CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDHGCalCell Class Reference

#include <DDHGCalCell.h>

Inheritance diagram for DDHGCalCell:

Public Member Functions

 DDHGCalCell ()
 
void execute (DDCompactView &cpv) override
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
 
 ~DDHGCalCell () override
 

Private Attributes

double cellT_
 
std::vector< std::string > cornrCN_
 
std::vector< std::string > cornrSensN_
 
std::vector< std::string > extenCN_
 
std::vector< std::string > extenSensN_
 
std::string fullCN_
 
std::string fullSensN_
 
std::string material_
 
std::string nameSpace_
 
int nCells_
 
int posSens_
 
std::vector< std::string > truncCN_
 
std::vector< std::string > truncSensN_
 
double waferSize_
 
double waferT_
 

Detailed Description

Definition at line 9 of file DDHGCalCell.h.

Constructor & Destructor Documentation

DDHGCalCell::DDHGCalCell ( )

Definition at line 12 of file DDHGCalCell.cc.

12  {
13 #ifdef EDM_ML_DEBUG
14  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Creating an instance";
15 #endif
16 }
DDHGCalCell::~DDHGCalCell ( )
override

Definition at line 18 of file DDHGCalCell.cc.

18 {}

Member Function Documentation

void DDHGCalCell::execute ( DDCompactView cpv)
override

Definition at line 72 of file DDHGCalCell.cc.

References cellT_, cornrCN_, cornrSensN_, DDBase< N, C >::ddname(), DDSplit(), extenCN_, extenSensN_, DDSolidFactory::extrudedpolygon(), plotBeamSpotDB::first, fullCN_, fullSensN_, mps_fire::i, gen::k, material_, DDBase< N, C >::name(), nameSpace_, nCells_, DDCompactView::position(), posSens_, dttmaxenums::R, alignCSCRings::r, makeMuonMisalignmentScenario::rot, Scenarios_cff::scale, edm::second(), mathSSE::sqrt(), truncCN_, truncSensN_, waferSize_, waferT_, geometryCSVtoXML::xx, geometryCSVtoXML::yy, and zw().

72  {
73 #ifdef EDM_ML_DEBUG
74  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalCell...";
75 #endif
76 
78  DDMaterial matter(matName);
79 #ifdef EDM_ML_DEBUG
80  edm::LogVerbatim("HGCalGeom")
81  << "DDHGCalCell: " << matName << " initialized at " << &matter;
82 #endif
83  DDLogicalPart glog1, glog2;
84 
85  static const double sqrt3 = std::sqrt(3.0);
86  double R = waferSize_ / (3.0 * nCells_);
87  double r = 0.5 * R * sqrt3;
88  double dx1 = R;
89  double dx2 = 0.5 * dx1;
90  double dx3 = 2.5 * dx2;
91  double dx4 = 0.5 * dx2;
92  double dy1 = r;
93  double dy2 = 0.5 * dy1;
94  double dy3 = 1.5 * dy1;
95  std::vector<double> xx = {dx1, dx2, -dx2, -dx1, -dx2, dx2,
96  dx3, -dx4, -dx1, -dx1, -dx4, dx3};
97  std::vector<double> yy = {0, dy1, dy1, 0, -dy1, -dy1,
98  dy2, dy3, dy1, -dy1, -dy3, -dy2};
99  double zpos =
100  (posSens_ == 0) ? -0.5 * (waferT_ - cellT_) : 0.5 * (waferT_ - cellT_);
101  DDTranslation tran(0, 0, zpos);
102 
103  // First the full cell
104  std::vector<double> xw = {xx[0], xx[1], xx[2], xx[3], xx[4], xx[5]};
105  std::vector<double> yw = {yy[0], yy[1], yy[2], yy[3], yy[4], yy[5]};
106  std::vector<double> zw = {-0.5 * waferT_, 0.5 * waferT_};
107  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
109  xw, yw, zw, zx, zy, scale);
110  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
111 #ifdef EDM_ML_DEBUG
112  edm::LogVerbatim("HGCalGeom")
113  << "DDHGCalCell: " << solid.name() << " extruded polygon made of "
114  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0]
115  << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":"
116  << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges";
117  for (unsigned int k = 0; k < xw.size(); ++k)
118  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
119 #endif
120  std::vector<double> zc = {-0.5 * cellT_, 0.5 * cellT_};
122  yw, zc, zx, zy, scale);
123  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
124 #ifdef EDM_ML_DEBUG
125  edm::LogVerbatim("HGCalGeom")
126  << "DDHGCalCell: " << solid.name() << " extruded polygon made of "
127  << matName << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0]
128  << ":" << scale[0] << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":"
129  << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges";
130  for (unsigned int k = 0; k < xw.size(); ++k)
131  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
132 #endif
133  DDRotation rot;
134  cpv.position(glog2, glog1, 1, tran, rot);
135 #ifdef EDM_ML_DEBUG
136  edm::LogVerbatim("HGCalGeom")
137  << "DDHGCalCell: " << glog2.name() << " number 1 position in "
138  << glog1.name() << " at " << tran << " with " << rot;
139 #endif
140 
141  static const int ir0[] = {0, 1, 0};
142  static const int ir1[] = {1, 2, 1};
143  static const int ir2[] = {2, 3, 3};
144  static const int ir3[] = {3, 4, 4};
145  static const int ir4[] = {5, 5, 5};
146  for (unsigned int i = 0; i < truncCN_.size(); ++i) {
147  std::vector<double> xw = {xx[ir0[i]], xx[ir1[i]], xx[ir2[i]], xx[ir3[i]],
148  xx[ir4[i]]};
149  std::vector<double> yw = {yy[ir0[i]], yy[ir1[i]], yy[ir2[i]], yy[ir3[i]],
150  yy[ir4[i]]};
152  yw, zw, zx, zy, scale);
153  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
154 #ifdef EDM_ML_DEBUG
155  edm::LogVerbatim("HGCalGeom")
156  << "DDHGCalCell: " << solid.name() << " extruded polygon made of "
157  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0]
158  << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":"
159  << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges";
160  for (unsigned int k = 0; k < xw.size(); ++k)
161  edm::LogVerbatim("HGCalGeom")
162  << "[" << k << "] " << xw[k] << ":" << yw[k];
163 #endif
165  xw, yw, zc, zx, zy, scale);
166  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
167 #ifdef EDM_ML_DEBUG
168  edm::LogVerbatim("HGCalGeom")
169  << "DDHGCalCell: " << solid.name() << " extruded polygon made of "
170  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0]
171  << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":"
172  << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges";
173  for (unsigned int k = 0; k < xw.size(); ++k)
174  edm::LogVerbatim("HGCalGeom")
175  << "[" << k << "] " << xw[k] << ":" << yw[k];
176 #endif
177  cpv.position(glog2, glog1, 1, tran, rot);
178 #ifdef EDM_ML_DEBUG
179  edm::LogVerbatim("HGCalGeom")
180  << "DDHGCalCell: " << glog2.name() << " number 1 position in "
181  << glog1.name() << " at " << tran << " with " << rot;
182 #endif
183  }
184 
185  static const int ie0[] = {1, 5, 0};
186  static const int ie1[] = {2, 6, 1};
187  static const int ie2[] = {3, 7, 8};
188  static const int ie3[] = {10, 3, 9};
189  static const int ie4[] = {11, 4, 5};
190  for (unsigned int i = 0; i < extenCN_.size(); ++i) {
191  std::vector<double> xw = {xx[ie0[i]], xx[ie1[i]], xx[ie2[i]], xx[ie3[i]],
192  xx[ie4[i]]};
193  std::vector<double> yw = {yy[ie0[i]], yy[ie1[i]], yy[ie2[i]], yy[ie3[i]],
194  yy[ie4[i]]};
196  yw, zw, zx, zy, scale);
197  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
198 #ifdef EDM_ML_DEBUG
199  edm::LogVerbatim("HGCalGeom")
200  << "DDHGCalCell: " << solid.name() << " extruded polygon made of "
201  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0]
202  << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":"
203  << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges";
204  for (unsigned int k = 0; k < xw.size(); ++k)
205  edm::LogVerbatim("HGCalGeom")
206  << "[" << k << "] " << xw[k] << ":" << yw[k];
207 #endif
209  xw, yw, zc, zx, zy, scale);
210  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
211 #ifdef EDM_ML_DEBUG
212  edm::LogVerbatim("HGCalGeom")
213  << "DDHGCalCell: " << solid.name() << " extruded polygon made of "
214  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0]
215  << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":"
216  << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges";
217  for (unsigned int k = 0; k < xw.size(); ++k)
218  edm::LogVerbatim("HGCalGeom")
219  << "[" << k << "] " << xw[k] << ":" << yw[k];
220 #endif
221  cpv.position(glog2, glog1, 1, tran, rot);
222 #ifdef EDM_ML_DEBUG
223  edm::LogVerbatim("HGCalGeom")
224  << "DDHGCalCell: " << glog2.name() << " number 1 position in "
225  << glog1.name() << " at " << tran << " with " << rot;
226 #endif
227  }
228 
229  static const int ic0[] = {0, 1, 1, 1, 1, 0};
230  static const int ic1[] = {1, 2, 2, 7, 3, 1};
231  static const int ic2[] = {8, 3, 3, 3, 4, 3};
232  static const int ic3[] = {3, 5, 10, 4, 5, 9};
233  static const int ic4[] = {5, 11, 5, 5, 6, 5};
234  for (unsigned int i = 0; i < cornrCN_.size(); ++i) {
235  std::vector<double> xw = {xx[ic0[i]], xx[ic1[i]], xx[ic2[i]], xx[ic3[i]],
236  xx[ic4[i]]};
237  std::vector<double> yw = {yy[ic0[i]], yy[ic1[i]], yy[ic2[i]], yy[ic3[i]],
238  yy[ic4[i]]};
240  yw, zw, zx, zy, scale);
241  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
242 #ifdef EDM_ML_DEBUG
243  edm::LogVerbatim("HGCalGeom")
244  << "DDHGCalCell: " << solid.name() << " extruded polygon made of "
245  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0]
246  << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":"
247  << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges";
248  for (unsigned int k = 0; k < xw.size(); ++k)
249  edm::LogVerbatim("HGCalGeom")
250  << "[" << k << "] " << xw[k] << ":" << yw[k];
251 #endif
253  xw, yw, zc, zx, zy, scale);
254  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
255 #ifdef EDM_ML_DEBUG
256  edm::LogVerbatim("HGCalGeom")
257  << "DDHGCalCell: " << solid.name() << " extruded polygon made of "
258  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0]
259  << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":"
260  << zy[1] << ":" << scale[1] << " and " << xw.size() << " edges";
261  for (unsigned int k = 0; k < xw.size(); ++k)
262  edm::LogVerbatim("HGCalGeom")
263  << "[" << k << "] " << xw[k] << ":" << yw[k];
264 #endif
265  cpv.position(glog2, glog1, 1, tran, rot);
266 #ifdef EDM_ML_DEBUG
267  edm::LogVerbatim("HGCalGeom")
268  << "DDHGCalCell: " << glog2.name() << " number 1 position in "
269  << glog1.name() << " at " << tran << " with " << rot;
270 #endif
271  }
272 }
const N & name() const
Definition: DDBase.h:74
std::string fullSensN_
Definition: DDHGCalCell.h:28
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
std::vector< std::string > truncCN_
Definition: DDHGCalCell.h:29
std::vector< std::string > extenSensN_
Definition: DDHGCalCell.h:30
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
U second(std::pair< T, U > const &p)
std::string nameSpace_
Definition: DDHGCalCell.h:32
double cellT_
Definition: DDHGCalCell.h:24
T sqrt(T t)
Definition: SSEVec.h:18
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
double waferSize_
Definition: DDHGCalCell.h:22
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:753
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:23
std::vector< std::string > cornrCN_
Definition: DDHGCalCell.h:31
std::vector< std::string > truncSensN_
Definition: DDHGCalCell.h:29
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:27
std::vector< std::string > extenCN_
Definition: DDHGCalCell.h:30
std::string fullCN_
Definition: DDHGCalCell.h:28
std::vector< std::string > cornrSensN_
Definition: DDHGCalCell.h:31
const N & ddname() const
Definition: DDBase.h:76
void DDHGCalCell::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 20 of file DDHGCalCell.cc.

References cellT_, cornrCN_, cornrSensN_, extenCN_, extenSensN_, fullCN_, fullSensN_, createfilelist::int, gen::k, material_, nameSpace_, nCells_, DDCurrentNamespace::ns(), posSens_, truncCN_, truncSensN_, waferSize_, and waferT_.

23  {
24  waferSize_ = nArgs["WaferSize"];
25  waferT_ = nArgs["WaferThick"];
26  cellT_ = nArgs["CellThick"];
27  nCells_ = (int)(nArgs["NCells"]);
28  posSens_ = (int)(nArgs["PosSensitive"]);
29  material_ = sArgs["Material"];
30  fullCN_ = sArgs["FullCell"];
31  fullSensN_ = sArgs["FullSensitive"];
32  truncCN_ = vsArgs["TruncatedCell"];
33  truncSensN_ = vsArgs["TruncatedSensitive"];
34  extenCN_ = vsArgs["ExtendedCell"];
35  extenSensN_ = vsArgs["ExtendedSensitive"];
36  cornrCN_ = vsArgs["CornerCell"];
37  cornrSensN_ = vsArgs["CornerSensitive"];
39  if ((truncCN_.size() != truncSensN_.size()) ||
40  (extenCN_.size() != extenSensN_.size()) ||
41  (cornrCN_.size() != cornrSensN_.size()))
42  edm::LogWarning("HGCalGeom")
43  << "The number of cells & sensitive differ:"
44  << " Truncated " << truncCN_.size() << ":" << truncSensN_.size()
45  << " Extended " << extenCN_.size() << ":" << extenSensN_.size()
46  << " Corners " << cornrCN_.size() << ":" << cornrSensN_.size();
47  if ((truncCN_.size() != 3) || (extenCN_.size() != 3) ||
48  (cornrCN_.size() != 6))
49  edm::LogWarning("HGCalGeom")
50  << "DDHGCalCell: The number of cells does not"
51  << " match with Standard: Truncated " << truncCN_.size()
52  << ":3 Extended " << extenCN_.size() << ":3"
53  << " Corners " << cornrCN_.size() << ":6";
54 #ifdef EDM_ML_DEBUG
55  edm::LogVerbatim("HGCalGeom")
56  << "DDHGCalCell: Wafer r " << waferSize_ << " T " << waferT_ << " Cell T "
57  << cellT_ << " Cells/Wafer " << nCells_ << " Material " << material_
58  << "Sensitive Position " << posSens_ << " NameSpace " << nameSpace_
59  << " Full Cell: " << fullCN_ << ":" << fullSensN_;
60  for (unsigned int k = 0; k < truncCN_.size(); ++k)
61  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Truncated Cell[" << k << "] "
62  << truncCN_[k] << ":" << truncSensN_[k];
63  for (unsigned int k = 0; k < extenCN_.size(); ++k)
64  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Extended Cell[" << k << "] "
65  << extenCN_[k] << ":" << extenSensN_[k];
66  for (unsigned int k = 0; k < cornrCN_.size(); ++k)
67  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Corner Cell[" << k << "] "
68  << cornrCN_[k] << ":" << cornrSensN_[k];
69 #endif
70 }
std::string fullSensN_
Definition: DDHGCalCell.h:28
static std::string & ns()
std::vector< std::string > truncCN_
Definition: DDHGCalCell.h:29
std::vector< std::string > extenSensN_
Definition: DDHGCalCell.h:30
std::string nameSpace_
Definition: DDHGCalCell.h:32
double cellT_
Definition: DDHGCalCell.h:24
double waferSize_
Definition: DDHGCalCell.h:22
int k[5][pyjets_maxn]
double waferT_
Definition: DDHGCalCell.h:23
std::vector< std::string > cornrCN_
Definition: DDHGCalCell.h:31
std::vector< std::string > truncSensN_
Definition: DDHGCalCell.h:29
std::string material_
Definition: DDHGCalCell.h:27
std::vector< std::string > extenCN_
Definition: DDHGCalCell.h:30
std::string fullCN_
Definition: DDHGCalCell.h:28
std::vector< std::string > cornrSensN_
Definition: DDHGCalCell.h:31

Member Data Documentation

double DDHGCalCell::cellT_
private

Definition at line 24 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::vector<std::string> DDHGCalCell::cornrCN_
private

Definition at line 31 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::vector<std::string> DDHGCalCell::cornrSensN_
private

Definition at line 31 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::vector<std::string> DDHGCalCell::extenCN_
private

Definition at line 30 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::vector<std::string> DDHGCalCell::extenSensN_
private

Definition at line 30 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::string DDHGCalCell::fullCN_
private

Definition at line 28 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::string DDHGCalCell::fullSensN_
private

Definition at line 28 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::string DDHGCalCell::material_
private

Definition at line 27 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::string DDHGCalCell::nameSpace_
private

Definition at line 32 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

int DDHGCalCell::nCells_
private

Definition at line 25 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

int DDHGCalCell::posSens_
private

Definition at line 26 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::vector<std::string> DDHGCalCell::truncCN_
private

Definition at line 29 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

std::vector<std::string> DDHGCalCell::truncSensN_
private

Definition at line 29 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

double DDHGCalCell::waferSize_
private

Definition at line 22 of file DDHGCalCell.h.

Referenced by execute(), and initialize().

double DDHGCalCell::waferT_
private

Definition at line 23 of file DDHGCalCell.h.

Referenced by execute(), and initialize().