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 cms::DDCompactView *, PTrackerParameters &)
 
bool build (const 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 cms::DDCompactView cpv,
PTrackerParameters ptp 
)

Definition at line 26 of file TrackerParametersFromDD.cc.

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 }

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

◆ build() [2/2]

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

Definition at line 8 of file TrackerParametersFromDD.cc.

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 }

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

Referenced by PTrackerParametersDBBuilder::beginRun(), and TrackerParametersESModule::produce().

◆ putOne()

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

Definition at line 42 of file TrackerParametersFromDD.cc.

42  {
44  item.id = subdet;
45  item.vpars = vpars;
46  ptp.vitems.emplace_back(item);
47 }

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

Referenced by build().

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
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
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
PTrackerParameters::vitems
std::vector< Item > vitems
Definition: PTrackerParameters.h:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PTrackerParameters::vpars
std::vector< int > vpars
Definition: PTrackerParameters.h:19
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
PTrackerParameters::Item
Definition: PTrackerParameters.h:11
cms::DDCompactView::detector
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34