CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( )
inline

Definition at line 16 of file TrackerParametersFromDD.h.

16 {}
virtual TrackerParametersFromDD::~TrackerParametersFromDD ( )
inlinevirtual

Definition at line 17 of file TrackerParametersFromDD.h.

17 {}

Member Function Documentation

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

Definition at line 8 of file TrackerParametersFromDD.cc.

References dbl_to_int(), mergeVDriftHistosByStation::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
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(), 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 &)
cms::DDVectorsMap const & vectors() const
Definition: DDDetector.h:17
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34
unsigned transform(const HcalDetId &id, unsigned transformCode)
void TrackerParametersFromDD::putOne ( int  subdet,
std::vector< int > &  vpars,
PTrackerParameters ptp 
)
private

Definition at line 42 of file TrackerParametersFromDD.cc.

References PTrackerParameters::Item::id, B2GTnPMonitor_cfi::item, PTrackerParameters::vitems, and PTrackerParameters::Item::vpars.

Referenced by build().

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