Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
PixelDistortionAlg Class Reference

#include <PixelDistortionAlg.h>

Inheritance diagram for PixelDistortionAlg:
Collaboration diagram for PixelDistortionAlg:

Public Member Functions

 PixelDistortionAlg (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~PixelDistortionAlg ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode execute () 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

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

const PixelIDm_pixelID {nullptr}
 
ServiceHandle< IAthRNGSvcm_rndmSvc {this, "RndmSvc", "AthRNGSvc"}
 Random number service. More...
 
SG::ReadCondHandleKey< DetCondCFloatm_readKey {this, "ReadKey", "/Indet/PixelDist", "Input readout distortion folder"}
 
SG::WriteCondHandleKey< PixelDistortionDatam_writeKey {this, "WriteKey", "PixelDistortionData", "Output readout distortion data"}
 
Gaudi::Property< int > m_distortionInputSource {this, "DistortionInputSource", 4, "Source of module distortions: 0 (none), 1 (constant), 2 (text file), 3 (random), 4 (database)"}
 
Gaudi::Property< int > m_distortionVersion {this, "DistortionVersion", -1, "Version number for distortion model"}
 
Gaudi::Property< bool > m_writeToFile {this, "DistortionWriteToFile", false, "Record data in storegate"}
 
Gaudi::Property< std::string > m_inputFileName {this, "DistortionFileName", "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/TrackingCP/PixelDistortions/PixelDistortionsData_v2_BB.txt","Read distortions from this file"}
 
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 27 of file PixelDistortionAlg.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

◆ PixelDistortionAlg()

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

Definition at line 23 of file PixelDistortionAlg.cxx.

23  :
24  ::AthAlgorithm(name, pSvcLocator)
25 {
26 }

◆ ~PixelDistortionAlg()

virtual PixelDistortionAlg::~PixelDistortionAlg ( )
virtualdefault

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

◆ 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 PixelDistortionAlg::execute ( )
overridevirtual

Definition at line 40 of file PixelDistortionAlg.cxx.

40  {
41  ATH_MSG_DEBUG("PixelDistortionAlg::execute()");
42 
44  if (writeHandle.isValid()) {
45  ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order.");
46  return StatusCode::SUCCESS;
47  }
48 
49  // Construct the output Cond Object and fill it in
50  std::unique_ptr<PixelDistortionData> writeCdo(std::make_unique<PixelDistortionData>());
51 
52 
53 
54  constexpr int nmodule_max = 2048;
55  std::unordered_map<uint32_t,std::vector<float>> distortionMap;
56  std::unordered_map<uint32_t,unsigned long long> ids;
57  if (m_distortionInputSource==0) { // no bow correction
58  ATH_MSG_DEBUG("No bow correction");
59  writeCdo -> setVersion(m_distortionVersion);
60  for (int i=0; i<nmodule_max; i++) {
61  distortionMap[i].push_back(0.0);
62  distortionMap[i].push_back(0.0);
63  distortionMap[i].push_back(0.0);
64  }
65  }
66  else if (m_distortionInputSource==1) { // constant bow
67  ATH_MSG_DEBUG("Using constant pixel distortions ");
68  writeCdo -> setVersion(m_distortionVersion);
69  for (int i=0; i<nmodule_max; i++) {
70  distortionMap[i].push_back(0.1); // 1/mm
71  distortionMap[i].push_back(0.1); // 1/mm
72  distortionMap[i].push_back(2.0*std::atan(0.0005)/CLHEP::degree); // convert to degree
73  }
74  }
75  else if (m_distortionInputSource==2) { // read from file
76  const std::string &file_name = m_inputFileName;
77  if (file_name.empty()) {
78  ATH_MSG_ERROR("Distortion filename is empty not found! No pixel distortion will be applied.");
79  return StatusCode::FAILURE;
80  }
81 
82  ATH_MSG_DEBUG("Reading pixel distortions from file: " << file_name);
83  writeCdo -> setVersion(m_distortionVersion);
84 
85  if (file_name[0] != '/') {
87  }
88  std::ifstream input(file_name);
89  if (!input.good()) {
90  ATH_MSG_ERROR("Cannot open " << file_name);
91  return StatusCode::FAILURE;
92  }
93 
94  int distosize;
95  if (m_distortionVersion < 2) distosize = 3;
96  else distosize = 441;
97 
98  while (!input.eof()) {
99  unsigned int idmod{};
100  unsigned int hashID {};
101  float data{};
102 
103  if (m_distortionVersion == 1) {
104  input >> idmod;
106  ATH_MSG_ERROR("idmod out of range: "<<idmod);
107  return StatusCode::FAILURE;
108  }
109  hashID = idmod;
110  } else {
111  input >> std::hex >> idmod >> std::dec;
112  hashID = m_pixelID->wafer_hash((Identifier)idmod);
113  }
114  Identifier modId = m_pixelID->wafer_id((IdentifierHash)hashID);
115  ids[hashID] = modId.get_compact();
116  ATH_MSG_DEBUG("Identifier = 0x" << std::hex << ids[hashID] << std::dec);
117 
118  std::stringstream s;
119  for (int i = 0; i < distosize; ++i) {
120  input >> data;
121  s << data << " ";
122  distortionMap[hashID].push_back(data);
123  }
124  ATH_MSG_DEBUG(s.str());
125  }
126  input.close();
127  }
128  else if (m_distortionInputSource==3) { // random generation
129  ATH_MSG_DEBUG("Using random pixel distortions");
130  writeCdo -> setVersion(m_distortionVersion);
131 
132  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this);
133  rngWrapper->setSeed(name(),Gaudi::Hive::currentContext());
134  CLHEP::HepRandomEngine *rndmEngine = *rngWrapper;
135  //these numbers could become properties, but seems unnecessary now (they are the same in all cases):
136  constexpr double distortionMeanR{0.12/CLHEP::meter};
137  constexpr double distortionRMSR{0.08};
138  constexpr double distortionMeanTwist{-0.0005};
139 
140  for (int i=0; i<nmodule_max; i++) {
141  float r1 = CLHEP::RandGaussZiggurat::shoot(rndmEngine,distortionMeanR,distortionRMSR);
142  float r2 = CLHEP::RandGaussZiggurat::shoot(rndmEngine,r1,distortionRMSR/10.);//to implement a correlation between distortions on 2 sides of the module
143  float twist = CLHEP::RandGaussZiggurat::shoot(rndmEngine,distortionMeanTwist,distortionMeanTwist);
144  distortionMap[i].push_back(r1*CLHEP::meter); // convert to 1/mm
145  distortionMap[i].push_back(r2*CLHEP::meter); // convert to 1/mm
146  distortionMap[i].push_back(2.0*std::atan(twist)/CLHEP::degree); // convert to degree
147  }
148  }
149  else if (m_distortionInputSource==4) { // read from database here
150  ATH_MSG_DEBUG("Using pixel distortions from database");
152  const DetCondCFloat* readCdo = *readHandle;
153  if (readCdo==nullptr) {
154  ATH_MSG_FATAL("Null pointer to the read conditions object");
155  return StatusCode::FAILURE;
156  }
157  // Get the validitiy range
158  ATH_MSG_DEBUG("Size of DetCondCFloat " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
159 
160  int version = 0;
161  if (readCdo->tag()=="/Indet/PixelDist") {
162  version = 0; // For reproducing bug in earlier versions for backward compatibility
163  ATH_MSG_INFO("Detected old version of pixel distortions data.");
164  }
165  else {
166  bool gotVersion = false;
167  // Get version number, expecting string to have the form /Indet/PixelDist_v#
168  // If not recongnized will default to latest version.
169  std::string baseStr = "/Indet/PixelDist_v";
170  if (readCdo->tag().compare(0,baseStr.size(),baseStr)==0) {
171  std::istringstream istr(readCdo->tag().substr(baseStr.size()));
172  int version_tmp = 0;
173  istr >> version_tmp;
174  if (istr.eof()) { // Should be have read whole stream if its a number
175  version = version_tmp;
176  gotVersion = true;
177  }
178  }
179  if (!gotVersion) {
180  ATH_MSG_WARNING("Unable to determine version number of pixel distortions data. Version string: " << readCdo->tag());
181  }
182  }
183  writeCdo -> setVersion(version);
184  ATH_MSG_DEBUG("Distortions data version = " << version);
185 
186  int distosize = readCdo->size();
187 
188  for (int i=0; i<nmodule_max; i++) {
189  if (readCdo->find(m_pixelID->wafer_id(IdentifierHash(i)))) {
191  const float *disto = readCdo->find(modId);
192  ids[i] = modId.get_compact();
193 
194  ATH_MSG_DEBUG("Identifier = 0x" << std::hex << ids[i] << std::dec);
195  std::stringstream s;
196  for (int j = 0; j < distosize; ++j) {
197  distortionMap[i].push_back(disto[j]);
198  s << disto[j] << " ";
199  }
200  ATH_MSG_DEBUG(s.str());
201  }
202  }
203  }
204  writeCdo -> setDistortionMap(distortionMap);
205  writeCdo -> setIds(ids);
206 
207  if (m_writeToFile) {
208  std::ofstream* outfile = new std::ofstream("output_distortion.txt");
209  for (int i=0; i<nmodule_max; i++) {
210  if (!distortionMap[i].empty()) {
211  if (m_distortionVersion==0) {
212  *outfile << m_pixelID->wafer_id(IdentifierHash(i)) << " " << distortionMap[i].at(0) << " " << distortionMap[i].at(1) << " " << distortionMap[i].at(2) << std::endl;
213  }
214  else if (m_distortionVersion>0) {
215  *outfile << i << " " << distortionMap[i].at(0) << " " << distortionMap[i].at(1) << " " << distortionMap[i].at(2) << std::endl;
216  }
217  }
218  }
219  outfile->close();
220  delete outfile;
221  }
222 
223  const EventIDBase start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
224  const EventIDBase stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
225  const EventIDRange rangeW{start, stop};
226 
227  if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
228  ATH_MSG_FATAL("Could not record PixelDistortionData " << writeHandle.key() << " with EventRange " << rangeW << " into Conditions Store");
229  return StatusCode::FAILURE;
230  }
231  ATH_MSG_DEBUG("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
232 
233  return StatusCode::SUCCESS;
234 }

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

◆ initialize()

StatusCode PixelDistortionAlg::initialize ( )
overridevirtual

Definition at line 28 of file PixelDistortionAlg.cxx.

28  {
29  ATH_MSG_DEBUG("PixelDistortionAlg::initialize()");
30 
31  ATH_CHECK(detStore()->retrieve(m_pixelID,"PixelID"));
32 
33  ATH_CHECK(m_rndmSvc.retrieve());
36 
37  return StatusCode::SUCCESS;
38 }

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

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

◆ 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_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_distortionInputSource

Gaudi::Property<int> PixelDistortionAlg::m_distortionInputSource {this, "DistortionInputSource", 4, "Source of module distortions: 0 (none), 1 (constant), 2 (text file), 3 (random), 4 (database)"}
private

Definition at line 45 of file PixelDistortionAlg.h.

◆ m_distortionVersion

Gaudi::Property<int> PixelDistortionAlg::m_distortionVersion {this, "DistortionVersion", -1, "Version number for distortion model"}
private

Definition at line 48 of file PixelDistortionAlg.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_inputFileName

Gaudi::Property<std::string> PixelDistortionAlg::m_inputFileName {this, "DistortionFileName", "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/TrackingCP/PixelDistortions/PixelDistortionsData_v2_BB.txt","Read distortions from this file"}
private

Definition at line 54 of file PixelDistortionAlg.h.

◆ m_pixelID

const PixelID* PixelDistortionAlg::m_pixelID {nullptr}
private

Definition at line 36 of file PixelDistortionAlg.h.

◆ m_readKey

SG::ReadCondHandleKey<DetCondCFloat> PixelDistortionAlg::m_readKey {this, "ReadKey", "/Indet/PixelDist", "Input readout distortion folder"}
private

Definition at line 39 of file PixelDistortionAlg.h.

◆ m_rndmSvc

ServiceHandle<IAthRNGSvc> PixelDistortionAlg::m_rndmSvc {this, "RndmSvc", "AthRNGSvc"}
private

Random number service.

Definition at line 37 of file PixelDistortionAlg.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.

◆ m_writeKey

SG::WriteCondHandleKey<PixelDistortionData> PixelDistortionAlg::m_writeKey {this, "WriteKey", "PixelDistortionData", "Output readout distortion data"}
private

Definition at line 42 of file PixelDistortionAlg.h.

◆ m_writeToFile

Gaudi::Property<bool> PixelDistortionAlg::m_writeToFile {this, "DistortionWriteToFile", false, "Record data in storegate"}
private

Definition at line 51 of file PixelDistortionAlg.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition: RNGWrapper.h:169
DetCondCFloat
DetCondCFloat is a class to hold sets of Identifiers and arrays of floats for detector element specif...
Definition: DetCondCFloat.h:45
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
PixelDistortionAlg::m_distortionVersion
Gaudi::Property< int > m_distortionVersion
Definition: PixelDistortionAlg.h:49
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
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
Identifier::get_compact
value_type get_compact() const
Get the compact id.
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
PixelDistortionAlg::m_writeKey
SG::WriteCondHandleKey< PixelDistortionData > m_writeKey
Definition: PixelDistortionAlg.h:43
MCP::ScaleSmearParam::r2
@ r2
PixelDistortionAlg::m_writeToFile
Gaudi::Property< bool > m_writeToFile
Definition: PixelDistortionAlg.h:52
PixelID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: PixelID.h:364
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
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
physics_parameters.file_name
string file_name
Definition: physics_parameters.py:32
PixelDistortionAlg::m_readKey
SG::ReadCondHandleKey< DetCondCFloat > m_readKey
Definition: PixelDistortionAlg.h:40
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
PixelID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: PixelID.h:387
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
python.SystemOfUnits.meter
int meter
Definition: SystemOfUnits.py:61
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
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
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
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
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
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
DetCondCFloat::size
int size() const
Definition: DetCondCFloat.h:85
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
get_generator_info.version
version
Definition: get_generator_info.py:33
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
a
TList * a
Definition: liststreamerinfos.cxx:10
columnar::empty
bool empty() const noexcept
Definition: ObjectRange.h:129
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
PixelDistortionAlg::m_inputFileName
Gaudi::Property< std::string > m_inputFileName
Definition: PixelDistortionAlg.h:55
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
DetCondCFloat::tag
const std::string & tag() const
Definition: DetCondCFloat.h:87
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
MCP::ScaleSmearParam::r1
@ r1
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
DetCondCFloat::find
const float * find(const Identifier &ident) const
Definition: DetCondCFloat.cxx:29
PixelDistortionAlg::m_distortionInputSource
Gaudi::Property< int > m_distortionInputSource
Definition: PixelDistortionAlg.h:46
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
PixelDistortionAlg::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service.
Definition: PixelDistortionAlg.h:37
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >
PixelDistortionAlg::m_pixelID
const PixelID * m_pixelID
Definition: PixelDistortionAlg.h:36
Identifier
Definition: IdentifierFieldParser.cxx:14