CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
MTDParametersFromDD Class Reference

#include <MTDParametersFromDD.h>

Public Member Functions

bool build (const cms::DDCompactView *, PMTDParameters &)
 
bool build (const DDCompactView *, PMTDParameters &)
 
 MTDParametersFromDD ()
 
virtual ~MTDParametersFromDD ()
 

Private Member Functions

void putOne (int, std::vector< int > &, PMTDParameters &)
 

Detailed Description

Definition at line 14 of file MTDParametersFromDD.h.

Constructor & Destructor Documentation

◆ MTDParametersFromDD()

MTDParametersFromDD::MTDParametersFromDD ( )
inline

Definition at line 16 of file MTDParametersFromDD.h.

16 {}

◆ ~MTDParametersFromDD()

virtual MTDParametersFromDD::~MTDParametersFromDD ( )
inlinevirtual

Definition at line 17 of file MTDParametersFromDD.h.

17 {}

Member Function Documentation

◆ build() [1/2]

bool MTDParametersFromDD::build ( const cms::DDCompactView cvp,
PMTDParameters ptp 
)

Definition at line 60 of file MTDParametersFromDD.cc.

60  {
61  cms::DDVectorsMap vmap = cvp->detector()->vectors();
62 
63  std::array<std::string, 2> mtdSubdet{{"BTL", "ETL"}};
64  int subdet(0);
65  for (const auto& name : mtdSubdet) {
66  subdet += 1;
67  for (auto const& it : vmap) {
68  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), name)) {
69  std::vector<int> subdetPars;
70  for (const auto& i : it.second)
71  subdetPars.emplace_back(std::round(i));
72  putOne(subdet, subdetPars, ptp);
73  }
74  }
75  }
76 
77  auto it = vmap.find("vPars");
78  if (it != end(vmap)) {
79  std::vector<int> tmpVec;
80  for (const auto& i : it->second)
81  tmpVec.emplace_back(std::round(i));
82  ptp.vpars_ = tmpVec;
83  }
84 
86  const cms::DDSpecParRegistry& mypar = cvp->specpars();
87  std::string attribute = "OnlyForMTDRecNumbering";
88  mypar.filter(ref, attribute, "MTD");
89 
90  std::string topoModeS(mypar.specPar("mtdNumbering")->strValue("TopologyMode"));
91  if (!topoModeS.empty()) {
92  int topoMode(-1);
94  topoMode = static_cast<int>(eparser);
95  ptp.topologyMode_ = topoMode;
96  } else {
97  throw cms::Exception("MTDParametersFromDD") << "Not found " << attribute.c_str() << " but needed.";
98  }
99 
100  return true;
101 }

References cms::DDCompactView::detector(), mps_fire::end, Exception, mps_fire::i, MTDTopologyMode::MTDStringToEnumParser(), Skims_PA_cff::name, cms::DDCompactView::specpars(), AlCaHLTBitMon_QueryRunRegistry::string, PMTDParameters::topologyMode_, cms::DDDetector::vectors(), and PMTDParameters::vpars_.

◆ build() [2/2]

bool MTDParametersFromDD::build ( const DDCompactView cvp,
PMTDParameters ptp 
)

Definition at line 31 of file MTDParametersFromDD.cc.

31  {
32  std::array<std::string, 2> mtdSubdet{{"BTL", "ETL"}};
33  int subdet(0);
34  for (const auto& name : mtdSubdet) {
35  auto const& v = cvp->vector(name);
36  if (!v.empty()) {
37  subdet += 1;
38  std::vector<int> subdetPars = dbl_to_int(v);
39  putOne(subdet, subdetPars, ptp);
40  }
41  }
42 
43  ptp.vpars_ = dbl_to_int(cvp->vector("vPars"));
44 
45  std::string attribute = "OnlyForMTDRecNumbering";
46  DDSpecificsHasNamedValueFilter filter1{attribute};
47  DDFilteredView fv1(*cvp, filter1);
48  bool ok = fv1.firstChild();
49  if (ok) {
50  DDsvalues_type sv(fv1.mergedSpecifics());
51  int topoMode = getMTDTopologyMode("TopologyMode", sv);
52  ptp.topologyMode_ = topoMode;
53  } else {
54  throw cms::Exception("MTDParametersFromDD") << "Not found " << attribute.c_str() << " but needed.";
55  }
56 
57  return true;
58 }

References dbl_to_int(), Exception, DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), Skims_PA_cff::name, convertSQLiteXML::ok, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, PMTDParameters::topologyMode_, findQualityFiles::v, DDCompactView::vector(), and PMTDParameters::vpars_.

Referenced by MTDParametersESModule::produce().

◆ putOne()

void MTDParametersFromDD::putOne ( int  subdet,
std::vector< int > &  vpars,
PMTDParameters ptp 
)
private

Definition at line 103 of file MTDParametersFromDD.cc.

103  {
105  item.id_ = subdet;
106  item.vpars_ = vpars;
107  ptp.vitems_.emplace_back(item);
108 }

References B2GTnPMonitor_cfi::item, and PMTDParameters::vitems_.

PMTDParameters::vpars_
std::vector< int > vpars_
Definition: PMTDParameters.h:19
mps_fire.i
i
Definition: mps_fire.py:428
PMTDParameters::vitems_
std::vector< Item > vitems_
Definition: PMTDParameters.h:18
cms::DDDetector::vectors
cms::DDVectorsMap const & vectors() const
Definition: DDDetector.h:17
cms::DDSpecParRefs
dd4hep::SpecParRefs DDSpecParRefs
Definition: DDCompactView.h:29
MTDTopologyMode::MTDStringToEnumParser
Mode MTDStringToEnumParser(const std::string &)
Definition: MTDTopologyMode.cc:7
DDCompactView::vector
std::vector< double > const & vector(std::string_view iKey) const
returns an empty container if not found
Definition: DDCompactView.cc:67
findQualityFiles.v
v
Definition: findQualityFiles.py:179
dbl_to_int
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
cms::DDSpecParRegistry
dd4hep::SpecParRegistry DDSpecParRegistry
Definition: DDCompactView.h:28
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
mps_fire.end
end
Definition: mps_fire.py:242
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MTDParametersFromDD::putOne
void putOne(int, std::vector< int > &, PMTDParameters &)
Definition: MTDParametersFromDD.cc:103
DDSpecificsHasNamedValueFilter
Definition: DDFilter.h:60
PMTDParameters::topologyMode_
int topologyMode_
Definition: PMTDParameters.h:20
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
MTDTopologyMode::Mode
Mode
Definition: MTDTopologyMode.h:13
PMTDParameters::Item
Definition: PMTDParameters.h:11
cms::DDCompactView::specpars
DDSpecParRegistry const & specpars() const
Definition: DDCompactView.h:35
Exception
Definition: hltDiff.cc:246
cms::DDVectorsMap
std::unordered_map< std::string, std::vector< double > > DDVectorsMap
Definition: DDNamespace.h:14
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDFilteredView
Definition: DDFilteredView.h:20
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