CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
cms::DDVolumeProcessor Class Reference

#include <DDVolumeProcessor.h>

Inheritance diagram for cms::DDVolumeProcessor:

Public Types

using PlacedVolume = dd4hep::PlacedVolume
 
using PlacedVolumeProcessor = dd4hep::PlacedVolumeProcessor
 
using Volume = dd4hep::Volume
 

Public Member Functions

bool compare (std::string_view s1, std::string_view s2)
 
int count () const
 
 DDVolumeProcessor ()=default
 
int operator() (PlacedVolume pv, int level) override
 Volume callback. More...
 
int process (PlacedVolume pv, int level, bool recursive) override
 Callback to retrieve PlacedVolume information of an entire Placement. More...
 
std::vector< std::string_view > split (std::string_view str, const char *delims)
 
std::string_view stripCopyNo (std::string_view v)
 
std::string_view stripNamespace (std::string_view v)
 
 ~DDVolumeProcessor () override=default
 

Private Attributes

int m_count = 0
 
std::vector< std::string_view > m_volumes
 

Detailed Description

Definition at line 14 of file DDVolumeProcessor.h.

Member Typedef Documentation

using cms::DDVolumeProcessor::PlacedVolume = dd4hep::PlacedVolume

Definition at line 18 of file DDVolumeProcessor.h.

using cms::DDVolumeProcessor::PlacedVolumeProcessor = dd4hep::PlacedVolumeProcessor

Definition at line 19 of file DDVolumeProcessor.h.

using cms::DDVolumeProcessor::Volume = dd4hep::Volume

Definition at line 17 of file DDVolumeProcessor.h.

Constructor & Destructor Documentation

cms::DDVolumeProcessor::DDVolumeProcessor ( )
default
cms::DDVolumeProcessor::~DDVolumeProcessor ( )
overridedefault

Member Function Documentation

bool cms::DDVolumeProcessor::compare ( std::string_view  s1,
std::string_view  s2 
)
inline

Definition at line 55 of file DDVolumeProcessor.h.

55  {
56  if(s1 == s2)
57  return true;
58  edm::LogVerbatim("Geometry") << '\"' << s1 << "\" does not match \"" << s2 << "\"\n";
59  return false;
60  }
int cms::DDVolumeProcessor::count ( void  ) const
inline

Definition at line 83 of file DDVolumeProcessor.h.

References m_count.

Referenced by DDTestNavigateGeometry::analyze().

83 { return m_count; }
int cms::DDVolumeProcessor::operator() ( PlacedVolume  pv,
int  level 
)
inlineoverride

Volume callback.

Definition at line 71 of file DDVolumeProcessor.h.

References mps_fire::i, edm::LogVerbatim::log(), cmsBatch::log, m_count, and m_volumes.

71  {
72  Volume vol = pv.volume();
73  edm::LogVerbatim("Geometry").log([&level, &vol, this](auto& log) {
74  log << "\nHierarchical level:" << level << " Placement:";
75  for(const auto& i : m_volumes)
76  log << "/" << i << ", \n";
77  log << "\n\tMaterial:" << vol.material().name()
78  << "\tSolid: " << vol.solid().name() << "\n";
79  });
80  ++m_count;
81  return 1;
82  }
def pv(vc)
Definition: MetAnalyzer.py:7
LogVerbatim & log(F &&iF)
std::vector< std::string_view > m_volumes
int cms::DDVolumeProcessor::process ( PlacedVolume  pv,
int  level,
bool  recursive 
)
inlineoverride
std::vector<std::string_view> cms::DDVolumeProcessor::split ( std::string_view  str,
const char *  delims 
)
inline

Definition at line 38 of file DDVolumeProcessor.h.

References command_line::start.

38  {
39  std::vector<std::string_view> ret;
40 
42  auto pos = str.find_first_of(delims, start);
43  while(pos != std::string_view::npos) {
44  if(pos != start) {
45  ret.emplace_back(str.substr(start, pos - start));
46  }
47  start = pos + 1;
48  pos = str.find_first_of(delims, start);
49  }
50  if(start < str.length())
51  ret.emplace_back(str.substr(start, str.length() - start));
52  return ret;
53  }
Definition: start.py:1
uint16_t size_type
#define str(s)
std::string_view cms::DDVolumeProcessor::stripCopyNo ( std::string_view  v)
inline

Definition at line 30 of file DDVolumeProcessor.h.

References runEdmFileComparison::found, and findQualityFiles::v.

30  {
31  auto found = v.find_last_of("_");
32  if(found != v.npos) {
33  v.remove_suffix(v.size() - found);
34  }
35  return v;
36  }
std::string_view cms::DDVolumeProcessor::stripNamespace ( std::string_view  v)
inline

Definition at line 24 of file DDVolumeProcessor.h.

References plotBeamSpotDB::first, min(), and findQualityFiles::v.

24  {
25  auto first = v.find_first_of(":");
26  v.remove_prefix(std::min(first+1, v.size()));
27  return v;
28  }
T min(T a, T b)
Definition: MathUtil.h:58

Member Data Documentation

int cms::DDVolumeProcessor::m_count = 0
private

Definition at line 86 of file DDVolumeProcessor.h.

Referenced by count(), and operator()().

std::vector<std::string_view> cms::DDVolumeProcessor::m_volumes
private

Definition at line 87 of file DDVolumeProcessor.h.

Referenced by operator()(), and process().