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