ATLAS Offline Software
EvtInclusiveDecay.cxx
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // Generators/EvtGen_i/EvtInclusiveDecay.h
4 //
5 // EvtInclusiveDecay is a TopAlg that takes HepMC events from StoreGate and
6 // generates particle decays using EvtGen. Depending on job options either all or
7 // only a subset of the particles which have decays defined in the EvtGen
8 // decay files will be handed to EvtGen. Both undecayed particles and particles
9 // with an existing decay tree can be handled (in the latter case,
10 // EvtInclusiveDecay will remove the existing decay tree).
11 //
12 // Written in February 2006 by Juerg Beringer, based in part on the existing
13 // EvtDecay module.
14 //
15 //*****************************************************************************
16 
18 
19 #include "EvtGenBase/EvtAbsRadCorr.hh"
20 #include "EvtGenBase/EvtDecayBase.hh"
21 #include "EvtGen_i/EvtGenExternal/EvtExternalGenList.hh"
22 
23 #include "EvtGenBase/EvtVector4R.hh"
24 #include "EvtGenBase/EvtParticle.hh"
25 #include "EvtGenBase/EvtParticleFactory.hh"
26 #include "EvtGen/EvtGen.hh"
27 #include "EvtGenBase/EvtRandomEngine.hh"
28 #include "EvtGenBase/EvtDecayTable.hh"
29 
31 
32 #include "AtlasHepMC/GenEvent.h"
33 #include "AtlasHepMC/GenVertex.h"
34 #include "AtlasHepMC/GenParticle.h"
37 
38 #include "GaudiKernel/MsgStream.h"
39 #include "GaudiKernel/ISvcLocator.h"
40 #include "GaudiKernel/DataSvc.h"
41 #include "GaudiKernel/IPartPropSvc.h"
42 #include "StoreGate/StoreGateSvc.h"
43 #include "StoreGate/DataHandle.h"
45 #include "HepPID/ParticleName.hh"
46 
48 #include "CLHEP/Random/RandFlat.h"
49 #include "CLHEP/Vector/LorentzVector.h"
50 
51 #include <stdlib.h>
52 #include <sstream>
53 #include <map>
54 
55 
56 EvtInclusiveDecay::EvtInclusiveDecay(const std::string& name, ISvcLocator* pSvcLocator):
57  GenBase( name, pSvcLocator ),
58  m_nRepeatedDecays(0) {
59 
60  // Basic EvtGen configuration: decay and particle definition files, random number stream
61  declareProperty("pdtFile", m_pdtFile = "inclusive.pdt");
62  declareProperty("decayFile", m_decayFile = "2014inclusive.dec");
63  declareProperty("userDecayFile", m_userDecayFile = "");
64  declareProperty("randomStreamName", m_randomStreamName = "EVTGEN");
65  declareProperty("inputKeyName", m_inputKeyName = "GEN_EVENT");
66  declareProperty("outputKeyName",m_outputKeyName = "GEN_EVENT_EVTGEN");
67  declareProperty("readExisting",m_readExisting=false);
68 
69  // Selection of particles to be decayed
70  declareProperty("prohibitFinalStateDecay", m_prohibitFinalStateDecay=false);
71  declareProperty("prohibitReDecay", m_prohibitReDecay=false);
72  declareProperty("prohibitUnDecay", m_prohibitUnDecay=true);
73  declareProperty("prohibitRemoveSelfDecay", m_prohibitRemoveSelfDecay=false);
74  declareProperty("blackList",m_blackList);
75  declareProperty("allowAllKnownDecays", m_allowAllKnownDecays=true);
76  declareProperty("allowDefaultBDecays", m_allowDefaultBDecays=true);
77  declareProperty("whiteList",m_whiteList);
78 
79  // Level of output
80  declareProperty("printHepMCBeforeEvtGen", m_printHepMCBeforeEvtGen=false);
81  declareProperty("printHepMCAfterEvtGen", m_printHepMCAfterEvtGen=false);
82  declareProperty("printHepMCHighlighted", m_printHepMCHighlighted=true);
83  declareProperty("printHepMCHighLightTopLevelDecays", m_printHepMCHighLightTopLevelDecays=true);
84 
85  // Optional checks
86  declareProperty("checkDecayTree", m_checkDecayTree=false);
87  declareProperty("checkDecayChannels", m_checkDecayChannels=false);
88 
89  // Repeated decays
90  declareProperty("maxNRepeatedDecays", m_maxNRepeatedDecays=1);
91 
92  // User selection
93  declareProperty("applyUserSelection", m_applyUserSelection=false);
94  declareProperty("userSelRequireOppositeSignedMu", m_userSelRequireOppositeSignedMu=true);
95  declareProperty("userSelMu1MinPt", m_userSelMu1MinPt=0.);
96  declareProperty("userSelMu2MinPt", m_userSelMu2MinPt=0.);
97  declareProperty("userSelMu1MaxEta", m_userSelMu1MaxEta=102.5);
98  declareProperty("userSelMu2MaxEta", m_userSelMu2MaxEta=102.5);
99  declareProperty("userSelMinDimuMass", m_userSelMinDimuMass=0.);
100  declareProperty("userSelMaxDimuMass", m_userSelMaxDimuMass=-1.); // set to negative to not apply cut
101  declareProperty("isfHerwig", m_isfHerwig=false);
102  declareProperty("setVMtransversePol", m_setVMtransversePol=false);
103 
104  // We have decided to blacklist Tau decays because we are not sure whether the polarization
105  // would be properly passed to EvtGen
106  m_blackList.push_back(15);
107 }
108 
109 
110 
112  delete m_myEvtGen;
113  delete m_evtAtRndmGen;
114 }
115 
116 
117 
119 
121  // Get the random number service
122  CHECK(m_rndmSvc.retrieve());
123 
124  msg(MSG::INFO) << "EvtInclusiveDecay initialize" << endmsg;
125  msg(MSG::INFO) << "Particle properties definition file = " << m_pdtFile << endmsg;
126  msg(MSG::INFO) << "Main decay file = " << m_decayFile << endmsg;
127  msg(MSG::INFO) << "User decay file = " << m_userDecayFile << endmsg;
128  msg(MSG::INFO) << "Max number of repeated decays = " << m_maxNRepeatedDecays << endmsg;
129  msg(MSG::INFO) << "EvtInclusiveDecay selection parameters:" << endmsg;
130  msg(MSG::INFO) << "* prohibitFinalStateDecay = " << m_prohibitFinalStateDecay << endmsg;
131  msg(MSG::INFO) << "* prohibitReDecay = " << m_prohibitReDecay << endmsg;
132  msg(MSG::INFO) << "* prohibitUnDecay = " << m_prohibitUnDecay << endmsg;
133  msg(MSG::INFO) << "* prohibitRemoveSelfDecay = " << m_prohibitRemoveSelfDecay << endmsg;
134  msg(MSG::INFO) << "* allowAllKnownDecays = " << m_allowAllKnownDecays << endmsg;
135  msg(MSG::INFO) << "* allowDefaultBDecays = " << m_allowDefaultBDecays << endmsg;
136  msg(MSG::INFO) << "User selection parameters:" << endmsg;
137  msg(MSG::INFO) << "* applyUserSelection = " << m_applyUserSelection << endmsg;
138  msg(MSG::INFO) << "* userSelRequireOppositeSignedMu = " << m_userSelRequireOppositeSignedMu << endmsg;
139  msg(MSG::INFO) << "* userSelMu1MinPt = " << m_userSelMu1MinPt << endmsg;
140  msg(MSG::INFO) << "* userSelMu2MinPt = " << m_userSelMu2MinPt << endmsg;
141  msg(MSG::INFO) << "* userSelMu1MaxEta = " << m_userSelMu1MaxEta << endmsg;
142  msg(MSG::INFO) << "* userSelMu2MaxEta = " << m_userSelMu2MaxEta << endmsg;
143  msg(MSG::INFO) << "* userSelMinDimuMass = " << m_userSelMinDimuMass << endmsg;
144  msg(MSG::INFO) << "* userSelMaxDimuMass = " << m_userSelMaxDimuMass << endmsg;
145 
146  // Initialize and print blackList
147  m_blackListSet.insert(m_blackList.begin(),m_blackList.end());
148  msg(MSG::INFO) << "* blackList; = ";
149  for (std::set<int>::iterator i = m_blackListSet.begin(); i!=m_blackListSet.end(); ++i)
150  msg(MSG::INFO) << (*i) << " ";
151  msg(MSG::INFO)<< endmsg;
152 
153  // Initialize and print whiteList
154  m_whiteListSet.insert(m_whiteList.begin(),m_whiteList.end());
155  msg(MSG::INFO) << "* whiteList = ";
156  for (std::set<int>::iterator i = m_whiteListSet.begin(); i!=m_whiteListSet.end(); ++i)
157  msg(MSG::INFO) << (*i) << " ";
158  msg(MSG::INFO) << endmsg;
159 
160  CLHEP::HepRandomEngine* rndmEngine = getRandomEngineDuringInitialize(m_randomStreamName, m_randomSeed, m_dsid);
161  // Obtain random number generator for EvtGen
162  m_evtAtRndmGen = new EvtInclusiveAtRndmGen(rndmEngine);
163 
164  // Create an instance of EvtGen and read particle properties and decay files
165  EvtExternalGenList genList(true,xmlpath(),"gamma");
166  EvtAbsRadCorr* radCorrEngine = genList.getPhotosModel();
167  std::list<EvtDecayBase*> extraModels = genList.getListOfModels();
168 
169  // Create the EvtGen generator object
170  // EvtGen myGenerator("decayFile.dec", "evt.pdl", randomEnginePointer,
171  // radCorrEngine, &extraModels);
172 
173 
174  m_myEvtGen = new EvtGen( m_decayFile.c_str(), m_pdtFile.c_str(), m_evtAtRndmGen, radCorrEngine, &extraModels);
175  if(!m_userDecayFile.empty())
176  m_myEvtGen->readUDecay(m_userDecayFile.c_str());
177 
178  return StatusCode::SUCCESS;
179 }
180 
181 
183  const EventContext& ctx)
184 {
185  long seeds[7];
186  ATHRNG::calculateSeedsMC21(seeds, streamName, ctx.eventID().event_number(), m_dsid, m_randomSeed);
187  m_evtAtRndmGen->getEngine()->setSeeds(seeds, 0); // NOT THREAD-SAFE
188 }
189 
190 
191 CLHEP::HepRandomEngine* EvtInclusiveDecay::getRandomEngine(const std::string& streamName, unsigned long int randomSeedOffset,
192  const EventContext& ctx) const
193 {
194  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, streamName);
195  rngWrapper->setSeed( streamName, ctx.slot(), randomSeedOffset, ctx.eventID().run_number() );
196  return rngWrapper->getEngine(ctx);
197 }
198 
199 
200 CLHEP::HepRandomEngine* EvtInclusiveDecay::getRandomEngineDuringInitialize(const std::string& streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun, unsigned int lbn) const
201 {
202  const size_t slot=0;
203  EventContext ctx;
204  ctx.setSlot( slot );
205  ctx.setEventID (EventIDBase (conditionsRun,
206  EventIDBase::UNDEFEVT, // event
207  EventIDBase::UNDEFNUM, // timestamp
208  EventIDBase::UNDEFNUM, // timestamp ns
209  lbn));
211  Atlas::ExtendedEventContext( evtStore()->hiveProxyDict(),
212  conditionsRun) );
213  return getRandomEngine(streamName, randomSeedOffset, ctx);
214 }
215 
216 
218  ATH_MSG_DEBUG("EvtInclusiveDecay executing");
219 
220  const EventContext& ctx = Gaudi::Hive::currentContext();
222 
223  std::string key = m_inputKeyName;
224  // retrieve event from Transient Store (Storegate)
225 
226  // Load HepMC info
227  // FIXME should be using Read/WriteHandles here
228  const McEventCollection* oldmcEvtColl{};
229  if(m_readExisting) {
230  CHECK(evtStore()->retrieve(oldmcEvtColl, key));
231  // Fill the new McEventCollection with a copy of the initial HepMC::GenEvent
232  m_mcEvtColl = new McEventCollection(*oldmcEvtColl);
233  }
234  else {CHECK(evtStore()->retrieve(m_mcEvtColl, key));}
235 
236  if(m_readExisting) {
237  if(m_outputKeyName!=key) {
239  }
240  }
241 
243  for( mcItr = m_mcEvtColl->begin(); mcItr != m_mcEvtColl->end(); ++mcItr ) {
244  HepMC::GenEvent* hepMC = *mcItr;
245 
246  // Search HepMC record for particles to be decayed by EvtGen
247  // NOTE: In order to ensure repeatability, we use a std::set of barcodes to obtain
248  // an ordered list of particles to be decayed by EvtGen.
249  std::set<HepMC::GenVertexPtr> visited;
250 #ifdef HEPMC3
251  std::set<HepMC::GenParticlePtr> toBeDecayed;
252  for (auto p: hepMC->particles()) {
253  if ( (!p->production_vertex()) ||
254  (p->production_vertex()->particles_in().size() == 0) ) {
255  StatusCode sc = traverseDecayTree(p,false,visited,toBeDecayed);
256  if (sc.isFailure())
257  return StatusCode::FAILURE;
258  }
259  }
260  // Print HepMC in tree format if desired (before doing anything)
262  msg(MSG::INFO) << "Printing HepMC record at " << hepMC << " BEFORE running EvtGen:" << endmsg;
264  printHepMC(hepMC,&toBeDecayed);
265  else
266  printHepMC(hepMC);
267  }
268 #else
269  std::set<int> toBeDecayed;
270  for (HepMC::GenEvent::particle_iterator itp = hepMC->particles_begin(); itp != hepMC->particles_end(); ++itp) {
272  if ( (!p->production_vertex()) ||
273  (p->production_vertex()->particles_in_size() == 0) ) {
274  StatusCode sc = traverseDecayTree(p,false,visited,toBeDecayed);
275  if (sc.isFailure())
276  return StatusCode::FAILURE;
277  }
278  }
279  // Print HepMC in tree format if desired (before doing anything)
281  msg(MSG::INFO) << "Printing HepMC record at " << hepMC << " BEFORE running EvtGen:" << endmsg;
283  printHepMC(hepMC,&toBeDecayed);
284  else
285  printHepMC(hepMC);
286  }
287 #endif
288 
289  // Decay selected particles
290  bool eventPassesCuts(false);
291  int loopCounter(0);
292  while( !eventPassesCuts && loopCounter < m_maxNRepeatedDecays ) {
293 #ifdef HEPMC3
294  for (auto p: toBeDecayed) {
295  if (p==0) {
296  msg(MSG::ERROR ) << "Overlapping decay tree for particle" << p <<endmsg;
297  return StatusCode::FAILURE;
298  }
299  decayParticle(hepMC,p);
301  }
302 #else
303  for (std::set<int>::iterator itb = toBeDecayed.begin(); itb!=toBeDecayed.end(); ++itb) {
304  auto p = hepMC->barcode_to_particle(*itb);
305  if (p==0) {
306  msg(MSG::ERROR ) << "Overlapping decay tree encountered for barcode " << *itb << endmsg;
307  return StatusCode::FAILURE;
308  }
309  decayParticle(hepMC,p);
311  }
312 #endif
313 
315  eventPassesCuts = passesUserSelection(hepMC);
316  else
317  eventPassesCuts = true;
318 
320  loopCounter++;
321  }
322 
323  // Store the number of decay attempts in event weights std::map, only if repeated decays enabled
324 #ifdef HEPMC3
325  if(m_maxNRepeatedDecays > 1)
326  hepMC->weight("nEvtGenDecayAttempts") = loopCounter;
327 #else
328  if(m_maxNRepeatedDecays > 1)
329  hepMC->weights()["nEvtGenDecayAttempts"] = loopCounter;
330 #endif
331  // Print HepMC in tree format if desired (after finishing all EvtGen decays)
333  msg(MSG::INFO) << "Printing HepMC record at " << hepMC << " AFTER running EvtGen:" << endmsg;
335  printHepMC(hepMC,&toBeDecayed);
336  else
337  printHepMC(hepMC);
338  }
339  }
340 
342  CHECK(evtStore()->overwrite(m_mcEvtColl, m_outputKeyName));
343  }
344 
345  return StatusCode::SUCCESS;
346 }
347 
348 
350 
351  if (m_checkDecayChannels) {
352  ATH_MSG_INFO("The following particles were checked and didn't have any decay channels:");
353  if (msgLvl(MSG::INFO)) {
354  std::cout << std::endl;
355  std::cout << " Particle code Name from HepPDT # Occurences" << std::endl;
356  std::cout << "------------------------------------------------------" << std::endl;
358  int id = p->first;
359  int count = p->second;
360  std::cout << std::setw(14) << id
361  << std::setw(20) << HepPID::particleName(id)
362  << std::setw(20) << count
363  << std::endl;
364  }
365  std::cout << std::endl;
366  }
367  }
368  ATH_MSG_INFO("Total number of repeated decays: " << m_nRepeatedDecays);
369  ATH_MSG_INFO("EvtInclusiveDecay finalized");
370  return StatusCode::SUCCESS;
371 }
372 
373 
374 
375 //
376 // Recursively traverse the decay tree of a particle p, looking for particles to be
377 // decayed by EvtGen. Care is taken to traverse each particle only once.
378 // Note that since in each decay tree only the top-most particle will be decayed
379 // by EvtGen (with its decay tree being deleted beforehand), we cannot use HepMC's
380 // "descendant" iterator.
381 //
382 #ifdef HEPMC3
384  bool isToBeRemoved,
385  std::set<HepMC::GenVertexPtr>& visited,
386  std::set<HepMC::GenParticlePtr>& toBeDecayed) {
387 #else
389  bool isToBeRemoved,
390  std::set<HepMC::GenVertexPtr>& visited,
391  std::set<int>& toBeDecayed) {
392 #endif
393  ATH_MSG_VERBOSE("Inspecting: " << pdgName(p) << " " << p);
394  if (!isToBeRemoved) {
395  if (isToBeDecayed(p,true)) {
396 #ifdef HEPMC3
397  toBeDecayed.insert(p);
398 #else
399  toBeDecayed.insert(HepMC::barcode(p));
400 #endif
401  isToBeRemoved = true;
402  ATH_MSG_VERBOSE("Selected particle for decay: " << pdgName(p) << " " << p );
403 
404  // In principle we could stop the recursion here. However, to prevent
405  // pathological cases in certain decay trees (in particular from Herwig),
406  // we continue in order to mark all descendants of this particle
407  // as visited. Thus none of these descendants can be flagged for further
408  // decay, even if it has several mothers.
409  }
410  }
411  auto v = p->end_vertex();
412 #ifdef HEPMC3
413  if (v) {
414  if (visited.insert(v).second) {
415  if ( isToBeRemoved && (v->particles_in().size()>1) && m_checkDecayTree ) {
416  ATH_MSG_WARNING("Found particle to be decayed with vertex with >1 incoming mother particles in decay tree");
417  ATH_MSG_WARNING( ([&p, &v](){ std::stringstream ss; HepMC::Print::line(ss,p); HepMC::Print::line(ss,v); return ss.str();})());
418  }
419  for (auto itp: v->particles_out()) {
420  ATH_CHECK(traverseDecayTree(itp,isToBeRemoved,visited,toBeDecayed) );
421  }
422  }
423  }
424 #else
425  if (v) {
426  if (visited.insert(v).second) {
427  if ( isToBeRemoved && (v->particles_in_size()>1) && m_checkDecayTree ) {
428  // This is normal for Herwig but should not occur for Pythia
429  ATH_MSG_WARNING("Found particle to be decayed with vertex with >1 incoming mother particles in decay tree");
430  ATH_MSG_WARNING( ([&p, &v](){ std::stringstream ss; HepMC::Print::line(ss,p); HepMC::Print::line(ss,v); return ss.str();})());
431  }
432  for (auto itp = v->particles_begin(HepMC::children); itp != v->particles_end(HepMC::children); ++itp) {
433  ATH_CHECK(traverseDecayTree(*itp,isToBeRemoved,visited,toBeDecayed) );
434  }
435  }
436  }
437 #endif
438  return StatusCode::SUCCESS;
439 }
440 
441 
442 
443 //
444 // Remove an existing decay tree
445 //
447  auto v = p->end_vertex();
448  if (v) {
449 #ifdef HEPMC3
450  //This is recursive in HepMC3. But explicit deletion is allowed as well.
451  hepMC->remove_vertex(v);
452  p->set_status(1); // For now, flag particle as undecayed (stable)
453  ATH_MSG_DEBUG("Removed existing " << pdgName(p) << " " << p );
454 #else
455  std::set<int> vtxBarCodesToDelete;
456  vtxBarCodesToDelete.insert(v->barcode());
457  for (HepMC::GenVertex::vertex_iterator itv = v->vertices_begin(HepMC::descendants);
458  itv != v->vertices_end(HepMC::descendants);
459  ++itv)
460  vtxBarCodesToDelete.insert((*itv)->barcode());
461  for (std::set<int>::iterator itb = vtxBarCodesToDelete.begin(); itb != vtxBarCodesToDelete.end(); ++itb) {
462  auto vdel = hepMC->barcode_to_vertex(*itb);
463  hepMC->remove_vertex(vdel);
464  delete vdel;
465  }
466  p->set_status(1); // For now, flag particle as undecayed (stable)
467  ATH_MSG_DEBUG("Removed existing " << pdgName(p) << " (barcode " << p->barcode() << ")"
468  << " decay tree with " << vtxBarCodesToDelete.size() << " vertices");
469 #endif
470  }
471 }
472 
473 
474 
475 //
476 // Decay a particle with EvtGen. Any existing decay tree will be removed.
477 //
478 // The following status codes are used:
479 //
480 // status == 1 - undecayed particle (also for particles that are not supposed to decay)
481 // status == 2 - particle decayed by EvtGen
482 // status == 0 - error, particle was supposed to be decayed by EvtGen, but found no decay channel
483 //
484 // Note that if a particle with an existing decay tree but no defined decay channels
485 // in EvtGen is passed to this routine, the net effect will be to "undecay" this
486 // particle. The particle will be flagged by status code 899, but MAY BE LOST further
487 // downstream in the simulation chain. The default job parameters are for routine
488 // isToBeDecayed() to never enable decays of such particles by EvtGen.
489 //
491  ATH_MSG_DEBUG("Decaying particle " << pdgName(part) << " " << part);
492  if (msgLvl(MSG::VERBOSE)) HepMC::Print::line(std::cout,part);
493 
494  // Remove existing decay tree, if any, and flag particle as being decayed by EvtGen
495  removeDecayTree(hepMC,part);
496  part->set_status(0);
497 
498  // Create EvtGen version of part and have EvtGen decay it.
499  // Since EvtGen uses GeV, convert particles momentum from MeV to GeV.
500  int id = part->pdg_id();
501  EvtId evtId=EvtPDL::evtIdFromStdHep(id);
502  double en =(part->momentum()).e()/1000.;
503  double px=(part->momentum()).px()/1000.;
504  double py=(part->momentum()).py()/1000.;
505  double pz=(part->momentum()).pz()/1000.;
506  EvtVector4R evtP(en,px,py,pz);
507  EvtParticle* evtPart = EvtParticleFactory::particleFactory(evtId,evtP);
508 
509  // set transverse polarization to vector mesons (relevant for coherent production of J/Psi etc in UPC)
510  if(m_setVMtransversePol && (id==113 || id== 443 || id==100443 || id==553 || id==100553 || id==200553) )evtPart->setVectorSpinDensity();
511 
512  m_myEvtGen->generateDecay(evtPart);
513  if (msgLvl(MSG::VERBOSE)) evtPart->printTree();
514  double ct_s = part->production_vertex()->position().t();
515  double x_s = part->production_vertex()->position().x();
516  double y_s = part->production_vertex()->position().y();
517  double z_s = part->production_vertex()->position().z();
518 
519  EvtVector4R treeStart(ct_s,x_s,y_s,z_s);
520  // Add new decay tree to hepMC, converting back from GeV to MeV.
521  addEvtGenDecayTree(hepMC, part, evtPart, treeStart, 1000.);
522  if(evtPart->getNDaug() !=0) part->set_status(2);
523  evtPart->deleteTree();
524 }
525 
526 
527 
529  EvtParticle* evtPart, EvtVector4R treeStart, double momentumScaleFactor) {
530  if(evtPart->getNDaug()!=0) {
531  // Add decay vertex, starting from production vertex of particle
532  double ct=(evtPart->getDaug(0)->get4Pos()).get(0)+treeStart.get(0);
533  double x=(evtPart->getDaug(0)->get4Pos()).get(1)+treeStart.get(1);
534  double y=(evtPart->getDaug(0)->get4Pos()).get(2)+treeStart.get(2);
535  double z=(evtPart->getDaug(0)->get4Pos()).get(3)+treeStart.get(3);
536 
537  HepMC::GenVertexPtr end_vtx = HepMC::newGenVertexPtr(HepMC::FourVector(x,y,z,ct));
538 
539  hepMC->add_vertex(end_vtx);
540  end_vtx->add_particle_in(part);
541 
542  // Add decay daughter with their own decay trees
543  for(uint it=0; it<evtPart->getNDaug(); it++) {
544  double e=(evtPart->getDaug(it)->getP4Lab()).get(0) * momentumScaleFactor;
545  double px=(evtPart->getDaug(it)->getP4Lab()).get(1) * momentumScaleFactor;
546  double py=(evtPart->getDaug(it)->getP4Lab()).get(2) * momentumScaleFactor;
547  double pz=(evtPart->getDaug(it)->getP4Lab()).get(3) * momentumScaleFactor;
548  int id=EvtPDL::getStdHep(evtPart->getDaug(it)->getId());
549  int status=1;
550  if(evtPart->getDaug(it)->getNDaug() != 0) status=2;
551  HepMC::GenParticlePtr daughter = HepMC::newGenParticlePtr(HepMC::FourVector(px,py,pz,e),id,status);
552  end_vtx->add_particle_out(daughter);
553  addEvtGenDecayTree(hepMC, daughter, evtPart->getDaug(it), treeStart, momentumScaleFactor);
554  }
555  }
556 }
557 
558 
559 
560 //
561 // isToBeDecayed returns true if we want the particle p to be decayed by
562 // EvtGen based on the job options selected by the user.
563 // The parameter doCrossChecks is used to prevent double-counting for cross-checks
564 // if isToBeDecayed is called more than once for the same particle.
565 //
567  int id = p->pdg_id();
568  int nDaughters = 0;
569  auto v = p->end_vertex();
570  if (v) nDaughters = v->particles_out_size();
571 
572  // Ignore documentation lines
573  if (p->status() == 3) return false;
574  // And any particles that aren't stable or decayed
575  if(!m_isfHerwig && !MC::isPhysical(p)) return false;
576 
577  // Particularly for Herwig, try to ignore particles that really should
578  // be flagged as documentation lines
579  double m2 = p->momentum().m2();
580  if (m2 < -1.0E-3) {
581  ATH_MSG_DEBUG("Ignoring particle " << pdgName(p) << " with m^2 = " << m2);
582  return false;
583  }
584 
585  // Check whether EvtGen has any decay channels defined for this particle
586  EvtId evtId = EvtPDL::evtIdFromStdHep(id);
587  // std::cout << "EVTID: " << evtId.getId() << " alias " << evtId.getAlias() << std::endl;
588  int nModes = 0;
589  if (evtId.getId()>=0)
590  // nModes = EvtDecayTable::getNMode(evtId.getAlias());
591  nModes = EvtDecayTable::getInstance()->getNMode(evtId.getAlias());
592  if (doCrossChecks) {
593  ATH_MSG_VERBOSE("Checking particle " << pdgName(p)
594  << " (status = " << p->status()
595  <<") -- " << nModes << " decay modes found");
596  if (m_checkDecayChannels && nModes==0) {
598  if (pos != m_noDecayChannels.end())
599  (pos->second)++;
600  else
601  m_noDecayChannels[id] = 1;
602  }
603  }
604 
605  // Check prohibit* settings
606  if (m_prohibitFinalStateDecay && MC::isStable(p)) return false;
607  if (m_prohibitReDecay && nDaughters>0) return false;
608  if (m_prohibitUnDecay && nModes==0) return false;
609  if (m_prohibitRemoveSelfDecay && nDaughters>0) {
610  // For now, check only children - this should be sufficient and checking all
611  // descendants would be very expensive.
612 #ifdef HEPMC3
613  for (auto itd: v->particles_out()) {
614  if (std::abs(itd->pdg_id()) == std::abs(id)) return false;
615  }
616 #else
617  for (HepMC::GenVertex::particle_iterator itd = v->particles_begin(HepMC::children);
618  itd != v->particles_end(HepMC::children);
619  ++itd) {
620  if (std::abs((*itd)->pdg_id()) == std::abs(id)) return false;
621  }
622 #endif
623  }
624 
625  // Check blackList
626  if (m_blackListSet.count(std::abs(id))>0) return false;
627 
628  // Check allow* settings
629  if (m_allowAllKnownDecays && nModes>0) return true;
630  if (m_allowDefaultBDecays && isDefaultB(id)) return true;
631 
632  // Check whiteList
633  if (m_whiteListSet.count(std::abs(id))>0) return true;
634 
635  return false; // Default is NOT to decay through EvtGen
636 }
637 
638 
639 
640 //
641 // The following mimicks the particle selection implemented in EvtDecay.
642 //
643 bool EvtInclusiveDecay::isDefaultB(const int pId) const {
644  int id = std::abs(pId);
645  if ( id == 511 ||
646  id == 521 ||
647  id == 531 ||
648  id == 541 ||
649  id == 5122 ||
650  id == 5132 ||
651  id == 5232 ||
652  id == 5112 ||
653  id == 5212 ||
654  id == 5222 )
655  return true;
656  else
657  return false;
658 }
659 
660 //
661 // Function to apply the user selection after repeated decay
662 // Now the selection is based on di-muon kinematics only
663 // TODO: to be replaced by something more configurable
664 //
665 bool EvtInclusiveDecay::passesUserSelection(HepMC::GenEvent* hepMC) {
666  bool passed(false);
667  std::vector<HepMC::GenParticlePtr> *muons = new std::vector<HepMC::GenParticlePtr>;
668 
669  for ( const auto& p: *hepMC) {
670  if( std::abs(p->pdg_id()) == 13 )
671  muons->push_back(p);
672  }
673 
674  for (auto muItr1 = muons->begin(); muItr1 != muons->end(); ++muItr1) {
675  for (auto muItr2 = muItr1+1; muItr2 != muons->end(); ++muItr2) {
676  if( m_userSelRequireOppositeSignedMu && (*muItr1)->pdg_id() * (*muItr2)->pdg_id() > 0)
677  continue;
678  if( !( (*muItr1)->momentum().perp() > m_userSelMu1MinPt && std::abs((*muItr1)->momentum().pseudoRapidity()) < m_userSelMu1MaxEta &&
679  (*muItr2)->momentum().perp() > m_userSelMu2MinPt && std::abs((*muItr2)->momentum().pseudoRapidity()) < m_userSelMu2MaxEta ) &&
680  !( (*muItr2)->momentum().perp() > m_userSelMu1MinPt && std::abs((*muItr2)->momentum().pseudoRapidity()) < m_userSelMu1MaxEta &&
681  (*muItr1)->momentum().perp() > m_userSelMu2MinPt && std::abs((*muItr1)->momentum().pseudoRapidity()) < m_userSelMu2MaxEta ) )
682  continue;
683  double dimuMass = invMass((*muItr1),(*muItr2));
684  if( !( dimuMass > m_userSelMinDimuMass && (dimuMass < m_userSelMaxDimuMass || m_userSelMaxDimuMass < 0.) ) )
685  continue;
686  passed = true;
687  }
688  }
689 
690  delete muons;
691 
692  return passed;
693 }
694 
696  double p1Px = p1->momentum().px();
697  double p1Py = p1->momentum().py();
698  double p1Pz = p1->momentum().pz();
699  double p1E = p1->momentum().e();
700  double p2Px = p2->momentum().px();
701  double p2Py = p2->momentum().py();
702  double p2Pz = p2->momentum().pz();
703  double p2E = p2->momentum().e();
704  double dimuE = p2E + p1E;
705  double dimuPx = p2Px + p1Px;
706  double dimuPy = p2Py + p1Py;
707  double dimuPz = p2Pz + p1Pz;
708  double invMass = std::sqrt(dimuE*dimuE - dimuPx*dimuPx - dimuPy*dimuPy - dimuPz*dimuPz);
709 
710  return invMass;
711 }
712 
713 //
714 // Utility functions to print a HepMC event record in a tree-like format, using
715 // colors to denote the status of particles and to indicate which particles
716 // are selected by the job options to be decayed by EvtGen.
717 //
718 #ifdef HEPMC3
719 void EvtInclusiveDecay::printHepMC(HepMC::GenEvent* hepMC, std::set<HepMC::GenParticlePtr>* barcodeList) {
720  std::set<HepMC::GenVertexPtr> visited;
721  unsigned int nParticlesFound = 0;
722  unsigned int nTreesFound = 0;
723  for (auto p: *hepMC) {
724  if ( (!p->production_vertex()) ||
725  (p->production_vertex()->particles_in().size() == 0) ) {
726  nTreesFound++;
727  std::cout << "\n Found new partial decay tree:\n" << std::endl;
728  unsigned int nParticlesVisited = printTree(p,visited,1,barcodeList);
729  std::cout << "\n " << nParticlesVisited << " particles in this subtree" << std::endl;
730  nParticlesFound += nParticlesVisited;
731  }
732  }
733  std::cout << "\n Total of " << nParticlesFound << " particles found in "
734  << nTreesFound << " decay subtrees in HepMC event record\n" << std::endl;
735 }
736 #else
737 void EvtInclusiveDecay::printHepMC(HepMC::GenEvent* hepMC, std::set<int>* barcodeList) {
738  std::set<HepMC::GenVertexPtr> visited;
739  unsigned int nParticlesFound = 0;
740  unsigned int nTreesFound = 0;
741  for (HepMC::GenEvent::particle_iterator itp = hepMC->particles_begin(); itp != hepMC->particles_end(); ++itp) {
743  if ( (!p->production_vertex()) ||
744  (p->production_vertex()->particles_in_size() == 0) ) {
745  nTreesFound++;
746  std::cout << "\n Found new partial decay tree:\n" << std::endl;
747  unsigned int nParticlesVisited = printTree(p,visited,1,barcodeList);
748  std::cout << "\n " << nParticlesVisited << " particles in this subtree" << std::endl;
749  nParticlesFound += nParticlesVisited;
750  }
751  }
752  std::cout << "\n Total of " << nParticlesFound << " particles found in "
753  << nTreesFound << " decay subtrees in HepMC event record\n" << std::endl;
754 }
755 #endif
756 
757 #ifdef HEPMC3
759  std::set<HepMC::GenVertexPtr>& visited, int level, std::set<HepMC::GenParticlePtr>* barcodeList) {
760  unsigned int nParticlesVisited = 1;
761  for (int i=0; i<level; i++) std::cout << " ";
762  std::cout << pdgName(p,m_printHepMCHighlighted,barcodeList);
763  auto v = p->end_vertex();
764  if (v) {
765  if (v->particles_in().size() > 1)
766  std::cout << " [interaction: " << v->particles_in().size() << " particles, vertex " << v << "] --> ";
767  else
768  std::cout << " --> ";
769  if (visited.insert(v).second) {
770  for (auto itp: v->particles_out()) {
771  std::cout << pdgName(itp,m_printHepMCHighlighted,barcodeList) << " ";
772  }
773  std::cout << std::endl;
774  for (auto itp: v->particles_out()) {
775  if (itp->end_vertex())
776  nParticlesVisited += printTree(itp, visited, level+1, barcodeList);
777  else
778  nParticlesVisited++;
779  }
780  } else
781  std::cout << "see above" << std::endl;
782  } else
783  std::cout << " no decay vertex\n" << std::endl;
784  return nParticlesVisited;
785 }
786 #else
788  std::set<HepMC::GenVertexPtr>& visited, int level, std::set<int>* barcodeList) {
789  unsigned int nParticlesVisited = 1;
790  for (int i=0; i<level; i++) std::cout << " ";
791  std::cout << pdgName(p,m_printHepMCHighlighted,barcodeList);
792  auto v = p->end_vertex();
793  if (v) {
794  if (v->particles_in_size() > 1)
795  std::cout << " [interaction: " << v->particles_in_size() << " particles, vertex " << v << "] --> ";
796  else
797  std::cout << " --> ";
798  if (visited.insert(v).second) {
799  for (HepMC::GenVertex::particle_iterator itp = v->particles_begin(HepMC::children);
800  itp != v->particles_end(HepMC::children);
801  ++itp) {
802  std::cout << pdgName(*itp,m_printHepMCHighlighted,barcodeList) << " ";
803  }
804  std::cout << std::endl;
805  for (HepMC::GenVertex::particle_iterator itp = v->particles_begin(HepMC::children);
806  itp != v->particles_end(HepMC::children);
807  ++itp) {
808  if ((*itp)->end_vertex())
809  nParticlesVisited += printTree(*itp, visited, level+1, barcodeList);
810  else
811  nParticlesVisited++;
812  }
813  } else
814  std:: cout << "see above" << std::endl;
815  } else
816  std::cout << " no decay vertex\n" << std::endl;
817  return nParticlesVisited;
818 }
819 #endif
820 
821 #ifdef HEPMC3
822 std::string EvtInclusiveDecay::pdgName(HepMC::ConstGenParticlePtr p, bool statusHighlighting, std::set<HepMC::GenParticlePtr>* barcodeList) {
823  std::ostringstream buf;
824  bool inlist=false;
825  if (barcodeList) for (const auto& pinl: *barcodeList) if (pinl&&p) if (pinl.get()==p.get()) inlist=true;
826  if (statusHighlighting) {
827  if ( ((barcodeList!=0) && (inlist)) ||
828  ((barcodeList==0) && isToBeDecayed(p,false)) )
829  buf << "\033[7m"; // reverse
830  if (!MC::isStable(p)) {
831  if (MC::isDecayed(p))
832  buf << "\033[33m"; // yellow
833  else
834  buf << "\033[31m"; // red
835  }
836  }
837  buf << p->pdg_id();
838  buf << "/" << HepPID::particleName(p->pdg_id());
839  if (statusHighlighting) {
840  buf << "\033[0m"; // revert color attributes
841  }
842  return buf.str();
843 }
844 #else
845 std::string EvtInclusiveDecay::pdgName(HepMC::ConstGenParticlePtr p, bool statusHighlighting, std::set<int>* barcodeList) {
846  std::ostringstream buf;
847  if (statusHighlighting) {
848  if ( ((barcodeList!=0) && (barcodeList->find(HepMC::barcode(p)) != barcodeList->end())) ||
849  ((barcodeList==0) && isToBeDecayed(p,false)) )
850  buf << "\033[7m"; // reverse
851  if (!MC::isStable(p)) {
852  if (MC::isDecayed(p))
853  buf << "\033[33m"; // yellow
854  else
855  buf << "\033[31m"; // red
856  }
857  }
858  buf << p->pdg_id();
859  buf << "/" << HepPID::particleName(p->pdg_id());
860  if (statusHighlighting) {
861  buf << "\033[0m"; // revert color attributes
862  }
863  return buf.str();
864 }
865 
866 #endif
867 
868 
869 //
870 // Interface between Athena random number service and EvtGen's EvtRandomEngine class
871 //
872 EvtInclusiveAtRndmGen::EvtInclusiveAtRndmGen(CLHEP::HepRandomEngine* engine)
873  : m_engine(engine)
874 {}
875 
877  return CLHEP::RandFlat::shoot(m_engine);
878 }
879 
881 
883  return PathResolverFindCalibDirectory( "Pythia8/xmldoc" );
884 }
HepMC::GenVertexPtr
HepMC::GenVertex * GenVertexPtr
Definition: GenVertex.h:59
EvtInclusiveDecay::m_checkDecayTree
bool m_checkDecayTree
Definition: EvtInclusiveDecay.h:151
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
EvtInclusiveDecay::isDefaultB
bool isDefaultB(const int pId) const
Definition: EvtInclusiveDecay.cxx:643
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition: RNGWrapper.h:169
EvtInclusiveDecay::m_randomStreamName
std::string m_randomStreamName
Definition: EvtInclusiveDecay.h:129
EvtInclusiveDecay::m_allowDefaultBDecays
bool m_allowDefaultBDecays
Definition: EvtInclusiveDecay.h:142
EvtInclusiveDecay::m_maxNRepeatedDecays
int m_maxNRepeatedDecays
Definition: EvtInclusiveDecay.h:157
TruthTest.itp
itp
Definition: TruthTest.py:46
GenEvent.h
EvtInclusiveDecay::m_whiteList
std::vector< int > m_whiteList
Definition: EvtInclusiveDecay.h:143
test_pyathena.px
px
Definition: test_pyathena.py:18
python.SystemOfUnits.m2
int m2
Definition: SystemOfUnits.py:92
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
EvtInclusiveDecay::m_allowAllKnownDecays
bool m_allowAllKnownDecays
Definition: EvtInclusiveDecay.h:141
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
EvtInclusiveDecay::m_blackList
std::vector< int > m_blackList
Definition: EvtInclusiveDecay.h:138
EvtInclusiveDecay::m_userSelMinDimuMass
double m_userSelMinDimuMass
Definition: EvtInclusiveDecay.h:165
EvtInclusiveDecay::m_noDecayChannels
std::map< int, long > m_noDecayChannels
Definition: EvtInclusiveDecay.h:153
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
EvtInclusiveDecay::m_blackListSet
std::set< int > m_blackListSet
Definition: EvtInclusiveDecay.h:139
EvtInclusiveDecay::reseedRandomEngine
void reseedRandomEngine(const std::string &streamName, const EventContext &ctx)
Definition: EvtInclusiveDecay.cxx:182
GenVertex.h
EvtInclusiveDecay::decayParticle
void decayParticle(HepMC::GenEvent *hepMC, HepMC::GenParticlePtr p)
Definition: EvtInclusiveDecay.cxx:490
HepMC::GenParticlePtr
GenParticle * GenParticlePtr
Definition: GenParticle.h:37
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
EvtInclusiveDecay::passesUserSelection
bool passesUserSelection(HepMC::GenEvent *hepMC)
Definition: EvtInclusiveDecay.cxx:665
McEventCollection
McEventCollection
Definition: GeneratorObjectsTPCnv.cxx:60
EvtInclusiveDecay::m_applyUserSelection
bool m_applyUserSelection
Definition: EvtInclusiveDecay.h:159
skel.it
it
Definition: skel.GENtoEVGEN.py:396
EvtInclusiveDecay::getRandomEngineDuringInitialize
CLHEP::HepRandomEngine * getRandomEngineDuringInitialize(const std::string &streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun=1, unsigned int lbn=1) const
Definition: EvtInclusiveDecay.cxx:200
EvtInclusiveDecay::m_userDecayFile
std::string m_userDecayFile
Definition: EvtInclusiveDecay.h:128
EvtInclusiveDecay::isToBeDecayed
bool isToBeDecayed(HepMC::ConstGenParticlePtr p, bool doCrossChecks)
Definition: EvtInclusiveDecay.cxx:566
EvtInclusiveDecay::m_printHepMCHighLightTopLevelDecays
bool m_printHepMCHighLightTopLevelDecays
Definition: EvtInclusiveDecay.h:149
EvtInclusiveDecay::m_userSelMu2MaxEta
double m_userSelMu2MaxEta
Definition: EvtInclusiveDecay.h:164
AthCommonMsg< Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
EvtInclusiveDecay::m_decayFile
std::string m_decayFile
Definition: EvtInclusiveDecay.h:127
EvtInclusiveDecay::m_evtAtRndmGen
EvtInclusiveAtRndmGen * m_evtAtRndmGen
Definition: EvtInclusiveDecay.h:122
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
HepMC::Print::line
void line(std::ostream &os, const GenEvent &e)
Definition: GenEvent.h:676
x
#define x
EvtInclusiveDecay::m_printHepMCHighlighted
bool m_printHepMCHighlighted
Definition: EvtInclusiveDecay.h:148
HepMC::fillBarcodesAttribute
void fillBarcodesAttribute(GenEvent *)
Definition: GenEvent.h:626
DataHandle.h
GenParticle.h
EvtInclusiveDecay::m_isfHerwig
bool m_isfHerwig
Definition: EvtInclusiveDecay.h:167
EvtInclusiveAtRndmGen::getEngine
CLHEP::HepRandomEngine * getEngine()
Definition: EvtInclusiveDecay.h:49
EvtInclusiveDecay::m_printHepMCAfterEvtGen
bool m_printHepMCAfterEvtGen
Definition: EvtInclusiveDecay.h:147
EvtInclusiveDecay::addEvtGenDecayTree
void addEvtGenDecayTree(HepMC::GenEvent *hepMC, HepMC::GenParticlePtr part, EvtParticle *evtPart, EvtVector4R treeStart, double momentumScaleFactor=1.0)
Definition: EvtInclusiveDecay.cxx:528
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
EvtInclusiveDecay::m_readExisting
bool m_readExisting
Definition: EvtInclusiveDecay.h:133
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
PathResolverFindCalibDirectory
std::string PathResolverFindCalibDirectory(const std::string &logical_file_name)
Definition: PathResolver.cxx:432
MC::isPhysical
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
Definition: HepMCHelpers.h:51
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
G4StepHelper::particleName
std::string particleName(const G4Step *theStep)
TODO.
Definition: StepHelper.cxx:24
GenBase
Base class for common behaviour of MC truth algorithms.
Definition: GenBase.h:47
McEventCollection.h
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
EvtInclusiveDecay::invMass
double invMass(HepMC::ConstGenParticlePtr p1, HepMC::ConstGenParticlePtr p2)
Definition: EvtInclusiveDecay.cxx:695
lumiFormat.i
int i
Definition: lumiFormat.py:85
EvtInclusiveDecay::getRandomEngine
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, unsigned long int randomSeedOffset, const EventContext &ctx) const
Definition: EvtInclusiveDecay.cxx:191
z
#define z
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
EvtInclusiveDecay::m_pdtFile
std::string m_pdtFile
Definition: EvtInclusiveDecay.h:126
Atlas::ExtendedEventContext
Definition: ExtendedEventContext.h:23
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
EvtInclusiveDecay::m_userSelMu1MinPt
double m_userSelMu1MinPt
Definition: EvtInclusiveDecay.h:161
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
EvtInclusiveDecay::m_checkDecayChannels
bool m_checkDecayChannels
Definition: EvtInclusiveDecay.h:152
EvtInclusiveDecay::removeDecayTree
void removeDecayTree(HepMC::GenEvent *hepMC, HepMC::GenParticlePtr p)
Definition: EvtInclusiveDecay.cxx:446
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
EvtInclusiveDecay::m_dsid
IntegerProperty m_dsid
Definition: EvtInclusiveDecay.h:114
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EvtInclusiveDecay::m_userSelMu1MaxEta
double m_userSelMu1MaxEta
Definition: EvtInclusiveDecay.h:163
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
EvtInclusiveDecay::traverseDecayTree
StatusCode traverseDecayTree(HepMC::GenParticlePtr p, bool isToBeRemoved, std::set< HepMC::GenVertexPtr > &visited, std::set< int > &toBeDecayed)
Definition: EvtInclusiveDecay.cxx:388
EvtInclusiveDecay::m_randomSeed
IntegerProperty m_randomSeed
Seed for random number engine.
Definition: EvtInclusiveDecay.h:117
EvtInclusiveDecay::printHepMC
void printHepMC(HepMC::GenEvent *hepMC, std::set< int > *barcodeList=nullptr)
Definition: EvtInclusiveDecay.cxx:737
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
calibdata.ct
ct
Definition: calibdata.py:418
EvtInclusiveDecay::m_userSelRequireOppositeSignedMu
bool m_userSelRequireOppositeSignedMu
Definition: EvtInclusiveDecay.h:160
EvtInclusiveDecay.h
EvtInclusiveDecay::execute
StatusCode execute()
Definition: EvtInclusiveDecay.cxx:217
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
EvtInclusiveDecay::printTree
unsigned int printTree(HepMC::GenParticlePtr p, std::set< HepMC::GenVertexPtr > &visited, int level, std::set< int > *barcodeList=0)
Definition: EvtInclusiveDecay.cxx:787
Amg::py
@ py
Definition: GeoPrimitives.h:39
PathResolver.h
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
MagicNumbers.h
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
PlotCalibFromCool.en
en
Definition: PlotCalibFromCool.py:399
EvtInclusiveDecay::m_prohibitFinalStateDecay
bool m_prohibitFinalStateDecay
Definition: EvtInclusiveDecay.h:134
EvtInclusiveDecay::pdgName
std::string pdgName(HepMC::ConstGenParticlePtr p, bool statusHighlighting=false, std::set< int > *barcodeList=nullptr)
Definition: EvtInclusiveDecay.cxx:845
EvtInclusiveAtRndmGen::EvtInclusiveAtRndmGen
EvtInclusiveAtRndmGen(CLHEP::HepRandomEngine *engine)
Definition: EvtInclusiveDecay.cxx:872
EvtInclusiveDecay::m_prohibitRemoveSelfDecay
bool m_prohibitRemoveSelfDecay
Definition: EvtInclusiveDecay.h:137
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition: RNGWrapper.h:134
RNGWrapper.h
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
EvtInclusiveDecay::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Definition: EvtInclusiveDecay.h:111
EvtInclusiveDecay::EvtInclusiveDecay
EvtInclusiveDecay(const std::string &name, ISvcLocator *pSvcLocator)
Definition: EvtInclusiveDecay.cxx:56
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
EvtInclusiveDecay::m_mcEvtColl
McEventCollection * m_mcEvtColl
Definition: EvtInclusiveDecay.h:119
EvtInclusiveAtRndmGen::m_engine
CLHEP::HepRandomEngine * m_engine
Definition: EvtInclusiveDecay.h:51
python.PyAthena.v
v
Definition: PyAthena.py:154
EvtInclusiveDecay::m_prohibitUnDecay
bool m_prohibitUnDecay
Definition: EvtInclusiveDecay.h:136
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition: HepMCHelpers.h:45
EvtInclusiveDecay::m_myEvtGen
EvtGen * m_myEvtGen
Definition: EvtInclusiveDecay.h:123
EvtInclusiveAtRndmGen::random
double random()
Definition: EvtInclusiveDecay.cxx:876
HepMC::newGenParticlePtr
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
Definition: GenParticle.h:39
y
#define y
EvtInclusiveDecay::m_nRepeatedDecays
int m_nRepeatedDecays
Definition: EvtInclusiveDecay.h:155
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
EvtInclusiveDecay::xmlpath
std::string xmlpath(void)
Definition: EvtInclusiveDecay.cxx:882
MC::isDecayed
bool isDecayed(const T &p)
Identify if the particle decayed.
Definition: HepMCHelpers.h:42
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
python.DecayParser.children
children
Definition: DecayParser.py:32
ATHRNG::calculateSeedsMC21
void calculateSeedsMC21(long *seeds, const std::string &algName, uint64_t ev, uint64_t run, uint64_t offset=0)
Set the random seed using a string (e.g.
Definition: RNGWrapper.cxx:37
EvtInclusiveDecay::m_setVMtransversePol
bool m_setVMtransversePol
Definition: EvtInclusiveDecay.h:168
EvtInclusiveDecay::m_printHepMCBeforeEvtGen
bool m_printHepMCBeforeEvtGen
Definition: EvtInclusiveDecay.h:146
EvtInclusiveDecay::m_outputKeyName
std::string m_outputKeyName
Definition: EvtInclusiveDecay.h:131
merge.status
status
Definition: merge.py:17
EvtInclusiveDecay::m_userSelMaxDimuMass
double m_userSelMaxDimuMass
Definition: EvtInclusiveDecay.h:166
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
EvtInclusiveDecay::m_inputKeyName
std::string m_inputKeyName
Definition: EvtInclusiveDecay.h:130
EvtInclusiveDecay::~EvtInclusiveDecay
virtual ~EvtInclusiveDecay()
Definition: EvtInclusiveDecay.cxx:111
EvtInclusiveDecay::m_userSelMu2MinPt
double m_userSelMu2MinPt
Definition: EvtInclusiveDecay.h:162
EvtInclusiveDecay::m_prohibitReDecay
bool m_prohibitReDecay
Definition: EvtInclusiveDecay.h:135
EvtInclusiveDecay::initialize
StatusCode initialize()
Definition: EvtInclusiveDecay.cxx:118
EvtInclusiveDecay::finalize
StatusCode finalize()
Definition: EvtInclusiveDecay.cxx:349
StoreGateSvc.h
Atlas::setExtendedEventContext
void setExtendedEventContext(EventContext &ctx, ExtendedEventContext &&ectx)
Move an extended context into a context object.
Definition: ExtendedEventContext.cxx:50
GenBase::initialize
virtual StatusCode initialize() override
Definition: GenBase.cxx:17
EvtInclusiveDecay::m_whiteListSet
std::set< int > m_whiteListSet
Definition: EvtInclusiveDecay.h:144
HepMCHelpers.h
EvtInclusiveAtRndmGen
Definition: EvtInclusiveDecay.h:44
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
GenParticle
@ GenParticle
Definition: TruthClasses.h:30
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37