CMS 3D CMS Logo

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

Public Member Functions

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

Private Attributes

std::vector< std::string > cellNames_
 
std::vector< int > cellOffset_
 
int cellType_
 
std::vector< int > copyNumber_
 
std::vector< int > face_
 
std::vector< std::string > layerNames_
 
std::vector< int > layers_
 
std::vector< double > layerSizeOff_
 
std::vector< double > layerThick_
 
std::vector< int > layerType_
 
std::string material_
 
std::vector< std::string > materials_
 
std::string nameSpace_
 
int nCells_
 
std::vector< int > orient_
 
std::vector< std::string > tag_
 
double thick_
 
double waferSepar_
 
double waferSize_
 
std::string waferTag_
 
double waferThick_
 

Detailed Description

Definition at line 26 of file DDHGCalWaferFullRotated.cc.

Constructor & Destructor Documentation

◆ DDHGCalWaferFullRotated()

DDHGCalWaferFullRotated::DDHGCalWaferFullRotated ( )

Definition at line 63 of file DDHGCalWaferFullRotated.cc.

63  {
64 #ifdef EDM_ML_DEBUG
65  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: Creating an instance";
66 #endif
67 }
Log< level::Info, true > LogVerbatim

◆ ~DDHGCalWaferFullRotated()

DDHGCalWaferFullRotated::~DDHGCalWaferFullRotated ( )
overridedefault

Member Function Documentation

◆ execute()

void DDHGCalWaferFullRotated::execute ( DDCompactView cpv)
override

Definition at line 130 of file DDHGCalWaferFullRotated.cc.

References funct::abs(), hgcalTopologyTester_cfi::cell1, cellNames_, cellOffset_, HGCalCell::cellPlacementIndex(), cellType_, HGCalCell::cellUV2Cell(), HGCalCell::cellUV2XY1(), filterCSVwithJSON::copy, copyNumber_, DDBase< N, C >::ddname(), DDSplit(), DDSolidFactory::extrudedpolygon(), face_, dqmdumpme::first, mps_fire::i, cuy::ii, dqmdumpme::k, GetRecoTauVFromDQM_MC_cff::kk, MainPageGenerator::l, layerNames_, layers_, layerSizeOff_, layerThick_, layerType_, material_, materials_, DDBase< N, C >::name(), nCells_, orient_, HGCalTypes::packCellTypeUV(), class-composition::parent, DDCompactView::position(), diffTwoXMLs::r2, makeMuonMisalignmentScenario::rot, pfClustersFromCombinedCaloHF_cfi::scale, edm::second(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, tag_, thick_, findQualityFiles::v, HGCalTypes::waferFrontBack(), waferSize_, waferTag_, waferThick_, and zw().

130  {
131 #ifdef EDM_ML_DEBUG
132  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalWaferFullRotated...";
133 #endif
134 
135  static constexpr double tol = 0.00001;
136  static const double sqrt3 = std::sqrt(3.0);
137  double rM = 0.5 * waferSize_;
138  double RM2 = rM / sqrt3;
139  const int nFine(nCells_), nCoarse(nCells_);
140  HGCalCell wafer(waferSize_, nFine, nCoarse);
141  for (unsigned int k = 0; k < tag_.size(); ++k) {
142  // First the mother
143  std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
144  std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
145  std::vector<double> zw = {-0.5 * thick_, 0.5 * thick_};
146  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
147  std::string parentName = parent().name().name();
148  parentName = parentName + tag_[k] + waferTag_;
149  DDSolid solid = DDSolidFactory::extrudedpolygon(parentName, xM, yM, zw, zx, zy, scale);
151  DDMaterial matter(matName);
152  DDLogicalPart glogM = DDLogicalPart(solid.ddname(), matter, solid);
153 #ifdef EDM_ML_DEBUG
154  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: " << solid.name() << " extruded polygon made of "
155  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":"
156  << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":"
157  << scale[1] << " and " << xM.size() << " edges";
158  for (unsigned int kk = 0; kk < xM.size(); ++kk)
159  edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << xM[kk] << ":" << yM[kk];
160 #endif
161 
162  // Then the layers
163  std::vector<DDLogicalPart> glogs(materials_.size());
164  for (unsigned int ii = 0; ii < copyNumber_.size(); ii++) {
165  copyNumber_[ii] = 1;
166  }
167  double zi(-0.5 * thick_), thickTot(0.0);
168  for (unsigned int l = 0; l < layers_.size(); l++) {
169  unsigned int i = layers_[l];
170  double r2 = 0.5 * (waferSize_ - layerSizeOff_[i]);
171  double R2 = r2 / sqrt3;
172  std::vector<double> xL = {r2, 0, -r2, -r2, 0, r2};
173  std::vector<double> yL = {R2, 2 * R2, R2, -R2, -2 * R2, -R2};
174  if (copyNumber_[i] == 1) {
175  if (layerType_[i] > 0) {
176  zw[0] = -0.5 * waferThick_;
177  zw[1] = 0.5 * waferThick_;
178  } else {
179  zw[0] = -0.5 * layerThick_[i];
180  zw[1] = 0.5 * layerThick_[i];
181  }
182  std::string layerName = layerNames_[i] + tag_[k] + waferTag_;
183 #ifdef EDM_ML_DEBUG
184  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: Layer " << l << ": " << i << ": " << layerName << " "
185  << layerSizeOff_[i] << " r " << r2 << ":" << R2;
186 #endif
187  solid = DDSolidFactory::extrudedpolygon(layerName, xL, yL, zw, zx, zy, scale);
189  DDMaterial matter(matN);
190  glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
191 #ifdef EDM_ML_DEBUG
192  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: " << solid.name() << " extruded polygon made of "
193  << matN << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":"
194  << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":"
195  << scale[1] << " and " << xL.size() << " edges";
196  for (unsigned int kk = 0; kk < xL.size(); ++kk)
197  edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << xL[kk] << ":" << yL[kk];
198 #endif
199  }
200  DDTranslation tran0(0, 0, (zi + 0.5 * layerThick_[i]));
201  DDRotation rot;
202  cpv.position(glogs[i], glogM, copyNumber_[i], tran0, rot);
203 #ifdef EDM_ML_DEBUG
204  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: " << glogs[i].name() << " number " << copyNumber_[i]
205  << " positioned in " << glogM.name() << " at " << tran0 << " with no rotation";
206 #endif
207  ++copyNumber_[i];
208  zi += layerThick_[i];
209  thickTot += layerThick_[i];
210  if ((layerType_[i] > 0) && (nCells_ > 0)) {
211  for (int u = 0; u < 2 * nCells_; ++u) {
212  for (int v = 0; v < 2 * nCells_; ++v) {
213  if (((v - u) < nCells_) && ((u - v) <= nCells_)) {
214  int placeIndex = wafer.cellPlacementIndex(1, HGCalTypes::waferFrontBack(face_[k]), orient_[k]);
215  std::pair<double, double> xy1 = wafer.cellUV2XY1(u, v, placeIndex, cellType_);
216  double yp = xy1.second;
217  double xp = xy1.first;
218  int cell(0);
219  std::pair<int, int> cell1 = wafer.cellUV2Cell(u, v, placeIndex, cellType_);
220  cell = cell1.first + cellOffset_[cell1.second];
221  DDTranslation tran(xp, yp, 0);
223  cpv.position(DDName(cellNames_[cell]), glogs[i], copy, tran, rot);
224 #ifdef EDM_ML_DEBUG
225  edm::LogVerbatim("HGCalGeom")
226  << "DDHGCalWaferFullRotated: " << cellNames_[cell] << " number " << copy << " positioned in "
227  << glogs[i].name() << " at " << tran << " with no rotation";
228 #endif
229  }
230  }
231  }
232  }
233  }
234  if (std::abs(thickTot - thick_) >= tol) {
235  if (thickTot > thick_) {
236  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick_ << " is smaller than " << thickTot
237  << ": thickness of all its components **** ERROR ****";
238  } else {
239  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick_ << " does not match with " << thickTot
240  << " of the components";
241  }
242  }
243  }
244 }
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)
std::vector< double > layerSizeOff_
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
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)
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > layerThick_
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
static int32_t waferFrontBack(int32_t index)
Definition: HGCalTypes.h:126
std::vector< std::string > cellNames_
std::vector< std::string > tag_
ii
Definition: cuy.py:589
const N & name() const
Definition: DDBase.h:59
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
std::vector< std::string > materials_
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::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 DDHGCalWaferFullRotated::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 69 of file DDHGCalWaferFullRotated.cc.

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

73  {
74  material_ = sArgs["ModuleMaterial"];
75  thick_ = nArgs["ModuleThickness"];
76  waferSize_ = nArgs["WaferSize"];
77  waferSepar_ = nArgs["SensorSeparation"];
78  waferThick_ = nArgs["WaferThickness"];
79  waferTag_ = sArgs["WaferTag"];
80 #ifdef EDM_ML_DEBUG
81  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: Module " << parent().name() << " made of " << material_
82  << " T " << thick_ << " Wafer 2r " << waferSize_ << " Half Separation " << waferSepar_
83  << " T " << waferThick_;
84 #endif
85  orient_ = dbl_to_int(vArgs["WaferOrient"]);
86  face_ = dbl_to_int(vArgs["WaferFace"]);
87  tag_ = vsArgs["WaferPlacementIndex"];
88  layerNames_ = vsArgs["LayerNames"];
89  materials_ = vsArgs["LayerMaterials"];
90  layerThick_ = vArgs["LayerThickness"];
91  layerSizeOff_ = vArgs["LayerSizeOffset"];
92  layerType_ = dbl_to_int(vArgs["LayerTypes"]);
93  copyNumber_.resize(materials_.size(), 1);
94 #ifdef EDM_ML_DEBUG
95  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: " << layerNames_.size() << " types of volumes";
96  for (unsigned int i = 0; i < layerNames_.size(); ++i)
97  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << layerNames_[i] << " of thickness " << layerThick_[i]
98  << " size offset " << layerSizeOff_[i] << " filled with " << materials_[i] << " type "
99  << layerType_[i];
100 #endif
101  layers_ = dbl_to_int(vArgs["Layers"]);
102 #ifdef EDM_ML_DEBUG
103  std::ostringstream st1;
104  for (unsigned int i = 0; i < layers_.size(); ++i)
105  st1 << " [" << i << "] " << layers_[i];
106  edm::LogVerbatim("HGCalGeom") << "There are " << layers_.size() << " blocks" << st1.str();
107 #endif
108  nCells_ = static_cast<int>(nArgs["NCells"]);
109  if (nCells_ > 0) {
110  cellType_ = static_cast<int>(nArgs["CellType"]);
111  cellNames_ = vsArgs["CellNames"];
112  cellOffset_ = dbl_to_int(vArgs["CellOffset"]);
113  } else {
114  cellType_ = -1;
115  }
117 #ifdef EDM_ML_DEBUG
118  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: Cells/Wafer " << nCells_ << " Cell Type " << cellType_
119  << " NameSpace " << nameSpace_ << ": # of cells " << cellNames_.size();
120  std::ostringstream st2;
121  for (unsigned int i = 0; i < cellOffset_.size(); ++i)
122  st2 << " [" << i << "] " << cellOffset_[i];
123  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: " << cellOffset_.size() << " types of cells with offsets "
124  << st2.str();
125  for (unsigned int k = 0; k < cellNames_.size(); ++k)
126  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferFullRotated: Cell[" << k << "] " << cellNames_[k];
127 #endif
128 }
Log< level::Info, true > LogVerbatim
std::vector< double > layerSizeOff_
static std::string & ns()
std::vector< double > layerThick_
std::vector< std::string > cellNames_
std::vector< std::string > tag_
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::vector< std::string > materials_
std::vector< std::string > layerNames_

Member Data Documentation

◆ cellNames_

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

Definition at line 59 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ cellOffset_

std::vector<int> DDHGCalWaferFullRotated::cellOffset_
private

Definition at line 58 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ cellType_

int DDHGCalWaferFullRotated::cellType_
private

Definition at line 57 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ copyNumber_

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

Definition at line 52 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ face_

std::vector<int> DDHGCalWaferFullRotated::face_
private

Definition at line 55 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ layerNames_

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

Definition at line 46 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ layers_

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

Definition at line 53 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ layerSizeOff_

std::vector<double> DDHGCalWaferFullRotated::layerSizeOff_
private

Definition at line 50 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ layerThick_

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

Definition at line 49 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ layerType_

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

Definition at line 51 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ material_

std::string DDHGCalWaferFullRotated::material_
private

Definition at line 40 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ materials_

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

Definition at line 47 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ nameSpace_

std::string DDHGCalWaferFullRotated::nameSpace_
private

Definition at line 60 of file DDHGCalWaferFullRotated.cc.

Referenced by initialize().

◆ nCells_

int DDHGCalWaferFullRotated::nCells_
private

Definition at line 56 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ orient_

std::vector<int> DDHGCalWaferFullRotated::orient_
private

Definition at line 54 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ tag_

std::vector<std::string> DDHGCalWaferFullRotated::tag_
private

Definition at line 48 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ thick_

double DDHGCalWaferFullRotated::thick_
private

Definition at line 42 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ waferSepar_

double DDHGCalWaferFullRotated::waferSepar_
private

Definition at line 44 of file DDHGCalWaferFullRotated.cc.

Referenced by initialize().

◆ waferSize_

double DDHGCalWaferFullRotated::waferSize_
private

Definition at line 43 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ waferTag_

std::string DDHGCalWaferFullRotated::waferTag_
private

Definition at line 41 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().

◆ waferThick_

double DDHGCalWaferFullRotated::waferThick_
private

Definition at line 45 of file DDHGCalWaferFullRotated.cc.

Referenced by execute(), and initialize().