CMS 3D CMS Logo

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

Public Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 22 of file DDHGCalWaferPartialRotated.cc.

Constructor & Destructor Documentation

◆ DDHGCalWaferPartialRotated()

DDHGCalWaferPartialRotated::DDHGCalWaferPartialRotated ( )
default

◆ ~DDHGCalWaferPartialRotated()

DDHGCalWaferPartialRotated::~DDHGCalWaferPartialRotated ( )
overridedefault

Member Function Documentation

◆ execute()

void DDHGCalWaferPartialRotated::execute ( DDCompactView cpv)
override

Definition at line 116 of file DDHGCalWaferPartialRotated.cc.

References funct::abs(), HGCalCell::cellOrient(), filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), DDSolidFactory::extrudedpolygon(), dqmdumpme::first, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, cmsLHEtoEOSManager::l, layerNames_, layers_, layerSizeOff_, layerThick_, layerType_, visualization-live-secondInstance_cfg::m, material_, materials_, DDBase< N, C >::name(), class-composition::parent, partialTypes_, placementIndex_, placementIndexTags_, DDCompactView::position(), makeMuonMisalignmentScenario::rot, L1EGammaClusterEmuProducer_cfi::scale, edm::second(), senseName_, senseT_, senseType_, AlCaHLTBitMon_QueryRunRegistry::string, tags_, thick_, waferSize_, waferTag_, waferThick_, HGCalWaferMask::waferXY(), and zw().

116  {
117 #ifdef EDM_ML_DEBUG
118  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalWaferPartialRotated...";
119 #endif
120 
121  static constexpr double tol = 0.00001;
122  std::string parentName = parent().name().name();
123 
124  // Loop over all types
125  for (unsigned int k = 0; k < tags_.size(); ++k) {
126  for (unsigned int m = 0; m < placementIndex_.size(); ++m) {
127  // First the mother
128  std::string mother = parentName + placementIndexTags_[m] + waferTag_ + tags_[k];
129  std::vector<std::pair<double, double> > wxy =
131  std::vector<double> xM, yM;
132  for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
133  xM.emplace_back(wxy[i].first);
134  yM.emplace_back(wxy[i].second);
135  }
136  std::vector<double> zw = {-0.5 * thick_, 0.5 * thick_};
137  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
138  DDSolid solid = DDSolidFactory::extrudedpolygon(mother, xM, yM, zw, zx, zy, scale);
140  DDMaterial matter(matName);
141  DDLogicalPart glogM = DDLogicalPart(solid.ddname(), matter, solid);
142 #ifdef EDM_ML_DEBUG
143  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferPartialRotated: " << solid.name() << " extruded polygon made of "
144  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":"
145  << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":"
146  << scale[1] << " partial " << partialTypes_[k] << " placement index "
147  << placementIndex_[m] << " and " << xM.size() << " edges";
148  for (unsigned int j = 0; j < xM.size(); ++j)
149  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xM[j] << ":" << yM[j];
150 #endif
151 
152  // Then the layers
153  std::vector<DDLogicalPart> glogs(materials_.size());
154  std::vector<int> copyNumber(materials_.size(), 1);
155  double zi(-0.5 * thick_), thickTot(0.0);
156  for (unsigned int l = 0; l < layers_.size(); l++) {
157  unsigned int i = layers_[l];
159  std::vector<double> xL, yL;
160  for (unsigned int i0 = 0; i0 < (wxy.size() - 1); ++i0) {
161  xL.emplace_back(wxy[i0].first);
162  yL.emplace_back(wxy[i0].second);
163  }
164 #ifdef EDM_ML_DEBUG
165  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferPartialRotated:Layer " << l << ":" << i << " T " << layerThick_[i]
166  << " Size offset " << layerSizeOff_[i] << " Copy " << copyNumber[i]
167  << " Partial type " << partialTypes_[k];
168 #endif
169  DDRotation rot;
170  if (copyNumber[i] == 1) {
171  if (layerType_[i] > 0) {
172  zw[0] = -0.5 * waferThick_;
173  zw[1] = 0.5 * waferThick_;
174  } else {
175  zw[0] = -0.5 * layerThick_[i];
176  zw[1] = 0.5 * layerThick_[i];
177  }
179  solid = DDSolidFactory::extrudedpolygon(lname, xL, yL, zw, zx, zy, scale);
181  DDMaterial matter(matN);
182  glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
183 #ifdef EDM_ML_DEBUG
184  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferPartialRotated: " << solid.name()
185  << " extruded polygon made of " << matN << " z|x|y|s (0) " << zw[0] << ":"
186  << zx[0] << ":" << zy[0] << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":"
187  << zx[1] << ":" << zy[1] << ":" << scale[1] << " partial " << partialTypes_[k]
188  << " placement index " << placementIndex_[m] << " and " << xL.size()
189  << " edges";
190  for (unsigned int j = 0; j < xL.size(); ++j)
191  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xL[j] << ":" << yL[j];
192 #endif
193  if ((layerType_[i] > 0) && (senseType_ >= 0)) {
195  zw[0] = -0.5 * senseT_;
196  zw[1] = 0.5 * senseT_;
197  solid = DDSolidFactory::extrudedpolygon(sname, xL, yL, zw, zx, zy, scale);
198  DDLogicalPart glog = DDLogicalPart(solid.ddname(), matter, solid);
199 #ifdef EDM_ML_DEBUG
200  edm::LogVerbatim("HGCalGeom")
201  << "DDHGCalWaferPartialRotated: " << solid.name() << " extruded polygon made of " << matN
202  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0] << " z|x|y|s (1) "
203  << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1] << " partial " << partialTypes_[k]
204  << " placement index " << placementIndex_[m] << " and " << xL.size() << " edges";
205  for (unsigned int j = 0; j < xL.size(); ++j)
206  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xL[j] << ":" << yL[j];
207 #endif
208  auto posSense = HGCalCell::cellOrient(placementIndex_[m]);
209  double zpos = (posSense.second > 0) ? -0.5 * (waferThick_ - senseT_) : 0.5 * (waferThick_ - senseT_);
210  DDTranslation tran(0, 0, zpos);
211  int copy = 10 + senseType_;
212  cpv.position(glog, glogs[i], copy, tran, rot);
213 #ifdef EDM_ML_DEBUG
214  edm::LogVerbatim("HGCalGeom")
215  << "DDHGCalWaferPartialRotated: " << glog.name() << " number " << copy << " positioned in "
216  << glogs[i].name() << " at " << tran << " with no rotation";
217 #endif
218  }
219  }
220  DDTranslation tran0(0, 0, (zi + 0.5 * layerThick_[i]));
221  cpv.position(glogs[i], glogM, copyNumber[i], tran0, rot);
222 #ifdef EDM_ML_DEBUG
223  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferPartialRotated: " << glogs[i].name() << " number "
224  << copyNumber[i] << " positioned in " << glogM.name() << " at " << tran0
225  << " with no rotation";
226 #endif
227  ++copyNumber[i];
228  zi += layerThick_[i];
229  thickTot += layerThick_[i];
230  }
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  }
241  }
242 }
Log< level::Info, true > LogVerbatim
std::vector< std::string > placementIndexTags_
std::vector< std::string > materials_
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
static std::vector< std::pair< double, double > > waferXY(int part, int orient, int zside, double delX, double delY, double xpos, double ypos)
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)
std::vector< std::string > layerNames_
static std::pair< int32_t, int32_t > cellOrient(int32_t placementIndex)
Definition: HGCalCell.cc:238
std::vector< std::string > tags_
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
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 DDHGCalWaferPartialRotated::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 58 of file DDHGCalWaferPartialRotated.cc.

References dbl_to_int(), mps_fire::i, dqmdumpme::k, layerNames_, layers_, layerSizeOff_, layerThick_, layerType_, visualization-live-secondInstance_cfg::m, material_, materials_, nameSpace_, DDCurrentNamespace::ns(), class-composition::parent, partialTypes_, placementIndex_, placementIndexTags_, senseName_, senseT_, senseType_, tags_, thick_, waferSepar_, waferSize_, waferTag_, and waferThick_.

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

Member Data Documentation

◆ layerNames_

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

Definition at line 46 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ layers_

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

Definition at line 51 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ layerSizeOff_

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

Definition at line 49 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ layerThick_

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

Definition at line 48 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ layerType_

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

Definition at line 50 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ material_

std::string DDHGCalWaferPartialRotated::material_
private

Definition at line 36 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ materials_

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

Definition at line 47 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ nameSpace_

std::string DDHGCalWaferPartialRotated::nameSpace_
private

Definition at line 55 of file DDHGCalWaferPartialRotated.cc.

Referenced by initialize().

◆ partialTypes_

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

Definition at line 43 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ placementIndex_

std::vector<int> DDHGCalWaferPartialRotated::placementIndex_
private

Definition at line 44 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ placementIndexTags_

std::vector<std::string> DDHGCalWaferPartialRotated::placementIndexTags_
private

Definition at line 45 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ senseName_

std::string DDHGCalWaferPartialRotated::senseName_
private

Definition at line 52 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ senseT_

double DDHGCalWaferPartialRotated::senseT_
private

Definition at line 53 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ senseType_

int DDHGCalWaferPartialRotated::senseType_
private

Definition at line 54 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ tags_

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

Definition at line 42 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ thick_

double DDHGCalWaferPartialRotated::thick_
private

Definition at line 38 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ waferSepar_

double DDHGCalWaferPartialRotated::waferSepar_
private

Definition at line 40 of file DDHGCalWaferPartialRotated.cc.

Referenced by initialize().

◆ waferSize_

double DDHGCalWaferPartialRotated::waferSize_
private

Definition at line 39 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ waferTag_

std::string DDHGCalWaferPartialRotated::waferTag_
private

Definition at line 37 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().

◆ waferThick_

double DDHGCalWaferPartialRotated::waferThick_
private

Definition at line 41 of file DDHGCalWaferPartialRotated.cc.

Referenced by execute(), and initialize().