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

an algorithm to copy in the overlayed store the calib hits from the signal event More...

#include <MergeCalibHitsTool.h>

Inheritance diagram for MergeCalibHitsTool:
Collaboration diagram for MergeCalibHitsTool:

Public Member Functions

 MergeCalibHitsTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override final
 called before the event loop 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 StatusCode processAllSubEvents (const EventContext &ctx) override final
 return false if not interested in certain xing times (in ns) implemented by default in PileUpToolBase as FirstXing<=bunchXing<=LastXing More...
 

Private Attributes

Gaudi::Property< bool > m_oldFormat {this, "OldFormat", false, ""}
 
ServiceHandle< PileUpMergeSvcm_pMergeSvc {this, "PileUpMergeSvc", "PileUpMergeSvc", ""}
 
bool m_firstSubEvent {true}
 
std::vector< CaloCalibrationHitContainer * > m_outputContainers
 
std::vector< std::string > m_CalibrationHitContainer
 

structors and AlgTool implementation

virtual bool toProcess (int bunchXing) const override
 the method this base class helps implementing More...
 
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 copy in the overlayed store the calib hits from the signal event

$Id:

Author
Guillaume Unal (from Paolo's MergeMcEventCollection)

Definition at line 25 of file MergeCalibHitsTool.h.

Constructor & Destructor Documentation

◆ MergeCalibHitsTool()

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

Definition at line 10 of file MergeCalibHitsTool.cxx.

12  :
14 {
15 }

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 MergeCalibHitsTool::initialize ( )
finaloverridevirtual

called before the event loop

Reimplemented from PileUpToolBase.

Definition at line 17 of file MergeCalibHitsTool.cxx.

17  {
18  ATH_MSG_VERBOSE ( "initialize()" );
19 
20  ATH_CHECK(m_pMergeSvc.retrieve());
21 
22  // list of CaloCalibrationHit containers
23  if(m_oldFormat) {
24  m_CalibrationHitContainer.reserve(5);
25  m_CalibrationHitContainer.push_back("LArCalibrationHitActive");
26  m_CalibrationHitContainer.push_back("LArCalibrationHitDeadMaterial");
27  m_CalibrationHitContainer.push_back("LArCalibrationHitInactive");
28  m_CalibrationHitContainer.push_back("TileCalibrationCellHitCnt");
29  m_CalibrationHitContainer.push_back("TileCalibrationDMHitCnt");
30  }
31  else {
32  m_CalibrationHitContainer.reserve(6);
33  m_CalibrationHitContainer.push_back("LArCalibrationHitActive");
34  m_CalibrationHitContainer.push_back("LArCalibrationHitDeadMaterial");
35  m_CalibrationHitContainer.push_back("LArCalibrationHitInactive");
36  m_CalibrationHitContainer.push_back("TileCalibHitActiveCell");
37  m_CalibrationHitContainer.push_back("TileCalibHitInactiveCell");
38  m_CalibrationHitContainer.push_back("TileCalibHitDeadMaterial");
39  }
41  return StatusCode::SUCCESS;
42 }

◆ mergeEvent()

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

called at the end of the subevts loop.

Not (necessarily) able to access SubEvents

Definition at line 113 of file MergeCalibHitsTool.cxx.

113  {
114  for (unsigned int iHitContainer=0;iHitContainer<m_CalibrationHitContainer.size();++iHitContainer) {
115  if ( m_outputContainers[iHitContainer]==0 ) { continue; } //don't bother recording unused containers!
116  if (!(evtStore()->record(m_outputContainers[iHitContainer],m_CalibrationHitContainer[iHitContainer]).isSuccess())) {
117  ATH_MSG_ERROR ( " Cannot record new calibration hit in overlayed event " );
118  return StatusCode::FAILURE;
119  }
120  } // end of loop over the various types of calo calibration hits
121  return StatusCode::SUCCESS;
122 }

◆ prepareEvent()

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

called before the subevts loop.

Not (necessarily) able to access SubEvents

Definition at line 45 of file MergeCalibHitsTool.cxx.

45  {
46  ATH_MSG_VERBOSE ( "Calling prepareEvent()" );
47  ATH_MSG_VERBOSE( "prepareEvent: there are " << nInputEvents << " subevents in this event.");
48  m_firstSubEvent = true;
49  //clean up pointers from the last event
50  m_outputContainers.clear();
51  for (unsigned int iHitContainer=0;iHitContainer<m_CalibrationHitContainer.size(); ++iHitContainer) {
52  m_outputContainers.push_back(NULL);
53  }
54  return StatusCode::SUCCESS;
55 }

◆ processAllSubEvents() [1/2]

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

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

Propagate the Calib Hit Containers to the output StoreGate

Reimplemented from PileUpToolBase.

Definition at line 124 of file MergeCalibHitsTool.cxx.

124  {
125  ATH_MSG_VERBOSE ( "processAllSubEvents()" );
126 
127  // loop over containers
128  for (unsigned int iHitContainer=0;iHitContainer<m_CalibrationHitContainer.size();iHitContainer++) {
129 
130  ATH_MSG_DEBUG ( " Process CalibrationHit container " << m_CalibrationHitContainer[iHitContainer] );
131 
132  const CaloCalibrationHitContainer* hitCont;
133 
134  // if container not there from pileupservice, do nothing
135  if (!(m_pMergeSvc->retrieveOriginal(m_CalibrationHitContainer[iHitContainer]
136  ,hitCont).isSuccess()) || !hitCont) {
137  ATH_MSG_DEBUG ( " Cannot find calibrationHit from PileUp service " );
138  continue;
139  }
140 
141  // create new container for overlayed event
143 
144  // loop over this container, perform a deep brute-force copy
145  int nhit=0;
146  ATH_MSG_DEBUG ( " Start loop over calibration hits of signal event " );
147  for (const CaloCalibrationHit* hit : *hitCont) {
148  nhit++;
149  newContainer->push_back(new CaloCalibrationHit(*hit));
150  } // end of loop over calibration hits
151 
152  ATH_MSG_DEBUG ( " Number of hits found in this container " << nhit );
153 
154  // record new container in overlayed event
155  if (!(evtStore()->record(newContainer,m_CalibrationHitContainer[iHitContainer]).isSuccess())) {
156  ATH_MSG_ERROR ( " Cannot record new calibration hit in overlayed event " );
157  return StatusCode::FAILURE;
158  }
159 
160  } // end of loop over the various types of calo calibration hits
161 
162  return StatusCode::SUCCESS;
163 }

◆ 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 MergeCalibHitsTool::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 57 of file MergeCalibHitsTool.cxx.

60 {
61  SubEventIterator iEvt(bSubEvents);
62  while (iEvt != eSubEvents) {
63  // MergeCalibHitsTool should only write out the hits from the signal event.
64  if(!m_firstSubEvent) {
65  ATH_MSG_VERBOSE ( " Have already seen a SubEvent marked as Signal! Don't need to look at any others! " );
66  break;
67  }
68 
69  if( iEvt->type()==xAOD::EventInfo_v1::PileUpType::Signal ) {
70  ATH_MSG_DEBUG ( " Found the Signal event! " );
71  }
72  else {
73  // this is not the signal event, so we should skip it.
74  ++iEvt;
75  continue;
76  }
77 
78  // loop over containers
79  for (unsigned int iHitContainer=0;iHitContainer<m_CalibrationHitContainer.size();++iHitContainer) {
80  ATH_MSG_VERBOSE ( " Bunch Crossing: " <<bunchXing << ". Process CalibrationHit container " << m_CalibrationHitContainer[iHitContainer] );
81  const CaloCalibrationHitContainer* hitCont;
82  if (!m_pMergeSvc->retrieveSingleSubEvtData(m_CalibrationHitContainer[iHitContainer], hitCont,
83  bunchXing, iEvt).isSuccess()){
84  ATH_MSG_VERBOSE("CaloCalibrationHitContainer not found for event key " << m_CalibrationHitContainer[iHitContainer]);
85  continue;
86  }
87 
88  //if this is the first SubEvent for this Event then create the hitContainers;
89  if(m_firstSubEvent) {
91  }
92  // loop over this container, perform a deep brute-force copy
93  int nhit=0;
94  ATH_MSG_VERBOSE ( " Start loop over calibration hits of signal event " );
95  CaloCalibrationHitContainer::const_iterator calibhititer = hitCont->begin();
96  CaloCalibrationHitContainer::const_iterator calibhitend = hitCont->end();
97  while(calibhititer != calibhitend) {
98  ++nhit;
99  m_outputContainers[iHitContainer]->push_back(new CaloCalibrationHit(**calibhititer));
100  ++calibhititer;
101  } // end of loop over calibration hits
102 
103  ATH_MSG_DEBUG ( " Number of hits found in this " << m_CalibrationHitContainer[iHitContainer]
104  << " container = " << nhit );
105  }
106  //we must have seen at least one event by now...
107  m_firstSubEvent = false;
108  ++iEvt;
109  }
110 
111  return StatusCode::SUCCESS;
112 }

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

virtual bool PileUpToolBase::toProcess ( int  bunchXing) const
inlineoverridevirtualinherited

the method this base class helps implementing

Reimplemented in MergeHijingParsTool, and MergeTrackRecordCollTool.

Definition at line 32 of file PileUpToolBase.h.

32  {
33  //closed interval [m_firstXing,m_lastXing]
34  return !((m_firstXing > bunchXing) || (bunchXing > m_lastXing));
35  }

Member Data Documentation

◆ m_CalibrationHitContainer

std::vector<std::string> MergeCalibHitsTool::m_CalibrationHitContainer
private

Definition at line 57 of file MergeCalibHitsTool.h.

◆ m_filterPassed

bool PileUpToolBase::m_filterPassed {true}
protectedinherited

Definition at line 60 of file PileUpToolBase.h.

◆ m_firstSubEvent

bool MergeCalibHitsTool::m_firstSubEvent {true}
private

Definition at line 55 of file MergeCalibHitsTool.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_oldFormat

Gaudi::Property<bool> MergeCalibHitsTool::m_oldFormat {this, "OldFormat", false, ""}
private

Definition at line 53 of file MergeCalibHitsTool.h.

◆ m_outputContainers

std::vector<CaloCalibrationHitContainer*> MergeCalibHitsTool::m_outputContainers
private

Definition at line 56 of file MergeCalibHitsTool.h.

◆ m_pMergeSvc

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

Definition at line 54 of file MergeCalibHitsTool.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:
CaloCalibrationHitContainer
Definition: CaloCalibrationHitContainer.h:25
MergeCalibHitsTool::m_pMergeSvc
ServiceHandle< PileUpMergeSvc > m_pMergeSvc
Definition: MergeCalibHitsTool.h:54
PileUpToolBase::m_filterPassed
bool m_filterPassed
Definition: PileUpToolBase.h:60
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
PileUpToolBase::m_lastXing
Gaudi::Property< int > m_lastXing
Definition: PileUpToolBase.h:56
CaloCalibrationHitContainer
CaloCalibrationHitContainer
Definition: CaloSimEventTPCnv.cxx:17
AthenaHitsVector< CaloCalibrationHit >::const_iterator
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator
Definition: AthenaHitsVector.h:58
MergeCalibHitsTool::m_outputContainers
std::vector< CaloCalibrationHitContainer * > m_outputContainers
Definition: MergeCalibHitsTool.h:56
AthenaHitsVector::push_back
void push_back(T *t)
Definition: AthenaHitsVector.h:153
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
python.PileUpEventType.Signal
int Signal
Definition: PileUpEventType.py:3
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
MergeCalibHitsTool::m_firstSubEvent
bool m_firstSubEvent
Definition: MergeCalibHitsTool.h:55
CaloCalibrationHit
Class to store calorimeter calibration hit.
Definition: CaloCalibrationHit.h:23
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
PileUpToolBase::m_firstXing
Gaudi::Property< int > m_firstXing
Definition: PileUpToolBase.h:54
MergeCalibHitsTool::m_oldFormat
Gaudi::Property< bool > m_oldFormat
Definition: MergeCalibHitsTool.h:53
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
AthenaHitsVector::end
const_iterator end() const
Definition: AthenaHitsVector.h:143
AthenaHitsVector::begin
const_iterator begin() const
Definition: AthenaHitsVector.h:139
MergeCalibHitsTool::m_CalibrationHitContainer
std::vector< std::string > m_CalibrationHitContainer
Definition: MergeCalibHitsTool.h:57