DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
VolumeProcessor.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>
16 #include <DD4hep/VolumeProcessor.h>
17 
18 using namespace dd4hep;
19 
22 }
23 
25 int PlacedVolumeProcessor::process(PlacedVolume pv, int level, bool recursive) {
26  if ( pv.isValid() ) {
27  int ret = (*this)(pv, level);
28  TGeoNode* node = pv.ptr();
29  if ( recursive ) {
30  for (Int_t idau = 0, ndau = node->GetNdaughters(); idau < ndau; ++idau) {
31  PlacedVolume placement(node->GetDaughter(idau));
32  //if ( placement.data() ) {
33  ret += process(placement,level+1,recursive);
34  //}
35  }
36  }
37  return ret;
38  }
39  except("PlacedVolume","Cannot process an invalid PlacedVolume element");
40  return 0;
41 }
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:173
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::PlacedVolumeProcessor::~PlacedVolumeProcessor
virtual ~PlacedVolumeProcessor() noexcept(false)
Default destructor.
Definition: VolumeProcessor.cpp:21
dd4hep::PlacedVolumeProcessor::process
virtual int process(PlacedVolume pv, int level, bool recursive)
Callback to output PlacedVolume information of an entire Placement.
Definition: VolumeProcessor.cpp:25
VolumeProcessor.h
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
Printout.h