CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Generator Class Reference

#include <Generator.h>

Public Member Functions

virtual const double eventWeight () const
 
 Generator (const edm::ParameterSet &p)
 
virtual const HepMC::GenEvent * genEvent () const
 
virtual const
math::XYZTLorentzVector
genVertex () const
 
void HepMC2G4 (const HepMC::GenEvent *g, G4Event *e)
 
void nonBeamEvent2G4 (const HepMC::GenEvent *g, G4Event *e)
 
void setGenEvent (const HepMC::GenEvent *inpevt)
 
virtual ~Generator ()
 

Private Member Functions

void particleAssignDaughters (G4PrimaryParticle *p, HepMC::GenParticle *hp, double length)
 
bool particlePassesPrimaryCuts (const G4PrimaryParticle *p) const
 
bool particlePassesPrimaryCuts (const math::XYZTLorentzVector &mom, const double zimp) const
 
void setGenId (G4PrimaryParticle *p, int id) const
 

Private Attributes

HepMC::GenEvent * evt_
 
bool fEtaCuts
 
bool fPCuts
 
bool fPhiCuts
 
double theEtaCutForHector
 
double theMaxEtaCut
 
double theMaxPCut
 
double theMaxPhiCut
 
double theMinEtaCut
 
double theMinPCut
 
double theMinPhiCut
 
double theRDecLenCut
 
int verbose
 
math::XYZTLorentzVectorvtx_
 
double weight_
 
double Z_hector
 
double Z_lmax
 
double Z_lmin
 

Detailed Description

Definition at line 21 of file Generator.h.

Constructor & Destructor Documentation

Generator::Generator ( const edm::ParameterSet p)

Definition at line 22 of file Generator.cc.

References create_public_lumi_plots::exp, fEtaCuts, LogDebug, theEtaCutForHector, theMaxEtaCut, theMinEtaCut, theRDecLenCut, Z_hector, Z_lmax, and Z_lmin.

22  :
23  fPCuts(p.getParameter<bool>("ApplyPCuts")),
24  fEtaCuts(p.getParameter<bool>("ApplyEtaCuts")),
25  fPhiCuts(p.getParameter<bool>("ApplyPhiCuts")),
26  theMinPhiCut(p.getParameter<double>("MinPhiCut")), // now operates in radians (CMS standard)
27  theMaxPhiCut(p.getParameter<double>("MaxPhiCut")),
28  theMinEtaCut(p.getParameter<double>("MinEtaCut")),
29  theMaxEtaCut(p.getParameter<double>("MaxEtaCut")),
30  theMinPCut(p.getParameter<double>("MinPCut")), // now operates in GeV (CMS standard)
31  theMaxPCut(p.getParameter<double>("MaxPCut")),
32  theRDecLenCut(p.getParameter<double>("RDecLenCut")*cm),
33  theEtaCutForHector(p.getParameter<double>("EtaCutForHector")),
34  verbose(p.getUntrackedParameter<int>("Verbosity",0)),
35  evt_(0),
36  vtx_(0),
37  weight_(0),
38  Z_lmin(0),
39  Z_lmax(0),
40  Z_hector(0)
41 {
42 
43  if(fEtaCuts){
44  Z_lmax = theRDecLenCut*( ( 1 - exp(-2*theMaxEtaCut) ) / ( 2*exp(-theMaxEtaCut) ) );
45  Z_lmin = theRDecLenCut*( ( 1 - exp(-2*theMinEtaCut) ) / ( 2*exp(-theMinEtaCut) ) );
46  }
47 
49 
50  if ( verbose > 0 ) LogDebug("SimG4CoreGenerator") << "Z_min = " << Z_lmin << " Z_max = " << Z_lmax << " Z_hector = " << Z_hector;
51 
52 }
#define LogDebug(id)
bool fPhiCuts
Definition: Generator.h:43
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double theEtaCutForHector
Definition: Generator.h:51
double Z_lmax
Definition: Generator.h:56
double theMaxPhiCut
Definition: Generator.h:45
double theMinEtaCut
Definition: Generator.h:46
double theMinPCut
Definition: Generator.h:48
double theMinPhiCut
Definition: Generator.h:44
double weight_
Definition: Generator.h:55
double theMaxEtaCut
Definition: Generator.h:47
double theRDecLenCut
Definition: Generator.h:50
double theMaxPCut
Definition: Generator.h:49
math::XYZTLorentzVector * vtx_
Definition: Generator.h:54
HepMC::GenEvent * evt_
Definition: Generator.h:53
double Z_lmin
Definition: Generator.h:56
int verbose
Definition: Generator.h:52
bool fEtaCuts
Definition: Generator.h:42
double Z_hector
Definition: Generator.h:56
bool fPCuts
Definition: Generator.h:41
Generator::~Generator ( )
virtual

Definition at line 54 of file Generator.cc.

55 {
56 }

Member Function Documentation

virtual const double Generator::eventWeight ( ) const
inlinevirtual

Definition at line 32 of file Generator.h.

References weight_.

Referenced by RunManager::produce().

32 { return weight_; }
double weight_
Definition: Generator.h:55
virtual const HepMC::GenEvent* Generator::genEvent ( ) const
inlinevirtual

Definition at line 30 of file Generator.h.

References evt_.

Referenced by RunManager::produce().

30 { return evt_; }
HepMC::GenEvent * evt_
Definition: Generator.h:53
virtual const math::XYZTLorentzVector* Generator::genVertex ( ) const
inlinevirtual

Definition at line 31 of file Generator.h.

References vtx_.

Referenced by RunManager::produce().

31 { return vtx_; }
math::XYZTLorentzVector * vtx_
Definition: Generator.h:54
void Generator::HepMC2G4 ( const HepMC::GenEvent *  g,
G4Event *  e 
)

Definition at line 58 of file Generator.cc.

References configurableAnalysis::GenParticle, LogDebug, AlCaHLTBitMon_ParallelJobs::p, particleAssignDaughters(), particlePassesPrimaryCuts(), hitfit::return, setGenId(), mathSSE::sqrt(), theRDecLenCut, vtx_, weight_, and Z_hector.

Referenced by RunManager::generateEvent().

59 {
60 
61  if ( *(evt_orig->vertices_begin()) == 0 )
62  {
63  throw SimG4Exception( "SimG4CoreGenerator: Corrupted Event - GenEvent with no vertex" ) ;
64  }
65 
66 
67  HepMC::GenEvent* evt = new HepMC::GenEvent(*evt_orig) ;
68 
69  if ( evt->weights().size() > 0 )
70  {
71  weight_ = evt->weights()[0] ;
72  for ( unsigned int iw=1; iw<evt->weights().size(); iw++ )
73  {
74  // terminate if the versot of weights contains a zero-weight
75  if ( evt->weights()[iw] <= 0 ) break;
76  weight_ *= evt->weights()[iw] ;
77  }
78  }
79 
80  if (vtx_ != 0) delete vtx_;
81  vtx_ = new math::XYZTLorentzVector((*(evt->vertices_begin()))->position().x(),
82  (*(evt->vertices_begin()))->position().y(),
83  (*(evt->vertices_begin()))->position().z(),
84  (*(evt->vertices_begin()))->position().t());
85 
86  if(verbose >0){
87  evt->print();
88  LogDebug("SimG4CoreGenerator") << "Primary Vertex = (" << vtx_->x() << ","
89  << vtx_->y() << ","
90  << vtx_->z() << ")";
91  }
92 
93  // double x0 = vtx_->x();
94  // double y0 = vtx_->y();
95 
96  unsigned int ng4vtx = 0;
97 
98  for(HepMC::GenEvent::vertex_const_iterator vitr= evt->vertices_begin();
99  vitr != evt->vertices_end(); ++vitr ) {
100  // loop for vertex ...
101  // real vertex?
102  G4bool qvtx=false;
103 
104  for (HepMC::GenVertex::particle_iterator pitr= (*vitr)->particles_begin(HepMC::children);
105  pitr != (*vitr)->particles_end(HepMC::children); ++pitr) {
106  // Admit also status=1 && end_vertex for long vertex special decay treatment
107  if ((*pitr)->status()==1) {
108  qvtx=true;
109  if ( verbose > 2 ) LogDebug("SimG4CoreGenerator") << "GenVertex barcode = " << (*vitr)->barcode()
110  << " selected for GenParticle barcode = " << (*pitr)->barcode() << std::endl;
111  break;
112  }
113  // The selection is made considering if the partcile with status = 2 have the end_vertex
114  // with a radius (R) greater then the theRDecLenCut that means: the end_vertex is outside
115  // the beampipe cilinder (no requirement on the Z of the vertex is applyed).
116  else if ( (*pitr)->status()== 2 ) {
117  if ( (*pitr)->end_vertex() != 0 ) {
118  //double xx = x0-(*pitr)->end_vertex()->position().x();
119  //double yy = y0-(*pitr)->end_vertex()->position().y();
120  double xx = (*pitr)->end_vertex()->position().x();
121  double yy = (*pitr)->end_vertex()->position().y();
122  double r_dd=std::sqrt(xx*xx+yy*yy);
123  if (r_dd>theRDecLenCut){
124  qvtx=true;
125  if ( verbose > 2 ) LogDebug("SimG4CoreGenerator") << "GenVertex barcode = " << (*vitr)->barcode()
126  << " selected for GenParticle barcode = " << (*pitr)->barcode() << " radius = " << r_dd << std::endl;
127  break;
128  }
129  }
130  }
131  }
132 
133 
134  if (!qvtx) {
135  continue;
136  }
137 
138  double x1 = (*vitr)->position().x();
139  double y1 = (*vitr)->position().y();
140  double z1 = (*vitr)->position().z();
141  double t1 = (*vitr)->position().t();
142  G4PrimaryVertex* g4vtx=
143  new G4PrimaryVertex(x1*mm, y1*mm, z1*mm, t1*mm/c_light);
144 
145  for (HepMC::GenVertex::particle_iterator vpitr= (*vitr)->particles_begin(HepMC::children);
146  vpitr != (*vitr)->particles_end(HepMC::children); ++vpitr){
147 
148  // Special cases:
149  // 1) import in Geant4 a full decay chain (e.g. also particles with status == 2)
150  // from the generator in case the decay radius is larger than theRDecLenCut
151  // In this case no cuts will be applied to select the particles hat has to be
152  // processed by geant
153  // 2) import in Geant4 particles with status == 1 but a final end vertex.
154  // The time of the vertex is used as the time of flight to be forced for the particle
155 
156  double r_decay_length=-1;
157  double decay_length=-1;
158 
159  if ( (*vpitr)->status() == 1 || (*vpitr)->status() == 2 ) {
160  // this particle has decayed
161  if ( (*vpitr)->end_vertex() != 0 ) {
162  // needed some particles have status 2 and no end_vertex
163  // Which are the particles with status 2 and not end_vertex, what are suppose to di such kind of particles
164  // when propagated to geant?
165 
166  double x2 = (*vpitr)->end_vertex()->position().x();
167  double y2 = (*vpitr)->end_vertex()->position().y();
168  double z2 = (*vpitr)->end_vertex()->position().z();
169  r_decay_length=std::sqrt(x2*x2+y2*y2);
170  decay_length=std::sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2));
171 
172  }
173  }
174  // end modification
175 
176  bool toBeAdded = false;
177  math::XYZTLorentzVector p((*vpitr)->momentum().px(),
178  (*vpitr)->momentum().py(),
179  (*vpitr)->momentum().pz(),
180  (*vpitr)->momentum().e());
181 
182  // protection against numerical problems for extremely low momenta
183  const double minTan = 1.e-20;
184  double zimpact = Z_hector+1.;
185  if ( fabs(z1) < Z_hector && fabs(p.pt()/p.pz()) >= minTan ) {
186  // write tan(p.Theta()) as p.Pt()/p.Pz()
187  zimpact = (theRDecLenCut-sqrt(x1*x1+y1*y1))*(p.pz()/p.pt())+z1;
188  }
189 
190  if ( verbose > 2 ) LogDebug("SimG4CoreGenerator") << "Processing GenParticle barcode = " << (*vpitr)->barcode()
191  << " status = " << (*vpitr)->status()
192  << " zimpact = " << zimpact;
193 
194  // Standard case: particles not decayed by the generator
195  if( (*vpitr)->status() == 1 && fabs(zimpact) < Z_hector ) {
196  if ( !particlePassesPrimaryCuts( p, zimpact ) ) {
197  continue ;
198  }
199  toBeAdded = true;
200  if ( verbose > 2 ) LogDebug("SimG4CoreGenerator") << "GenParticle barcode = " << (*vpitr)->barcode() << " passed case 1" << std::endl;
201  }
202 
203  // Decay chain entering exiting the fiducial cylinder defined by theRDecLenCut
204  else if((*vpitr)->status() == 2 && r_decay_length > theRDecLenCut &&
205  fabs(zimpact) < Z_hector ) {
206  toBeAdded=true;
207  if ( verbose > 2 ) LogDebug("SimG4CoreGenerator") << "GenParticle barcode = " << (*vpitr)->barcode() << " passed case 2" << std::endl;
208  }
209 
210  // Particles trasnported along the beam pipe for forward detectors (HECTOR)
211  // Always pass to Geant4 without cuts (to be checked)
212  else if( (*vpitr)->status() == 1 && fabs(zimpact) >= Z_hector && fabs(z1) >= Z_hector) {
213  toBeAdded = true;
214  if ( verbose > 2 ) LogDebug("SimG4CoreGenerator") << "GenParticle barcode = " << (*vpitr)->barcode() << " passed case 3" << std::endl;
215  }
216 
217  if(toBeAdded){
218 
219  G4int pdgcode= (*vpitr)-> pdg_id();
220  G4PrimaryParticle* g4prim=
221  new G4PrimaryParticle(pdgcode, p.Px()*GeV, p.Py()*GeV, p.Pz()*GeV);
222 
223  if ( g4prim->GetG4code() != 0 ){
224  g4prim->SetMass( g4prim->GetG4code()->GetPDGMass() ) ;
225  g4prim->SetCharge( g4prim->GetG4code()->GetPDGCharge() ) ;
226  }
227 
228  g4prim->SetWeight( 10000*(*vpitr)->barcode() ) ;
229  setGenId( g4prim, (*vpitr)->barcode() ) ;
230 
231  if ( (*vpitr)->status() == 2 )
232  particleAssignDaughters(g4prim,(HepMC::GenParticle *) *vpitr, decay_length);
233  if ( verbose > 1 ) g4prim->Print();
234  g4vtx->SetPrimary(g4prim);
235  // impose also proper time for status=1 and available end_vertex
236  if ( (*vpitr)->status()==1 && (*vpitr)->end_vertex()!=0) {
237  double proper_time=decay_length/(p.Beta()*p.Gamma()*c_light);
238  if ( verbose > 1 ) LogDebug("SimG4CoreGenerator") <<"Setting proper time for beta="<<p.Beta()<<" gamma="<<p.Gamma()<<" Proper time=" <<proper_time<<" ns" ;
239  g4prim->SetProperTime(proper_time*ns);
240  }
241  }
242  }
243 
244  if (verbose > 1 ) g4vtx->Print();
245  g4evt->AddPrimaryVertex(g4vtx);
246  ng4vtx++;
247  }
248 
249  // Add a protection for completely empty events (produced by LHCTransport): add a dummy vertex with no particle attached to it
250  if ( ng4vtx == 0 ) {
251  double x1 = 0.;
252  double y1 = 0.;
253  double z1 = 0.;
254  double t1 = 0.;
255  G4PrimaryVertex* g4vtx=
256  new G4PrimaryVertex(x1*mm, y1*mm, z1*mm, t1*mm/c_light);
257  if (verbose > 1 ) g4vtx->Print();
258  g4evt->AddPrimaryVertex(g4vtx);
259  }
260 
261  delete evt ;
262 
263  return ;
264 }
#define LogDebug(id)
void setGenId(G4PrimaryParticle *p, int id) const
Definition: Generator.h:37
void particleAssignDaughters(G4PrimaryParticle *p, HepMC::GenParticle *hp, double length)
Definition: Generator.cc:266
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
T sqrt(T t)
Definition: SSEVec.h:46
double weight_
Definition: Generator.h:55
double theRDecLenCut
Definition: Generator.h:50
math::XYZTLorentzVector * vtx_
Definition: Generator.h:54
bool particlePassesPrimaryCuts(const G4PrimaryParticle *p) const
Definition: Generator.cc:344
double Z_hector
Definition: Generator.h:56
void Generator::nonBeamEvent2G4 ( const HepMC::GenEvent *  g,
G4Event *  e 
)

Definition at line 368 of file Generator.cc.

References g, configurableAnalysis::GenParticle, i, particlePassesPrimaryCuts(), setGenId(), and v.

Referenced by RunManager::generateEvent().

369 {
370  int i = 0;
371  for(HepMC::GenEvent::particle_const_iterator it = evt->particles_begin();
372  it != evt->particles_end(); ++it )
373  {
374  i++;
375  HepMC::GenParticle * g = (*it);
376  int g_status = g->status();
377  // storing only particle with status == 1
378  if (g_status == 1)
379  {
380  int g_id = g->pdg_id();
381  G4PrimaryParticle * g4p =
382  new G4PrimaryParticle(g_id,g->momentum().px()*GeV,g->momentum().py()*GeV,g->momentum().pz()*GeV);
383  if (g4p->GetG4code() != 0)
384  {
385  g4p->SetMass(g4p->GetG4code()->GetPDGMass());
386  g4p->SetCharge(g4p->GetG4code()->GetPDGCharge()) ;
387  }
388  g4p->SetWeight(i*10000);
389  setGenId(g4p,i);
390  if (particlePassesPrimaryCuts(g4p))
391  {
392  G4PrimaryVertex * v = new
393  G4PrimaryVertex(g->production_vertex()->position().x()*mm,
394  g->production_vertex()->position().y()*mm,
395  g->production_vertex()->position().z()*mm,
396  g->production_vertex()->position().t()*mm/c_light);
397  v->SetPrimary(g4p);
398  g4evt->AddPrimaryVertex(v);
399  if(verbose >0) {
400  v->Print();
401  }
402  }
403  }
404  } // end loop on HepMC particles
405 }
int i
Definition: DBlmapReader.cc:9
void setGenId(G4PrimaryParticle *p, int id) const
Definition: Generator.h:37
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
mathSSE::Vec4< T > v
bool particlePassesPrimaryCuts(const G4PrimaryParticle *p) const
Definition: Generator.cc:344
void Generator::particleAssignDaughters ( G4PrimaryParticle *  p,
HepMC::GenParticle *  hp,
double  length 
)
private

Definition at line 266 of file Generator.cc.

References createTree::dd, LogDebug, AlCaHLTBitMon_ParallelJobs::p, hitfit::return, setGenId(), and mathSSE::sqrt().

Referenced by HepMC2G4().

267 {
268 
269  if ( !(vp->end_vertex()) ) return ;
270 
271  if ( verbose > 1 )
272  LogDebug("SimG4CoreGenerator") << "Special case of long decay length \n"
273  << "Assign daughters with to mother with decaylength=" << decaylength << "mm";
274  math::XYZTLorentzVector p(vp->momentum().px(), vp->momentum().py(), vp->momentum().pz(), vp->momentum().e());
275  double proper_time=decaylength/(p.Beta()*p.Gamma()*c_light);
276  if ( verbose > 2 ) {
277  LogDebug("SimG4CoreGenerator") <<" px="<<vp->momentum().px()
278  <<" py="<<vp->momentum().py()
279  <<" pz="<<vp->momentum().pz()
280  <<" e="<<vp->momentum().e()
281  <<" beta="<<p.Beta()
282  <<" gamma="<<p.Gamma()
283  <<" Proper time=" <<proper_time<<" ns" ;
284  }
285  g4p->SetProperTime(proper_time*ns); // the particle will decay after the same length if it has not interacted before
286  double x1 = vp->end_vertex()->position().x();
287  double y1 = vp->end_vertex()->position().y();
288  double z1 = vp->end_vertex()->position().z();
289  for (HepMC::GenVertex::particle_iterator
290  vpdec= vp->end_vertex()->particles_begin(HepMC::children);
291  vpdec != vp->end_vertex()->particles_end(HepMC::children); ++vpdec) {
292 
293  //transform decay products such that in the rest frame of mother
294  math::XYZTLorentzVector pdec((*vpdec)->momentum().px(),
295  (*vpdec)->momentum().py(),
296  (*vpdec)->momentum().pz(),
297  (*vpdec)->momentum().e());
298  // children should only be taken into account once
299  G4PrimaryParticle * g4daught=
300  new G4PrimaryParticle((*vpdec)->pdg_id(), pdec.x()*GeV, pdec.y()*GeV, pdec.z()*GeV);
301  if ( g4daught->GetG4code() != 0 )
302  {
303  g4daught->SetMass( g4daught->GetG4code()->GetPDGMass() ) ;
304  g4daught->SetCharge( g4daught->GetG4code()->GetPDGCharge() ) ;
305  }
306  g4daught->SetWeight( 10000*(*vpdec)->barcode() ) ;
307  setGenId( g4daught, (*vpdec)->barcode() ) ;
308  if ( verbose > 1 ) LogDebug("SimG4CoreGenerator") <<"Assigning a "<<(*vpdec)->pdg_id()
309  <<" as daughter of a " <<vp->pdg_id() ;
310  if ( (*vpdec)->status() == 2 && (*vpdec)->end_vertex() != 0 )
311  {
312  double x2 = (*vpdec)->end_vertex()->position().x();
313  double y2 = (*vpdec)->end_vertex()->position().y();
314  double z2 = (*vpdec)->end_vertex()->position().z();
315  double dd = std::sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2));
316  particleAssignDaughters(g4daught,*vpdec,dd);
317  }
318  (*vpdec)->set_status(1000+(*vpdec)->status());
319  g4p->SetDaughter(g4daught);
320  }
321  return;
322 }
#define LogDebug(id)
void setGenId(G4PrimaryParticle *p, int id) const
Definition: Generator.h:37
void particleAssignDaughters(G4PrimaryParticle *p, HepMC::GenParticle *hp, double length)
Definition: Generator.cc:266
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
T sqrt(T t)
Definition: SSEVec.h:46
bool Generator::particlePassesPrimaryCuts ( const G4PrimaryParticle *  p) const
private

Definition at line 344 of file Generator.cc.

References eta(), fEtaCuts, fPCuts, fPhiCuts, create_public_lumi_plots::log, LogDebug, phi, mathSSE::sqrt(), funct::tan(), theMaxEtaCut, theMaxPCut, and theMaxPhiCut.

Referenced by HepMC2G4(), and nonBeamEvent2G4().

345 {
346 
347  G4ThreeVector mom = p->GetMomentum();
348  double phi = mom.phi() ;
349  double nrg = sqrt(p->GetPx()*p->GetPx() + p->GetPy()*p->GetPy() + p->GetPz()*p->GetPz());
350  nrg /= GeV ; // need to convert, since Geant4 operates in MeV
351  double eta = -log(tan(mom.theta()/2));
352  bool flag = true;
353 
354  if ( (fEtaCuts) && (eta < theMinEtaCut || eta > theMaxEtaCut) ) {
355  flag = false;
356  } else if ( (fPCuts) && (nrg < theMinPCut || nrg > theMaxPCut) ) {
357  flag = false;
358  } else if ( (fPhiCuts) && (phi < theMinPhiCut || phi > theMaxPhiCut) ) {
359  flag = false;
360  }
361 
362  if ( verbose > 2 ) LogDebug("SimG4CoreGenerator") << "Generator p = " << nrg << " eta = " << eta << " theta = " << mom.theta() << " phi = " << phi << " Flag = " << flag;
363 
364  return flag;
365 
366 }
#define LogDebug(id)
bool fPhiCuts
Definition: Generator.h:43
long int flag
Definition: mlp_lapack.h:47
double theMaxPhiCut
Definition: Generator.h:45
T eta() const
T sqrt(T t)
Definition: SSEVec.h:46
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double theMaxEtaCut
Definition: Generator.h:47
double theMaxPCut
Definition: Generator.h:49
bool fEtaCuts
Definition: Generator.h:42
Definition: DDAxes.h:10
bool fPCuts
Definition: Generator.h:41
bool Generator::particlePassesPrimaryCuts ( const math::XYZTLorentzVector mom,
const double  zimp 
) const
private

Definition at line 324 of file Generator.cc.

References fEtaCuts, fPCuts, fPhiCuts, LogDebug, phi, theMaxPCut, theMaxPhiCut, and Z_lmax.

325 {
326 
327  double phi = mom.Phi() ;
328  double nrg = mom.P() ;
329  bool flag = true;
330 
331  if ( (fEtaCuts) && (zimp < Z_lmin || zimp > Z_lmax) ) {
332  flag = false;
333  } else if ( (fPCuts) && (nrg < theMinPCut || nrg > theMaxPCut) ) {
334  flag = false;
335  } else if ( (fPhiCuts) && (phi < theMinPhiCut || phi > theMaxPhiCut) ) {
336  flag = false;
337  }
338 
339  if ( verbose > 2 ) LogDebug("SimG4CoreGenerator") << "Generator p = " << nrg << " z_imp = " << zimp << " phi = " << mom.Phi() << " Flag = " << flag;
340 
341  return flag;
342 }
#define LogDebug(id)
bool fPhiCuts
Definition: Generator.h:43
long int flag
Definition: mlp_lapack.h:47
double Z_lmax
Definition: Generator.h:56
double theMaxPhiCut
Definition: Generator.h:45
double theMaxPCut
Definition: Generator.h:49
bool fEtaCuts
Definition: Generator.h:42
Definition: DDAxes.h:10
bool fPCuts
Definition: Generator.h:41
void Generator::setGenEvent ( const HepMC::GenEvent *  inpevt)
inline

Definition at line 27 of file Generator.h.

References evt_, and hitfit::return.

Referenced by RunManager::generateEvent().

27 { evt_ = (HepMC::GenEvent*)inpevt; return ; }
HepMC::GenEvent * evt_
Definition: Generator.h:53
void Generator::setGenId ( G4PrimaryParticle *  p,
int  id 
) const
inlineprivate

Definition at line 37 of file Generator.h.

Referenced by HepMC2G4(), nonBeamEvent2G4(), and particleAssignDaughters().

Member Data Documentation

HepMC::GenEvent* Generator::evt_
private

Definition at line 53 of file Generator.h.

Referenced by genEvent(), and setGenEvent().

bool Generator::fEtaCuts
private

Definition at line 42 of file Generator.h.

Referenced by Generator(), and particlePassesPrimaryCuts().

bool Generator::fPCuts
private

Definition at line 41 of file Generator.h.

Referenced by particlePassesPrimaryCuts().

bool Generator::fPhiCuts
private

Definition at line 43 of file Generator.h.

Referenced by particlePassesPrimaryCuts().

double Generator::theEtaCutForHector
private

Definition at line 51 of file Generator.h.

Referenced by Generator().

double Generator::theMaxEtaCut
private

Definition at line 47 of file Generator.h.

Referenced by Generator(), and particlePassesPrimaryCuts().

double Generator::theMaxPCut
private

Definition at line 49 of file Generator.h.

Referenced by particlePassesPrimaryCuts().

double Generator::theMaxPhiCut
private

Definition at line 45 of file Generator.h.

Referenced by particlePassesPrimaryCuts().

double Generator::theMinEtaCut
private

Definition at line 46 of file Generator.h.

Referenced by Generator().

double Generator::theMinPCut
private

Definition at line 48 of file Generator.h.

double Generator::theMinPhiCut
private

Definition at line 44 of file Generator.h.

double Generator::theRDecLenCut
private

Definition at line 50 of file Generator.h.

Referenced by Generator(), and HepMC2G4().

int Generator::verbose
private

Definition at line 52 of file Generator.h.

math::XYZTLorentzVector* Generator::vtx_
private

Definition at line 54 of file Generator.h.

Referenced by genVertex(), and HepMC2G4().

double Generator::weight_
private

Definition at line 55 of file Generator.h.

Referenced by eventWeight(), and HepMC2G4().

double Generator::Z_hector
private

Definition at line 56 of file Generator.h.

Referenced by Generator(), and HepMC2G4().

double Generator::Z_lmax
private

Definition at line 56 of file Generator.h.

Referenced by Generator(), and particlePassesPrimaryCuts().

double Generator::Z_lmin
private

Definition at line 56 of file Generator.h.

Referenced by Generator().