CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonOffsetFromDD Class Reference

#include <MuonOffsetFromDD.h>

Public Member Functions

bool build (const cms::DDCompactView *, MuonOffsetMap &)
 
bool build (const DDCompactView *, MuonOffsetMap &)
 
 MuonOffsetFromDD (std::vector< std::string > names)
 

Private Member Functions

bool debugParameters (const MuonOffsetMap &)
 
int getNumber (const std::string &, const DDsvalues_type &)
 

Private Attributes

const unsigned int nset_
 
const std::vector< std::string > specpars_
 

Detailed Description

Definition at line 14 of file MuonOffsetFromDD.h.

Constructor & Destructor Documentation

◆ MuonOffsetFromDD()

MuonOffsetFromDD::MuonOffsetFromDD ( std::vector< std::string >  names)

Definition at line 13 of file MuonOffsetFromDD.cc.

13  : specpars_(name), nset_(name.size()) {
14 #ifdef EDM_ML_DEBUG
15  edm::LogVerbatim("MuonGeom") << "MuonOffsetFromDD initialized with " << nset_ << " specpars";
16 #endif
17 }

References nset_.

Member Function Documentation

◆ build() [1/2]

bool MuonOffsetFromDD::build ( const cms::DDCompactView cpv,
MuonOffsetMap php 
)

Definition at line 44 of file MuonOffsetFromDD.cc.

44  {
45  edm::LogVerbatim("MuonGeom") << "Inside MuonOffsetFromDD::build(const cms::DDCompactView*, MuonOffsetMap&)";
46 
47  // Get the offsets and tags first
48  int offsets[nset_], tags[nset_];
49  cms::DDFilteredView fv(cpv->detector(), cpv->detector()->worldVolume());
50  for (unsigned int k = 0; k < nset_; ++k) {
51  std::vector<int> off = fv.get<std::vector<int>>(specpars_[k], "CopyNoOffset");
52  offsets[k] = (!off.empty()) ? off[0] : 0;
53  std::vector<int> tag = fv.get<std::vector<int>>(specpars_[k], "CopyNoTag");
54  tags[k] = (!tag.empty()) ? tag[0] : 0;
55  }
56  // Now loop over the detectors
57  std::string attribute = "OnlyForMuonNumbering";
59  for (unsigned int k = 0; k < nset_; ++k) {
60  name = "muonstep" + std::to_string(k);
61  const cms::DDFilter filter(attribute, name);
62  cms::DDFilteredView fv((*cpv), filter);
63  while (fv.firstChild()) {
64  name = static_cast<std::string>(fv.name());
65  php.muonMap_[name] = std::make_pair(offsets[k], tags[k]);
66  }
67  }
68  return this->debugParameters(php);
69 }

References debugParameters(), cms::DDCompactView::detector(), ALCARECOTkAlBeamHalo_cff::filter, cms::DDFilteredView::firstChild(), cms::DDFilteredView::get(), dqmdumpme::k, MuonOffsetMap::muonMap_, Skims_PA_cff::name, cms::DDFilteredView::name(), nset_, unpackBuffers-CaloStage1::offsets, specpars_, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, triggerMatcherToHLTDebug_cfi::tags, and cms::DDDetector::worldVolume().

◆ build() [2/2]

bool MuonOffsetFromDD::build ( const DDCompactView cpv,
MuonOffsetMap php 
)

Definition at line 19 of file MuonOffsetFromDD.cc.

19  {
20 #ifdef EDM_ML_DEBUG
21  edm::LogVerbatim("MuonGeom") << "Inside MuonOffsetFromDD::build(const DDCompactView*, MuonOffsetMap&)";
22 #endif
23 
24  // Loop over all the sets
25  std::string attribute = "OnlyForMuonNumbering";
27  for (unsigned int k = 0; k < nset_; ++k) {
28  name = "muonstep" + std::to_string(k);
30  DDFilteredView fv(*cpv, filter);
31  bool dodet = fv.firstChild();
32  DDsvalues_type sv(fv.mergedSpecifics());
33  int offset = getNumber("CopyNoOffset", sv);
34  int tag = getNumber("CopyNoTag", sv);
35  while (dodet) {
36  name = fv.logicalPart().name().name();
37  php.muonMap_[name] = std::make_pair(offset, tag);
38  dodet = fv.next();
39  }
40  }
41  return this->debugParameters(php);
42 }

References debugParameters(), ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), getNumber(), dqmdumpme::k, DDFilteredView::logicalPart(), DDFilteredView::mergedSpecifics(), MuonOffsetMap::muonMap_, Skims_PA_cff::name, DDName::name(), DDBase< N, C >::name(), DDFilteredView::next(), nset_, hltrates_dqm_sourceclient-live_cfg::offset, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by MuonOffsetESProducer::produce().

◆ debugParameters()

bool MuonOffsetFromDD::debugParameters ( const MuonOffsetMap php)
private

Definition at line 71 of file MuonOffsetFromDD.cc.

71  {
72  edm::LogVerbatim("MuonGeom") << "MuonOffsetFromDD: Finds " << php.muonMap_.size() << " entries in the map";
73 #ifdef EDM_ML_DEBUG
74  unsigned int k(0);
75  for (auto itr = php.muonMap_.begin(); itr != php.muonMap_.end(); ++itr, ++k) {
76  edm::LogVerbatim("MuonGeom") << "[" << k << "] " << itr->first << ": (" << (itr->second).first << ", "
77  << (itr->second).second << ")";
78  }
79 #endif
80  return true;
81 }

References first, dqmdumpme::k, and MuonOffsetMap::muonMap_.

Referenced by build().

◆ getNumber()

int MuonOffsetFromDD::getNumber ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 83 of file MuonOffsetFromDD.cc.

83  {
84 #ifdef EDM_ML_DEBUG
85  edm::LogVerbatim("MuonGeom") << "MuonOffsetFromDD::getNumbers called for " << str;
86 #endif
87  DDValue value(str);
88  if (DDfetch(&sv, value)) {
89  const std::vector<double>& fvec = value.doubles();
90  int nval = (!fvec.empty()) ? static_cast<int>(fvec[0]) : 0;
91  return nval;
92  } else {
93  return 0;
94  }
95 }

References DDfetch(), str, pfDeepBoostedJetPreprocessParams_cfi::sv, and relativeConstraints::value.

Referenced by build().

Member Data Documentation

◆ nset_

const unsigned int MuonOffsetFromDD::nset_
private

Definition at line 25 of file MuonOffsetFromDD.h.

Referenced by build(), and MuonOffsetFromDD().

◆ specpars_

const std::vector<std::string> MuonOffsetFromDD::specpars_
private

Definition at line 24 of file MuonOffsetFromDD.h.

Referenced by build().

MuonOffsetFromDD::getNumber
int getNumber(const std::string &, const DDsvalues_type &)
Definition: MuonOffsetFromDD.cc:83
MuonOffsetFromDD::specpars_
const std::vector< std::string > specpars_
Definition: MuonOffsetFromDD.h:24
MuonOffsetFromDD::debugParameters
bool debugParameters(const MuonOffsetMap &)
Definition: MuonOffsetFromDD.cc:71
cms::DDFilteredView
Definition: DDFilteredView.h:70
MuonOffsetFromDD::nset_
const unsigned int nset_
Definition: MuonOffsetFromDD.h:25
cms::DDFilteredView::get
T get(const std::string &)
extract attribute value
cms::DDFilter
Definition: DDFilteredView.h:59
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
str
#define str(s)
Definition: TestProcessor.cc:52
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
dqmdumpme.k
k
Definition: dqmdumpme.py:60
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::DDDetector::worldVolume
dd4hep::Volume worldVolume() const
Handle to the world volume containing everything.
Definition: DDDetector.cc:48
value
Definition: value.py:1
DDValue
Definition: DDValue.h:21
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
unpackBuffers-CaloStage1.offsets
offsets
Definition: unpackBuffers-CaloStage1.py:127
DDFilteredView
Definition: DDFilteredView.h:20
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
MuonOffsetMap::muonMap_
std::unordered_map< std::string, std::pair< int, int > > muonMap_
Definition: MuonOffsetMap.h:14
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
cms::DDCompactView::detector
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34