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

#include <NswCondTestAlg.h>

Inheritance diagram for NswCondTestAlg:
Collaboration diagram for NswCondTestAlg:

Public Member Functions

 NswCondTestAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~NswCondTestAlg () override
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &) const override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
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
virtual void setFilterPassed (bool state, const EventContext &ctx) const
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

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

using TimeChargeType = NswCalibDbTimeChargeData::CalibDataType
using TimeTech = MuonCond::CalibTechType
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode retrieveTdoPdo (const EventContext &ctx, TimeChargeType data, const std::string &tech, const std::string &side, std::chrono::duration< double > &timer) const
StatusCode retrieveVmm (const EventContext &, const std::string &, const std::string &, std::chrono::duration< double > &) const
StatusCode retrieveT0 (const EventContext &, std::chrono::duration< double > &) const
std::string timestamp () const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< NswCalibDbTimeChargeDatam_readKey_tdopdo
SG::ReadCondHandleKey< NswCalibDbThresholdDatam_readKey_vmm
SG::ReadCondHandleKey< NswT0Datam_readKey_t0 {this, "readKey_t0", "NswT0Data", "Key of NswT0Data containing the t0 calibration data"}
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
Gaudi::Property< std::string > m_logName {this,"LogName", "LogFile", "Name of the log file. The file creating the TimeCharge log will be called <LogName>_TDO.txt, the other will be <LogName>_vmm.txt"}
Gaudi::Property< bool > m_isMC {this, "isMC", false, "flagging the input type"}
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 25 of file NswCondTestAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ TimeChargeType

◆ TimeTech

Definition at line 35 of file NswCondTestAlg.h.

Constructor & Destructor Documentation

◆ NswCondTestAlg()

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

Definition at line 26 of file NswCondTestAlg.cxx.

26: AthReentrantAlgorithm(name, pSvcLocator) {}

◆ ~NswCondTestAlg()

NswCondTestAlg::~NswCondTestAlg ( )
overridevirtualdefault

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ 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 NswCondTestAlg::execute ( const EventContext & ctx) const
overridevirtual

Definition at line 42 of file NswCondTestAlg.cxx.

42 {
43 ATH_MSG_INFO("Calling execute");
44
45 // setup parameters
46 std::chrono::duration<double> retrieving_MM_TDO_A{};
47 std::chrono::duration<double> retrieving_MM_TDO_C{};
48 std::chrono::duration<double> retrieving_MM_PDO_A{};
49 std::chrono::duration<double> retrieving_MM_PDO_C{};
50 std::chrono::duration<double> retrieving_MM_VMM_A{};
51 std::chrono::duration<double> retrieving_MM_VMM_C{};
52 std::chrono::duration<double> retrieving_STGC_TDO_A{};
53 std::chrono::duration<double> retrieving_STGC_TDO_C{};
54 std::chrono::duration<double> retrieving_STGC_PDO_A{};
55 std::chrono::duration<double> retrieving_STGC_PDO_C{};
56 std::chrono::duration<double> retrieving_STGC_VMM_A{};
57 std::chrono::duration<double> retrieving_STGC_VMM_C{};
58 std::chrono::duration<double> retrieving_T0{};
59
60 // retrieve all folders
61 ATH_CHECK(retrieveTdoPdo(ctx, TimeChargeType::PDO, "MM", "A", retrieving_MM_PDO_A));
62 ATH_CHECK(retrieveTdoPdo(ctx, TimeChargeType::PDO, "MM", "C", retrieving_MM_PDO_C));
63 ATH_CHECK(retrieveTdoPdo(ctx, TimeChargeType::TDO, "MM", "A", retrieving_MM_TDO_A));
64 ATH_CHECK(retrieveTdoPdo(ctx, TimeChargeType::TDO, "MM", "C", retrieving_MM_TDO_C));
65 if(m_isMC) ATH_CHECK(retrieveVmm(ctx, "MM", "A", retrieving_MM_VMM_A));
66 if(m_isMC) ATH_CHECK(retrieveVmm(ctx, "MM", "C", retrieving_MM_VMM_C));
67 ATH_CHECK(retrieveTdoPdo(ctx, TimeChargeType::TDO, "STGC", "A", retrieving_STGC_TDO_A));
68 ATH_CHECK(retrieveTdoPdo(ctx, TimeChargeType::TDO, "STGC", "C", retrieving_STGC_TDO_C));
69 ATH_CHECK(retrieveTdoPdo(ctx, TimeChargeType::PDO, "STGC", "A", retrieving_STGC_PDO_A));
70 ATH_CHECK(retrieveTdoPdo(ctx, TimeChargeType::PDO, "STGC", "C", retrieving_STGC_PDO_C));
71 if(m_isMC) ATH_CHECK(retrieveVmm(ctx, "STGC", "A", retrieving_STGC_VMM_A));
72 if(m_isMC) ATH_CHECK(retrieveVmm(ctx, "STGC", "C", retrieving_STGC_VMM_C));
73 if(!m_isMC) ATH_CHECK(retrieveT0(ctx,retrieving_T0));
74
75 // postprocess
76 ATH_MSG_INFO("Retrieving time for (MM , TDO, Side A) = "
77 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_TDO_A).count() * 1.0) << "s ");
78 ATH_MSG_INFO("Retrieving time for (MM , TDO, Side C) = "
79 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_TDO_C).count() * 1.0) << "s ");
80 ATH_MSG_INFO("Retrieving time for (MM , PDO, Side A) = "
81 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_PDO_A).count() * 1.0) << "s ");
82 ATH_MSG_INFO("Retrieving time for (MM , PDO, Side C) = "
83 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_PDO_C).count() * 1.0) << "s ");
84 if(m_isMC){
85 ATH_MSG_INFO("Retrieving time for (MM , VMM, Side A) = "
86 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_VMM_A).count() * 1.0) << "s ");
87 ATH_MSG_INFO("Retrieving time for (MM , VMM, Side C) = "
88 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_MM_VMM_C).count() * 1.0) << "s ");
89 }
90
91 ATH_MSG_INFO("Retrieving time for (STGC, TDO, Side A) = "
92 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_TDO_A).count() * 1.0) << "s ");
93 ATH_MSG_INFO("Retrieving time for (STGC, TDO, Side C) = "
94 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_TDO_C).count() * 1.0) << "s ");
95 ATH_MSG_INFO("Retrieving time for (STGC, PDO, Side A) = "
96 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_PDO_A).count() * 1.0) << "s ");
97 ATH_MSG_INFO("Retrieving time for (STGC, PDO, Side C) = "
98 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_PDO_C).count() * 1.0) << "s ");
99 if(m_isMC) {
100 ATH_MSG_INFO("Retrieving time for (STGC, VMM, Side A) = "
101 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_VMM_A).count() * 1.0) << "s ");
102 ATH_MSG_INFO("Retrieving time for (STGC, VMM, Side C) = "
103 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_STGC_VMM_C).count() * 1.0) << "s ");
104 }
105
106 if(!m_isMC){
107 ATH_MSG_INFO("retrieving time for T0 for NSW = "
108 << (std::chrono::duration_cast<std::chrono::microseconds>(retrieving_T0).count() * 1.0) << "s ");
109 }
110
111 ATH_MSG_INFO("MADE IT TO THE END!!");
112 return StatusCode::SUCCESS;
113}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
StatusCode retrieveT0(const EventContext &, std::chrono::duration< double > &) const
Gaudi::Property< bool > m_isMC
StatusCode retrieveVmm(const EventContext &, const std::string &, const std::string &, std::chrono::duration< double > &) const
StatusCode retrieveTdoPdo(const EventContext &ctx, TimeChargeType data, const std::string &tech, const std::string &side, std::chrono::duration< double > &timer) const
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

◆ 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 & AthCommonReentrantAlgorithm< 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 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

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

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ initialize()

StatusCode NswCondTestAlg::initialize ( )
overridevirtual

Definition at line 32 of file NswCondTestAlg.cxx.

32 {
33 ATH_MSG_INFO("Calling initialize");
34 ATH_CHECK(m_readKey_tdopdo.initialize());
35 ATH_CHECK(m_readKey_vmm.initialize(m_isMC));
36 ATH_CHECK(m_readKey_t0.initialize(!m_isMC));
37 ATH_CHECK(m_idHelperSvc.retrieve());
38 return StatusCode::SUCCESS;
39}
SG::ReadCondHandleKey< NswCalibDbThresholdData > m_readKey_vmm
SG::ReadCondHandleKey< NswT0Data > m_readKey_t0
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::ReadCondHandleKey< NswCalibDbTimeChargeData > m_readKey_tdopdo

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

◆ 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 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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 364 of file AthCommonDataStore.h.

364 {
366 }

◆ retrieveT0()

StatusCode NswCondTestAlg::retrieveT0 ( const EventContext & ctx,
std::chrono::duration< double > & timer ) const
private

Definition at line 231 of file NswCondTestAlg.cxx.

232 {
233 ATH_MSG_INFO("Starting to retrieve T0 values at " << timestamp());
234 auto start1 = std::chrono::high_resolution_clock::now();
235
236 // Start with an infinte range and narrow it down as needed
237 EventIDRange rangeW = IOVInfiniteRange::infiniteMixed();
238
239 // Retrieve Data Object
240 SG::ReadCondHandle<NswT0Data> readHandle{m_readKey_t0,ctx};
241 const NswT0Data* readCdo{*readHandle};
242 if (!readCdo) {
243 ATH_MSG_ERROR("Null pointer to the read conditions object");
244 return StatusCode::FAILURE;
245 }
246
247 EventIDRange range;
248 if (!readHandle.range(range)) {
249 ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
250 return StatusCode::FAILURE;
251 }
252
253 // Intersect validity range of this obj with the validity of already-loaded objs
254 rangeW = EventIDRange::intersect(range, rangeW);
255
256 std::stringstream sstr {};
257 const MmIdHelper& id_helper = m_idHelperSvc->mmIdHelper();
258 auto it = id_helper.detectorElement_begin();
259 for(; it!= id_helper.detectorElement_end(); it++){
260 for(int i_layer=id_helper.gasGapMin(*it); i_layer <= id_helper.gasGapMax(*it); i_layer++){
261 Identifier layerId = id_helper.channelID(*it,id_helper.multilayer(*it), i_layer,1);
262 for(int i_channel=id_helper.channelMin(layerId); i_channel < id_helper.channelMax(layerId); i_channel++){
263 Identifier channelId = id_helper.channelID(layerId,id_helper.multilayer(*it), i_layer, i_channel);
264 float t0{0};
265 if(!readCdo->getT0(channelId, t0)){
266 ATH_MSG_ERROR("Failed to retrieve t0 calibration for channel"<< m_idHelperSvc->toString(channelId));
267 return StatusCode::FAILURE;
268 }
269 if (!m_logName.empty()){
270 sstr<<m_idHelperSvc->toString(channelId)<<" T0 "<< t0 <<std::endl;
271 }
272 }
273 }
274 }
275
276 if (!m_logName.empty()){
277 std::ofstream ostr{m_logName+"_T0.txt"};
278 ostr<<sstr.str()<<std::endl;
279 }
280
281 auto end1 = std::chrono::high_resolution_clock::now();
282 timer += end1 - start1;
283 ATH_MSG_INFO("Ending at " << timestamp());
284 return StatusCode::SUCCESS;
285}
#define ATH_MSG_ERROR(x)
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
static int gasGapMax()
static int channelMin()
static int channelMax()
static int gasGapMin()
int multilayer(const Identifier &id) const
const_id_iterator detectorElement_begin() const
Iterators over full set of ids.
const_id_iterator detectorElement_end() const
std::string timestamp() const
Gaudi::Property< std::string > m_logName
bool getT0(const Identifier &channelId, float &channelT0) const
Definition NswT0Data.cxx:58
bool range(EventIDRange &r)
const std::string & key() const
std::vector< ALFA_RawData_p1 > t0
timer(name, disabled=False)

◆ retrieveTdoPdo()

StatusCode NswCondTestAlg::retrieveTdoPdo ( const EventContext & ctx,
TimeChargeType data,
const std::string & tech,
const std::string & side,
std::chrono::duration< double > & timer ) const
private

Definition at line 116 of file NswCondTestAlg.cxx.

117 {
118 ATH_MSG_INFO("Starting with " << " data for " << tech << " and " << side << " at " << timestamp());
119 auto start1 = std::chrono::high_resolution_clock::now();
120
121 // Start with an infinte range and narrow it down as needed
122 EventIDRange rangeW = IOVInfiniteRange::infiniteMixed();
123
124 // Retrieve Data Object
125 SG::ReadCondHandle<NswCalibDbTimeChargeData> readHandle{m_readKey_tdopdo, ctx};
126 const NswCalibDbTimeChargeData* readCdo{*readHandle};
127 if (!readCdo) {
128 ATH_MSG_ERROR("Null pointer to the read conditions object");
129 return StatusCode::FAILURE;
130 }
131
132 EventIDRange range;
133 if (!readHandle.range(range)) {
134 ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
135 return StatusCode::FAILURE;
136 }
137
138 // Intersect validity range of this obj with the validity of already-loaded objs
139 rangeW = EventIDRange::intersect(range, rangeW);
140
141 // retrieve all channels
142 std::vector<Identifier> channelIds = readCdo->getChannelIds(data, tech, side);
143 ATH_MSG_INFO("Found data for " << channelIds.size() << " channels!");
144
145 // retrieve data for the first channel
146 std::stringstream sstr{};
147 if (!channelIds.empty()) {
148 const Identifier& channel = channelIds[0];
149
150 const NswCalibDbTimeChargeData::CalibConstants& calib_data = *readCdo->getCalibForChannel(data, channel);
151 ATH_MSG_INFO("Checking channel 0 (Id = " << channel.get_compact() << ") "<<calib_data);
152 if (!m_logName.empty()){
153 for (const Identifier& chan_id : channelIds) {
154 const NswCalibDbTimeChargeData::CalibConstants& calib_data = *readCdo->getCalibForChannel(data, chan_id);
155 sstr<<m_idHelperSvc->toString(chan_id)<<" "<<calib_data<<std::endl;
156 }
157 }
158 } else if (!m_logName.empty()) {
159 const NswCalibDbTimeChargeData::CalibConstants& calib_data = *readCdo->getZeroCalibChannel(data, tech == "MM" ? TimeTech::MM : TimeTech::STGC);
160 sstr<<"Dummy calib channel "<<calib_data<<std::endl;
161 }
162
163 if (!m_logName.empty()){
164 std::ofstream ostr{m_logName+"_"+ (data == TimeChargeType::TDO ? "TDO" : "PDO") + "_"+tech+side+".txt"};
165 ostr<<sstr.str()<<std::endl;
166 }
167
168 ATH_MSG_ALWAYS(sstr.str());
169
170 auto end1 = std::chrono::high_resolution_clock::now();
171 timer += end1 - start1;
172 ATH_MSG_INFO("Ending at " << timestamp());
173 return StatusCode::SUCCESS;
174}
#define ATH_MSG_ALWAYS(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
const CalibConstants * getCalibForChannel(const CalibDataType type, const Identifier &channelId) const
Retrieves the calibration constant for a particular readout channel.
const CalibConstants * getZeroCalibChannel(const CalibDataType type, const MuonCond::CalibTechType tech) const
Returns the dummy calibration constant for the given technology type.
std::vector< Identifier > getChannelIds(const CalibDataType type, const std::string &tech, const std::string &side) const

◆ retrieveVmm()

StatusCode NswCondTestAlg::retrieveVmm ( const EventContext & ctx,
const std::string & tech,
const std::string & side,
std::chrono::duration< double > & timer ) const
private

Definition at line 177 of file NswCondTestAlg.cxx.

178 {
179 ATH_MSG_INFO("Starting with VMM data for " << tech << " and " << side << " at " << timestamp());
180 auto start1 = std::chrono::high_resolution_clock::now();
181
182 // Start with an infinte range and narrow it down as needed
183 EventIDRange rangeW = IOVInfiniteRange::infiniteMixed();
184
185 // Retrieve Data Object
186 SG::ReadCondHandle<NswCalibDbThresholdData> readHandle{m_readKey_vmm, ctx};
187 const NswCalibDbThresholdData* readCdo{*readHandle};
188 if (!readCdo) {
189 ATH_MSG_ERROR("Null pointer to the read conditions object");
190 return StatusCode::FAILURE;
191 }
192
193 EventIDRange range;
194 if (!readHandle.range(range)) {
195 ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key());
196 return StatusCode::FAILURE;
197 }
198
199 // Intersect validity range of this obj with the validity of already-loaded objs
200 rangeW = EventIDRange::intersect(range, rangeW);
201
202 // retrieve all channels
203 std::vector<Identifier> channelIds = readCdo->getChannelIds(tech, side);
204 ATH_MSG_INFO("Found data for " << channelIds.size() << " channels!");
205
206 // retrieve data for the first channel
207 std::stringstream sstr {};
208 if (!channelIds.empty()) {
209 const Identifier& channel = channelIds[0];
210 float threshold{0.};
211 readCdo->getThreshold(channel, threshold);
212 ATH_MSG_INFO("Checking channel 0 (Id = " << m_idHelperSvc->toString(channel)<< ") threshold "<< threshold);
213 if (!m_logName.empty()){
214 for (const Identifier& id : channelIds){
215 sstr<<m_idHelperSvc->toString(id)<<" threshold "<<threshold<<std::endl;
216 }
217 }
218 }
219 if (!m_logName.empty()){
220 std::ofstream ostr{m_logName+"_THRESH_"+tech+side+".txt"};
221 ostr<<sstr.str()<<std::endl;
222 }
223
224 auto end1 = std::chrono::high_resolution_clock::now();
225 timer += end1 - start1;
226 ATH_MSG_INFO("Ending at " << timestamp());
227 return StatusCode::SUCCESS;
228}
std::vector< Identifier > getChannelIds(const std::string="", const std::string="") const
bool getThreshold(const Identifier &, float &) const

◆ setFilterPassed()

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

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< 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.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< 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 HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
#define ATH_MSG_WARNING(x)
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.

◆ timestamp()

std::string NswCondTestAlg::timestamp ( ) const
private

Definition at line 287 of file NswCondTestAlg.cxx.

287 {
288 auto now = std::chrono::system_clock::now();
289 std::time_t time_now = std::chrono::system_clock::to_time_t(now);
290 std::tm local_tm;
291 localtime_r(&time_now, &local_tm);
292 auto duration_since_epoch = now.time_since_epoch();
293 auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(duration_since_epoch) % 1000;
294 std::ostringstream oss;
295 oss << std::put_time(&local_tm, "%H:%M:%S") << '.' << std::setw(3) << std::setfill('0') << milliseconds.count();
296 return oss.str();
297}

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

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

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

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> NswCondTestAlg::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 51 of file NswCondTestAlg.h.

51{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_isMC

Gaudi::Property<bool> NswCondTestAlg::m_isMC {this, "isMC", false, "flagging the input type"}
private

Definition at line 54 of file NswCondTestAlg.h.

54{this, "isMC", false, "flagging the input type"};

◆ m_logName

Gaudi::Property<std::string> NswCondTestAlg::m_logName {this,"LogName", "LogFile", "Name of the log file. The file creating the TimeCharge log will be called <LogName>_TDO.txt, the other will be <LogName>_vmm.txt"}
private

Definition at line 53 of file NswCondTestAlg.h.

53{this,"LogName", "LogFile", "Name of the log file. The file creating the TimeCharge log will be called <LogName>_TDO.txt, the other will be <LogName>_vmm.txt"};

◆ m_readKey_t0

SG::ReadCondHandleKey<NswT0Data> NswCondTestAlg::m_readKey_t0 {this, "readKey_t0", "NswT0Data", "Key of NswT0Data containing the t0 calibration data"}
private

Definition at line 49 of file NswCondTestAlg.h.

49{this, "readKey_t0", "NswT0Data", "Key of NswT0Data containing the t0 calibration data"};

◆ m_readKey_tdopdo

SG::ReadCondHandleKey<NswCalibDbTimeChargeData> NswCondTestAlg::m_readKey_tdopdo
private
Initial value:
{
this, "ReadKey_tdopdo", "NswCalibDbTimeChargeData",
"Key of NswCalibDbTimeChargeData object containing calibration data (TDOs and PDOs)"}

Definition at line 43 of file NswCondTestAlg.h.

43 {
44 this, "ReadKey_tdopdo", "NswCalibDbTimeChargeData",
45 "Key of NswCalibDbTimeChargeData object containing calibration data (TDOs and PDOs)"};

◆ m_readKey_vmm

SG::ReadCondHandleKey<NswCalibDbThresholdData> NswCondTestAlg::m_readKey_vmm
private
Initial value:
{
this, "ReadKey_vmm", "NswCalibDbThresholdData",
"Key of NswCalibDbThresholdData object containing calibration data (VMM thresholds)"}

Definition at line 46 of file NswCondTestAlg.h.

46 {
47 this, "ReadKey_vmm", "NswCalibDbThresholdData",
48 "Key of NswCalibDbThresholdData object containing calibration data (VMM thresholds)"};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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