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 > &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 > &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

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 > &  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; }

◆ errIfConnected()

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

Definition at line 292 of file LArFlatFromFile.cxx.

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

◆ 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 109 of file LArFlatFromFile.cxx.

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

◆ 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;
48  for (unsigned gain=0;gain<nGain;++gain) {
49  std::vector<float> gval(m_hashMax);
50  for (unsigned hs=0;hs<m_hashMax;++hs) gval[hs]=1.0; // default
51  values.push_back(gval);
52  }
53  unsigned id;
54  unsigned hash;
55  float value;
56  while (std::getline(myfile, line)) {
57  std::stringstream st(line);
58  if(m_isSC) {
59  st>>std::dec>>id>>std::dec>>value;
60  hash=0;
61  } else {
62  st>>std::hex>>id>>std::dec>>hash>>value;
63  }
64  const HWIdentifier chid(id);
65  if (value < 0) {
66  errIfConnected(chid,hash,blobName);
67  value=1.0; //Default vaue is 1.0, since these are multiplicative constants
68  ++nDefault;
69  }
70  if (hash >= nGain) {
71  errIfConnected(chid,hash,blobName," Wrong Gain !!!");
72  hash=0;
73  }
74 
75  if(m_isSC)
77  else
79  } // over the input file
80 
81  for (unsigned gain=0;gain<nGain;++gain) {
82  auto attrList = std::make_unique<coral::AttributeList>(*spec);
83  (*attrList)["version"].setValue(0U);
84  coral::Blob& blob=(*attrList)[blobName].data<coral::Blob>();
85  blob.resize(m_hashMax*sizeof(float));
86  float* pblob=static_cast<float*>(blob.startingAddress());
87  for (unsigned hs=0;hs<m_hashMax;++hs) {
88  pblob[hs]=values[gain][hs];
89  ++nChannels;
90  }
91  unsigned coolChan=gain;
92 
93  coll->add(coolChan,*attrList.release());
94  }
95 
96  ATH_MSG_INFO( "Converted " << blobName << " to inline storage. Total number of channels=" << nChannels );
97  ATH_MSG_INFO( "Number of channels filled with default value (1.0) " << nDefault << " (including disconnected)" );
98  if (nCopiedEMPS)
99  ATH_MSG_INFO( "\t Number of low gain EMBPS channels copied from medium gain" << nCopiedEMPS );
100  StatusCode sc=detStore()->record(std::move(coll),outputName);
101  if (sc.isFailure()) {
102  ATH_MSG_ERROR( "Failed to record CondAttrListCollection with key" << outputName );
103  return;
104  }
105  return;
106 }

◆ stop()

StatusCode LArFlatFromFile::stop ( )
overridevirtual

Definition at line 232 of file LArFlatFromFile.cxx.

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

◆ 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
checkFileSG.line
line
Definition: checkFileSG.py:75
LArOnlineID_Base::channel_Hash
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
Definition: LArOnlineID_Base.cxx:1636
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
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:47
LArG4FSStartPointFilterLegacy.line1
line1
Definition: LArG4FSStartPointFilterLegacy.py:58
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArFlatFromFile::ofcFlat
void ofcFlat(const std::string &input, const std::string &outputName)
Definition: LArFlatFromFile.cxx:109
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
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:122
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
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:797
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
LArFlatFromFile::m_onlineSCID
const LArOnline_SuperCellID * m_onlineSCID
Definition: LArFlatFromFile.h:50
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:92
CreatePhysValWebPage.hs
hs
Definition: CreatePhysValWebPage.py:107
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
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
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:194
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArOnlineID_Base::channelHashMax
size_type channelHashMax(void) const
Define channel hash tables max size.
Definition: LArOnlineID_Base.cxx:1901
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:71
LArFlatFromFile::errIfConnected
void errIfConnected(const HWIdentifier chid, const int gain, const std::string &objName, const std::string &message="") const
Definition: LArFlatFromFile.cxx:292
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:109
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:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
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:218
LArFlatFromFile::m_hashMax
unsigned m_hashMax
Definition: LArFlatFromFile.h:48
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
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