ATLAS Offline Software
Loading...
Searching...
No Matches
EvtInclusiveDecay.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5//*****************************************************************************
6//
7// Generators/EvtGen_i/EvtInclusiveDecay.h
8//
9// EvtInclusiveDecay is a TopAlg that takes HepMC events from StoreGate and
10// generates particle decays using EvtGen. Depending on job options either all or
11// only a subset of the particles which have decays defined in the EvtGen
12// decay files will be handed to EvtGen. Both undecayed particles and particles
13// with an existing decay tree can be handled (in the latter case,
14// EvtInclusiveDecay will remove the existing decay tree).
15//
16// Written in February 2006 by Juerg Beringer, based in part on the existing
17// EvtDecay module.
18//
19//*****************************************************************************
20
21#ifndef GENERATORMODULESEVTDECAYINCLUSIVE_H
22#define GENERATORMODULESEVTDECAYINCLUSIVE_H
23
24#include "AtlasHepMC/GenEvent.h"
26
27
28#include "EvtGenBase/EvtParticle.hh"
29#include "EvtGen/EvtGen.hh"
30#include "EvtGenBase/EvtRandomEngine.hh"
31
33#include "GaudiKernel/ISvcLocator.h"
34
37
38namespace CLHEP {
39 class HepRandomEngine;
40};
41
42class EvtInclusiveAtRndmGen : public EvtRandomEngine {
43public:
44 EvtInclusiveAtRndmGen(CLHEP::HepRandomEngine* engine);
45 virtual ~EvtInclusiveAtRndmGen() = default;
46 double random();
47 CLHEP::HepRandomEngine* getEngine() { return m_engine; }
48private:
49 CLHEP::HepRandomEngine* m_engine{};
50};
51
52
53
55
56public:
57 EvtInclusiveDecay(const std::string& name, ISvcLocator* pSvcLocator);
58 virtual ~EvtInclusiveDecay();
59
60 StatusCode initialize();
61 StatusCode execute(const EventContext& ctx);
62 StatusCode finalize();
63 std::string xmlpath(void);
64 struct ParticleIdCompare {bool operator()(const HepMC::GenParticlePtr& a,const HepMC::GenParticlePtr& b) const {return (a)&&(b)&&(a->momentum().e() < b->momentum().e());}};
65private:
66
68
69 void reseedRandomEngine(const std::string& streamName, const EventContext& ctx);
70 CLHEP::HepRandomEngine* getRandomEngine(const std::string& streamName, unsigned long int randomSeedOffset, const EventContext& ctx) const;
71 CLHEP::HepRandomEngine* getRandomEngineDuringInitialize(const std::string& streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun=1, unsigned int lbn=1) const;
73
75 bool isToBeRemoved,
76 std::set<HepMC::GenVertexPtr>& visited,
77 std::set<HepMC::GenParticlePtr,ParticleIdCompare>& toBeDecayed);
80 void addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr part, EvtParticle* evtPart, EvtVector4R treeStart, double momentumScaleFactor = 1.0);
81
82 bool isToBeDecayed(HepMC::ConstGenParticlePtr p, bool doCrossChecks);
83 bool isDefaultB(const int pId) const;
84
87
88 // Utility functions to print HepMC record for debugging with optional
89 // coloring by status code and highlighting of particles in a specific list
90 void printHepMC(HepMC::GenEvent* hepMC, std::set<HepMC::GenParticlePtr,ParticleIdCompare>* particleSet = nullptr);
91 unsigned int printTree(HepMC::GenParticlePtr p, std::set<HepMC::GenVertexPtr>& visited, int level, std::set<HepMC::GenParticlePtr,ParticleIdCompare>* particleSet = nullptr);
92 std::string pdgName(HepMC::ConstGenParticlePtr p, bool statusHighlighting = false, std::set<HepMC::GenParticlePtr,ParticleIdCompare>* particleSet = nullptr);
93
94 // Random number service
95 ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc"};
96
97 //Gen_tf run args.
98 IntegerProperty m_dsid{this, "Dsid", 999999};
99
101 IntegerProperty m_randomSeed{this, "RandomSeed", 1234567, "Random seed for the built-in random engine"}; // FIXME make this into an unsigned long int?
102
104
105 // EvtGen interface
107 EvtGen* m_myEvtGen{};
108
109 // jobOption params
110 std::string m_pdtFile;
111 std::string m_decayFile;
112 std::string m_userDecayFile;
114 std::string m_inputKeyName;
115 std::string m_outputKeyName;
116
122 std::vector<int> m_blackList;
123 std::set<int> m_blackListSet; // filed from m_blackList for speed optimization
124
127 std::vector<int> m_whiteList;
128 std::set<int> m_whiteListSet; // filed from m_whilteList for speed optimization
129
134
137 std::map<int,long> m_noDecayChannels;
138
140
142
153};
154
155#endif
static Double_t a
CLHEP::HepRandomEngine * getEngine()
virtual ~EvtInclusiveAtRndmGen()=default
EvtInclusiveAtRndmGen(CLHEP::HepRandomEngine *engine)
CLHEP::HepRandomEngine * m_engine
void printHepMC(HepMC::GenEvent *hepMC, std::set< HepMC::GenParticlePtr, ParticleIdCompare > *particleSet=nullptr)
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, unsigned long int randomSeedOffset, const EventContext &ctx) const
ServiceHandle< IAthRNGSvc > m_rndmSvc
void removeDecayTree(HepMC::GenEvent *hepMC, HepMC::GenParticlePtr p)
void reseedRandomEngine(const std::string &streamName, const EventContext &ctx)
bool isDefaultB(const int pId) const
std::set< int > m_blackListSet
CLHEP::HepRandomEngine * getRandomEngineDuringInitialize(const std::string &streamName, unsigned long int randomSeedOffset, unsigned int conditionsRun=1, unsigned int lbn=1) const
void addEvtGenDecayTree(HepMC::GenEvent *hepMC, HepMC::GenParticlePtr part, EvtParticle *evtPart, EvtVector4R treeStart, double momentumScaleFactor=1.0)
std::string m_randomStreamName
IntegerProperty m_dsid
StatusCode traverseDecayTree(HepMC::GenParticlePtr p, bool isToBeRemoved, std::set< HepMC::GenVertexPtr > &visited, std::set< HepMC::GenParticlePtr, ParticleIdCompare > &toBeDecayed)
bool passesUserSelection(HepMC::GenEvent *hepMC)
double invMass(HepMC::ConstGenParticlePtr p1, HepMC::ConstGenParticlePtr p2)
McEventCollection * m_mcEvtColl
std::string m_userDecayFile
std::string xmlpath(void)
std::set< int > m_whiteListSet
IntegerProperty m_randomSeed
Seed for random number engine.
std::vector< int > m_blackList
unsigned int printTree(HepMC::GenParticlePtr p, std::set< HepMC::GenVertexPtr > &visited, int level, std::set< HepMC::GenParticlePtr, ParticleIdCompare > *particleSet=nullptr)
std::string m_outputKeyName
bool isToBeDecayed(HepMC::ConstGenParticlePtr p, bool doCrossChecks)
std::string pdgName(HepMC::ConstGenParticlePtr p, bool statusHighlighting=false, std::set< HepMC::GenParticlePtr, ParticleIdCompare > *particleSet=nullptr)
std::map< int, long > m_noDecayChannels
void decayParticle(HepMC::GenEvent *hepMC, HepMC::GenParticlePtr p)
StatusCode execute(const EventContext &ctx)
Execute method.
EvtInclusiveAtRndmGen * m_evtAtRndmGen
EvtInclusiveDecay(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< int > m_whiteList
GenBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition GenBase.cxx:11
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
HepMC3::GenParticlePtr GenParticlePtr
Definition GenParticle.h:19
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39
bool operator()(const HepMC::GenParticlePtr &a, const HepMC::GenParticlePtr &b) const