CMS 3D CMS Logo

DDHGCalCell.cc
Go to the documentation of this file.
9 #include "CLHEP/Units/GlobalSystemOfUnits.h"
10 
11 //#define EDM_ML_DEBUG
12 
14 #ifdef EDM_ML_DEBUG
15  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Creating an instance";
16 #endif
17 }
18 
20 
22  const DDVectorArguments &,
23  const DDMapArguments &,
24  const DDStringArguments & sArgs,
25  const DDStringVectorArguments & vsArgs) {
26 
27  waferSize_ = nArgs["WaferSize"];
28  waferT_ = nArgs["WaferThick"];
29  cellT_ = nArgs["CellThick"];
30  nCells_ = (int)(nArgs["NCells"]);
31  posSens_ = (int)(nArgs["PosSensitive"]);
32  material_ = sArgs["Material"];
33  fullCN_ = sArgs["FullCell"];
34  fullSensN_ = sArgs["FullSensitive"];
35  truncCN_ = vsArgs["TruncatedCell"];
36  truncSensN_ = vsArgs["TruncatedSensitive"];
37  extenCN_ = vsArgs["ExtendedCell"];
38  extenSensN_ = vsArgs["ExtendedSensitive"];
39  cornrCN_ = vsArgs["CornerCell"];
40  cornrSensN_ = vsArgs["CornerSensitive"];
42  if ((truncCN_.size() != truncSensN_.size()) ||
43  (extenCN_.size() != extenSensN_.size()) ||
44  (cornrCN_.size() != cornrSensN_.size()))
45  edm::LogWarning("HGCalGeom") << "The number of cells & sensitive differ:"
46  << " Truncated " << truncCN_.size() << ":"
47  << truncSensN_.size() << " Extended "
48  << extenCN_.size() <<":" << extenSensN_.size()
49  << " Corners " << cornrCN_.size() << ":"
50  << cornrSensN_.size();
51  if ((truncCN_.size() != 3) || (extenCN_.size() != 3) ||
52  (cornrCN_.size() != 6))
53  edm::LogWarning("HGCalGeom") << "DDHGCalCell: The number of cells does not"
54  << " match with Standard: Truncated "
55  << truncCN_.size() << ":3 Extended "
56  << extenCN_.size() <<":3" << " Corners "
57  << cornrCN_.size() << ":6";
58 #ifdef EDM_ML_DEBUG
59  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Wafer r " << waferSize_
60  << " T " << waferT_ << " Cell T " << cellT_
61  << " Cells/Wafer " << nCells_ << " Material "
62  << material_ << "Sensitive Position "
63  << posSens_ << " NameSpace " << nameSpace_
64  << " Full Cell: " << fullCN_ << ":"
65  << fullSensN_;
66  for (unsigned int k=0; k<truncCN_.size(); ++k)
67  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Truncated Cell[" << k
68  << "] " << truncCN_[k] << ":"
69  << truncSensN_[k];
70  for (unsigned int k=0; k<extenCN_.size(); ++k)
71  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Extended Cell[" << k
72  << "] " << extenCN_[k] << ":"
73  << extenSensN_[k];
74  for (unsigned int k=0; k<cornrCN_.size(); ++k)
75  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Corner Cell[" << k
76  << "] " << cornrCN_[k] << ":"
77  << cornrSensN_[k];
78 #endif
79 }
80 
82 
83 #ifdef EDM_ML_DEBUG
84  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalCell...";
85 #endif
86 
88  DDMaterial matter(matName);
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << matName
91  << " initialized at " << &matter;
92 #endif
93  DDLogicalPart glog1, glog2;
94 
95  static const double sqrt3 = std::sqrt(3.0);
96  double R = waferSize_/(3.0*nCells_);
97  double r = 0.5*R*sqrt3;
98  double dx1 = R;
99  double dx2 = 0.5*dx1;
100  double dx3 = 2.5*dx2;
101  double dx4 = 0.5*dx2;
102  double dy1 = r;
103  double dy2 = 0.5*dy1;
104  double dy3 = 1.5*dy1;
105  std::vector<double> xx = {dx1,dx2,-dx2,-dx1,-dx2,dx2,
106  dx3,-dx4,-dx1,-dx1,-dx4,dx3};
107  std::vector<double> yy = {0,dy1,dy1,0,-dy1,-dy1,
108  dy2,dy3,dy1,-dy1,-dy3,-dy2};
109  double zpos = (posSens_ == 0) ? -0.5*(waferT_-cellT_) : 0.5*(waferT_-cellT_);
110  DDTranslation tran(0,0,zpos);
111 
112  // First the full cell
113  std::vector<double> xw = {xx[0],xx[1],xx[2],xx[3],xx[4],xx[5]};
114  std::vector<double> yw = {yy[0],yy[1],yy[2],yy[3],yy[4],yy[5]};
115  std::vector<double> zw = {-0.5*waferT_,0.5*waferT_};
116  std::vector<double> zx(2,0), zy(2,0), scale(2,1.0);
118  xw, yw, zw, zx, zy, scale);
119  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name()
122  << " extruded polygon made of " << matName
123  << " z|x|y|s (0) " << zw[0] << ":" << zx[0]
124  << ":" << zy[0] << ":" << scale[0]
125  << " z|x|y|s (1) " << zw[1] << ":" << zx[1]
126  << ":" << zy[1] << ":" << scale[1] << " and "
127  << xw.size() << " edges";
128  for (unsigned int k=0; k<xw.size(); ++k)
129  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
130 #endif
131  std::vector<double> zc = {-0.5*cellT_,0.5*cellT_};
133  xw, yw, zc, zx, zy, scale);
134  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
135 #ifdef EDM_ML_DEBUG
136  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name()
137  << " extruded polygon made of " << matName
138  << " z|x|y|s (0) " << zc[0] << ":" << zx[0]
139  << ":" << zy[0] << ":" << scale[0]
140  << " z|x|y|s (1) " << zc[1] << ":" << zx[1]
141  << ":" << zy[1] << ":" << scale[1] << " and "
142  << xw.size() << " edges";
143  for (unsigned int k=0; k<xw.size(); ++k)
144  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
145 #endif
146  DDRotation rot;
147  cpv.position(glog2, glog1, 1, tran, rot);
148 #ifdef EDM_ML_DEBUG
149  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name()
150  << " number 1 position in " << glog1.name()
151  << " at " << tran << " with " << rot;
152 #endif
153 
154  static const int ir0[] = {0,1,0};
155  static const int ir1[] = {1,2,1};
156  static const int ir2[] = {2,3,3};
157  static const int ir3[] = {3,4,4};
158  static const int ir4[] = {5,5,5};
159  for (unsigned int i=0; i<truncCN_.size(); ++i) {
160  std::vector<double> xw = {xx[ir0[i]],xx[ir1[i]],xx[ir2[i]],xx[ir3[i]],xx[ir4[i]]};
161  std::vector<double> yw = {yy[ir0[i]],yy[ir1[i]],yy[ir2[i]],yy[ir3[i]],yy[ir4[i]]};
163  xw, yw, zw, zx, zy, scale);
164  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
165 #ifdef EDM_ML_DEBUG
166  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name()
167  << " extruded polygon made of " << matName
168  << " z|x|y|s (0) " << zw[0] << ":" << zx[0]
169  << ":" << zy[0] << ":" << scale[0]
170  << " z|x|y|s (1) " << zw[1] << ":" << zx[1]
171  << ":" << zy[1] << ":" << scale[1] << " and "
172  << xw.size() << " edges";
173  for (unsigned int k=0; k<xw.size(); ++k)
174  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":"
175  << yw[k];
176 #endif
178  xw, yw, zc, zx, zy, scale);
179  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
180 #ifdef EDM_ML_DEBUG
181  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name()
182  << " extruded polygon made of " << matName
183  << " z|x|y|s (0) " << zw[0] << ":" << zx[0]
184  << ":" << zy[0] << ":" << scale[0]
185  << " z|x|y|s (1) " << zw[1] << ":" << zx[1]
186  << ":" << zy[1] << ":" << scale[1] << " and "
187  << xw.size() << " edges";
188  for (unsigned int k=0; k<xw.size(); ++k)
189  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":"
190  << yw[k];
191 #endif
192  cpv.position(glog2, glog1, 1, tran, rot);
193 #ifdef EDM_ML_DEBUG
194  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name()
195  << " number 1 position in " << glog1.name()
196  << " at " << tran << " with " << rot;
197 #endif
198  }
199 
200  static const int ie0[] = {1,5,0};
201  static const int ie1[] = {2,6,1};
202  static const int ie2[] = {3,7,8};
203  static const int ie3[] = {10,3,9};
204  static const int ie4[] = {11,4,5};
205  for (unsigned int i=0; i<extenCN_.size(); ++i) {
206  std::vector<double> xw = {xx[ie0[i]],xx[ie1[i]],xx[ie2[i]],xx[ie3[i]],xx[ie4[i]]};
207  std::vector<double> yw = {yy[ie0[i]],yy[ie1[i]],yy[ie2[i]],yy[ie3[i]],yy[ie4[i]]};
209  xw, yw, zw, zx, zy, scale);
210  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
211 #ifdef EDM_ML_DEBUG
212  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name()
213  << " extruded polygon made of " << matName
214  << " z|x|y|s (0) " << zw[0] << ":" << zx[0]
215  << ":" << zy[0] << ":" << scale[0]
216  << " z|x|y|s (1) " << zw[1] << ":" << zx[1]
217  << ":" << zy[1] << ":" << scale[1] << " and "
218  << xw.size() << " edges";
219  for (unsigned int k=0; k<xw.size(); ++k)
220  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":"
221  << yw[k];
222 #endif
224  xw, yw, zc, zx, zy, scale);
225  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
226 #ifdef EDM_ML_DEBUG
227  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name()
228  << " extruded polygon made of " << matName
229  << " z|x|y|s (0) " << zw[0] << ":" << zx[0]
230  << ":" << zy[0] << ":" << scale[0]
231  << " z|x|y|s (1) " << zw[1] << ":" << zx[1]
232  << ":" << zy[1] << ":" << scale[1] << " and "
233  << xw.size() << " edges";
234  for (unsigned int k=0; k<xw.size(); ++k)
235  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":"
236  << yw[k];
237 #endif
238  cpv.position(glog2, glog1, 1, tran, rot);
239 #ifdef EDM_ML_DEBUG
240  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name()
241  << " number 1 position in " << glog1.name()
242  << " at " << tran << " with " << rot;
243 #endif
244  }
245 
246  static const int ic0[] = {0,1,1,1,1,0};
247  static const int ic1[] = {1,2,2,7,3,1};
248  static const int ic2[] = {8,3,3,3,4,3};
249  static const int ic3[] = {3,5,10,4,5,9};
250  static const int ic4[] = {5,11,5,5,6,5};
251  for (unsigned int i=0; i<cornrCN_.size(); ++i) {
252  std::vector<double> xw = {xx[ic0[i]],xx[ic1[i]],xx[ic2[i]],xx[ic3[i]],xx[ic4[i]]};
253  std::vector<double> yw = {yy[ic0[i]],yy[ic1[i]],yy[ic2[i]],yy[ic3[i]],yy[ic4[i]]};
255  xw, yw, zw, zx, zy, scale);
256  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
257 #ifdef EDM_ML_DEBUG
258  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name()
259  << " extruded polygon made of " << matName
260  << " z|x|y|s (0) " << zw[0] << ":" << zx[0]
261  << ":" << zy[0] << ":" << scale[0]
262  << " z|x|y|s (1) " << zw[1] << ":" << zx[1]
263  << ":" << zy[1] << ":" << scale[1] << " and "
264  << xw.size() << " edges";
265  for (unsigned int k=0; k<xw.size(); ++k)
266  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":"
267  << yw[k];
268 #endif
270  xw, yw, zc, zx, zy, scale);
271  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
272 #ifdef EDM_ML_DEBUG
273  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name()
274  << " extruded polygon made of " << matName
275  << " z|x|y|s (0) " << zw[0] << ":" << zx[0]
276  << ":" << zy[0] << ":" << scale[0]
277  << " z|x|y|s (1) " << zw[1] << ":" << zx[1]
278  << ":" << zy[1] << ":" << scale[1] << " and "
279  << xw.size() << " edges";
280  for (unsigned int k=0; k<xw.size(); ++k)
281  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":"
282  << yw[k];
283 #endif
284  cpv.position(glog2, glog1, 1, tran, rot);
285 #ifdef EDM_ML_DEBUG
286  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name()
287  << " number 1 position in " << glog1.name()
288  << " at " << tran << " with " << rot;
289 #endif
290  }
291 
292 }
const N & name() const
Definition: DDBase.h:78
std::string fullSensN_
Definition: DDHGCalCell.h:30
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Definition: DDHGCalCell.cc:21
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
~DDHGCalCell() override
Definition: DDHGCalCell.cc:19
static std::string & ns()
std::vector< std::string > truncCN_
Definition: DDHGCalCell.h:31
type of data representation of DDCompactView
Definition: DDCompactView.h:90
std::vector< std::string > extenSensN_
Definition: DDHGCalCell.h:32
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void execute(DDCompactView &cpv) override
Definition: DDHGCalCell.cc:81
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
U second(std::pair< T, U > const &p)
std::string nameSpace_
Definition: DDHGCalCell.h:34
double cellT_
Definition: DDHGCalCell.h:26
T sqrt(T t)
Definition: SSEVec.h:18
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
double waferSize_
Definition: DDHGCalCell.h:24
int k[5][pyjets_maxn]
static DDSolid extrudedpolygon(const DDName &name, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< double > &zx, const std::vector< double > &zy, const std::vector< double > &zscale)
Definition: DDSolid.cc:869
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
double waferT_
Definition: DDHGCalCell.h:25
std::vector< std::string > cornrCN_
Definition: DDHGCalCell.h:33
std::vector< std::string > truncSensN_
Definition: DDHGCalCell.h:31
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:75
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::string material_
Definition: DDHGCalCell.h:29
std::vector< std::string > extenCN_
Definition: DDHGCalCell.h:32
std::string fullCN_
Definition: DDHGCalCell.h:30
std::vector< std::string > cornrSensN_
Definition: DDHGCalCell.h:33
const N & ddname() const
Definition: DDBase.h:80