ATLAS Offline Software
Loading...
Searching...
No Matches
TileCellVerify Class Reference

#include <TileCellVerify.h>

Inheritance diagram for TileCellVerify:
Collaboration diagram for TileCellVerify:

Public Member Functions

 TileCellVerify (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~TileCellVerify ()
StatusCode initialize ()
StatusCode execute (const EventContext &ctx)
 Execute method.
StatusCode finalize ()
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< CaloCellContainer > m_cellContainer1Key
SG::ReadHandleKey< CaloCellContainer > m_cellContainer2Key
const TileID * m_tileID {nullptr}
Gaudi::Property< bool > m_dumpCells {this, "DumpCells", false, "Dump all cells"}
Gaudi::Property< bool > m_sortFlag {this, "SortFlag", false, "Sort cells by energy before comparison"}
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 46 of file TileCellVerify.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TileCellVerify()

TileCellVerify::TileCellVerify ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 49 of file TileCellVerify.cxx.

50 : AthAlgorithm(name, pSvcLocator)
51{
52}
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.

◆ ~TileCellVerify()

TileCellVerify::~TileCellVerify ( )
virtual

Definition at line 54 of file TileCellVerify.cxx.

54 {
55}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TileCellVerify::execute ( const EventContext & ctx)
virtual

Execute method.

Implements AthAlgorithm.

Definition at line 71 of file TileCellVerify.cxx.

71 {
72
73 // step1: read two cell containers from TES
74 SG::ReadHandle<CaloCellContainer> cellContainer1(m_cellContainer1Key, ctx);
75 ATH_CHECK(cellContainer1.isValid());
76
77 SG::ReadHandle<CaloCellContainer> cellContainer2(m_cellContainer2Key, ctx);
78 ATH_CHECK(cellContainer2.isValid());
79
80 // step2: first compare the number of cells in the two containers
81 int nCells1 = cellContainer1->size();
82 int nCells2 = cellContainer2->size();
83 ATH_MSG_INFO( "The number of cells in " << m_cellContainer1Key.key() << " is " << nCells1 );
84 ATH_MSG_INFO( "The number of cells in " << m_cellContainer2Key.key() << " is " << nCells2 );
85
86 if (nCells1 != nCells2) {
87 ATH_MSG_ERROR( "The number of cells is not equal in the two cell "
88 << "containers: " << m_cellContainer1Key.key()
89 << " and " << m_cellContainer2Key.key() );
90
91 return (StatusCode::SUCCESS);
92 }
93
94 // step3: to sort the cells in the container read above by energy
95 vector<const CaloCell*> cells1;
96 vector<const CaloCell*> cells2;
97 const CaloCell* cell1(nullptr);
98 const CaloCell* cell2(nullptr);
99 if (m_sortFlag) {
100
101 for (const CaloCell* cell : *cellContainer1) {
102 cells1.push_back(cell);
103 }
104
105 for (const CaloCell* cell : *cellContainer2) {
106 cells2.push_back(cell);
107 }
108
109 sort(cells1.begin(), cells1.end(), CompCell());
110 sort(cells2.begin(), cells2.end(), CompCell());
111 }
112
113 // step4: then compare every cell-pair in the containers
114 bool bErrorFlag = false;
115 bool bOnlyOnceFlag = false;
116 bool lVerbose = msgLvl(MSG::VERBOSE);
117 for (int i = 0; i < nCells1; ++i) {
118
119 if (m_sortFlag) {
120 cell1 = cells1[i];
121 cell2 = cells2[i];
122 } else {
123 cell1 = (*cellContainer1)[i];
124 cell2 = (*cellContainer2)[i];
125 }
126
127 Identifier id1 = cell1->ID();
128 Identifier id2 = cell2->ID();
129 if (id1 != id2) bErrorFlag = true;
130 if (lVerbose && (m_dumpCells || bErrorFlag)) {
131
132 if (!bOnlyOnceFlag) {
133 msg(MSG::VERBOSE) << " ===" << m_cellContainer1Key.key() << "=== ===" << m_cellContainer2Key.key() << "===" << endmsg;
134 msg(MSG::VERBOSE) << " Index e1 id1 | e2 id2" << endmsg;
135 msg(MSG::VERBOSE) << "--------------------------------------------------------------------------------" << endmsg;
136 bOnlyOnceFlag = true;
137 }
138
139 msg(MSG::VERBOSE) << setw(5) << i << " " << setw(12) << cell1->energy() << " [";
140 msg(MSG::VERBOSE) << m_tileID->to_string(id1, -2) << "]";
141 msg(MSG::VERBOSE) << " | " << setw(12) << cell2->energy() << " [";
142 msg(MSG::VERBOSE) << m_tileID->to_string(id2, -2) << "]";
143
144 if (bErrorFlag) msg(MSG::VERBOSE) << " * ";
145
146 msg(MSG::VERBOSE) << endmsg;
147
148 } else if (bErrorFlag){
149 break;
150 }
151 }
152 if (bOnlyOnceFlag) {
153 msg(MSG::VERBOSE) << "--------------------------------------------------------------------------------" << endmsg;
154 }
155 if (!bErrorFlag) {
156 ATH_MSG_INFO( "The two cellContainers (" << m_cellContainer1Key.key()
157 << " and " << m_cellContainer2Key.key() << ") are same!!!" );
158 } else {
159 ATH_MSG_INFO( "The two cellContainers (" << m_cellContainer1Key.key()
160 << " and " << m_cellContainer2Key.key() << ") are not same!!!" );
161 }
162
163 // Execution completed.
164 ATH_MSG_INFO( "TileCellVerify execution completed successfully" );
165
166 return StatusCode::SUCCESS;
167}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
bool msgLvl(const MSG::Level lvl) const
SG::ReadHandleKey< CaloCellContainer > m_cellContainer2Key
const TileID * m_tileID
Gaudi::Property< bool > m_sortFlag
SG::ReadHandleKey< CaloCellContainer > m_cellContainer1Key
Gaudi::Property< bool > m_dumpCells
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode TileCellVerify::finalize ( )

Definition at line 169 of file TileCellVerify.cxx.

169 {
170
171 ATH_MSG_INFO( "TileCellVerify::finalize() end" );
172
173 return StatusCode::SUCCESS;
174}

◆ initialize()

StatusCode TileCellVerify::initialize ( )

Definition at line 58 of file TileCellVerify.cxx.

58 {
59
60 // retrieve TileID helper from det store
61 CHECK( detStore()->retrieve(m_tileID) );
62
63 ATH_CHECK( m_cellContainer1Key.initialize() );
64 ATH_CHECK( m_cellContainer2Key.initialize() );
65
66 ATH_MSG_INFO( "TileCellVerify initialization completed" );
67
68 return StatusCode::SUCCESS;
69}
#define CHECK(...)
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
#define ATH_MSG_WARNING(x,...)
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }

Member Data Documentation

◆ m_cellContainer1Key

SG::ReadHandleKey<CaloCellContainer> TileCellVerify::m_cellContainer1Key
private
Initial value:
{this,"TileCellContainer1",
"TileCellContainer1",
"Input Calo cell container 1 key"}

Definition at line 61 of file TileCellVerify.h.

61 {this,"TileCellContainer1",
62 "TileCellContainer1",
63 "Input Calo cell container 1 key"};

◆ m_cellContainer2Key

SG::ReadHandleKey<CaloCellContainer> TileCellVerify::m_cellContainer2Key
private
Initial value:
{this,"TileCellContainer2",
"TileCellContainer1",
"Input Calo cell container 2 key"}

Definition at line 65 of file TileCellVerify.h.

65 {this,"TileCellContainer2",
66 "TileCellContainer1",
67 "Input Calo cell container 2 key"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_dumpCells

Gaudi::Property<bool> TileCellVerify::m_dumpCells {this, "DumpCells", false, "Dump all cells"}
private

Definition at line 72 of file TileCellVerify.h.

72{this, "DumpCells", false, "Dump all cells"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_sortFlag

Gaudi::Property<bool> TileCellVerify::m_sortFlag {this, "SortFlag", false, "Sort cells by energy before comparison"}
private

Definition at line 73 of file TileCellVerify.h.

73{this, "SortFlag", false, "Sort cells by energy before comparison"};

◆ m_tileID

const TileID* TileCellVerify::m_tileID {nullptr}
private

Definition at line 70 of file TileCellVerify.h.

70{nullptr};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.


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