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