CMS 3D CMS Logo

TrackerParametersFromDD.cc
Go to the documentation of this file.
6 #include <DD4hep/Filter.h>
7 
9  for (int subdet = 1; subdet <= 6; ++subdet) {
10  std::stringstream sstm;
11  sstm << "Subdetector" << subdet;
12  std::string name = sstm.str();
13 
14  auto const& v = cvp->vector(name);
15  if (!v.empty()) {
16  std::vector<int> subdetPars = dbl_to_int(v);
17  putOne(subdet, subdetPars, ptp);
18  }
19  }
20 
21  ptp.vpars = dbl_to_int(cvp->vector("vPars"));
22 
23  return true;
24 }
25 
27  const auto& vmap = cpv->detector()->vectors();
28  for (int subdet = 1; subdet <= 6; ++subdet) {
29  const auto& v = vmap.at("trackerParameters:Subdetector" + std::to_string(subdet));
30  std::vector<int> subdetPars;
31  std::transform(v.begin(), v.end(), std::back_inserter(subdetPars), [](int i) -> int { return std::round(i); });
32  putOne(subdet, subdetPars, ptp);
33  }
34 
35  // get "vPars" parameter block from XMLs.
36  const auto& vPars = vmap.at("trackerParameters:vPars");
37  std::transform(vPars.begin(), vPars.end(), std::back_inserter(ptp.vpars), [](int i) -> int { return std::round(i); });
38 
39  return true;
40 }
41 
42 void TrackerParametersFromDD::putOne(int subdet, std::vector<int>& vpars, PTrackerParameters& ptp) {
44  item.id = subdet;
45  item.vpars = vpars;
46  ptp.vitems.emplace_back(item);
47 }
TrackerParametersFromDD.h
mps_fire.i
i
Definition: mps_fire.py:428
TrackerParametersFromDD::putOne
void putOne(int, std::vector< int > &, PTrackerParameters &)
Definition: TrackerParametersFromDD.cc:42
cms::DDDetector::vectors
cms::DDVectorsMap const & vectors() const
Definition: DDDetector.h:17
PTrackerParameters
Definition: PTrackerParameters.h:6
PTrackerParameters.h
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
DDCompactView.h
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
DDCompactView.h
PTrackerParameters::vitems
std::vector< Item > vitems
Definition: PTrackerParameters.h:18
DDutils.h
PTrackerParameters::vpars
std::vector< int > vpars
Definition: PTrackerParameters.h:19
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::DDCompactView
Definition: DDCompactView.h:31
TrackerParametersFromDD::build
bool build(const DDCompactView *, PTrackerParameters &)
Definition: TrackerParametersFromDD.cc:8
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
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
PTrackerParameters::Item
Definition: PTrackerParameters.h:11
cms::DDCompactView::detector
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34