diff --git a/r3bgen/R3BINCLRootGenerator.cxx b/r3bgen/R3BINCLRootGenerator.cxx index 4a8b33bf8..bfdde8edc 100644 --- a/r3bgen/R3BINCLRootGenerator.cxx +++ b/r3bgen/R3BINCLRootGenerator.cxx @@ -86,6 +86,7 @@ bool R3BINCLRootGenerator::ReadEvent(FairPrimaryGenerator* primGen) if (!validevent) { fEvt++; + continue; } } else if (fOnlySpallation) @@ -96,8 +97,34 @@ bool R3BINCLRootGenerator::ReadEvent(FairPrimaryGenerator* primGen) if (!validevent) { fEvt++; + continue; } } + + else if (fOnlyP2pSpallation) + { + Int_t nbp = 0; + for (Int_t j = 0; j < fParticles; j++) + if (fOrigin[j] == 0) + validevent = true; + if (!validevent) + { + fEvt++; + continue; + } + + for (Int_t j = 0; j < fParticles; j++) + if (fPdgCode[j] == 2212) + nbp++; + + if (nbp != 2 && validevent) + { + fEvt++; + validevent = false; + continue; + } + } + else if (fOnlyP2pFission) { Int_t nbp = 0; @@ -107,6 +134,7 @@ bool R3BINCLRootGenerator::ReadEvent(FairPrimaryGenerator* primGen) if (!validevent) { fEvt++; + continue; } for (Int_t j = 0; j < fParticles; j++) @@ -117,14 +145,45 @@ bool R3BINCLRootGenerator::ReadEvent(FairPrimaryGenerator* primGen) { fEvt++; validevent = false; + continue; } } + + else if (fOnlyPpnSpallation) + { + Int_t nbp = 0; + Int_t nbn = 0; + for (Int_t j = 0; j < fParticles; j++) + if (fOrigin[j] == 0) + validevent = true; + if (!validevent) + { + fEvt++; + continue; + } + + for (Int_t j = 0; j < fParticles; j++) + { + if (fPdgCode[j] == 2212) + nbp++; + if (fPdgCode[j] == 2112) + nbn++; + } + + if ((nbp != 1 || nbn != 1) && validevent) + { + fEvt++; + validevent = false; + continue; + } + } + else { validevent = true; } - if (fEvt > fEvtRoot) + if (fEvt >= fEvtRoot) { LOG(error) << "\033[5m\033[31m R3BINCLRootGenerator: Number of simulated events larger than the ones contained " diff --git a/r3bgen/R3BINCLRootGenerator.h b/r3bgen/R3BINCLRootGenerator.h index 0bcb36b5d..7e2113eb4 100644 --- a/r3bgen/R3BINCLRootGenerator.h +++ b/r3bgen/R3BINCLRootGenerator.h @@ -75,6 +75,16 @@ class R3BINCLRootGenerator : public FairGenerator **/ void SetOnlyP2pFission(bool Opt = true) { fOnlyP2pFission = Opt; } + /** + ** Method to simulate only p2p-spallation events + **/ + void SetOnlyP2pSpallation(bool Opt = true) { fOnlyP2pSpallation = Opt; } + + /** + ** Method to simulate only ppn-spallation events + **/ + void SetOnlyPpnSpallation(bool Opt = true) { fOnlyPpnSpallation = Opt; } + /** ** Method to simulate only fragments (changed with SetMinPdgCode) **/ @@ -90,11 +100,13 @@ class R3BINCLRootGenerator : public FairGenerator private: TString fFileName; // Input file name TFile* fInput; - bool fOnlyFission = false; // True if we want to simulate only fission events - bool fOnlyP2pFission = false; // True if we want to simulate only p2p-fission events - bool fOnlySpallation = false; // True if we want to simulate only spallation events - bool fOnlyFragments = false; // True if we want to simulate only fragments - int fPdgCodeMin = 1000050070; // Limit in Boro-7 + bool fOnlyFission = false; // True if we want to simulate only fission events + bool fOnlyP2pFission = false; // True if we want to simulate only p2p-fission events + bool fOnlyP2pSpallation = false; // True if we want to simulate only p2p-spallation events + bool fOnlyPpnSpallation = false; // True if we want to simulate only ppn-spallation events + bool fOnlySpallation = false; // True if we want to simulate only spallation events + bool fOnlyFragments = false; // True if we want to simulate only fragments + int fPdgCodeMin = 1000050070; // Limit in Boro-7 double fRotXBeam = 0.; double fRotYBeam = 0.;