CMS 3D CMS Logo

List of all members | Public Member Functions
HcalParametersFromDD Class Reference

#include <HcalParametersFromDD.h>

Public Member Functions

bool build (const DDCompactView *, HcalParameters &)
 
 HcalParametersFromDD ()
 
virtual ~HcalParametersFromDD ()
 

Detailed Description

Definition at line 7 of file HcalParametersFromDD.h.

Constructor & Destructor Documentation

HcalParametersFromDD::HcalParametersFromDD ( )
inline

Definition at line 9 of file HcalParametersFromDD.h.

9 {}
virtual HcalParametersFromDD::~HcalParametersFromDD ( )
inlinevirtual

Definition at line 10 of file HcalParametersFromDD.h.

References build().

10 {}

Member Function Documentation

bool HcalParametersFromDD::build ( const DDCompactView cpv,
HcalParameters php 
)

Definition at line 43 of file HcalParametersFromDD.cc.

References DDVectorGetter::check(), gather_cfg::cout, dbl_to_int(), TauDecayModes::dec, HcalParameters::dzVcal, HcalParameters::etagroup, HcalParameters::etaMax, HcalParameters::etaMin, HcalParameters::etaRange, HcalParameters::etaTable, HcalParameters::etaTableHF, Exception, DDFilteredView::firstChild(), relativeConstraints::geom, DDVectorGetter::get(), HcalGeomParameters::getConstDzHF(), HcalGeomParameters::getConstRHO(), HcalGeomParameters::getModHalfHBHE(), HcalParameters::gparHF, HcalParameters::HBGains, HcalParameters::HBShift, HcalParameters::HEGains, HcalParameters::HEShift, HcalParameters::HFGains, HcalParameters::HFShift, mps_fire::i, createfilelist::int, gen::k, HcalParameters::LayerItem::layer, HcalParameters::Layer0Wt, HcalParameters::LayerItem::layerGroup, HcalParameters::layerGroupEtaRec, HcalParameters::layerGroupEtaSim, HcalGeomParameters::loadGeometry(), cmsBatch::log, HcalParameters::maxDepth, DDFilteredView::mergedSpecifics(), HcalParameters::modHB, HcalParameters::modHE, HcalParameters::noff, convertSQLiteXML::ok, HcalParameters::phibin, HcalParameters::phigroup, HcalParameters::phioff, HcalParameters::phitable, HcalParameters::rHO, HcalParameters::rTable, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, funct::tan(), and HcalParameters::topologyMode.

Referenced by HcalParametersDBBuilder::beginRun(), HcalParametersESModule::produce(), and ~HcalParametersFromDD().

44  {
45 
46  //Special parameters at simulation level
47  std::string attribute = "OnlyForHcalSimNumbering";
48  DDSpecificsHasNamedValueFilter filter1{attribute};
49  DDFilteredView fv1(*cpv,filter1);
50  bool ok = fv1.firstChild();
51 
52  const int nEtaMax=100;
53 
54  if (ok) {
56  geom->loadGeometry( fv1, php );
57  php.modHB = geom->getModHalfHBHE(0);
58  php.modHE = geom->getModHalfHBHE(1);
59  php.dzVcal = geom->getConstDzHF();
60  geom->getConstRHO(php.rHO);
61 
62  php.phioff = DDVectorGetter::get( "phioff" );
63  php.etaTable = DDVectorGetter::get( "etaTable" );
64  php.rTable = DDVectorGetter::get( "rTable" );
65  php.phibin = DDVectorGetter::get( "phibin" );
66  php.phitable = DDVectorGetter::get( "phitable" );
67  for (unsigned int i = 1; i<=nEtaMax; ++i) {
68  std::stringstream sstm;
69  sstm << "layerGroupSimEta" << i;
70  std::string tempName = sstm.str();
71  if (DDVectorGetter::check(tempName)) {
72  HcalParameters::LayerItem layerGroupEta;
73  layerGroupEta.layer = i;
74  layerGroupEta.layerGroup = dbl_to_int(DDVectorGetter::get(tempName));
75  php.layerGroupEtaSim.emplace_back(layerGroupEta);
76  }
77  }
78  php.etaMin = dbl_to_int( DDVectorGetter::get( "etaMin" ));
79  php.etaMax = dbl_to_int( DDVectorGetter::get( "etaMax" ));
80  php.etaMin[0] = 1;
81  if (php.etaMax[1] >= php.etaMin[1])
82  php.etaMax[1] = static_cast<int>(php.etaTable.size())-1;
83  php.etaMax[2] = php.etaMin[2]+(int)(php.rTable.size())-2;
84  php.etaRange = DDVectorGetter::get( "etaRange" );
85  php.gparHF = DDVectorGetter::get( "gparHF" );
86  php.noff = dbl_to_int( DDVectorGetter::get( "noff" ));
87  php.Layer0Wt = DDVectorGetter::get( "Layer0Wt" );
88  php.HBGains = DDVectorGetter::get( "HBGains" );
89  php.HBShift = dbl_to_int( DDVectorGetter::get( "HBShift" ));
90  php.HEGains = DDVectorGetter::get( "HEGains" );
91  php.HEShift = dbl_to_int( DDVectorGetter::get( "HEShift" ));
92  php.HFGains = DDVectorGetter::get( "HFGains" );
93  php.HFShift = dbl_to_int( DDVectorGetter::get( "HFShift" ));
94  php.maxDepth = dbl_to_int( DDVectorGetter::get( "MaxDepth" ));
95  } else {
96  throw cms::Exception("HcalParametersFromDD") << "Not found "<< attribute.c_str() << " but needed.";
97  }
98  for( unsigned int i = 0; i < php.rTable.size(); ++i ) {
99  unsigned int k = php.rTable.size() - i - 1;
100  php.etaTableHF.emplace_back( -log( tan( 0.5 * atan( php.rTable[k] / php.gparHF[4] ))));
101  }
102  //Special parameters at reconstruction level
103  attribute = "OnlyForHcalRecNumbering";
104  DDSpecificsHasNamedValueFilter filter2{attribute};
105  DDFilteredView fv2(*cpv,filter2);
106  ok = fv2.firstChild();
107  if (ok) {
108  DDsvalues_type sv(fv2.mergedSpecifics());
109  int topoMode = getTopologyMode("TopologyMode", sv, true);
110  int trigMode = getTopologyMode("TriggerMode", sv, false);
111  php.topologyMode = ((trigMode&0xFF)<<8) | (topoMode&0xFF);
112  php.etagroup = dbl_to_int( DDVectorGetter::get( "etagroup" ));
113  php.phigroup = dbl_to_int( DDVectorGetter::get( "phigroup" ));
114  for (unsigned int i = 1; i<=nEtaMax; ++i) {
115  std::stringstream sstm;
116  sstm << "layerGroupRecEta" << i;
117  std::string tempName = sstm.str();
118  if (DDVectorGetter::check(tempName)) {
119  HcalParameters::LayerItem layerGroupEta;
120  layerGroupEta.layer = i;
121  layerGroupEta.layerGroup = dbl_to_int(DDVectorGetter::get(tempName));
122  php.layerGroupEtaRec.emplace_back(layerGroupEta);
123  }
124  }
125  } else {
126  throw cms::Exception( "HcalParametersFromDD" ) << "Not found "<< attribute.c_str() << " but needed.";
127  }
128 
129 #ifdef EDM_ML_DEBUG
130  int i(0);
131  std::cout << "HcalParametersFromDD: MaxDepth: ";
132  for (const auto& it : php.maxDepth) std::cout << it << ", ";
133  std::cout << std::endl;
134  std::cout << "HcalParametersFromDD: ModHB [" << php.modHB.size() << "]: ";
135  for (const auto& it : php.modHB) std::cout << it << ", ";
136  std::cout << std::endl;
137  std::cout << "HcalParametersFromDD: ModHE [" << php.modHE.size() << "]: ";
138  for (const auto& it : php.modHE) std::cout << it << ", ";
139  std::cout << std::endl;
140  std::cout << "HcalParametersFromDD: " << php.phioff.size() << " phioff values";
141  std::vector<double>::const_iterator it;
142  for (it=php.phioff.begin(), i=0; it!=php.phioff.end(); ++it)
143  std::cout << " [" << ++i << "] = " << (*it)/CLHEP::deg;
144  std::cout << std::endl;
145  std::cout << "HcalParametersFromDD: " << php.etaTable.size() << " entries for etaTable";
146  for (it=php.etaTable.begin(), i=0; it!=php.etaTable.end(); ++it)
147  std::cout << " [" << ++i << "] = " << (*it);
148  std::cout << std::endl;
149  std::cout << "HcalParametersFromDD: " << php.rTable.size() << " entries for rTable";
150  for (it=php.rTable.begin(), i=0; it!=php.rTable.end(); ++it)
151  std::cout << " [" << ++i << "] = " << (*it)/CLHEP::cm;
152  std::cout << std::endl;
153  std::cout << "HcalParametersFromDD: " << php.phibin.size() << " phibin values";
154  for (it=php.phibin.begin(), i=0; it!=php.phibin.end(); ++it)
155  std::cout << " [" << ++i << "] = " << (*it)/CLHEP::deg;
156  std::cout << std::endl;
157  std::cout << "HcalParametersFromDD: " << php.phitable.size() << " phitable values";
158  for (it=php.phitable.begin(), i=0; it!=php.phitable.end(); ++it)
159  std::cout << " [" << ++i << "] = " << (*it)/CLHEP::deg;
160  std::cout << std::endl;
161  std::cout << "HcalParametersFromDD: " << php.layerGroupEtaSim.size() << " layerGroupEtaSim blocks" << std::endl;
162  std::vector<HcalParameters::LayerItem>::const_iterator jt;
163  std::vector<int>::const_iterator kt;
164  for (unsigned int k=0; k < php.layerGroupEtaSim.size(); ++k) {
165  std::cout << "layerGroupEtaSim[" << k << "] Layer " << php.layerGroupEtaSim[k].layer;
166  for (kt=php.layerGroupEtaSim[k].layerGroup.begin(), i=0; kt!=php.layerGroupEtaSim[k].layerGroup.end(); ++kt)
167  std::cout << " " << ++i << ":" << (*kt);
168  std::cout << std::endl;
169  }
170  std::cout << "HcalParametersFromDD: " << php.etaMin.size() << " etaMin values";
171  for (kt=php.etaMin.begin(), i=0; kt!=php.etaMin.end(); ++kt)
172  std::cout << " [" << ++i << "] = " << (*kt);
173  std::cout << std::endl;
174  std::cout << "HcalParametersFromDD: " << php.etaMax.size() << " etaMax values";
175  for (kt=php.etaMax.begin(), i=0; kt!=php.etaMax.end(); ++kt)
176  std::cout << " [" << ++i << "] = " << (*kt);
177  std::cout << std::endl;
178  std::cout << "HcalParametersFromDD: " << php.etaRange.size() << " etaRange values";
179  for (it=php.etaRange.begin(), i=0; it!=php.etaRange.end(); ++it)
180  std::cout << " [" << ++i << "] = " << (*it);
181  std::cout << std::endl;
182  std::cout << "HcalParametersFromDD: " << php.gparHF.size() << " gparHF values";
183  for (it=php.gparHF.begin(), i=0; it!=php.gparHF.end(); ++it)
184  std::cout << " [" << ++i << "] = " << (*it)/CLHEP::cm;
185  std::cout << std::endl;
186  std::cout << "HcalParametersFromDD: " << php.noff.size() << " noff values";
187  for (kt=php.noff.begin(), i=0; kt!=php.noff.end(); ++kt)
188  std::cout << " [" << ++i << "] = " << (*kt);
189  std::cout << std::endl;
190  std::cout << "HcalParametersFromDD: " << php.Layer0Wt.size() << " Layer0Wt values";
191  for (it=php.Layer0Wt.begin(), i=0; it!=php.Layer0Wt.end(); ++it)
192  std::cout << " [" << ++i << "] = " << (*it);
193  std::cout << std::endl;
194  std::cout << "HcalParametersFromDD: " << php.HBGains.size() << " Shift/Gains values for HB";
195  for (unsigned k=0; k<php.HBGains.size(); ++k)
196  std::cout << " [" << k << "] = " << php.HBShift[k] << ":" << php.HBGains[k];
197  std::cout << std::endl;
198  std::cout << "HcalParametersFromDD: " << php.HEGains.size() << " Shift/Gains values for HE";
199  for (unsigned k=0; k<php.HEGains.size(); ++k)
200  std::cout << " [" << k << "] = " << php.HEShift[k] << ":" << php.HEGains[k];
201  std::cout << std::endl;
202  std::cout << "HcalParametersFromDD: " << php.HFGains.size() << " Shift/Gains values for HF";
203  for (unsigned k=0; k<php.HFGains.size(); ++k)
204  std::cout << " [" << k << "] = " << php.HFShift[k] << ":" << php.HFGains[k];
205  std::cout << std::endl;
206  std::cout << "HcalParametersFromDD: " << php.etagroup.size() << " etagroup values";
207  for (kt=php.etagroup.begin(), i=0; kt!=php.etagroup.end(); ++kt)
208  std::cout << " [" << ++i << "] = " << (*kt);
209  std::cout << std::endl;
210  std::cout << "HcalParametersFromDD: " << php.phigroup.size() << " phigroup values";
211  for (kt=php.phigroup.begin(), i=0; kt!=php.phigroup.end(); ++kt)
212  std::cout << " [" << ++i << "] = " << (*kt);
213  std::cout << std::endl;
214  std::cout << "HcalParametersFromDD: " << php.layerGroupEtaRec.size() << " layerGroupEtaRec blocks" << std::endl;
215  for (unsigned int k=0; k < php.layerGroupEtaRec.size(); ++k) {
216  std::cout << "layerGroupEtaRec[" << k << "] Layer " << php.layerGroupEtaRec[k].layer;
217  for (kt=php.layerGroupEtaRec[k].layerGroup.begin(), i=0; kt!=php.layerGroupEtaRec[k].layerGroup.end(); ++kt)
218  std::cout << " " << ++i << ":" << (*kt);
219  std::cout << std::endl;
220  }
221  std::cout << "HcalParametersFromDD: (topology|trigger)Mode " << std::hex
222  << php.topologyMode << std::dec << std::endl;
223 #endif
224 
225  return true;
226 }
std::vector< double > etaTable
std::vector< int > etagroup
void loadGeometry(const DDFilteredView &_fv, HcalParameters &php)
std::vector< double > etaRange
std::vector< double > HBGains
std::vector< int > getModHalfHBHE(const int type) const
std::vector< int > HEShift
double getConstDzHF() const
std::vector< double > etaTableHF
void getConstRHO(std::vector< double > &) const
std::vector< int > etaMax
std::vector< int > modHB
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< LayerItem > layerGroupEtaSim
bool check(const std::string &)
std::vector< double > rHO
std::vector< int > layerGroup
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< int > modHE
std::vector< int > HFShift
std::vector< double > get(const std::string &)
int k[5][pyjets_maxn]
std::vector< double > HEGains
std::vector< double > phioff
std::vector< double > gparHF
std::vector< double > Layer0Wt
std::vector< double > rTable
std::vector< double > phitable
std::vector< double > phibin
std::vector< LayerItem > layerGroupEtaRec
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > HFGains
std::vector< int > noff
std::vector< int > HBShift
std::vector< int > maxDepth
std::vector< int > phigroup
std::vector< int > etaMin