1 #include "ERDecay26Oto24O2n.h" 3 #include "TVirtualMC.h" 4 #include "TLorentzVector.h" 5 #include "TMCProcess.h" 7 #include "FairRunSim.h" 13 #include "ERMCEventHeader.h" 15 ERDecay26Oto24O2n::ERDecay26Oto24O2n():
17 fDirectReactionFinish(kFALSE),
20 fRnd =
new TRandom3();
21 fPHSpace =
new TGenPhaseSpace();
22 FairRunSim* run = FairRunSim::Instance();
23 FairIon* ThirdIon =
new FairIon(
"ExpertThirdIon",8,24, 8);
24 run->AddNewIon(ThirdIon);
27 ERDecay26Oto24O2n::~ERDecay26Oto24O2n(){
31 Bool_t ERDecay26Oto24O2n::Init(){
33 fSecondIon = TDatabasePDG::Instance()->GetParticle(
"ExpertSecondIon");
35 std::cerr <<
"-W- ERDecay26Oto24O2n: Ion ExpertSecondIon not found in database!" << endl;
38 fThirdIon = TDatabasePDG::Instance()->GetParticle(
"ExpertThirdIon");
40 std::cerr <<
"-W- ERDecay26Oto24O2n: Ion not ExpertThirdIon found in database!" << endl;
45 Bool_t ERDecay26Oto24O2n::Stepping(){
46 if(!fDirectReactionFinish && gMC->TrackPid() == 1000080260){
48 gMC->SetMaxStep(0.01);
52 Bool_t destroied = kFALSE;
54 TLorentzVector curMomentum;
55 gMC->TrackMomentum(curMomentum);
56 TLorentzVector curPos;
57 gMC->TrackPosition(curPos);
59 Double_t momentum = TMath::Sqrt(curMomentum.X()*curMomentum.X() + curMomentum.Y()*curMomentum.Y() + curMomentum.Z()*curMomentum.Z());
60 Double_t fullEnergy = TMath::Sqrt(fSecondIon->Mass()*fSecondIon->Mass() + momentum*momentum);
63 Double_t betaCM = (fullEnergy-fSecondIon->Mass())/fullEnergy;
64 Double_t gammaCM = TMath::Sqrt( 1. / ( 1. - betaCM*betaCM) );
66 Double_t tau = fTauCM*gammaCM;
69 if (fRnd->Uniform() > TMath::Exp(-(gMC->TrackTime())*(1.0e09)/tau)){
70 FairRunSim* run = FairRunSim::Instance();
72 std::cout <<
"Start direct reaction. Current pos: " << curPos.Z() <<
" [cm] " << endl;
73 header->SetDirectReactionPos(curPos.Z());
75 TLorentzVector pSecIon(curMomentum.X(),curMomentum.Y(),curMomentum.Z(),fullEnergy);
80 masses[0] = fThirdIon->Mass();
83 if (!fPHSpace->SetDecay(pSecIon,3,masses)){
84 std::cerr <<
"ERDecay: the decay is forbidden by kinematics" <<endl;
85 fDirectReactionFinish = kTRUE;
91 TLorentzVector* pThirdIon = fPHSpace->GetDecay(0);
93 Int_t thirdIonPDG = fThirdIon->PdgCode();
95 std::cout <<
"-I- ERDecay: Generating ion of type " 96 << fThirdIon->GetName() <<
" (PDG code " << thirdIonPDG <<
")" << endl;
97 std::cout <<
" Momentum (" << pThirdIon->Px() <<
", " << pThirdIon->Py() <<
", " << pThirdIon->Pz()
98 <<
") Gev from vertex (" << curPos.X() <<
", " << curPos.Y() <<
", " << curPos.Z() <<
") cm" << endl;
100 gMC->GetStack()->PushTrack(1, 1, thirdIonPDG,
101 pThirdIon->Px(),pThirdIon->Py(),pThirdIon->Pz(),
102 pThirdIon->E(), curPos.X(), curPos.Y(), curPos.Z(),
103 gMC->TrackTime(), 0., 0., 0.,
104 kPDecay, newTrackNb, fThirdIon->Mass(), 0);
106 TLorentzVector* pNeutron1 = fPHSpace->GetDecay(1);
107 TLorentzVector* pNeutron2 = fPHSpace->GetDecay(2);
109 std::cout <<
"-I- ERGenerator: Generating neutron " << endl
110 <<
" Momentum (" << pNeutron1->Px() <<
", " << pNeutron1->Py() <<
", " << pNeutron1->Pz()
111 <<
") Gev from vertex (" << curPos.X() <<
", " << curPos.Y() <<
", " << curPos.Z() <<
") cm" << endl;
112 std::cout <<
"-I- ERGenerator: Generating neutron " << endl
113 <<
" Momentum (" << pNeutron2->Px() <<
", " << pNeutron2->Py() <<
", " << pNeutron2->Pz()
114 <<
") Gev from vertex (" << curPos.X() <<
", " << curPos.Y() <<
", " << curPos.Z() <<
") cm" << endl;
116 gMC->GetStack()->PushTrack(1, 1, 2112,
117 pNeutron1->Px(),pNeutron1->Py(),pNeutron1->Pz(),
118 pNeutron1->E(), curPos.X(), curPos.Y(), curPos.Z(),
119 gMC->TrackTime(), 0., 0., 0.,
120 kPDecay, newTrackNb, 0.939, 0);
121 gMC->GetStack()->PushTrack(1, 1, 2112,
122 pNeutron2->Px(),pNeutron2->Py(),pNeutron2->Pz(),
123 pNeutron2->E(), curPos.X(), curPos.Y(), curPos.Z(),
124 gMC->TrackTime(), 0., 0., 0.,
125 kPDecay, newTrackNb, 0.939, 0);
127 fDirectReactionFinish = kTRUE;
135 void ERDecay26Oto24O2n::BeginEvent(){
136 fDirectReactionFinish = kFALSE;
139 void ERDecay26Oto24O2n::FinishEvent(){