CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
DDHGCalCell Class Reference
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
 

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 18 of file DDHGCalCell.cc.

Constructor & Destructor Documentation

DDHGCalCell::DDHGCalCell ( )
inline

Definition at line 21 of file DDHGCalCell.cc.

21 {}

Member Function Documentation

void DDHGCalCell::execute ( DDCompactView cpv)
override

Definition at line 85 of file DDHGCalCell.cc.

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

85  {
87  DDMaterial matter(matName);
88 #ifdef EDM_ML_DEBUG
89  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << matName << " initialized";
90 #endif
91  DDLogicalPart glog1, glog2;
92 
93  static const double sqrt3 = std::sqrt(3.0);
94  double R = waferSize_ / (3.0 * nCells_);
95  double r = 0.5 * R * sqrt3;
96  double dx1 = R;
97  double dx2 = 0.5 * dx1;
98  double dx3 = 2.5 * dx2;
99  double dx4 = 0.5 * dx2;
100  double dy1 = r;
101  double dy2 = 0.5 * dy1;
102  double dy3 = 1.5 * dy1;
103  std::vector<double> xx = {
104  dx1, dx2, -dx2, -dx1, -dx2, dx2, dx3, dx1, dx4, -dx4, -dx1, -dx3, -dx3, -dx1, -dx4, dx4, dx1, dx3};
105  std::vector<double> yy = {
106  0, dy1, dy1, 0, -dy1, -dy1, dy2, dy1, dy3, dy3, dy1, dy2, -dy2, -dy1, -dy3, -dy3, -dy1, -dy2};
107  double zpos = (posSens_ == 0) ? -0.5 * (waferT_ - cellT_) : 0.5 * (waferT_ - cellT_);
108  DDTranslation tran(0, 0, zpos);
109 
110  // First the full cell
111  std::vector<double> xw = {xx[0], xx[1], xx[2], xx[3], xx[4], xx[5]};
112  std::vector<double> yw = {yy[0], yy[1], yy[2], yy[3], yy[4], yy[5]};
113  std::vector<double> zw = {-0.5 * waferT_, 0.5 * waferT_};
114  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
115  DDSolid solid = DDSolidFactory::extrudedpolygon(DDName(fullCN_, nameSpace_), xw, yw, zw, zx, zy, scale);
116  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
117 #ifdef EDM_ML_DEBUG
118  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
119  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
120  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
121  << " and " << xw.size() << " edges";
122  for (unsigned int k = 0; k < xw.size(); ++k)
123  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
124 #endif
125  std::vector<double> zc = {-0.5 * cellT_, 0.5 * cellT_};
126  solid = DDSolidFactory::extrudedpolygon(DDName(fullSensN_, nameSpace_), xw, yw, zc, zx, zy, scale);
127  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
128 #ifdef EDM_ML_DEBUG
129  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
130  << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
131  << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
132  << " and " << xw.size() << " edges";
133  for (unsigned int k = 0; k < xw.size(); ++k)
134  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
135 #endif
136  DDRotation rot;
137  cpv.position(glog2, glog1, 1, tran, rot);
138 #ifdef EDM_ML_DEBUG
139  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name() << " at "
140  << tran << " with no rotation";
141 #endif
142 
143  static constexpr int ir0[] = {0, 1, 0, 1, 3, 5};
144  static constexpr int ir1[] = {1, 2, 1, 2, 4, 0};
145  static constexpr int ir2[] = {2, 3, 3, 3, 5, 1};
146  static constexpr int ir3[] = {3, 4, 4, 4, 0, 2};
147  static constexpr int ir4[] = {5, 5, 5, 0, 2, 4};
148  for (unsigned int i = 0; i < truncCN_.size(); ++i) {
149  std::vector<double> xw = {xx[ir0[i]], xx[ir1[i]], xx[ir2[i]], xx[ir3[i]], xx[ir4[i]]};
150  std::vector<double> yw = {yy[ir0[i]], yy[ir1[i]], yy[ir2[i]], yy[ir3[i]], yy[ir4[i]]};
151  solid = DDSolidFactory::extrudedpolygon(DDName(truncCN_[i], nameSpace_), xw, yw, zw, zx, zy, scale);
152  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
153 #ifdef EDM_ML_DEBUG
154  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
155  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
156  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
157  << " and " << xw.size() << " edges";
158  for (unsigned int k = 0; k < xw.size(); ++k)
159  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
160 #endif
161  solid = DDSolidFactory::extrudedpolygon(DDName(truncSensN_[i], nameSpace_), xw, yw, zc, zx, zy, scale);
162  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
163 #ifdef EDM_ML_DEBUG
164  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
165  << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
166  << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
167  << " and " << xw.size() << " edges";
168  for (unsigned int k = 0; k < xw.size(); ++k)
169  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
170 #endif
171  cpv.position(glog2, glog1, 1, tran, rot);
172 #ifdef EDM_ML_DEBUG
173  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
174  << " at " << tran << " with no rotation";
175 #endif
176  }
177 
178  static constexpr int ie0[] = {1, 5, 0, 0, 2, 4};
179  static constexpr int ie1[] = {2, 6, 1, 1, 3, 5};
180  static constexpr int ie2[] = {3, 9, 10, 2, 4, 0};
181  static constexpr int ie3[] = {14, 3, 13, 12, 16, 8};
182  static constexpr int ie4[] = {17, 4, 5, 15, 7, 11};
183  for (unsigned int i = 0; i < extenCN_.size(); ++i) {
184  std::vector<double> xw = {xx[ie0[i]], xx[ie1[i]], xx[ie2[i]], xx[ie3[i]], xx[ie4[i]]};
185  std::vector<double> yw = {yy[ie0[i]], yy[ie1[i]], yy[ie2[i]], yy[ie3[i]], yy[ie4[i]]};
186  solid = DDSolidFactory::extrudedpolygon(DDName(extenCN_[i], nameSpace_), xw, yw, zw, zx, zy, scale);
187  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
188 #ifdef EDM_ML_DEBUG
189  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
190  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
191  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
192  << " and " << xw.size() << " edges";
193  for (unsigned int k = 0; k < xw.size(); ++k)
194  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
195 #endif
196  solid = DDSolidFactory::extrudedpolygon(DDName(extenSensN_[i], nameSpace_), xw, yw, zc, zx, zy, scale);
197  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
198 #ifdef EDM_ML_DEBUG
199  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
200  << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
201  << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
202  << " and " << xw.size() << " edges";
203  for (unsigned int k = 0; k < xw.size(); ++k)
204  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
205 #endif
206  cpv.position(glog2, glog1, 1, tran, rot);
207 #ifdef EDM_ML_DEBUG
208  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
209  << " at " << tran << " with no rotation";
210 #endif
211  }
212 
213  static constexpr int ic0[] = {0, 1, 1, 1, 1, 0, 0, 1, 2, 3, 4, 5};
214  static constexpr int ic1[] = {1, 2, 2, 9, 3, 1, 1, 2, 3, 4, 5, 0};
215  static constexpr int ic2[] = {10, 3, 3, 3, 4, 3, 2, 12, 4, 16, 0, 8};
216  static constexpr int ic3[] = {3, 5, 14, 4, 5, 13, 4, 4, 0, 0, 2, 2};
217  static constexpr int ic4[] = {5, 17, 5, 5, 6, 5, 15, 0, 7, 2, 11, 4};
218  for (unsigned int i = 0; i < cornrCN_.size(); ++i) {
219  std::vector<double> xw = {xx[ic0[i]], xx[ic1[i]], xx[ic2[i]], xx[ic3[i]], xx[ic4[i]]};
220  std::vector<double> yw = {yy[ic0[i]], yy[ic1[i]], yy[ic2[i]], yy[ic3[i]], yy[ic4[i]]};
221  solid = DDSolidFactory::extrudedpolygon(DDName(cornrCN_[i], nameSpace_), xw, yw, zw, zx, zy, scale);
222  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
223 #ifdef EDM_ML_DEBUG
224  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
225  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
226  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
227  << " and " << xw.size() << " edges";
228  for (unsigned int k = 0; k < xw.size(); ++k)
229  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
230 #endif
231  solid = DDSolidFactory::extrudedpolygon(DDName(cornrSensN_[i], nameSpace_), xw, yw, zc, zx, zy, scale);
232  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
233 #ifdef EDM_ML_DEBUG
234  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
235  << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
236  << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
237  << " and " << xw.size() << " edges";
238  for (unsigned int k = 0; k < xw.size(); ++k)
239  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
240 #endif
241  cpv.position(glog2, glog1, 1, tran, rot);
242 #ifdef EDM_ML_DEBUG
243  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
244  << " at " << tran << " with no rotation";
245 #endif
246  }
247 }
Log< level::Info, true > LogVerbatim
const N & name() const
Definition: DDBase.h:59
std::string fullSensN_
Definition: DDHGCalCell.cc:37
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::vector< std::string > truncCN_
Definition: DDHGCalCell.cc:38
std::vector< std::string > extenSensN_
Definition: DDHGCalCell.cc:39
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
std::string nameSpace_
Definition: DDHGCalCell.cc:41
double cellT_
Definition: DDHGCalCell.cc:33
T sqrt(T t)
Definition: SSEVec.h:19
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
double waferSize_
Definition: DDHGCalCell.cc:31
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:584
double waferT_
Definition: DDHGCalCell.cc:32
std::vector< std::string > cornrCN_
Definition: DDHGCalCell.cc:40
std::vector< std::string > truncSensN_
Definition: DDHGCalCell.cc:38
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:75
std::string material_
Definition: DDHGCalCell.cc:36
std::vector< std::string > extenCN_
Definition: DDHGCalCell.cc:39
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
std::string fullCN_
Definition: DDHGCalCell.cc:37
std::vector< std::string > cornrSensN_
Definition: DDHGCalCell.cc:40
const N & ddname() const
Definition: DDBase.h:61
void DDHGCalCell::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 44 of file DDHGCalCell.cc.

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

48  {
49  waferSize_ = nArgs["WaferSize"];
50  waferT_ = nArgs["WaferThick"];
51  cellT_ = nArgs["CellThick"];
52  nCells_ = (int)(nArgs["NCells"]);
53  posSens_ = (int)(nArgs["PosSensitive"]);
54  material_ = sArgs["Material"];
55  fullCN_ = sArgs["FullCell"];
56  fullSensN_ = sArgs["FullSensitive"];
57  truncCN_ = vsArgs["TruncatedCell"];
58  truncSensN_ = vsArgs["TruncatedSensitive"];
59  extenCN_ = vsArgs["ExtendedCell"];
60  extenSensN_ = vsArgs["ExtendedSensitive"];
61  cornrCN_ = vsArgs["CornerCell"];
62  cornrSensN_ = vsArgs["CornerSensitive"];
64  if ((truncCN_.size() != truncSensN_.size()) || (extenCN_.size() != extenSensN_.size()) ||
65  (cornrCN_.size() != cornrSensN_.size()))
66  edm::LogWarning("HGCalGeom") << "The number of cells & sensitive differ:"
67  << " Truncated " << truncCN_.size() << ":" << truncSensN_.size() << " Extended "
68  << extenCN_.size() << ":" << extenSensN_.size() << " Corners " << cornrCN_.size()
69  << ":" << cornrSensN_.size();
70 #ifdef EDM_ML_DEBUG
71  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Wafer r " << waferSize_ << " T " << waferT_ << " Cell T " << cellT_
72  << " Cells/Wafer " << nCells_ << " Material " << material_ << "Sensitive Position "
73  << posSens_ << " NameSpace " << nameSpace_ << ": Full Cell: " << fullCN_ << ":"
74  << fullSensN_;
75  for (unsigned int k = 0; k < truncCN_.size(); ++k)
76  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Truncated Cell[" << k << "] " << truncCN_[k] << ":"
77  << truncSensN_[k];
78  for (unsigned int k = 0; k < extenCN_.size(); ++k)
79  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Extended Cell[" << k << "] " << extenCN_[k] << ":" << extenSensN_[k];
80  for (unsigned int k = 0; k < cornrCN_.size(); ++k)
81  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Corner Cell[" << k << "] " << cornrCN_[k] << ":" << cornrSensN_[k];
82 #endif
83 }
Log< level::Info, true > LogVerbatim
std::string fullSensN_
Definition: DDHGCalCell.cc:37
static std::string & ns()
std::vector< std::string > truncCN_
Definition: DDHGCalCell.cc:38
std::vector< std::string > extenSensN_
Definition: DDHGCalCell.cc:39
std::string nameSpace_
Definition: DDHGCalCell.cc:41
double cellT_
Definition: DDHGCalCell.cc:33
double waferSize_
Definition: DDHGCalCell.cc:31
double waferT_
Definition: DDHGCalCell.cc:32
std::vector< std::string > cornrCN_
Definition: DDHGCalCell.cc:40
std::vector< std::string > truncSensN_
Definition: DDHGCalCell.cc:38
Log< level::Warning, false > LogWarning
std::string material_
Definition: DDHGCalCell.cc:36
std::vector< std::string > extenCN_
Definition: DDHGCalCell.cc:39
std::string fullCN_
Definition: DDHGCalCell.cc:37
std::vector< std::string > cornrSensN_
Definition: DDHGCalCell.cc:40

Member Data Documentation

double DDHGCalCell::cellT_
private

Definition at line 33 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

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

Definition at line 40 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

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

Definition at line 40 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

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

Definition at line 39 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

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

Definition at line 39 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

std::string DDHGCalCell::fullCN_
private

Definition at line 37 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

std::string DDHGCalCell::fullSensN_
private

Definition at line 37 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

std::string DDHGCalCell::material_
private

Definition at line 36 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

std::string DDHGCalCell::nameSpace_
private

Definition at line 41 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

int DDHGCalCell::nCells_
private

Definition at line 34 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

int DDHGCalCell::posSens_
private

Definition at line 35 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

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

Definition at line 38 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

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

Definition at line 38 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

double DDHGCalCell::waferSize_
private

Definition at line 31 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().

double DDHGCalCell::waferT_
private

Definition at line 32 of file DDHGCalCell.cc.

Referenced by execute(), and initialize().