ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
MergeTrackRecordCollTool Class Reference

an algorithm to merge MC track record collTool in the overlay store More...

#include <MergeTrackRecordCollTool.h>

Inheritance diagram for MergeTrackRecordCollTool:
Collaboration diagram for MergeTrackRecordCollTool:

Public Member Functions

 MergeTrackRecordCollTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override final
 Initialize tool. More...
 
virtual StatusCode prepareEvent (const EventContext &ctx, unsigned int nInputEvents) override final
 called before the subevts loop. More...
 
virtual StatusCode mergeEvent (const EventContext &ctx) override final
 called at the end of the subevts loop. More...
 
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 More...
 
virtual bool toProcess (int bunchXing) const override final
 return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase as FirstXing<=bunchXing<=LastXing More...
 
virtual StatusCode processAllSubEvents (const EventContext &ctx) override final
 Propagate the TrackRecordCollections to the output StoreGate. More...
 

Private Attributes

ServiceHandle< PileUpMergeSvcm_pMergeSvc {this, "PileUpMergeSvc", "PileUpMergeSvc", ""}
 
StringProperty m_trRecCollKey {this, "TrackRecordCollKey", "MuonEntryLayer", ""}
 
SG::WriteHandleKey< TrackRecordCollectionm_outputKey { this, "TrackRecordCollOutputKey", "MuonExitLayer", "" }
 
bool m_firstSubEvent {true}
 

structors and AlgTool implementation

virtual StatusCode processAllSubEvents (const EventContext &ctx)=0
 dummy implementation to allow compilation while all Digitization packages are migrated to use this new interface. More...
 
virtual bool filterPassed () const override
 dummy implementation of passing filter More...
 
virtual void resetFilter () override
 dummy implementation of filter reset More...
 
Gaudi::Property< int > m_firstXing
 
Gaudi::Property< int > m_lastXing
 
Gaudi::Property< int > m_vetoPileUpTruthLinks
 
bool m_filterPassed {true}
 

Detailed Description

an algorithm to merge MC track record collTool in the overlay store

$Id:

Author
DCost.nosp@m.anzo.nosp@m.@bnl..nosp@m.gov (from Paolo's MergeMcEventCollTool)

Definition at line 24 of file MergeTrackRecordCollTool.h.

Constructor & Destructor Documentation

◆ MergeTrackRecordCollTool()

MergeTrackRecordCollTool::MergeTrackRecordCollTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 9 of file MergeTrackRecordCollTool.cxx.

11  :
13 {
14 }

Member Function Documentation

◆ filterPassed()

virtual bool PileUpToolBase::filterPassed ( ) const
inlineoverridevirtualinherited

dummy implementation of passing filter

Definition at line 49 of file PileUpToolBase.h.

49 { return m_filterPassed; }

◆ initialize()

StatusCode MergeTrackRecordCollTool::initialize ( )
finaloverridevirtual

Initialize tool.

Reimplemented from PileUpToolBase.

Definition at line 16 of file MergeTrackRecordCollTool.cxx.

17 {
18  ATH_MSG_DEBUG( "initialize()" );
19  ATH_CHECK( m_pMergeSvc.retrieve() );
20  ATH_CHECK( m_outputKey.initialize() );
21  return StatusCode::SUCCESS;
22 }

◆ mergeEvent()

StatusCode MergeTrackRecordCollTool::mergeEvent ( const EventContext &  ctx)
finaloverridevirtual

called at the end of the subevts loop.

Not (necessarily) able to access SubEvents

Definition at line 68 of file MergeTrackRecordCollTool.cxx.

69 {
70  //Nothing to do here;
71  return StatusCode::SUCCESS;
72 }

◆ prepareEvent()

StatusCode MergeTrackRecordCollTool::prepareEvent ( const EventContext &  ctx,
unsigned int  nInputEvents 
)
finaloverridevirtual

called before the subevts loop.

Not (necessarily) able to access SubEvents

Definition at line 24 of file MergeTrackRecordCollTool.cxx.

25 {
26  ATH_MSG_DEBUG ( "Calling prepareEvent()" );
27  ATH_MSG_DEBUG( "prepareEvent: there are " << nInputEvents << " subevents in this event.");
28  m_firstSubEvent=true;
29  return StatusCode::SUCCESS;
30 }

◆ processAllSubEvents() [1/2]

StatusCode MergeTrackRecordCollTool::processAllSubEvents ( const EventContext &  ctx)
finaloverridevirtual

Propagate the TrackRecordCollections to the output StoreGate.

Reimplemented from PileUpToolBase.

Definition at line 81 of file MergeTrackRecordCollTool.cxx.

82 {
83  ATH_MSG_VERBOSE ( "processAllSubEvents()" );
84 
86  TimedTruthList truthList;
87  if ( (m_pMergeSvc->retrieveSubEvtsData(m_trRecCollKey.value(), truthList)).isSuccess() ) {
88  if (truthList.begin() != truthList.end()) {
89  //FIXME we are forced to do a deep copy
90  const TrackRecordCollection &oldColl=*(truthList.begin())->second;
91 
93  ATH_CHECK(outputCollection.record(std::make_unique<TrackRecordCollection>()));
94  if (!outputCollection.isValid()) {
95  ATH_MSG_ERROR("Could not record output TrackRecordCollection " << outputCollection.name() << " to store " << outputCollection.store());
96  return StatusCode::FAILURE;
97  }
98 
99  for (const auto& trcit : oldColl) {
100  outputCollection->push_back( TrackRecord(trcit) );
101  }
102 
103  ATH_MSG_DEBUG ( "processAllSubEvents: copied original event TrackRecordCollection" );
104  }
105  else {
106  ATH_MSG_ERROR ( "processAllSubEvents: TimedTruthList is empty" );
107  }
108  }
109  else {
110  ATH_MSG_ERROR ( "processAllSubEvents: Can not find TimedTruthList" );
111  }
112  return StatusCode::SUCCESS;
113 }

◆ processAllSubEvents() [2/2]

virtual StatusCode IPileUpTool::processAllSubEvents
inherited

dummy implementation to allow compilation while all Digitization packages are migrated to use this new interface.

◆ processBunchXing()

StatusCode MergeTrackRecordCollTool::processBunchXing ( int  bunchXing,
SubEventIterator  bSubEvents,
SubEventIterator  eSubEvents 
)
finaloverridevirtual

called for each active bunch-crossing to process current SubEvents bunchXing is in ns

Reimplemented from PileUpToolBase.

Definition at line 32 of file MergeTrackRecordCollTool.cxx.

35 {
36  ATH_MSG_VERBOSE ( "processBunchXing()" );
37  //We are only interested in the TrackRecordCollection for the original event
38  if(m_firstSubEvent && bunchXing==0) {
39  if (bSubEvents != eSubEvents) {
40  const TrackRecordCollection* oldColl(nullptr);
41  if (m_pMergeSvc->retrieveSingleSubEvtData(m_trRecCollKey.value(), oldColl,
42  bunchXing, bSubEvents).isSuccess()) {
44  ATH_CHECK(outputCollection.record(std::make_unique<TrackRecordCollection>()));
45  if (!outputCollection.isValid()) {
46  ATH_MSG_ERROR("Could not record output TrackRecordCollection " << outputCollection.name() << " to store " << outputCollection.store());
47  return StatusCode::FAILURE;
48  }
49 
50  for(const auto& trcit : *oldColl) {
51  outputCollection->push_back( TrackRecord(trcit) );
52  }
53  ATH_MSG_DEBUG( "processBunchXing: copied original event TrackRecordCollection" );
54  m_firstSubEvent=false;
55  }
56  else {
57  ATH_MSG_ERROR ( "processBunchXing: TimedTruthList is empty" );
58  }
59  }
60  else {
61  ATH_MSG_ERROR ( "processBunchXing: Can not find TimedTruthList" );
62  }
63  }
64 
65  return StatusCode::SUCCESS;
66 }

◆ resetFilter()

virtual void PileUpToolBase::resetFilter ( )
inlineoverridevirtualinherited

dummy implementation of filter reset

Reimplemented in MergeTruthJetsTool.

Definition at line 51 of file PileUpToolBase.h.

51 { m_filterPassed=true; }

◆ toProcess()

bool MergeTrackRecordCollTool::toProcess ( int  bunchXing) const
finaloverridevirtual

return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase as FirstXing<=bunchXing<=LastXing

Reimplemented from PileUpToolBase.

Definition at line 74 of file MergeTrackRecordCollTool.cxx.

75 {
76  //We are only interested in the TrackRecordCollection for the original event
77  //which should be in BC 0 !
78  return (bunchXing==0);
79 }

Member Data Documentation

◆ m_filterPassed

bool PileUpToolBase::m_filterPassed {true}
protectedinherited

Definition at line 60 of file PileUpToolBase.h.

◆ m_firstSubEvent

bool MergeTrackRecordCollTool::m_firstSubEvent {true}
private

Definition at line 53 of file MergeTrackRecordCollTool.h.

◆ m_firstXing

Gaudi::Property<int> PileUpToolBase::m_firstXing
protectedinherited
Initial value:
{this, "FirstXing", -999,
"First bunch-crossing in which det is live"}

Definition at line 54 of file PileUpToolBase.h.

◆ m_lastXing

Gaudi::Property<int> PileUpToolBase::m_lastXing
protectedinherited
Initial value:
{this, "LastXing", 999,
"Last bunch-crossing in which det is live"}

Definition at line 56 of file PileUpToolBase.h.

◆ m_outputKey

SG::WriteHandleKey<TrackRecordCollection> MergeTrackRecordCollTool::m_outputKey { this, "TrackRecordCollOutputKey", "MuonExitLayer", "" }
private

Definition at line 52 of file MergeTrackRecordCollTool.h.

◆ m_pMergeSvc

ServiceHandle<PileUpMergeSvc> MergeTrackRecordCollTool::m_pMergeSvc {this, "PileUpMergeSvc", "PileUpMergeSvc", ""}
private

Definition at line 50 of file MergeTrackRecordCollTool.h.

◆ m_trRecCollKey

StringProperty MergeTrackRecordCollTool::m_trRecCollKey {this, "TrackRecordCollKey", "MuonEntryLayer", ""}
private

Definition at line 51 of file MergeTrackRecordCollTool.h.

◆ m_vetoPileUpTruthLinks

Gaudi::Property<int> PileUpToolBase::m_vetoPileUpTruthLinks
protectedinherited
Initial value:
{this, "VetoPileUpTruthLinks", true,
"Ignore links to suppressed pile-up truth"}

Definition at line 58 of file PileUpToolBase.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
PileUpToolBase::m_filterPassed
bool m_filterPassed
Definition: PileUpToolBase.h:60
AtlasHitsVector
Definition: AtlasHitsVector.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
PileUpMergeSvc::TimedList::type
std::list< value_t > type
type of the collection of timed data object
Definition: PileUpMergeSvc.h:75
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MergeTrackRecordCollTool::m_pMergeSvc
ServiceHandle< PileUpMergeSvc > m_pMergeSvc
Definition: MergeTrackRecordCollTool.h:50
MergeTrackRecordCollTool::m_outputKey
SG::WriteHandleKey< TrackRecordCollection > m_outputKey
Definition: MergeTrackRecordCollTool.h:52
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
PileUpToolBase::PileUpToolBase
PileUpToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: PileUpToolBase.cxx:7
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
postInclude.outputCollection
outputCollection
Definition: postInclude.SortInput.py:27
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MergeTrackRecordCollTool::m_firstSubEvent
bool m_firstSubEvent
Definition: MergeTrackRecordCollTool.h:53
TrackRecord
Definition: TrackRecord.h:12
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MergeTrackRecordCollTool::m_trRecCollKey
StringProperty m_trRecCollKey
Definition: MergeTrackRecordCollTool.h:51