1 #include "ERDecay30Arto28S2p.h" 3 #include "TVirtualMC.h" 4 #include "TLorentzVector.h" 5 #include "TMCProcess.h" 7 #include "FairRunSim.h" 13 #include "ERMCEventHeader.h" 15 ERDecay30Arto28S2p::ERDecay30Arto28S2p():
17 fDirectReactionFinish(kFALSE),
20 fRnd =
new TRandom3();
21 fPHSpace =
new TGenPhaseSpace();
22 FairRunSim* run = FairRunSim::Instance();
23 FairIon* ThirdIon =
new FairIon(
"ExpertThirdIon",16,28,16);
24 run->AddNewIon(ThirdIon);
27 ERDecay30Arto28S2p::~ERDecay30Arto28S2p(){
31 Bool_t ERDecay30Arto28S2p::Init(){
34 std::cerr <<
"-W- ERDecay30Arto28S2p: Ion ExpertSecondIon not found in database!" << endl;
37 fThirdIon = TDatabasePDG::Instance()->GetParticle(
"ExpertThirdIon");
39 std::cerr <<
"-W- ERDecay30Arto28S2p: Ion not ExpertThirdIon found in database!" << endl;
45 Bool_t ERDecay30Arto28S2p::Stepping(){
46 if(!fDirectReactionFinish && gMC->TrackPid() == 1000180300){
47 fSecondIon = TDatabasePDG::Instance()->GetParticle(
"ExpertSecondIon");
49 gMC->SetMaxStep(0.01);
53 Bool_t destroied = kFALSE;
55 TLorentzVector curMomentum;
56 gMC->TrackMomentum(curMomentum);
57 TLorentzVector curPos;
58 gMC->TrackPosition(curPos);
60 Double_t momentum = TMath::Sqrt(curMomentum.X()*curMomentum.X() + curMomentum.Y()*curMomentum.Y() + curMomentum.Z()*curMomentum.Z());
61 Double_t fullEnergy = TMath::Sqrt(fSecondIon->Mass()*fSecondIon->Mass() + momentum*momentum);
64 Double_t betaCM = (fullEnergy-fSecondIon->Mass())/fullEnergy;
65 Double_t gammaCM = TMath::Sqrt( 1. / ( 1. - betaCM*betaCM) );
67 Double_t tau = fTauCM*gammaCM;
70 if (fRnd->Uniform() > TMath::Exp(-(gMC->TrackTime())*(1.0e09)/tau)){
71 FairRunSim* run = FairRunSim::Instance();
73 std::cout <<
"Start direct reaction. Current pos: " << curPos.Z() <<
" [cm] " << endl;
74 header->SetDirectReactionPos(curPos.Z());
76 TLorentzVector pSecIon(curMomentum.X(),curMomentum.Y(),curMomentum.Z(),fullEnergy);
81 masses[0] = fThirdIon->Mass();
84 if (!fPHSpace->SetDecay(pSecIon,3,masses)){
85 std::cerr <<
"ERDecay: the decay is forbidden by kinematics" <<endl;
86 fDirectReactionFinish = kTRUE;
92 TLorentzVector* pThirdIon = fPHSpace->GetDecay(0);
94 Int_t thirdIonPDG = fThirdIon->PdgCode();
96 std::cout <<
"-I- ERDecay: Generating ion of type " 97 << fThirdIon->GetName() <<
" (PDG code " << thirdIonPDG <<
")" << endl;
98 std::cout <<
" Momentum (" << pThirdIon->Px() <<
", " << pThirdIon->Py() <<
", " << pThirdIon->Pz()
99 <<
") Gev from vertex (" << curPos.X() <<
", " << curPos.Y() <<
", " << curPos.Z() <<
") cm" << endl;
101 gMC->GetStack()->PushTrack(1, 1, thirdIonPDG,
102 pThirdIon->Px(),pThirdIon->Py(),pThirdIon->Pz(),
103 pThirdIon->E(), curPos.X(), curPos.Y(), curPos.Z(),
104 gMC->TrackTime(), 0., 0., 0.,
105 kPDecay, newTrackNb, fThirdIon->Mass(), 0);
107 TLorentzVector* pNeutron1 = fPHSpace->GetDecay(1);
108 TLorentzVector* pNeutron2 = fPHSpace->GetDecay(2);
110 std::cout <<
"-I- ERGenerator: Generating neutron " << endl
111 <<
" Momentum (" << pNeutron1->Px() <<
", " << pNeutron1->Py() <<
", " << pNeutron1->Pz()
112 <<
") Gev from vertex (" << curPos.X() <<
", " << curPos.Y() <<
", " << curPos.Z() <<
") cm" << endl;
113 std::cout <<
"-I- ERGenerator: Generating neutron " << endl
114 <<
" Momentum (" << pNeutron2->Px() <<
", " << pNeutron2->Py() <<
", " << pNeutron2->Pz()
115 <<
") Gev from vertex (" << curPos.X() <<
", " << curPos.Y() <<
", " << curPos.Z() <<
") cm" << endl;
117 gMC->GetStack()->PushTrack(1, 1, 2212,
118 pNeutron1->Px(),pNeutron1->Py(),pNeutron1->Pz(),
119 pNeutron1->E(), curPos.X(), curPos.Y(), curPos.Z(),
120 gMC->TrackTime(), 0., 0., 0.,
121 kPDecay, newTrackNb, 0.938, 0);
122 gMC->GetStack()->PushTrack(1, 1, 2212,
123 pNeutron2->Px(),pNeutron2->Py(),pNeutron2->Pz(),
124 pNeutron2->E(), curPos.X(), curPos.Y(), curPos.Z(),
125 gMC->TrackTime(), 0., 0., 0.,
126 kPDecay, newTrackNb, 0.938, 0);
128 fDirectReactionFinish = kTRUE;
136 void ERDecay30Arto28S2p::BeginEvent(){
137 fDirectReactionFinish = kFALSE;
140 void ERDecay30Arto28S2p::FinishEvent(){