CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MTDParametersFromDD Class Reference

#include <MTDParametersFromDD.h>

Public Member Functions

bool build (const DDCompactView *, PMTDParameters &)
 
 MTDParametersFromDD ()
 
 MTDParametersFromDD (const edm::ParameterSet &)
 
virtual ~MTDParametersFromDD ()
 

Private Member Functions

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

Private Attributes

std::vector< PMTDParameters::Itemitems_
 
std::vector< int > pars_
 

Detailed Description

Definition at line 11 of file MTDParametersFromDD.h.

Constructor & Destructor Documentation

MTDParametersFromDD::MTDParametersFromDD ( )
inline

Definition at line 13 of file MTDParametersFromDD.h.

13 {}
MTDParametersFromDD::MTDParametersFromDD ( const edm::ParameterSet pset)

Definition at line 7 of file MTDParametersFromDD.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSetVector(), mps_fire::i, mps_monitormerge::items, items_, and pars_.

7  {
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 }
T getParameter(std::string const &) const
VParameterSet const & getParameterSetVector(std::string const &name) const
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::vector< PMTDParameters::Item > items_
std::vector< int > pars_
virtual MTDParametersFromDD::~MTDParametersFromDD ( )
inlinevirtual

Definition at line 15 of file MTDParametersFromDD.h.

References build(), and putOne().

15 {}

Member Function Documentation

bool MTDParametersFromDD::build ( const DDCompactView cvp,
PMTDParameters ptp 
)

Definition at line 21 of file MTDParametersFromDD.cc.

References DDVectorGetter::check(), dbl_to_int(), DDVectorGetter::get(), items_, dataset::name, pars_, putOne(), AlCaHLTBitMon_QueryRunRegistry::string, PMTDParameters::vitems_, and PMTDParameters::vpars_.

Referenced by MTDParametersESModule::produce(), and ~MTDParametersFromDD().

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 }
std::vector< Item > vitems_
void putOne(int, std::vector< int > &, PMTDParameters &)
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
bool check(const std::string &)
std::vector< PMTDParameters::Item > items_
std::vector< double > get(const std::string &)
std::vector< int > pars_
void MTDParametersFromDD::putOne ( int  subdet,
std::vector< int > &  vpars,
PMTDParameters ptp 
)
private

Definition at line 51 of file MTDParametersFromDD.cc.

References PMTDParameters::Item::id_, PMTDParameters::vitems_, and PMTDParameters::Item::vpars_.

Referenced by build(), and ~MTDParametersFromDD().

52 {
54  item.id_ = subdet;
55  item.vpars_ = vpars;
56  ptp.vitems_.emplace_back( item );
57 }
std::vector< Item > vitems_
std::vector< int > vpars_

Member Data Documentation

std::vector<PMTDParameters::Item> MTDParametersFromDD::items_
private

Definition at line 21 of file MTDParametersFromDD.h.

Referenced by build(), and MTDParametersFromDD().

std::vector<int> MTDParametersFromDD::pars_
private

Definition at line 22 of file MTDParametersFromDD.h.

Referenced by build(), and MTDParametersFromDD().