CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDHGCalWaferF Class Reference
Inheritance diagram for DDHGCalWaferF:

Public Member Functions

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

Private Attributes

std::vector< std::string > cellNames_
 
int cellType_
 
std::vector< int > copyNumber_
 
std::vector< std::string > layerNames_
 
std::vector< int > layers_
 
std::vector< double > layerThick_
 
std::vector< int > layerType_
 
std::string material_
 
std::vector< std::string > materials_
 
std::string nameSpace_
 
int nCells_
 
double thick_
 
double waferSepar_
 
double waferSize_
 
double waferThick_
 

Detailed Description

Definition at line 26 of file DDHGCalWaferF.cc.

Constructor & Destructor Documentation

◆ DDHGCalWaferF()

DDHGCalWaferF::DDHGCalWaferF ( )
inline

Definition at line 29 of file DDHGCalWaferF.cc.

29 {}

◆ ~DDHGCalWaferF()

DDHGCalWaferF::~DDHGCalWaferF ( )
overridedefault

Member Function Documentation

◆ execute()

void DDHGCalWaferF::execute ( DDCompactView cpv)
override

Definition at line 102 of file DDHGCalWaferF.cc.

References funct::abs(), cellNames_, cellType_, filterCSVwithJSON::copy, copyNumber_, counter, DDBase< N, C >::ddname(), DDSplit(), DDSolidFactory::extrudedpolygon(), first, mps_fire::i, dqmdumpme::k, MainPageGenerator::l, layerNames_, layers_, layerThick_, layerType_, material_, materials_, DDBase< N, C >::name(), nCells_, HGCalTypes::packCellTypeUV(), class-composition::parent, DDCompactView::position(), dttmaxenums::R, alignCSCRings::r, diffTwoXMLs::r2, makeMuonMisalignmentScenario::rot, L1EGammaClusterEmuProducer_cfi::scale, edm::second(), mathSSE::sqrt(), thick_, findQualityFiles::v, waferSize_, waferThick_, and zw().

102  {
103 #ifdef EDM_ML_DEBUG
104  int counter(0);
105 #endif
106 
107  static constexpr double tol = 0.00001;
108  static const double sqrt3 = std::sqrt(3.0);
109  double rM = 0.5 * waferSize_;
110  double RM2 = rM / sqrt3;
111  double R = waferSize_ / (3.0 * nCells_);
112  double r = 0.5 * R * sqrt3;
113  double r2 = 0.5 * waferSize_;
114  double R2 = r2 / sqrt3;
115 
116  // First the mother
117  std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
118  std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
119  std::vector<double> zw = {-0.5 * thick_, 0.5 * thick_};
120  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
121  DDName parentName = parent().name();
122  DDSolid solid = DDSolidFactory::extrudedpolygon(parentName, xM, yM, zw, zx, zy, scale);
124  DDMaterial matter(matName);
125  DDLogicalPart glogM = DDLogicalPart(solid.ddname(), matter, solid);
126 #ifdef EDM_ML_DEBUG
127  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << solid.name() << " extruded polygon made of " << matName
128  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
129  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
130  << " and " << xM.size() << " edges";
131  for (unsigned int k = 0; k < xM.size(); ++k)
132  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xM[k] << ":" << yM[k];
133 #endif
134 
135  // Then the layers
136  std::vector<double> xL = {r2, 0, -r2, -r2, 0, r2};
137  std::vector<double> yL = {R2, 2 * R2, R2, -R2, -2 * R2, -R2};
138  std::vector<DDLogicalPart> glogs(materials_.size());
139  double zi(-0.5 * thick_), thickTot(0.0);
140  for (unsigned int l = 0; l < layers_.size(); l++) {
141  unsigned int i = layers_[l];
142  if (copyNumber_[i] == 1) {
143  if (layerType_[i] > 0) {
144  zw[0] = -0.5 * waferThick_;
145  zw[1] = 0.5 * waferThick_;
146  } else {
147  zw[0] = -0.5 * layerThick_[i];
148  zw[1] = 0.5 * layerThick_[i];
149  }
150  solid = DDSolidFactory::extrudedpolygon(layerNames_[i], xL, yL, zw, zx, zy, scale);
152  DDMaterial matter(matN);
153  glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
154 #ifdef EDM_ML_DEBUG
155  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << solid.name() << " extruded polygon made of " << matN
156  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
157  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
158  << " and " << xL.size() << " edges";
159  for (unsigned int k = 0; k < xL.size(); ++k)
160  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xL[k] << ":" << yL[k];
161 #endif
162  }
163  DDTranslation tran0(0, 0, (zi + 0.5 * layerThick_[i]));
164  DDRotation rot;
165  cpv.position(glogs[i], glogM, copyNumber_[i], tran0, rot);
166 #ifdef EDM_ML_DEBUG
167  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << glogs[i].name() << " number " << copyNumber_[i]
168  << " positioned in " << glogM.name() << " at " << tran0 << " with no rotation";
169 #endif
170  ++copyNumber_[i];
171  zi += layerThick_[i];
172  thickTot += layerThick_[i];
173  if (layerType_[i] > 0) {
174  int n2 = nCells_ / 2;
175  double y0 = (cellType_ >= 3) ? 0.5 : 0.0;
176  double x0 = (cellType_ >= 3) ? 0.5 : 1.0;
177  int voff = (cellType_ >= 3) ? 0 : 1;
178  int uoff = 1 - voff;
179  int cellType = (cellType_ >= 3) ? (cellType_ - 3) : cellType_;
180  for (int u = 0; u < 2 * nCells_; ++u) {
181  for (int v = 0; v < 2 * nCells_; ++v) {
182  if (((v - u) < (nCells_ + uoff)) && (u - v) < (nCells_ + voff)) {
183 #ifdef EDM_ML_DEBUG
184  counter++;
185 #endif
186  double yp = (u - 0.5 * v - n2 + y0) * 2 * r;
187  double xp = (1.5 * (v - nCells_) + x0) * R;
188  int cell(0);
189  if ((u == 0) && (v == 0))
190  cell = 7;
191  else if ((u == 0) && (v == nCells_ - voff))
192  cell = 8;
193  else if ((u == nCells_ - uoff) && (v == 2 * nCells_ - 1))
194  cell = 9;
195  else if ((u == (2 * nCells_ - 1)) && (v == 2 * nCells_ - 1))
196  cell = 10;
197  else if ((u == 2 * nCells_ - 1) && (v == (nCells_ - voff)))
198  cell = 11;
199  else if ((u == (nCells_ - uoff)) && (v == 0))
200  cell = 12;
201  else if (u == 0)
202  cell = 1;
203  else if ((v - u) == (nCells_ - voff))
204  cell = 4;
205  else if (v == (2 * nCells_ - 1))
206  cell = 2;
207  else if (u == (2 * nCells_ - 1))
208  cell = 5;
209  else if ((u - v) == (nCells_ - uoff))
210  cell = 3;
211  else if (v == 0)
212  cell = 6;
213  if ((cellType_ >= 3) && (cell != 0))
214  cell += 12;
215  DDTranslation tran(xp, yp, 0);
216  int copy = HGCalTypes::packCellTypeUV(cellType, u, v);
217  cpv.position(DDName(cellNames_[cell]), glogs[i], copy, tran, rot);
218 #ifdef EDM_ML_DEBUG
219  edm::LogVerbatim("HGCalGeom")
220  << "DDHGCalWaferF: " << cellNames_[cell] << " number " << copy << " positioned in " << glogs[i].name()
221  << " at " << tran << " with no rotation";
222 #endif
223  }
224  }
225  }
226  }
227  }
228 #ifdef EDM_ML_DEBUG
229  edm::LogVerbatim("HGCalGeom") << "\nDDHGCalWaferF::Counter : " << counter << "\n===============================\n";
230 #endif
231  if (std::abs(thickTot - thick_) >= tol) {
232  if (thickTot > thick_) {
233  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick_ << " is smaller than " << thickTot
234  << ": thickness of all its components **** ERROR ****";
235  } else {
236  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick_ << " does not match with " << thickTot
237  << " of the components";
238  }
239  }
240 }
Log< level::Info, true > LogVerbatim
static int32_t packCellTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:28
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
std::vector< int > layerType_
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
Log< level::Error, false > LogError
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)
double waferThick_
std::vector< double > layerThick_
std::vector< int > layers_
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< std::string > materials_
std::vector< std::string > cellNames_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
const N & name() const
Definition: DDBase.h:59
std::vector< int > copyNumber_
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
const N & ddname() const
Definition: DDBase.h:61
static std::atomic< unsigned int > counter
std::vector< std::string > layerNames_
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:75
Log< level::Warning, false > LogWarning
std::string material_
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

◆ initialize()

void DDHGCalWaferF::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 57 of file DDHGCalWaferF.cc.

References cellNames_, cellType_, copyNumber_, dbl_to_int(), mps_fire::i, createfilelist::int, dqmdumpme::k, layerNames_, layers_, layerThick_, layerType_, material_, materials_, nameSpace_, nCells_, DDCurrentNamespace::ns(), class-composition::parent, thick_, waferSepar_, waferSize_, and waferThick_.

61  {
62  material_ = sArgs["ModuleMaterial"];
63  thick_ = nArgs["ModuleThickness"];
64  waferSize_ = nArgs["WaferSize"];
65  waferSepar_ = nArgs["SensorSeparation"];
66  waferThick_ = nArgs["WaferThickness"];
67 #ifdef EDM_ML_DEBUG
68  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: Module " << parent().name() << " made of " << material_ << " T "
69  << thick_ << " Wafer 2r " << waferSize_ << " Half Separation " << waferSepar_ << " T "
70  << waferThick_;
71 #endif
72  layerNames_ = vsArgs["LayerNames"];
73  materials_ = vsArgs["LayerMaterials"];
74  layerThick_ = vArgs["LayerThickness"];
75  layerType_ = dbl_to_int(vArgs["LayerTypes"]);
76  copyNumber_.resize(materials_.size(), 1);
77 #ifdef EDM_ML_DEBUG
78  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << layerNames_.size() << " types of volumes";
79  for (unsigned int i = 0; i < layerNames_.size(); ++i)
80  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << layerNames_[i] << " of thickness " << layerThick_[i]
81  << " filled with " << materials_[i] << " type " << layerType_[i];
82 #endif
83  layers_ = dbl_to_int(vArgs["Layers"]);
84 #ifdef EDM_ML_DEBUG
85  std::ostringstream st1;
86  for (unsigned int i = 0; i < layers_.size(); ++i)
87  st1 << " [" << i << "] " << layers_[i];
88  edm::LogVerbatim("HGCalGeom") << "There are " << layers_.size() << " blocks" << st1.str();
89 #endif
90  nCells_ = (int)(nArgs["NCells"]);
91  cellType_ = (int)(nArgs["CellType"]);
92  cellNames_ = vsArgs["CellNames"];
94 #ifdef EDM_ML_DEBUG
95  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: Cells/Wafer " << nCells_ << " Cell Type " << cellType_
96  << " NameSpace " << nameSpace_ << ": # of cells " << cellNames_.size();
97  for (unsigned int k = 0; k < cellNames_.size(); ++k)
98  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: Cell[" << k << "] " << cellNames_[k];
99 #endif
100 }
Log< level::Info, true > LogVerbatim
std::vector< int > layerType_
static std::string & ns()
double waferThick_
std::vector< double > layerThick_
double waferSepar_
std::vector< int > layers_
std::vector< std::string > materials_
std::vector< std::string > cellNames_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::string nameSpace_
std::vector< int > copyNumber_
std::vector< std::string > layerNames_
std::string material_

Member Data Documentation

◆ cellNames_

std::vector<std::string> DDHGCalWaferF::cellNames_
private

Definition at line 53 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ cellType_

int DDHGCalWaferF::cellType_
private

Definition at line 52 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ copyNumber_

std::vector<int> DDHGCalWaferF::copyNumber_
private

Definition at line 49 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ layerNames_

std::vector<std::string> DDHGCalWaferF::layerNames_
private

Definition at line 45 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ layers_

std::vector<int> DDHGCalWaferF::layers_
private

Definition at line 50 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ layerThick_

std::vector<double> DDHGCalWaferF::layerThick_
private

Definition at line 47 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ layerType_

std::vector<int> DDHGCalWaferF::layerType_
private

Definition at line 48 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ material_

std::string DDHGCalWaferF::material_
private

Definition at line 40 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ materials_

std::vector<std::string> DDHGCalWaferF::materials_
private

Definition at line 46 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ nameSpace_

std::string DDHGCalWaferF::nameSpace_
private

Definition at line 54 of file DDHGCalWaferF.cc.

Referenced by initialize().

◆ nCells_

int DDHGCalWaferF::nCells_
private

Definition at line 51 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ thick_

double DDHGCalWaferF::thick_
private

Definition at line 41 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ waferSepar_

double DDHGCalWaferF::waferSepar_
private

Definition at line 43 of file DDHGCalWaferF.cc.

Referenced by initialize().

◆ waferSize_

double DDHGCalWaferF::waferSize_
private

Definition at line 42 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ waferThick_

double DDHGCalWaferF::waferThick_
private

Definition at line 44 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().