DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ConditionsRepositoryWriter.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DD4HEP_DDCOND_CONDITIONSREPOSITORYWRITER_H
14 #define DD4HEP_DDCOND_CONDITIONSREPOSITORYWRITER_H
15 
16 // Framework include files
17 #include <DD4hep/Detector.h>
18 #include <XML/XMLElements.h>
20 
21 // C/C++ include files
22 
24 namespace dd4hep {
25 
27  namespace cond {
28 
29  // Forward declarations
30  class ConditionsSlice;
31 
33 
49  long m_numConverted = 0;
51  long m_numUnconverted = 0;
52  public:
59 
65  size_t collect(xml::Element root,ConditionsSlice& slice,DetElement detector);
67  size_t collect(xml::Element root, ConditionsManager manager);
69  size_t collect(xml::Element root, ConditionsSlice& slice);
71  long write(xml::Document doc, const std::string& output) const;
72  };
73 
74  } /* End namespace cond */
75 } /* End namespace dd4hep */
76 #endif /* DD4HEP_DDCOND_CONDITIONSREPOSITORYWRITER_H */
77 
78 
79 //==========================================================================
80 // AIDA Detector description implementation
81 //--------------------------------------------------------------------------
82 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
83 // All rights reserved.
84 //
85 // For the licensing terms see $DD4hepINSTALL/LICENSE.
86 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
87 //
88 // Author : M.Frank
89 //
90 //==========================================================================
91 
92 // Framework include files
93 #include <XML/XMLElements.h>
94 #include <XML/DocumentHandler.h>
95 #include <DD4hep/Printout.h>
96 #include <DD4hep/Alignments.h>
97 #include <DD4hep/AlignmentData.h>
100 #include <DD4hep/DetFactoryHelper.h>
103 
104 #include <DDCond/ConditionsTags.h>
105 #include <DDCond/ConditionsSlice.h>
107 
108 // C/C++ include files
109 #include <stdexcept>
110 #include <memory>
111 #include <sstream>
112 #include <list>
113 #include <set>
114 
115 using namespace dd4hep::cond;
116 namespace units = dd4hep;
117 namespace xml = dd4hep::xml;
118 using dd4hep::printout;
119 using dd4hep::_toString;
120 
122 namespace {
123 
125  static dd4hep::PrintLevel s_printLevel = dd4hep::INFO;
126 
127  class pressure;
128  class temperature;
129  class value;
130  class sequence;
131 
132  class PropertyDumper {
133  xml::Element root;
134  public:
135  PropertyDumper(xml::Element p) : root(p) {}
136  void operator()(const std::pair<std::string, dd4hep::Property>& p) const {
137  xml::Element e = xml::Element(root.document(),_UC(property));
138  std::string val = p.second.str();
139  if ( val[0] == '\'' ) val = p.second.str().c_str()+1;
140  if ( !val.empty() && val[val.length()-1] == '\'' ) val[val.length()-1] = 0;
141  e.setAttr(_U(name), p.first);
142  e.setAttr(_U(value), val);
143  root.append(e);
144  }
145  };
146 
147  template <typename T> xml::Element _convert(xml::Element par, dd4hep::Condition c);
148 
150  char hash[64];
151  std::string nam = c.name();
152  std::string cn = nam.substr(nam.find('#')+1);
153  ::snprintf(hash,sizeof(hash),"%llX",c.key());
154  e.setAttr(_U(name),cn);
155  e.setAttr(_U(key),hash);
156  return e;
157  }
158  xml::Element _convert(xml::Element par, const dd4hep::Translation3D& tr) {
159  xml::Element e = xml::Element(par.document(),_U(pivot));
160  const dd4hep::Translation3D::Vector& v = tr.Vect();
161  e.setAttr(_U(x),_toString(v.X()/dd4hep::mm,"%f*mm"));
162  e.setAttr(_U(y),_toString(v.Y()/dd4hep::mm,"%f*mm"));
163  e.setAttr(_U(z),_toString(v.Z()/dd4hep::mm,"%f*mm"));
164  return e;
165  }
166  xml::Element _convert(xml::Element par, const dd4hep::Position& pos) {
167  xml::Element e = xml::Element(par.document(),_U(position));
168  e.setAttr(_U(x),_toString(pos.X()/dd4hep::mm,"%f*mm"));
169  e.setAttr(_U(y),_toString(pos.Y()/dd4hep::mm,"%f*mm"));
170  e.setAttr(_U(z),_toString(pos.Z()/dd4hep::mm,"%f*mm"));
171  return e;
172  }
173  xml::Element _convert(xml::Element par, const dd4hep::RotationZYX& rot) {
174  xml::Element e = xml::Element(par.document(),_U(rotation));
175  double z, y, x;
176  rot.GetComponents(z,y,x);
177  e.setAttr(_U(x),_toString(x/dd4hep::rad,"%f*rad"));
178  e.setAttr(_U(y),_toString(y/dd4hep::rad,"%f*rad"));
179  e.setAttr(_U(z),_toString(z/dd4hep::rad,"%f*rad"));
180  return e;
181  }
182  template <> xml::Element _convert<value>(xml::Element par, dd4hep::Condition c) {
183  xml::Element v = make(xml::Element(par.document(),_U(value)),c);
184  dd4hep::OpaqueData& data = c.data();
185  v.setAttr(_U(type),data.dataType());
186  v.setAttr(_U(value),data.str());
187  return v;
188  }
189  template <> xml::Element _convert<pressure>(xml::Element par, dd4hep::Condition c) {
190  xml::Element press = make(xml::Element(par.document(),_UC(pressure)),c);
191  press.setAttr(_U(value),c.get<double>()/(100e0*units::pascal));
192  press.setAttr(_U(unit),"hPa");
193  return press;
194  }
195  template <> xml::Element _convert<temperature>(xml::Element par, dd4hep::Condition c) {
196  xml::Element temp = make(xml::Element(par.document(),_UC(temperature)),c);
197  temp.setAttr(_U(value),c.get<double>()/units::kelvin);
198  temp.setAttr(_U(unit),"kelvin");
199  return temp;
200  }
201  template <> xml::Element _convert<dd4hep::Delta>(xml::Element par, dd4hep::Condition c) {
202  xml::Element align = make(xml::Element(par.document(),_UC(alignment_delta)),c);
203  const dd4hep::Delta& delta = c.get<dd4hep::Delta>();
205  align.append(_convert(align,delta.translation));
207  align.append(_convert(align,delta.rotation));
208  if ( delta.flags&dd4hep::Delta::HAVE_PIVOT )
209  align.append(_convert(align,delta.pivot));
210  return align;
211  }
212  template <> xml::Element _convert<dd4hep::Alignment>(xml::Element par, dd4hep::Condition c) {
213  char hash[64];
215  dd4hep::AlignmentCondition acond = c;
216  KM km(c.key());
217  const dd4hep::Delta& delta = acond.data().delta;
218  xml::Element align(xml::Element(par.document(),_UC(alignment_delta)));
220  ::snprintf(hash,sizeof(hash),"%llX",key);
222  align.setAttr(_U(key),hash);
224  align.append(_convert(align,delta.translation));
226  align.append(_convert(align,delta.rotation));
227  if ( delta.flags&dd4hep::Delta::HAVE_PIVOT )
228  align.append(_convert(align,delta.pivot));
229  return align;
230  }
231  xml::Element _seq(xml::Element v, dd4hep::Condition c, const char* tag, const char* match) {
232  dd4hep::OpaqueData& data = c.data();
233  std::string typ = data.dataType();
234  size_t len = ::strlen(match);
235  size_t idx = typ.find(match);
236  size_t idq = typ.find(',',idx+len);
237  if ( idx != std::string::npos && idq != std::string::npos ) {
238  std::string subtyp = tag;
239  subtyp += "["+typ.substr(idx+len,idq-idx-len)+"]";
240  v.setAttr(_U(type),subtyp);
241  xml::Handle_t(v.ptr()).setText(data.str());
242  return v;
243  }
244  dd4hep::except("Writer","++ Unknwon XML conversion to type: %s",typ.c_str());
245  return v;
246  }
247  template <> xml::Element _convert<std::vector<void*> >(xml::Element par, dd4hep::Condition c) {
248  xml::Element v = make(xml::Element(par.document(),_UC(sequence)),c);
249  return _seq(v,c,"vector","::vector<");
250  }
251  template <> xml::Element _convert<std::list<void*> >(xml::Element par, dd4hep::Condition c) {
252  xml::Element v = make(xml::Element(par.document(),_UC(sequence)),c);
253  return _seq(v,c,"list","::list<");
254  }
255  template <> xml::Element _convert<std::set<void*> >(xml::Element par, dd4hep::Condition c) {
256  xml::Element v = make(xml::Element(par.document(),_UC(sequence)),c);
257  return _seq(v,c,"set","::set<");
258  }
259 }
260 
263  printout(INFO,"ConditionsXMLWriter","++ Summary: Converted %ld conditions. %ld conditions without recipe.",
265 }
266 
270  xml::Document doc = docH.create("conditions", docH.defaultComment());
271  collect(doc.root(),slice);
272  return doc;
273 }
274 
278  xml::Document doc = docH.create("conditions", docH.defaultComment());
279  xml::Element root = doc.root();
280  collect(root,manager);
281  return doc;
282 }
283 
286  xml::Element repo(root.document(),_UC(repository));
287  xml::Element iov (repo.document(),_UC(iov));
288  const IOV& validity = slice.pool->validity();
289  char text[128];
290 
291  root.append(repo);
292  repo.append(iov);
293  std::snprintf(text,sizeof(text),"%ld,%ld#%s",
294  long(validity.keyData.first), long(validity.keyData.second),
295  validity.iovType->name.c_str());
296  iov.setAttr(_UC(validity),text);
297  return collect(iov,slice,slice.manager->detectorDescription().world());
298 }
299 
302  ConditionsManager manager)
303 {
304  size_t count = 0;
305  if ( manager.isValid() ) {
307  PropertyManager& prp = manager.properties();
308  xml::Element rep(root.document(),_UC(repository));
309  xml::Element mgr(rep.document(),_UC(manager));
310  const auto iovs = manager.iovTypesUsed();
311 
312  prp.for_each(PropertyDumper(mgr));
313  rep.append(mgr);
314  count += prp.size();
315  for ( const auto t : iovs ) {
316  xml::Element iov_typ(rep.document(),_UC(iov_type));
317  iov_typ.setAttr(_U(name),t->name);
318  iov_typ.setAttr(_U(id),int(t->type));
319  rep.append(iov_typ);
320  }
321  root.append(rep);
322  }
323  return count;
324 }
325 
328  ConditionsSlice& slice,
329  DetElement detector)
330 {
331  size_t count = 0;
332  if ( detector.isValid() ) {
333  std::vector<Condition> conds;
334  conditionsCollector(slice,conds)(detector);
335  if ( !conds.empty() ) {
336  std::stringstream comment;
337  Condition cond_align, cond_delta;
338  xml::Element conditions = xml::Element(root.document(),_UC(detelement));
339  conditions.setAttr(_U(path),detector.path());
340  printout(s_printLevel,"Writer","++ Conditions of DE %s [%d entries]",
341  detector.path().c_str(), int(conds.size()));
342  comment << " DDCond conditions for DetElement " << detector.path()
343  << " Total of " << int(conds.size()) << " Entries. ";
344  root.addComment(comment.str());
345  root.append(conditions);
346  for(const auto& c : conds ) {
347  std::string nam = c.name();
348  std::string cn = nam.substr(nam.find('#')+1);
349  detail::ReferenceBitMask<Condition::mask_type> msk(c->flags);
350 
351  printout(s_printLevel,"Writer","++ Condition %s [%16llX] -> %s",
352  cn.c_str(), c.key(), c.name());
353  if ( msk.isSet(Condition::TEMPERATURE) ) {
354  conditions.append(_convert<temperature>(conditions,c));
355  ++m_numConverted;
356  }
357  else if ( msk.isSet(Condition::PRESSURE) ) {
358  conditions.append(_convert<pressure>(conditions,c));
359  ++m_numConverted;
360  }
361  else if ( msk.isSet(Condition::ALIGNMENT_DERIVED) ) {
362  cond_align = c;
363  }
364  else if ( msk.isSet(Condition::ALIGNMENT_DELTA) ) {
365  cond_delta = c;
366  }
367  else {
368  const dd4hep::OpaqueData& data = c.data();
369  const std::type_info& typ = data.typeInfo();
370 #if defined(DD4HEP_HAVE_ALL_PARSERS)
371  if ( typ == typeid(char) || typ == typeid(unsigned char) ||
372  typ == typeid(short) || typ == typeid(unsigned short) ||
373  typ == typeid(int) || typ == typeid(unsigned int) ||
374  typ == typeid(long) || typ == typeid(unsigned long) ||
375  typ == typeid(float) || typ == typeid(double) ||
376  typ == typeid(bool) || typ == typeid(std::string) )
377 #else
378  if ( typ == typeid(int) || typ == typeid(long) ||
379  typ == typeid(float) || typ == typeid(double) ||
380  typ == typeid(bool) || typ == typeid(std::string) )
381 #endif
382  {
383  conditions.append(_convert<value>(conditions,c));
384  ++m_numConverted;
385  }
386  else if ( ::strstr(data.dataType().c_str(),"::vector<") ) {
387  conditions.append(_convert<std::vector<void*> >(conditions,c));
388  ++m_numConverted;
389  }
390  else if ( ::strstr(data.dataType().c_str(),"::list<") ) {
391  conditions.append(_convert<std::list<void*> >(conditions,c));
392  ++m_numConverted;
393  }
394  else if ( ::strstr(data.dataType().c_str(),"::set<") ) {
395  conditions.append(_convert<std::set<void*> >(conditions,c));
396  ++m_numConverted;
397  }
398  else {
399  comment.str("");
400  comment << "\n ** Unconverted condition: "
401  << "Unknown data type of condition: " << cn
402  << " [" << (void*)c.key() << "] -> "
403  << c.name() << " Flags:" << (unsigned int)c->flags << "\n";
404  conditions.addComment(comment.str());
405  printout(ERROR,"Writer",comment.str());
406  comment.str("");
407  comment << c.data().str() << " [" << c.data().dataType() << "]\n";
408  conditions.addComment(comment.str());
410  }
411  }
412  }
413  if ( cond_align.isValid() ) {
414  conditions.append(_convert<Alignment>(conditions,cond_align));
415  ++m_numConverted;
416  }
417  else if ( cond_delta.isValid() ) {
418  conditions.append(_convert<dd4hep::Delta>(conditions,cond_delta));
419  ++m_numConverted;
420  }
421  }
422  for (const auto& i : detector.children())
423  count += collect(root,slice,i.second);
424  }
425  return count;
426 }
427 // ======================================================================================
428 
430 long ConditionsXMLRepositoryWriter::write(xml::Document doc, const std::string& output) const {
431  xml_handler_t docH;
432  long ret = docH.output(doc, output);
433  if ( !output.empty() ) {
434  printout(INFO,"Writer","++ Successfully wrote %ld conditions (%ld unconverted) to file: %s",
435  m_numConverted,m_numUnconverted,output.c_str());
436  }
437  return ret;
438 }
439 
441 
446 static long write_repository_conditions(dd4hep::Detector& description, int argc, char** argv) {
447  ConditionsManager manager = ConditionsManager::from(description);
448  const dd4hep::IOVType* iovtype = 0;
449  long iovvalue = -1;
450  long mgr_prop = 0;
451  std::string output;
452 
453  for(int i=0; i<argc; ++i) {
454  if ( ::strncmp(argv[i],"-iov_type",7) == 0 )
455  iovtype = manager.iovType(argv[++i]);
456  else if ( ::strncmp(argv[i],"-iov_value",7) == 0 )
457  iovvalue = ::atol(argv[++i]);
458  else if ( ::strncmp(argv[i],"-output",4) == 0 && argc>i+1)
459  output = argv[++i];
460  else if ( ::strncmp(argv[i],"-manager",4) == 0 )
461  mgr_prop = 1;
462  else if ( ::strncmp(argv[i],"-help",2) == 0 ) {
463  printout(dd4hep::ALWAYS,"Plugin-Help","Usage: dd4hep_XMLConditionsRepositoryWriter --opt [--opt] ");
464  printout(dd4hep::ALWAYS,"Plugin-Help"," -output <string> Output file name. Default: stdout ");
465  printout(dd4hep::ALWAYS,"Plugin-Help"," -manager <string> Add manager properties to the output. ");
466  printout(dd4hep::ALWAYS,"Plugin-Help"," -iov_type <string> IOV type to be selected. ");
467  printout(dd4hep::ALWAYS,"Plugin-Help"," -iov_value <string> IOV value to create the conditions snapshot.");
468  ::exit(EINVAL);
469  }
470  }
471  if ( 0 == iovtype )
472  dd4hep::except("ConditionsPrepare","++ Unknown IOV type supplied.");
473  if ( 0 > iovvalue )
474  dd4hep::except("ConditionsPrepare",
475  "++ Unknown IOV value supplied for iov type %s.",iovtype->str().c_str());
476 
477  dd4hep::IOV iov(iovtype,iovvalue);
478  std::shared_ptr<ConditionsContent> content(new ConditionsContent());
479  std::shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content));
480  dd4hep::cond::fill_content(manager,*content,*iovtype);
481  ConditionsManager::Result cres = manager.prepare(iov, *slice);
482  printout(dd4hep::INFO, "Conditions",
483  "++ Selected conditions: %7ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) for IOV:%-12s",
484  cres.total(), cres.selected, cres.loaded, cres.computed, cres.missing,
485  iovtype ? iov.str().c_str() : "???");
486 
488  xml::Document doc(0);
489  if ( mgr_prop ) {
490  doc = writer.dump(manager);
491  writer.collect(doc.root(), *slice);
492  }
493  else {
494  doc = writer.dump(*slice);
495  }
496  writer.write(doc, output);
497  return 1;
498 }
499 DECLARE_APPLY(DD4hep_ConditionsXMLRepositoryWriter,write_repository_conditions)
500 
501 
502 // ======================================================================================
504 
509 static long write_repository_manager(dd4hep::Detector& description, int argc, char** argv) {
510  ConditionsManager manager = ConditionsManager::from(description);
511  std::string output;
512 
513  for(int i=0; i<argc; ++i) {
514  if ( ::strncmp(argv[i],"-output",4) == 0 && argc>i+1)
515  output = argv[++i];
516  else if ( ::strncmp(argv[i],"-help",2) == 0 ) {
517  printout(dd4hep::ALWAYS,"Plugin-Help","Usage: dd4hep_XMLConditionsManagerWriter --opt [--opt] ");
518  printout(dd4hep::ALWAYS,"Plugin-Help"," -output <string> Output file name. Default: stdout ");
519  ::exit(EINVAL);
520  }
521  }
523  xml::Document doc = writer.dump(manager);
524  writer.write(doc, output);
525  return 1;
526 }
527 DECLARE_APPLY(DD4hep_ConditionsXMLManagerWriter,write_repository_manager)
528 // ======================================================================================
dd4hep::cond::ConditionsManager::iovType
const IOVType * iovType(const std::string &iov_name) const
Access IOV by its name.
Definition: ConditionsManager.cpp:199
dd4hep::DetElement::children
const Children & children() const
Access to the list of children.
Definition: DetElement.cpp:207
dd4hep::DetElement::path
const std::string & path() const
Path of the detector element (not necessarily identical to placement path!)
Definition: DetElement.cpp:158
dd4hep::xml::DocumentHandler::create
Document create(const char *tag, const char *comment=0) const
Create new XML document by parsing empty xml buffer.
Definition: DocumentHandler.cpp:681
dd4hep::xml::Element::document
Document document() const
Access the hosting document handle of this DOM element.
Definition: XMLElements.cpp:1089
dd4hep::Delta::HAVE_TRANSLATION
@ HAVE_TRANSLATION
Definition: AlignmentData.h:48
ConditionsSlice.h
dd4hep::Detector::world
virtual DetElement world() const =0
Return reference to the top-most (world) detector element.
dd4hep::IOVType::name
std::string name
String name.
Definition: IOV.h:43
cond
AlignmentCondition::Object * cond
Definition: AlignmentsCalculator.cpp:68
dd4hep::PropertyManager::for_each
void for_each(FUNCTOR &func)
Apply functor on properties.
Definition: ComponentProperties.h:217
dd4hep::cond::ConditionsXMLRepositoryWriter::m_numUnconverted
long m_numUnconverted
Debug counters: unconverted conditions.
Definition: ConditionsRepositoryWriter.cpp:51
dd4hep::Condition::flags
mask_type flags() const
Flag operations: Get condition flags.
Definition: Conditions.cpp:186
dd4hep::xml::Element::append
void append(Handle_t handle) const
Append a new element to the existing tree.
Definition: XMLElements.h:839
v
View * v
Definition: MultiView.cpp:28
ConditionsInterna.h
Detector.h
dd4hep::cond::conditionsCollector
ConditionsCollector< typename std::remove_reference< T >::type > conditionsCollector(ConditionsMap &m, T &&conditions)
Creator utility function for ConditionsCollector objects.
Definition: ConditionsProcessor.h:150
dd4hep::Delta::HAVE_PIVOT
@ HAVE_PIVOT
Definition: AlignmentData.h:50
dd4hep::AlignmentCondition
Main handle class to hold an alignment conditions object.
Definition: Alignments.h:68
dd4hep::cond::ConditionsManager::detectorDescription
Detector & detectorDescription() const
Access the detector description.
Definition: ConditionsManager.cpp:173
dd4hep::Delta::HAVE_ROTATION
@ HAVE_ROTATION
Definition: AlignmentData.h:49
Alignments.h
delta
const Delta * delta
Definition: AlignmentsCalculator.cpp:67
DECLARE_APPLY
#define DECLARE_APPLY(name, func)
Definition: Factories.h:281
dd4hep::cond::ConditionsManager::Result::selected
size_t selected
Definition: ConditionsManager.h:61
dd4hep::cond::ConditionsSlice::manager
ConditionsManager manager
Reference to the conditions manager.
Definition: ConditionsSlice.h:105
dd4hep::IOVType::str
std::string str() const
Conversion to string.
Definition: IOV.cpp:43
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::_toString
std::string _toString(bool value)
String conversions: boolean value to string.
Definition: Handle.cpp:332
dd4hep::Condition::key
key_type key() const
Hash identifier.
Definition: Conditions.cpp:171
dd4hep::cond::ConditionsManager::Result::loaded
size_t loaded
Definition: ConditionsManager.h:62
dd4hep::xml::Handle_t
Class to easily access the properties of single XmlElements.
Definition: XMLElements.h:380
ConditionsManager.h
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
dd4hep::Condition::PRESSURE
@ PRESSURE
Definition: Conditions.h:84
dd4hep::ConditionKey::KeyMaker
Helper union to interprete conditions keys.
Definition: Conditions.h:295
dd4hep::IOVType
Class describing the interval of validty type.
Definition: IOV.h:37
dd4hep::cond::ConditionsManager::iovTypesUsed
const std::vector< const IOVType * > iovTypesUsed() const
Access the used/registered IOV types.
Definition: ConditionsManager.cpp:209
dd4hep::Delta
Class describing an condition to re-adjust an alignment.
Definition: AlignmentData.h:38
DocumentHandler.h
_UC
#define _UC(x)
Definition: ConditionsTags.h:63
dd4hep::Translation3D
ROOT::Math::Translation3D Translation3D
Definition: Objects.h:119
ConditionsManagerObject.h
dd4hep::Condition
Main condition object handle.
Definition: Conditions.h:51
dd4hep::cond::ConditionsManager::from
static ConditionsManager from(T &host)
Static accessor if installed as an extension.
dd4hep::cond
Namespace for implementation details of the AIDA detector description toolkit.
Definition: ConditionsCleanup.h:23
dd4hep::cond::ConditionsContent
Conditions content object. Defines which conditions should be loaded by the ConditionsManager.
Definition: ConditionsContent.h:74
dd4hep::IOV
Class describing the interval of validty.
Definition: IOV.h:67
dd4hep::cond::ConditionsManager::prepare
Result prepare(const IOV &required_validity, ConditionsSlice &slice, ConditionUpdateUserContext *ctxt=0) const
Prepare all updates to the clients with the defined IOV.
Definition: ConditionsManager.cpp:289
dd4hep::Condition::TEMPERATURE
@ TEMPERATURE
Definition: Conditions.h:82
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::Condition::ALIGNMENT_DELTA
@ ALIGNMENT_DELTA
Definition: Conditions.h:86
dd4hep::AlignmentCondition::data
AlignmentData & data()
Data accessor for the use of decorators.
Definition: Alignments.cpp:157
dd4hep::align::Keys::deltaKey
static const Condition::itemkey_type deltaKey
Key value of a delta condition "alignment_delta".
Definition: Alignments.h:52
dd4hep::align::Keys::deltaName
static const std::string deltaName
Key name of a delta condition "alignment_delta".
Definition: Alignments.h:50
dd4hep::AlignmentData::delta
Delta delta
Alignment changes.
Definition: AlignmentData.h:116
dd4hep::cond::ConditionsManager::properties
PropertyManager & properties() const
Access to the property manager.
Definition: ConditionsManager.cpp:178
dd4hep::IOV::keyData
Key keyData
IOV key (if second==first, discrete, otherwise range)
Definition: IOV.h:82
dd4hep::xml
Namespace for the AIDA detector description toolkit supporting XML utilities.
Definition: ConditionsTags.h:27
dd4hep::cond::ConditionsXMLRepositoryWriter
Conditions slice object. Defines which conditions should be loaded by the ConditionsManager.
Definition: ConditionsRepositoryWriter.cpp:47
dd4hep::OpaqueData
Class describing an opaque data block.
Definition: OpaqueData.h:39
_U
#define _U(a)
Definition: Tags.h:23
dd4hep::cond::ConditionsXMLRepositoryWriter::~ConditionsXMLRepositoryWriter
virtual ~ConditionsXMLRepositoryWriter()
Default destructor.
Definition: ConditionsRepositoryWriter.cpp:262
dd4hep::Condition::get
T & get()
Generic getter. Specify the exact type, not a polymorph type.
Definition: Conditions.h:258
dd4hep::xml::DocumentHandler::defaultComment
static std::string defaultComment()
Default comment string.
Definition: DocumentHandler.cpp:630
dd4hep::cond::ConditionsXMLRepositoryWriter::ConditionsXMLRepositoryWriter
ConditionsXMLRepositoryWriter()=default
Default constructor.
dd4hep::xml::Handle_t::setText
void setText(const XmlChar *text) const
Set the element's text.
Definition: XMLElements.cpp:783
dd4hep::cond::ConditionsManager::Result::missing
size_t missing
Definition: ConditionsManager.h:64
dd4hep::Condition::key_type
unsigned long long int key_type
Forward definition of the key type.
Definition: Conditions.h:54
dd4hep::cond::ConditionsXMLRepositoryWriter::write
long write(xml::Document doc, const std::string &output) const
Write the XML document structure to a file.
Definition: ConditionsRepositoryWriter.cpp:430
dd4hep::OpaqueData::typeInfo
const std::type_info & typeInfo() const
Access type id of the condition.
Definition: OpaqueData.cpp:42
dd4hep::xml::Document
Class supporting the basic functionality of an XML document.
Definition: XMLElements.h:697
dd4hep::cond::ConditionsManager
Manager class for condition handles.
Definition: ConditionsManager.h:46
dd4hep::Position
ROOT::Math::XYZVector Position
Definition: Objects.h:81
DetFactoryHelper.h
dd4hep::cond::ConditionsSlice::pool
std::unique_ptr< UserPool > pool
Reference to the user pool managing all conditions of this slice.
Definition: ConditionsSlice.h:107
dd4hep::xml::DocumentHandler::output
virtual int output(Document doc, const std::string &fname) const
Write xml document to output file (stdout if file name empty)
Definition: DocumentHandler.cpp:396
key
unsigned char key
Definition: AlignmentsCalculator.cpp:69
dd4hep::cond::ConditionsManager::Result
Result of a prepare call to the conditions manager.
Definition: ConditionsManager.h:59
dd4hep::cond::ConditionsXMLRepositoryWriter::m_numConverted
long m_numConverted
Debug counters: converted conditions.
Definition: ConditionsRepositoryWriter.cpp:49
dd4hep::xml::DocumentHandler
Class supporting to read and parse XML documents.
Definition: DocumentHandler.h:39
dd4hep::PropertyManager
Manager to ease the handling of groups of properties.
Definition: ComponentProperties.h:174
dd4hep::PropertyManager::size
size_t size() const
Access total number of properties.
Definition: ComponentProperties.cpp:92
XMLElements.h
dd4hep::xml::Element
User abstraction class to manipulate XML elements within a document.
Definition: XMLElements.h:769
dd4hep::IOV::iovType
const IOVType * iovType
Reference to IOV type.
Definition: IOV.h:80
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::xml::Element::setAttr
Attribute setAttr(const XmlChar *nam, const T &val) const
Set single attribute.
Definition: XMLElements.h:900
dd4hep::Condition::ALIGNMENT_DERIVED
@ ALIGNMENT_DERIVED
Definition: Conditions.h:87
dd4hep::cond::fill_content
void fill_content(ConditionsManager mgr, ConditionsContent &content, const IOVType &typ)
Populate the conditions slice from the conditions manager (convenience)
Definition: ConditionsSlice.cpp:182
dd4hep::cond::ConditionsXMLRepositoryWriter::dump
xml::Document dump(ConditionsSlice &slice)
Dump the tree content into a XML document structure.
Definition: ConditionsRepositoryWriter.cpp:268
dd4hep::sim::hash
unsigned int hash(unsigned int initialSeed, unsigned int eventNumber, unsigned int runNumber)
calculate hash from initialSeed, eventID and runID
Definition: Geant4EventSeed.h:201
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::OpaqueData::dataType
const std::string & dataType() const
Access type name of the condition data block.
Definition: OpaqueData.cpp:50
dd4hep::cond::ConditionsManager::Result::computed
size_t computed
Definition: ConditionsManager.h:63
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::OpaqueData::str
std::string str() const
Create string representation of the data block.
Definition: OpaqueData.cpp:34
dd4hep::RotationZYX
ROOT::Math::RotationZYX RotationZYX
Definition: Objects.h:105
dd4hep::cond::ConditionsXMLRepositoryWriter::collect
size_t collect(xml::Element root, ConditionsSlice &slice, DetElement detector)
Dump the tree content into an existing XML document structure.
Definition: ConditionsRepositoryWriter.cpp:327
AlignmentsInterna.h
ConditionsTags.h
Printout.h
OpaqueDataBinder.h
dd4hep::cond::ConditionsXMLRepositoryWriter::ConditionsXMLRepositoryWriter
ConditionsXMLRepositoryWriter(const ConditionsXMLRepositoryWriter &copy)=default
Copy constructor (Special, partial copy only. Hence no assignment!)
AlignmentData.h
dd4hep::Condition::data
OpaqueDataBlock & data() const
Access the opaque data block.
Definition: Conditions.cpp:129
dd4hep::cond::ConditionsManager::Result::total
size_t total() const
Definition: ConditionsManager.h:68
dd4hep::cond::ConditionsSlice
Conditions slice object. Defines which conditions should be loaded by the ConditionsManager.
Definition: ConditionsSlice.h:53
dd4hep::xml::Element::addComment
void addComment(const XmlChar *text) const
Add comment node to the element.
Definition: XMLElements.cpp:1135
ConditionsProcessor.h
dd4hep::xml::Document::root
Handle_t root() const
Access the ROOT eleemnt of the DOM document.
Definition: XMLElements.cpp:1040