CMS 3D CMS Logo

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

#include <TrackerParametersFromDD.h>

Public Member Functions

bool build (const DDCompactView *, PTrackerParameters &)
 
bool build (const cms::DDCompactView *, PTrackerParameters &)
 
 TrackerParametersFromDD ()
 
virtual ~TrackerParametersFromDD ()
 

Private Member Functions

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

Detailed Description

Definition at line 14 of file TrackerParametersFromDD.h.

Constructor & Destructor Documentation

◆ TrackerParametersFromDD()

TrackerParametersFromDD::TrackerParametersFromDD ( )
inline

Definition at line 16 of file TrackerParametersFromDD.h.

16 {}

◆ ~TrackerParametersFromDD()

virtual TrackerParametersFromDD::~TrackerParametersFromDD ( )
inlinevirtual

Definition at line 17 of file TrackerParametersFromDD.h.

17 {}

Member Function Documentation

◆ build() [1/2]

bool TrackerParametersFromDD::build ( const DDCompactView cvp,
PTrackerParameters ptp 
)

Definition at line 8 of file TrackerParametersFromDD.cc.

References dbl_to_int(), Skims_PA_cff::name, putOne(), AlCaHLTBitMon_QueryRunRegistry::string, findQualityFiles::v, DDCompactView::vector(), and PTrackerParameters::vpars.

Referenced by PTrackerParametersDBBuilder::beginRun().

8  {
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 }
std::vector< int > vpars
void putOne(int, std::vector< int > &, PTrackerParameters &)
std::vector< double > const & vector(std::string_view iKey) const
returns an empty container if not found
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

◆ build() [2/2]

bool TrackerParametersFromDD::build ( const cms::DDCompactView cpv,
PTrackerParameters ptp 
)

Definition at line 26 of file TrackerParametersFromDD.cc.

References cms::DDCompactView::detector(), mps_fire::i, putOne(), cond::impl::to_string(), HcalDetIdTransform::transform(), findQualityFiles::v, cms::DDDetector::vectors(), and PTrackerParameters::vpars.

26  {
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 }
std::vector< int > vpars
void putOne(int, std::vector< int > &, PTrackerParameters &)
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34
std::string to_string(const V &value)
Definition: OMSAccess.h:77
cms::DDVectorsMap const & vectors() const
Definition: DDDetector.h:17
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ putOne()

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

Definition at line 42 of file TrackerParametersFromDD.cc.

References B2GTnPMonitor_cfi::item, and PTrackerParameters::vitems.

Referenced by build().

42  {
44  item.id = subdet;
45  item.vpars = vpars;
46  ptp.vitems.emplace_back(item);
47 }
std::vector< Item > vitems