ATLAS Offline Software
Loading...
Searching...
No Matches
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.
virtual StatusCode prepareEvent (const EventContext &ctx, unsigned int nInputEvents) override final
 called before the subevts loop.
virtual StatusCode mergeEvent (const EventContext &ctx) override final
 called at the end of the subevts loop.
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
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
virtual StatusCode processAllSubEvents (const EventContext &ctx) override final
 Propagate the TrackRecordCollections to the output StoreGate.

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 bool filterPassed () const override
 dummy implementation of passing filter
virtual void resetFilter () override
 dummy implementation of filter reset
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 :
12 PileUpToolBase(type, name, parent)
13{
14}
PileUpToolBase(const std::string &type, const std::string &name, const IInterface *parent)

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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
SG::WriteHandleKey< TrackRecordCollection > m_outputKey
ServiceHandle< PileUpMergeSvc > m_pMergeSvc

◆ 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()

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
92 SG::WriteHandle<TrackRecordCollection> outputCollection(m_outputKey, ctx);
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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
AtlasHitsVector< TrackRecord > TrackRecordCollection
std::list< value_t > type
type of the collection of timed data object

◆ 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()) {
43 SG::WriteHandle<TrackRecordCollection> outputCollection(m_outputKey);
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.

60{true};

◆ m_firstSubEvent

bool MergeTrackRecordCollTool::m_firstSubEvent {true}
private

Definition at line 53 of file MergeTrackRecordCollTool.h.

53{true};

◆ 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.

54 {this, "FirstXing", -999,
55 "First bunch-crossing in which det is live"};

◆ 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.

56 {this, "LastXing", 999,
57 "Last bunch-crossing in which det is live"};

◆ m_outputKey

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

Definition at line 52 of file MergeTrackRecordCollTool.h.

52{ this, "TrackRecordCollOutputKey", "MuonExitLayer", "" };

◆ m_pMergeSvc

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

Definition at line 50 of file MergeTrackRecordCollTool.h.

50{this, "PileUpMergeSvc", "PileUpMergeSvc", ""};

◆ m_trRecCollKey

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

Definition at line 51 of file MergeTrackRecordCollTool.h.

51{this, "TrackRecordCollKey", "MuonEntryLayer", ""};

◆ 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.

58 {this, "VetoPileUpTruthLinks", true,
59 "Ignore links to suppressed pile-up truth"};

The documentation for this class was generated from the following files: