ATLAS Offline Software
SimpleMergeMcEventCollTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MCTRUTHSIMALGS_SIMPLEMERGEMCEVENTCOLLTOOL_H
6 #define MCTRUTHSIMALGS_SIMPLEMERGEMCEVENTCOLLTOOL_H
7 
9 
10 #include "Gaudi/Property.h"
11 #include "GaudiKernel/ServiceHandle.h"
12 
13 #include <utility> /* pair */
14 
15 class McEventCollection;
16 
27 public:
28  SimpleMergeMcEventCollTool(const std::string& type,
29  const std::string& name,
30  const IInterface* parent);
31  virtual StatusCode initialize() override final;
34  virtual StatusCode prepareEvent(const EventContext& ctx, unsigned int nInputEvents) override final;
37  virtual StatusCode mergeEvent(const EventContext& ctx) override final;
40  virtual StatusCode
41  processBunchXing(int /*bunchXing*/,
42  SubEventIterator bSubEvents,
43  SubEventIterator eSubEvents) override final;
46  // virtual bool toProcess(int bunchXing) const;
47 
48  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
49 
50 private:
51  //** Ensure that any GenEvent::HeavyIon info is stored in the signal GenEvent.
52  StatusCode saveHeavyIonInfo(const McEventCollection *pMcEvtColl, McEventCollection *outputMcEventCollection);
53  //** Add the required information from the current GenEvent to the output McEventCollection
54  StatusCode processEvent(const McEventCollection *pMcEvtColl, McEventCollection *outputMcEventCollection, const int currentBkgEventIndex, int bunchCrossingTime, int pileupType);
55  //** Print out detailed debug info if required.
56  void printDetailsOfMergedMcEventCollection(McEventCollection *outputMcEventCollection) const;
57  //** Handle for the PileUpMergeSvc (provides input McEventCollections)
58  ServiceHandle<PileUpMergeSvc> m_pMergeSvc{this, "PileUpMergeSvc", "PileUpMergeSvc", ""};
59  StringProperty m_truthCollOutputKey{this, "TruthCollOutputKey", "TruthEvent", "Name of output McEventCollection"};
61  //** Name of input McEventCollection
62  StringProperty m_truthCollInputKey{this, "TruthCollInputKey", "TruthEvent", ""};
63  //** Override the event numbers to be the current background event index
64  BooleanProperty m_overrideEventNumbers{this, "OverrideEventNumbers", false, ""};
65  //** Just save the Signal GenEvent
66  BooleanProperty m_onlySaveSignalTruth{this, "OnlySaveSignalTruth", false, "Just save the Signal GenEvent"};
67  //** Bool to indicate that the next GenEvent is a new signal event
68  bool m_newevent{true};
69  //** The total number of GenEvents that will be passed for the current signal event
70  unsigned int m_nInputMcEventColls{0};
71  //** How many background events have been read so far for this signal event
72  unsigned int m_nBkgEventsReadSoFar{0};
73 };
74 #endif //MCTRUTHSIMALGS_SIMPLEMERGEMCEVENTCOLLTOOL_H
SimpleMergeMcEventCollTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int nInputEvents) override final
called before the subevts loop.
Definition: SimpleMergeMcEventCollTool.cxx:29
SimpleMergeMcEventCollTool::m_truthCollOutputKey
StringProperty m_truthCollOutputKey
Definition: SimpleMergeMcEventCollTool.h:59
SimpleMergeMcEventCollTool::m_nInputMcEventColls
unsigned int m_nInputMcEventColls
Definition: SimpleMergeMcEventCollTool.h:70
SimpleMergeMcEventCollTool::m_pMergeSvc
ServiceHandle< PileUpMergeSvc > m_pMergeSvc
Definition: SimpleMergeMcEventCollTool.h:58
SimpleMergeMcEventCollTool::m_onlySaveSignalTruth
BooleanProperty m_onlySaveSignalTruth
Definition: SimpleMergeMcEventCollTool.h:66
GenParticle_fwd.h
SimpleMergeMcEventCollTool::saveHeavyIonInfo
StatusCode saveHeavyIonInfo(const McEventCollection *pMcEvtColl, McEventCollection *outputMcEventCollection)
Common methods.
Definition: SimpleMergeMcEventCollTool.cxx:136
SimpleMergeMcEventCollTool::m_outputMcEventCollection
McEventCollection * m_outputMcEventCollection
Definition: SimpleMergeMcEventCollTool.h:60
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
GenVertex_fwd.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
SimpleMergeMcEventCollTool::processEvent
StatusCode processEvent(const McEventCollection *pMcEvtColl, McEventCollection *outputMcEventCollection, const int currentBkgEventIndex, int bunchCrossingTime, int pileupType)
Definition: SimpleMergeMcEventCollTool.cxx:152
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
SimpleMergeMcEventCollTool::m_truthCollInputKey
StringProperty m_truthCollInputKey
Definition: SimpleMergeMcEventCollTool.h:62
SimpleMergeMcEventCollTool::processBunchXing
virtual StatusCode processBunchXing(int, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
called for each active bunch-crossing to process current SubEvents bunchXing is in ns
Definition: SimpleMergeMcEventCollTool.cxx:49
PileUpToolBase
Definition: PileUpToolBase.h:18
SimpleMergeMcEventCollTool::initialize
virtual StatusCode initialize() override final
Definition: SimpleMergeMcEventCollTool.cxx:19
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SimpleMergeMcEventCollTool::m_nBkgEventsReadSoFar
unsigned int m_nBkgEventsReadSoFar
Definition: SimpleMergeMcEventCollTool.h:72
SimpleMergeMcEventCollTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase...
Definition: SimpleMergeMcEventCollTool.cxx:90
SimpleMergeMcEventCollTool::SimpleMergeMcEventCollTool
SimpleMergeMcEventCollTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: SimpleMergeMcEventCollTool.cxx:12
SimpleMergeMcEventCollTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
called at the end of the subevts loop.
Definition: SimpleMergeMcEventCollTool.cxx:77
SimpleMergeMcEventCollTool
a PileUpTool to merge MC truth collection in the overlay store
Definition: SimpleMergeMcEventCollTool.h:26
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SimpleMergeMcEventCollTool::printDetailsOfMergedMcEventCollection
void printDetailsOfMergedMcEventCollection(McEventCollection *outputMcEventCollection) const
Definition: SimpleMergeMcEventCollTool.cxx:189
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
SimpleMergeMcEventCollTool::m_overrideEventNumbers
BooleanProperty m_overrideEventNumbers
Definition: SimpleMergeMcEventCollTool.h:64
SimpleMergeMcEventCollTool::m_newevent
bool m_newevent
Definition: SimpleMergeMcEventCollTool.h:68
ServiceHandle< PileUpMergeSvc >