CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PrintGeomSolids Class Reference
Inheritance diagram for PrintGeomSolids:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::Event const &iEvent, edm::EventSetup const &) override
 
 PrintGeomSolids (const edm::ParameterSet &)
 
 ~PrintGeomSolids () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::ESGetToken< cms::DDCompactView, IdealGeometryRecordcpvTokenDD4hep_
 
edm::ESGetToken< DDCompactView, IdealGeometryRecordcpvTokenDDD_
 
bool fromDD4hep_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 28 of file PrintGeomSolids.cc.

Constructor & Destructor Documentation

◆ PrintGeomSolids()

PrintGeomSolids::PrintGeomSolids ( const edm::ParameterSet ps)
explicit

Definition at line 42 of file PrintGeomSolids.cc.

References cpvTokenDD4hep_, cpvTokenDDD_, fromDD4hep_, and edm::ParameterSet::getParameter().

42  {
43  fromDD4hep_ = ps.getParameter<bool>("fromDD4hep");
44  if (fromDD4hep_)
45  cpvTokenDD4hep_ = esConsumes<cms::DDCompactView, IdealGeometryRecord>(edm::ESInputTag());
46  else
47  cpvTokenDDD_ = esConsumes<DDCompactView, IdealGeometryRecord>(edm::ESInputTag());
48 
49  edm::LogVerbatim("PrintGeom") << "PrintGeomSolids created with dd4hep: " << fromDD4hep_;
50 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4hep_

◆ ~PrintGeomSolids()

PrintGeomSolids::~PrintGeomSolids ( )
inlineoverride

Definition at line 31 of file PrintGeomSolids.cc.

31 {}

Member Function Documentation

◆ analyze()

void PrintGeomSolids::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 58 of file PrintGeomSolids.cc.

References cpvTokenDD4hep_, cpvTokenDDD_, cms::DDDetector::description(), cms::DDCompactView::detector(), spr::find(), fromDD4hep_, relativeConstraints::geom, edm::EventSetup::getData(), DDCompactView::graph(), Skims_PA_cff::name, DDSolidShapesName::name(), DDBase< N, C >::name(), names, GetRecoTauVFromDQM_MC_cff::next, castor_dqm_sourceclient_file_cfg::path, DDSolid::shape(), l1trig_cff::shape, DDLogicalPart::solid(), and AlCaHLTBitMon_QueryRunRegistry::string.

58  {
59  int solids(0);
60  std::map<std::string, int> shapes;
61  if (fromDD4hep_) {
62  const cms::DDCompactView* cpv = &iSetup.getData(cpvTokenDD4hep_);
63  const cms::DDDetector* det = cpv->detector();
64  TGeoManager const& geom = det->description()->manager();
65  TGeoIterator next(geom.GetTopVolume());
66  TGeoNode* node;
67  TString path;
68  std::vector<std::string> names;
69  while ((node = next())) {
70  next.GetPath(path);
71  std::string name = static_cast<std::string>(node->GetVolume()->GetName());
72  if (std::find(names.begin(), names.end(), name) == names.end()) {
73  edm::LogVerbatim("PrintGeom") << name << " "
74  << static_cast<std::string>(node->GetVolume()->GetShape()->GetTitle());
75  names.emplace_back(name);
76  std::string shape = node->GetVolume()->GetShape()->GetTitle();
77  if (shapes.find(shape) == shapes.end())
78  shapes.emplace(std::make_pair(shape, 1));
79  else
80  ++shapes[shape];
81  ++solids;
82  }
83  }
84 
85  } else {
86  const DDCompactView* cpv = &iSetup.getData(cpvTokenDDD_);
87  const auto& gra = cpv->graph();
88  for (DDCompactView::Graph::const_adj_iterator git = gra.begin(); git != gra.end(); ++git) {
89  const DDLogicalPart& ddLP = gra.nodeData(git);
90  const DDSolid& solid = ddLP.solid();
91  edm::LogVerbatim("PrintGeom") << solid.name() << " " << DDSolidShapesName::name(solid.shape());
93  if (shapes.find(shape) == shapes.end())
94  shapes.emplace(std::make_pair(shape, 1));
95  else
96  ++shapes[shape];
97  ++solids;
98  }
99  }
100  edm::LogVerbatim("PrintGeom") << "\n\nPrintGeomSolids finds " << solids << " solids\n\n";
101  for (std::map<std::string, int>::iterator itr = shapes.begin(); itr != shapes.end(); ++itr) {
102  edm::LogVerbatim("PrintGeom") << "Shape:" << itr->first << " # " << itr->second;
103  }
104 }
Log< level::Info, true > LogVerbatim
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_
dd4hep::Detector const * description() const
Definition: DDDetector.h:35
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
const std::string names[nVars_]
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
static const char *const name(DDSolidShape s)
Definition: DDSolidShapes.h:33
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4hep_
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
const N & name() const
Definition: DDBase.h:59
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
adj_list::const_iterator const_adj_iterator
Definition: Graph.h:105
const Graph & graph() const
Provides read-only access to the data structure of the compact-view.

◆ fillDescriptions()

void PrintGeomSolids::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 52 of file PrintGeomSolids.cc.

References edm::ConfigurationDescriptions::add(), and submitPVResolutionJobs::desc.

52  {
54  desc.add<bool>("fromDD4hep", false);
55  descriptions.add("printGeomSolids", desc);
56 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ cpvTokenDD4hep_

edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> PrintGeomSolids::cpvTokenDD4hep_
private

Definition at line 38 of file PrintGeomSolids.cc.

Referenced by analyze(), and PrintGeomSolids().

◆ cpvTokenDDD_

edm::ESGetToken<DDCompactView, IdealGeometryRecord> PrintGeomSolids::cpvTokenDDD_
private

Definition at line 37 of file PrintGeomSolids.cc.

Referenced by analyze(), and PrintGeomSolids().

◆ fromDD4hep_

bool PrintGeomSolids::fromDD4hep_
private

Definition at line 39 of file PrintGeomSolids.cc.

Referenced by analyze(), and PrintGeomSolids().