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
 

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 20 of file DDHGCalWaferF.cc.

Constructor & Destructor Documentation

◆ DDHGCalWaferF()

DDHGCalWaferF::DDHGCalWaferF ( )

Definition at line 51 of file DDHGCalWaferF.cc.

51  {
52 #ifdef EDM_ML_DEBUG
53  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: Creating an instance";
54 #endif
55 }

◆ ~DDHGCalWaferF()

DDHGCalWaferF::~DDHGCalWaferF ( )
override

Definition at line 57 of file DDHGCalWaferF.cc.

57 {}

Member Function Documentation

◆ execute()

void DDHGCalWaferF::execute ( DDCompactView cpv)
override

Definition at line 104 of file DDHGCalWaferF.cc.

104  {
105 #ifdef EDM_ML_DEBUG
106  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalWaferF...";
107 #endif
108 
109  static constexpr double tol = 0.00001;
110  static const double sqrt3 = std::sqrt(3.0);
111  double rM = 0.5 * waferSize_;
112  double RM2 = rM / sqrt3;
113  double R = waferSize_ / (3.0 * nCells_);
114  double r = 0.5 * R * sqrt3;
115  double r2 = 0.5 * waferSize_;
116  double R2 = r2 / sqrt3;
117 
118  // First the mother
119  std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
120  std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
121  std::vector<double> zw = {-0.5 * thick_, 0.5 * thick_};
122  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
123  DDName parentName = parent().name();
124  DDSolid solid = DDSolidFactory::extrudedpolygon(parentName, 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") << "DDHGCalWaferF: " << 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  << " and " << xM.size() << " edges";
133  for (unsigned int k = 0; k < xM.size(); ++k)
134  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xM[k] << ":" << yM[k];
135 #endif
136 
137  // Then the layers
138  std::vector<double> xL = {r2, 0, -r2, -r2, 0, r2};
139  std::vector<double> yL = {R2, 2 * R2, R2, -R2, -2 * R2, -R2};
140  std::vector<DDLogicalPart> glogs(materials_.size());
141  double zi(-0.5 * thick_), thickTot(0.0);
142  for (unsigned int l = 0; l < layers_.size(); l++) {
143  unsigned int i = layers_[l];
144  if (copyNumber_[i] == 1) {
145  if (layerType_[i] > 0) {
146  zw[0] = -0.5 * waferThick_;
147  zw[1] = 0.5 * waferThick_;
148  } else {
149  zw[0] = -0.5 * layerThick_[i];
150  zw[1] = 0.5 * layerThick_[i];
151  }
152  solid = DDSolidFactory::extrudedpolygon(layerNames_[i], xL, yL, zw, zx, zy, scale);
154  DDMaterial matter(matN);
155  glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
156 #ifdef EDM_ML_DEBUG
157  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << solid.name() << " extruded polygon made of " << matN
158  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
159  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
160  << " and " << xL.size() << " edges";
161  for (unsigned int k = 0; k < xL.size(); ++k)
162  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xL[k] << ":" << yL[k];
163 #endif
164  }
165  DDTranslation tran0(0, 0, (zi + 0.5 * layerThick_[i]));
166  DDRotation rot;
167  cpv.position(glogs[i], glogM, copyNumber_[i], tran0, rot);
168 #ifdef EDM_ML_DEBUG
169  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << glogs[i].name() << " number " << copyNumber_[i]
170  << " positioned in " << glogM.name() << " at " << tran0 << " with no rotation";
171 #endif
172  ++copyNumber_[i];
173  zi += layerThick_[i];
174  thickTot += layerThick_[i];
175  if (layerType_[i] > 0) {
176  for (int u = 0; u < 2 * nCells_; ++u) {
177  for (int v = 0; v < 2 * nCells_; ++v) {
178  if (((v - u) < nCells_) && (u - v) <= nCells_) {
179  int n2 = nCells_ / 2;
180  double yp = (u - 0.5 * v - n2) * 2 * r;
181  double xp = (1.5 * (v - nCells_) + 1.0) * R;
182  int cell(0);
183  if ((u == 0) && (v == 0))
184  cell = 7;
185  else if ((u == 0) && (v == nCells_ - 1))
186  cell = 8;
187  else if ((u == nCells_) && (v == 2 * nCells_ - 1))
188  cell = 9;
189  else if ((u == 2 * nCells_ - 1) && (v == 2 * nCells_ - 1))
190  cell = 10;
191  else if ((u == 2 * nCells_ - 1) && (v == nCells_ - 1))
192  cell = 11;
193  else if ((u == nCells_) && (v == 0))
194  cell = 12;
195  else if (u == 0)
196  cell = 1;
197  else if ((v - u) == (nCells_ - 1))
198  cell = 4;
199  else if (v == (2 * nCells_ - 1))
200  cell = 2;
201  else if (u == (2 * nCells_ - 1))
202  cell = 5;
203  else if ((u - v) == nCells_)
204  cell = 3;
205  else if (v == 0)
206  cell = 6;
207  DDTranslation tran(xp, yp, 0);
209  cpv.position(DDName(cellNames_[cell]), glogs[i], copy, tran, rot);
210 #ifdef EDM_ML_DEBUG
211  edm::LogVerbatim("HGCalGeom")
212  << "DDHGCalWaferF: " << cellNames_[cell] << " number " << copy << " positioned in " << glogs[i].name()
213  << " at " << tran << " with no rotation";
214 #endif
215  }
216  }
217  }
218  }
219  }
220  if (std::abs(thickTot - thick_) >= tol) {
221  if (thickTot > thick_) {
222  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick_ << " is smaller than " << thickTot
223  << ": thickness of all its components **** ERROR ****";
224  } else {
225  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick_ << " does not match with " << thickTot
226  << " of the components";
227  }
228  }
229 }

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

◆ initialize()

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

Definition at line 59 of file DDHGCalWaferF.cc.

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

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_.

Member Data Documentation

◆ cellNames_

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

Definition at line 47 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ cellType_

int DDHGCalWaferF::cellType_
private

Definition at line 46 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ copyNumber_

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

Definition at line 43 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ layerNames_

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

Definition at line 39 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ layers_

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

Definition at line 44 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ layerThick_

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

Definition at line 41 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ layerType_

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

Definition at line 42 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ material_

std::string DDHGCalWaferF::material_
private

Definition at line 34 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ materials_

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

Definition at line 40 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ nameSpace_

std::string DDHGCalWaferF::nameSpace_
private

Definition at line 48 of file DDHGCalWaferF.cc.

Referenced by initialize().

◆ nCells_

int DDHGCalWaferF::nCells_
private

Definition at line 45 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ thick_

double DDHGCalWaferF::thick_
private

Definition at line 35 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ waferSepar_

double DDHGCalWaferF::waferSepar_
private

Definition at line 37 of file DDHGCalWaferF.cc.

Referenced by initialize().

◆ waferSize_

double DDHGCalWaferF::waferSize_
private

Definition at line 36 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

◆ waferThick_

double DDHGCalWaferF::waferThick_
private

Definition at line 38 of file DDHGCalWaferF.cc.

Referenced by execute(), and initialize().

mps_fire.i
i
Definition: mps_fire.py:428
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:17
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DDHGCalWaferF::nCells_
int nCells_
Definition: DDHGCalWaferF.cc:45
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
DDHGCalWaferF::nameSpace_
std::string nameSpace_
Definition: DDHGCalWaferF.cc:48
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
DDHGCalWaferF::material_
std::string material_
Definition: DDHGCalWaferF.cc:34
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDBase::name
const N & name() const
Definition: DDBase.h:59
HGCalTypes::packCellTypeUV
static int32_t packCellTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:28
DDHGCalWaferF::layerThick_
std::vector< double > layerThick_
Definition: DDHGCalWaferF.cc:41
dqmdumpme.k
k
Definition: dqmdumpme.py:60
callgraph.n2
n2
Definition: callgraph.py:50
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
DDHGCalWaferF::copyNumber_
std::vector< int > copyNumber_
Definition: DDHGCalWaferF.cc:43
DDHGCalWaferF::waferSepar_
double waferSepar_
Definition: DDHGCalWaferF.cc:37
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:584
DDBase::ddname
const N & ddname() const
Definition: DDBase.h:61
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
createfilelist.int
int
Definition: createfilelist.py:10
DDHGCalWaferF::thick_
double thick_
Definition: DDHGCalWaferF.cc:35
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
DDHGCalWaferF::waferSize_
double waferSize_
Definition: DDHGCalWaferF.cc:36
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDHGCalWaferF::layerNames_
std::vector< std::string > layerNames_
Definition: DDHGCalWaferF.cc:39
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DDHGCalWaferF::materials_
std::vector< std::string > materials_
Definition: DDHGCalWaferF.cc:40
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
DDHGCalWaferF::cellNames_
std::vector< std::string > cellNames_
Definition: DDHGCalWaferF.cc:47
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
DDHGCalWaferF::waferThick_
double waferThick_
Definition: DDHGCalWaferF.cc:38
DDHGCalWaferF::layerType_
std::vector< int > layerType_
Definition: DDHGCalWaferF.cc:42
DDHGCalWaferF::cellType_
int cellType_
Definition: DDHGCalWaferF.cc:46
zw
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:75
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
edm::Log
Definition: MessageLogger.h:70
dttmaxenums::R
Definition: DTTMax.h:29
class-composition.parent
parent
Definition: class-composition.py:98
DDHGCalWaferF::layers_
std::vector< int > layers_
Definition: DDHGCalWaferF.cc:44
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