Back to home page

EIC code displayed by LXR

 
 

    


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

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 includes
0015 #include <DD4hep/Printout.h>
0016 #include <DD4hep/AlignmentsProcessor.h>
0017 #include <DD4hep/ConditionsProcessor.h>
0018 #include <DD4hep/detail/ContainerHelpers.h>
0019 #include <DD4hep/detail/ConditionsInterna.h>
0020 
0021 using namespace dd4hep;
0022 using namespace dd4hep::align;
0023 
0024 /// Callback to output alignments information
0025 template <typename T>
0026 int DeltaCollector<T>::operator()(DetElement de, int level)  const  {
0027   if ( de.isValid() )  {
0028     int count = 0;
0029     std::vector<Condition> conditions;
0030     cond::conditionsCollector(mapping,conditions)(de,level);
0031     for( auto cond : conditions )   {
0032       if ( cond->testFlag(Condition::ALIGNMENT_DELTA) )  {
0033         insert_item(deltas, de, cond.get<Delta>());
0034         ++count;
0035       }
0036     }
0037     return count;
0038   }
0039   except("Alignments","Cannot process alignments of an invalid detector element");
0040   return 0;  
0041 }
0042 
0043 /// Callback to output alignments information
0044 template <typename T>
0045 int AlignmentsCollector<T>::operator()(DetElement de, int level)  const  {
0046   if ( de.isValid() )  {
0047     int count = 0;
0048     std::vector<Condition> conditions;
0049     cond::conditionsCollector(mapping,conditions)(de,level);
0050     for( auto cond : conditions )   {
0051       if ( cond->testFlag(Condition::ALIGNMENT_DERIVED) )  {
0052         Alignment align = cond;
0053         insert_item(alignments, de, align);
0054         ++count;
0055       }
0056     }
0057     return count;
0058   }
0059   except("Alignments","Cannot process alignments of an invalid detector element");
0060   return 0;  
0061 }
0062 
0063 
0064 /// Namespace for the AIDA detector description toolkit
0065 namespace dd4hep {
0066 
0067   /// Namespace for the AIDA detector description toolkit supporting XML utilities
0068   namespace align {
0069 
0070     template class DeltaCollector<std::list<Delta> >;
0071     template class DeltaCollector<std::vector<Delta> >;
0072     template class DeltaCollector<std::map<DetElement,Delta> >;
0073     template class DeltaCollector<std::vector<std::pair<DetElement,Delta> > >;
0074     template class DeltaCollector<std::vector<std::pair<std::string,Delta> > >;
0075 
0076     template class DeltaCollector<std::multimap<DetElement,Delta> >;
0077     template class DeltaCollector<std::map<std::string,Delta> >;
0078     template class DeltaCollector<std::multimap<std::string,Delta> >;
0079 
0080 
0081     template class AlignmentsCollector<std::list<Alignment> >;
0082     template class AlignmentsCollector<std::vector<Alignment> >;
0083     template class AlignmentsCollector<std::map<DetElement,Alignment> >;
0084     template class AlignmentsCollector<std::vector<std::pair<DetElement,Alignment> > >;
0085     template class AlignmentsCollector<std::vector<std::pair<std::string,Alignment> > >;
0086 
0087     template class AlignmentsCollector<std::multimap<DetElement,Alignment> >;
0088     template class AlignmentsCollector<std::map<std::string,Alignment> >;
0089     template class AlignmentsCollector<std::multimap<std::string,Alignment> >;
0090 
0091   }    /* End namespace align  */
0092 }      /* End namespace dd4hep      */