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") || particle.Contains("pASystem")) && (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  //Initialize the generator - read in the decay table and particle properties
94 
95  EvtRandomEngine* myRandomEngine=0;
96 
97  // Make sure that the seed is always set if default value (-1) is used, JGM, August 2011
98  if (Seed<0)
99  {
100  Seed = gRandom->GetSeed();
101  cout << "<I> Rnd Seed changed to " << Seed << endl;
102  }
103  myRandomEngine=new EvtRootRandomEngine(Seed);
104 
105 
106  // Set up the default external generator list: Photos, Pythia and/or Tauola ONLY if available
107 #if EVTGEN_EXTERNAL
108  EvtExternalGenList genList;
109  EvtAbsRadCorr* radCorrEngine = genList.getPhotosModel();
110  std::list<EvtDecayBase*> extraModels = genList.getListOfModels();
111 
112  // Create the EvtGen generator object
113  myGenerator=new EvtGen(defaultDECAY,defaultPDL,myRandomEngine,
114  radCorrEngine, &extraModels);
115 #else
116  //If you don't want to use external generators, use the following:
117  myGenerator=new EvtGen(defaultDECAY,defaultPDL,myRandomEngine);
118 #endif
119 
120  //If I wanted a user decay file, I would read it in now.
121  if(decfile!="") myGenerator->readUDecay(decfile.Data());
122 
123  PART=EvtPDL::getId(std::string(particle.Data()));
124 
125  double val=-3.0969;
126  fMomentum = 0.0;
127  fEnergy = 0.0;
128  double mp=0.938272;
129  double md=1.875613;
130  double mu=0.931494;
131  double mA=ATarg*mu;
132 
133  if ( particle.Contains("pbarp") || particle.Contains("pbard") || particle.Contains("pbarA") || particle.Contains("pp") || particle.Contains("pd") || particle.Contains("pA") ) {
134  if (Mom==0) {
135  cerr <<"\033[5m\033[31m -E ****** FATAL ERROR: <particle> is '" << particle.Data() << "'; MUST give pbar momentum or cms energy!\033[0m"<<endl;
136  exit(0);
137  } else {
138  val=Mom;
139  }
140  } else {
141  if(PART.getId()==-1) {
142  cerr << "Particle \""<<particle<<"\" is unknown!!!"<<endl<<"Check your Macro for spelling mistake."<<endl;
143  exit(0);
144  }
145  val=-EvtPDL::getMass(PART);
146  }
147 
148  // val is the momentum of the beam
149  if (val>0) {
150  fMomentum = val;
151  if ( particle.Contains("pbarpSystem") || particle.Contains("ppSystem")) fEnergy = mp+sqrt(fMomentum*fMomentum+mp*mp);
152  if ( particle.Contains("pbardSystem") || particle.Contains("pdSystem")) fEnergy = md+sqrt(fMomentum*fMomentum+mp*mp);
153  if ( particle.Contains("pbarASystem") || particle.Contains("pASystem")) fEnergy = mA+sqrt(fMomentum*fMomentum+mp*mp);
154  } else { //val is -E_cm
155  val=-val;
156  fEnergy = val*val/(2*mp);
157  fMomentum = sqrt(fEnergy*fEnergy-val*val);
158  }
159 
160  cout <<"\n############# Generating with following conditions:\n\n";
161  cout <<"incident 4-mom : ("<<fEnergy<<", 0, 0, "<<fMomentum<<"), m = "<<sqrt(fEnergy*fEnergy-fMomentum*fMomentum)<<endl;
162  cout <<"\n######################\n\n"<<endl;
163 
164 }
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 168 of file PndEvtGenDirect.cxx.

168  {
169 
170 }

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 174 of file PndEvtGenDirect.cxx.

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

174  {
175  static Int_t evtnr=0;
176  // Loop to create nEvents, starting from an Upsilon(4S)
177  // Set up the parent particle
178  EvtParticle *parent;
179 
180  EvtVector4R pInit(fEnergy, 0.0000, -0.0000, fMomentum);
181  parent=EvtParticleFactory::particleFactory(PART,pInit);
182  parent->setDiagonalSpinDensity();
183 
184  // Generate the event
185  myGenerator->generateDecay(parent);
186  // Write out the results
187 
188  // we should better use the EvtParticle properties here... and kick the evtstd structure!!!!
189  evtstdhep.init();
190  parent->makeStdHep(evtstdhep);
191 
192  Bool_t plotflag;
193  plotflag=false;
194  //print out some status info
195  if (verbose>1 ||(verbose==1 && (evtnr<10 || ((evtnr+1)%100)==0))) {
196  cout << "PndEvtGenDirect::ReadEvent "<<evtnr <<" "<<fEnergy<<" "<<fMomentum << endl;
197  parent->printParticle();
198  // Write out the results
199  EvtHepMCEvent theEvent;
200  theEvent.constructEvent(parent);
201  HepMC::GenEvent* genEvent = theEvent.getEvent();
202  genEvent->print(std::cout);
203 
204  // report(INFO,"EvtGen") << "event Number\t"<< evtnr << evtstdhep << endl;
205  // cout << evtnr << "\t" << evtstdhep.getNPart();
206  // cout <<evtstdhep<<endl;
207 
208  cout <<"==== now compare ==="<<endl;
209  plotflag=true;
210  }
211 
212  // Write the output
213 
214  Int_t npart;
215  Double_t fX, fY, fZ, fT;
216  double Px,Py,Pz, fE; // ,Pm[1000],Wh[1000];
217  int Id;
218  npart=evtstdhep.getNPart();
219  EvtVector4R vxyz,pxyz;
220 
221  for(Int_t i=0; i<npart; i++) {
222  Int_t nFD, nLD;
223  // add track
224  nFD=evtstdhep.getFirstDaughter(i);
225  nLD=evtstdhep.getLastDaughter(i);
226  if(fStoreTree ||(nFD==-1 && nLD==-1))
227  {
228  Id=evtstdhep.getStdHepID(i);
229  vxyz=evtstdhep.getX4(i);
230  pxyz=evtstdhep.getP4(i);
231  fT=vxyz.get(0)/(1000*TMath::C()); //mm - > s conversion
232  fX=vxyz.get(1)/10.; // mm -> cm conversion
233  fY=vxyz.get(2)/10.; // mm -> cm conversion
234  fZ=vxyz.get(3)/10.; // mm -> cm conversion
235  fE=pxyz.get(0);
236  Px=pxyz.get(1);
237  Py=pxyz.get(2);
238  Pz=pxyz.get(3);
239  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,
240  fX, fY, fZ, fT,Px, Py, Pz, fE, Id, nFD, nLD,evtstdhep.getFirstMother(i),evtstdhep.getLastMother(i));
241  if(fStoreTree) {
242  primGen->AddTrack(Id, Px, Py, Pz, fX, fY, fZ, evtstdhep.getFirstMother(i),(nFD==-1 && nLD==-1),fE,fT);
243  } else {
244  primGen->AddTrack(Id, Px, Py, Pz, fX, fY, fZ,-1,true,fE,fT);// default -1, true
245  }
246  }
247  }
248  if(plotflag) cout <<"==== compare end ==="<<endl;
249 
250  parent->deleteTree();
251 
252  evtnr++;
253 
254  return kTRUE;
255 
256 }
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: