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 ( )
inline

Definition at line 16 of file TrackerParametersFromDD.h.

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

Definition at line 17 of file TrackerParametersFromDD.h.

References newFWLiteAna::build.

17 {}

Member Function Documentation

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

Definition at line 9 of file TrackerParametersFromDD.cc.

References DDVectorGetter::check(), dbl_to_int(), DDVectorGetter::get(), Skims_PA_cff::name, putOne(), AlCaHLTBitMon_QueryRunRegistry::string, and PTrackerParameters::vpars.

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

9  {
10  for (int subdet = 1; subdet <= 6; ++subdet) {
11  std::stringstream sstm;
12  sstm << "Subdetector" << subdet;
13  std::string name = sstm.str();
14 
15  if (DDVectorGetter::check(name)) {
16  std::vector<int> subdetPars = dbl_to_int(DDVectorGetter::get(name));
17  putOne(subdet, subdetPars, ptp);
18  }
19  }
20 
21  ptp.vpars = dbl_to_int(DDVectorGetter::get("vPars"));
22 
23  return true;
24 }
std::vector< int > vpars
void putOne(int, std::vector< int > &, PTrackerParameters &)
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 check(const std::string &)
std::vector< double > get(const std::string &)
bool TrackerParametersFromDD::build ( const cms::DDCompactView cvp,
PTrackerParameters ptp 
)

Definition at line 26 of file TrackerParametersFromDD.cc.

References cms::dd::compareEqual(), cms::DDCompactView::detector(), end, mps_fire::i, Skims_PA_cff::name, cms::dd::noNamespace(), putOne(), AlCaHLTBitMon_QueryRunRegistry::string, cms::DDDetector::vectors(), and PTrackerParameters::vpars.

26  {
27  cms::DDVectorsMap vmap = cvp->detector()->vectors();
28  for (int subdet = 1; subdet <= 6; ++subdet) {
29  std::stringstream sstm;
30  sstm << "Subdetector" << subdet;
31  std::string name = sstm.str();
32  for (auto const& it : vmap) {
33  if (cms::dd::compareEqual(cms::dd::noNamespace(it.first), name)) {
34  std::vector<int> subdetPars;
35  for (const auto& i : it.second)
36  subdetPars.emplace_back(std::round(i));
37  putOne(subdet, subdetPars, ptp);
38  }
39  }
40  }
41 
42  auto it = vmap.find("vPars");
43  if (it != end(vmap)) {
44  std::vector<int> tmpVec;
45  for (const auto& i : it->second)
46  tmpVec.emplace_back(std::round(i));
47  ptp.vpars = tmpVec;
48  }
49 
50  return true;
51 }
std::vector< int > vpars
void putOne(int, std::vector< int > &, PTrackerParameters &)
std::string_view noNamespace(std::string_view)
Definition: Filter.cc:61
DDVectorsMap const & vectors() const
Definition: DDDetector.h:22
tbb::concurrent_unordered_map< std::string, tbb::concurrent_vector< double >> DDVectorsMap
Definition: DDNamespace.h:14
#define end
Definition: vmac.h:39
bool compareEqual(std::string_view, std::string_view)
const cms::DDDetector * detector() const
Definition: DDCompactView.h:32
void TrackerParametersFromDD::putOne ( int  subdet,
std::vector< int > &  vpars,
PTrackerParameters ptp 
)
private