DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GlobalAlignmentCache.h
Go to the documentation of this file.
1 // $Id: $
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 #ifndef DD4HEP_ALIGNMENT_GLOBALALIGNMENTCACHE_H
15 #define DD4HEP_ALIGNMENT_GLOBALALIGNMENTCACHE_H
16 
17 // Framework include files
18 #include "DD4hep/GlobalAlignment.h"
19 #include "DDAlign/AlignmentStack.h"
20 
22 namespace DD4hep {
23 
25  namespace Alignments {
26 
28  class AlignmentOperator;
29  class GlobalAlignmentCache;
30  class AlignmentStack;
31 
33 
42  friend class LCDD;
43  friend class AlignmentOperator;
44 
45  public:
48  typedef std::map<unsigned int, TGeoPhysicalNode*> Cache;
49  typedef std::map<std::string,GlobalAlignmentCache*> SubdetectorAlignments;
50 
51  protected:
59  std::string m_sdPath;
61  size_t m_sdPathLen;
65  bool m_top;
66 
67  protected:
69  GlobalAlignmentCache(LCDD& lcdd, const std::string& sdPath, bool top);
71  virtual ~GlobalAlignmentCache();
72 
74  GlobalAlignmentCache* subdetectorAlignments(const std::string& name);
75 
77  void apply(AlignmentStack& stack);
79  void apply(const std::vector<Entry*> &changes);
81  bool insert(GlobalAlignment alignment);
82 
83  public:
85  static GlobalAlignmentCache* install(LCDD& lcdd);
87  static void uninstall(LCDD& lcdd);
89  int addRef();
91  int release();
93  const std::string& name() const { return m_sdPath; }
95  void commit(AlignmentStack& stack);
97  GlobalAlignmentCache* section(const std::string& path_name) const;
99  GlobalAlignment get(const std::string& path) const;
101  std::vector<GlobalAlignment> matches(const std::string& path_match, bool exclude_exact=false) const;
102  };
103 
104  } /* End namespace Alignments */
105 } /* End namespace DD4hep */
106 #endif /* DD4HEP_ALIGNMENT_GLOBALALIGNMENTCACHE_H */
Cache m_cache
The subdetector specific map of alignments caches.
GlobalAlignmentCache(LCDD &lcdd, const std::string &sdPath, bool top)
Default constructor initializing variables.
std::map< std::string, GlobalAlignmentCache * > SubdetectorAlignments
bool m_top
Flag to indicate the top instance.
bool insert(GlobalAlignment alignment)
Add a new entry to the cache. The key is the placement path.
const std::string & name() const
Access the section name.
Main handle class to hold a TGeo alignment object of type TGeoPhysicalNode.
void commit(AlignmentStack &stack)
Close existing transaction stack and apply all alignments.
std::vector< GlobalAlignment > matches(const std::string &path_match, bool exclude_exact=false) const
Return all entries matching a given path. Careful: Expensive operaton!
static void uninstall(LCDD &lcdd)
Unregister and delete a tree instance.
size_t m_sdPathLen
The length of the branch name to optimize lookups....
int release()
Release object. If reference count goes to NULL, automatic deletion is triggered. ...
void apply(AlignmentStack &stack)
Population entry: Apply a complete stack of ordered alignments to the geometry structure.
virtual ~GlobalAlignmentCache()
Default destructor.
SubdetectorAlignments m_detectors
Cache of subdetectors.
Class caching all known alignment operations for one LCDD instance.
static GlobalAlignmentCache * install(LCDD &lcdd)
Create and install a new instance tree.
GlobalAlignmentCache * subdetectorAlignments(const std::string &name)
Retrieve branch cache by name. If not present it will be created.
Stack entry definition.
GlobalAlignmentCache * section(const std::string &path_name) const
Retrieve the cache section corresponding to the path of an entry.
std::map< unsigned int, TGeoPhysicalNode * > Cache
Base class for alignment functors.
Alignment Stack object definition.