New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added possibility to disable eta/p cut for Geant4 primary #25251
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,8 @@ Generator::Generator(const ParameterSet & p) : | |
|
||
double theDecLenCut = p.getParameter<double>("LDecLenCut")*cm; | ||
|
||
fFiductialCuts = (fPCuts || fPtransCut || fEtaCuts || fPhiCuts); | ||
|
||
pdgFilter.resize(0); | ||
if ( p.exists("PDGselection") ) { | ||
pdgFilterSel = (p.getParameter<edm::ParameterSet>("PDGselection")). | ||
|
@@ -85,14 +87,15 @@ Generator::Generator(const ParameterSet & p) : | |
/ ( 2*exp(-theEtaCutForHector) ) ); | ||
|
||
edm::LogVerbatim("SimG4CoreGenerator") | ||
<< " Rdecaycut= " << theRDecLenCut/cm | ||
<< "SimG4Core/Generator: Rdecaycut= " << theRDecLenCut/cm | ||
<< " cm; Zdecaycut= " << theDecLenCut/cm | ||
<< "Z_min= " << Z_lmin/cm << " cm; Z_max= " << Z_lmax | ||
<< " cm; Z_hector = " << Z_hector << " cm\n" | ||
<< "ApplyPCuts: " << fPCuts << " ApplyPtransCut: " << fPtransCut | ||
<< " ApplyEtaCuts: " << fEtaCuts | ||
<< " ApplyPhiCuts: " << fPhiCuts | ||
<< " ApplyLumiMonitorCuts: " << lumi; | ||
<< " ApplyCuts: " << fFiductialCuts | ||
<< " PCuts: " << fPCuts << " PtransCut: " << fPtransCut | ||
<< " EtaCut: " << fEtaCuts | ||
<< " PhiCut: " << fPhiCuts | ||
<< " LumiMonitorCut: " << lumi; | ||
if(lumi) { fLumiFilter->Describe(); } | ||
} | ||
|
||
|
@@ -130,13 +133,9 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt) | |
(*(evt->vertices_begin()))->position().z(), | ||
(*(evt->vertices_begin()))->position().t()); | ||
|
||
if(verbose > 0) { | ||
edm::LogVerbatim("SimG4CoreGenerator") << &evt; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @civanch this might help in understanding the generator structure to be imported, was it disturbing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fabiocos , when we debug various problems it become useful to enable edm::LogVerbatim to see list of primary vertexes/particles. Here I tried make the printout to be easier to find in a long log and more convenient for reading. The old style "verbose" variable requires change of g4SimHits parameter (but save a drop of CPU). With this change debugging is a bit easier, however, this is a minor thing. |
||
LogDebug("SimG4CoreGenerator") << "Primary Vertex = (" | ||
<< vtx_->x() << "," | ||
<< vtx_->y() << "," | ||
<< vtx_->z() << ")"; | ||
} | ||
edm::LogVerbatim("SimG4CoreGenerator") | ||
<< "Generator: primary Vertex = (" | ||
<< vtx_->x() << ", " << vtx_->y() << ", " << vtx_->z() << ")"; | ||
|
||
unsigned int ng4vtx = 0; | ||
|
||
|
@@ -243,12 +242,13 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt) | |
} | ||
|
||
edm::LogVerbatim("SimG4CoreGenerator") | ||
<< " pdg= " << pdg | ||
<< "Generator: pdg= " << pdg | ||
<< " status= " << status | ||
<< " hasPreDefinedDecay: " << hasDecayVertex | ||
<< " isExotic: " << isExotic(pdg) | ||
<< " isExoticNotDet: " << isExoticNonDetectable(pdg) | ||
<< " isInTheList: " << IsInTheFilterList(pdg); | ||
<< " isInTheList: " << IsInTheFilterList(pdg) | ||
<< "\n (x,y,z,t): (" << x1 << ","<< y1 << "," << z1 << "," << t1 << ")"; | ||
|
||
if (status > 3 && isExotic(pdg) && (!(isExoticNonDetectable(pdg))) ) { | ||
status = hasDecayVertex ? 2 : 1; | ||
|
@@ -275,7 +275,8 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt) | |
decay_length = std::sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)); | ||
} | ||
|
||
bool toBeAdded = false; | ||
bool toBeAdded = (fFiductialCuts) ? false : true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @civanch with the default g4SimHits settings this should preserve the standard behaviour... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fabiocos , no differences in all tests is observed. Normally we have eta/p cuts, so the code behaves in the same way as before. |
||
|
||
double px = (*pitr)->momentum().px(); | ||
double py = (*pitr)->momentum().py(); | ||
double pz = (*pitr)->momentum().pz(); | ||
|
@@ -310,7 +311,7 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt) | |
|
||
// Particles of status 1 trasnported along the beam pipe for forward | ||
// detectors (HECTOR) always pass to Geant4 without cuts | ||
if( 1 == status && | ||
if( 1 == status && | ||
std::abs(zimpact) >= Z_hector && rimpact2 <= theDecRCut2) { | ||
toBeAdded = true; | ||
if ( verbose > 2 ) LogDebug("SimG4CoreGenerator") | ||
|
@@ -319,7 +320,7 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt) | |
} else { | ||
|
||
// Standard case: particles not decayed by the generator | ||
if(1 == status && | ||
if(1 == status && | ||
(std::abs(zimpact) < Z_hector || rimpact2 > theDecRCut2)) { | ||
|
||
// Ptot cut for all particles | ||
|
@@ -396,7 +397,7 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt) | |
delete g4prim; | ||
continue; | ||
} | ||
g4prim->SetCharge(charge); | ||
g4prim->SetCharge(charge); | ||
} | ||
|
||
// V.I. do not use SetWeight but the same code | ||
|
@@ -410,6 +411,9 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt) | |
} | ||
if ( verbose > 1 ) g4prim->Print(); | ||
g4vtx->SetPrimary(g4prim); | ||
edm::LogVerbatim("SimG4CoreGenerator") | ||
<< "Generator: new particle pdg= " << pdg << " Ptot(GeV/c)= " << ptot | ||
<< " Pt= " << std::sqrt(px*px + py*py); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@civanch trivial issue, why this space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabiocos , it is formatting a new line to have clear printout - just before is "\n" symbol.