CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
DDHGCalModule Class Reference

#include <DDHGCalModule.h>

Inheritance diagram for DDHGCalModule:

Public Member Functions

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

Protected Member Functions

void constructLayers (const DDLogicalPart &, DDCompactView &cpv)
 
void positionSensitive (DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
 
double rMax (double z)
 

Private Attributes

std::unordered_set< int > copies
 
std::vector< int > copyNumber
 
std::string idName
 
std::string idNameSpace
 
std::vector< int > layers
 
std::vector< int > layerSense
 
std::vector< double > layerThick
 
std::vector< int > layerType
 
std::vector< std::string > materials
 
std::vector< std::string > names
 
double rMaxFine
 
std::vector< double > rMaxFront
 
int sectors
 
std::vector< double > slopeB
 
std::vector< double > slopeT
 
std::vector< double > thick
 
std::vector< std::string > wafer
 
double waferW
 
std::vector< double > zFront
 
double zMinBlock
 

Detailed Description

Definition at line 11 of file DDHGCalModule.h.

Constructor & Destructor Documentation

DDHGCalModule::DDHGCalModule ( )

Definition at line 24 of file DDHGCalModule.cc.

24  {
25 #ifdef EDM_ML_DEBUG
26  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: Creating an instance";
27 #endif
28 }
DDHGCalModule::~DDHGCalModule ( )
override

Definition at line 30 of file DDHGCalModule.cc.

30 {}

Member Function Documentation

void DDHGCalModule::constructLayers ( const DDLogicalPart module,
DDCompactView cpv 
)
protected

Definition at line 128 of file DDHGCalModule.cc.

References alpha, geant_units::operators::convertRadToDeg(), popcon2dropbox::copy(), funct::cos(), DDBase< N, C >::ddname(), DDSplit(), plotBeamSpotDB::first, mps_fire::i, cuy::ii, gen::k, LayerTriplets::layers(), dataset::name, DDBase< N, C >::name(), names, geant_units::piRadians(), DDSolidFactory::polyhedra(), DDCompactView::position(), diffTwoXMLs::r1, hfnoseDigiStudy_cfi::rMax, makeMuonMisalignmentScenario::rot, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, DDSolidFactory::tubs(), and geometryCSVtoXML::zz.

129  {
130 #ifdef EDM_ML_DEBUG
131  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: \t\tInside Layers";
132 #endif
133  double zi(zMinBlock);
134  int laymin(0);
135  const double tol(0.01);
136  for (unsigned int i = 0; i < layers.size(); i++) {
137  double zo = zi + layerThick[i];
138  double routF = rMax(zi);
139  int laymax = laymin + layers[i];
140  double zz = zi;
141  double thickTot(0);
142  for (int ly = laymin; ly < laymax; ++ly) {
143  int ii = layerType[ly];
144  int copy = copyNumber[ii];
145  double rinB = (layerSense[ly] == 0) ? (zo * slopeB[0]) : (zo * slopeB[1]);
146  zz += (0.5 * thick[ii]);
147  thickTot += thick[ii];
148 
149  std::string name = "HGCal" + names[ii] + std::to_string(copy);
150 #ifdef EDM_ML_DEBUG
151  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: Layer " << ly << ":" << ii
152  << " Front " << zi << ", " << routF
153  << " Back " << zo << ", " << rinB
154  << " superlayer thickness " << layerThick[i];
155 #endif
156  DDName matName(DDSplit(materials[ii]).first,
157  DDSplit(materials[ii]).second);
158  DDMaterial matter(matName);
159  DDLogicalPart glog;
160  if (layerSense[ly] == 0) {
162  double rmax = routF * cos(alpha) - tol;
163  std::vector<double> pgonZ, pgonRin, pgonRout;
164  pgonZ.emplace_back(-0.5 * thick[ii]);
165  pgonZ.emplace_back(0.5 * thick[ii]);
166  pgonRin.emplace_back(rinB);
167  pgonRin.emplace_back(rinB);
168  pgonRout.emplace_back(rmax);
169  pgonRout.emplace_back(rmax);
171  sectors, -alpha,
173  pgonZ, pgonRin, pgonRout);
174  glog = DDLogicalPart(solid.ddname(), matter, solid);
175 #ifdef EDM_ML_DEBUG
176  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: " << solid.name()
177  << " polyhedra of " << sectors
178  << " sectors covering "
179  << convertRadToDeg(-alpha)
180  << ":" << (360.0+convertRadToDeg(-alpha))
181  << " with " << pgonZ.size() << " sections";
182  for (unsigned int k = 0; k < pgonZ.size(); ++k)
183  edm::LogVerbatim("HGCalGeom") << "[" << k << "] z " << pgonZ[k]
184  << " R " << pgonRin[k]
185  << ":" << pgonRout[k];
186 #endif
187  } else {
188  DDSolid solid =
189  DDSolidFactory::tubs(DDName(name, idNameSpace), 0.5 * thick[ii],
190  rinB, routF, 0.0, 2*geant_units::piRadians);
191  glog = DDLogicalPart(solid.ddname(), matter, solid);
192 #ifdef EDM_ML_DEBUG
193  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: " << solid.name()
194  << " Tubs made of " << matName
195  << " of dimensions " << rinB << ", "
196  << routF << ", " << 0.5 * thick[ii]
197  << ", 0.0, 360.0";
198  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule test position in: "
199  << glog.name() << " number " << copy;
200 #endif
201  positionSensitive(glog, rinB, routF, cpv);
202  }
203  DDTranslation r1(0, 0, zz);
204  DDRotation rot;
205  cpv.position(glog, module, copy, r1, rot);
206  ++copyNumber[ii];
207 #ifdef EDM_ML_DEBUG
208  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: " << glog.name()
209  << " number " << copy << " positioned in "
210  << module.name() << " at " << r1
211  << " with " << rot;
212 #endif
213  zz += (0.5 * thick[ii]);
214  } // End of loop over layers in a block
215  zi = zo;
216  laymin = laymax;
217  if (fabs(thickTot - layerThick[i]) < 0.00001) {
218  } else if (thickTot > layerThick[i]) {
219  edm::LogError("HGCalGeom")
220  << "Thickness of the partition " << layerThick[i]
221  << " is smaller than thickness " << thickTot
222  << " of all its components **** ERROR ****\n";
223  } else if (thickTot < layerThick[i]) {
224  edm::LogWarning("HGCalGeom")
225  << "Thickness of the partition " << layerThick[i]
226  << " does not match with " << thickTot << " of the components\n";
227  }
228  } // End of loop over blocks
229 }
float alpha
Definition: AMPTWrapper.h:95
const N & name() const
Definition: DDBase.h:74
def copy(args, dbName)
double rMax(double z)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
std::vector< int > copyNumber
Definition: DDHGCalModule.h:34
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
std::vector< int > layerSense
Definition: DDHGCalModule.h:38
constexpr long double piRadians(M_PI)
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
std::vector< int > layers
Definition: DDHGCalModule.h:35
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
U second(std::pair< T, U > const &p)
std::vector< double > slopeB
Definition: DDHGCalModule.h:43
std::vector< std::string > names
Definition: DDHGCalModule.h:32
std::vector< std::string > materials
Definition: DDHGCalModule.h:31
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:865
std::vector< int > layerType
Definition: DDHGCalModule.h:37
ii
Definition: cuy.py:590
int k[5][pyjets_maxn]
double zMinBlock
Definition: DDHGCalModule.h:39
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< double > thick
Definition: DDHGCalModule.h:33
std::vector< double > layerThick
Definition: DDHGCalModule.h:36
void positionSensitive(DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::string idNameSpace
Definition: DDHGCalModule.h:48
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:730
const N & ddname() const
Definition: DDBase.h:76
void DDHGCalModule::execute ( DDCompactView cpv)
override

Definition at line 109 of file DDHGCalModule.cc.

References gen::k, and class-composition::parent.

109  {
110 #ifdef EDM_ML_DEBUG
111  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalModule...";
112 #endif
113  copies.clear();
114  constructLayers(parent(), cpv);
115 #ifdef EDM_ML_DEBUG
116  edm::LogVerbatim("HGCalGeom") << copies.size() << " different wafer copy numbers";
117  int k(0);
118  for (std::unordered_set<int>::const_iterator itr = copies.begin();
119  itr != copies.end(); ++itr, ++k)
120  edm::LogVerbatim("HGCalGeom") << "Copy[" << k << "] : " << (*itr);
121 #endif
122  copies.clear();
123 #ifdef EDM_ML_DEBUG
124  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalModule construction ...";
125 #endif
126 }
std::unordered_set< int > copies
Definition: DDHGCalModule.h:49
int k[5][pyjets_maxn]
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
void DDHGCalModule::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 32 of file DDHGCalModule.cc.

References dbl_to_int(), mps_fire::i, createfilelist::int, LayerTriplets::layers(), names, and DDCurrentNamespace::ns().

36  {
37  wafer = vsArgs["WaferName"];
38 #ifdef EDM_ML_DEBUG
39  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: " << wafer.size() << " wafers";
40  for (unsigned int i = 0; i < wafer.size(); ++i)
41  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << wafer[i];
42 #endif
43  materials = vsArgs["MaterialNames"];
44  names = vsArgs["VolumeNames"];
45  thick = vArgs["Thickness"];
46  for (unsigned int i = 0; i < materials.size(); ++i) {
47  copyNumber.emplace_back(1);
48  }
49 #ifdef EDM_ML_DEBUG
50  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: " << materials.size()
51  << " types of volumes";
52  for (unsigned int i = 0; i < names.size(); ++i)
53  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names[i]
54  << " of thickness " << thick[i]
55  << " filled with " << materials[i]
56  << " first copy number " << copyNumber[i];
57 #endif
58  layers = dbl_to_int(vArgs["Layers"]);
59  layerThick = vArgs["LayerThick"];
60 #ifdef EDM_ML_DEBUG
61  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: " << layers.size() <<" blocks";
62  for (unsigned int i = 0; i < layers.size(); ++i)
63  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness "
64  << layerThick[i] << " with " << layers[i]
65  << " layers";
66 #endif
67  layerType = dbl_to_int(vArgs["LayerType"]);
68  layerSense = dbl_to_int(vArgs["LayerSense"]);
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: " << layerType.size()
71  << " layers";
72  for (unsigned int i = 0; i < layerType.size(); ++i)
73  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type "
74  << layerType[i] << " sensitive class "
75  << layerSense[i];
76 #endif
77  zMinBlock = nArgs["zMinBlock"];
78  rMaxFine = nArgs["rMaxFine"];
79  waferW = nArgs["waferW"];
80  sectors = (int)(nArgs["Sectors"]);
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: zStart " << zMinBlock
83  << " rFineCoarse " << rMaxFine << " wafer width "
84  << waferW << " sectors " << sectors;
85 #endif
86  slopeB = vArgs["SlopeBottom"];
87  slopeT = vArgs["SlopeTop"];
88  zFront = vArgs["ZFront"];
89  rMaxFront = vArgs["RMaxFront"];
90 #ifdef EDM_ML_DEBUG
91  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: Bottom slopes " << slopeB[0]
92  << ":" << slopeB[1] << " and " << slopeT.size()
93  << " slopes for top";
94  for (unsigned int i = 0; i < slopeT.size(); ++i)
95  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFront[i]
96  << " Rmax " << rMaxFront[i] << " Slope "
97  << slopeT[i];
98 #endif
100 #ifdef EDM_ML_DEBUG
101  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: NameSpace " << idNameSpace;
102 #endif
103 }
std::vector< int > copyNumber
Definition: DDHGCalModule.h:34
static std::string & ns()
std::vector< std::string > wafer
Definition: DDHGCalModule.h:30
std::vector< int > layerSense
Definition: DDHGCalModule.h:38
std::vector< int > layers
Definition: DDHGCalModule.h:35
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 > slopeB
Definition: DDHGCalModule.h:43
std::vector< double > slopeT
Definition: DDHGCalModule.h:44
std::vector< std::string > names
Definition: DDHGCalModule.h:32
std::vector< std::string > materials
Definition: DDHGCalModule.h:31
std::vector< double > rMaxFront
Definition: DDHGCalModule.h:46
std::vector< int > layerType
Definition: DDHGCalModule.h:37
double zMinBlock
Definition: DDHGCalModule.h:39
std::vector< double > thick
Definition: DDHGCalModule.h:33
std::vector< double > layerThick
Definition: DDHGCalModule.h:36
std::vector< double > zFront
Definition: DDHGCalModule.h:45
std::string idNameSpace
Definition: DDHGCalModule.h:48
void DDHGCalModule::positionSensitive ( DDLogicalPart glog,
double  rin,
double  rout,
DDCompactView cpv 
)
protected

Definition at line 249 of file DDHGCalModule.cc.

References popcon2dropbox::copy(), TCMET_cfi::corner, DDBase< N, C >::ddname(), DDSplit(), PVValHelper::dx, PVValHelper::dy, createfilelist::int, HGCalParameters::k_CornerSize, dataset::name, create_public_lumi_plots::ncol, nin, DDCompactView::position(), idealTransformation::rotation, findQualityFiles::rr, mathSSE::sqrt(), funct::tan(), and HGCalGeomTools::waferCorner().

250  {
251  double dx = 0.5 * waferW;
252  double dy = 3.0 * dx * tan(30._deg);
253  double rr = 2.0 * dx * tan(30._deg);
254  int ncol = (int)(2.0 * rout / waferW) + 1;
255  int nrow = (int)(rout / (waferW * tan(30._deg))) + 1;
256  int incm(0), inrm(0), kount(0), ntot(0), nin(0), nfine(0), ncoarse(0);
257 #ifdef EDM_ML_DEBUG
258  edm::LogVerbatim("HGCalGeom") << glog.ddname() << " rout " << rout << " Row "
259  << nrow << " Column " << ncol;
260 #endif
261  for (int nr = -nrow; nr <= nrow; ++nr) {
262  int inr = (nr >= 0) ? nr : -nr;
263  for (int nc = -ncol; nc <= ncol; ++nc) {
264  int inc = (nc >= 0) ? nc : -nc;
265  if (inr % 2 == inc % 2) {
266  double xpos = nc * dx;
267  double ypos = nr * dy;
268  std::pair<int, int> corner =
269  HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, rin, rout, true);
270  ++ntot;
271  if (corner.first > 0) {
272  int copy = inr * 100 + inc;
273  if (nc < 0) copy += 10000;
274  if (nr < 0) copy += 100000;
275  if (inc > incm) incm = inc;
276  if (inr > inrm) inrm = inr;
277  kount++;
278  if (copies.count(copy) == 0) copies.insert(copy);
279  if (corner.first == (int)(HGCalParameters::k_CornerSize)) {
280  double rpos = std::sqrt(xpos * xpos + ypos * ypos);
281  DDTranslation tran(xpos, ypos, 0.0);
283  ++nin;
284  DDName name =
285  (rpos < rMaxFine)
286  ? DDName(DDSplit(wafer[0]).first, DDSplit(wafer[0]).second)
287  : DDName(DDSplit(wafer[1]).first, DDSplit(wafer[1]).second);
288  cpv.position(name, glog.ddname(), copy, tran, rotation);
289  if (rpos < rMaxFine)
290  ++nfine;
291  else
292  ++ncoarse;
293 #ifdef EDM_ML_DEBUG
294  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: " << name
295  << " number " << copy
296  << " positioned in " << glog.ddname()
297  << " at " << tran << " with "
298  << rotation;
299 #endif
300  }
301  }
302  }
303  }
304  }
305 #ifdef EDM_ML_DEBUG
306  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: # of columns " << incm
307  << " # of rows " << inrm << " and " << nin << ":"
308  << kount << ":" << ntot << " wafers ("
309  << nfine << ":" << ncoarse << ") for "
310  << glog.ddname() << " R " << rin << ":" << rout;
311 #endif
312 }
def copy(args, dbName)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
std::vector< std::string > wafer
Definition: DDHGCalModule.h:30
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
int nin
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
T sqrt(T t)
Definition: SSEVec.h:18
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::unordered_set< int > copies
Definition: DDHGCalModule.h:49
static uint32_t k_CornerSize
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
const N & ddname() const
Definition: DDBase.h:76
double DDHGCalModule::rMax ( double  z)
protected

Definition at line 231 of file DDHGCalModule.cc.

References gen::k, and alignCSCRings::r.

231  {
232  double r(0);
233 #ifdef EDM_ML_DEBUG
234  unsigned int ik(0);
235 #endif
236  for (unsigned int k = 0; k < slopeT.size(); ++k) {
237  if (z < zFront[k]) break;
238  r = rMaxFront[k] + (z - zFront[k]) * slopeT[k];
239 #ifdef EDM_ML_DEBUG
240  ik = k;
241 #endif
242  }
243 #ifdef EDM_ML_DEBUG
244  edm::LogVerbatim("HGCalGeom") << "rMax : " << z << ":" << ik << ":" << r;
245 #endif
246  return r;
247 }
std::vector< double > slopeT
Definition: DDHGCalModule.h:44
std::vector< double > rMaxFront
Definition: DDHGCalModule.h:46
int k[5][pyjets_maxn]
std::vector< double > zFront
Definition: DDHGCalModule.h:45

Member Data Documentation

std::unordered_set<int> DDHGCalModule::copies
private

Definition at line 49 of file DDHGCalModule.h.

std::vector<int> DDHGCalModule::copyNumber
private

Definition at line 34 of file DDHGCalModule.h.

std::string DDHGCalModule::idName
private

Definition at line 47 of file DDHGCalModule.h.

std::string DDHGCalModule::idNameSpace
private

Definition at line 48 of file DDHGCalModule.h.

std::vector<int> DDHGCalModule::layers
private

Definition at line 35 of file DDHGCalModule.h.

std::vector<int> DDHGCalModule::layerSense
private

Definition at line 38 of file DDHGCalModule.h.

std::vector<double> DDHGCalModule::layerThick
private

Definition at line 36 of file DDHGCalModule.h.

std::vector<int> DDHGCalModule::layerType
private

Definition at line 37 of file DDHGCalModule.h.

std::vector<std::string> DDHGCalModule::materials
private

Definition at line 31 of file DDHGCalModule.h.

std::vector<std::string> DDHGCalModule::names
private

Definition at line 32 of file DDHGCalModule.h.

double DDHGCalModule::rMaxFine
private

Definition at line 40 of file DDHGCalModule.h.

std::vector<double> DDHGCalModule::rMaxFront
private

Definition at line 46 of file DDHGCalModule.h.

int DDHGCalModule::sectors
private

Definition at line 42 of file DDHGCalModule.h.

std::vector<double> DDHGCalModule::slopeB
private

Definition at line 43 of file DDHGCalModule.h.

std::vector<double> DDHGCalModule::slopeT
private

Definition at line 44 of file DDHGCalModule.h.

std::vector<double> DDHGCalModule::thick
private

Definition at line 33 of file DDHGCalModule.h.

std::vector<std::string> DDHGCalModule::wafer
private

Definition at line 30 of file DDHGCalModule.h.

double DDHGCalModule::waferW
private

Definition at line 41 of file DDHGCalModule.h.

std::vector<double> DDHGCalModule::zFront
private

Definition at line 45 of file DDHGCalModule.h.

double DDHGCalModule::zMinBlock
private

Definition at line 39 of file DDHGCalModule.h.