#ifndef ___STRUCTS_HELPERS___ #define ___STRUCTS_HELPERS___ #include "TVector3.h" #include "TLorentzVector.h" #include "TDatabasePDG.h" #include "TParticlePDG.h" #include "TDecayChannel.h" #include "TObjArray.h" #include "TString.h" #include "TFile.h" #include "TTree.h" #include "TClonesArray.h" #include #include #include #include #include #include #include "pid_converters.h" using namespace std; //######################## INPUT PARAMETERS ############################## struct parameters { Int_t verbose_flag; TString infile; TString outfile; Int_t nevents; Int_t help; Int_t doIncludeSpectators; Int_t doRecoRho; Int_t doRecoOmega; Int_t doRecoPhi; Int_t doSecondDecay; Int_t doPluto; Int_t doTree; Int_t doBoost; TString boostConfig; UInt_t seed; TString databasefile; void print() { cerr<<"current parameters :"< LAB // (provived by the -b option string) Double_t calcGamma(Double_t beta) { return sqrt(1 - beta*beta); } Double_t calcBeta (Double_t Ekin=1.23) // Ekin/u [GeV], { const Double_t mP = 0.938272, mN = 0.939565; // GeV Double_t m = (mP+mN)/2.; return sqrt(pow(Ekin + m, 2.) - pow(m, 2.)) / (Ekin + 2*m); } //------------------------------------------------------ void reset(){ evtNr = nParticle =0; impact=eBeam=gamma=beta=flag=0; } void print(){ cout<<"-------------------------------------------------------------------"< 0 ) return kFALSE; if(b.state < 0 && a.state > 0 ) return kTRUE; return (a.form_time) < (b.form_time); } Bool_t sortState (smash_p& a, smash_p& b) { return (a.state) > (b.state); } //######################################################################## struct mapDecay { map > > mPDGDecayList; map > mPDGDecayListStat; map > mPDGDecayListID; map > >::iterator it; map >::iterator it2; vector vIds; Bool_t compDaughters(const vector& d1,const vector& d2) { if(d1.size() != d2.size()) return kFALSE; for(UInt_t i = 0 ; i < d1.size(); i++){ if(find(d2.begin(),d2.end(),d1[i]) == d2.end()) return kFALSE; } return kTRUE; } Bool_t findDecay(Int_t pdg,UInt_t& ich,Int_t& srcID, const vector& vdaughters,Bool_t count=kTRUE) { ich = 99; srcID = -1; it = mPDGDecayList.find(pdg); if(it == mPDGDecayList.end()) return kFALSE; vector >& vdecays = it->second; for(UInt_t i = 0; i < vdecays.size(); i++){ vector& d = vdecays[i]; if(compDaughters(vdaughters,d)){ if(count)mPDGDecayListStat[pdg][i]++; srcID = mPDGDecayListID[pdg][i]; ich = i; return kTRUE; } } return kFALSE; } const vector& getDecayDaughters(Int_t pdgID,UInt_t ich){ return mPDGDecayList[pdgID][ich]; } Int_t getDecayStat(Int_t pdgID,UInt_t ich){ return mPDGDecayListStat[pdgID][ich]; } Int_t getDecaySourceID(Int_t pdgID,UInt_t ich){ return mPDGDecayListID[pdgID][ich]; } void printDecay(TDatabasePDG& PDG,Int_t id,Int_t ich){ it = mPDGDecayList.find(id); if(it == mPDGDecayList.end()) return; it2 = mPDGDecayListID.find(id); vector& d = mPDGDecayList[id][ich]; cout<<"Mother PDG "<GetName()<<") "<GetName()); } cout<first<<" ("<first)->GetName()<<") "< >& vdecays = it->second; it2 = mPDGDecayListID.find(it->first); vector& vID = it2->second; for(UInt_t i = 0; i < vdecays.size(); i++){ vector& d = vdecays[i]; cout<<"channel "<GetName()); } it2 = mPDGDecayListStat.find(it->first); if(d.size() == 2)cout<second[i]<second[i]< > vdecays; vector vstat; vector vid; vector vdgeant; TObjArray* a = p->DecayList(); for(Int_t i = 0 ; i < a->GetEntries(); i++){ TDecayChannel* ch = (TDecayChannel*) a->At(i); vector daughters; for(Int_t j = 0 ; j < ch->NDaughters(); j ++){ Int_t pid_daughter = ch->DaughterPdgCode(j); daughters.push_back(pid_daughter); } vdgeant.clear(); Int_t geantID_mother = getPdgPIDtoGeant3(PDG,pid,kTRUE); for(UInt_t j = 0 ; j < daughters.size(); j++) vdgeant.push_back(getPdgPIDtoGeant3(PDG,daughters[j], kTRUE)); Int_t sourceID = createSourceID(geantID_mother,vdgeant); vdecays.push_back(daughters); vstat .push_back(0); vid .push_back(sourceID); } mPDGDecayList [pid] = vdecays; mPDGDecayListStat[pid] = vstat; mPDGDecayListID [pid] = vid; } else { cout<<"fillDecayMap() : ID = "<& d) { // adds the new decay channel (does not check if the channel exists already) vector vgeant; Int_t geantID_mother = getPdgPIDtoGeant3(PDG,pid,kTRUE); for(UInt_t j = 0 ; j < d.size(); j++) vgeant.push_back(getPdgPIDtoGeant3(PDG,d[j], kTRUE)); Int_t sourceID = createSourceID(geantID_mother,vgeant); it = mPDGDecayList.find(pid); if(it == mPDGDecayList.end()) { vector > vdecays; vector daughters = d; vector vstat; vector vid; vstat .push_back(0); vid .push_back(sourceID); vdecays.push_back(daughters); mPDGDecayList [pid] = vdecays; mPDGDecayListStat[pid] = vstat; mPDGDecayListStat[pid] = vid; } else { vector daughters = d; vector >& vdecays = it->second; it2 = mPDGDecayListStat.find(pid); it2->second.push_back(0); it2 = mPDGDecayListID.find(pid); it2->second.push_back(sourceID); vdecays.push_back(daughters); } } void removeDecay(Int_t pid,UInt_t ich) { // remove the decay channel ich it = mPDGDecayList.find(pid); if(it == mPDGDecayList.end()) return; vector >& vdecays = it->second; if(ich < vdecays.size()) { vdecays.erase(vdecays.begin()+ich); it2 = mPDGDecayListStat.find(pid); it2->second.erase(it2->second.begin()+ich); it2 = mPDGDecayListID.find(pid); it2->second.erase(it2->second.begin()+ich); } } void init(TDatabasePDG& PDG){ //vIds.push_back( 111); // pi0 //vIds.push_back( 221); // eta vIds.push_back( 113); // rho0 vIds.push_back( 213); // rho+ vIds.push_back(-213); // rho- vIds.push_back( 223); // w vIds.push_back( 333); // phi for(UInt_t i = 0 ; i < vIds.size(); i++){ fillDecayMap(PDG,vIds[i]); } Int_t chw[3][2] = { { 113, 111}, // rho0 pi0 { 213,-211}, // rho+ pi- {-213, 211}, // rho- pi+ }; vector d; for(Int_t i = 0; i < 3; i++){ d.clear(); for(Int_t j = 0; j < 2; j++){ d.push_back(chw[i][j]); } addDecay(PDG,223,d); } Int_t chphi [2] = { 311, -311 //K0 K0bar }; d.clear(); for(Int_t j = 0; j < 2; j++){ d.push_back(chphi[j]); } addDecay(PDG,333,d); printDecayMap(PDG); } }; //###################### COLLECT GLOABAL OBJECTS ######################### struct objects { TDatabasePDG PDG; smash_evt evt; vector particles; ofstream out; TString input; TString output; Int_t nEvts; Int_t debug; TFile* PLUTO_out ; TTree* PLUTO_tree ; TClonesArray* PLUTO_evt ; Int_t PLUTO_npart; Double_t PLUTO_impact; Double_t PLUTO_evtplane; map mProcID; mapDecay mDecay; void init(){ mProcID[0 ]="No previous process yet, particle was created at initialization"; mProcID[1 ]="Elastic scattering"; mProcID[2 ]="Resonance formation (2 -> 1)"; mProcID[3 ]="Inelastic binary scattering (2 -> 2)"; mProcID[4 ]="Inelastic multi-particle scattering (2 -> 3)"; mProcID[5 ]="Resonance decay"; mProcID[6 ]="Box wall crossing (due to periodic boundary conditions)"; mProcID[7 ]="Forced thermalization, many particles are replaced by a thermalized ensemble"; mProcID[8 ]="Hypersurface crossing, Particles are removed from the evolution and printed to a separate output to serve as initial conditions for hybrid models."; mProcID[9 ]="Bremsstrahlung process: a + b -> a + b + photon"; mProcID[10]="Inelastic multi-particle meson scattering (3 -> 1)"; mProcID[11]="Inelastic multi-particle scattering (3 -> 2)"; mProcID[12]="Inelastic multi-particle scattering (5 -> 2)"; mProcID[13]="Inelastic multi-particle scattering (2 -> 5)"; mProcID[14]="Inelastic multi-particle scattering (4 -> 2)"; mProcID[15]="Inelastic multi-particle scattering (2 -> 4)"; mProcID[41]="Soft string excitation, single diffractive AB -> AX. Both quark and anti-/di-quark taken from B."; mProcID[42]="Soft string excitation, single diffractive AB -> XB. Both quark and anti-/di-quark taken from A. It makes sense to distinguish it from AB -> AX, because A and B can be particles of different types, for example, a pion and a proton. It matters then, whether the pion creates a string or the proton."; mProcID[43]="Soft string excitation, double diffractive. Two strings are formed, one from A and one from B."; mProcID[44]="Soft string N-Nbar annihilation, a special case of baryon-antibaryon annihilation. One pair qqbar annihilates immediately and then two strings are formed."; mProcID[45]="Soft string excitation, non-diffractive. Two strings are formed both have ends in A and B."; mProcID[46]="Hard string excitation, hard string process involving 2 -> 2 QCD process by PYTHIA. Here quarks do not simply form a string. They actually scatter on parton level first."; mProcID[47]="Failed string process, Soft String NNbar annihilation process can fail by lack of energy. This is a tag we add to avoid mislabeling the events."; mProcID[90]="Add or remove particle(s) process, which ignores conservation laws. It can be thought of as a 0 -> 1 or a 1 -> 0 process."; mDecay.init(PDG); } void printEvent(TString message) { evt.print(); cout<<"NPart " <