From 614081490e701e22e845ebf665ccccb96865f3d4 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Thu, 22 Sep 2016 09:16:18 +0200 Subject: [PATCH] Compiler errors --- DDAlign/include/DDAlign/AlignmentOperators.h | 18 ++--- .../include/DDAlign/GlobalAlignmentCache.h | 26 +++--- .../include/DDAlign/GlobalAlignmentWriter.h | 16 ++-- DDAlign/src/AlignmentOperators.cpp | 4 +- DDAlign/src/GlobalAlignmentCache.cpp | 58 +++++++------- DDAlign/src/GlobalAlignmentWriter.cpp | 26 +++--- DDAlign/src/plugins/AlignmentParser.cpp | 10 +-- DDAlign/src/plugins/AlignmentPlugins.cpp | 4 +- examples/Conditions/CMakeLists.txt | 31 ++++++++ examples/Conditions/xml/Sequence_1.xml | 20 +++++ examples/Conditions/xml/Sequence_2.xml | 12 +++ examples/Conditions/xml/SideB_conditions.xml | 18 +++++ examples/Conditions/xml/TPC.xml | 9 +++ examples/Conditions/xml/TPC_alignment.xml | 79 +++++++++++++++++++ examples/Conditions/xml/TPC_run_123456.xml | 7 ++ examples/Conditions/xml/TPC_run_234567.xml | 7 ++ examples/Conditions/xml/TPC_run_563543.xml | 7 ++ examples/Conditions/xml/TPC_run_filler.xml | 15 ++++ examples/Conditions/xml/examples.xml | 24 ++++++ examples/Conditions/xml/plugins.xml | 25 ++++++ 20 files changed, 335 insertions(+), 81 deletions(-) create mode 100644 examples/Conditions/CMakeLists.txt create mode 100644 examples/Conditions/xml/Sequence_1.xml create mode 100644 examples/Conditions/xml/Sequence_2.xml create mode 100644 examples/Conditions/xml/SideB_conditions.xml create mode 100644 examples/Conditions/xml/TPC.xml create mode 100644 examples/Conditions/xml/TPC_alignment.xml create mode 100644 examples/Conditions/xml/TPC_run_123456.xml create mode 100644 examples/Conditions/xml/TPC_run_234567.xml create mode 100644 examples/Conditions/xml/TPC_run_563543.xml create mode 100644 examples/Conditions/xml/TPC_run_filler.xml create mode 100644 examples/Conditions/xml/examples.xml create mode 100644 examples/Conditions/xml/plugins.xml diff --git a/DDAlign/include/DDAlign/AlignmentOperators.h b/DDAlign/include/DDAlign/AlignmentOperators.h index 9d6276c8a..080bfc449 100644 --- a/DDAlign/include/DDAlign/AlignmentOperators.h +++ b/DDAlign/include/DDAlign/AlignmentOperators.h @@ -17,7 +17,7 @@ // Framework include files #include "DD4hep/Alignments.h" #include "DD4hep/GlobalAlignment.h" -#include "DDAlign/AlignmentCache.h" +#include "DDAlign/GlobalAlignmentCache.h" /// Namespace for the AIDA detector description toolkit namespace DD4hep { @@ -33,15 +33,15 @@ namespace DD4hep { */ class AlignmentOperator { public: - typedef AlignmentStack::StackEntry Entry; - typedef AlignmentCache::Cache Cache; - typedef std::vector<Entry*> Entries; + typedef AlignmentStack::StackEntry Entry; + typedef GlobalAlignmentCache::Cache Cache; + typedef std::vector<Entry*> Entries; typedef std::map<std::string,std::pair<TGeoPhysicalNode*,Entry*> > Nodes; - AlignmentCache& cache; + GlobalAlignmentCache& cache; Nodes& nodes; public: /// Initializing functor constructor - AlignmentOperator(AlignmentCache& c, Nodes& n) : cache(c), nodes(n) {} + AlignmentOperator(GlobalAlignmentCache& c, Nodes& n) : cache(c), nodes(n) {} /// Insert alignment entry void insert(GlobalAlignment alignment) const; }; @@ -56,11 +56,11 @@ namespace DD4hep { public: const Entries& entries; /// Initializing functor constructor - AlignmentSelector(AlignmentCache& c, Nodes& n, const Entries& e) : AlignmentOperator(c,n), entries(e) {} + AlignmentSelector(GlobalAlignmentCache& c, Nodes& n, const Entries& e) : AlignmentOperator(c,n), entries(e) {} ~AlignmentSelector() { } const AlignmentSelector& reset() const { nodes.clear(); return *this; } /// Function callback for cache entries - void operator()(const AlignmentCache::Cache::value_type& e) const; + void operator()(const GlobalAlignmentCache::Cache::value_type& e) const; /// Function callback for entries void operator()(Entry* e) const; }; @@ -74,7 +74,7 @@ namespace DD4hep { template <typename T> class AlignmentActor : public AlignmentOperator { public: /// Initializing functor constructor - AlignmentActor(AlignmentCache& c, Nodes& n) : AlignmentOperator(c,n) { init(); } + AlignmentActor(GlobalAlignmentCache& c, Nodes& n) : AlignmentOperator(c,n) { init(); } void init() {} /// Function callback for entries void operator()(Nodes::value_type& e) const; diff --git a/DDAlign/include/DDAlign/GlobalAlignmentCache.h b/DDAlign/include/DDAlign/GlobalAlignmentCache.h index 5422b10ec..17e3471c0 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentCache.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentCache.h @@ -11,8 +11,8 @@ // Author : M.Frank // //========================================================================== -#ifndef DD4HEP_ALIGNMENT_ALIGNMENTCACHE_H -#define DD4HEP_ALIGNMENT_ALIGNMENTCACHE_H +#ifndef DD4HEP_ALIGNMENT_GLOBALALIGNMENTCACHE_H +#define DD4HEP_ALIGNMENT_GLOBALALIGNMENTCACHE_H // Framework include files #include "DD4hep/GlobalAlignment.h" @@ -26,7 +26,7 @@ namespace DD4hep { /// Forward declarations class AlignmentOperator; - class AlignmentCache; + class GlobalAlignmentCache; class AlignmentStack; /// Class caching all known alignment operations for one LCDD instance. @@ -38,7 +38,7 @@ namespace DD4hep { * \version 1.0 * \ingroup DD4HEP_ALIGN */ - class AlignmentCache { + class GlobalAlignmentCache { friend class LCDD; friend class AlignmentOperator; @@ -46,7 +46,7 @@ namespace DD4hep { typedef AlignmentStack Stack; typedef AlignmentStack::StackEntry Entry; typedef std::map<unsigned int, TGeoPhysicalNode*> Cache; - typedef std::map<std::string,AlignmentCache*> SubdetectorAlignments; + typedef std::map<std::string,GlobalAlignmentCache*> SubdetectorAlignments; protected: LCDD& m_lcdd; @@ -66,12 +66,12 @@ namespace DD4hep { protected: /// Default constructor initializing variables - AlignmentCache(LCDD& lcdd, const std::string& sdPath, bool top); + GlobalAlignmentCache(LCDD& lcdd, const std::string& sdPath, bool top); /// Default destructor - virtual ~AlignmentCache(); + virtual ~GlobalAlignmentCache(); /// Retrieve branch cache by name. If not present it will be created - AlignmentCache* subdetectorAlignments(const std::string& name); + GlobalAlignmentCache* subdetectorAlignments(const std::string& name); /// Population entry: Apply a complete stack of ordered alignments to the geometry structure void apply(AlignmentStack& stack); @@ -82,7 +82,7 @@ namespace DD4hep { public: /// Create and install a new instance tree - static AlignmentCache* install(LCDD& lcdd); + static GlobalAlignmentCache* install(LCDD& lcdd); /// Unregister and delete a tree instance static void uninstall(LCDD& lcdd); /// Add reference count @@ -94,13 +94,13 @@ namespace DD4hep { /// Close existing transaction stack and apply all alignments void commit(AlignmentStack& stack); /// Retrieve the cache section corresponding to the path of an entry. - AlignmentCache* section(const std::string& path_name) const; + GlobalAlignmentCache* section(const std::string& path_name) const; /// Retrieve an alignment entry by its lacement path GlobalAlignment get(const std::string& path) const; /// Return all entries matching a given path. Careful: Expensive operaton! std::vector<GlobalAlignment> matches(const std::string& path_match, bool exclude_exact=false) const; }; - } /* End namespace Alignments */ -} /* End namespace DD4hep */ -#endif /* DD4HEP_ALIGNMENT_ALIGNMENTCACHE_H */ + } /* End namespace Alignments */ +} /* End namespace DD4hep */ +#endif /* DD4HEP_ALIGNMENT_GLOBALALIGNMENTCACHE_H */ diff --git a/DDAlign/include/DDAlign/GlobalAlignmentWriter.h b/DDAlign/include/DDAlign/GlobalAlignmentWriter.h index 43d36dc12..632039de3 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentWriter.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentWriter.h @@ -11,8 +11,8 @@ // Author : M.Frank // //========================================================================== -#ifndef DD4HEP_DDALIGN_ALIGNMENTWRITER_H -#define DD4HEP_DDALIGN_ALIGNMENTWRITER_H +#ifndef DD4HEP_DDALIGN_GLOBALALIGNMENTWRITER_H +#define DD4HEP_DDALIGN_GLOBALALIGNMENTWRITER_H // Framework include files #include "XML/XMLElements.h" @@ -26,7 +26,7 @@ namespace DD4hep { namespace Alignments { // Forward declarations - class AlignmentCache; + class GlobalAlignmentCache; /// Write aligment data to XML data file /** @@ -34,21 +34,21 @@ namespace DD4hep { * \version 1.0 * \ingroup DD4HEP_ALIGN */ - class AlignmentWriter { + class GlobalAlignmentWriter { protected: /// Reference to detector description LCDD& m_lcdd; /// Reference to the alignment cache - AlignmentCache* m_cache; + GlobalAlignmentCache* m_cache; /// Add single alignment node to the XML document void addNode(XML::Element elt, GlobalAlignment a) const; public: /// Initializing Constructor - AlignmentWriter(LCDD& lcdd); + GlobalAlignmentWriter(LCDD& lcdd); /// Standard destructor - virtual ~AlignmentWriter(); + virtual ~GlobalAlignmentWriter(); /// Dump one full DetElement subtree into a newly created document XML::Document dump(DetElement element, bool enable_transactions=false) const; @@ -61,5 +61,5 @@ namespace DD4hep { }; } // End namespace XML } // End namespace DD4hep -#endif // DD4HEP_DDALIGN_ALIGNMENTWRITER_H +#endif // DD4HEP_DDALIGN_GLOBALALIGNMENTWRITER_H diff --git a/DDAlign/src/AlignmentOperators.cpp b/DDAlign/src/AlignmentOperators.cpp index f4fefaa3c..05a4aac78 100644 --- a/DDAlign/src/AlignmentOperators.cpp +++ b/DDAlign/src/AlignmentOperators.cpp @@ -57,13 +57,13 @@ void AlignmentSelector::operator()(const Cache::value_type& entry) const { } template <> void AlignmentActor<DDAlign_standard_operations::node_print>::init() { - printout(ALWAYS,"AlignmentCache","++++++++++++++++++++++++ Summary ++++++++++++++++++++++++"); + printout(ALWAYS,"GlobalAlignmentCache","++++++++++++++++++++++++ Summary ++++++++++++++++++++++++"); } template <> void AlignmentActor<DDAlign_standard_operations::node_print>::operator()(Nodes::value_type& n) const { TGeoPhysicalNode* p = n.second.first; Entry* e = n.second.second; - printout(ALWAYS,"AlignmentCache","Need to reset entry:%s - %s [needsReset:%s, hasMatrix:%s]", + printout(ALWAYS,"GlobalAlignmentCache","Need to reset entry:%s - %s [needsReset:%s, hasMatrix:%s]", p->GetName(),e->path.c_str(),yes_no(e->needsReset()),yes_no(e->hasMatrix())); } diff --git a/DDAlign/src/GlobalAlignmentCache.cpp b/DDAlign/src/GlobalAlignmentCache.cpp index d3fc53c43..a8ceb60ad 100644 --- a/DDAlign/src/GlobalAlignmentCache.cpp +++ b/DDAlign/src/GlobalAlignmentCache.cpp @@ -15,7 +15,7 @@ // Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" -#include "DDAlign/AlignmentCache.h" +#include "DDAlign/GlobalAlignmentCache.h" #include "DDAlign/AlignmentOperators.h" #include "DD4hep/objects/DetectorInterna.h" @@ -41,29 +41,29 @@ DetElement _detector(DetElement child) { } /// Default constructor -AlignmentCache::AlignmentCache(LCDD& lcdd, const string& sdPath, bool top) +GlobalAlignmentCache::GlobalAlignmentCache(LCDD& lcdd, const string& sdPath, bool top) : m_lcdd(lcdd), m_sdPath(sdPath), m_sdPathLen(sdPath.length()), m_refCount(1), m_top(top) { } /// Default destructor -AlignmentCache::~AlignmentCache() { +GlobalAlignmentCache::~GlobalAlignmentCache() { int nentries = (int)m_cache.size(); int nsect = (int)m_detectors.size(); releaseObjects(m_detectors); m_cache.clear(); - printout(INFO,"AlignmentCache", + printout(INFO,"GlobalAlignmentCache", "Destroy cache for subdetector %s [%d section(s), %d entrie(s)]", m_sdPath.c_str(),nsect,nentries); } /// Add reference count -int AlignmentCache::addRef() { +int GlobalAlignmentCache::addRef() { return ++m_refCount; } /// Release object. If reference count goes to NULL, automatic deletion is triggered. -int AlignmentCache::release() { +int GlobalAlignmentCache::release() { int value = --m_refCount; if ( value == 0 ) { delete this; @@ -72,27 +72,27 @@ int AlignmentCache::release() { } /// Create and install a new instance tree -AlignmentCache* AlignmentCache::install(LCDD& lcdd) { - AlignmentCache* cache = lcdd.extension<AlignmentCache>(false); +GlobalAlignmentCache* GlobalAlignmentCache::install(LCDD& lcdd) { + GlobalAlignmentCache* cache = lcdd.extension<GlobalAlignmentCache>(false); if ( !cache ) { - lcdd.addExtension<AlignmentCache>(new AlignmentCache(lcdd,"world",true)); + lcdd.addExtension<GlobalAlignmentCache>(new GlobalAlignmentCache(lcdd,"world",true)); } return cache; } /// Unregister and delete a tree instance -void AlignmentCache::uninstall(LCDD& lcdd) { - if ( lcdd.extension<AlignmentCache>(false) ) { - lcdd.removeExtension<AlignmentCache>(true); +void GlobalAlignmentCache::uninstall(LCDD& lcdd) { + if ( lcdd.extension<GlobalAlignmentCache>(false) ) { + lcdd.removeExtension<GlobalAlignmentCache>(true); } } /// Add a new entry to the cache. The key is the placement path -bool AlignmentCache::insert(GlobalAlignment alignment) { +bool GlobalAlignmentCache::insert(GlobalAlignment alignment) { TGeoPhysicalNode* pn = alignment.ptr(); unsigned int index = hash32(pn->GetName()+m_sdPathLen); Cache::const_iterator i = m_cache.find(index); - printout(ALWAYS,"AlignmentCache","Section: %s adding entry: %s", + printout(ALWAYS,"GlobalAlignmentCache","Section: %s adding entry: %s", name().c_str(),alignment->GetName()); if ( i == m_cache.end() ) { m_cache[index] = pn; @@ -102,13 +102,13 @@ bool AlignmentCache::insert(GlobalAlignment alignment) { } /// Retrieve the cache section corresponding to the path of an entry. -AlignmentCache* AlignmentCache::section(const string& path_name) const { +GlobalAlignmentCache* GlobalAlignmentCache::section(const string& path_name) const { size_t idx, idq; if ( path_name[0] != '/' ) { return section(m_lcdd.world().placementPath()+'/'+path_name); } else if ( (idx=path_name.find('/',1)) == string::npos ) { - return (m_sdPath == path_name.c_str()+1) ? (AlignmentCache*)this : 0; + return (m_sdPath == path_name.c_str()+1) ? (GlobalAlignmentCache*)this : 0; } else if ( m_detectors.empty() ) { return 0; @@ -120,7 +120,7 @@ AlignmentCache* AlignmentCache::section(const string& path_name) const { } /// Retrieve an alignment entry by its placement path -GlobalAlignment AlignmentCache::get(const string& path_name) const { +GlobalAlignment GlobalAlignmentCache::get(const string& path_name) const { size_t idx, idq; unsigned int index = hash32(path_name.c_str()+m_sdPathLen); Cache::const_iterator i = m_cache.find(index); @@ -145,9 +145,9 @@ GlobalAlignment AlignmentCache::get(const string& path_name) const { } /// Return all entries matching a given path. -vector<GlobalAlignment> AlignmentCache::matches(const string& match, bool exclude_exact) const { +vector<GlobalAlignment> GlobalAlignmentCache::matches(const string& match, bool exclude_exact) const { vector<GlobalAlignment> result; - AlignmentCache* c = section(match); + GlobalAlignmentCache* c = section(match); if ( c ) { size_t len = match.length(); result.reserve(c->m_cache.size()); @@ -164,7 +164,7 @@ vector<GlobalAlignment> AlignmentCache::matches(const string& match, bool exclud } /// Close existing transaction stack and apply all alignments -void AlignmentCache::commit(AlignmentStack& stack) { +void GlobalAlignmentCache::commit(AlignmentStack& stack) { TGeoManager& mgr = m_lcdd.manager(); mgr.UnlockGeometry(); apply(stack); @@ -172,10 +172,10 @@ void AlignmentCache::commit(AlignmentStack& stack) { } /// Retrieve branch cache by name. If not present it will be created -AlignmentCache* AlignmentCache::subdetectorAlignments(const string& nam) { +GlobalAlignmentCache* GlobalAlignmentCache::subdetectorAlignments(const string& nam) { SubdetectorAlignments::const_iterator i = m_detectors.find(nam); if ( i == m_detectors.end() ) { - AlignmentCache* ptr = new AlignmentCache(m_lcdd,nam,false); + GlobalAlignmentCache* ptr = new GlobalAlignmentCache(m_lcdd,nam,false); m_detectors.insert(make_pair(nam,ptr)); return ptr; } @@ -183,7 +183,7 @@ AlignmentCache* AlignmentCache::subdetectorAlignments(const string& nam) { } /// Apply a complete stack of ordered alignments to the geometry structure -void AlignmentCache::apply(AlignmentStack& stack) { +void GlobalAlignmentCache::apply(AlignmentStack& stack) { typedef map<string,DetElement> DetElementUpdates; typedef map<DetElement,vector<Entry*> > sd_entries_t; TGeoManager& mgr = m_lcdd.manager(); @@ -200,12 +200,12 @@ void AlignmentCache::apply(AlignmentStack& stack) { } for(sd_entries_t::iterator i=all.begin(); i!=all.end(); ++i) { DetElement det((*i).first); - AlignmentCache* sd_cache = subdetectorAlignments(det.placement().name()); + GlobalAlignmentCache* sd_cache = subdetectorAlignments(det.placement().name()); sd_cache->apply( (*i).second ); (*i).second.clear(); } - printout(INFO,"AlignmentCache","Alignments were applied. Refreshing physical nodes...."); + printout(INFO,"GlobalAlignmentCache","Alignments were applied. Refreshing physical nodes...."); mgr.GetCurrentNavigator()->ResetAll(); mgr.GetCurrentNavigator()->BuildCache(); mgr.RefreshPhysicalNodes(); @@ -213,7 +213,7 @@ void AlignmentCache::apply(AlignmentStack& stack) { // Provide update callback for every detector element with a changed placement for(DetElementUpdates::iterator i=detelt_updates.begin(); i!=detelt_updates.end(); ++i) { DetElement elt((*i).second); - printout(DEBUG,"AlignmentCache","+++ Trigger placement update for %s [2]",elt.path().c_str()); + printout(DEBUG,"GlobalAlignmentCache","+++ Trigger placement update for %s [2]",elt.path().c_str()); elt->update(DetElement::PLACEMENT_CHANGED|DetElement::PLACEMENT_ELEMENT,elt.ptr()); } // Provide update callback for the highest detector element @@ -222,7 +222,7 @@ void AlignmentCache::apply(AlignmentStack& stack) { const string& path = (*i).first; if ( path.find(last_path) == string::npos ) { DetElement elt((*i).second); - printout(DEBUG,"AlignmentCache","+++ Trigger placement update for %s [1]",elt.path().c_str()); + printout(DEBUG,"GlobalAlignmentCache","+++ Trigger placement update for %s [1]",elt.path().c_str()); elt->update(DetElement::PLACEMENT_CHANGED|DetElement::PLACEMENT_HIGHEST,elt.ptr()); last_path = (*i).first; } @@ -230,13 +230,13 @@ void AlignmentCache::apply(AlignmentStack& stack) { // Provide update callback at the detector level for(sd_entries_t::iterator i=all.begin(); i!=all.end(); ++i) { DetElement elt((*i).first); - printout(DEBUG,"AlignmentCache","+++ Trigger placement update for %s [0]",elt.path().c_str()); + printout(DEBUG,"GlobalAlignmentCache","+++ Trigger placement update for %s [0]",elt.path().c_str()); elt->update(DetElement::PLACEMENT_CHANGED|DetElement::PLACEMENT_DETECTOR,elt.ptr()); } } /// Apply a vector of SD entries of ordered alignments to the geometry structure -void AlignmentCache::apply(const vector<Entry*>& changes) { +void GlobalAlignmentCache::apply(const vector<Entry*>& changes) { typedef map<string,pair<TGeoPhysicalNode*,Entry*> > Nodes; Nodes nodes; AlignmentSelector selector(*this,nodes,changes); diff --git a/DDAlign/src/GlobalAlignmentWriter.cpp b/DDAlign/src/GlobalAlignmentWriter.cpp index 3b5aae1b6..d6b921601 100644 --- a/DDAlign/src/GlobalAlignmentWriter.cpp +++ b/DDAlign/src/GlobalAlignmentWriter.cpp @@ -13,16 +13,16 @@ //========================================================================== // Framework includes -#include "DDAlign/AlignmentWriter.h" +#include "DDAlign/GlobalAlignmentWriter.h" +#include "DDAlign/GlobalAlignmentCache.h" +#include "DDAlign/GlobalDetectorAlignment.h" +#include "DDAlign/AlignmentTags.h" #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" #include "DD4hep/MatrixHelpers.h" #include "DD4hep/objects/DetectorInterna.h" #include "XML/DocumentHandler.h" -#include "DDAlign/AlignmentTags.h" -#include "DDAlign/AlignmentCache.h" -#include "DDAlign/GlobalDetectorAlignment.h" #include "TGeoMatrix.h" @@ -36,20 +36,20 @@ using namespace DD4hep; using namespace std; /// Initializing Constructor -AlignmentWriter::AlignmentWriter(LCDD& lcdd) +GlobalAlignmentWriter::GlobalAlignmentWriter(LCDD& lcdd) : m_lcdd(lcdd) { - m_cache = lcdd.extension<Alignments::AlignmentCache>(); + m_cache = lcdd.extension<Alignments::GlobalAlignmentCache>(); if ( m_cache ) m_cache->addRef(); } /// Standard destructor -AlignmentWriter::~AlignmentWriter() { +GlobalAlignmentWriter::~GlobalAlignmentWriter() { if ( m_cache ) m_cache->release(); } /// Create the element corresponding to one single detector element without children -XML::Element AlignmentWriter::createElement(XML::Document doc, DetElement element) const { +XML::Element GlobalAlignmentWriter::createElement(XML::Document doc, DetElement element) const { XML::Element e(0), placement(0), elt = XML::Element(doc,_ALU(detelement)); string path = element.placementPath(); GlobalAlignment a = element->global_alignment; @@ -70,7 +70,7 @@ XML::Element AlignmentWriter::createElement(XML::Document doc, DetElement elemen } /// Add single alignment node to the XML document -void AlignmentWriter::addNode(XML::Element elt, GlobalAlignment a) const { +void GlobalAlignmentWriter::addNode(XML::Element elt, GlobalAlignment a) const { TGeoNode* n = a->GetNode(); TGeoHMatrix mat(a->GetOriginalMatrix()->Inverse()); mat.Multiply(n->GetMatrix()); @@ -79,7 +79,7 @@ void AlignmentWriter::addNode(XML::Element elt, GlobalAlignment a) const { placement.setAttr(_ALU(placement),a->GetName()); elt.append(placement); - printout(INFO,"AlignmentWriter","Write Delta constants for %s",a->GetName()); + printout(INFO,"GlobalAlignmentWriter","Write Delta constants for %s",a->GetName()); //mat.Print(); if ( fabs(t[0]) > numeric_limits<double>::epsilon() || fabs(t[1]) > numeric_limits<double>::epsilon() || @@ -108,7 +108,7 @@ void AlignmentWriter::addNode(XML::Element elt, GlobalAlignment a) const { } /// Scan a DetElement subtree and add on the fly the XML entries -XML::Element AlignmentWriter::scan(XML::Document doc, DetElement element) const { +XML::Element GlobalAlignmentWriter::scan(XML::Document doc, DetElement element) const { XML::Element elt(0); if ( element.isValid() ) { const DetElement::Children& c = element.children(); @@ -125,7 +125,7 @@ XML::Element AlignmentWriter::scan(XML::Document doc, DetElement element) const } /// Dump the tree content into a XML document structure -XML::Document AlignmentWriter::dump(DetElement top, bool enable_transactions) const { +XML::Document GlobalAlignmentWriter::dump(DetElement top, bool enable_transactions) const { const char comment[] = "\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" " ++++ DD4hep generated alignment file using the ++++\n" @@ -148,7 +148,7 @@ XML::Document AlignmentWriter::dump(DetElement top, bool enable_transactions) c } /// Write the XML document structure to a file. -long AlignmentWriter::write(XML::Document doc, const string& output) const { +long GlobalAlignmentWriter::write(XML::Document doc, const string& output) const { XML::DocumentHandler docH; return docH.output(doc, output); } diff --git a/DDAlign/src/plugins/AlignmentParser.cpp b/DDAlign/src/plugins/AlignmentParser.cpp index 932c5c588..ae840d820 100644 --- a/DDAlign/src/plugins/AlignmentParser.cpp +++ b/DDAlign/src/plugins/AlignmentParser.cpp @@ -25,7 +25,7 @@ #include "DDAlign/AlignmentTags.h" #include "DDAlign/AlignmentStack.h" -#include "DDAlign/AlignmentCache.h" +#include "DDAlign/GlobalAlignmentCache.h" #include "DDAlign/GlobalDetectorAlignment.h" // C/C++ include files @@ -344,18 +344,18 @@ static long setup_Alignment(lcdd_t& lcdd, const xml_h& e) { bool open_trans = e.hasChild(_ALU(close_transaction)); bool close_trans = e.hasChild(_ALU(close_transaction)); - AlignmentCache::install(lcdd); + GlobalAlignmentCache::install(lcdd); /// Check if transaction already present. If not, open, else issue an error if ( open_trans ) { if ( AlignmentStack::exists() ) { - except("AlignmentCache","Request to open a second alignment transaction stack -- not allowed!"); + except("GlobalAlignment","Request to open a second alignment transaction stack -- not allowed!"); } AlignmentStack::create(); } AlignmentStack& stack = AlignmentStack::get(); (DD4hep::Converter<DD4hep::alignment>(lcdd,lcdd.world().ptr(),&stack))(e); if ( close_trans ) { - AlignmentCache* cache = lcdd.extension<Alignments::AlignmentCache>(); + GlobalAlignmentCache* cache = lcdd.extension<Alignments::GlobalAlignmentCache>(); cache->commit(stack); AlignmentStack::get().release(); } @@ -376,7 +376,7 @@ DECLARE_XML_DOC_READER(global_alignment,setup_Alignment) * @date 01/04/2014 */ static long install_Alignment(lcdd_t& lcdd, int, char**) { - AlignmentCache::install(lcdd); + GlobalAlignmentCache::install(lcdd); return 1; } DECLARE_APPLY(DD4hep_GlobalAlignmentInstall,install_Alignment) diff --git a/DDAlign/src/plugins/AlignmentPlugins.cpp b/DDAlign/src/plugins/AlignmentPlugins.cpp index 3fefd1e62..adb146a80 100644 --- a/DDAlign/src/plugins/AlignmentPlugins.cpp +++ b/DDAlign/src/plugins/AlignmentPlugins.cpp @@ -39,7 +39,7 @@ namespace { DECLARE_APPLY(DD4hep_AlignmentsManagerInstaller,ddalign_install_align_mgr) // ====================================================================================== -#include "DDAlign/AlignmentWriter.h" +#include "DDAlign/GlobalAlignmentWriter.h" namespace { namespace DetectorTools = DD4hep::Geometry::DetectorTools; long create_global_alignment_file(Geometry::LCDD& lcdd, int argc, char** argv) { @@ -64,7 +64,7 @@ namespace { path.c_str(), output.c_str()); top = DetectorTools::findDaughterElement(lcdd.world(),path); if ( top.isValid() ) { - AlignmentWriter wr(lcdd); + GlobalAlignmentWriter wr(lcdd); return wr.write(wr.dump(top,enable_transactions), output); } throw std::runtime_error("AlignmentWriter: Invalid top level element name:"+path); diff --git a/examples/Conditions/CMakeLists.txt b/examples/Conditions/CMakeLists.txt new file mode 100644 index 000000000..05bad5ed3 --- /dev/null +++ b/examples/Conditions/CMakeLists.txt @@ -0,0 +1,31 @@ +# $Id: $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== +cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) +include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) + +#----------------------------------------------------------------------------------- +dd4hep_configure_output () +dd4hep_package ( CLICSiD MAJOR 0 MINOR 0 PATCH 1 + USES [ROOT REQUIRED COMPONENTS Geom] + [DD4hep REQUIRED COMPONENTS DDCore] +) +dd4hep_install_dir( xml DESTINATION ${DD4hep_DIR}/examples/Conditions ) +#-------------------------------------------------------------------------- +#if (DD4HEP_USE_GEANT4) +# dd4hep_add_executable(CLICSiDXML SOURCES scripts/CLICSiDXML.C +# USES [DD4hep REQUIRED COMPONENTS DDG4] GEANT4 ) +# #-------------------------------------------------------------------------- +# dd4hep_add_executable(CLICSiDAClick SOURCES scripts/CLICSiDAClick.C +# USES [DD4hep REQUIRED COMPONENTS DDG4] GEANT4 ) +#endif() +# +dd4hep_configure_scripts ( Conditions DEFAULT_SETUP WITH_TESTS ) diff --git a/examples/Conditions/xml/Sequence_1.xml b/examples/Conditions/xml/Sequence_1.xml new file mode 100644 index 000000000..d661d9afd --- /dev/null +++ b/examples/Conditions/xml/Sequence_1.xml @@ -0,0 +1,20 @@ +<plugins> + + <plugin name="DD4hepXMLLoader"> + <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC.xml"/> + </plugin> + + <plugin name="DD4hepVolumeManager"/> + <plugin name="DD4hepConditionsManagerInstaller"/> + + <plugin name="DD4hepXMLLoader"> + <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_alignment.xml"/> + </plugin> + <plugin name="DD4hepXMLLoader"> + <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_reset.xml"/> + </plugin> + + <plugin name="DD4hep_Test_CallbackInstall"/> + <plugin name="DD4hep_Test_ConditionsAccess"/> + <plugin name="DD4hep_Test_ConditionsTreeDump"/> +</plugins> diff --git a/examples/Conditions/xml/Sequence_2.xml b/examples/Conditions/xml/Sequence_2.xml new file mode 100644 index 000000000..e264937e8 --- /dev/null +++ b/examples/Conditions/xml/Sequence_2.xml @@ -0,0 +1,12 @@ +<plugins> + + <plugin name="DD4hepXMLLoader"> + <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC.xml"/> + </plugin> + + <plugin name="DD4hepVolumeManager"/> + <plugin name="DD4hepConditionsManagerInstaller"/> + <plugin name="DD4hep_Test_CallbackInstall"/> + <plugin name="DD4hep_Test_ConditionsExample3"/> + +</plugins> diff --git a/examples/Conditions/xml/SideB_conditions.xml b/examples/Conditions/xml/SideB_conditions.xml new file mode 100644 index 000000000..e6cc9e422 --- /dev/null +++ b/examples/Conditions/xml/SideB_conditions.xml @@ -0,0 +1,18 @@ + +<conditions> + <detelement path="TPC/TPC_SideB" name="ambience" validity="1396887257,1396887257#epoch"> + <alignment ref="SideB_aligments.xml" validity="563543#run"/> + <temperature name="AmbientTemperature" value="20.9*kelvin"/> + <pressure name="ExternalPressure" value="980*hPa"/> + <whatever name="SomeMultiParams" validity="563543#run">[0.0, 1.0, 2.0, 3.0]</whatever> + + <detelement path="TPC_SideB_sector08" name="ambience" validity="1396887257,1396887257#epoch"> + <temperature name="AmbientTemperature" value="20.9*kelvin"/> + <pressure name="ExternalPressure" value="980*hPa"/> + </detelement> + <detelement path="TPC_SideB_sector09" name="ambience" validity="1396887257,1396887257#epoch"> + <temperature name="AmbientTemperature" value="20.9*kelvin"/> + </detelement> + + </detelement> +</conditions> diff --git a/examples/Conditions/xml/TPC.xml b/examples/Conditions/xml/TPC.xml new file mode 100644 index 000000000..fd5ca8aae --- /dev/null +++ b/examples/Conditions/xml/TPC.xml @@ -0,0 +1,9 @@ +<conditions> + <detelement path="TPC" name="ambience" validity="1396887257,1396887257#epoch"> + <temperature name="AmbientTemperature" value="20.9*kelvin"/> + <pressure name="ExternalPressure" value="980*hPa"/> + <whatever name="SomeMultiParams" validity="1396887257,1396887257#epoch">[0.0, 1.0, 2.0, 3.0]</whatever> + </detelement> + + <include ref="SideB_conditions.xml"/> +</conditions> diff --git a/examples/Conditions/xml/TPC_alignment.xml b/examples/Conditions/xml/TPC_alignment.xml new file mode 100644 index 000000000..c7181f69d --- /dev/null +++ b/examples/Conditions/xml/TPC_alignment.xml @@ -0,0 +1,79 @@ +<alignment> + + <open_transaction/> + <subdetectors> + <!-- + Note: The subdetector name MUST be in the list of top level + detector elements attached to the LCDD structure. + +A generic alignment transformation is defined by +- a translation in 3D space identified in XML as a +<position/> element +- a rotation in 3D space around a pivot point specified in XML by +2 elements: the <rotation/> and the <pivot/> element. +The specification of any of the elements is optional: +- The absence of a translation implies the origin (0,0,0) +- The absence of a pivot point implies the origin (0,0,0) +- The absence of a rotation implies the identity rotation. +Any supplied pivot point in this case is ignored. + +<position x="30" y="30" z="80"/> + + --> + + <detelement path="TPC" reset="true" reset_children="true"> + <comment ref="Move the entire TPC in the world volume."/> + <position x="0" y="0" z="0*mm"/> + <rotation x="0" y="0" z="0"/> + + <comment ref="Twist a bit the entire endcap A"/> + <detelement path="/world/TPC/TPC_SideA" check_overlaps="false"> + <position x="0" y="0" z="-500*mm"/> + <rotation x="-0.2" y="-0.2" z="0"/> + + <comment ref="A detector element relative to the parent"/> + <detelement path="TPC_SideA_sector02" check_overlaps="true"> + <position x="0" y="0" z="0"/> + <rotation x="0.5" y="0.1" z="0.2"/> + </detelement> + </detelement> + + <detelement path="TPC_SideA/TPC_SideA_sector03" check_overlaps="true"> + <position x="0" y="0" z="290.0*mm"/> + <rotation x="0" y="pi/2" z="0"/> + <pivot x="0" y="0" z="100"/> + <volume path="TPC_sector_K_layer2_2"> + <position x="0" y="0" z="0.0001*mm"/> + <rotation x="0" y="0.5" z="0"/> + </volume> + </detelement> + + <detelement path="TPC_SideA/TPC_SideA_sector05" check_overlaps="false"> + <position x="0" y="0" z="150.0*mm"/> + <rotation x="0" y="0" z="0"/> + </detelement> + + <detelement path="TPC_SideA/TPC_SideA_sector10" check_overlaps="false"> + <position x="0" y="0" z="450.0*mm"/> + <rotation x="0" y="0" z="pi/4"/> + </detelement> + + <comment ref="Twist a bit the entire endcap B"/> + <detelement path="TPC_SideB" check_overlaps="false"> + <position x="0" y="0" z="0"/> + <rotation x="0" y="0" z="0"/> + + <comment ref="A detector element relative to the parent"/> + <detelement path="TPC_SideB_sector02" check_overlaps="true"> + <position x="0" y="0" z="0"/> + <rotation x="0.5" y="0.1" z="0.2"/> + </detelement> + </detelement> <comment ref="end: TPC side B"/> +<!-- +--> + </detelement> <!-- end: TPC --> + + </subdetectors> + + <close_transaction/> +</alignment> diff --git a/examples/Conditions/xml/TPC_run_123456.xml b/examples/Conditions/xml/TPC_run_123456.xml new file mode 100644 index 000000000..07b353a70 --- /dev/null +++ b/examples/Conditions/xml/TPC_run_123456.xml @@ -0,0 +1,7 @@ +<conditions> + <detelement path="TPC" name="ambience"> + <alignment ref="TPC_Alignment.xml" validity="123456#run"/> + <alignment path="TPC_SideA" ref="TPC_SideA_Alignment.xml" validity="123456#run"/> + <alignment name="TPC_A_align" ref="TPC_SideA_Alignment.xml" validity="123456#run"/> + </detelement> +</conditions> diff --git a/examples/Conditions/xml/TPC_run_234567.xml b/examples/Conditions/xml/TPC_run_234567.xml new file mode 100644 index 000000000..f2579945b --- /dev/null +++ b/examples/Conditions/xml/TPC_run_234567.xml @@ -0,0 +1,7 @@ +<conditions> + <detelement path="TPC" name="ambience"> + <alignment ref="TPC_Alignment.xml" validity="234567#run"/> + <alignment path="TPC_SideA" ref="TPC_SideA_Alignment.xml" validity="234567#run"/> + <alignment name="TPC_A_align" ref="TPC_SideA_Alignment.xml" validity="234567#run"/> + </detelement> +</conditions> diff --git a/examples/Conditions/xml/TPC_run_563543.xml b/examples/Conditions/xml/TPC_run_563543.xml new file mode 100644 index 000000000..0a6d9cfd8 --- /dev/null +++ b/examples/Conditions/xml/TPC_run_563543.xml @@ -0,0 +1,7 @@ +<conditions> + <detelement path="TPC" name="ambience"> + <alignment ref="TPC_Alignment.xml" validity="563543#run"/> + <alignment path="TPC_SideA" ref="TPC_SideA_Alignment.xml" validity="563543#run"/> + <alignment name="TPC_A_align" ref="TPC_SideA_Alignment.xml" validity="563543#run"/> + </detelement> +</conditions> diff --git a/examples/Conditions/xml/TPC_run_filler.xml b/examples/Conditions/xml/TPC_run_filler.xml new file mode 100644 index 000000000..ed0f94b9f --- /dev/null +++ b/examples/Conditions/xml/TPC_run_filler.xml @@ -0,0 +1,15 @@ +<conditions> + <detelement path="TPC" name="ambience"> + <alignment ref="TPC_Alignment.xml" validity="123457,234566#run"/> + <alignment path="TPC_SideA" ref="TPC_SideA_Alignment.xml" validity="123457,234566#run"/> + <alignment name="TPC_A_align" ref="TPC_SideA_Alignment.xml" validity="123457,234566#run"/> + + <alignment ref="TPC_Alignment.xml" validity="234568,563542#run"/> + <alignment path="TPC_SideA" ref="TPC_SideA_Alignment.xml" validity="234568,563542#run"/> + <alignment name="TPC_A_align" ref="TPC_SideA_Alignment.xml" validity="234568,563542#run"/> + + <alignment ref="TPC_Alignment.xml" validity="563544,999999#run"/> + <alignment path="TPC_SideA" ref="TPC_SideA_Alignment.xml" validity="563544,999999#run"/> + <alignment name="TPC_A_align" ref="TPC_SideA_Alignment.xml" validity="563544,999999#run"/> + </detelement> +</conditions> diff --git a/examples/Conditions/xml/examples.xml b/examples/Conditions/xml/examples.xml new file mode 100644 index 000000000..15d2f3087 --- /dev/null +++ b/examples/Conditions/xml/examples.xml @@ -0,0 +1,24 @@ +<conditions> + <open_transaction/> + <detelement path="TPC" name="ambience" validity="1396887257,1396887257#epoch"> + <alignment validity="563543#run"/> + <alignment path="TPC_SideA" validity="563543#run"/> + <temperature name="AmbientTemperature" value="20.9*kelvin"/> + <pressure name="ExternalPressure" value="980*hPa"/> + <whatever name="SomeMultiParams" validity="563543#run">[0.0, 1.0, 2.0, 3.0]</whatever> + +<!-- + <gains> + <gain/> + </gains> +--> + +<!-- + <include ref=""/> +--> + </detelement> + + <include ref="SideB_conditions.xml"/> + <close_transaction/> + +</conditions> diff --git a/examples/Conditions/xml/plugins.xml b/examples/Conditions/xml/plugins.xml new file mode 100644 index 000000000..ff25edf35 --- /dev/null +++ b/examples/Conditions/xml/plugins.xml @@ -0,0 +1,25 @@ +<plugins> + + <plugin name="DD4hepXMLLoader"> + <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC.xml"/> + </plugin> + + <plugin name="DD4hepVolumeManager"/> + <plugin name="DD4hepConditionsManagerInstaller"/> + + <plugin name="DD4hepXMLLoader"> + <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_alignment.xml"/> + </plugin> + <plugin name="DD4hepXMLLoader"> + <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_reset.xml"/> + </plugin> + + <plugin name="DD4hep_Test_CallbackInstallTest"/> + +<!-- + <plugin name="DD4hep_Test_ConditionsAccess"/> + <plugin name="DD4hep_Test_ConditionsTreeDump"/> +--> + <plugin name="DD4hepExample3"/> + +</plugins> -- GitLab