CMS 3D CMS Logo

DDHGCalWafer8.cc
Go to the documentation of this file.
9 
10 //#define EDM_ML_DEBUG
11 
13 #ifdef EDM_ML_DEBUG
14  edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: Creating an instance";
15 #endif
16 }
17 
19 
21  const DDVectorArguments &,
22  const DDMapArguments &,
23  const DDStringArguments &sArgs,
24  const DDStringVectorArguments &vsArgs) {
25  waferSize_ = nArgs["WaferSize"];
26  waferT_ = nArgs["WaferThick"];
27  waferSepar_ = nArgs["SensorSeparation"];
28  mouseBite_ = nArgs["MouseBite"];
29  nCells_ = (int)(nArgs["NCells"]);
30  cellType_ = (int)(nArgs["CellType"]);
31  material_ = sArgs["Material"];
32  cellNames_ = vsArgs["CellNames"];
34 #ifdef EDM_ML_DEBUG
35  edm::LogVerbatim("HGCalGeom")
36  << "DDHGCalWafer8: Wafer 2r " << waferSize_ << " T " << waferT_
37  << " Half Separation " << waferSepar_ << " Mouse bite radius "
38  << mouseBite_ << " Cells/Wafer " << nCells_ << " Cell Type " << cellType_
39  << " Material " << material_ << " Names " << parent().name()
40  << " NameSpace " << nameSpace_ << " # of cells " << cellNames_.size();
41  for (unsigned int k = 0; k < cellNames_.size(); ++k)
42  edm::LogVerbatim("HGCalGeom")
43  << "DDHGCalWafer8: Cell[" << k << "] " << cellNames_[k];
44 #endif
45 }
46 
48 #ifdef EDM_ML_DEBUG
49  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalWafer8...";
50 #endif
51 
52  static const double sqrt3 = std::sqrt(3.0);
53  double rM = 0.5 * (waferSize_ + waferSepar_);
54  double RM2 = rM / sqrt3;
55  double R = waferSize_ / (3.0 * nCells_);
56  double r = 0.5 * R * sqrt3;
57 
58  // First the full cell
59  std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
60  std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
61  std::vector<double> zw = {-0.5 * waferT_, 0.5 * waferT_};
62  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
63  DDName parentName = parent().name();
64  DDSolid solid =
65  DDSolidFactory::extrudedpolygon(parentName, xM, yM, zw, zx, zy, scale);
67  DDMaterial matter(matName);
68  DDLogicalPart glog = DDLogicalPart(solid.ddname(), matter, solid);
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("HGCalGeom")
71  << "DDHGCalWafer8: " << solid.name() << " extruded polygon made of "
72  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0]
73  << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":"
74  << zy[1] << ":" << scale[1] << " and " << xM.size() << " edges";
75  for (unsigned int k = 0; k < xM.size(); ++k)
76  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xM[k] << ":" << yM[k];
77 #endif
78 
80  for (int u = 0; u < 2 * nCells_; ++u) {
81  for (int v = 0; v < 2 * nCells_; ++v) {
82  if (((v - u) < nCells_) && (u - v) <= nCells_) {
83  int n2 = nCells_ / 2;
84  double yp = (u - 0.5 * v - n2) * 2 * r;
85  double xp = (1.5 * (v - nCells_) + 1.0) * R;
86  int cell(0);
87  if ((u == 0) && (v == 0))
88  cell = 7;
89  else if ((u == 0) && (v == nCells_ - 1))
90  cell = 8;
91  else if ((u == nCells_) && (v == 2 * nCells_ - 1))
92  cell = 9;
93  else if ((u == 2 * nCells_ - 1) && (v == 2 * nCells_ - 1))
94  cell = 10;
95  else if ((u == 2 * nCells_ - 1) && (v == nCells_ - 1))
96  cell = 11;
97  else if ((u == nCells_) && (v == 0))
98  cell = 12;
99  else if (u == 0)
100  cell = 1;
101  else if ((v - u) == (nCells_ - 1))
102  cell = 4;
103  else if (v == (2 * nCells_ - 1))
104  cell = 2;
105  else if (u == (2 * nCells_ - 1))
106  cell = 5;
107  else if ((u - v) == nCells_)
108  cell = 3;
109  else if (v == 0)
110  cell = 6;
111  DDTranslation tran(xp, yp, 0);
112  int copy = (cellType_ * 100 + v) * 100 + u;
113  cpv.position(DDName(cellNames_[cell]), glog, copy, tran, rot);
114 #ifdef EDM_ML_DEBUG
115  edm::LogVerbatim("HGCalGeom")
116  << "DDHGCalWafer8: " << cellNames_[cell] << " number " << copy
117  << " position in " << glog.name() << " at " << tran << " with "
118  << rot;
119 #endif
120  }
121  }
122  }
123 }
const N & name() const
Definition: DDBase.h:74
double waferSepar_
Definition: DDHGCalWafer8.h:24
def copy(args, dbName)
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
double waferSize_
Definition: DDHGCalWafer8.h:22
static std::string & ns()
std::string material_
Definition: DDHGCalWafer8.h:28
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
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)
double mouseBite_
Definition: DDHGCalWafer8.h:25
std::vector< std::string > cellNames_
Definition: DDHGCalWafer8.h:29
T sqrt(T t)
Definition: SSEVec.h:18
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
void execute(DDCompactView &cpv) override
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)
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 nameSpace_
Definition: DDHGCalWafer8.h:30
~DDHGCalWafer8() override
const N & ddname() const
Definition: DDBase.h:76