ATLAS Offline Software
MergeTruthParticlesTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MCTRUTHSIMALGS_MERGETRUTHPARTICLESTOOL_H
6 #define MCTRUTHSIMALGS_MERGETRUTHPARTICLESTOOL_H
7 
9 
11 
12 #include "Gaudi/Property.h"
13 #include "GaudiKernel/ServiceHandle.h"
14 #include "GaudiKernel/ToolHandle.h"
16 #include "GaudiKernel/SystemOfUnits.h"
17 
18 #include <string>
19 
24 public:
25  MergeTruthParticlesTool(const std::string& type,
26  const std::string& name,
27  const IInterface* parent);
29  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 processBunchXing(int bunchXing,
39  SubEventIterator bSubEvents,
40  SubEventIterator eSubEvents) override final;
42  virtual StatusCode processAllSubEvents(const EventContext& ctx) override final;
43 
44 private:
46  virtual StatusCode processTruthParticleContainer(const xAOD::TruthParticleContainer* inputTruthParticleContainer,
47  xAOD::TruthParticleContainer *outputTruthParticleContainer,
48  int eventNumber);
49  StatusCode record(const xAOD::TruthParticleContainer* pTruthParticles, const std::string& truthParticleContainerName) const;
50  ServiceHandle<PileUpMergeSvc> m_pMergeSvc{this, "PileUpMergeSvc", "PileUpMergeSvc", ""};
51  Gaudi::Property<std::string> m_inputTruthParticleCollKey{this, "InputTruthParticleCollKey", "TruthPileupParticles", ""};
52  Gaudi::Property<std::string> m_inTimeOutputTruthParticleCollKey{this, "InTimeOutputTruthParticleCollKey", "TruthPileupParticles", ""};
53  Gaudi::Property<bool> m_includeSignalTruthParticles{this, "IncludeSignalTruthParticles", false, ""};
55  bool m_first_event{true};
56 };
57 #endif //MCTRUTHSIMALGS_MERGETRUTHPARTICLESTOOL_H
MergeTruthParticlesTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Merge the Truth TruthParticleContainers using the PileUpMergeSvc.
Definition: MergeTruthParticlesTool.cxx:109
MergeTruthParticlesTool::MergeTruthParticlesTool
MergeTruthParticlesTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MergeTruthParticlesTool.cxx:12
TruthParticleContainer.h
MergeTruthParticlesTool::m_includeSignalTruthParticles
Gaudi::Property< bool > m_includeSignalTruthParticles
Definition: MergeTruthParticlesTool.h:53
MergeTruthParticlesTool::m_inputTruthParticleCollKey
Gaudi::Property< std::string > m_inputTruthParticleCollKey
Definition: MergeTruthParticlesTool.h:51
MergeTruthParticlesTool::m_pMergeSvc
ServiceHandle< PileUpMergeSvc > m_pMergeSvc
Definition: MergeTruthParticlesTool.h:50
MergeTruthParticlesTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
called at the end of the subevts loop.
Definition: MergeTruthParticlesTool.cxx:70
MergeTruthParticlesTool::processBunchXing
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
called for each active bunch-crossing to process current SubEvents bunchXing is in ns
Definition: MergeTruthParticlesTool.cxx:36
MergeTruthParticlesTool::initialize
StatusCode initialize() override final
Initialize.
Definition: MergeTruthParticlesTool.cxx:19
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
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
PileUpToolBase
Definition: PileUpToolBase.h:18
MergeTruthParticlesTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int nInputEvents) override final
called before the subevts loop.
Definition: MergeTruthParticlesTool.cxx:26
MergeTruthParticlesTool::processTruthParticleContainer
virtual StatusCode processTruthParticleContainer(const xAOD::TruthParticleContainer *inputTruthParticleContainer, xAOD::TruthParticleContainer *outputTruthParticleContainer, int eventNumber)
TruthParticleContainer Loop.
Definition: MergeTruthParticlesTool.cxx:158
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MergeTruthParticlesTool::record
StatusCode record(const xAOD::TruthParticleContainer *pTruthParticles, const std::string &truthParticleContainerName) const
Definition: MergeTruthParticlesTool.cxx:85
MergeTruthParticlesTool::m_inTimeOutputTruthParticleContainer
xAOD::TruthParticleContainer * m_inTimeOutputTruthParticleContainer
Definition: MergeTruthParticlesTool.h:54
MergeTruthParticlesTool::m_first_event
bool m_first_event
Definition: MergeTruthParticlesTool.h:55
MergeTruthParticlesTool
an algorithm to merge truth particles collections in the overlay store
Definition: MergeTruthParticlesTool.h:23
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
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
PileUpToolBase.h
helper base class IPileUpTool::toProcess().
MergeTruthParticlesTool::m_inTimeOutputTruthParticleCollKey
Gaudi::Property< std::string > m_inTimeOutputTruthParticleCollKey
Definition: MergeTruthParticlesTool.h:52
ServiceHandle< PileUpMergeSvc >