CMS 3D CMS Logo

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

Public Member Functions

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

Private Attributes

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_
 
std::vector< int > orientations_
 
std::vector< int > partialTypes_
 
int posSense_
 
std::string senseName_
 
double senseT_
 
int senseType_
 
std::vector< std::string > tags_
 
double thick_
 
double waferSepar_
 
double waferSize_
 
double waferThick_
 

Detailed Description

Definition at line 21 of file DDHGCalWaferP.cc.

Constructor & Destructor Documentation

◆ DDHGCalWaferP()

DDHGCalWaferP::DDHGCalWaferP ( )
inline

Definition at line 24 of file DDHGCalWaferP.cc.

24 {}

◆ ~DDHGCalWaferP()

DDHGCalWaferP::~DDHGCalWaferP ( )
overridedefault

Member Function Documentation

◆ execute()

void DDHGCalWaferP::execute ( DDCompactView cpv)
override

Definition at line 107 of file DDHGCalWaferP.cc.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), DDSolidFactory::extrudedpolygon(), dqmdumpme::first, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, MainPageGenerator::l, layerNames_, layers_, layerThick_, layerType_, material_, materials_, DDBase< N, C >::name(), orientations_, class-composition::parent, partialTypes_, DDCompactView::position(), posSense_, makeMuonMisalignmentScenario::rot, l1tEGammaCrystalsEmulatorProducer_cfi::scale, edm::second(), senseName_, senseT_, senseType_, AlCaHLTBitMon_QueryRunRegistry::string, tags_, thick_, waferSize_, waferThick_, HGCalWaferMask::waferXY(), and zw().

107  {
108  static constexpr double tol = 0.00001;
109  std::string parentName = parent().name().name();
110 
111  // Loop over all types
112  for (unsigned int k = 0; k < tags_.size(); ++k) {
113  // First the mother
114  std::string mother = parentName + tags_[k];
115  std::vector<std::pair<double, double> > wxy =
116  HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, waferSize_, 0.0, 0.0, 0.0, true);
117  std::vector<double> xM, yM;
118  for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
119  xM.emplace_back(wxy[i].first);
120  yM.emplace_back(wxy[i].second);
121  }
122  std::vector<double> zw = {-0.5 * thick_, 0.5 * thick_};
123  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
124  DDSolid solid = DDSolidFactory::extrudedpolygon(mother, xM, yM, zw, zx, zy, scale);
126  DDMaterial matter(matName);
127  DDLogicalPart glogM = DDLogicalPart(solid.ddname(), matter, solid);
128 #ifdef EDM_ML_DEBUG
129  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << solid.name() << " extruded polygon made of " << matName
130  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
131  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
132  << " partial " << partialTypes_[k] << " orientation " << orientations_[k] << " and "
133  << xM.size() << " edges";
134  for (unsigned int j = 0; j < xM.size(); ++j)
135  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xM[j] << ":" << yM[j];
136 #endif
137 
138  // Then the layers
139  wxy = HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, waferSize_, 0.0, 0.0, 0.0, true);
140  std::vector<double> xL, yL;
141  for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
142  xL.emplace_back(wxy[i].first);
143  yL.emplace_back(wxy[i].second);
144  }
145  std::vector<DDLogicalPart> glogs(materials_.size());
146  std::vector<int> copyNumber(materials_.size(), 1);
147  double zi(-0.5 * thick_), thickTot(0.0);
148  for (unsigned int l = 0; l < layers_.size(); l++) {
149  unsigned int i = layers_[l];
150 #ifdef EDM_ML_DEBUG
151  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP:Layer " << l << ":" << i << " T " << layerThick_[i] << " Copy "
152  << copyNumber[i];
153 #endif
154  DDRotation rot;
155  if (copyNumber[i] == 1) {
156  if (layerType_[i] > 0) {
157  zw[0] = -0.5 * waferThick_;
158  zw[1] = 0.5 * waferThick_;
159  } else {
160  zw[0] = -0.5 * layerThick_[i];
161  zw[1] = 0.5 * layerThick_[i];
162  }
163  std::string lname = layerNames_[i] + tags_[k];
164  solid = DDSolidFactory::extrudedpolygon(lname, xL, yL, zw, zx, zy, scale);
166  DDMaterial matter(matN);
167  glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
168 #ifdef EDM_ML_DEBUG
169  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << solid.name() << " extruded polygon made of " << matN
170  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
171  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
172  << " partial " << partialTypes_[k] << " orientation " << orientations_[k]
173  << " and " << xL.size() << " edges";
174  for (unsigned int j = 0; j < xL.size(); ++j)
175  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xL[j] << ":" << yL[j];
176 #endif
177  if (layerType_[i] > 0) {
178  std::string sname = senseName_ + tags_[k];
179  zw[0] = -0.5 * senseT_;
180  zw[1] = 0.5 * senseT_;
181  solid = DDSolidFactory::extrudedpolygon(sname, xL, yL, zw, zx, zy, scale);
182  DDLogicalPart glog = DDLogicalPart(solid.ddname(), matter, solid);
183 #ifdef EDM_ML_DEBUG
184  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << solid.name() << " extruded polygon made of " << matN
185  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
186  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
187  << " partial " << partialTypes_[k] << " orientation " << orientations_[k]
188  << " and " << xL.size() << " edges";
189  for (unsigned int j = 0; j < xL.size(); ++j)
190  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xL[j] << ":" << yL[j];
191 #endif
192  double zpos = (posSense_ == 0) ? -0.5 * (waferThick_ - senseT_) : 0.5 * (waferThick_ - senseT_);
193  DDTranslation tran(0, 0, zpos);
194  int copy = 10 + senseType_;
195  cpv.position(glog, glogs[i], copy, tran, rot);
196 #ifdef EDM_ML_DEBUG
197  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << glog.name() << " number " << copy << " positioned in "
198  << glogs[i].name() << " at " << tran << " with no rotation";
199 #endif
200  }
201  }
202  DDTranslation tran0(0, 0, (zi + 0.5 * layerThick_[i]));
203  cpv.position(glogs[i], glogM, copyNumber[i], tran0, rot);
204 #ifdef EDM_ML_DEBUG
205  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << glogs[i].name() << " number " << copyNumber[i]
206  << " positioned in " << glogM.name() << " at " << tran0 << " with no rotation";
207 #endif
208  ++copyNumber[i];
209  zi += layerThick_[i];
210  thickTot += layerThick_[i];
211  }
212  if (std::abs(thickTot - thick_) >= tol) {
213  if (thickTot > thick_) {
214  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick_ << " is smaller than " << thickTot
215  << ": thickness of all its components **** ERROR ****";
216  } else {
217  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick_ << " does not match with " << thickTot
218  << " of the components";
219  }
220  }
221  }
222 }
Log< level::Info, true > LogVerbatim
std::vector< int > orientations_
std::vector< int > layerType_
std::vector< int > partialTypes_
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
std::vector< std::string > tags_
std::vector< std::string > layerNames_
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
static std::vector< std::pair< double, double > > waferXY(const int &part, const int &orient, const int &zside, const double &waferSize, const double &offset, const double &xpos, const double &ypos, const bool &v17)
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::vector< std::string > materials_
std::vector< int > layers_
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
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< double > layerThick_
std::string material_
double waferThick_
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:84
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
std::string senseName_

◆ initialize()

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

Definition at line 55 of file DDHGCalWaferP.cc.

References dbl_to_int(), mps_fire::i, dqmdumpme::k, layerNames_, layers_, layerThick_, layerType_, material_, materials_, nameSpace_, DDCurrentNamespace::ns(), orientations_, class-composition::parent, partialTypes_, posSense_, senseName_, senseT_, senseType_, tags_, thick_, waferSepar_, waferSize_, and waferThick_.

59  {
60  material_ = sArgs["ModuleMaterial"];
61  thick_ = nArgs["ModuleThickness"];
62  waferSize_ = nArgs["WaferSize"];
63  waferThick_ = nArgs["WaferThickness"];
64 #ifdef EDM_ML_DEBUG
65  waferSepar_ = nArgs["SensorSeparation"];
66  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: Module " << parent().name() << " made of " << material_ << " T "
67  << thick_ << " Wafer 2r " << waferSize_ << " Half Separation " << waferSepar_ << " T "
68  << waferThick_;
69 #endif
70  tags_ = vsArgs["Tags"];
71  partialTypes_ = dbl_to_int(vArgs["PartialTypes"]);
72  orientations_ = dbl_to_int(vArgs["Orientations"]);
73 #ifdef EDM_ML_DEBUG
74  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << tags_.size() << " variations of wafer types";
75  for (unsigned int k = 0; k < tags_.size(); ++k)
76  edm::LogVerbatim("HGCalGeom") << "Type[" << k << "] " << tags_[k] << " Partial " << partialTypes_[k]
77  << " Orientation " << orientations_[k];
78 #endif
79  layerNames_ = vsArgs["LayerNames"];
80  materials_ = vsArgs["LayerMaterials"];
81  layerThick_ = vArgs["LayerThickness"];
82  layerType_ = dbl_to_int(vArgs["LayerTypes"]);
83 #ifdef EDM_ML_DEBUG
84  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << layerNames_.size() << " types of volumes";
85  for (unsigned int i = 0; i < layerNames_.size(); ++i)
86  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << layerNames_[i] << " of thickness " << layerThick_[i]
87  << " filled with " << materials_[i] << " type " << layerType_[i];
88 #endif
89  layers_ = dbl_to_int(vArgs["Layers"]);
90 #ifdef EDM_ML_DEBUG
91  std::ostringstream st1;
92  for (unsigned int i = 0; i < layers_.size(); ++i)
93  st1 << " [" << i << "] " << layers_[i];
94  edm::LogVerbatim("HGCalGeom") << "There are " << layers_.size() << " blocks" << st1.str();
95 #endif
96  senseName_ = sArgs["SenseName"];
97  senseT_ = nArgs["SenseThick"];
98  senseType_ = static_cast<int>(nArgs["SenseType"]);
99  posSense_ = static_cast<int>(nArgs["PosSensitive"]);
101 #ifdef EDM_ML_DEBUG
102  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: NameSpace " << nameSpace_ << ": Sensitive Layer Name " << senseName_
103  << " Thickness " << senseT_ << " Type " << senseType_ << " Position " << posSense_;
104 #endif
105 }
Log< level::Info, true > LogVerbatim
std::vector< int > orientations_
double waferSepar_
std::vector< int > layerType_
std::vector< int > partialTypes_
std::vector< std::string > tags_
std::vector< std::string > layerNames_
static std::string & ns()
std::vector< std::string > materials_
std::vector< int > layers_
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< double > layerThick_
std::string material_
double waferThick_
std::string nameSpace_
std::string senseName_

Member Data Documentation

◆ layerNames_

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

Definition at line 43 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ layers_

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

Definition at line 47 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ layerThick_

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

Definition at line 45 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ layerType_

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

Definition at line 46 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ material_

std::string DDHGCalWaferP::material_
private

Definition at line 35 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ materials_

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

Definition at line 44 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ nameSpace_

std::string DDHGCalWaferP::nameSpace_
private

Definition at line 52 of file DDHGCalWaferP.cc.

Referenced by initialize().

◆ orientations_

std::vector<int> DDHGCalWaferP::orientations_
private

Definition at line 42 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ partialTypes_

std::vector<int> DDHGCalWaferP::partialTypes_
private

Definition at line 41 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ posSense_

int DDHGCalWaferP::posSense_
private

Definition at line 51 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ senseName_

std::string DDHGCalWaferP::senseName_
private

Definition at line 48 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ senseT_

double DDHGCalWaferP::senseT_
private

Definition at line 49 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ senseType_

int DDHGCalWaferP::senseType_
private

Definition at line 50 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ tags_

std::vector<std::string> DDHGCalWaferP::tags_
private

Definition at line 40 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ thick_

double DDHGCalWaferP::thick_
private

Definition at line 36 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ waferSepar_

double DDHGCalWaferP::waferSepar_
private

Definition at line 38 of file DDHGCalWaferP.cc.

Referenced by initialize().

◆ waferSize_

double DDHGCalWaferP::waferSize_
private

Definition at line 37 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ waferThick_

double DDHGCalWaferP::waferThick_
private

Definition at line 39 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().