CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalParametersFromDD.cc
Go to the documentation of this file.
8 
9 namespace
10 {
11  double getTopologyMode( const char* s, const DDsvalues_type & sv )
12  {
13  DDValue val( s );
14  if( DDfetch( &sv, val ))
15  {
16  const std::vector<std::string> & fvec = val.strings();
17  if( fvec.size() == 0 )
18  {
19  throw cms::Exception( "HcalParametersFromDD" ) << "Failed to get " << s << " tag.";
20  }
21 
24 
25  return double( mode );
26  }
27  else
28  throw cms::Exception( "HcalParametersFromDD" ) << "Failed to get "<< s << " tag.";
29  }
30 }
31 
32 bool
34  PHcalParameters& php )
35 {
36  php.phioff = DDVectorGetter::get( "phioff" );
37  php.etaTable = DDVectorGetter::get( "etaTable" );
38  php.rTable = DDVectorGetter::get( "rTable" );
39  php.phibin = DDVectorGetter::get( "phibin" );
40  php.phitable = DDVectorGetter::get( "phitable" );
41  php.etaRange = DDVectorGetter::get( "etaRange" );
42  php.gparHF = DDVectorGetter::get( "gparHF" );
43  php.noff = dbl_to_int( DDVectorGetter::get( "noff" ));
44  php.Layer0Wt = DDVectorGetter::get( "Layer0Wt" );
45  php.HBGains = DDVectorGetter::get( "HBGains" );
46  php.HEGains = DDVectorGetter::get( "HEGains" );
47  php.HFGains = DDVectorGetter::get( "HFGains" );
48  php.etaMin = dbl_to_int( DDVectorGetter::get( "etaMin" ));
49  php.etaMax = dbl_to_int( DDVectorGetter::get( "etaMax" ));
50  php.HBShift = dbl_to_int( DDVectorGetter::get( "HBShift" ));
51  php.HEShift = dbl_to_int( DDVectorGetter::get( "HEShift" ));
52  php.HFShift = dbl_to_int( DDVectorGetter::get( "HFShift" ));
53 
54  php.etagroup = dbl_to_int( DDVectorGetter::get( "etagroup" ));
55  php.phigroup = dbl_to_int( DDVectorGetter::get( "phigroup" ));
56 
57  PHcalParameters::LayerItem layerGroupEta;
58  for( unsigned int i = 0; i < 27; ++i )
59  {
60  std::stringstream sstm;
61  sstm << "layerGroupEta" << i;
62  std::string tempName = sstm.str();
63 
64  if( DDVectorGetter::check( tempName ))
65  {
66  PHcalParameters::LayerItem layerGroupEta;
67  layerGroupEta.layer = i;
68  layerGroupEta.layerGroup = dbl_to_int( DDVectorGetter::get( tempName ));
69  php.layerGroupEta.push_back( layerGroupEta );
70  }
71  }
72 
73  // FIXME: HcalTopology mode can be defined as double.
74  // This is for consistency with SLHC releases.
75  //
76  std::string attribute = "OnlyForHcalRecNumbering";
77  std::string value = "any";
78  DDValue val( attribute, value, 0.0 );
79 
81  filter.setCriteria( val,
83  DDLogOp::AND, true, // compare strings
84  true // use merged-specifics or simple-specifics
85  );
86  DDFilteredView fv( *cpv );
87  fv.addFilter( filter );
88  bool ok = fv.firstChild();
89 
90  if( !ok ) throw cms::Exception( "HcalParametersFromDD" ) << "Not found "<< attribute.c_str() << " but needed.";
91 
93 
94  php.topologyMode = getTopologyMode( "TopologyMode", sv );
95 
96  return true;
97 }
std::vector< double > HEGains
std::vector< double > Layer0Wt
int i
Definition: DBlmapReader.cc:9
std::vector< int > HBShift
std::vector< double > phioff
std::vector< int > etaMax
std::vector< int > layerGroup
void addFilter(const DDFilter &, DDLogOp op=DDLogOp::AND)
std::vector< double > HBGains
std::vector< int > phigroup
type of data representation of DDCompactView
Definition: DDCompactView.h:76
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80
bool build(const DDCompactView *, PHcalParameters &)
std::vector< double > HFGains
std::vector< double > rTable
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.cc:4
std::vector< int > HFShift
bool check(const std::string &)
std::vector< int > etaMin
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:19
std::vector< double > phibin
std::vector< double > get(const std::string &)
std::vector< int > etagroup
std::vector< double > phitable
DDsvalues_type mergedSpecifics() const
std::vector< double > etaRange
std::vector< double > etaTable
bool firstChild()
set the current node to the first child ...
std::vector< int > noff
std::vector< int > HEShift
std::vector< LayerItem > layerGroupEta
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:245
std::vector< double > gparHF
T parseString(const std::string &value)
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:32