Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:51

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 
0014 // Framework include files
0015 #include <DD4hep/AlignmentData.h>
0016 #include <DD4hep/detail/AlignmentsInterna.h>
0017 #include <DD4hep/detail/ConditionsInterna.h>
0018 
0019 // C/C++ include files
0020 #include <sstream>
0021 
0022 using namespace dd4hep;
0023 
0024 const std::string dd4hep::align::Keys::deltaName("alignment_delta");
0025 const dd4hep::Condition::itemkey_type  dd4hep::align::Keys::deltaKey =
0026   dd4hep::ConditionKey::itemCode("alignment_delta");
0027 
0028 const std::string dd4hep::align::Keys::alignmentName("alignment");
0029 const dd4hep::Condition::itemkey_type dd4hep::align::Keys::alignmentKey =
0030   dd4hep::ConditionKey::itemCode("alignment");
0031 
0032 /// Default constructor
0033 Alignment::Processor::Processor() {
0034 }
0035 
0036 /// Initializing constructor to create a new object (Specialized for AlignmentNamedObject)
0037 Alignment::Alignment(const std::string& nam)  {
0038   char*   p = (char*)::operator new(sizeof(Object)+sizeof(AlignmentData));
0039   Object* o = new(p) Object(nam, "alignment", p+sizeof(Object), sizeof(AlignmentData));
0040   assign(o, nam, "alignment");
0041   o->hash   = 0;
0042 }
0043 
0044 /// Initializing constructor to create a new object (Specialized for AlignmentObject)
0045 AlignmentCondition::AlignmentCondition(const std::string& nam)   {
0046   char*   p = (char*)::operator new(sizeof(Object)+sizeof(AlignmentData));
0047   Object* o = new(p) Object(nam, "alignment", p+sizeof(Object), sizeof(AlignmentData));
0048   assign(o, nam, "alignment");
0049   o->hash   = 0;
0050 }
0051 
0052 /// Data accessor for the use of decorators
0053 AlignmentData& Alignment::data()              {
0054   return access()->values();
0055 }
0056 
0057 /// Data accessor for the use of decorators
0058 const AlignmentData& Alignment::data() const  {
0059   return access()->values();
0060 }
0061 
0062 /// Access the delta value of the object
0063 const Delta& Alignment::delta() const   {
0064   return access()->values().delta;
0065 }
0066 
0067 /// Create cached matrix to transform to world coordinates
0068 const TGeoHMatrix& Alignment::worldTransformation()  const  {
0069   return access()->values().worldTransformation();
0070 }
0071 
0072 /// Access the alignment/placement matrix with respect to the world
0073 const TGeoHMatrix& Alignment::detectorTransformation() const   {
0074   return access()->values().detectorTransformation();
0075 }
0076 
0077 /// Access to the node list
0078 const std::vector<PlacedVolume>& Alignment::nodes() const   {
0079   return access()->values().nodes;
0080 }
0081 
0082 /// Transformation from local coordinates of the placed volume to the world system
0083 void Alignment::localToWorld(const Position& local, Position& global) const  {
0084   return access()->values().localToWorld(local,global);
0085 }
0086 
0087 /// Transformation from local coordinates of the placed volume to the world system
0088 void Alignment::localToWorld(const Double_t local[3], Double_t global[3]) const  {
0089   return access()->values().localToWorld(local,global);
0090 }
0091 /// Transformation from local coordinates of the placed volume to the world system
0092 Position Alignment::localToWorld(const Position& local) const  {
0093   return access()->values().localToWorld(local);
0094 }
0095 
0096 /// Transformation from world coordinates of the local placed volume coordinates
0097 void Alignment::worldToLocal(const Position& global, Position& local) const  {
0098   return access()->values().worldToLocal(global,local);
0099 }
0100 
0101 /// Transformation from world coordinates of the local placed volume coordinates
0102 void Alignment::worldToLocal(const Double_t global[3], Double_t local[3]) const  {
0103   return access()->values().worldToLocal(global,local);
0104 }
0105 
0106 /// Transformation from local coordinates of the placed volume to the world system
0107 Position Alignment::worldToLocal(const Position& global) const  {
0108   return access()->values().worldToLocal(global);
0109 }
0110 
0111 /// Transformation from local coordinates of the placed volume to the detector system
0112 void Alignment::localToDetector(const Position& local, Position& detector) const  {
0113   return access()->values().localToDetector(local,detector);
0114 }
0115 
0116 /// Transformation from local coordinates of the placed volume to the detector system
0117 void Alignment::localToDetector(const Double_t local[3], Double_t detector[3]) const  {
0118   return access()->values().localToDetector(local,detector);
0119 }
0120 
0121 /// Transformation from local coordinates of the placed volume to the world system
0122 Position Alignment::localToDetector(const Position& local) const  {
0123   return access()->values().localToDetector(local);
0124 }
0125 
0126 /// Transformation from detector element coordinates to the local placed volume coordinates
0127 void Alignment::detectorToLocal(const Position& detector, Position& local) const  {
0128   return access()->values().detectorToLocal(detector,local);
0129 }
0130 
0131 /// Transformation from detector element coordinates to the local placed volume coordinates
0132 void Alignment::detectorToLocal(const Double_t detector[3], Double_t local[3]) const  {
0133   return access()->values().detectorToLocal(detector,local);
0134 }
0135 
0136 /// Transformation from detector element coordinates to the local placed volume coordinates
0137 Position Alignment::detectorToLocal(const Position& detector) const  {
0138   return access()->values().detectorToLocal(detector);
0139 }
0140 
0141 /// Access the IOV type
0142 const dd4hep::IOVType& AlignmentCondition::iovType() const   {
0143   return *(access()->iovType());
0144 }
0145 
0146 /// Access the IOV block
0147 const dd4hep::IOV& AlignmentCondition::iov() const   {
0148   return *(access()->iovData());
0149 }
0150 
0151 /// Access the hash identifier
0152 AlignmentCondition::key_type AlignmentCondition::key() const   {
0153   return access()->hash;
0154 }
0155 
0156 /// Data accessor for the use of decorators
0157 AlignmentData& AlignmentCondition::data()              {
0158   return *(access()->alignment_data);
0159 }
0160 
0161 /// Data accessor for the use of decorators
0162 const AlignmentData& AlignmentCondition::data() const  {
0163   return *(access()->alignment_data);
0164 }
0165 
0166 /// Access the delta value of the object
0167 const Delta& AlignmentCondition::delta() const   {
0168   return access()->alignment_data->delta;
0169 }
0170 
0171 /// Check if object is already bound....
0172 bool AlignmentCondition::is_bound()  const  {
0173   return isValid() ? ptr()->data.is_bound() : false;
0174 }
0175 
0176 /// Create cached matrix to transform to world coordinates
0177 const TGeoHMatrix& AlignmentCondition::worldTransformation()  const  {
0178   return data().worldTransformation();
0179 }
0180 
0181 /// Access the alignment/placement matrix with respect to the world
0182 const TGeoHMatrix& AlignmentCondition::detectorTransformation() const   {
0183   return data().detectorTransformation();
0184 }