CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalGeomParameters Class Reference

#include <HcalGeomParameters.h>

Public Member Functions

double getConstDzHF () const
 
void getConstRHO (std::vector< double > &) const
 
std::vector< int > getModHalfHBHE (const int type) const
 
 HcalGeomParameters ()
 
void loadGeometry (const DDFilteredView &_fv, HcalParameters &php)
 
 ~HcalGeomParameters ()
 

Private Member Functions

unsigned find (int element, std::vector< int > &array) const
 
double getEta (double r, double z) const
 

Private Attributes

double dlShort
 
double dzVcal
 
double etaHO [4]
 
int nmodHB
 
int nmodHE
 
int nzHB
 
int nzHE
 
double rminHO
 
double zVcal
 

Detailed Description

this class extracts some geometry constants from CompactView to be used by Reco Geometry/Topology

Date:
2015/06/25 00:06:50
Author
Sunanda Banerjee, Fermilab sunan.nosp@m.da.b.nosp@m.anerj.nosp@m.ee@c.nosp@m.ern.c.nosp@m.h

Definition at line 26 of file HcalGeomParameters.h.

Constructor & Destructor Documentation

HcalGeomParameters::HcalGeomParameters ( )

Definition at line 20 of file HcalGeomParameters.cc.

References gather_cfg::cout.

20  {
21 #ifdef DebugLog
22  std::cout << "HcalGeomParameters::HcalGeomParameters ( const DDCompactView& cpv ) constructor" << std::endl;
23 #endif
24 }
tuple cout
Definition: gather_cfg.py:145
HcalGeomParameters::~HcalGeomParameters ( )

Definition at line 26 of file HcalGeomParameters.cc.

References gather_cfg::cout.

26  {
27 #ifdef DebugLog
28  std::cout << "HcalGeomParameters::destructed!!!" << std::endl;
29 #endif
30 }
tuple cout
Definition: gather_cfg.py:145

Member Function Documentation

unsigned int HcalGeomParameters::find ( int  element,
std::vector< int > &  array 
) const
private

Definition at line 49 of file HcalGeomParameters.cc.

References i.

Referenced by loadGeometry().

50  {
51  unsigned int id = array.size();
52  for (unsigned int i = 0; i < array.size(); i++) {
53  if (element == array[i]) {
54  id = i;
55  break;
56  }
57  }
58  return id;
59 }
int i
Definition: DBlmapReader.cc:9
tuple array
Definition: mps_check.py:181
double HcalGeomParameters::getConstDzHF ( ) const
inline

Definition at line 33 of file HcalGeomParameters.h.

References dzVcal.

Referenced by HcalParametersFromDD::build().

33 {return dzVcal;}
void HcalGeomParameters::getConstRHO ( std::vector< double > &  rHO) const

Definition at line 32 of file HcalGeomParameters.cc.

References etaHO, i, and rminHO.

Referenced by HcalParametersFromDD::build().

32  {
33 
34  rHO.push_back(rminHO);
35  for (int i=0; i<4; ++i) rHO.push_back(etaHO[i]);
36 }
int i
Definition: DBlmapReader.cc:9
double HcalGeomParameters::getEta ( double  r,
double  z 
) const
private

Definition at line 61 of file HcalGeomParameters.cc.

References gather_cfg::cout, dqm-mbProfile::log, funct::tan(), and tmp.

Referenced by loadGeometry().

61  {
62 
63  double tmp = 0;
64  if (z != 0) tmp = -log(tan(0.5*atan(r/z)));
65 #ifdef DebugLog
66  std::cout << "HcalGeomParameters::getEta " << r << " " << z << " ==> "
67  << tmp << std::endl;
68 #endif
69  return tmp;
70 }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
tuple cout
Definition: gather_cfg.py:145
std::vector< int > HcalGeomParameters::getModHalfHBHE ( const int  type) const

Definition at line 38 of file HcalGeomParameters.cc.

References nmodHB, nmodHE, nzHB, and nzHE.

Referenced by HcalParametersFromDD::build().

38  {
39 
40  std::vector<int> modHalf;
41  if (type == 0) {
42  modHalf.push_back(nmodHB); modHalf.push_back(nzHB);
43  } else {
44  modHalf.push_back(nmodHE); modHalf.push_back(nzHE);
45  }
46  return modHalf;
47 }
type
Definition: HCALResponse.h:21
void HcalGeomParameters::loadGeometry ( const DDFilteredView _fv,
HcalParameters php 
)

Definition at line 72 of file HcalGeomParameters.cc.

References funct::abs(), filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), funct::cos(), gather_cfg::cout, ddcons, ddpolycone_rrz, ddtubs, HcalParameters::drHB, HcalParameters::dx1HE, HcalParameters::dx2HE, HcalParameters::dxHB, HcalParameters::dyHB, HcalParameters::dyHE, HcalParameters::dzHE, dzVcal, etaHO, find(), citk::for(), newFWLiteAna::found, getEta(), DDBox::halfX(), DDBox::halfY(), DDTrap::halfZ(), DDBox::halfZ(), i, cuy::ib, reco::if(), j, relval_2017::k, GetRecoTauVFromDQM_MC_cff::kk, HcalParameters::layHB, HcalParameters::layHE, DDFilteredView::logicalPart(), min(), DDBase< N, C >::name(), DDFilteredView::next(), nmodHB, nmodHE, nzHB, nzHE, DDSolid::parameters(), HcalParameters::rHB, HcalParameters::rhoxHB, HcalParameters::rhoxHE, DDTubs::rIn(), rminHO, DDTubs::rOut(), DDSolid::shape(), DDLogicalPart::solid(), lumiQTWidget::t, funct::tan(), tmp, DDFilteredView::translation(), DDTrap::x1(), DDTrap::x2(), DDTrap::x3(), DDTrap::x4(), DDTrap::y1(), DDTrap::y2(), DDTubs::zhalf(), HcalParameters::zHE, HcalParameters::zHO, HcalParameters::zxHB, and HcalParameters::zxHE.

Referenced by HcalParametersFromDD::build().

73  {
74 
75  DDFilteredView fv = _fv;
76  bool dodet=true, hf=false;
77  std::vector<double> rb(20,0.0), ze(20,0.0), thkb(20,-1.0), thke(20,-1.0);
78  std::vector<int> ib(20,0), ie(20,0);
79  std::vector<int> izb, phib, ize, phie;
80  std::vector<double> rxb;
81  php.rhoxHB.clear(); php.zxHB.clear(); php.dyHB.clear(); php.dxHB.clear();
82  php.layHB.clear(); php.layHE.clear();
83  php.zxHE.clear(); php.rhoxHE.clear(); php.dyHE.clear(); php.dx1HE.clear(); php.dx2HE.clear();
84  dzVcal = -1.;
85 
86  while (dodet) {
88  std::vector<int> copy = fv.copyNumbers();
89  const DDSolid & sol = fv.logicalPart().solid();
90  int idet = 0, lay = -1;
91  int nsiz = (int)(copy.size());
92  if (nsiz>0) lay = copy[nsiz-1]/10;
93  if (nsiz>1) idet = copy[nsiz-2]/1000;
94  double dx=0, dy=0, dz=0, dx1=0, dx2=0;
95  if (sol.shape() == 1) {
96  const DDBox & box = static_cast<DDBox>(fv.logicalPart().solid());
97  dx = box.halfX();
98  dy = box.halfY();
99  dz = box.halfZ();
100  } else if (sol.shape() == 3) {
101  const DDTrap & trp = static_cast<DDTrap>(fv.logicalPart().solid());
102  dx1= trp.x1();
103  dx2= trp.x2();
104  dx = 0.25*(trp.x1()+trp.x2()+trp.x3()+trp.x4());
105  dy = 0.5*(trp.y1()+trp.y2());
106  dz = trp.halfZ();
107  } else if (sol.shape() == 2) {
108  const DDTubs & tub = static_cast<DDTubs>(fv.logicalPart().solid());
109  dx = tub.rIn();
110  dy = tub.rOut();
111  dz = tub.zhalf();
112  }
113  if (idet == 3) {
114  // HB
115 #ifdef DebugLog
116  std::cout << "HB " << sol.name() << " Shape " << sol.shape()
117  << " Layer " << lay << " R " << t.Rho() << std::endl;
118 #endif
119  if (lay >=0 && lay < 20) {
120  ib[lay]++;
121  rb[lay] += t.Rho();
122  if (thkb[lay] <= 0) {
123  if (lay < 17) thkb[lay] = dx;
124  else thkb[lay] = std::min(dx,dy);
125  }
126  if (lay < 17) {
127  bool found = false;
128  for (unsigned int k=0; k<rxb.size(); k++) {
129  if (std::abs(rxb[k]-t.Rho()) < 0.01) {
130  found = true;
131  break;
132  }
133  }
134  if (!found) {
135  rxb.push_back(t.Rho());
136  php.rhoxHB.push_back(t.Rho()*std::cos(t.phi()));
137  php.zxHB.push_back(std::abs(t.z()));
138  php.dyHB.push_back(2.*dy);
139  php.dxHB.push_back(2.*dz);
140  php.layHB.push_back(lay);
141  }
142  }
143  }
144  if (lay == 2) {
145  int iz = copy[nsiz-5];
146  int fi = copy[nsiz-4];
147  unsigned int it1 = find(iz, izb);
148  if (it1 == izb.size()) izb.push_back(iz);
149  unsigned int it2 = find(fi, phib);
150  if (it2 == phib.size()) phib.push_back(fi);
151  }
152  if (lay == 18) {
153  int ifi=-1, ich=-1;
154  if (nsiz>2) ifi = copy[nsiz-3];
155  if (nsiz>3) ich = copy[nsiz-4];
156  double z1 = std::abs((t.z()) + dz);
157  double z2 = std::abs((t.z()) - dz);
158  if (std::abs(z1-z2) < 0.01) z1 = 0;
159  if (ifi == 1 && ich == 4) {
160  if (z1 > z2) {
161  double tmp = z1;
162  z1 = z2;
163  z2 = tmp;
164  }
165  bool sok = true;
166  for (unsigned int kk=0; kk<php.zHO.size(); kk++) {
167  if (std::abs(z2-php.zHO[kk]) < 0.01) {
168  sok = false;
169  break;
170  } else if (z2 < php.zHO[kk]) {
171  php.zHO.resize(php.zHO.size()+2);
172  for (unsigned int kz=php.zHO.size()-1; kz>kk+1; kz=kz-2) {
173  php.zHO[kz] = php.zHO[kz-2];
174  php.zHO[kz-1] = php.zHO[kz-3];
175  }
176  php.zHO[kk+1] = z2;
177  php.zHO[kk] = z1;
178  sok = false;
179  break;
180  }
181  }
182  if (sok) {
183  php.zHO.push_back(z1);
184  php.zHO.push_back(z2);
185  }
186 #ifdef DebugLog
187  std::cout << "Detector " << idet << " Lay " << lay << " fi " << ifi
188  << " " << ich << " z " << z1 << " " << z2 << std::endl;
189 #endif
190  }
191  }
192  } else if (idet == 4) {
193  // HE
194 #ifdef DebugLog
195  std::cout << "HE " << sol.name() << " Shape " << sol.shape()
196  << " Layer " << lay << " Z " << t.z() << std::endl;
197 #endif
198  if (lay >=0 && lay < 20) {
199  ie[lay]++;
200  ze[lay] += std::abs(t.z());
201  if (thke[lay] <= 0) thke[lay] = dz;
202  bool found = false;
203  for (unsigned int k=0; k<php.zxHE.size(); k++) {
204  if (std::abs(php.zxHE[k]-std::abs(t.z())) < 0.01) {
205  found = true;
206  break;
207  }
208  }
209  if (!found) {
210  php.zxHE.push_back(std::abs(t.z()));
211  php.rhoxHE.push_back(t.Rho()*std::cos(t.phi()));
212  php.dyHE.push_back(dy*std::cos(t.phi()));
213  dx1 -= 0.5*(t.rho()-dy)*std::cos(t.phi())*std::tan(10*CLHEP::deg);
214  dx2 -= 0.5*(t.rho()+dy)*std::cos(t.phi())*std::tan(10*CLHEP::deg);
215  php.dx1HE.push_back(-dx1);
216  php.dx2HE.push_back(-dx2);
217  php.layHE.push_back(lay);
218  }
219  }
220  if (copy[nsiz-1] == 21 || copy[nsiz-1] == 71) {
221  int iz = copy[nsiz-7];
222  int fi = copy[nsiz-5];
223  unsigned int it1 = find(iz, ize);
224  if (it1 == ize.size()) ize.push_back(iz);
225  unsigned int it2 = find(fi, phie);
226  if (it2 == phie.size()) phie.push_back(fi);
227  }
228  } else if (idet == 5) {
229  // HF
230  if (!hf) {
231  const std::vector<double> & paras = sol.parameters();
232 #ifdef DebugLog
233  std::cout << "HF " << sol.name() << " Shape " << sol.shape()
234  << " Z " << t.z() << " with " << paras.size()
235  << " Parameters" << std::endl;
236  for (unsigned j=0; j<paras.size(); j++)
237  std::cout << "HF Parameter[" << j << "] = " << paras[j] << std::endl;
238 #endif
239  if (sol.shape() == ddpolycone_rrz) {
240  int nz = (int)(paras.size())-3;
241  dzVcal = 0.5*(paras[nz]-paras[3]);
242  hf = true;
243  } else if (sol.shape() == ddtubs || sol.shape() == ddcons) {
244  dzVcal = paras[0];
245  hf = true;
246  }
247  }
248 #ifdef DebugLog
249  } else {
250  std::cout << "Unknown Detector " << idet << " for " << sol.name()
251  << " Shape " << sol.shape() << " R " << t.Rho() << " Z "
252  << t.z() << std::endl;
253 #endif
254  }
255  dodet = fv.next();
256  }
257 
258  int ibmx = 0, iemx = 0;
259  for (int i = 0; i < 20; i++) {
260  if (ib[i]>0) {
261  rb[i] /= (double)(ib[i]);
262  ibmx = i+1;
263  }
264  if (ie[i]>0) {
265  ze[i] /= (double)(ie[i]);
266  iemx = i+1;
267  }
268 #ifdef DebugLog
269  std::cout << "Index " << i << " Barrel " << ib[i] << " "
270  << rb[i] << " Endcap " << ie[i] << " " << ze[i] << std::endl;
271 #endif
272  }
273  for (int i = 4; i >= 0; i--) {
274  if (ib[i] == 0) {rb[i] = rb[i+1]; thkb[i] = thkb[i+1];}
275  if (ie[i] == 0) {ze[i] = ze[i+1]; thke[i] = thke[i+1];}
276 #ifdef DebugLog
277  if (ib[i] == 0 || ie[i] == 0)
278  std::cout << "Index " << i << " Barrel " << ib[i] << " "
279  << rb[i] << " Endcap " << ie[i] << " " << ze[i] << std::endl;
280 #endif
281  }
282 
283 #ifdef DebugLog
284  for (unsigned int k=0; k<php.layHB.size(); ++k)
285  std::cout << "HB: " << php.layHB[k] << " R " << rxb[k] << " " << php.rhoxHB[k] << " Z " << php.zxHB[k] << " DY " << php.dyHB[k] << " DZ " << php.dxHB[k] << "\n";
286  for (unsigned int k=0; k<php.layHE.size(); ++k)
287  std::cout << "HE: " << php.layHE[k] << " R " << php.rhoxHE[k] << " Z " << php.zxHE[k] << " X1|X2 " << php.dx1HE[k] << "|" << php.dx2HE[k] << " DY " << php.dyHE[k] << "\n";
288  std::cout << "HcalGeomParameters: Maximum Layer for HB " << ibmx << " for HE "
289  << iemx << " extent " << dzVcal << std::endl;
290 #endif
291 
292  if (ibmx > 0) {
293  php.rHB.resize(ibmx);
294  php.drHB.resize(ibmx);
295  for (int i=0; i<ibmx; i++) {
296  php.rHB[i] = rb[i];
297  php.drHB[i] = thkb[i];
298 #ifdef DebugLog
299  std::cout << "HcalGeomParameters: php.rHB[" << i << "] = " << php.rHB[i]
300  << " php.drHB[" << i << "] = " << php.drHB[i] << std::endl;
301 #endif
302  }
303  }
304  if (iemx > 0) {
305  php.zHE.resize(iemx);
306  php.dzHE.resize(iemx);
307  for (int i=0; i<iemx; i++) {
308  php.zHE[i] = ze[i];
309  php.dzHE[i] = thke[i];
310 #ifdef DebugLog
311  std::cout << "HcalGeomParameters: php.zHE[" << i << "] = " << php.zHE[i]
312  << " php.dzHE[" << i << "] = " << php.dzHE[i] << std::endl;
313 #endif
314  }
315  }
316 
317  nzHB = (int)(izb.size());
318  nmodHB = (int)(phib.size());
319 #ifdef DebugLog
320  std::cout << "HcalGeomParameters::loadGeometry: " << nzHB
321  << " barrel half-sectors" << std::endl;
322  for (int i=0; i<nzHB; i++)
323  std::cout << "Section " << i << " Copy number " << izb[i] << std::endl;
324  std::cout << "HcalGeomParameters::loadGeometry: " << nmodHB
325  << " barrel modules" << std::endl;
326  for (int i=0; i<nmodHB; i++)
327  std::cout << "Module " << i << " Copy number " << phib[i] << std::endl;
328 #endif
329 
330  nzHE = (int)(ize.size());
331  nmodHE = (int)(phie.size());
332 #ifdef DebugLog
333  std::cout << "HcalGeomParameters::loadGeometry: " << nzHE
334  << " endcap half-sectors" << std::endl;
335  for (int i=0; i<nzHE; i++)
336  std::cout << "Section " << i << " Copy number " << ize[i] << std::endl;
337  std::cout << "HcalGeomParameters::loadGeometry: " << nmodHE
338  << " endcap modules" << std::endl;
339  for (int i=0; i<nmodHE; i++)
340  std::cout << "Module " << i << " Copy number " << phie[i] << std::endl;
341 #endif
342 
343 #ifdef DebugLog
344  std::cout << "HO has Z of size " << php.zHO.size() << std::endl;
345  for (unsigned int kk=0; kk<php.zHO.size(); kk++)
346  std::cout << "ZHO[" << kk << "] = " << php.zHO[kk] << std::endl;
347 #endif
348  if (ibmx > 17 && php.zHO.size() > 4) {
349  rminHO = php.rHB[17]-100.0;
350  etaHO[0] = getEta(0.5*(php.rHB[17]+php.rHB[18]), php.zHO[1]);
351  etaHO[1] = getEta(php.rHB[18]+php.drHB[18], php.zHO[2]);
352  etaHO[2] = getEta(php.rHB[18]-php.drHB[18], php.zHO[3]);
353  etaHO[3] = getEta(php.rHB[18]+php.drHB[18], php.zHO[4]);
354  } else {
355  rminHO =-1.0;
356  etaHO[0] = etaHO[1] = etaHO[2] = etaHO[3] = 0;
357  }
358 #ifdef DebugLog
359  std::cout << "HO Eta boundaries " << etaHO[0] << " " << etaHO[1]
360  << " " << etaHO[2] << " " << etaHO[3] << std::endl;
361  std::cout << "HO Parameters " << rminHO << " " << php.zHO.size();
362  for (int i=0; i<4; ++i) std::cout << " eta[" << i << "] = " << etaHO[i];
363  for (unsigned int i=0; i<php.zHO.size(); ++i) std::cout << " zho[" << i << "] = " << php.zHO[i];
364  std::cout << std::endl;
365 #endif
366 }
std::vector< double > zHO
int i
Definition: DBlmapReader.cc:9
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:167
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
double halfZ(void) const
Definition: DDSolid.cc:258
std::vector< int > layHE
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:175
const N & name() const
Definition: DDBase.h:78
int ib
Definition: cuy.py:660
double halfY(void) const
Definition: DDSolid.cc:256
std::vector< double > rHB
nav_type copyNumbers() const
return the stack of copy numbers
unsigned find(int element, std::vector< int > &array) const
std::vector< double > rhoxHB
std::vector< double > dx2HE
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
std::vector< double > rhoxHE
std::vector< double > zxHE
std::vector< double > zHE
std::vector< double > dyHE
std::vector< double > zxHB
double x4(void) const
Half-length along x of the side at y=+pDy2 of the face at +pDz.
Definition: DDSolid.cc:185
bool next()
set current node to the next node in the filtered tree
std::vector< double > dx1HE
std::vector< double > dzHE
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Interface to a Trapezoid.
Definition: DDSolid.h:77
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:173
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144
T min(T a, T b)
Definition: MathUtil.h:58
double rOut(void) const
Definition: DDSolid.cc:509
std::vector< double > dyHB
double halfX(void) const
Definition: DDSolid.cc:254
Interface to a Box.
Definition: DDSolid.h:162
std::vector< double > dxHB
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:177
double zhalf(void) const
Definition: DDSolid.cc:505
double getEta(double r, double z) const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
if(dp >Float(M_PI)) dp-
std::vector< double > drHB
double y2(void) const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:181
tuple cout
Definition: gather_cfg.py:145
const DDTranslation & translation() const
The absolute translation of the current node.
double rIn(void) const
Definition: DDSolid.cc:507
for(const auto &isodef:isoDefs)
std::vector< int > layHB
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
Definition: DDSolid.cc:183

Member Data Documentation

double HcalGeomParameters::dlShort
private

Definition at line 48 of file HcalGeomParameters.h.

double HcalGeomParameters::dzVcal
private

Definition at line 47 of file HcalGeomParameters.h.

Referenced by getConstDzHF(), and loadGeometry().

double HcalGeomParameters::etaHO[4]
private

Definition at line 45 of file HcalGeomParameters.h.

Referenced by getConstRHO(), and loadGeometry().

int HcalGeomParameters::nmodHB
private

Definition at line 43 of file HcalGeomParameters.h.

Referenced by getModHalfHBHE(), and loadGeometry().

int HcalGeomParameters::nmodHE
private

Definition at line 44 of file HcalGeomParameters.h.

Referenced by getModHalfHBHE(), and loadGeometry().

int HcalGeomParameters::nzHB
private

Definition at line 43 of file HcalGeomParameters.h.

Referenced by getModHalfHBHE(), and loadGeometry().

int HcalGeomParameters::nzHE
private

Definition at line 44 of file HcalGeomParameters.h.

Referenced by getModHalfHBHE(), and loadGeometry().

double HcalGeomParameters::rminHO
private

Definition at line 45 of file HcalGeomParameters.h.

Referenced by getConstRHO(), and loadGeometry().

double HcalGeomParameters::zVcal
private

Definition at line 46 of file HcalGeomParameters.h.