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

#include <LArFlatFromFile.h>

Inheritance diagram for LArFlatFromFile:
Collaboration diagram for LArFlatFromFile:

Public Member Functions

 LArFlatFromFile (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters: More...
 
virtual ~LArFlatFromFile ()=default
 Destructor: More...
 
virtual StatusCode initialize () override
 
virtual StatusCode execute () override
 
virtual StatusCode finalize () override
 
virtual StatusCode stop () override
 
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, V, H > &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

 LArFlatFromFile ()
 Default constructor: More...
 
void singleFloatFlat (const char *blobName, const std::string &input, const std::string &outputName, const unsigned nGain)
 
void ofcFlat (const std::string &input, const std::string &outputName)
 
void errIfConnected (const HWIdentifier chid, const int gain, const std::string &objName, const std::string &message="") const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

unsigned m_hashMax {}
 
const LArOnlineIDm_onlineID {}
 
const LArOnline_SuperCellIDm_onlineSCID {}
 
SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
 
Gaudi::Property< std::string > m_OFCInput {this, "OFCInput","","Input file name"}
 Input files. More...
 
Gaudi::Property< std::string > m_SingleInput {this, "SingleInput","","Input file name"}
 
Gaudi::Property< bool > m_isSC {this,"SuperCells",false,"Run for SC ?"}
 
Gaudi::Property< unsigned > m_ngain {this,"NGains",1,"Number of gains to process"}
 
Gaudi::Property< unsigned > m_nsample {this,"NSamples",4,"Number of samples to process"}
 
Gaudi::Property< std::string > m_Folder {this, "Folder","","Folder to create"}
 
Gaudi::Property< std::string > m_BlobName {this, "Blob","","Blob name"}
 
Gaudi::Property< bool > m_checkCompletness {this, "checkInput", true, "Check if input file is complete"}
 
bool m_forceStop {}
 
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

Definition at line 17 of file LArFlatFromFile.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LArFlatFromFile() [1/2]

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

Constructor with parameters:

Definition at line 16 of file LArFlatFromFile.cxx.

17  :
18  ::AthAlgorithm( name, pSvcLocator ),
19  m_hashMax(0),
20  m_onlineID(nullptr), m_onlineSCID(nullptr)
21 {
22 
23 }

◆ ~LArFlatFromFile()

virtual LArFlatFromFile::~LArFlatFromFile ( )
virtualdefault

Destructor:

◆ LArFlatFromFile() [2/2]

LArFlatFromFile::LArFlatFromFile ( )
private

Default constructor:

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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; }

◆ errIfConnected()

void LArFlatFromFile::errIfConnected ( const HWIdentifier  chid,
const int  gain,
const std::string &  objName,
const std::string &  message = "" 
) const
private

Definition at line 287 of file LArFlatFromFile.cxx.

287  {
288 
290  const LArOnOffIdMapping* cabling{*cablingHdl};
291  if(!cabling) {
292  ATH_MSG_ERROR( "Do not have cabling mapping from key " << m_cablingKey.key() );
293  return;
294  }
295 
296  if (cabling->isOnlineConnected(chid)) {
297  if (! (gain==2 && m_onlineID->isEMBPS(chid))) { //No LG Presampler calibration
298  ATH_MSG_ERROR( "No valid " << objName << " found for channel " << m_onlineID->channel_name(chid) << ", gain " << gain << ". ");
299  if (!message.empty()) ATH_MSG_ERROR( message );
300  ATH_MSG_ERROR( " Filling with default value." );
301  }
302  }
303  return;
304 }

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

virtual StatusCode LArFlatFromFile::execute ( )
inlineoverridevirtual

Definition at line 32 of file LArFlatFromFile.h.

32 {return StatusCode::SUCCESS;}

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

virtual StatusCode LArFlatFromFile::finalize ( )
inlineoverridevirtual

Definition at line 33 of file LArFlatFromFile.h.

33 {return StatusCode::SUCCESS;}

◆ initialize()

StatusCode LArFlatFromFile::initialize ( )
overridevirtual

Definition at line 25 of file LArFlatFromFile.cxx.

26 {
28  return StatusCode::SUCCESS;
29 }

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

◆ ofcFlat()

void LArFlatFromFile::ofcFlat ( const std::string &  input,
const std::string &  outputName 
)
private

Definition at line 104 of file LArFlatFromFile.cxx.

104  {
105 
106  ATH_MSG_INFO("LArFlatFromFile::ofcFlat, starting");
107  // parsing the file, fill OFC arrays
108  std::vector<std::vector<std::vector<float> > > vofc_a; //[ngain][nchannel][nsamples]
109  std::vector<std::vector<std::vector<float> > > vofc_b;
110  vofc_a.resize(m_ngain);
111  vofc_b.resize(m_ngain);
112  for (unsigned i=0; i<m_ngain; ++i) {
113  vofc_a[i].resize(m_hashMax);
114  vofc_b[i].resize(m_hashMax);
115  }
116 
117  std::ifstream myfile(input);
118  // we expect two lines per channel with Id, hash and values
119  // it contains particular pattern, change it if formatting has changed
120  std::string line, line1;
121  unsigned long id, id1;
122  unsigned hash, hash1;
123  char mychar, mychar1;
124  while (std::getline(myfile, line),std::getline(myfile, line1)) {
125  std::stringstream st(line);
126  st>>std::hex>>id>>std::dec>>hash;
127  std::stringstream st1(line1);
128  st>>std::hex>>id1>>std::dec>>hash1;
129  // check equality of Id and has in both lines
130  if(id != id1 || hash != hash1) {
131  ATH_MSG_ERROR("Different input id or hash: "<<line<<" "<<line1);
132  continue;
133  }
134  // Now it should contain a and b chars
135  st>>mychar;
136  st1>>mychar1;
137  if(mychar != 'a' || mychar1 != 'b') {
138  ATH_MSG_ERROR("Wrong OFC type: "<<line<<" "<<line1);
139 
140  }
141 
142  // check if nsamples corresponds to asked one, we expect the same number in each gain
143  }
144 
145  unsigned nChannels=0;
146  unsigned nDefault=0;
147 
148  coral::AttributeListSpecification* spec = new coral::AttributeListSpecification();
149  spec->extend("OFCa", "blob");
150  spec->extend("OFCb", "blob");
151  spec->extend("TimeOffset","blob");
152  spec->extend<unsigned>("nSamples");
153  spec->extend<unsigned>("version");
154  auto collOFC = std::make_unique<CondAttrListCollection>(true);
155 
156  float timeOffset=0.;
157 
158  for (unsigned gain=0;gain<m_ngain;++gain) {
159 
160  auto attrList = std::make_unique<coral::AttributeList>(*spec);
161  (*attrList)["version"].setValue(0U);
162  coral::Blob& ofcaBlob=(*attrList)["OFCa"].data<coral::Blob>();
163  coral::Blob& ofcbBlob=(*attrList)["OFCb"].data<coral::Blob>();
164  coral::Blob& toBlob=(*attrList)["TimeOffset"].data<coral::Blob>();
165 
166  (*attrList)["nSamples"].setValue(m_nsample);
167 
168  ofcaBlob.resize(m_hashMax*sizeof(float)*m_nsample);
169  ofcbBlob.resize(m_hashMax*sizeof(float)*m_nsample);
170  toBlob.resize(m_hashMax*sizeof(float));
171  float* pOfca=static_cast<float*>(ofcaBlob.startingAddress());
172  float* pOfcb=static_cast<float*>(ofcbBlob.startingAddress());
173  float* pTimeOffset=static_cast<float*>(toBlob.startingAddress());
174  for (unsigned hs=0;hs<m_hashMax;++hs) {
175  const HWIdentifier chid=m_onlineID->channel_Id(hs);
176  LArOFCFlat::OFCRef_t ofca(vofc_a[gain][hs]);
177  LArOFCFlat::OFCRef_t ofcb(vofc_b[gain][hs]);
178 
179  if (ofca.size()==m_nsample) {
180  for (unsigned i=0;i<m_nsample;++i) {
181  pOfca[hs*m_nsample+i]=ofca[i];
182  }
183  }
184  else {
185  std::stringstream message;
186  message <<"Number of samples don't match. Expect " << m_nsample << ", got " << ofca.size() << ".";
187  errIfConnected(chid,gain,"OFCa", message.str());
188  for (unsigned i=0;i<m_nsample;++i) {
189  pOfca[hs*m_nsample+i]=1.0;
190  }
191  ++nDefault;
192  }
193 
194  if (ofcb.size()==m_nsample) {
195  for (unsigned i=0;i<m_nsample;++i) {
196  pOfcb[hs*m_nsample+i]=ofcb[i];
197  }
198  }
199  else {
200  std::stringstream message;
201  message <<"Number of samples don't match. Expect " << m_nsample << ", got " << ofcb.size() << ".";
202  errIfConnected(chid,gain,"OFCb", message.str());
203  for (unsigned i=0;i<m_nsample;++i) {
204  pOfcb[hs*m_nsample+i]=0.0;
205  }
206  }
207  pTimeOffset[hs]=timeOffset;
208  ++nChannels;
209 
210  }//end loop over hash ids
211  collOFC->add(gain,*(attrList.release()));
212  }//end loop over gains
213 
214  StatusCode sc=detStore()->record(std::move(collOFC),outputName);//"/LAR/ElecCalibFlat/OFC");
215  if (sc.isFailure()) {
216  ATH_MSG_ERROR( "Failed to record CondAttrListCollection OFC with key " << outputName );
217  return;
218  }
219 
220  ATH_MSG_INFO( "Converted OFCs to inline storage. Total number of channels=" << nChannels );
221  ATH_MSG_INFO( "Number of channels filled with default OFCs {1,1,1,1} " << nDefault << " (including disconnected)" );
222  return;
223 }

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

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

◆ singleFloatFlat()

void LArFlatFromFile::singleFloatFlat ( const char *  blobName,
const std::string &  input,
const std::string &  outputName,
const unsigned  nGain 
)
private

Definition at line 33 of file LArFlatFromFile.cxx.

34  {
35 
36  unsigned nChannels=0;
37  unsigned nCopiedEMPS=0;
38  unsigned nDefault=0;
39 
40  coral::AttributeListSpecification* spec = new coral::AttributeListSpecification();
41  spec->extend(blobName, "blob");
42  spec->extend<unsigned>("version");
43  std::unique_ptr<CondAttrListCollection> coll= std::make_unique<CondAttrListCollection>(true);
44  // we expect line per channel with Id, hash and value
45  std::ifstream myfile(input);
46  std::string line;
47  std::vector< std::vector<float> > values(nGain, std::vector<float>(m_hashMax,1.0f));
48  unsigned id;
49  unsigned hash;
50  float value;
51  while (std::getline(myfile, line)) {
52  std::stringstream st(line);
53  if(m_isSC) {
54  st>>std::dec>>id>>std::dec>>value;
55  hash=0;
56  } else {
57  st>>std::hex>>id>>std::dec>>hash>>value;
58  }
59  const HWIdentifier chid(id);
60  if (value < 0) {
61  errIfConnected(chid,static_cast<int>(hash),blobName);
62  value=1.0; //Default vaue is 1.0, since these are multiplicative constants
63  ++nDefault;
64  }
65  if (hash >= nGain) {
66  errIfConnected(chid,static_cast<int>(hash),blobName," Wrong Gain !!!");
67  hash=0;
68  }
69 
70  if(m_isSC)
72  else
74  } // over the input file
75 
76  for (unsigned gain=0;gain<nGain;++gain) {
77  auto attrList = std::make_unique<coral::AttributeList>(*spec);
78  (*attrList)["version"].setValue(0U);
79  coral::Blob& blob=(*attrList)[blobName].data<coral::Blob>();
80  blob.resize(m_hashMax*sizeof(float));
81  float* pblob=static_cast<float*>(blob.startingAddress());
82  for (unsigned hs=0;hs<m_hashMax;++hs) {
83  pblob[hs]=values[gain][hs];
84  ++nChannels;
85  }
86  unsigned coolChan=gain;
87 
88  coll->add(coolChan,*attrList.release());
89  }
90 
91  ATH_MSG_INFO( "Converted " << blobName << " to inline storage. Total number of channels=" << nChannels );
92  ATH_MSG_INFO( "Number of channels filled with default value (1.0) " << nDefault << " (including disconnected)" );
93  if (nCopiedEMPS)
94  ATH_MSG_INFO( "\t Number of low gain EMBPS channels copied from medium gain" << nCopiedEMPS );
95  StatusCode sc=detStore()->record(std::move(coll),outputName);
96  if (sc.isFailure()) {
97  ATH_MSG_ERROR( "Failed to record CondAttrListCollection with key" << outputName );
98  return;
99  }
100  return;
101 }

◆ stop()

StatusCode LArFlatFromFile::stop ( )
overridevirtual

Definition at line 227 of file LArFlatFromFile.cxx.

227  {
228 
229 
232 
233  if(m_isSC)
235  else
237 
238 
239 
240  //OFC:
241  if (m_OFCInput.size()) {
242  std::ifstream myfile(m_OFCInput);
243  // new lines will be skipped unless we stop it from happening:
244  myfile.unsetf(std::ios_base::skipws);
245 
246  // count the newlines with an algorithm specialized for counting:
247  unsigned line_count = std::count( std::istream_iterator<char>(myfile),
248  std::istream_iterator<char>(), '\n');
249  myfile.close();
250  if (m_checkCompletness && 2*m_hashMax != line_count) {
251  ATH_MSG_ERROR( "Failed to check file with OFCs" );
252  return StatusCode::FAILURE;
253  } else {
254  if(m_isSC)
255  ofcFlat(m_OFCInput,"/LAR/ElecCalibSC/OFC");
256  else
257  ofcFlat(m_OFCInput,"/LAR/ElecCalibFlat/OFC");
258  }
259  }//end have m_OFCInput
260 
261  //SIngle:
262  if (m_SingleInput.size()) {
263  std::ifstream myfile(m_SingleInput);
264  // new lines will be skipped unless we stop it from happening:
265  myfile.unsetf(std::ios_base::skipws);
266 
267  // count the newlines with an algorithm specialized for counting:
268  unsigned line_count = std::count( std::istream_iterator<char>(myfile),
269  std::istream_iterator<char>(), '\n');
270  myfile.close();
271  if (m_checkCompletness && m_ngain*m_hashMax != line_count) {
272  ATH_MSG_ERROR( "Failed to check input file "<<m_SingleInput );
273  ATH_MSG_ERROR( "Line count: "<<line_count<<" expected: "<<m_ngain*m_hashMax<<" "<<m_isSC);
274  return StatusCode::FAILURE;
275  } else {
277  }
278  }//end have m_SingleInput
279 
280  return StatusCode::SUCCESS;
281 }

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

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

Gaudi::Property<std::string> LArFlatFromFile::m_BlobName {this, "Blob","","Blob name"}
private

Definition at line 68 of file LArFlatFromFile.h.

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> LArFlatFromFile::m_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
private

Definition at line 53 of file LArFlatFromFile.h.

◆ m_checkCompletness

Gaudi::Property<bool> LArFlatFromFile::m_checkCompletness {this, "checkInput", true, "Check if input file is complete"}
private

Definition at line 71 of file LArFlatFromFile.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_Folder

Gaudi::Property<std::string> LArFlatFromFile::m_Folder {this, "Folder","","Folder to create"}
private

Definition at line 67 of file LArFlatFromFile.h.

◆ m_forceStop

bool LArFlatFromFile::m_forceStop {}
private

Definition at line 73 of file LArFlatFromFile.h.

◆ m_hashMax

unsigned LArFlatFromFile::m_hashMax {}
private

Definition at line 48 of file LArFlatFromFile.h.

◆ m_isSC

Gaudi::Property<bool> LArFlatFromFile::m_isSC {this,"SuperCells",false,"Run for SC ?"}
private

Definition at line 60 of file LArFlatFromFile.h.

◆ m_ngain

Gaudi::Property<unsigned> LArFlatFromFile::m_ngain {this,"NGains",1,"Number of gains to process"}
private

Definition at line 63 of file LArFlatFromFile.h.

◆ m_nsample

Gaudi::Property<unsigned> LArFlatFromFile::m_nsample {this,"NSamples",4,"Number of samples to process"}
private

Definition at line 64 of file LArFlatFromFile.h.

◆ m_OFCInput

Gaudi::Property<std::string> LArFlatFromFile::m_OFCInput {this, "OFCInput","","Input file name"}
private

Input files.

Definition at line 56 of file LArFlatFromFile.h.

◆ m_onlineID

const LArOnlineID* LArFlatFromFile::m_onlineID {}
private

Definition at line 49 of file LArFlatFromFile.h.

◆ m_onlineSCID

const LArOnline_SuperCellID* LArFlatFromFile::m_onlineSCID {}
private

Definition at line 50 of file LArFlatFromFile.h.

◆ m_SingleInput

Gaudi::Property<std::string> LArFlatFromFile::m_SingleInput {this, "SingleInput","","Input file name"}
private

Definition at line 57 of file LArFlatFromFile.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
RPDUtils::nChannels
unsigned constexpr int nChannels
Definition: RPDUtils.h:23
LArOnlineID_Base::channel_Hash
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
Definition: LArOnlineID_Base.cxx:1636
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArFlatFromFile::m_OFCInput
Gaudi::Property< std::string > m_OFCInput
Input files.
Definition: LArFlatFromFile.h:56
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:46
LArG4FSStartPointFilterLegacy.line1
line1
Definition: LArG4FSStartPointFilterLegacy.py:58
LArFlatFromFile::ofcFlat
void ofcFlat(const std::string &input, const std::string &outputName)
Definition: LArFlatFromFile.cxx:104
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
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
LArFlatFromFile::m_checkCompletness
Gaudi::Property< bool > m_checkCompletness
Definition: LArFlatFromFile.h:71
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
athena.value
value
Definition: athena.py:124
LArFlatFromFile::m_BlobName
Gaudi::Property< std::string > m_BlobName
Definition: LArFlatFromFile.h:68
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HWIdentifier
Definition: HWIdentifier.h:13
ReweightUtils.message
message
Definition: ReweightUtils.py:15
dq_defect_bulk_create_defects.line
line
Definition: dq_defect_bulk_create_defects.py:27
XMLtoHeader.count
count
Definition: XMLtoHeader.py:84
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:808
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
LArOnlineID_Base::channelHashMax
size_type channelHashMax() const
Define channel hash tables max size.
Definition: LArOnlineID_Base.cxx:1901
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
LArFlatFromFile::m_onlineSCID
const LArOnline_SuperCellID * m_onlineSCID
Definition: LArFlatFromFile.h:50
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
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.
lumiFormat.i
int i
Definition: lumiFormat.py:85
CreatePhysValWebPage.hs
hs
Definition: CreatePhysValWebPage.py:107
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
python.getProblemFolderFromLogs.st
st
Definition: getProblemFolderFromLogs.py:68
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
LArOnlineID_Base::channel_Id
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
Definition: LArOnlineID_Base.cxx:1569
LArFlatFromFile::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArFlatFromFile.h:49
LArFlatFromFile::singleFloatFlat
void singleFloatFlat(const char *blobName, const std::string &input, const std::string &outputName, const unsigned nGain)
Definition: LArFlatFromFile.cxx:33
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
hist_file_dump.f
f
Definition: hist_file_dump.py:140
LArFlatFromFile::m_ngain
Gaudi::Property< unsigned > m_ngain
Definition: LArFlatFromFile.h:63
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
LArFlatFromFile::m_SingleInput
Gaudi::Property< std::string > m_SingleInput
Definition: LArFlatFromFile.h:57
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:239
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArFlatFromFile::m_isSC
Gaudi::Property< bool > m_isSC
Definition: LArFlatFromFile.h:60
lumiFormat.outputName
string outputName
Definition: lumiFormat.py:65
LArFlatFromFile::errIfConnected
void errIfConnected(const HWIdentifier chid, const int gain, const std::string &objName, const std::string &message="") const
Definition: LArFlatFromFile.cxx:287
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
a
TList * a
Definition: liststreamerinfos.cxx:10
h
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:108
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArOnlineID_Base::isEMBPS
bool isEMBPS(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1665
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
LArFlatFromFile::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArFlatFromFile.h:53
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
LArFlatFromFile::m_nsample
Gaudi::Property< unsigned > m_nsample
Definition: LArFlatFromFile.h:64
LArOnlineID_Base::channel_name
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
Definition: LArOnlineID_Base.cxx:225
LArFlatFromFile::m_hashMax
unsigned m_hashMax
Definition: LArFlatFromFile.h:48
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:95
fitman.k
k
Definition: fitman.py:528
LArVectorProxy
Proxy for accessing a range of float values like a vector.
Definition: LArVectorProxy.h:38
LArFlatFromFile::m_Folder
Gaudi::Property< std::string > m_Folder
Definition: LArFlatFromFile.h:67
ServiceHandle< ICondSvc >
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20