ATLAS Offline Software
OldSpclMcFilterTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // OldSpclMcFilterTool.cxx
7 // Implementation file for class OldSpclMcFilterTool
8 // Author: S.Binet<binet@cern.ch>
10 
11 
12 // STL includes
13 #include <cmath>
14 
15 // CLHEP/HepMC includes
17 #include "GenAccessIO.h"
18 #include "AtlasHepMC/GenEvent.h"
19 #include "AtlasHepMC/GenParticle.h"
20 #include "AtlasHepMC/GenVertex.h"
21 #include "AtlasHepMC/Relatives.h"
22 #include "CLHEP/Units/SystemOfUnits.h"
24 
25 
26 // McParticleKernel includes
28 
29 // McParticleTools includes
30 #include "OldSpclMcFilterTool.h"
31 
33 // Public methods:
35 
36 using namespace TruthHelper;
37 using CLHEP::GeV;
38 
39 // Constructors
42  const std::string& name,
43  const IInterface* parent ) :
45  m_tesIO( nullptr )
46 {
47  //
48  // Property declaration
49  //
50  //declareProperty( "Property", m_nProperty );
51 
52  declareProperty( "rIsolation",
53  m_rIsol = 0.45,
54  "DeltaR isolation energy cut for electrons, muons, "
55  "taus and photons" );
56 
57  declareProperty( "ptGammaMin",
58  m_ptGamMin = 0.5*GeV,
59  "Minimum threshold for transverse momentum of photons" );
60 
61  declareProperty( "ptMin",
62  m_ptMin = 0.5*GeV,
63  "Minimum threshold for transverse momentum for all particles.\n"
64  "Warning: this cut is applied *before* Pt photon cut !" );
65 
66  declareProperty( "etaRange",
67  m_etaRange = 5.0,
68  "Eta acceptance cut applied on all stable particles" );
69 
70  // switches
71 
72  declareProperty( "IncludeSimul",
73  m_includeSimul = true,
74  "Switch to include or not particles from detector simulation "
75  "(Geant 4)" );
76 
77  declareProperty( "IncludePartonShowers",
79  "Switch to include or not parton showers" );
80 
81  declareProperty( "RemoveDecayToSelf",
82  m_removeDecayToSelf = true,
83  "Switch to remove particles which decay into themselves (t->tg) "
84  "*but* only for generated particles, not the ones from the "
85  "Geant4 interactions" );
86 
87 }
88 
89 // Destructor
92 {
93  delete m_tesIO; m_tesIO = nullptr;
94  ATH_MSG_DEBUG("Calling destructor");
95 }
96 
98 // Non-const methods:
100 
103 {
104  if ( nullptr == in || nullptr == out ) {
105  ATH_MSG_ERROR("Invalid pointer to McEventCollection !" << endmsg
106  << " in: " << in << endmsg
107  << " out: " << out);
108  return StatusCode::FAILURE;
109  }
110 
111  // we just copy the input McEventCollection and put it into the output one
112  out->operator=( *in );
113 
114  // select the barcodes of the "special" particles from the input GenEvent
115  if ( selectSpclMcBarcodes().isFailure() ) {
116  ATH_MSG_ERROR("Could not select the \"special\" barcodes !!");
117  return StatusCode::FAILURE;
118  }
119 
120  // remove the not "special" particles from the filtered McEventCollection
121  if ( shapeGenEvent(out).isFailure() ) {
122  ATH_MSG_ERROR("Could not remove the not \"special\" particles from the "\
123  "filtered McEventCollection !!");
124  return StatusCode::FAILURE;
125  }
126 
127  // reconnect the particles
128  if ( reconnectParticles(in, out).isFailure() ) {
129  ATH_MSG_ERROR("Could not reconnect the particles in the filtered "\
130  "McEventCollection !!");
131  return StatusCode::FAILURE;
132  }
133 
134  return StatusCode::SUCCESS;
135 }
136 
138 // Non-const methods:
141 {
142  StatusCode sc = StatusCode::SUCCESS;
143 
144  // Get all of the generated particles (does not have Geant secondaries)
145 
146  std::vector<HepMC::ConstGenParticlePtr> particles;
147  if ( m_includeSimul ) {
149  } else {
151  }
152  if ( sc.isFailure() ) {
153  ATH_MSG_ERROR("Could not get Monte Carlo particles from TDS at : "
155  return StatusCode::FAILURE;
156  }
157 
158  m_barcodes.clear();
159 
160  // Loop over all particles, selecting special ones
161  // keep track of them using their barcodes
162 
163  for (const auto& part : particles) {
164 
165  const int id = part->pdg_id();
166  const int ida = std::abs(id);
167  const HepMC::FourVector hlv = part->momentum();
168  const double pt = hlv.perp();
169  const double eta = hlv.pseudoRapidity();
170  const double mass = hlv.m();
171  const int barcode = HepMC::barcode(part);
172 
173  HepMC::ConstGenVertexPtr decayVtx = part->end_vertex();
174  HepMC::ConstGenVertexPtr prodVtx = part->production_vertex();
175 
176  bool isSpcl = false;
177 
179  if( !MC::isStable(part) && !decayVtx ) continue;
180 
181  const bool accept = pt > m_ptMin;
182 
184  // Select special particles
186 
188  if (m_includeSimul ) {
189  if ( MC::isSimStable(part) && accept && std::abs(eta) < m_etaRange ) isSpcl = true;
190  } else {
191  if ( MC::isGenStable(part) && accept && std::abs(eta) < m_etaRange ) isSpcl = true;
192  }
193  // e, mu, tau, neutrino
194  // Hard coded cut pt>2GeV to remove beam-jet Dalitz decays, etc.
195  if( MC::isSMLepton(part) && pt>2.*GeV && std::abs(eta) < m_etaRange ) isSpcl = true;
196 
199  if ( MC::isPhoton(part) && pt>m_ptGamMin && std::abs(eta) < m_etaRange ) {
201  if ( nullptr == part->end_vertex() ) {
202  isSpcl=true;
203  }
204  }
205 
206  // Any long-lived B meson or baryon 5x1 or 5xx2
207  int ifl=0;
208  if( ida>100 && ida<1000) ifl=ida/100;
209  if( ida>1000 && ida<10000) ifl=ida/1000;
210  int jj1 = ida%10;
211  if( (ifl==5 && jj1<3 && mass<9.0*GeV) || ( ifl==4 && jj1<3 && mass<2.4*GeV) ) {
212  if (accept) isSpcl = true;
213  }
214 
215  // Any heavy particle other than quarks or gluons.
216  // M > 9.0GeV excludes B hadrons but includes Upsilon, W, Z, t, ...
217  if( ida>5 && ida!=21 && ida!=9 && mass>9.*GeV && accept ) isSpcl=true;
218 
219  // save the quarks
220  if (ida >= 1 && ida <= 5 && accept ) isSpcl = true;
221 
222  // save the gluons
223  if ( ida == 21 && accept ) isSpcl = true;
224 
225  // save the double charged Higgs
226  if ( (ida == 9900041 || ida == 9900042) && accept ) isSpcl = true;
227 
228  // SUSY particles -- relies on PDG codes
229  if( ida>1000000 && ida<3000000 && accept ) isSpcl = true;
230 
232  // Exclude invalid special particles
234 
235  // Monte Carlo internal particles per PDG
236  if( ida>80 && ida<101 ) isSpcl=false;
237 
238  // Particles decaying into itself
239  // This prevents documentaries from being reported twice and
240  // eliminates (if asked to) parton showers like q -> qg.
241  // But should not delete particle if child is from GEANT.
242  if( isSpcl && decayVtx ) {
243  auto dcyVtx = part->end_vertex();
244  for(const auto& child: *dcyVtx) {
245  if( child->pdg_id()==id && //> looking for parton showers or documentaries
246  HepMC::barcode(child) !=barcode && //> just to be sure that merging GEN_EVENT/G4Truth is OK
247  !HepMC::is_simulation_particle(child) //> child is not from GEANT
248  ) {
249  if ( m_includePartonShowers ) {
250  // we keep the parent particle
251  // this could be vertices of the form :
252  // q -> q + g + b + bbar(hence the outgoing quark isn't decaying:documentary)
253  // t -> t + W + b (with outgoing top being a documentary)
254  // q -> q + g (real parton shower)
255  isSpcl = true;
256  } else {
257  isSpcl = false;
258  }
259  }
260  }
261  }
262 
267  if ( ( decayVtx && m_mcVtxFilterTool->isAccepted(decayVtx) ) ||
268  ( prodVtx && m_mcVtxFilterTool->isAccepted(prodVtx) ) ) {
269  isSpcl = true;
270  }
271 
273  // Save special particles and children
275  if( !isSpcl ) continue;
276  m_barcodes.insert(barcode); // add it to list
277 
278  // Children
279  if( isSpcl && decayVtx ) {
280  for(const auto& child: *(part->end_vertex())) {
282  m_barcodes.insert(HepMC::barcode(child));// its not there already
283  }
284  }
285  }
286 
287  }
288  ATH_MSG_DEBUG("Read " << particles.size()
289  << " and selected " << m_barcodes.size() << " particles");
290 
291  return StatusCode::SUCCESS;
292 }
293 
295 {
296  //now remove all the particles except those whose barcodes are marked
297  for ( McEventCollection::iterator evt = genAod->begin(); evt != genAod->end();++evt) {
298  std::vector<HepMC::GenParticlePtr> going_out;
299 
300 #ifdef HEPMC3
301  for ( auto & p : ((HepMC::GenEvent*)(*evt))->particles()) {
302 //AV: We modify event
303  int pBC = HepMC::barcode(p);
304  ATH_MSG_DEBUG("[pdg,bc]= " << p->pdg_id() << ", " << pBC);
305  if ( m_barcodes.count(pBC) != 0 ) continue;
306  going_out.push_back(p); // list of useless particles
307  auto pvtx = p->production_vertex();
308  auto evtx = p->end_vertex();
309  if (pvtx) pvtx->remove_particle_out(p); //remove from production vertex from useless partilcle
310  if (evtx) { // if it has end vertex, may need to move the out partilces
311  if(pvtx){ // move the partilces back
312  for (auto& pp: evtx->particles_out()) {
313  pvtx->add_particle_out(pp);
314  }
315  }
316  evtx->remove_particle_out(p); // disconnect from end vertex
317  }
318  }//> loop over particles
319 #else
320  std::list<int> evtBarcodes;
321  for ( const auto& p: **evt ) {
322  evtBarcodes.push_back( HepMC::barcode(p) );
323  }
324  for ( std::list<int>::const_iterator itrBc = evtBarcodes.begin();itrBc != evtBarcodes.end(); ++itrBc ) {
325 //AV: We modify event
326  HepMC::GenParticlePtr p = HepMC::barcode_to_particle((HepMC::GenEvent*)(*evt),*itrBc);
327  int pBC = HepMC::barcode(p);
328  ATH_MSG_DEBUG("[pdg,bc]= " << p->pdg_id() << ", " << pBC);
329  if ( m_barcodes.count(pBC) == 0 ) {
330  going_out.push_back(p); // list of useless particles
331  auto pvtx = p->production_vertex();
332  auto evtx = p->end_vertex();
333  if (pvtx) pvtx->remove_particle(p); //remove from production vertex from useless partilcle
334  if (evtx) { // if it has end vertex, may need to move the out partilces
335  if(pvtx){ // move the partilces back
336  if ( msgLvl(MSG::DEBUG) ) {
337  msg(MSG::DEBUG) << "\tin endVtx "<< endmsg;
338  }
339  while ( evtx->particles_out_const_begin() != evtx->particles_out_const_end()) {
340  HepMC::GenVertex::particles_out_const_iterator np = evtx->particles_out_const_begin();
341  pvtx->add_particle_out(*np); // note that this really is a MOVE!!! it get taken off evtx by magic
342  }
343  }//> end if [prod vertex]
344  evtx->remove_particle(p); // disconnect from end vertex
345  }//> end if [decay vertex]
346  }//> particle has to be removed
347  }//> loop over particles (via their barcode)
348 #endif
349 
350 
351 #ifdef HEPMC3
352  // there may be a bunch of vertices with no particles connected to them:
353  // ==> Get rid of them //AV: Not sure if this is needed
354  std::vector<HepMC::ConstGenVertexPtr> going_out_again;
355  for ( auto& v: (*evt)->vertices()) {
356  if ( v->particles_in().empty() && v->particles_out().empty() ){
357  going_out_again.push_back(v);
358  }
359  }//> loop over vertices
360 //HepMC3 uses smart pointers
361 #else
362  // now get rid of all dead particles
363  for ( std::vector<HepMC::GenParticle*>::iterator d = going_out.begin();
364  d != going_out.end();
365  ++d ){
366  delete *d;
367  }
368 
369  // there may be a bunch of vertices with no particles connected to them:
370  // ==> Get rid of them
371  std::vector<HepMC::GenVertex*> going_out_again;
372  for ( HepMC::GenEvent::vertex_const_iterator v = (*evt)->vertices_begin();
373  v != (*evt)->vertices_end(); ++v ) {
374  if ( (*v)->particles_in_size() == 0 && (*v)->particles_out_size() == 0 ){
375  going_out_again.push_back(*v);
376  }
377  }//> loop over vertices
378 
379  // now get rid of all dead vertices
380  for ( std::vector<HepMC::GenVertex*>::iterator d = going_out_again.begin();
381  d != going_out_again.end();
382  ++d ){
383  delete *d;
384  }
385 #endif
386 
387  }//> loop over GenEvents in McEventCollection
388 
389  // Set the signal_process_vertex to NULL if not to be recorded
390  for ( McEventCollection::iterator evt = genAod->begin(); evt != genAod->end(); ++evt) {
391 #ifdef HEPMC3
392  auto sigProcVtx = HepMC::signal_process_vertex(*evt);
393  if (!sigProcVtx) continue;
394  const int sigProcBC = HepMC::barcode(sigProcVtx);
395  bool isInColl = false;
396  for ( const auto& itrVtx: (*evt)->vertices() ) {
397  if ( sigProcBC == HepMC::barcode(itrVtx) ) {
398  isInColl = true;
399  break;
400  }
401  } //> loop over vertices
402 //AV: We don't set nullptr as signal vertex in HepMC3
403  if ( !isInColl ) {
404  (*evt)->remove_attribute("signal_process_vertex");
405  }
406 #else
407  const HepMC::GenVertex * sigProcVtx = (*evt)->signal_process_vertex();
408  if ( 0 != sigProcVtx ) {
409  const int sigProcBC = sigProcVtx->barcode();
410  bool isInColl = false;
411  for ( HepMC::GenEvent::vertex_const_iterator itrVtx = (*evt)->vertices_begin();
412  itrVtx != (*evt)->vertices_end();
413  ++itrVtx ) {
414  if ( sigProcBC == (*itrVtx)->barcode() ) {
415  isInColl = true;
416  break;
417  }
418  } //> loop over vertices
419  if ( !isInColl ) {
420  (*evt)->set_signal_process_vertex(0);
421  }
422  }//> a signal_process_vertex has been setup
423 #endif
424  }//> loop over GenEvent's
425 
426  return StatusCode::SUCCESS;
427 }
428 
431 {
432  if ( nullptr == in || nullptr == out ) {
433  ATH_MSG_ERROR("Invalid pointer to McEventCollection !!" << endmsg
434  << " in: " << in << endmsg
435  << " out: " << out);
436  return StatusCode::FAILURE;
437  }
438 #ifdef HEPMC3
439  return StatusCode::SUCCESS;
440 #else
441  for ( unsigned int iEvt = 0; iEvt != in->size(); ++iEvt) {
442  const HepMC::GenEvent * evt = (*in)[iEvt];
443  HepMC::GenEvent * outEvt = (*out)[iEvt];
444 
445  // Reconnect the particles
446  ATH_MSG_VERBOSE("Reconnecting particles...");
447  for (const auto& itrPart: *outEvt) {
448  if ( itrPart->end_vertex() ) {
449  continue;
450  }
451  if ( rebuildLinks( evt, outEvt, itrPart ).isFailure() ) {
452  ATH_MSG_WARNING("Could not rebuild links for this particle = "<< itrPart);
453  } else if ( msgLvl(MSG::VERBOSE) ) {
455  << "==========================================================="
456  << endmsg << "Production vertex for particle " << itrPart << " : ";
457  if ( itrPart->production_vertex() ) {
458  std::stringstream prodVtx("");
459  HepMC::Print::line(prodVtx,itrPart->production_vertex());
460  msg(MSG::VERBOSE) << std::endl << prodVtx.str() << endmsg;
461  } else {
462  msg(MSG::VERBOSE) << "[No production vertex]" << endmsg;
463  }
464 
465  msg(MSG::VERBOSE) << "Decay vertex for particle "
466  << itrPart << " : ";
467  if ( itrPart->end_vertex() ) {
468  std::stringstream dcyVtx("");
469  HepMC::Print::line(dcyVtx, itrPart->end_vertex());
470  msg(MSG::VERBOSE) << std::endl
471  << dcyVtx.str()
472  << endmsg;
473  } else {
474  msg(MSG::VERBOSE) << endmsg << "[No decay vertex]" << endmsg;
475  }
476  }//> end VERBOSE messages
477 
478  }//> loop over particles
479  }//> loop over GenEvents
480 
481  return StatusCode::SUCCESS;
482 #endif
483 }
484 
485 StatusCode OldSpclMcFilterTool::rebuildLinks( const HepMC::GenEvent * mcEvt,
486  HepMC::GenEvent * outEvt,
487  const HepMC::GenParticlePtr& mcPart )
488 {
489 
490  if ( !mcPart ) {
491  ATH_MSG_WARNING("Null GenParticle: can not rebuildLinks");
492  return StatusCode::FAILURE;
493  }
494 
495  if ( mcPart->end_vertex() ) {
496  ATH_MSG_VERBOSE("GenParticle has already a decay vertex : nothing to do");
497  return StatusCode::SUCCESS;
498  }
499 
500  if ( !mcEvt ) {
501  ATH_MSG_WARNING("Null input HepMC::GenEvent : can not rebuildLinks");
502  return StatusCode::FAILURE;
503  }
504 
505  if ( !outEvt ) {
506  ATH_MSG_WARNING("Null output HepMC::GenEvent: can not rebuildLinks");
507  return StatusCode::FAILURE;
508  }
509 #ifdef HEPMC3
510  return StatusCode::SUCCESS;
511 #else
512  // Cache some useful infos
513  const int pdgId = mcPart->pdg_id();
514  const int bc = HepMC::barcode(mcPart);
515 
516 //AV: Const correctness is broken for HepMC2.
518  HepMC::GenVertexPtr dcyVtx = inPart->end_vertex();
519 
520  if ( !dcyVtx ) {
521  ATH_MSG_VERBOSE("No decay vertex for the particle #" << bc << " : " << "No link to rebuild...");
522  return StatusCode::SUCCESS;
523  }
524 
525  std::list<int> bcChildPart;
526  std::list<int> bcChildVert;
527 
528  //
529  // Loop over all descendants of the GenParticle
530  // Store the barcode of the GenParticles entering into each GenVertex
531  //
532  const HepMC::GenVertex::vertex_iterator endVtx = dcyVtx->vertices_end(HepMC::descendants);
533  for ( HepMC::GenVertex::vertex_iterator itrVtx = dcyVtx->vertices_begin( HepMC::descendants );
534  itrVtx != endVtx;
535  ++itrVtx ) {
536  bool foundPdgId = false;
537  HepMC::GenVertex::particles_in_const_iterator endPart = (*itrVtx)->particles_in_const_end();
538  for ( HepMC::GenVertex::particles_in_const_iterator itrPart = (*itrVtx)->particles_in_const_begin();
539  itrPart != endPart;
540  ++itrPart ) {
541 
542  // because the vertices are traversed in POST ORDER !!
543  // (quoting GenVertex::vertex_iterator)
544  bcChildPart.push_front( (*itrPart)->barcode() );
545 
546  if ( (*itrPart)->pdg_id() == pdgId ) {
547  foundPdgId = true;
548  }
549  }//> loop over in-going particles of this vertex
550 
551  if ( foundPdgId ) {
552  bcChildVert.push_front( (*itrVtx)->barcode() );
553  }
554 
555  }//> loop over descendants of decay vertex
556 
557  //
558  // Now we loop over the previously stored barcodes and
559  // we connect our GenParticle to the first found barcode
560  //
561  std::list<int>::const_iterator bcVtxEnd = bcChildVert.end();
562  for ( std::list<int>::const_iterator itrBcVtx = bcChildVert.begin();
563  itrBcVtx != bcVtxEnd;
564  ++itrBcVtx ) {
565  HepMC::GenVertex * childVtx = outEvt->barcode_to_vertex(*itrBcVtx);
566  if ( childVtx ) {
567  if ( childVtx->particles_in_size() > 0 ) {
568  HepMC::GenVertex::particles_in_const_iterator endPart = childVtx->particles_in_const_end();
569  for ( HepMC::GenVertex::particles_in_const_iterator itrPart = childVtx->particles_in_const_begin();
570  itrPart != endPart;
571  ++itrPart ) {
572  if ( (*itrPart)->pdg_id() == pdgId ) {
573  HepMC::GenVertex * prodVtx = (*itrPart)->production_vertex();
574  if ( prodVtx ) {
575  if ( prodVtx->particles_in_size() > 0 ) {
576  // Humm... This is not what we'd have expected
577  // so we skip it
578  if ( msgLvl(MSG::VERBOSE) ) {
580  << "found a particle = "
581  << (*itrPart) << ", "
582  << "but its production vertex has incoming particles !"
583  << endmsg;
584  continue;
585  }
586  // create a GenVertex which will be the decay vertex of our
587  // GenParticle and the production vertex of the GenParticle
588  // we just found
590  outEvt->add_vertex( linkVtx );
591  linkVtx->add_particle_in( mcPart );
592  linkVtx->add_particle_out( *itrPart );
593 
594  msg(MSG::ERROR)
595  << "====================================================="
596  << endmsg
597  << "Created a GenVertex - link !"
598  << std::endl;
599  std::stringstream vtxLink("");
600  linkVtx->print(vtxLink);
601  msg(MSG::ERROR)
602  << vtxLink.str()
603  << endmsg
604  << "====================================================="
605  << endmsg;
606  }
607  }
608  }
609  }//> loop over incoming particles
610  } else {
611  // no incoming particle : so we just add this particle
612  // a bit odd though : FIXME ?
613  childVtx->add_particle_in(mcPart);
614  msg(MSG::WARNING) << "Odd situation:" << std::endl;
615  std::stringstream vtxDump( "" );
616  childVtx->print(vtxDump);
617  msg(MSG::WARNING) << vtxDump.str() << endmsg;
618  return StatusCode::SUCCESS;
619  }//> end if incoming particles
620  }//> found a child-vertex
621  }//> loop over child-vertex-barcodes
622  return StatusCode::FAILURE;
623 #endif
624 }
625 
627 {
628  ATH_MSG_DEBUG("Calling initializeTool");
629  delete m_tesIO; m_tesIO = nullptr;
630  // accessor for particles
631  m_tesIO = new GenAccessIO();
632  if( m_tesIO == nullptr ) {
633  ATH_MSG_ERROR("Unable to retrieve GenAccessIO pointer");
634  return StatusCode::FAILURE;
635  }
636  return StatusCode::SUCCESS;
637 }
638 
HepMC::GenVertexPtr
HepMC::GenVertex * GenVertexPtr
Definition: GenVertex.h:59
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
GenEvent.h
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
hist_file_dump.d
d
Definition: hist_file_dump.py:137
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
GenVertex.h
HepMC::GenParticlePtr
GenParticle * GenParticlePtr
Definition: GenParticle.h:37
McEventCollection
McEventCollection
Definition: GeneratorObjectsTPCnv.cxx:60
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
OldSpclMcFilterTool::m_includeSimul
BooleanProperty m_includeSimul
Switch to include or not particles from detector simulation (Geant4)
Definition: OldSpclMcFilterTool.h:124
OldSpclMcFilterTool::m_tesIO
TruthHelper::GenAccessIO * m_tesIO
Pointer to a StoreGateSvc helper (Mc particle retrieval with predicates)
Definition: OldSpclMcFilterTool.h:132
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
PlotPulseshapeFromCool.np
np
Definition: PlotPulseshapeFromCool.py:64
HepMC::Print::line
void line(std::ostream &os, const GenEvent &e)
Definition: GenEvent.h:554
GenParticle.h
PowhegPy8EG_H2a.pdgId
dictionary pdgId
Definition: PowhegPy8EG_H2a.py:128
dqt_zlumi_pandas.mass
mass
Definition: dqt_zlumi_pandas.py:170
OldSpclMcFilterTool::m_etaRange
DoubleProperty m_etaRange
Eta acceptance cut applied on all stable particles.
Definition: OldSpclMcFilterTool.h:120
MC::isGenStable
bool isGenStable(const T &p)
Determine if the particle is stable at the generator (not det-sim) level,.
Definition: HepMCHelpers.h:36
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
isSMLepton
bool isSMLepton(const T &p)
Definition: AtlasPID.h:134
OldSpclMcFilterTool::m_removeDecayToSelf
BooleanProperty m_removeDecayToSelf
Switch to remove particles which decay into themselves (t->tg) but only for generated particles,...
Definition: OldSpclMcFilterTool.h:137
GenAccessIO.h
OldSpclMcFilterTool::m_barcodes
std::set< int > m_barcodes
List of particles (in fact their unique barcode) which have been labelled as "special".
Definition: OldSpclMcFilterTool.h:103
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HepMC::barcode_to_particle
GenParticle * barcode_to_particle(const GenEvent *e, int id)
Definition: GenEvent.h:506
HepMC::is_simulation_particle
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
Definition: MagicNumbers.h:299
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
HepMC::newGenVertexPtr
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
Definition: GenVertex.h:64
TruthParticleFilterBaseTool::m_mcEventsReadHandleKey
SG::ReadHandleKey< McEventCollection > m_mcEventsReadHandleKey
ReadHandleKey for the input McEventCollection one wants to filter.
Definition: TruthParticleFilterBaseTool.h:100
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TruthParticleFilterBaseTool::m_mcVtxFilterTool
McVtxFilterTool_t m_mcVtxFilterTool
Pointer to the McVtxFilterTool to be able to select additional vertices on some decay pattern criteri...
Definition: TruthParticleFilterBaseTool.h:78
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
test_pyathena.parent
parent
Definition: test_pyathena.py:15
OldSpclMcFilterTool::m_ptGamMin
DoubleProperty m_ptGamMin
Minimum threshold for transverse momentum of photons.
Definition: OldSpclMcFilterTool.h:111
TruthHelper::GenAccessIO::getMC
StatusCode getMC(MCParticleCollection &mcParticles, const bool ifgen=false, const std::string &key="GEN_EVENT") const
Definition: Generators/FlowAfterburner/FlowAfterburner/GenAccessIO.h:32
OldSpclMcFilterTool::m_rIsol
DoubleProperty m_rIsol
deltaR isolation energy cut for electrons, muons, taus and photons
Definition: OldSpclMcFilterTool.h:107
TruthParticleFilterBaseTool
Definition: TruthParticleFilterBaseTool.h:33
OldSpclMcFilterTool::~OldSpclMcFilterTool
virtual ~OldSpclMcFilterTool()
Destructor:
Definition: OldSpclMcFilterTool.cxx:91
OldSpclMcFilterTool::reconnectParticles
StatusCode reconnectParticles(const McEventCollection *inEvt, McEventCollection *out)
Reconnect the particles of the filtered McEventCollection.
Definition: OldSpclMcFilterTool.cxx:429
OldSpclMcFilterTool::m_ptMin
DoubleProperty m_ptMin
Minimum threshold for transverse momentum for all particles.
Definition: OldSpclMcFilterTool.h:116
TruthHelper
Definition: Generators/FlowAfterburner/FlowAfterburner/GenAccessIO.h:22
OldSpclMcFilterTool::initializeTool
StatusCode initializeTool()
to get tesIO
Definition: OldSpclMcFilterTool.cxx:626
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MagicNumbers.h
TruthHelper::GenAccessIO
Definition: Generators/FlowAfterburner/FlowAfterburner/GenAccessIO.h:24
python.PyAthena.v
v
Definition: PyAthena.py:157
MC::isStable
bool isStable(const T &p)
Definition: HepMCHelpers.h:30
OldSpclMcFilterTool::selectSpclMcBarcodes
StatusCode selectSpclMcBarcodes()
Retrieve the GenParticles from the GenEvent object (located into the McEventCollection container),...
Definition: OldSpclMcFilterTool.cxx:140
OldSpclMcFilterTool::buildMcAod
StatusCode buildMcAod(const McEventCollection *in, McEventCollection *out)
This method will check the validity of the input McEventCollection and build a filtered one from the ...
Definition: OldSpclMcFilterTool.cxx:101
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
OldSpclMcFilterTool::OldSpclMcFilterTool
OldSpclMcFilterTool()
Default constructor:
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::EgammaHelpers::isPhoton
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
Definition: EgammaxAODHelpers.cxx:22
OldSpclMcFilterTool.h
DEBUG
#define DEBUG
Definition: page_access.h:11
Relatives.h
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
OldSpclMcFilterTool::m_includePartonShowers
BooleanProperty m_includePartonShowers
Switch to include or not parton showers.
Definition: OldSpclMcFilterTool.h:128
IMcVtxFilterTool.h
HepMC::ConstGenVertexPtr
const HepMC::GenVertex * ConstGenVertexPtr
Definition: GenVertex.h:60
MC::isSimStable
bool isSimStable(const T &p)
Identify if the particle is considered stable at the post-detector-sim stage.
Definition: HepMCHelpers.h:39
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
OldSpclMcFilterTool::rebuildLinks
StatusCode rebuildLinks(const HepMC::GenEvent *mcEvent, HepMC::GenEvent *outEvt, const HepMC::GenParticlePtr &mcPart)
Rebuild the links between particles which were connected, eg by a long FSR chain.
Definition: OldSpclMcFilterTool.cxx:485
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
HepMCHelpers.h
OldSpclMcFilterTool::shapeGenEvent
StatusCode shapeGenEvent(McEventCollection *outEvt)
Build the out McEventCollection by removing all the GenParticles whose barcode is not in the list of ...
Definition: OldSpclMcFilterTool.cxx:294
HepMC::signal_process_vertex
GenVertex * signal_process_vertex(const GenEvent *e)
Definition: GenEvent.h:503