ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
TRTCondWrite Class Reference

#include <TRTCondWrite.h>

Inheritance diagram for TRTCondWrite:
Collaboration diagram for TRTCondWrite:

Public Types

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

Public Member Functions

 TRTCondWrite (const std::string &name, ISvcLocator *pSvcLocator)
 constructor More...
 
 ~TRTCondWrite (void)
 destructor More...
 
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 More...
 
virtual StatusCode checkTextFile (const std::string &file, int &format)
 read calibration from text file into TDS More...
 
virtual StatusCode readTextFile (const std::string &file, int &format)
 
virtual StatusCode readTextFile_Format1 (std::istream &)
 
virtual EventIDRange IOVInfRange () const
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

bool m_setup
 true at first event More...
 
std::string m_par_caltextfile
 input text file More...
 
const TRT_IDm_trtid
 trt id helper More...
 
ServiceHandle< StoreGateSvcm_detstore
 
ServiceHandle< ICondSvc > m_condSvc
 
SG::WriteCondHandleKey< RtRelationContainerm_rtWriteKey {this,"RtWriteKeyName","/TRT/Calib/RT","r-t relation out-key"}
 
SG::WriteCondHandleKey< StrawT0Containerm_t0WriteKey {this,"T0WriteKeyName","/TRT/Calib/T0","t0 out-key"}
 
DataObjIDColl m_extendedExtraObjects
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

read calibration constants from text file and publish them in ConditionsStore

Definition at line 33 of file TRTCondWrite.h.

Member Typedef Documentation

◆ RtRelationContainer

Definition at line 35 of file TRTCondWrite.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ StrawT0Container

Definition at line 36 of file TRTCondWrite.h.

Constructor & Destructor Documentation

◆ TRTCondWrite()

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

constructor

Definition at line 24 of file TRTCondWrite.cxx.

25  :AthAlgorithm (name, pSvcLocator),
26  m_setup(false),
27  m_par_caltextfile(""), // input text file
28  m_trtid(0),
29  m_detstore("DetectorStore",name),
30  m_condSvc("CondSvc",name)
31 
32 {
33  // declare algorithm parameters
34  declareProperty("DetectorStore",m_detstore);
35  declareProperty("CalibInputFile",m_par_caltextfile);
36 }

◆ ~TRTCondWrite()

TRTCondWrite::~TRTCondWrite ( void  )

destructor

Definition at line 38 of file TRTCondWrite.cxx.

39 {}

Member Function Documentation

◆ checkTextFile()

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

read calibration from text file into TDS

Definition at line 132 of file TRTCondWrite.cxx.

133 {
134 
135  StatusCode sc=StatusCode::SUCCESS ;
136  std::ifstream infile(filename.c_str()) ;
137  if(!infile) {
138  sc=StatusCode::FAILURE;
139  } else {
140  // read the format tag. if none, default to 0
141  format = 0 ;
142  char line[512] ;
143  infile.getline(line,512) ;
144  std::string linestring(line) ;
145  size_t pos = linestring.find("Fileformat") ;
146  if(pos != std::string::npos) {
147  sscanf(line,"# Fileformat=%d",&format) ;
148  } else {
149  ATH_MSG_WARNING( "Input file has no Fileformat identifier. Assuming format=0.");
150  // 'rewind' the file
151 
152  infile.close() ;
153  infile.open(filename.c_str()) ;
154  }
155  }
156  infile.close() ;
157  return sc ;
158 }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode TRTCondWrite::execute ( void  )
overridevirtual

Definition at line 89 of file TRTCondWrite.cxx.

89  {
90 
91  StatusCode sc = StatusCode::SUCCESS;
92  //
93  // at first event:
94  if (!m_setup) {
95 
96 
97  // Read from text file?
98 
99  if( !m_par_caltextfile.empty()) {
100  std::ifstream infile(m_par_caltextfile.c_str()) ;
101  if(infile) {
102  ATH_MSG_INFO( " Read calibration constants from text file " << m_par_caltextfile);
103  int format =0;
104  if(StatusCode::SUCCESS!=readTextFile(m_par_caltextfile, format)) {
105  ATH_MSG_FATAL( "Could not read calibration objects from text file " << m_par_caltextfile);
106  return StatusCode::FAILURE ;
107  }
108  } else{
109  ATH_MSG_INFO( "Input file does not exist " );
110  }
111  infile.close();
112  } else {
113  ATH_MSG_INFO( "No input filename supplied " );
114  }
115 
116 
117 
118 
119  m_setup=true;
120 
121  }
122 
123  return sc;
124 }

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

◆ finalize()

StatusCode TRTCondWrite::finalize ( void  )
overridevirtual

Definition at line 126 of file TRTCondWrite.cxx.

126  {
127 
128  StatusCode sc = StatusCode::SUCCESS;
129 
130  return sc;
131 }

◆ initialize()

StatusCode TRTCondWrite::initialize ( void  )
overridevirtual

Definition at line 41 of file TRTCondWrite.cxx.

41  {
42 
43  ATH_MSG_DEBUG("TRTCondWrite::initialize() called");
44 
45  //
46  // Get ID helper
47  ATH_CHECK( detStore()->retrieve(m_trtid,"TRT_ID") );
48 
49  //
50  // Get condSvc
51  ATH_CHECK( m_condSvc.retrieve() );
52 
53 
54  // Format of input text file
55 
56  int format =0;
57  if( m_par_caltextfile != "" ) {
58  ATH_MSG_INFO( " input text file supplied " << m_par_caltextfile);
59  if(StatusCode::SUCCESS!=checkTextFile(m_par_caltextfile, format)) {
60  ATH_MSG_INFO( "Could not find or could not read text file" << m_par_caltextfile);
61  return StatusCode::SUCCESS;
62  }
63  ATH_MSG_INFO( " Found format " << format << " in text file " << m_par_caltextfile);
64  } else {
65  ATH_MSG_INFO( " No input text file supplied. Initialization done. ");
66  return StatusCode::SUCCESS;
67  }
68 
69 
70  // Write keys
71 
72 
73  // If an input text file is specified, initialize write keys. The corresponding folders must be blocked.
74 
75  if(m_par_caltextfile != "" && format>0) {
76 
77  ATH_CHECK( m_rtWriteKey.initialize() );
78  if(m_condSvc->regHandle(this,m_rtWriteKey).isFailure()) ATH_MSG_ERROR("unable to register WriteCondHandle " << m_rtWriteKey.fullKey());
79  ATH_MSG_INFO("Registered WriteCondHandle " << m_rtWriteKey.fullKey());
80  ATH_CHECK( m_t0WriteKey.initialize() );
81  if(m_condSvc->regHandle(this,m_t0WriteKey).isFailure()) ATH_MSG_ERROR("unable to register WriteCondHandle " << m_t0WriteKey.fullKey());
82  ATH_MSG_INFO("Registered WriteCondHandle " << m_t0WriteKey.fullKey());
83  }
84  ATH_MSG_INFO( " Initilization done with WriteKey Registraton ");
85 
86  return StatusCode::SUCCESS;
87 }

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

◆ IOVInfRange()

EventIDRange TRTCondWrite::IOVInfRange ( ) const
virtual

Definition at line 299 of file TRTCondWrite.cxx.

300 {
301  const EventIDBase start {1, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM, 0};
302  const EventIDBase stop {EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM-1};
303  return EventIDRange{start,stop};
304 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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 TRTCondWrite::readTextFile ( const std::string &  file,
int &  format 
)
virtual

Definition at line 160 of file TRTCondWrite.cxx.

161 {
162 
163  StatusCode sc=StatusCode::SUCCESS ;
164  std::ifstream infile(filename.c_str()) ;
165  if(!infile) {
166  ATH_MSG_ERROR( "Cannot find input file " << filename ) ;
167  } else {
168  // read the format tag. if none, default to 0
169  format = 0 ;
170  char line[512] ;
171  infile.getline(line,512) ;
172  std::string linestring(line) ;
173  size_t pos = linestring.find("Fileformat") ;
174  if(pos != std::string::npos) {
175  sscanf(line,"# Fileformat=%d",&format) ;
176  } else {
177  ATH_MSG_WARNING( "Input file has no Fileformat identifier. Assuming format=1");
178  // 'rewind' the file
179 
180  infile.close() ;
181  infile.open(filename.c_str()) ;
182  }
183  ATH_MSG_INFO( "Reading calibration data from text file " << filename << " format " << format ) ;
184  // force format 1 here
186  }
187  infile.close() ;
188  return sc ;
189 }

◆ readTextFile_Format1()

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

Definition at line 192 of file TRTCondWrite.cxx.

193 {
194 
195 
196  enum ReadMode { ReadingRtRelation, ReadingStrawT0, ReadingGarbage } ;
197  ReadMode readmode =ReadingGarbage ;
198 
199  // Make containers for access via ReadCondHandle for the reconstruction.
200  std::unique_ptr<RtRelationContainer> rtCdo{std::make_unique<RtRelationContainer>()};
201  std::unique_ptr<StrawT0Container> t0Cdo{std::make_unique<StrawT0Container>()};
202 
203  char line[512] ;
204  int nrtrelations(0), nstrawt0(0) ;
205  while( infile.getline(line,512) ) {
206  if(line[0] == '#') {
207  // line with tag
208  std::string linestring(line) ;
209  if(linestring.find("RtRelation") != std::string::npos) {
210  readmode = ReadingRtRelation ;
211  ATH_MSG_INFO(" Found line with Rt tag ");
212 
213  } else if (linestring.find("StrawT0") != std::string::npos) {
214  readmode = ReadingStrawT0 ;
215  ATH_MSG_INFO(" Found line with T0 tag ");
216 
217  }else readmode = ReadingGarbage ;
218  } else if( readmode != ReadingGarbage) {
219  std::istringstream is(line) ;
220  // read the id
222  is >> id ;
223  // read the semicolon that end the id
224  char dummy ;
225  is >> dummy ;
226 
227  // read the object
228  if( readmode == ReadingRtRelation ) {
229 
230 
232  rtCdo->set( id,rt);
233  delete rt ;
234  ++nrtrelations ;
235  } else if( readmode == ReadingStrawT0 ) {
236 
237  float t0(0), t0err(0) ;
238  is >> t0 >> t0err;
239  t0Cdo->setT0( id, t0, t0err);
240  ++nstrawt0 ;
241  }
242  }
243  }
244 
245  // Check that containers were filled
246 
247  size_t t0footprint = t0Cdo->footprint() ;
248  size_t rtfootprint = rtCdo->footprint() ;
249  //t0Cdo->crunch();
250 
251 
252  ATH_MSG_INFO( "read " << nstrawt0 << " t0 and " << nrtrelations << " rt from file. "
253  << " t0/rt footprints " << t0footprint << " / " << rtfootprint << " t0 footprint after crunch " << t0Cdo->footprint());
254 
255 
256 
257  //Record the containers for access via ReadCondHandle during reconstruction
258 
259  const EventIDRange rangeW= IOVInfRange();
261  if(rtWriteHandle.isValid()) {
262  ATH_MSG_DEBUG(" RtRelationContainer already available ");
263  return StatusCode::SUCCESS ;
264  }
265 
266  if(rtWriteHandle.record(rangeW,std::move(rtCdo)).isFailure()) {
267  ATH_MSG_ERROR("Could not record RT Container for key " << m_rtWriteKey.fullKey() << " with WriteHandle ");
268  return StatusCode::FAILURE;
269  } else {
270  ATH_MSG_INFO("Recorded RT Container for key " << m_rtWriteKey.fullKey() << " with range " << rtWriteHandle.getRange());
271  }
272 
273 
275  if(t0WriteHandle.isValid()) {
276  ATH_MSG_DEBUG(" StrawT0Container already available ");
277  return StatusCode::SUCCESS ;
278  }
279 
280  if(t0Cdo->initialize().isFailure()) ATH_MSG_WARNING("Could not initialize T0 Container for key " << m_t0WriteKey.fullKey());
281 
282  if(t0WriteHandle.record(rangeW,std::move(t0Cdo)).isFailure()) {
283  ATH_MSG_ERROR("Could not record T0 Container for key " << m_t0WriteKey.fullKey() << " with WriteHandle ");
284  return StatusCode::FAILURE;
285  } else {
286  ATH_MSG_INFO("Recorded T0 Container for key " << m_t0WriteKey.fullKey() << " with range " << t0WriteHandle.getRange());
287  }
288 
289 
290  return StatusCode::SUCCESS ;
291 }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
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, PyAthena::Alg, and AthHistogramAlgorithm.

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 }

◆ 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 TRTCondWrite::trtcondid ( const Identifier id,
int  level = TRTCond::ExpandedIdentifier::STRAW 
) const
virtual

create an TRTCond::ExpandedIdentifier from a TRTID identifier

Definition at line 293 of file TRTCondWrite.cxx.

294 {
297  m_trtid->straw(id),level ) ;
298 }

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_condSvc

ServiceHandle<ICondSvc> TRTCondWrite::m_condSvc
private

Definition at line 65 of file TRTCondWrite.h.

◆ m_detstore

ServiceHandle<StoreGateSvc> TRTCondWrite::m_detstore
private

Definition at line 64 of file TRTCondWrite.h.

◆ 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

std::string TRTCondWrite::m_par_caltextfile
private

input text file

Definition at line 62 of file TRTCondWrite.h.

◆ m_rtWriteKey

SG::WriteCondHandleKey<RtRelationContainer> TRTCondWrite::m_rtWriteKey {this,"RtWriteKeyName","/TRT/Calib/RT","r-t relation out-key"}
private

Definition at line 68 of file TRTCondWrite.h.

◆ m_setup

bool TRTCondWrite::m_setup
private

true at first event

Definition at line 61 of file TRTCondWrite.h.

◆ m_t0WriteKey

SG::WriteCondHandleKey<StrawT0Container> TRTCondWrite::m_t0WriteKey {this,"T0WriteKeyName","/TRT/Calib/T0","t0 out-key"}
private

Definition at line 69 of file TRTCondWrite.h.

◆ m_trtid

const TRT_ID* TRTCondWrite::m_trtid
private

trt id helper

Definition at line 63 of file TRTCondWrite.h.

◆ 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:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
checkFileSG.line
line
Definition: checkFileSG.py:75
TRTCondWrite::m_t0WriteKey
SG::WriteCondHandleKey< StrawT0Container > m_t0WriteKey
Definition: TRTCondWrite.h:69
run.infile
string infile
Definition: run.py:13
vtune_athena.format
format
Definition: vtune_athena.py:14
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TRTCondWrite::m_condSvc
ServiceHandle< ICondSvc > m_condSvc
Definition: TRTCondWrite.h:65
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
TRTCondWrite::m_rtWriteKey
SG::WriteCondHandleKey< RtRelationContainer > m_rtWriteKey
Definition: TRTCondWrite.h:68
TRTCondWrite::m_par_caltextfile
std::string m_par_caltextfile
input text file
Definition: TRTCondWrite.h:62
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TRTCondWrite::m_setup
bool m_setup
true at first event
Definition: TRTCondWrite.h:61
TRTCondWrite::readTextFile
virtual StatusCode readTextFile(const std::string &file, int &format)
Definition: TRTCondWrite.cxx:160
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
TRTCond::RtRelation
Definition: RtRelation.h:27
TRT_ID::straw
int straw(const Identifier &id) const
Definition: TRT_ID.h:902
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
TRTCond::RtRelationFactory::readFromFile
static RtRelation * readFromFile(std::istream &is)
read method
Definition: RtRelationFactory.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRTCondWrite::IOVInfRange
virtual EventIDRange IOVInfRange() const
Definition: TRTCondWrite.cxx:299
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:893
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
TRTCondWrite::m_trtid
const TRT_ID * m_trtid
trt id helper
Definition: TRTCondWrite.h:63
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
TRTCondWrite::readTextFile_Format1
virtual StatusCode readTextFile_Format1(std::istream &)
Definition: TRTCondWrite.cxx:192
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
TRTCond::ExpandedIdentifier
Identifier for TRT detector elements in the conditions code.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:30
TRTCondWrite::m_detstore
ServiceHandle< StoreGateSvc > m_detstore
Definition: TRTCondWrite.h:64
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
TRTCondWrite::checkTextFile
virtual StatusCode checkTextFile(const std::string &file, int &format)
read calibration from text file into TDS
Definition: TRTCondWrite.cxx:132
ServiceHandle< ICondSvc >