CMS 3D CMS Logo

HcalDDDGeometryLoader.cc
Go to the documentation of this file.
9 
10 #include<string>
11 
13 
14 //#define EDM_ML_DEBUG
15 
17  : hcalConstants(hcons) {
19 }
20 
22 }
23 
26 
27  HcalSubdetector hsub = static_cast<HcalSubdetector>(subdet);
28 
29 
30  HcalDDDGeometry* gDDD ( new HcalDDDGeometry(topo) );
31  ReturnType geom ( gDDD );
32 
33  if ( geom->cornersMgr() == 0 ) {
34  const unsigned int count (hcalConstants->numberOfCells(HcalBarrel ) +
38  geom->allocateCorners( count ) ;
39  }
40 
41  // if( geom->cornersMgr() == 0 ) geom->allocateCorners( 2592 ) ;
42 
43  if ( geom->parMgr() == 0 ) geom->allocatePar( 500, 3 ) ;
44 
45  fill (hsub, gDDD, geom );
46  return geom ;
47 }
48 
51 
52  HcalDDDGeometry* gDDD ( new HcalDDDGeometry(topo) );
53  ReturnType geom ( gDDD );
54 
55  if( geom->cornersMgr() == 0 ) {
56  const unsigned int count (hcalConstants->numberOfCells(HcalBarrel ) +
60  geom->allocateCorners( count ) ;
61  }
62  if( geom->parMgr() == 0 ) geom->allocatePar( 500, 3 ) ;
63 
64  fill(HcalBarrel, gDDD, geom);
65  fill(HcalEndcap, gDDD, geom);
66  fill(HcalForward, gDDD, geom);
67  fill(HcalOuter, gDDD, geom);
68  return geom ;
69 }
70 
72  HcalDDDGeometry* geometryDDD,
74 
75  // start by making the new HcalDetIds
76  std::vector<HcalCellType> hcalCells = hcalConstants->HcalCellTypes(subdet);
77  geometryDDD->insertCell(hcalCells);
78 #ifdef EDM_ML_DEBUG
79  std::cout << "HcalDDDGeometryLoader::fill gets " << hcalCells.size()
80  << " cells for subdetector " << subdet << std::endl;
81 #endif
82  // Make the new HcalDetIds and the cells
83 
84  std::vector<HcalDetId> hcalIds;
85  for (unsigned int i=0; i<hcalCells.size(); i++) {
86  int etaRing = hcalCells[i].etaBin();
87  int iside = hcalCells[i].zside();
88  int depthBin = hcalCells[i].depthSegment();
89  double dphi = hcalCells[i].phiBinWidth();
90  std::vector<std::pair<int,double> > phis = hcalCells[i].phis();
91 #ifdef EDM_ML_DEBUG
92  std::cout << "HcalDDDGeometryLoader: Subdet " << subdet << " side "
93  << iside << " eta " << etaRing << " depth " << depthBin
94  << " with " << phis.size() << "modules:" << std::endl;
95 #endif
96  for (unsigned int k = 0; k < phis.size(); k++) {
97 #ifdef EDM_ML_DEBUG
98  std::cout << "HcalDDDGeometryLoader::fill Cell " << i << " eta "
99  << iside*etaRing << " phi " << phis[k].first << "("
100  << phis[k].second/CLHEP::deg << ", " << dphi/CLHEP::deg
101  << ") depth " << depthBin << std::endl;
102 #endif
103  HcalDetId id(subdet, iside*etaRing, phis[k].first, depthBin);
104  hcalIds.push_back(id);
105  makeCell(id,hcalCells[i],phis[k].second,dphi,geom) ;
106  }
107  }
108 
109  edm::LogInfo("HCalGeom") << "Number of HCAL DetIds made for " << subdet
110  << " is " << hcalIds.size();
111 }
112 
114  const HcalCellType& hcalCell,
115  double phi, double dphi,
116  CaloSubdetectorGeometry* geom) const {
117 
118  // the two eta boundaries of the cell
119  double eta1 = hcalCell.etaMin();
120  double eta2 = hcalCell.etaMax();
121  HcalSubdetector subdet = detId.subdet();
122  double eta = 0.5*(eta1+eta2) * detId.zside();
123  double deta = (eta2-eta1);
124  double theta = 2.0*atan(exp(-eta));
125 
126  // barrel vs forward
127  bool rzType = hcalCell.depthType();
128  bool isBarrel = (subdet == HcalBarrel || subdet == HcalOuter);
129 
130  double z, r, thickness;
131 #ifdef EDM_ML_DEBUG
132  double r0, r1, r2;
133 #endif
134  if (rzType) {
135  r = hcalCell.depthMin();
136  if (isBarrel) {
137  z = r * sinh(eta); // sinh(eta) == 1/tan(theta)
138  thickness = (hcalCell.depthMax() - r) * cosh(eta); // cosh(eta) == 1/sin(theta)
139 #ifdef EDM_ML_DEBUG
140  r1 = r;
141  r2 = hcalCell.depthMax();
142  r0 = 0.5*(r1+r2);
143 #endif
144  } else {
145  z = r * sinh(eta2);
146  thickness = 2. * hcalCell.halfSize();
147  r = z/sinh(std::abs(eta));
148 #ifdef EDM_ML_DEBUG
149  r0 = z/sinh(std::abs(eta));
150  r1 = z/sinh(std::abs(eta)+0.5*deta);
151  r2 = z/sinh(std::abs(eta)-0.5*deta);
152 #endif
153  }
154 #ifdef EDM_ML_DEBUG
155  std::cout << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
156  << " eta = " << eta << " theta = " << theta << " r = " << r
157  << " thickness = " << thickness << " r0-r2 (" << r0 << ":"
158  << r1 << ":" << r2 << ")" << std::endl;
159 #endif
160  } else {
161  z = hcalCell.depthMin();
162  thickness = hcalCell.depthMax() - z;
163  if (isBH_) z += (0.5*thickness);
164  z *= detId.zside(); // get the sign right.
165  r = z * tan(theta);
166  thickness /= std::abs(cos(theta));
167 #ifdef EDM_ML_DEBUG
168  r0 = z/sinh(std::abs(eta));
169  r1 = z/sinh(std::abs(eta)+0.5*deta);
170  r2 = z/sinh(std::abs(eta)-0.5*deta);
171  std::cout << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
172  << " eta = " << eta << " theta = " << theta << " z = " << z
173  << " r = " << r << " thickness = " << thickness << " r0-r2 ("
174  << r0 << ":" << r1 << ":" << r2 << ")" << std::endl;
175 #endif
176  }
177 
178  double x = r * cos(phi);
179  double y = r * sin(phi);
180  GlobalPoint point(x,y,z);
181 
182 #ifdef EDM_ML_DEBUG
183  std::cout << "HcalDDDGeometryLoader::makeCell for " << detId << " Point "
184  << point << " deta = " << deta << " dphi = " << dphi
185  << " thickness = " << thickness << " isBarrel = " << isBarrel
186  << " " << rzType << std::endl;
187 #endif
188 
189  std::vector<CCGFloat> hp ;
190  hp.reserve(3) ;
191 
192  if (subdet==HcalForward) {
193  hp.push_back(deta/2.) ;
194  hp.push_back(dphi/2.) ;
195  hp.push_back(thickness/2.) ;
196  } else {
197  const double sign ( isBarrel ? 1 : -1 ) ;
198  hp.push_back(deta/2.) ;
199  hp.push_back(dphi/2.) ;
200  hp.push_back(sign*thickness/2.) ;
201  }
202  geom->newCell( point, point, point,
204  geom->parMgr(),
205  geom->parVecVec() ),
206  detId ) ;
207 }
double depthMax() const
Definition: HcalCellType.h:77
int i
Definition: DBlmapReader.cc:9
double depthMin() const
Definition: HcalCellType.h:76
bool depthType() const
Definition: HcalCellType.h:78
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.cc:93
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)=0
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
CaloCellGeometry::CCGFloat CCGFloat
void allocatePar(ParVec::size_type n, unsigned int m)
void fill(HcalSubdetector, HcalDDDGeometry *, CaloSubdetectorGeometry *)
U second(std::pair< T, U > const &p)
double halfSize() const
Definition: HcalCellType.h:79
unsigned int numberOfCells(HcalSubdetector) const
int insertCell(std::vector< HcalCellType > const &)
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
ReturnType load(const HcalTopology &topo, DetId::Detector, int)
std::vector< HcalCellType > HcalCellTypes(HcalSubdetector) const
void makeCell(const HcalDetId &, const HcalCellType &, double, double, CaloSubdetectorGeometry *geom) const
int k[5][pyjets_maxn]
double etaMax() const
cell edge, always positive & greater than etaMin
Definition: HcalCellType.h:69
CaloCellGeometry::CornersMgr * cornersMgr()
Detector
Definition: DetId.h:24
double etaMin() const
lower cell edge. Always positive
Definition: HcalCellType.h:66
const HcalDDDRecConstants * hcalConstants
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5