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 90 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().

90  {
92  DDMaterial matter(matName);
93 #ifdef EDM_ML_DEBUG
94  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << matName << " initialized";
95 #endif
96  DDLogicalPart glog1, glog2;
97 
98  static const double sqrt3 = std::sqrt(3.0);
99  double R = waferSize_ / (3.0 * nCells_);
100  double r = 0.5 * R * sqrt3;
101  double dx1 = R;
102  double dx2 = 0.5 * dx1;
103  double dx3 = 2.5 * dx2;
104  double dx4 = 0.5 * dx2;
105  double dy1 = r;
106  double dy2 = 0.5 * dy1;
107  double dy3 = 1.5 * dy1;
108  std::vector<double> xx = {
109  dx1, dx2, -dx2, -dx1, -dx2, dx2, dx3, dx1, dx4, -dx4, -dx1, -dx3, -dx3, -dx1, -dx4, dx4, dx1, dx3};
110  std::vector<double> yy = {
111  0, dy1, dy1, 0, -dy1, -dy1, dy2, dy1, dy3, dy3, dy1, dy2, -dy2, -dy1, -dy3, -dy3, -dy1, -dy2};
112  double zpos = (posSens_ == 0) ? -0.5 * (waferT_ - cellT_) : 0.5 * (waferT_ - cellT_);
113  DDTranslation tran(0, 0, zpos);
114 
115  // First the full cell
116  std::vector<double> xw = {xx[0], xx[1], xx[2], xx[3], xx[4], xx[5]};
117  std::vector<double> yw = {yy[0], yy[1], yy[2], yy[3], yy[4], yy[5]};
118  std::vector<double> zw = {-0.5 * waferT_, 0.5 * waferT_};
119  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
120  DDSolid solid = DDSolidFactory::extrudedpolygon(DDName(fullCN_, nameSpace_), xw, yw, zw, zx, zy, scale);
121  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
122 #ifdef EDM_ML_DEBUG
123  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
124  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
125  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
126  << " and " << xw.size() << " edges";
127  for (unsigned int k = 0; k < xw.size(); ++k)
128  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
129 #endif
130  std::vector<double> zc = {-0.5 * cellT_, 0.5 * cellT_};
131  solid = DDSolidFactory::extrudedpolygon(DDName(fullSensN_, nameSpace_), xw, yw, zc, zx, zy, scale);
132  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
133 #ifdef EDM_ML_DEBUG
134  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
135  << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
136  << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
137  << " and " << xw.size() << " edges";
138  for (unsigned int k = 0; k < xw.size(); ++k)
139  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
140 #endif
141  DDRotation rot;
142  cpv.position(glog2, glog1, 1, tran, rot);
143 #ifdef EDM_ML_DEBUG
144  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name() << " at "
145  << tran << " with no rotation";
146 #endif
147 
148  static constexpr int ir0[] = {0, 1, 0, 1, 3, 5};
149  static constexpr int ir1[] = {1, 2, 1, 2, 4, 0};
150  static constexpr int ir2[] = {2, 3, 3, 3, 5, 1};
151  static constexpr int ir3[] = {3, 4, 4, 4, 0, 2};
152  static constexpr int ir4[] = {5, 5, 5, 0, 2, 4};
153  for (unsigned int i = 0; i < truncCN_.size(); ++i) {
154  std::vector<double> xw = {xx[ir0[i]], xx[ir1[i]], xx[ir2[i]], xx[ir3[i]], xx[ir4[i]]};
155  std::vector<double> yw = {yy[ir0[i]], yy[ir1[i]], yy[ir2[i]], yy[ir3[i]], yy[ir4[i]]};
156  solid = DDSolidFactory::extrudedpolygon(DDName(truncCN_[i], nameSpace_), xw, yw, zw, zx, zy, scale);
157  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
158 #ifdef EDM_ML_DEBUG
159  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
160  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
161  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
162  << " and " << xw.size() << " edges";
163  for (unsigned int k = 0; k < xw.size(); ++k)
164  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
165 #endif
166  solid = DDSolidFactory::extrudedpolygon(DDName(truncSensN_[i], nameSpace_), xw, yw, zc, zx, zy, scale);
167  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
168 #ifdef EDM_ML_DEBUG
169  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
170  << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
171  << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
172  << " and " << xw.size() << " edges";
173  for (unsigned int k = 0; k < xw.size(); ++k)
174  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
175 #endif
176  cpv.position(glog2, glog1, 1, tran, rot);
177 #ifdef EDM_ML_DEBUG
178  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
179  << " at " << tran << " with no rotation";
180 #endif
181  }
182 
183  static constexpr int ie0[] = {1, 5, 0, 2, 4, 0};
184  static constexpr int ie1[] = {2, 6, 1, 3, 5, 1};
185  static constexpr int ie2[] = {3, 9, 10, 4, 0, 2};
186  static constexpr int ie3[] = {14, 3, 13, 16, 8, 12};
187  static constexpr int ie4[] = {17, 4, 5, 7, 11, 15};
188  for (unsigned int i = 0; i < extenCN_.size(); ++i) {
189  std::vector<double> xw = {xx[ie0[i]], xx[ie1[i]], xx[ie2[i]], xx[ie3[i]], xx[ie4[i]]};
190  std::vector<double> yw = {yy[ie0[i]], yy[ie1[i]], yy[ie2[i]], yy[ie3[i]], yy[ie4[i]]};
191  solid = DDSolidFactory::extrudedpolygon(DDName(extenCN_[i], nameSpace_), xw, yw, zw, zx, zy, scale);
192  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
193 #ifdef EDM_ML_DEBUG
194  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
195  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
196  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
197  << " and " << xw.size() << " edges";
198  for (unsigned int k = 0; k < xw.size(); ++k)
199  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
200 #endif
201  solid = DDSolidFactory::extrudedpolygon(DDName(extenSensN_[i], nameSpace_), xw, yw, zc, zx, zy, scale);
202  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
203 #ifdef EDM_ML_DEBUG
204  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
205  << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
206  << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
207  << " and " << xw.size() << " edges";
208  for (unsigned int k = 0; k < xw.size(); ++k)
209  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
210 #endif
211  cpv.position(glog2, glog1, 1, tran, rot);
212 #ifdef EDM_ML_DEBUG
213  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
214  << " at " << tran << " with no rotation";
215 #endif
216  }
217 
218  static constexpr int ic0[] = {0, 1, 1, 1, 1, 0, 1, 2, 3, 4, 5, 0};
219  static constexpr int ic1[] = {1, 2, 2, 9, 3, 1, 2, 3, 4, 5, 0, 1};
220  static constexpr int ic2[] = {10, 3, 3, 3, 4, 3, 12, 5, 16, 0, 8, 2};
221  static constexpr int ic3[] = {3, 5, 14, 4, 5, 13, 4, 0, 0, 2, 2, 4};
222  static constexpr int ic4[] = {5, 17, 5, 5, 6, 5, 0, 7, 2, 11, 4, 15};
223  for (unsigned int i = 0; i < cornrCN_.size(); ++i) {
224  std::vector<double> xw = {xx[ic0[i]], xx[ic1[i]], xx[ic2[i]], xx[ic3[i]], xx[ic4[i]]};
225  std::vector<double> yw = {yy[ic0[i]], yy[ic1[i]], yy[ic2[i]], yy[ic3[i]], yy[ic4[i]]};
226  solid = DDSolidFactory::extrudedpolygon(DDName(cornrCN_[i], nameSpace_), xw, yw, zw, zx, zy, scale);
227  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
228 #ifdef EDM_ML_DEBUG
229  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
230  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
231  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
232  << " and " << xw.size() << " edges";
233  for (unsigned int k = 0; k < xw.size(); ++k)
234  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
235 #endif
236  solid = DDSolidFactory::extrudedpolygon(DDName(cornrSensN_[i], nameSpace_), xw, yw, zc, zx, zy, scale);
237  glog2 = DDLogicalPart(solid.ddname(), matter, solid);
238 #ifdef EDM_ML_DEBUG
239  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << solid.name() << " extruded polygon made of " << matName
240  << " z|x|y|s (0) " << zc[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
241  << " z|x|y|s (1) " << zc[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
242  << " and " << xw.size() << " edges";
243  for (unsigned int k = 0; k < xw.size(); ++k)
244  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xw[k] << ":" << yw[k];
245 #endif
246  cpv.position(glog2, glog1, 1, tran, rot);
247 #ifdef EDM_ML_DEBUG
248  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
249  << " at " << tran << " with no rotation";
250 #endif
251  }
252 }
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  if ((truncCN_.size() != 3) || (extenCN_.size() != 3) || (cornrCN_.size() != 6))
71  edm::LogWarning("HGCalGeom") << "DDHGCalCell: The number of cells does not"
72  << " match with Standard: Truncated " << truncCN_.size() << ":3 Extended "
73  << extenCN_.size() << ":3"
74  << " Corners " << cornrCN_.size() << ":6";
75 #ifdef EDM_ML_DEBUG
76  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Wafer r " << waferSize_ << " T " << waferT_ << " Cell T " << cellT_
77  << " Cells/Wafer " << nCells_ << " Material " << material_ << "Sensitive Position "
78  << posSens_ << " NameSpace " << nameSpace_ << ": Full Cell: " << fullCN_ << ":"
79  << fullSensN_;
80  for (unsigned int k = 0; k < truncCN_.size(); ++k)
81  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Truncated Cell[" << k << "] " << truncCN_[k] << ":"
82  << truncSensN_[k];
83  for (unsigned int k = 0; k < extenCN_.size(); ++k)
84  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Extended Cell[" << k << "] " << extenCN_[k] << ":" << extenSensN_[k];
85  for (unsigned int k = 0; k < cornrCN_.size(); ++k)
86  edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Corner Cell[" << k << "] " << cornrCN_[k] << ":" << cornrSensN_[k];
87 #endif
88 }
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().