DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
GlobalAlignmentCache.h
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 DDALIGN_GLOBALALIGNMENTCACHE_H
14 #define DDALIGN_GLOBALALIGNMENTCACHE_H
15 
16 // Framework include files
17 #include <DD4hep/ExtensionEntry.h>
18 #include <DD4hep/GlobalAlignment.h>
20 
22 namespace dd4hep {
23 
25  namespace align {
26 
28  class GlobalAlignmentOperator;
29  class GlobalAlignmentCache;
30  class GlobalAlignmentStack;
31 
33 
42  friend class dd4hep::Detector;
45 
46  public:
49  typedef std::map<unsigned int, TGeoPhysicalNode*> Cache;
50  typedef std::map<std::string,GlobalAlignmentCache*> SubdetectorAlignments;
51 
52  protected:
60  std::string m_sdPath;
62  size_t m_sdPathLen;
66  bool m_top;
67 
68  protected:
70  GlobalAlignmentCache(Detector& description, const std::string& sdPath, bool top);
72  virtual ~GlobalAlignmentCache();
73 
75  GlobalAlignmentCache* subdetectorAlignments(const std::string& name);
76 
78  void apply(GlobalAlignmentStack& stack);
80  void apply(const std::vector<Entry*> &changes);
82  bool insert(GlobalAlignment alignment);
83 
84  public:
86  static GlobalAlignmentCache* install(Detector& description);
88  static void uninstall(Detector& description);
90  int addRef();
92  int release();
94  const std::string& name() const { return m_sdPath; }
96  void commit(GlobalAlignmentStack& stack);
98  GlobalAlignmentCache* section(const std::string& path_name) const;
100  GlobalAlignment get(const std::string& path) const;
102  std::vector<GlobalAlignment> matches(const std::string& path_match, bool exclude_exact=false) const;
103  };
104 
105  } /* End namespace align */
106 } /* End namespace dd4hep */
107 #endif // DDALIGN_GLOBALALIGNMENTCACHE_H
dd4hep::align::GlobalAlignmentCache::uninstall
static void uninstall(Detector &description)
Unregister and delete a tree instance.
Definition: GlobalAlignmentCache.cpp:83
GlobalAlignment.h
dd4hep::align::GlobalAlignmentStack
Alignment Stack object definition.
Definition: GlobalAlignmentStack.h:34
dd4hep::align::GlobalAlignment
Main handle class to hold a TGeo alignment object of type TGeoPhysicalNode.
Definition: GlobalAlignment.h:38
dd4hep::align::GlobalAlignmentOperator
Base class for alignment functors.
Definition: GlobalAlignmentOperators.h:33
dd4hep::align::GlobalAlignmentCache::matches
std::vector< GlobalAlignment > matches(const std::string &path_match, bool exclude_exact=false) const
Return all entries matching a given path. Careful: Expensive operaton!
Definition: GlobalAlignmentCache.cpp:148
dd4hep::align::GlobalAlignmentCache::release
int release()
Release object. If reference count goes to NULL, automatic deletion is triggered.
Definition: GlobalAlignmentCache.cpp:63
dd4hep::align::GlobalAlignmentCache::m_cache
Cache m_cache
The subdetector specific map of alignments caches.
Definition: GlobalAlignmentCache.h:57
dd4hep::align::GlobalAlignmentCache::addRef
int addRef()
Add reference count.
Definition: GlobalAlignmentCache.cpp:58
dd4hep::align::GlobalAlignmentCache::m_detDesc
Detector & m_detDesc
Definition: GlobalAlignmentCache.h:53
dd4hep::align::GlobalAlignmentCache::m_sdPathLen
size_t m_sdPathLen
The length of the branch name to optimize lookups....
Definition: GlobalAlignmentCache.h:62
dd4hep::align::GlobalAlignmentCache::m_detectors
SubdetectorAlignments m_detectors
Cache of subdetectors.
Definition: GlobalAlignmentCache.h:55
dd4hep::align::GlobalAlignmentCache::apply
void apply(GlobalAlignmentStack &stack)
Population entry: Apply a complete stack of ordered alignments to the geometry structure.
Definition: GlobalAlignmentCache.cpp:186
dd4hep::align::GlobalAlignmentCache::subdetectorAlignments
GlobalAlignmentCache * subdetectorAlignments(const std::string &name)
Retrieve branch cache by name. If not present it will be created.
Definition: GlobalAlignmentCache.cpp:175
dd4hep::detail::DeleteExtension
Implementation class for the object extension mechanism.
Definition: ExtensionEntry.h:123
dd4hep::align::GlobalAlignmentCache::commit
void commit(GlobalAlignmentStack &stack)
Close existing transaction stack and apply all alignments.
Definition: GlobalAlignmentCache.cpp:167
dd4hep::align::GlobalAlignmentCache::get
GlobalAlignment get(const std::string &path) const
Retrieve an alignment entry by its placement path.
Definition: GlobalAlignmentCache.cpp:122
dd4hep::align::GlobalAlignmentCache::Entry
Stack::StackEntry Entry
Definition: GlobalAlignmentCache.h:48
dd4hep::align::GlobalAlignmentCache::Stack
GlobalAlignmentStack Stack
Definition: GlobalAlignmentCache.h:47
dd4hep::align::GlobalAlignmentCache::~GlobalAlignmentCache
virtual ~GlobalAlignmentCache()
Default destructor.
Definition: GlobalAlignmentCache.cpp:47
dd4hep::align::GlobalAlignmentCache::m_top
bool m_top
Flag to indicate the top instance.
Definition: GlobalAlignmentCache.h:66
dd4hep::align::GlobalAlignmentCache
Class caching all known alignment operations for one Detector instance.
Definition: GlobalAlignmentCache.h:41
GlobalAlignmentStack.h
dd4hep::align::GlobalAlignmentCache::GlobalAlignmentCache
GlobalAlignmentCache(Detector &description, const std::string &sdPath, bool top)
Default constructor initializing variables.
Definition: GlobalAlignmentCache.cpp:41
dd4hep::align::GlobalAlignmentCache::m_refCount
int m_refCount
Reference count.
Definition: GlobalAlignmentCache.h:64
dd4hep::align::GlobalAlignmentCache::SubdetectorAlignments
std::map< std::string, GlobalAlignmentCache * > SubdetectorAlignments
Definition: GlobalAlignmentCache.h:50
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::align::GlobalAlignmentCache::section
GlobalAlignmentCache * section(const std::string &path_name) const
Retrieve the cache section corresponding to the path of an entry.
Definition: GlobalAlignmentCache.cpp:104
dd4hep::align::GlobalAlignmentCache::name
const std::string & name() const
Access the section name.
Definition: GlobalAlignmentCache.h:94
dd4hep::align::GlobalAlignmentCache::Cache
std::map< unsigned int, TGeoPhysicalNode * > Cache
Definition: GlobalAlignmentCache.h:49
dd4hep::align::GlobalAlignmentCache::insert
bool insert(GlobalAlignment alignment)
Add a new entry to the cache. The key is the placement path.
Definition: GlobalAlignmentCache.cpp:90
dd4hep::align::GlobalAlignmentStack::StackEntry
Stack entry definition.
Definition: GlobalAlignmentStack.h:52
dd4hep::align::GlobalAlignmentCache::m_sdPath
std::string m_sdPath
Definition: GlobalAlignmentCache.h:60
ExtensionEntry.h
dd4hep::align::GlobalAlignmentCache::install
static GlobalAlignmentCache * install(Detector &description)
Create and install a new instance tree.
Definition: GlobalAlignmentCache.cpp:72