CMS 3D CMS Logo

Generator.cc
Go to the documentation of this file.
4 
6 
8 
9 #include "HepPDT/ParticleID.hh"
10 
11 #include "G4Event.hh"
12 
13 #include "G4HEPEvtParticle.hh"
14 #include "G4Log.hh"
15 #include "G4ParticleDefinition.hh"
16 #include "G4PhysicalConstants.hh"
17 #include "G4SystemOfUnits.hh"
18 #include "G4UnitsTable.hh"
19 
20 #include <sstream>
21 
22 using namespace edm;
23 
25  : fPCuts(p.getParameter<bool>("ApplyPCuts")),
26  fPtransCut(p.getParameter<bool>("ApplyPtransCut")),
27  fEtaCuts(p.getParameter<bool>("ApplyEtaCuts")),
28  fPhiCuts(p.getParameter<bool>("ApplyPhiCuts")),
29  theMinPhiCut(p.getParameter<double>("MinPhiCut")), // in radians (CMS standard)
30  theMaxPhiCut(p.getParameter<double>("MaxPhiCut")),
31  theMinEtaCut(p.getParameter<double>("MinEtaCut")),
32  theMaxEtaCut(p.getParameter<double>("MaxEtaCut")),
33  theMinPCut(p.getParameter<double>("MinPCut")), // in GeV (CMS standard)
34  theMaxPCut(p.getParameter<double>("MaxPCut")),
35  theEtaCutForHector(p.getParameter<double>("EtaCutForHector")),
36  verbose(p.getUntrackedParameter<int>("Verbosity", 0)),
37  fLumiFilter(nullptr),
38  evt_(nullptr),
39  vtx_(nullptr),
40  weight_(0),
41  Z_lmin(0),
42  Z_lmax(0),
43  Z_hector(0),
44  pdgFilterSel(false),
45  fPDGFilter(false) {
46  bool lumi = p.getParameter<bool>("ApplyLumiMonitorCuts");
47  if (lumi) {
49  }
50 
51  double theRDecLenCut = p.getParameter<double>("RDecLenCut") * cm;
52  theDecRCut2 = theRDecLenCut * theRDecLenCut;
53 
55 
56  double theDecLenCut = p.getParameter<double>("LDecLenCut") * cm;
57 
59 
60  pdgFilter.resize(0);
61  if (p.exists("PDGselection")) {
62  pdgFilterSel = (p.getParameter<edm::ParameterSet>("PDGselection")).getParameter<bool>("PDGfilterSel");
63  pdgFilter = (p.getParameter<edm::ParameterSet>("PDGselection")).getParameter<std::vector<int>>("PDGfilter");
64  if (!pdgFilter.empty()) {
65  fPDGFilter = true;
66  std::stringstream ss;
67  ss << "SimG4Core/Generator: ";
68  if (pdgFilterSel) {
69  ss << " Selecting only PDG ID = ";
70  } else {
71  ss << " Filtering out PDG ID = ";
72  }
73  for (unsigned int ii = 0; ii < pdgFilter.size(); ++ii) {
74  ss << pdgFilter[ii] << " ";
75  }
76  edm::LogVerbatim("SimG4CoreGenerator") << ss.str();
77  }
78  }
79 
80  if (fEtaCuts) {
81  Z_lmax = theRDecLenCut * ((1 - exp(-2 * theMaxEtaCut)) / (2 * exp(-theMaxEtaCut)));
82  Z_lmin = theRDecLenCut * ((1 - exp(-2 * theMinEtaCut)) / (2 * exp(-theMinEtaCut)));
83  }
84 
85  Z_hector = theRDecLenCut * ((1 - exp(-2 * theEtaCutForHector)) / (2 * exp(-theEtaCutForHector)));
86 
87  edm::LogVerbatim("SimG4CoreGenerator") << "SimG4Core/Generator: Rdecaycut= " << theRDecLenCut / cm
88  << " cm; Zdecaycut= " << theDecLenCut / cm << "Z_min= " << Z_lmin / cm
89  << " cm; Z_max= " << Z_lmax << " cm; Z_hector = " << Z_hector << " cm\n"
90  << " ApplyCuts: " << fFiductialCuts
91  << " PCuts: " << fPCuts << " PtransCut: " << fPtransCut
92  << " EtaCut: " << fEtaCuts << " PhiCut: " << fPhiCuts
93  << " LumiMonitorCut: " << lumi;
94  if (lumi) {
96  }
97 }
98 
100 
101 void Generator::HepMC2G4(const HepMC::GenEvent *evt_orig, G4Event *g4evt) {
102  HepMC::GenEvent *evt = new HepMC::GenEvent(*evt_orig);
103 
104  if (*(evt->vertices_begin()) == nullptr) {
105  std::stringstream ss;
106  ss << "SimG4Core/Generator: in event " << g4evt->GetEventID() << " Corrupted Event - GenEvent with no vertex \n";
107  throw SimG4Exception(ss.str());
108  }
109 
110  if (!evt->weights().empty()) {
111  weight_ = evt->weights()[0];
112  for (unsigned int iw = 1; iw < evt->weights().size(); ++iw) {
113  // terminate if the vector of weights contains a zero-weight
114  if (evt->weights()[iw] <= 0)
115  break;
116  weight_ *= evt->weights()[iw];
117  }
118  }
119 
120  if (vtx_ != nullptr) {
121  delete vtx_;
122  }
123  vtx_ = new math::XYZTLorentzVector((*(evt->vertices_begin()))->position().x(),
124  (*(evt->vertices_begin()))->position().y(),
125  (*(evt->vertices_begin()))->position().z(),
126  (*(evt->vertices_begin()))->position().t());
127 
128  edm::LogVerbatim("SimG4CoreGenerator") << "Generator: primary Vertex = (" << vtx_->x() << ", " << vtx_->y() << ", "
129  << vtx_->z() << ")";
130 
131  unsigned int ng4vtx = 0;
132 
133  for (HepMC::GenEvent::vertex_const_iterator vitr = evt->vertices_begin(); vitr != evt->vertices_end(); ++vitr) {
134  // loop for vertex, is it a real vertex?
135  // Set qvtx to true for any particles that should be propagated by GEANT,
136  // i.e., status 1 particles or status 2 particles that decay outside the
137  // beampipe.
138  G4bool qvtx = false;
139  HepMC::GenVertex::particle_iterator pitr;
140  for (pitr = (*vitr)->particles_begin(HepMC::children); pitr != (*vitr)->particles_end(HepMC::children); ++pitr) {
141  // For purposes of this function, the status is defined as follows:
142  // 1: particles are not decayed by generator
143  // 2: particles are decayed by generator but need to be propagated by
144  // GEANT 3: particles are decayed by generator but do not need to be
145  // propagated by GEANT
146  int status = (*pitr)->status();
147  int pdg = (*pitr)->pdg_id();
148  if (status > 3 && isExotic(pdg) && (!(isExoticNonDetectable(pdg)))) {
149  // In Pythia 8, there are many status codes besides 1, 2, 3.
150  // By setting the status to 2 for exotic particles, they will be
151  // checked: if its decay vertex is outside the beampipe, it will be
152  // propagated by GEANT. Some Standard Model particles, e.g., K0, cannot
153  // be propagated by GEANT, so do not change their status code.
154  status = 2;
155  }
156  if(std::abs(pdg) == 9900015) status = 3;
157 
158  // Particles which are not decayed by generator
159  if (status == 1) {
160  // filter out unwanted particles and vertices
161  if (fPDGFilter && !pdgFilterSel && IsInTheFilterList(pdg)) {
162  continue;
163  }
164 
165  qvtx = true;
166  if (verbose > 2)
167  LogDebug("SimG4CoreGenerator") << "GenVertex barcode = " << (*vitr)->barcode()
168  << " selected for GenParticle barcode = " << (*pitr)->barcode();
169  break;
170  }
171  // The selection is made considering if the partcile with status = 2
172  // have the end_vertex with a radius greater than the radius of beampipe
173  // cylinder (no requirement on the Z of the vertex is applyed).
174  else if (status == 2) {
175  if ((*pitr)->end_vertex() != nullptr) {
176  double xx = (*pitr)->end_vertex()->position().x();
177  double yy = (*pitr)->end_vertex()->position().y();
178  double r_dd = xx * xx + yy * yy;
179  if (r_dd > theDecRCut2) {
180  qvtx = true;
181  if (verbose > 2)
182  LogDebug("SimG4CoreGenerator")
183  << "GenVertex barcode = " << (*vitr)->barcode()
184  << " selected for GenParticle barcode = " << (*pitr)->barcode() << " radius = " << std::sqrt(r_dd);
185  break;
186  }
187  } else {
188  // particles with status 2 without end_vertex are
189  // equivalent to stable
190  qvtx = true;
191  break;
192  }
193  }
194  }
195 
196  // if this vertex is inside fiductial volume inside the beam pipe
197  // and has no long-lived secondary the vertex is not saved
198  if (!qvtx) {
199  continue;
200  }
201 
202  double x1 = (*vitr)->position().x() * mm;
203  double y1 = (*vitr)->position().y() * mm;
204  double z1 = (*vitr)->position().z() * mm;
205  double t1 = (*vitr)->position().t() * mm / c_light;
206 
207  G4PrimaryVertex *g4vtx = new G4PrimaryVertex(x1, y1, z1, t1);
208 
209  for (pitr = (*vitr)->particles_begin(HepMC::children); pitr != (*vitr)->particles_end(HepMC::children); ++pitr) {
210  int status = (*pitr)->status();
211  int pdg = (*pitr)->pdg_id();
212  bool hasDecayVertex = (nullptr != (*pitr)->end_vertex()) ? true : false;
213 
214  // Filter on allowed particle species if required
215  if (fPDGFilter) {
216  bool isInTheList = IsInTheFilterList(pdg);
217  if ((!pdgFilterSel && isInTheList) || (pdgFilterSel && !isInTheList)) {
218  edm::LogVerbatim("SimG4CoreGenerator")
219  << " Skiped GenParticle barcode= " << (*pitr)->barcode() << " PDGid= " << pdg << " status= " << status
220  << " isExotic: " << isExotic(pdg) << " isExoticNotDet: " << isExoticNonDetectable(pdg)
221  << " isInTheList: " << isInTheList << " hasDecayVertex: " << hasDecayVertex;
222  continue;
223  }
224  }
225 
226  edm::LogVerbatim("SimG4CoreGenerator")
227  << "Generator: pdg= " << pdg << " status= " << status << " hasPreDefinedDecay: " << hasDecayVertex
228  << " isExotic: " << isExotic(pdg) << " isExoticNotDet: " << isExoticNonDetectable(pdg)
229  << " isInTheList: " << IsInTheFilterList(pdg) << "\n (x,y,z,t): (" << x1 << "," << y1 << "," << z1
230  << "," << t1 << ")";
231 
232  if (status > 3 && isExotic(pdg) && (!(isExoticNonDetectable(pdg)))) {
233  status = hasDecayVertex ? 2 : 1;
234  }
235 
236  // this particle has predefined decay but has no vertex
237  if (2 == status && !hasDecayVertex) {
238  edm::LogWarning("SimG4CoreGenerator: in event ") << g4evt->GetEventID() << " a particle "
239  << " pdgid= " << pdg
240  << " has status=2 but has no decay vertex, so will be fully "
241  "tracked by Geant4";
242  status = 1;
243  }
244  // heavy neutrino should not be propagated by Geant4
245  if(std::abs(pdg) == 9900015) status = 3;
246 
247  double x2 = x1;
248  double y2 = y1;
249  double z2 = z1;
250  double decay_length = 0.0;
251  if (2 == status) {
252  x2 = (*pitr)->end_vertex()->position().x();
253  y2 = (*pitr)->end_vertex()->position().y();
254  z2 = (*pitr)->end_vertex()->position().z();
255  decay_length = std::sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1));
256  }
257 
258  bool toBeAdded = (fFiductialCuts) ? false : true;
259 
260  double px = (*pitr)->momentum().px();
261  double py = (*pitr)->momentum().py();
262  double pz = (*pitr)->momentum().pz();
263  double ptot = std::sqrt(px * px + py * py + pz * pz);
264  math::XYZTLorentzVector p(px, py, pz, (*pitr)->momentum().e());
265 
266  double ximpact = x1;
267  double yimpact = y1;
268  double zimpact = z1;
269 
270  // protection against numerical problems for extremely low momenta
271  // compute impact point at transition to Hector
272  const double minTan = 1.e-20;
273  if (std::abs(z1) < Z_hector && std::abs(pz) >= minTan * ptot) {
274  if (pz > 0.0) {
275  zimpact = Z_hector;
276  } else {
277  zimpact = -Z_hector;
278  }
279  double del = (zimpact - z1) / pz;
280  ximpact += del * px;
281  yimpact += del * py;
282  }
283  double rimpact2 = ximpact * ximpact + yimpact * yimpact;
284 
285  if (verbose > 2)
286  LogDebug("SimG4CoreGenerator") << "Processing GenParticle barcode= " << (*pitr)->barcode() << " pdg= " << pdg
287  << " status= " << (*pitr)->status() << " st= " << status
288  << " rimpact(cm)= " << std::sqrt(rimpact2) / cm
289  << " zimpact(cm)= " << zimpact / cm << " ptot(GeV)= " << ptot
290  << " pz(GeV)= " << pz;
291 
292  // Particles of status 1 trasnported along the beam pipe for forward
293  // detectors (HECTOR) always pass to Geant4 without cuts
294  if (1 == status && std::abs(zimpact) >= Z_hector && rimpact2 <= theDecRCut2) {
295  toBeAdded = true;
296  if (verbose > 2)
297  LogDebug("SimG4CoreGenerator") << "GenParticle barcode = " << (*pitr)->barcode() << " passed case 3";
298  } else {
299  // Standard case: particles not decayed by the generator
300  if (1 == status && (std::abs(zimpact) < Z_hector || rimpact2 > theDecRCut2)) {
301  // Ptot cut for all particles
302  if (fPCuts && (ptot < theMinPCut || ptot > theMaxPCut)) {
303  continue;
304  }
305  // phi cut is applied mainly for particle gun
306  if (fPhiCuts) {
307  double phi = p.phi();
308  if (phi < theMinPhiCut || phi > theMaxPhiCut) {
309  continue;
310  }
311  }
312  // eta cut is applied if position of the decay
313  // is within vacuum chamber and limited in Z
314  if (fEtaCuts) {
315  // eta cut
316  double xi = x1;
317  double yi = y1;
318  double zi = z1;
319 
320  // can be propagated along Z
321  if (std::abs(pz) >= minTan * ptot) {
322  if ((zi >= Z_lmax) & (pz < 0.0)) {
323  zi = Z_lmax;
324  } else if ((zi <= Z_lmin) & (pz > 0.0)) {
325  zi = Z_lmin;
326  } else {
327  if (pz > 0) {
328  zi = Z_lmax;
329  } else {
330  zi = Z_lmin;
331  }
332  }
333  double del = (zi - z1) / pz;
334  xi += del * px;
335  yi += del * py;
336  }
337  // check eta cut
338  if ((zi >= Z_lmin) & (zi <= Z_lmax) & (xi * xi + yi * yi < theDecRCut2)) {
339  continue;
340  }
341  }
342  if (fLumiFilter && !fLumiFilter->isGoodForLumiMonitor(*pitr)) {
343  continue;
344  }
345  toBeAdded = true;
346  if (verbose > 2)
347  LogDebug("SimG4CoreGenerator") << "GenParticle barcode = " << (*pitr)->barcode() << " passed case 1";
348 
349  // Decay chain outside the fiducial cylinder defined by theRDecLenCut
350  // are used for Geant4 tracking with predefined decay channel
351  // In the case of decay in vacuum particle is not tracked by Geant4
352  } else if (2 == status && x2 * x2 + y2 * y2 >= theDecRCut2 && std::abs(z2) < Z_hector) {
353  toBeAdded = true;
354  if (verbose > 2)
355  LogDebug("SimG4CoreGenerator") << "GenParticle barcode = " << (*pitr)->barcode() << " passed case 2"
356  << " decay_length(cm)= " << decay_length / cm;
357  }
358  }
359  if (toBeAdded) {
360  G4PrimaryParticle *g4prim = new G4PrimaryParticle(pdg, px * GeV, py * GeV, pz * GeV);
361 
362  if (g4prim->GetG4code() != nullptr) {
363  g4prim->SetMass(g4prim->GetG4code()->GetPDGMass());
364  double charge = g4prim->GetG4code()->GetPDGCharge();
365 
366  // apply Pt cut
367  if (fPtransCut && 0.0 != charge && px * px + py * py < theMinPtCut2) {
368  delete g4prim;
369  continue;
370  }
371  g4prim->SetCharge(charge);
372  }
373 
374  // V.I. do not use SetWeight but the same code
375  // value of the code compute inside TrackWithHistory
376  // g4prim->SetWeight( 10000*(*vpitr)->barcode() ) ;
377  setGenId(g4prim, (*pitr)->barcode());
378 
379  if (2 == status) {
380  particleAssignDaughters(g4prim, (HepMC::GenParticle *)*pitr, decay_length);
381  }
382  if (verbose > 1)
383  g4prim->Print();
384  g4vtx->SetPrimary(g4prim);
385  edm::LogVerbatim("SimG4CoreGenerator") << "Generator: new particle pdg= " << pdg << " Ptot(GeV/c)= " << ptot
386  << " Pt= " << std::sqrt(px * px + py * py);
387  }
388  }
389 
390  if (verbose > 1)
391  g4vtx->Print();
392  g4evt->AddPrimaryVertex(g4vtx);
393  ++ng4vtx;
394  }
395 
396  // Add a protection for completely empty events (produced by LHCTransport):
397  // add a dummy vertex with no particle attached to it
398  if (ng4vtx == 0) {
399  G4PrimaryVertex *g4vtx = new G4PrimaryVertex(0.0, 0.0, 0.0, 0.0);
400  if (verbose > 1)
401  g4vtx->Print();
402  g4evt->AddPrimaryVertex(g4vtx);
403  }
404 
405  delete evt;
406 }
407 
408 void Generator::particleAssignDaughters(G4PrimaryParticle *g4p, HepMC::GenParticle *vp, double decaylength) {
409  if (verbose > 1) {
410  LogDebug("SimG4CoreGenerator") << "Special case of long decay length \n"
411  << "Assign daughters with to mother with decaylength=" << decaylength / cm << " cm";
412  }
413  math::XYZTLorentzVector p(vp->momentum().px(), vp->momentum().py(), vp->momentum().pz(), vp->momentum().e());
414 
415  // defined preassigned decay time
416  double proper_time = decaylength / (p.Beta() * p.Gamma() * c_light);
417  g4p->SetProperTime(proper_time);
418 
419  if (verbose > 2) {
420  LogDebug("SimG4CoreGenerator") << " px= " << p.px() << " py= " << p.py() << " pz= " << p.pz() << " e= " << p.e()
421  << " beta= " << p.Beta() << " gamma= " << p.Gamma()
422  << " Proper time= " << proper_time / ns << " ns";
423  }
424 
425  // the particle will decay after the same length if it
426  // has not interacted before
427  double x1 = vp->end_vertex()->position().x();
428  double y1 = vp->end_vertex()->position().y();
429  double z1 = vp->end_vertex()->position().z();
430 
431  for (HepMC::GenVertex::particle_iterator vpdec = vp->end_vertex()->particles_begin(HepMC::children);
432  vpdec != vp->end_vertex()->particles_end(HepMC::children);
433  ++vpdec) {
434  // transform decay products such that in the rest frame of mother
436  (*vpdec)->momentum().px(), (*vpdec)->momentum().py(), (*vpdec)->momentum().pz(), (*vpdec)->momentum().e());
437 
438  // children should only be taken into account once
439  G4PrimaryParticle *g4daught =
440  new G4PrimaryParticle((*vpdec)->pdg_id(), pdec.x() * GeV, pdec.y() * GeV, pdec.z() * GeV);
441 
442  if (g4daught->GetG4code() != nullptr) {
443  g4daught->SetMass(g4daught->GetG4code()->GetPDGMass());
444  g4daught->SetCharge(g4daught->GetG4code()->GetPDGCharge());
445  }
446 
447  // V.I. do not use SetWeight but the same code
448  // value of the code compute inside TrackWithHistory
449  setGenId(g4daught, (*vpdec)->barcode());
450 
451  if (verbose > 2)
452  LogDebug("SimG4CoreGenerator") << "Assigning a " << (*vpdec)->pdg_id() << " as daughter of a " << vp->pdg_id();
453  if ((*vpdec)->status() == 2 && (*vpdec)->end_vertex() != nullptr) {
454  double x2 = (*vpdec)->end_vertex()->position().x();
455  double y2 = (*vpdec)->end_vertex()->position().y();
456  double z2 = (*vpdec)->end_vertex()->position().z();
457  double dd = std::sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2));
458  particleAssignDaughters(g4daught, *vpdec, dd);
459  }
460  (*vpdec)->set_status(1000 + (*vpdec)->status());
461  g4p->SetDaughter(g4daught);
462 
463  if (verbose > 1)
464  g4daught->Print();
465  }
466 }
467 
468 // Used for non-beam particles
469 bool Generator::particlePassesPrimaryCuts(const G4ThreeVector &p) const {
470  bool flag = true;
471  double ptot = p.mag();
472  if (fPCuts && (ptot < theMinPCut * GeV || ptot > theMaxPCut * GeV)) {
473  flag = false;
474  }
475  if (fEtaCuts && flag) {
476  double pz = p.z();
477  if (ptot < pz + 1.e-10) {
478  flag = false;
479 
480  } else {
481  double eta = 0.5 * G4Log((ptot + pz) / (ptot - pz));
482  if (eta < theMinEtaCut || eta > theMaxEtaCut) {
483  flag = false;
484  }
485  }
486  }
487  if (fPhiCuts && flag) {
488  double phi = p.phi();
489  if (phi < theMinPhiCut || phi > theMaxPhiCut) {
490  flag = false;
491  }
492  }
493 
494  if (verbose > 2)
495  LogDebug("SimG4CoreGenerator") << "Generator ptot(GeV)= " << ptot / GeV << " eta= " << p.eta()
496  << " phi= " << p.phi() << " Flag= " << flag;
497 
498  return flag;
499 }
500 
501 bool Generator::isExotic(int pdgcode) const {
502  int pdgid = std::abs(pdgcode);
503  return ((pdgid >= 1000000 && pdgid < 4000000 && pdgid != 3000022) || // SUSY, R-hadron, and technicolor particles
504  pdgid == 17 || // 4th generation lepton
505  pdgid == 34 || // W-prime
506  pdgid == 37) // charged Higgs
507  ? true
508  : false;
509 }
510 
511 bool Generator::isExoticNonDetectable(int pdgcode) const {
512  int pdgid = std::abs(pdgcode);
513  HepPDT::ParticleID pid(pdgcode);
514  int charge = pid.threeCharge();
515  return ((charge == 0) && (pdgid >= 1000000 && pdgid < 1000040)) // SUSY
516  ? true
517  : false;
518 }
519 
520 bool Generator::IsInTheFilterList(int pdgcode) const {
521  int pdgid = std::abs(pdgcode);
522  for (auto &pdg : pdgFilter) {
523  if (std::abs(pdg) == pdgid) {
524  return true;
525  }
526  }
527  return false;
528 }
529 
530 void Generator::nonBeamEvent2G4(const HepMC::GenEvent *evt, G4Event *g4evt) {
531  int i = 0;
532  for (HepMC::GenEvent::particle_const_iterator it = evt->particles_begin(); it != evt->particles_end(); ++it) {
533  ++i;
534  HepMC::GenParticle *gp = (*it);
535  int g_status = gp->status();
536  // storing only particle with status == 1
537  if (g_status == 1) {
538  int g_id = gp->pdg_id();
539  G4PrimaryParticle *g4p =
540  new G4PrimaryParticle(g_id, gp->momentum().px() * GeV, gp->momentum().py() * GeV, gp->momentum().pz() * GeV);
541  if (g4p->GetG4code() != nullptr) {
542  g4p->SetMass(g4p->GetG4code()->GetPDGMass());
543  g4p->SetCharge(g4p->GetG4code()->GetPDGCharge());
544  }
545  setGenId(g4p, i);
546  if (particlePassesPrimaryCuts(g4p->GetMomentum())) {
547  G4PrimaryVertex *v = new G4PrimaryVertex(gp->production_vertex()->position().x() * mm,
548  gp->production_vertex()->position().y() * mm,
549  gp->production_vertex()->position().z() * mm,
550  gp->production_vertex()->position().t() * mm / c_light);
551  v->SetPrimary(g4p);
552  g4evt->AddPrimaryVertex(v);
553  if (verbose > 0) {
554  v->Print();
555  }
556 
557  } else {
558  delete g4p;
559  }
560  }
561  } // end loop on HepMC particles
562 }
#define LogDebug(id)
double theDecRCut2
Definition: Generator.h:55
bool fPhiCuts
Definition: Generator.h:46
T getParameter(std::string const &) const
void setGenId(G4PrimaryParticle *p, int id) const
Definition: Generator.h:40
const double GeV
Definition: MathUtil.h:16
double theMinPtCut2
Definition: Generator.h:53
double theEtaCutForHector
Definition: Generator.h:56
double Z_lmax
Definition: Generator.h:63
void HepMC2G4(const HepMC::GenEvent *g, G4Event *e)
Definition: Generator.cc:101
double theMaxPhiCut
Definition: Generator.h:49
Generator(const edm::ParameterSet &p)
Definition: Generator.cc:24
bool fPtransCut
Definition: Generator.h:44
#define nullptr
bool exists(std::string const &parameterName) const
checks if a parameter exists
double theDecLenCut
Definition: Generator.h:57
double theMinEtaCut
Definition: Generator.h:50
bool isExoticNonDetectable(int pdgcode) const
Definition: Generator.cc:511
bool pdgFilterSel
Definition: Generator.h:65
void particleAssignDaughters(G4PrimaryParticle *p, HepMC::GenParticle *hp, double length)
Definition: Generator.cc:408
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
double theMinPCut
Definition: Generator.h:52
LumiMonitorFilter * fLumiFilter
Definition: Generator.h:59
bool fFiductialCuts
Definition: Generator.h:47
T sqrt(T t)
Definition: SSEVec.h:18
bool fPDGFilter
Definition: Generator.h:66
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double weight_
Definition: Generator.h:62
double theMaxEtaCut
Definition: Generator.h:51
ii
Definition: cuy.py:590
double theMaxPCut
Definition: Generator.h:54
bool isExotic(int pdgcode) const
Definition: Generator.cc:501
void Describe() const
bool isGoodForLumiMonitor(const HepMC::GenParticle *) const
math::XYZTLorentzVector * vtx_
Definition: Generator.h:61
void nonBeamEvent2G4(const HepMC::GenEvent *g, G4Event *e)
Definition: Generator.cc:530
double Z_lmin
Definition: Generator.h:63
virtual ~Generator()
Definition: Generator.cc:99
HLT enums.
bool particlePassesPrimaryCuts(const G4ThreeVector &p) const
Definition: Generator.cc:469
std::vector< int > pdgFilter
Definition: Generator.h:64
bool IsInTheFilterList(int pdgcode) const
Definition: Generator.cc:520
bool fEtaCuts
Definition: Generator.h:45
double Z_hector
Definition: Generator.h:63
bool fPCuts
Definition: Generator.h:43