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) {
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::dd::compareEqual(), cms::DDCompactView::detector(), end, Exception, cms::DDSpecParRegistry::filter(), mps_fire::i, MTDTopologyMode::MTDStringToEnumParser(), Skims_PA_cff::name, cms::dd::noNamespace(), cms::DDSpecParRegistry::specPar(), cms::DDCompactView::specpars(), AlCaHLTBitMon_QueryRunRegistry::string, cms::DDSpecPar::strValue(), PMTDParameters::topologyMode_, cms::DDDetector::vectors(), and PMTDParameters::vpars_.

◆ build() [2/2]

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

Definition at line 32 of file MTDParametersFromDD.cc.

32  {
33  std::array<std::string, 2> mtdSubdet{{"BTL", "ETL"}};
34  int subdet(0);
35  for (const auto& name : mtdSubdet) {
37  subdet += 1;
38  std::vector<int> subdetPars = dbl_to_int(DDVectorGetter::get(name));
39  putOne(subdet, subdetPars, ptp);
40  }
41  }
42 
43  ptp.vpars_ = dbl_to_int(DDVectorGetter::get("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 DDVectorGetter::check(), dbl_to_int(), Exception, DDFilteredView::firstChild(), DDVectorGetter::get(), DDFilteredView::mergedSpecifics(), Skims_PA_cff::name, convertSQLiteXML::ok, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, PMTDParameters::topologyMode_, 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:355
PMTDParameters::vitems_
std::vector< Item > vitems_
Definition: PMTDParameters.h:18
cms::DDVectorsMap
tbb::concurrent_unordered_map< std::string, tbb::concurrent_vector< double > > DDVectorsMap
Definition: DDNamespace.h:14
cms::DDSpecParRegistry::specPar
const DDSpecPar * specPar(std::string_view) const
Definition: DDSpecparRegistry.cc:145
cms::DDSpecParRegistry
Definition: DDSpecParRegistry.h:32
MTDTopologyMode::MTDStringToEnumParser
Mode MTDStringToEnumParser(const std::string &)
Definition: MTDTopologyMode.cc:7
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
DDVectorGetter::get
std::vector< double > get(const std::string &)
Definition: DDVectorGetter.h:28
end
#define end
Definition: vmac.h:39
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:226
cms::dd::noNamespace
std::string_view noNamespace(std::string_view)
Definition: Filter.cc:63
cms::DDSpecParRefs
std::vector< const DDSpecPar * > DDSpecParRefs
Definition: DDSpecParRegistry.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::DDSpecPar::strValue
std::string_view strValue(const std::string &) const
Definition: DDSpecparRegistry.cc:10
DDVectorGetter::check
bool check(const std::string &)
Definition: DDVectorGetter.h:13
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
cms::dd::compareEqual
bool compareEqual(std::string_view, std::string_view)
MTDTopologyMode::Mode
Mode
Definition: MTDTopologyMode.h:13
PMTDParameters::Item
Definition: PMTDParameters.h:11
cms::DDCompactView::specpars
DDSpecParRegistry const & specpars() const
Definition: DDCompactView.h:33
cms::DDSpecParRegistry::filter
void filter(DDSpecParRefs &, const std::string &, const std::string &="") const
Definition: DDSpecparRegistry.cc:98
Exception
Definition: hltDiff.cc:246
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::DDDetector::vectors
DDVectorsMap const & vectors() const
Definition: DDDetector.h:22
cms::DDCompactView::detector
const cms::DDDetector * detector() const
Definition: DDCompactView.h:32