CMS 3D CMS Logo

MTDParametersFromDD.cc
Go to the documentation of this file.
6 
8  const edm::VParameterSet& items =
9  pset.getParameterSetVector("vitems");
10  pars_ = pset.getParameter<std::vector<int32_t> >("vpars");
11 
12  items_.resize(items.size());
13  for( unsigned i = 0; i < items.size(); ++i) {
14  auto& item = items_[i];
15  item.id_ = i+1;
16  item.vpars_ = items[i].getParameter<std::vector<int32_t> >("subdetPars");
17  }
18 }
19 
20 bool
22  PMTDParameters& ptp)
23 {
24  if( items_.empty() ) {
25  for( int subdet = 1; subdet <= 6; ++subdet )
26  {
27  std::stringstream sstm;
28  sstm << "Subdetector" << subdet;
29  std::string name = sstm.str();
30 
31  if( DDVectorGetter::check( name ))
32  {
33  std::vector<int> subdetPars = dbl_to_int( DDVectorGetter::get( name ));
34  putOne( subdet, subdetPars, ptp );
35  }
36  }
37  } else {
38  ptp.vitems_ = items_;
39  }
40 
41  if( pars_.empty() ) {
42  ptp.vpars_ = dbl_to_int( DDVectorGetter::get( "vPars" ));
43  } else {
44  ptp.vpars_ = pars_;
45  }
46 
47  return true;
48 }
49 
50 void
51 MTDParametersFromDD::putOne( int subdet, std::vector<int> & vpars, PMTDParameters& ptp )
52 {
54  item.id_ = subdet;
55  item.vpars_ = vpars;
56  ptp.vitems_.emplace_back( item );
57 }
T getParameter(std::string const &) const
VParameterSet const & getParameterSetVector(std::string const &name) const
std::vector< Item > vitems_
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
void putOne(int, std::vector< int > &, PMTDParameters &)
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
std::vector< int > vpars_
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
std::vector< int > vpars_
bool check(const std::string &)
std::vector< PMTDParameters::Item > items_
std::vector< double > get(const std::string &)
bool build(const DDCompactView *, PMTDParameters &)
std::vector< int > pars_