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
 

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_
 

Detailed Description

Definition at line 21 of file DDHGCalWaferP.cc.

Constructor & Destructor Documentation

◆ DDHGCalWaferP()

DDHGCalWaferP::DDHGCalWaferP ( )

Definition at line 54 of file DDHGCalWaferP.cc.

54  {
55 #ifdef EDM_ML_DEBUG
56  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: Creating an instance";
57 #endif
58 }

◆ ~DDHGCalWaferP()

DDHGCalWaferP::~DDHGCalWaferP ( )
override

Definition at line 60 of file DDHGCalWaferP.cc.

60 {}

Member Function Documentation

◆ execute()

void DDHGCalWaferP::execute ( DDCompactView cpv)
override

Definition at line 112 of file DDHGCalWaferP.cc.

112  {
113 #ifdef EDM_ML_DEBUG
114  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalWaferP...";
115 #endif
116 
117  static constexpr double tol = 0.00001;
118  static const double sqrt3 = std::sqrt(3.0);
119  double rM = 0.5 * (waferSize_ + waferSepar_);
120  double RM = 2.0 * rM / sqrt3;
121  double r = 0.5 * waferSize_;
122  double R = 2.0 * r / sqrt3;
123  std::string parentName = parent().name().name();
124 
125  // Loop over all types
126  for (unsigned int k = 0; k < tags_.size(); ++k) {
127  // First the mother
128  std::string mother = parentName + tags_[k];
129  std::vector<std::pair<double, double> > wxy =
130  HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, rM, RM, 0.0, 0.0);
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") << "DDHGCalWaferP: " << solid.name() << " extruded polygon made of " << matName
144  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
145  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
146  << " partial " << partialTypes_[k] << " orientation " << orientations_[k] << " and "
147  << 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  wxy = HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, r, R, 0.0, 0.0);
154  std::vector<double> xL, yL;
155  for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
156  xL.emplace_back(wxy[i].first);
157  yL.emplace_back(wxy[i].second);
158  }
159  std::vector<DDLogicalPart> glogs(materials_.size());
160  std::vector<int> copyNumber(materials_.size(), 1);
161  double zi(-0.5 * thick_), thickTot(0.0);
162  for (unsigned int l = 0; l < layers_.size(); l++) {
163  unsigned int i = layers_[l];
164 #ifdef EDM_ML_DEBUG
165  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP:Layer " << l << ":" << i << " T " << layerThick_[i] << " Copy "
166  << copyNumber[i];
167 #endif
168  DDRotation rot;
169  if (copyNumber[i] == 1) {
170  zw[0] = -0.5 * layerThick_[i];
171  zw[1] = 0.5 * layerThick_[i];
172  std::string lname = layerNames_[i] + tags_[k];
173  solid = DDSolidFactory::extrudedpolygon(lname, xL, yL, zw, zx, zy, scale);
175  DDMaterial matter(matN);
176  glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
177 #ifdef EDM_ML_DEBUG
178  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << solid.name() << " extruded polygon made of " << matN
179  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
180  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
181  << " partial " << partialTypes_[k] << " orientation " << orientations_[k]
182  << " and " << xL.size() << " edges";
183  for (unsigned int j = 0; j < xL.size(); ++j)
184  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xL[j] << ":" << yL[j];
185 #endif
186  if (layerType_[i] > 0) {
187  std::string sname = senseName_ + tags_[k];
188  zw[0] = -0.5 * senseT_;
189  zw[1] = 0.5 * senseT_;
190  solid = DDSolidFactory::extrudedpolygon(sname, xL, yL, zw, zx, zy, scale);
191  DDLogicalPart glog = DDLogicalPart(solid.ddname(), matter, solid);
192 #ifdef EDM_ML_DEBUG
193  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << solid.name() << " extruded polygon made of " << matN
194  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
195  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
196  << " partial " << partialTypes_[k] << " orientation " << orientations_[k]
197  << " and " << xL.size() << " edges";
198  for (unsigned int j = 0; j < xL.size(); ++j)
199  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xL[j] << ":" << yL[j];
200 #endif
201  double zpos = (posSense_ == 0) ? -0.5 * (layerThick_[i] - senseT_) : 0.5 * (layerThick_[i] - senseT_);
202  DDTranslation tran(0, 0, zpos);
203  int copy = 10 + senseType_;
204  cpv.position(glog, glogs[i], copy, tran, rot);
205 #ifdef EDM_ML_DEBUG
206  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << glog.name() << " number " << copy << " positioned in "
207  << glogs[i].name() << " at " << tran << " with no rotation";
208 #endif
209  }
210  }
211  DDTranslation tran0(0, 0, (zi + 0.5 * layerThick_[i]));
212  cpv.position(glogs[i], glogM, copyNumber[i], tran0, rot);
213 #ifdef EDM_ML_DEBUG
214  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: " << glogs[i].name() << " number " << copyNumber[i]
215  << " positioned in " << glogM.name() << " at " << tran0 << " with no rotation";
216 #endif
217  ++copyNumber[i];
218  zi += layerThick_[i];
219  thickTot += layerThick_[i];
220  }
221  if (std::abs(thickTot - thick_) >= tol) {
222  if (thickTot > thick_) {
223  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick_ << " is smaller than " << thickTot
224  << ": thickness of all its components **** ERROR ****";
225  } else {
226  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick_ << " does not match with " << thickTot
227  << " of the components";
228  }
229  }
230  }
231 }

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

◆ initialize()

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

Definition at line 62 of file DDHGCalWaferP.cc.

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

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_, and waferSize_.

Member Data Documentation

◆ layerNames_

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

Definition at line 42 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ layers_

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

Definition at line 46 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ layerThick_

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

Definition at line 44 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ layerType_

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

Definition at line 45 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 43 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ nameSpace_

std::string DDHGCalWaferP::nameSpace_
private

Definition at line 51 of file DDHGCalWaferP.cc.

Referenced by initialize().

◆ orientations_

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

Definition at line 41 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ partialTypes_

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

Definition at line 40 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ posSense_

int DDHGCalWaferP::posSense_
private

Definition at line 50 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ senseName_

std::string DDHGCalWaferP::senseName_
private

Definition at line 47 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ senseT_

double DDHGCalWaferP::senseT_
private

Definition at line 48 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ senseType_

int DDHGCalWaferP::senseType_
private

Definition at line 49 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

◆ tags_

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

Definition at line 39 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 execute(), and initialize().

◆ waferSize_

double DDHGCalWaferP::waferSize_
private

Definition at line 37 of file DDHGCalWaferP.cc.

Referenced by execute(), and initialize().

mps_fire.i
i
Definition: mps_fire.py:428
DDHGCalWaferP::materials_
std::vector< std::string > materials_
Definition: DDHGCalWaferP.cc:43
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
HGCalWaferMask::waferXY
static std::vector< std::pair< double, double > > waferXY(int part, int orient, int zside, double delX, double delY, double xpos, double ypos)
Definition: HGCalWaferMask.cc:790
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DDHGCalWaferP::senseName_
std::string senseName_
Definition: DDHGCalWaferP.cc:47
DDHGCalWaferP::waferSize_
double waferSize_
Definition: DDHGCalWaferP.cc:37
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
DDHGCalWaferP::posSense_
int posSense_
Definition: DDHGCalWaferP.cc:50
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDHGCalWaferP::orientations_
std::vector< int > orientations_
Definition: DDHGCalWaferP.cc:41
DDHGCalWaferP::layerNames_
std::vector< std::string > layerNames_
Definition: DDHGCalWaferP.cc:42
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDBase::name
const N & name() const
Definition: DDBase.h:59
dqmdumpme.k
k
Definition: dqmdumpme.py:60
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
DDHGCalWaferP::tags_
std::vector< std::string > tags_
Definition: DDHGCalWaferP.cc:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDHGCalWaferP::layers_
std::vector< int > layers_
Definition: DDHGCalWaferP.cc:46
DDSolidFactory::extrudedpolygon
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:570
DDHGCalWaferP::layerType_
std::vector< int > layerType_
Definition: DDHGCalWaferP.cc:45
DDBase::ddname
const N & ddname() const
Definition: DDBase.h:61
DDHGCalWaferP::waferSepar_
double waferSepar_
Definition: DDHGCalWaferP.cc:38
DDHGCalWaferP::senseType_
int senseType_
Definition: DDHGCalWaferP.cc:49
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDHGCalWaferP::thick_
double thick_
Definition: DDHGCalWaferP.cc:36
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDHGCalWaferP::nameSpace_
std::string nameSpace_
Definition: DDHGCalWaferP.cc:51
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
DDHGCalWaferP::partialTypes_
std::vector< int > partialTypes_
Definition: DDHGCalWaferP.cc:40
DDHGCalWaferP::layerThick_
std::vector< double > layerThick_
Definition: DDHGCalWaferP.cc:44
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
DDHGCalWaferP::material_
std::string material_
Definition: DDHGCalWaferP.cc:35
zw
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:75
DDHGCalWaferP::senseT_
double senseT_
Definition: DDHGCalWaferP.cc:48
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dbl_to_int
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
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Log
Definition: MessageLogger.h:70
dttmaxenums::R
Definition: DTTMax.h:29
class-composition.parent
parent
Definition: class-composition.py:88
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
DDCompactView::position
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Definition: DDCompactView.cc:76