ATLAS Offline Software
NewMergeMcEventCollTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MCTRUTHSIMALGS_NEWMERGEMCEVENTCOLLTOOL_H
6 #define MCTRUTHSIMALGS_NEWMERGEMCEVENTCOLLTOOL_H
7 
8 #include "Gaudi/Property.h"
9 #include "GaudiKernel/ServiceHandle.h"
10 
11 #include "StoreGate/WriteHandle.h"
13 
15 
17 
19 
25 public:
26  NewMergeMcEventCollTool(const std::string& type,
27  const std::string& name,
28  const IInterface* parent);
29  virtual StatusCode initialize() override final;
32  virtual StatusCode prepareEvent(const EventContext& ctx, unsigned int nInputEvents) override final;
35  virtual StatusCode mergeEvent(const EventContext& ctx) override final;
38  virtual StatusCode
39  processBunchXing(int /*bunchXing*/,
40  SubEventIterator bSubEvents,
41  SubEventIterator eSubEvents) override final;
42 
43  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
44 
45 private:
46  //** Add the required information from the current GenEvent to the output McEventCollection
47  StatusCode processEvent(const McEventCollection *pMcEvtColl, McEventCollection *outputMcEventCollection, int pileupType, long timeOffset=0);
48  //** Print out detailed debug info if required.
49  void printDetailsOfMergedMcEventCollection(McEventCollection *outputMcEventCollection) const;
50  //** Handle for the PileUpMergeSvc (provides input McEventCollections)
51  ServiceHandle<PileUpMergeSvc> m_pMergeSvc{this, "PileUpMergeSvc", "PileUpMergeSvc", ""};
52  //** Name of input McEventCollection
53  StringProperty m_truthCollInputKey{this,"TruthCollInputKey", "TruthEvent", ""};
54  //** Depends on PileUpTimeEventIndex::PileUpType; provide one instance of this tool for each type
55  Gaudi::Property<int> m_pileUpType{this, "PileUpType", -1, ""}; // initialise to PileUpTimeEventIndex::PileUpType::Unknown
56  //** Writing to StoreGate safely in MT
58  //** Writing to StoreGate safely in MT
59  SG::WriteHandleKey<McEventCollection> m_truthCollOutputKey{this, "TruthCollOutputKey","TruthEvent",""};
60 };
61 #endif //MCTRUTHSIMALGS_NEWMERGEMCEVENTCOLLTOOL_H
NewMergeMcEventCollTool::processEvent
StatusCode processEvent(const McEventCollection *pMcEvtColl, McEventCollection *outputMcEventCollection, int pileupType, long timeOffset=0)
Definition: NewMergeMcEventCollTool.cxx:115
NewMergeMcEventCollTool::m_outputMcEventCollection
SG::WriteHandle< McEventCollection > m_outputMcEventCollection
Definition: NewMergeMcEventCollTool.h:57
NewMergeMcEventCollTool::m_pMergeSvc
ServiceHandle< PileUpMergeSvc > m_pMergeSvc
Definition: NewMergeMcEventCollTool.h:51
NewMergeMcEventCollTool::m_truthCollInputKey
StringProperty m_truthCollInputKey
Definition: NewMergeMcEventCollTool.h:53
NewMergeMcEventCollTool::printDetailsOfMergedMcEventCollection
void printDetailsOfMergedMcEventCollection(McEventCollection *outputMcEventCollection) const
Definition: NewMergeMcEventCollTool.cxx:153
NewMergeMcEventCollTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int nInputEvents) override final
called before the subevts loop.
Definition: NewMergeMcEventCollTool.cxx:24
NewMergeMcEventCollTool::m_pileUpType
Gaudi::Property< int > m_pileUpType
Definition: NewMergeMcEventCollTool.h:55
WriteHandle.h
Handle class for recording to StoreGate.
SG::WriteHandleKey< McEventCollection >
NewMergeMcEventCollTool::NewMergeMcEventCollTool
NewMergeMcEventCollTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: NewMergeMcEventCollTool.cxx:8
McEventCollection.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
NewMergeMcEventCollTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
called at the end of the subevts loop.
Definition: NewMergeMcEventCollTool.cxx:72
NewMergeMcEventCollTool
a PileUpTool to merge MC truth collection in the overlay store
Definition: NewMergeMcEventCollTool.h:24
PileUpToolBase
Definition: PileUpToolBase.h:18
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
NewMergeMcEventCollTool::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: NewMergeMcEventCollTool.cxx:52
NewMergeMcEventCollTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Algorithm Approach.
Definition: NewMergeMcEventCollTool.cxx:80
SG::WriteHandle< McEventCollection >
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
NewMergeMcEventCollTool::m_truthCollOutputKey
SG::WriteHandleKey< McEventCollection > m_truthCollOutputKey
Definition: NewMergeMcEventCollTool.h:59
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
NewMergeMcEventCollTool::initialize
virtual StatusCode initialize() override final
Definition: NewMergeMcEventCollTool.cxx:15
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
ServiceHandle< PileUpMergeSvc >