DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
DetectorProcessor.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework includes
15 #include <DD4hep/Printout.h>
18 
19 using namespace dd4hep;
20 
23 }
24 
26 int DetectorProcessor::process(DetElement de, int level, bool recursive) const {
27  if ( de.isValid() ) {
28  int ret = (*this)(de, level);
29  if ( recursive ) {
30  for (const auto& c : de.children() )
31  ret += process(c.second,level+1,recursive);
32  }
33  return ret;
34  }
35  except("Detector","Cannot process an invalid detector element");
36  return 0;
37 }
38 
40 template <typename T>
42  insert_item(elements, de, level);
43  return 1;
44 }
45 
47 namespace dd4hep {
48  //template class DetElementsCollector<T>;
52 
56 } /* End namespace dd4hep */
57 
dd4hep::DetectorProcessor::~DetectorProcessor
virtual ~DetectorProcessor()
Default destructor.
Definition: DetectorProcessor.cpp:22
DetectorProcessor.h
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::insert_item
void insert_item(std::vector< T > &c, Q, const T &d)
Definition: ContainerHelpers.h:37
dd4hep::DetectorProcessor::process
virtual int process(DetElement de, int level, bool recursive) const
Callback to output detector information of an entire DetElement.
Definition: DetectorProcessor.cpp:26
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::DetElementsCollector
Generic detector element collector of a sub-tree.
Definition: DetectorProcessor.h:129
dd4hep::DetElementsCollector::operator()
virtual int operator()(DetElement de, int level) const final
Callback to output elements information.
Definition: DetectorProcessor.cpp:41
ContainerHelpers.h
Printout.h