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

read calibration constants from text file and store them in a pool and cool file. More...

#include <TRTCondStoreText.h>

Inheritance diagram for TRTCondStoreText:
Collaboration diagram for TRTCondStoreText:

Public Types

typedef TRTCond::RtRelationMultChanContainer RtRelationContainer
typedef TRTCond::StrawT0MultChanContainer StrawT0Container

Public Member Functions

 TRTCondStoreText (const std::string &name, ISvcLocator *pSvcLocator)
 constructor
virtual ~TRTCondStoreText () override=default
virtual StatusCode initialize (void) override
virtual StatusCode execute (void) override
virtual StatusCode finalize (void) override
virtual TRTCond::ExpandedIdentifier trtcondid (const Identifier &id, int level=TRTCond::ExpandedIdentifier::STRAW) const
 create an TRTCond::ExpandedIdentifier from a TRTID identifier
virtual StatusCode checkTextFile (const std::string &file, int &format)
 read calibration from text file into TDS
virtual StatusCode readTextFile (const std::string &file, int &format)
virtual StatusCode readTextFile_Format1 (std::istream &)
virtual StatusCode readTextFile_Format2 (std::istream &)
virtual StatusCode readTextFile_Format3 (std::istream &)
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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

typedef ServiceHandle< StoreGateSvcStoreGateSvc_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

Gaudi::Property< std::string > m_par_errcontainerkey {this,"ErrorFolderName" ,"/TRT/Calib/errors2d",""}
Gaudi::Property< std::string > m_par_slopecontainerkey {this,"ErrorSlopeFolderName","/TRT/Calib/slopes",""}
Gaudi::Property< std::string > m_par_rtcontainerkey {this,"RtFolderName" ,"/TRT/Calib/RT",""}
Gaudi::Property< std::string > m_par_t0containerkey {this,"T0FolderName" ,"/TRT/Calib/T0",""}
Gaudi::Property< std::string > m_par_caltextfile {this,"CalibInputFile" ,"dbconst.txt",""}
Gaudi::Property< std::string > m_streamer {this,"StreamTool" ,"AthenaOutputStreamTool/CondStream1",""}
const TRT_IDm_trtid {}
 trt id helper
DataObjIDColl m_extendedExtraObjects
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

read calibration constants from text file and store them in a pool and cool file.

Definition at line 32 of file TRTCondStoreText.h.

Member Typedef Documentation

◆ RtRelationContainer

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ StrawT0Container

Constructor & Destructor Documentation

◆ TRTCondStoreText()

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

constructor

Definition at line 25 of file TRTCondStoreText.cxx.

25:AthAlgorithm (name, pSvcLocator){}
AthAlgorithm()
Default constructor:

◆ ~TRTCondStoreText()

virtual TRTCondStoreText::~TRTCondStoreText ( )
overridevirtualdefault

Member Function Documentation

◆ checkTextFile()

StatusCode TRTCondStoreText::checkTextFile ( const std::string & file,
int & format )
virtual

read calibration from text file into TDS

Definition at line 69 of file TRTCondStoreText.cxx.

70{
71
72 StatusCode sc=StatusCode::SUCCESS ;
73 std::ifstream infile(filename) ;
74 if(!infile) {
75 ATH_MSG_ERROR( "Cannot find input file " << filename ) ;
76 sc=StatusCode::FAILURE;
77 } else {
78 // read the format tag. if none, default to 0
79 format = 0 ;
80 char line[512] ;
81 infile.getline(line,512) ;
82 std::string linestring(line) ;
83 size_t pos = linestring.find("Fileformat") ;
84 if(pos != std::string::npos) {
85 sscanf(line,"# Fileformat=%d",&format) ;
86 } else {
87 ATH_MSG_WARNING( "Input file has no Fileformat identifier. Assuming format=0.");
88 // 'rewind' the file
89
90 infile.close() ;
91 infile.open(filename) ;
92 }
93 }
94 infile.close() ;
95 return sc ;
96}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.
str infile
Definition run.py:13

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< 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< 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< 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< 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 TRTCondStoreText::execute ( void )
overridevirtual

Definition at line 57 of file TRTCondStoreText.cxx.

57 {
58
59 StatusCode sc = StatusCode::SUCCESS;
60 return sc;
61}

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< 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 & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode TRTCondStoreText::finalize ( void )
overridevirtual

Definition at line 63 of file TRTCondStoreText.cxx.

63 {
64
65 StatusCode sc = StatusCode::SUCCESS;
66 return sc;
67}

◆ initialize()

StatusCode TRTCondStoreText::initialize ( void )
overridevirtual

Definition at line 27 of file TRTCondStoreText.cxx.

28{
29
30 // Get TRT ID helper
31 ATH_CHECK(detStore()->retrieve(m_trtid, "TRT_ID"));
32
33 // Format of input text file
34 int format = 0;
35 if (m_par_caltextfile != ""){
36 ATH_MSG_INFO(" input text file supplied " << m_par_caltextfile);
37 if (StatusCode::SUCCESS != checkTextFile(m_par_caltextfile, format)){
38 ATH_MSG_FATAL("Could not read format of text file" << m_par_caltextfile);
39 return StatusCode::FAILURE;
40 }
41 ATH_MSG_INFO(" Found format " << format << " in text file " << m_par_caltextfile);
42 }
43 else{
44 ATH_MSG_FATAL(" No input text file supplied. Nothing can be done. ");
45 return StatusCode::FAILURE;
46 }
47
48 ATH_MSG_INFO(" Read calibration constants from text file " << m_par_caltextfile);
49 if (StatusCode::SUCCESS != readTextFile(m_par_caltextfile, format)){
50 ATH_MSG_FATAL("Could not read calibration objects from text file " << m_par_caltextfile);
51 return StatusCode::FAILURE;
52 }
53
54 return StatusCode::SUCCESS;
55}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() const
virtual StatusCode readTextFile(const std::string &file, int &format)
Gaudi::Property< std::string > m_par_caltextfile
virtual StatusCode checkTextFile(const std::string &file, int &format)
read calibration from text file into TDS
const TRT_ID * m_trtid
trt id helper
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< 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.

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< 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< 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.

◆ readTextFile()

StatusCode TRTCondStoreText::readTextFile ( const std::string & file,
int & format )
virtual

Definition at line 98 of file TRTCondStoreText.cxx.

99{
100
101 StatusCode sc=StatusCode::SUCCESS ;
102 std::ifstream infile(filename) ;
103 if(!infile) {
104 ATH_MSG_ERROR( "Cannot find input file " << filename ) ;
105 } else {
106 // read the format tag. if none, default to 0
107 format = 0 ;
108 char line[512] ;
109 infile.getline(line,512) ;
110 std::string linestring(line) ;
111 size_t pos = linestring.find("Fileformat") ;
112 if(pos != std::string::npos) {
113 sscanf(line,"# Fileformat=%d",&format) ;
114 } else {
115 ATH_MSG_WARNING( "Input file has no Fileformat identifier. Assuming format=1");
116 // 'rewind' the file
117
118 infile.close() ;
119 infile.open(filename) ;
120 }
121 ATH_MSG_INFO( "Reading calibration data from text file " << filename << " format " << format ) ;
122 switch(format) {
123 case 1: sc=readTextFile_Format1(infile) ; break ;
124 case 2: sc=readTextFile_Format2(infile) ; break ;
125 case 3: sc=readTextFile_Format3(infile) ; break ;
126 default : sc=readTextFile_Format1(infile) ; break ;
127 }
128 }
129 infile.close() ;
130
131 return sc ;
132}
virtual StatusCode readTextFile_Format3(std::istream &)
virtual StatusCode readTextFile_Format2(std::istream &)
virtual StatusCode readTextFile_Format1(std::istream &)

◆ readTextFile_Format1()

StatusCode TRTCondStoreText::readTextFile_Format1 ( std::istream & infile)
virtual

Definition at line 135 of file TRTCondStoreText.cxx.

136{
137
138
139 enum ReadMode { ReadingRtRelation, ReadingStrawT0, ReadingGarbage } ;
140 ReadMode readmode =ReadingGarbage ;
141
142 // The OutputConditionAlg only works with old-style conditions access, so create raw pointers here.
143
144 StrawT0Container* t0Container = new TRTCond::StrawT0MultChanContainer() ;
145 RtRelationContainer* rtContainer = new TRTCond::RtRelationMultChanContainer() ;
146
147 char line[512] ;
148 int nrtrelations(0), nstrawt0(0) ;
149 while( infile.getline(line,512) ) {
150 if(line[0] == '#') {
151 // line with tag
152 std::string linestring(line) ;
153 if(linestring.find("RtRelation") != std::string::npos) {
154 readmode = ReadingRtRelation ;
155 ATH_MSG_INFO(" Found line with Rt tag ");
156
157 } else if (linestring.find("StrawT0") != std::string::npos) {
158 readmode = ReadingStrawT0 ;
159 ATH_MSG_INFO(" Found line with T0 tag ");
160
161 }else readmode = ReadingGarbage ;
162 } else if( readmode != ReadingGarbage) {
163 std::istringstream is(line) ;
164 // read the id
165 TRTCond::ExpandedIdentifier id ;
166 is >> id ;
167 // read the semicolon that end the id
168 char dummy ;
169 is >> dummy ;
170
171 // read the object
172 if( readmode == ReadingRtRelation ) {
173
174
175 TRTCond::RtRelation* rt = TRTCond::RtRelationFactory::readFromFile(is) ;
176 // coverity[tainted_data]
177 rtContainer->set( id,rt);
178 delete rt ;
179 ++nrtrelations ;
180 } else if( readmode == ReadingStrawT0 ) {
181
182 float t0(0), t0err(0) ;
183 is >> t0 >> t0err;
184
185 //skip straws with t0=0. The
186 if(t0==0) continue;
187 // coverity[tainted_data]
188 t0Container->setT0( id, t0, t0err );
189 //debug
190 //id.print();
191 //std::cout << " t0 " << t0 << " t0err " << t0err << std::endl;
192 ++nstrawt0 ;
193 }
194 }
195 }
196
197 // Check that containers were filled
198
199 size_t t0footprint = t0Container->footprint() ;
200 size_t rtfootprint = rtContainer->footprint() ;
201
202
203 ATH_MSG_INFO( "read " << nstrawt0 << " t0 and " << nrtrelations << " rt from file. "
204 << " t0/rt footprints " << t0footprint << " / " << rtfootprint ) ;
205
206
207 //Record the containers the old way for the OutputConditionsAlg
208
209 if(t0Container->initialize().isFailure()) ATH_MSG_WARNING("Could not initialize T0 Container for key " << m_par_t0containerkey);
210 ATH_MSG_INFO(" Recording T0 container ");
211 if( (detStore()->record(t0Container,m_par_t0containerkey))!=StatusCode::SUCCESS ) {
212 ATH_MSG_ERROR("Could not record T0 container for key " << m_par_t0containerkey << " with DetStore ");
213 return StatusCode::FAILURE;
214 } else {
215 if(StatusCode::SUCCESS!=detStore()->retrieve(t0Container,m_par_t0containerkey)) {
216 ATH_MSG_FATAL( "Could not retrieve data handle for StrawT0Container " );
217 return StatusCode::FAILURE ;
218 } else {
219 ATH_MSG_INFO("Successfully recorded T0 Container " << m_par_t0containerkey << " with DetStore ");
220 }
221 }
222
223
224 ATH_MSG_INFO(" Recording RT container ");
225 if( (detStore()->record(rtContainer,m_par_rtcontainerkey))!=StatusCode::SUCCESS ) {
226 ATH_MSG_ERROR("Could not record RT container for key " << m_par_rtcontainerkey << " with DetStore ");
227 return StatusCode::FAILURE;
228 } else {
229 if(StatusCode::SUCCESS!=detStore()->retrieve(rtContainer,m_par_rtcontainerkey)) {
230 ATH_MSG_FATAL( "Could not retrieve data handle for RtRelationContainer " );
231 return StatusCode::FAILURE ;
232 } else {
233 ATH_MSG_INFO("Successfully recorded RT Container " << m_par_rtcontainerkey << " with DetStore ");
234 }
235 }
236
237
238 return StatusCode::SUCCESS ;
239}
static Double_t t0
Gaudi::Property< std::string > m_par_rtcontainerkey
Gaudi::Property< std::string > m_par_t0containerkey
TRTCond::StrawT0MultChanContainer StrawT0Container
TRTCond::RtRelationMultChanContainer RtRelationContainer
static RtRelation * readFromFile(std::istream &is)
read method

◆ readTextFile_Format2()

StatusCode TRTCondStoreText::readTextFile_Format2 ( std::istream & infile)
virtual

Definition at line 241 of file TRTCondStoreText.cxx.

242{
243
244
245 enum ReadMode { ReadingRtRelation, ReadingErrors, ReadingStrawT0, ReadingGarbage } ;
246 ReadMode readmode =ReadingGarbage ;
247 char line[512] ;
248 int nrtrelations(0), nerrors(0), nstrawt0(0) ;
249
250 // The OutputConditionAlg only works with old-style access, so create a raw pointer.
251 StrawT0Container* t0Container = new TRTCond::StrawT0MultChanContainer() ;
252 RtRelationContainer* rtContainer = new TRTCond::RtRelationMultChanContainer() ;
253 RtRelationContainer* errContainer = new TRTCond::RtRelationMultChanContainer() ;
254
255
256 while( infile.getline(line,512) ) {
257 if(line[0] == '#') {
258 // line with tag
259 std::string linestring(line) ;
260 if( linestring.find("RtRelation") != std::string::npos) {
261 readmode = ReadingRtRelation ;
262 ATH_MSG_INFO(" Found line with Rt tag ");
263 rtContainer->clear() ;
264 } else if(linestring.find("StrawT0") != std::string::npos) {
265 readmode = ReadingStrawT0 ;
266 ATH_MSG_INFO(" Found line with T0 tag ");
267 t0Container->clear() ;
268 } else if(linestring.find("RtErrors") != std::string::npos) {
269 readmode = ReadingErrors ;
270 ATH_MSG_INFO(" Found line with Error tag ");
271 errContainer->clear() ;
272 } else { readmode = ReadingGarbage ; }
273 } else if( readmode != ReadingGarbage) {
274 std::istringstream is(line) ;
275 // read the id
276 TRTCond::ExpandedIdentifier id ;
277 is >> id ;
278 // read the semicolon that end the id
279 char dummy ;
280 is >> dummy ;
281 // read the object
282 if( readmode == ReadingRtRelation ) {
283
284 TRTCond::RtRelation* rt = TRTCond::RtRelationFactory::readFromFile(is) ;
285 // coverity[tainted_data]
286 rtContainer->set( id,rt);
287 delete rt ;
288 ++nrtrelations ;
289
290 } else if( readmode == ReadingErrors ) {
291
292 TRTCond::RtRelation* err = TRTCond::RtRelationFactory::readFromFile(is) ;
293 // coverity[tainted_data]
294 errContainer->set( id,err);
295 delete err ;
296 ++nerrors ;
297
298 } else if( readmode == ReadingStrawT0 ) {
299
300 float t0(0), t0err(0) ;
301 is >> t0 >> t0err ;
302 // coverity[tainted_data]
303 t0Container->setT0( id, t0, t0err );
304
305 ++nstrawt0 ;
306 }
307 }
308 }
309
310 size_t t0footprint = t0Container->footprint() ;
311 size_t rtfootprint = rtContainer->footprint() ;
312 size_t errfootprint = errContainer->footprint() ;
313
314 ATH_MSG_INFO( "read " << nstrawt0 << " t0 and " << nerrors << " errors and " << nrtrelations << " rt relations "
315 << " t0/rt/err footprints " << t0footprint << " / " << rtfootprint << " / " << errfootprint ) ;
316
317 //Record the containers the old way for the OutputConditionsAlg
318 if(t0Container->initialize().isFailure()) ATH_MSG_WARNING("Could not initialize T0 Container for key " << m_par_t0containerkey);
319 ATH_MSG_INFO(" Recording T0 container ");
320 if( (detStore()->record(t0Container,m_par_t0containerkey))!=StatusCode::SUCCESS ) {
321 ATH_MSG_ERROR("Could not record T0 container for key " << m_par_t0containerkey << " with DetStore ");
322 return StatusCode::FAILURE;
323 } else {
324 if(StatusCode::SUCCESS!=detStore()->retrieve(t0Container,m_par_t0containerkey)) {
325 ATH_MSG_FATAL( "Could not retrieve data handle for StrawT0Container " );
326 return StatusCode::FAILURE ;
327 } else {
328 ATH_MSG_INFO("Successfully recorded T0 Container " << m_par_t0containerkey << " with DetStore ");
329 }
330 }
331
332
333 ATH_MSG_INFO(" Recording RT container ");
334 if( (detStore()->record(rtContainer,m_par_rtcontainerkey))!=StatusCode::SUCCESS ) {
335 ATH_MSG_ERROR("Could not record RT container for key " << m_par_rtcontainerkey << " with DetStore ");
336 return StatusCode::FAILURE;
337 } else {
338 if(StatusCode::SUCCESS!=detStore()->retrieve(rtContainer,m_par_rtcontainerkey)) {
339 ATH_MSG_FATAL( "Could not retrieve data handle for RtRelationContainer " );
340 return StatusCode::FAILURE ;
341 } else {
342 ATH_MSG_INFO("Successfully recorded RT Container " << m_par_rtcontainerkey << " with DetStore ");
343 }
344 }
345
346 ATH_MSG_INFO(" Recording Error container ");
347 if( (detStore()->record(errContainer,m_par_errcontainerkey))!=StatusCode::SUCCESS ) {
348 ATH_MSG_ERROR("Could not record Error container for key " << m_par_errcontainerkey << " with DetStore ");
349 return StatusCode::FAILURE;
350 } else {
351 if(StatusCode::SUCCESS!=detStore()->retrieve(errContainer,m_par_errcontainerkey)) {
352 ATH_MSG_FATAL( "Could not retrieve data handle for RtRelationContainer " );
353 return StatusCode::FAILURE ;
354 } else {
355 ATH_MSG_INFO("Successfully recorded Error Container " << m_par_errcontainerkey << " with DetStore ");
356 }
357 }
358
359 return StatusCode::SUCCESS ;
360}
Gaudi::Property< std::string > m_par_errcontainerkey

◆ readTextFile_Format3()

StatusCode TRTCondStoreText::readTextFile_Format3 ( std::istream & infile)
virtual

Definition at line 363 of file TRTCondStoreText.cxx.

364{
365
366 // The OutputConditionAlg only works with old-style access, so create a raw pointer.
367 StrawT0Container* t0Container = new TRTCond::StrawT0MultChanContainer() ;
368 RtRelationContainer* rtContainer = new TRTCond::RtRelationMultChanContainer() ;
369 RtRelationContainer* errContainer = new TRTCond::RtRelationMultChanContainer() ;
370 RtRelationContainer* slopeContainer = new TRTCond::RtRelationMultChanContainer() ;
371
372
373 enum ReadMode { ReadingRtRelation, ReadingErrors, ReadingSlopes, ReadingStrawT0, ReadingGarbage } ;
374 ReadMode readmode =ReadingGarbage ;
375 char line[512] ;
376 int nrtrelations(0), nerrors(0), nslopes(0), nstrawt0(0) ;
377
378 while( infile.getline(line,512) ) {
379 if(line[0] == '#') {
380 // line with tag
381 std::string linestring(line) ;
382 if( linestring.find("RtRelation") != std::string::npos) {
383 readmode = ReadingRtRelation ;
384 rtContainer->clear() ;
385 ATH_MSG_INFO(" Found line with Rt tag ");
386 } else if(linestring.find("RtErrors") != std::string::npos) {
387 readmode = ReadingErrors ;
388 errContainer->clear() ;
389 ATH_MSG_INFO(" Found line with Error tag ");
390 } else if(linestring.find("RtSlopes") != std::string::npos) {
391 readmode = ReadingSlopes ;
392 slopeContainer->clear() ;
393 ATH_MSG_INFO(" Found line with Slope tag ");
394 } else if(linestring.find("StrawT0") != std::string::npos) {
395 readmode = ReadingStrawT0 ;
396 t0Container->clear() ;
397 ATH_MSG_INFO(" Found line with T0 tag ");
398 } else { readmode = ReadingGarbage ; }
399 } else if( readmode != ReadingGarbage) {
400 std::istringstream is(line) ;
401 // read the id
402 TRTCond::ExpandedIdentifier id ;
403 is >> id ;
404 // read the semicolon that end the id
405 char dummy ;
406 is >> dummy ;
407 // read the object
408 if( readmode == ReadingRtRelation ) {
409
410 TRTCond::RtRelation* rt = TRTCond::RtRelationFactory::readFromFile(is) ;
411 // coverity[tainted_data]
412 rtContainer->set( id,rt);
413 delete rt ;
414 ++nrtrelations ;
415
416 } else if( readmode == ReadingErrors ) {
417
418 TRTCond::RtRelation* err = TRTCond::RtRelationFactory::readFromFile(is) ;
419 // coverity[tainted_data]
420 errContainer->set( id,err);
421 delete err ;
422 ++nerrors ;
423
424 } else if( readmode == ReadingSlopes ) {
425
426 TRTCond::RtRelation* slope = TRTCond::RtRelationFactory::readFromFile(is) ;
427 // coverity[tainted_data]
428 slopeContainer->set( id,slope);
429 delete slope ;
430 ++nslopes ;
431
432 } else if( readmode == ReadingStrawT0 ) {
433
434 float t0(0), t0err(0) ;
435 is >> t0 >> t0err ;
436 // coverity[tainted_data]
437 t0Container->setT0( id, t0, t0err );
438 ++nstrawt0 ;
439 }
440 }
441 }
442
443 size_t t0footprint = t0Container->footprint() ;
444 size_t rtfootprint = rtContainer->footprint() ;
445 size_t errfootprint = errContainer->footprint() ;
446 size_t slopefootprint = slopeContainer->footprint() ;
447
448 ATH_MSG_INFO( "read " << nstrawt0 << " t0 and " << nerrors << " errors and " << nrtrelations << " rt relations and " << nslopes << " error slopes "
449 << " t0/rt/err/slope footprints " << t0footprint << " / " << rtfootprint << " / " << errfootprint << " / " << slopefootprint) ;
450
451
452 //Record the containers the old way for the OutputConditionsAlg
453 if(t0Container->initialize().isFailure()) ATH_MSG_WARNING("Could not initialize T0 Container for key " << m_par_t0containerkey);
454 ATH_MSG_INFO(" Recording T0 container ");
455 if( (detStore()->record(t0Container,m_par_t0containerkey))!=StatusCode::SUCCESS ) {
456 ATH_MSG_ERROR("Could not record T0 container for key " << m_par_t0containerkey << " with DetStore ");
457 return StatusCode::FAILURE;
458 } else {
459 if(StatusCode::SUCCESS!=detStore()->retrieve(t0Container,m_par_t0containerkey)) {
460 ATH_MSG_FATAL( "Could not retrieve data handle for StrawT0Container " );
461 return StatusCode::FAILURE ;
462 } else {
463 ATH_MSG_INFO("Successfully recorded T0 Container " << m_par_t0containerkey << " with DetStore ");
464 }
465 }
466
467
468 ATH_MSG_INFO(" Recording RT container ");
469 if( (detStore()->record(rtContainer,m_par_rtcontainerkey))!=StatusCode::SUCCESS ) {
470 ATH_MSG_ERROR("Could not record RT container for key " << m_par_rtcontainerkey << " with DetStore ");
471 return StatusCode::FAILURE;
472 } else {
473 if(StatusCode::SUCCESS!=detStore()->retrieve(rtContainer,m_par_rtcontainerkey)) {
474 ATH_MSG_FATAL( "Could not retrieve data handle for RtRelationContainer " );
475 return StatusCode::FAILURE ;
476 } else {
477 ATH_MSG_INFO("Successfully recorded RT Container " << m_par_rtcontainerkey << " with DetStore ");
478 }
479 }
480
481 ATH_MSG_INFO(" Recording Error container ");
482 if( (detStore()->record(errContainer,m_par_errcontainerkey))!=StatusCode::SUCCESS ) {
483 ATH_MSG_ERROR("Could not record Error container for key " << m_par_errcontainerkey << " with DetStore ");
484 return StatusCode::FAILURE;
485 } else {
486 if(StatusCode::SUCCESS!=detStore()->retrieve(errContainer,m_par_errcontainerkey)) {
487 ATH_MSG_FATAL( "Could not retrieve data handle for RtRelationContainer " );
488 return StatusCode::FAILURE ;
489 } else {
490 ATH_MSG_INFO("Successfully recorded Error Container " << m_par_errcontainerkey << " with DetStore ");
491 }
492 }
493
494 ATH_MSG_INFO(" Recording Slope container ");
495 if( (detStore()->record(slopeContainer,m_par_slopecontainerkey))!=StatusCode::SUCCESS ) {
496 ATH_MSG_ERROR("Could not record Slope container for key " << m_par_slopecontainerkey << " with DetStore ");
497 return StatusCode::FAILURE;
498 } else {
499 if(StatusCode::SUCCESS!=detStore()->retrieve(slopeContainer,m_par_slopecontainerkey)) {
500 ATH_MSG_FATAL( "Could not retrieve data handle for RtRelationContainer " );
501 return StatusCode::FAILURE ;
502 } else {
503 ATH_MSG_INFO("Successfully recorded Slope Container " << m_par_slopecontainerkey << " with DetStore ");
504 }
505 }
506
507
508 return StatusCode::SUCCESS ;
509}
Gaudi::Property< std::string > m_par_slopecontainerkey

◆ 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< 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< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::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< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< 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.

◆ trtcondid()

TRTCond::ExpandedIdentifier TRTCondStoreText::trtcondid ( const Identifier & id,
int level = TRTCond::ExpandedIdentifier::STRAW ) const
virtual

create an TRTCond::ExpandedIdentifier from a TRTID identifier

Definition at line 512 of file TRTCondStoreText.cxx.

513{
514 return TRTCond::ExpandedIdentifier( m_trtid->barrel_ec(id),m_trtid->layer_or_wheel(id),
515 m_trtid->phi_module(id),m_trtid->straw_layer(id),
516 m_trtid->straw(id),level ) ;
517}

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< 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 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< 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< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_par_caltextfile

Gaudi::Property<std::string> TRTCondStoreText::m_par_caltextfile {this,"CalibInputFile" ,"dbconst.txt",""}
private

Definition at line 64 of file TRTCondStoreText.h.

64{this,"CalibInputFile" ,"dbconst.txt",""};

◆ m_par_errcontainerkey

Gaudi::Property<std::string> TRTCondStoreText::m_par_errcontainerkey {this,"ErrorFolderName" ,"/TRT/Calib/errors2d",""}
private

Definition at line 60 of file TRTCondStoreText.h.

60{this,"ErrorFolderName" ,"/TRT/Calib/errors2d",""};

◆ m_par_rtcontainerkey

Gaudi::Property<std::string> TRTCondStoreText::m_par_rtcontainerkey {this,"RtFolderName" ,"/TRT/Calib/RT",""}
private

Definition at line 62 of file TRTCondStoreText.h.

62{this,"RtFolderName" ,"/TRT/Calib/RT",""};

◆ m_par_slopecontainerkey

Gaudi::Property<std::string> TRTCondStoreText::m_par_slopecontainerkey {this,"ErrorSlopeFolderName","/TRT/Calib/slopes",""}
private

Definition at line 61 of file TRTCondStoreText.h.

61{this,"ErrorSlopeFolderName","/TRT/Calib/slopes",""};

◆ m_par_t0containerkey

Gaudi::Property<std::string> TRTCondStoreText::m_par_t0containerkey {this,"T0FolderName" ,"/TRT/Calib/T0",""}
private

Definition at line 63 of file TRTCondStoreText.h.

63{this,"T0FolderName" ,"/TRT/Calib/T0",""};

◆ m_streamer

Gaudi::Property<std::string> TRTCondStoreText::m_streamer {this,"StreamTool" ,"AthenaOutputStreamTool/CondStream1",""}
private

Definition at line 65 of file TRTCondStoreText.h.

65{this,"StreamTool" ,"AthenaOutputStreamTool/CondStream1",""};

◆ m_trtid

const TRT_ID* TRTCondStoreText::m_trtid {}
private

trt id helper

Definition at line 67 of file TRTCondStoreText.h.

67{};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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