Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:12:34

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 #ifndef DD4HEP_GLOBALALIGNMENT_H
0014 #define DD4HEP_GLOBALALIGNMENT_H
0015 
0016 // Framework include files
0017 #include <DD4hep/Objects.h>
0018 #include <DD4hep/Volumes.h>
0019 #include <DD4hep/Alignments.h>
0020 #include <TGeoPhysicalNode.h>
0021 
0022 /// Namespace for the AIDA detector description toolkit
0023 namespace dd4hep {
0024 
0025   /// Namespace for implementation details of the AIDA detector description toolkit
0026   namespace align {
0027 
0028     /// Main handle class to hold a TGeo alignment object of type TGeoPhysicalNode
0029     /**
0030      *  See the ROOT documentation about the TGeoPhysicalNode for further details:
0031      *  @see http://root.cern.ch/root/html/TGeoPhysicalNode.html
0032      *
0033      *  \author  M.Frank
0034      *  \version 1.0
0035      *  \ingroup DD4HEP_CORE
0036      *  \ingroup DD4HEP_ALIGN
0037      */
0038     class GlobalAlignment : public Handle<TGeoPhysicalNode> {
0039     public:
0040       /// Default constructor
0041       GlobalAlignment() = default;
0042       /// Default constructor
0043       GlobalAlignment(TGeoPhysicalNode* p) : Handle<TGeoPhysicalNode>(p)  {}
0044       /// Copy constructor
0045       GlobalAlignment(const GlobalAlignment& c) = default;
0046       /// Constructor to be used when reading the already parsed object
0047       template <typename Q> GlobalAlignment(const Handle<Q>& e)
0048         : Handle<TGeoPhysicalNode>(e) {
0049       }
0050       /// Initializing constructor
0051       GlobalAlignment(const std::string& path);
0052       /// Assignment operator
0053       GlobalAlignment& operator=(const GlobalAlignment& c) = default;
0054       /// Number of nodes in this branch (=depth of the placement hierarchy from the top level volume)
0055       int numNodes() const;
0056       /// Access the placement of this node
0057       PlacedVolume placement()   const;
0058       /// Access the placement of the mother of this node
0059       PlacedVolume motherPlacement(int level_up = 1)   const;
0060       /// Access the placement of a node in the chain of placements for this branch
0061       /** Remeber the special cases:
0062        *  nodePlacement(-1) == nodePlacement(numNodes()) = placement()
0063        *  nodePlacement(numNodes()-1)  == motherPlacement() = TGeoPhysicalNode::GetMother()
0064        *                    == direct mother of placement()
0065        */
0066       PlacedVolume nodePlacement(int level=-1)   const;
0067       /// Access the currently applied alignment/placement matrix with respect to the world
0068       Transform3D toGlobal(int level=-1) const;
0069       /// Transform a point from local coordinates of a given level to global coordinates
0070       Position toGlobal(const Position& localPoint, int level=-1) const;
0071       /// Transform a point from global coordinates to local coordinates of a given level
0072       Position globalToLocal(const Position& globalPoint, int level=-1) const;
0073 
0074       /// Access the currently applied alignment/placement matrix with respect to mother volume
0075       Transform3D toMother(int level=-1) const;
0076 
0077       /// Access the currently applied alignment/placement matrix (mother to daughter)
0078       Transform3D nominal() const;
0079       /// Access the currently applied correction matrix (delta) (mother to daughter)
0080       Transform3D delta() const;
0081       /// Access the inverse of the currently applied correction matrix (delta) (mother to daughter)
0082       Transform3D invDelta() const;
0083     };
0084 
0085   }       /* End namespace align                */
0086 }         /* End namespace dd4hep                    */
0087 #endif // DD4HEP_GLOBALALIGNMENT_H
0088