FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndEvtGenDirect Class Reference

#include <PndEvtGenDirect.h>

Inheritance diagram for PndEvtGenDirect:

Public Member Functions

 PndEvtGenDirect ()
 
 PndEvtGenDirect (TString particle, TString decfile="", Double_t Mom=0, Long_t Seed=-1, TString defDECAY="", TString defPDL="", Double_t ATarg=0.0)
 
virtual ~PndEvtGenDirect ()
 
virtual Bool_t ReadEvent (FairPrimaryGenerator *primGen)
 
void SetStoreTree (Bool_t store=true)
 
void SetVerbose (int v=1)
 

Private Member Functions

 ClassDef (PndEvtGenDirect, 1)
 The mother particle. More...
 

Private Attributes

Bool_t fStoreTree
 
Int_t verbose
 
Double_t fEnergy
 
Double_t fMomentum
 Energy of System. More...
 
EvtGen * myGenerator
 Momentum of System. More...
 
EvtStdHep evtstdhep
 Pointer to the actual EvtGen. More...
 
EvtId PART
 The decay tree. More...
 

Detailed Description

Definition at line 28 of file PndEvtGenDirect.h.

Constructor & Destructor Documentation

PndEvtGenDirect::PndEvtGenDirect ( )

Default constructor (should not be used)

Definition at line 65 of file PndEvtGenDirect.cxx.

References SetName, and verbose.

65  {
66  SetName("PndEvtGenDirect");
67  fStoreTree=false;
68  verbose=0;
69 }
cout<< "-----------------------------------------------> Quarter VOLUME<<endl;name="QuarterShape";QuarterShape=newTGeoArb8(name,dz,vertQuar);name="Quarter4Vol";TStringmedium="air";QuarterVol=newTGeoVolumeAssembly(name);name="SubunitShape";SubunitShape=newTGeoArb8(name,dz,vertSub);TStringmedium="air";name="SubunitVol";name1="SubunitVol1";name2="SubunitVol2";name3="SubunitVol3";name4="SubunitVol4";name5="SubunitVol5";name6="SubunitVol6";name7="SubunitVol7";name8="SubunitVol8";name9="SubunitVol9";SubunitVol=newTGeoVolumeAssembly(name);SubunitVol1=newTGeoVolumeAssembly(name1);SubunitVol2=newTGeoVolumeAssembly(name2);SubunitVol3=newTGeoVolumeAssembly(name3);SubunitVol4=newTGeoVolumeAssembly(name4);SubunitVol5=newTGeoVolumeAssembly(name5);SubunitVol6=newTGeoVolumeAssembly(name6);SubunitVol7=newTGeoVolumeAssembly(name7);SubunitVol8=newTGeoVolumeAssembly(name8);SubunitVol9=newTGeoVolumeAssembly(name9);name="BoxShape";BoxShape=newTGeoArb8(name,dz,vertBox);TStringmedium="air";name="BoxVol";BoxVol=newTGeoVolumeAssembly(name);name1="BoxVol1";name2="BoxVol2";name3="BoxVol3";name4="BoxVol4";BoxVol1=newTGeoVolumeAssembly(name1);BoxVol2=newTGeoVolumeAssembly(name2);BoxVol3=newTGeoVolumeAssembly(name3);BoxVol4=newTGeoVolumeAssembly(name4);for(Int_tb=0;b<kNumOfBoxes;b++){cout<<""<<endl;cout<<"---------------->BOXnumber:"<<b<<endl;if(b==0){trBox=newTGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(0.465518);rotBox.RotateY(-0.465518);}if(b==1){trBox=newTGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(-0.465518);rotBox.RotateY(0.465518);}if(b==2){trBox=newTGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(-0.465518);rotBox.RotateY(-0.465518);}if(b==3){trBox=newTGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(0.465518);rotBox.RotateY(0.465518);}TGeoCombiTrans*trrotBox=newTGeoCombiTrans(trBox,rotBox);name="BoxVol";name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol->AddNode(BoxVol,b,trrotBox);if(b==1){name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol1->AddNode(BoxVol,b,trrotBox);}if(b==2){name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol2->AddNode(BoxVol1,b,trrotBox);}if(b==0){name+=b;trrotBox-> SetName(name)
PndEvtGenDirect::PndEvtGenDirect ( TString  particle,
TString  decfile = "",
Double_t  Mom = 0,
Long_t  Seed = -1,
TString  defDECAY = "",
TString  defPDL = "",
Double_t  ATarg = 0.0 
)

Definition at line 73 of file PndEvtGenDirect.cxx.

References exit(), mp, sqrt(), TString, and val.

73  {
75 
76  cout << "<I> PndEvtGenDirect"<<endl;
77  cout << "<I> Particle: "<<particle<<endl;
78  cout << "<I> decfile: "<<decfile<<endl;
79  if(Mom>0) cout << "<I> pbar-Momentum: "<<Mom<<endl;
80  if(Mom==0) cout << "<I> Momentum: "<<Mom<<endl;
81  if(Mom<0) cout << "<I> CMS energy: "<<Mom<<endl;
82  cout << "<I> Rnd Seed: "<<Seed<<endl;
83  TString work = getenv("VMCWORKDIR");
84  if (defaultDECAY=="") defaultDECAY = work + "/pgenerators/EvtGen/EvtGen/Private/DECAY.DEC";
85  if (defaultPDL=="") defaultPDL = work + "/pgenerators/EvtGen/EvtGen/Private/evt.pdl";
86 
87  if (particle.Contains("pbarASystem") && (ATarg<3.||ATarg>238.))
88  {
89  cerr <<"****** FATAL ERROR: nuclear target mass number MUST be between 3 and 238! ******"<<endl;
90  exit(0);
91  }
92 
93 
94 
95  //Initialize the generator - read in the decay table and particle properties
96 
97  EvtRandomEngine* myRandomEngine=0;
98 
99  // Make sure that the seed is always set if default value (-1) is used, JGM, August 2011
100  if (Seed<0)
101  {
102  Seed = gRandom->GetSeed();
103  cout << "<I> Rnd Seed changed to " << Seed << endl;
104  }
105  myRandomEngine=new EvtRootRandomEngine(Seed);
106 
107 
108  // Set up the default external generator list: Photos, Pythia and/or Tauola ONLY if available
109 #if EVTGEN_EXTERNAL
110  EvtExternalGenList genList;
111  EvtAbsRadCorr* radCorrEngine = genList.getPhotosModel();
112  std::list<EvtDecayBase*> extraModels = genList.getListOfModels();
113 
114  // Create the EvtGen generator object
115  myGenerator=new EvtGen(defaultDECAY,defaultPDL,myRandomEngine,
116  radCorrEngine, &extraModels);
117 #else
118  //If you don't want to use external generators, use the following:
119  myGenerator=new EvtGen(defaultDECAY,defaultPDL,myRandomEngine);
120 #endif
121 
122  //If I wanted a user decay file, I would read it in now.
123  if(decfile!="") myGenerator->readUDecay(decfile.Data());
124 
125  PART=EvtPDL::getId(std::string(particle.Data()));
126 
127  if ( (particle.Contains("pbarp") || particle.Contains("pbard") || particle.Contains("pbarA")) && Mom==0)
128  {
129  cerr <<"\033[5m\033[31m -E ****** FATAL ERROR: <particle> is '" << particle.Data() << "'; MUST give pbar momentum or cms energy!\033[0m"<<endl;
130  exit(0);
131  }
132 
133  double val=-3.0969;
134  fMomentum = 0.0;
135  fEnergy = 0.0;
136  double mp=0.938272;
137  double md=1.875613;
138  double mu=0.931494;
139  double mA=ATarg*mu;
140 
141  if ( (particle.Contains("pbarp") || particle.Contains("pbard") || particle.Contains("pbarA") ) && Mom!=0){
142  val=Mom;
143  }else{
144  if(PART.getId()==-1){
145  cerr << "Particle \""<<particle<<"\" is unknown!!!"<<endl<<"Check your Macro for spelling mistake."<<endl;
146  exit(0);
147  }
148  val=-EvtPDL::getMass(PART);
149  }
150 
151  // val is the momentum of the pbar beam
152  if (val>0){
153  fMomentum = val;
154  if ( particle.Contains("pbarpSystem") ) fEnergy = mp+sqrt(fMomentum*fMomentum+mp*mp);
155  if ( particle.Contains("pbardSystem") ) fEnergy = md+sqrt(fMomentum*fMomentum+mp*mp);
156  if ( particle.Contains("pbarASystem") ) fEnergy = mA+sqrt(fMomentum*fMomentum+mp*mp);
157  }
158  else //val is -E_cm
159  {
160  val=-val;
161  fEnergy = val*val/(2*mp);
162  fMomentum = sqrt(fEnergy*fEnergy-val*val);
163  }
164 
165  cout <<"\n############# Generating with following conditions:\n\n";
166  cout <<"incident 4-mom : ("<<fEnergy<<", 0, 0, "<<fMomentum<<"), m = "<<sqrt(fEnergy*fEnergy-fMomentum*fMomentum)<<endl;
167  cout <<"\n######################\n\n"<<endl;
168 
169 }
Double_t fMomentum
Energy of System.
exit(0)
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
EvtGen * myGenerator
Momentum of System.
static const double mp
Definition: mzparameters.h:11
const int particle
EvtId PART
The decay tree.
PndEvtGenDirect::~PndEvtGenDirect ( )
virtual

Destructor

Definition at line 173 of file PndEvtGenDirect.cxx.

173  {
174 
175 }

Member Function Documentation

PndEvtGenDirect::ClassDef ( PndEvtGenDirect  ,
 
)
private

The mother particle.

Bool_t PndEvtGenDirect::ReadEvent ( FairPrimaryGenerator *  primGen)
virtual

Generate one event using EVT

Parameters
primGenpointer to the FairPrimaryGenerator

Definition at line 179 of file PndEvtGenDirect.cxx.

References Bool_t, C(), Double_t, fT, fX, fY, fZ, i, printf(), and verbose.

179  {
180  static Int_t evtnr=0;
181  // Loop to create nEvents, starting from an Upsilon(4S)
182  // Set up the parent particle
183  EvtParticle *parent;
184 
185  EvtVector4R pInit(fEnergy, 0.0000, -0.0000, fMomentum);
186  parent=EvtParticleFactory::particleFactory(PART,pInit);
187  parent->setDiagonalSpinDensity();
188 
189 
190  // Generate the event
191  myGenerator->generateDecay(parent);
192  // Write out the results
193 
194  // we should better use the EvtParticle properties here... and kick the evtstd structure!!!!
195  evtstdhep.init();
196  parent->makeStdHep(evtstdhep);
197 
198  Bool_t plotflag;
199  plotflag=false;
200  //print out some status info
201  if (verbose>1 ||(verbose==1 && (evtnr<10 || ((evtnr+1)%100)==0))){
202  cout << "PndEvtGenDirect::ReadEvent "<<evtnr <<" "<<fEnergy<<" "<<fMomentum << endl;
203  parent->printParticle();
204  // Write out the results
205  EvtHepMCEvent theEvent;
206  theEvent.constructEvent(parent);
207  HepMC::GenEvent* genEvent = theEvent.getEvent();
208  genEvent->print(std::cout);
209 
210 // report(INFO,"EvtGen") << "event Number\t"<< evtnr << evtstdhep << endl;
211 // cout << evtnr << "\t" << evtstdhep.getNPart();
212 // cout <<evtstdhep<<endl;
213 
214  cout <<"==== now compare ==="<<endl;
215  plotflag=true;
216  }
217 
218  // Write the output
219 
220  Int_t npart;
221  Double_t fX, fY, fZ, fT;
222  double Px,Py,Pz, fE; // ,Pm[1000],Wh[1000];
223  int Id;
224  npart=evtstdhep.getNPart();
225  EvtVector4R vxyz,pxyz;
226 
227  for(Int_t i=0; i<npart; i++){
228  Int_t nFD, nLD;
229  // add track
230  nFD=evtstdhep.getFirstDaughter(i);
231  nLD=evtstdhep.getLastDaughter(i);
232  if(fStoreTree ||(nFD==-1 && nLD==-1))
233  {
234  Id=evtstdhep.getStdHepID(i);
235  vxyz=evtstdhep.getX4(i);
236  pxyz=evtstdhep.getP4(i);
237  fT=vxyz.get(0)/(1000*TMath::C()); //mm - > s conversion
238  fX=vxyz.get(1)/10.; // mm -> cm conversion
239  fY=vxyz.get(2)/10.; // mm -> cm conversion
240  fZ=vxyz.get(3)/10.; // mm -> cm conversion
241  fE=pxyz.get(0);
242  Px=pxyz.get(1);
243  Py=pxyz.get(2);
244  Pz=pxyz.get(3);
245  if(plotflag) printf("- I -: new particle %d at: %f, %f, %f (%f)-> %f %f %f (%f) ID %d ##Daughters %d %d Mothers %d %d\n", i,
246  fX, fY, fZ, fT,Px, Py, Pz, fE, Id, nFD, nLD,evtstdhep.getFirstMother(i),evtstdhep.getLastMother(i));
247  if(fStoreTree){
248  primGen->AddTrack(Id, Px, Py, Pz, fX, fY, fZ, evtstdhep.getFirstMother(i),(nFD==-1 && nLD==-1),fE,fT);
249  }else{
250  primGen->AddTrack(Id, Px, Py, Pz, fX, fY, fZ,-1,true,fE,fT);// default -1, true
251  }
252  }
253  }
254  if(plotflag) cout <<"==== compare end ==="<<endl;
255 
256  parent->deleteTree();
257 
258  evtnr++;
259 
260  return kTRUE;
261 
262 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Double_t fMomentum
Energy of System.
Int_t i
Definition: run_full.C:25
TClonesArray * fT
Definition: drawGLTracks.C:13
Double_t fX
Definition: PndCaloDraw.cxx:34
EvtGen * myGenerator
Momentum of System.
Double_t fZ
Definition: PndCaloDraw.cxx:34
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
int Pic_FED Eff_lEE C()
Double_t
EvtId PART
The decay tree.
Double_t fY
Definition: PndCaloDraw.cxx:34
EvtStdHep evtstdhep
Pointer to the actual EvtGen.
void PndEvtGenDirect::SetStoreTree ( Bool_t  store = true)
inline
void PndEvtGenDirect::SetVerbose ( int  v = 1)
inline

Definition at line 48 of file PndEvtGenDirect.h.

References v, and verbose.

Referenced by runSim().

48 {verbose=v;};
__m128 v
Definition: P4_F32vec4.h:4

Member Data Documentation

EvtStdHep PndEvtGenDirect::evtstdhep
private

Pointer to the actual EvtGen.

Definition at line 61 of file PndEvtGenDirect.h.

Double_t PndEvtGenDirect::fEnergy
private

P_lab(GeV/c)

Definition at line 57 of file PndEvtGenDirect.h.

Double_t PndEvtGenDirect::fMomentum
private

Energy of System.

Definition at line 58 of file PndEvtGenDirect.h.

Bool_t PndEvtGenDirect::fStoreTree
private

Definition at line 48 of file PndEvtGenDirect.h.

Referenced by SetStoreTree().

EvtGen* PndEvtGenDirect::myGenerator
private

Momentum of System.

Definition at line 60 of file PndEvtGenDirect.h.

EvtId PndEvtGenDirect::PART
private

The decay tree.

Definition at line 62 of file PndEvtGenDirect.h.

Int_t PndEvtGenDirect::verbose
private

Definition at line 53 of file PndEvtGenDirect.h.

Referenced by SetVerbose().


The documentation for this class was generated from the following files: