Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:16:58

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/DetectorProcessor.h>
0017 #include <DD4hep/detail/ContainerHelpers.h>
0018 
0019 using namespace dd4hep;
0020 
0021 /// Default destructor
0022 DetectorProcessor::~DetectorProcessor()   {
0023 }
0024 
0025 /// Callback to output detector information of an entire DetElement
0026 int DetectorProcessor::process(DetElement de, int level, bool recursive)  const  {
0027   if ( de.isValid() )  {
0028     int ret = (*this)(de, level);
0029     if ( recursive )  {
0030       for (const auto& c : de.children() )
0031         ret += process(c.second,level+1,recursive);
0032     }
0033     return ret;
0034   }
0035   except("Detector","Cannot process an invalid detector element");
0036   return 0;
0037 }
0038 
0039 /// Callback to output conditions information
0040 template <typename T>
0041 int DetElementsCollector<T>::operator()(DetElement de, int level)  const  {
0042   insert_item(elements, de, level);
0043   return 1;
0044 }
0045 
0046 /// Namespace for the AIDA detector description toolkit
0047 namespace dd4hep {
0048   //template class DetElementsCollector<T>;
0049   template class DetElementsCollector<std::set<DetElement> >;
0050   template class DetElementsCollector<std::list<DetElement> >;
0051   template class DetElementsCollector<std::vector<DetElement> >;
0052 
0053   template class DetElementsCollector<std::set<std::pair<DetElement, int> > >;
0054   template class DetElementsCollector<std::list<std::pair<DetElement, int> > >;
0055   template class DetElementsCollector<std::vector<std::pair<DetElement, int> > >;
0056 }  /* End namespace dd4hep   */
0057