CMS 3D CMS Logo

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

Public Member Functions

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

Protected Member Functions

void constructLayers (const DDLogicalPart &, DDCompactView &cpv)
 
void positionMix (const DDLogicalPart &glog, const std::string &name, int copy, double thick, const DDMaterial &matter, double rin, double rmid, double routF, double zz, DDCompactView &cpv)
 
void positionSensitive (const DDLogicalPart &glog, double rin, double rout, double zpos, int layertype, int layer, DDCompactView &cpv)
 

Private Attributes

int absorbMode_
 
double alpha_
 
std::unordered_set< int > copies_
 
std::vector< int > copyNumber_
 
std::vector< int > copyNumberBot_
 
std::vector< int > copyNumberTop_
 
double cosAlpha_
 
int firstLayer_
 
HGCalGeomTools geomTools_
 
std::vector< int > layerCenter_
 
std::vector< int > layers_
 
std::vector< int > layerSense_
 
std::vector< int > layerSenseBot_
 
std::vector< double > layerThick_
 
std::vector< double > layerThickBot_
 
std::vector< double > layerThickTop_
 
std::vector< int > layerType_
 
std::vector< int > layerTypeBot_
 
std::vector< int > layerTypeTop_
 
std::vector< std::string > materials_
 
std::vector< std::string > materialsBot_
 
std::vector< std::string > materialsTop_
 
std::vector< std::string > names_
 
std::vector< std::string > namesBot_
 
std::string nameSpace_
 
std::vector< std::string > namesTop_
 
std::vector< double > rMaxFront_
 
std::vector< double > rMinFront_
 
std::vector< double > rMixLayer_
 
int sectors_
 
int sensitiveMode_
 
std::vector< double > slopeB_
 
std::vector< double > slopeT_
 
std::vector< double > thick_
 
std::vector< int > waferIndex_
 
std::vector< int > waferProperty_
 
std::vector< std::string > wafers_
 
double waferSepar_
 
double waferSize_
 
std::vector< double > zFrontB_
 
std::vector< double > zFrontT_
 
double zMinBlock_
 

Static Private Attributes

static constexpr double tol1_ = 0.01
 
static constexpr double tol2_ = 0.00001
 

Detailed Description

Definition at line 34 of file DDHGCalHEFileAlgo.cc.

Constructor & Destructor Documentation

◆ DDHGCalHEFileAlgo()

DDHGCalHEFileAlgo::DDHGCalHEFileAlgo ( )

Definition at line 109 of file DDHGCalHEFileAlgo.cc.

109  {
110 #ifdef EDM_ML_DEBUG
111  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Creating an instance";
112 #endif
113 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ constructLayers()

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

Definition at line 276 of file DDHGCalHEFileAlgo.cc.

References funct::abs(), angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), dqmdumpme::first, mps_fire::i, cuy::ii, l1ctLayer1_patternWriters_cff::isec, dqmdumpme::k, SiStripPI::min, Skims_PA_cff::name, DDBase< N, C >::name(), DDSolidFactory::polyhedra(), DDCompactView::position(), HGCalGeomTools::radius(), makeMuonMisalignmentScenario::rot, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, to_string(), DDSolidFactory::tubs(), and geometryCSVtoXML::zz.

276  {
277  double zi(zMinBlock_);
278  int laymin(0);
279  for (unsigned int i = 0; i < layers_.size(); i++) {
280  double zo = zi + layerThick_[i];
281  double routF = HGCalGeomTools::radius(zi, zFrontT_, rMaxFront_, slopeT_);
282  int laymax = laymin + layers_[i];
283  double zz = zi;
284  double thickTot(0);
285  for (int ly = laymin; ly < laymax; ++ly) {
286  int ii = layerType_[ly];
287  int copy = copyNumber_[ii];
288  double hthick = 0.5 * thick_[ii];
289  double rinB = HGCalGeomTools::radius(zo, zFrontB_, rMinFront_, slopeB_);
290  zz += hthick;
291  thickTot += thick_[ii];
292 
294 #ifdef EDM_ML_DEBUG
295  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Layer " << ly << ":" << ii << " Front " << zi << ", "
296  << routF << " Back " << zo << ", " << rinB << " superlayer thickness "
297  << layerThick_[i];
298 #endif
300  DDMaterial matter(matName);
301  DDLogicalPart glog;
302  if (layerSense_[ly] < 1) {
303  std::vector<double> pgonZ, pgonRin, pgonRout;
304  double rmax =
306  HGCalGeomTools::radius(zz - hthick,
307  zz + hthick,
308  zFrontB_,
309  rMinFront_,
310  slopeB_,
311  zFrontT_,
312  rMaxFront_,
313  slopeT_,
314  -layerSense_[ly],
315  pgonZ,
316  pgonRin,
317  pgonRout);
318  for (unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
319  pgonZ[isec] -= zz;
320  if (layerSense_[ly] == 0 || absorbMode_ == 0)
321  pgonRout[isec] = rmax;
322  else
323  pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol1_;
324  }
325  DDSolid solid =
326  DDSolidFactory::polyhedra(DDName(name, nameSpace_), sectors_, -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
327  glog = DDLogicalPart(solid.ddname(), matter, solid);
328 #ifdef EDM_ML_DEBUG
329  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " polyhedra of " << sectors_
330  << " sectors covering " << convertRadToDeg(-alpha_) << ":"
331  << convertRadToDeg(-alpha_ + 2._pi) << " with " << pgonZ.size() << " sections";
332  for (unsigned int k = 0; k < pgonZ.size(); ++k)
333  edm::LogVerbatim("HGCalGeom") << "[" << k << "] z " << pgonZ[k] << " R " << pgonRin[k] << ":" << pgonRout[k];
334 #endif
335  } else {
336  double rins = (sensitiveMode_ < 1) ? rinB : HGCalGeomTools::radius(zz + hthick, zFrontB_, rMinFront_, slopeB_);
337  double routs =
338  (sensitiveMode_ < 1) ? routF : HGCalGeomTools::radius(zz - hthick, zFrontT_, rMaxFront_, slopeT_);
339  DDSolid solid = DDSolidFactory::tubs(DDName(name, nameSpace_), hthick, rins, routs, 0.0, 2._pi);
340  glog = DDLogicalPart(solid.ddname(), matter, solid);
341 #ifdef EDM_ML_DEBUG
342  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matName
343  << " of dimensions " << rinB << ":" << rins << ", " << routF << ":" << routs
344  << ", " << hthick << ", 0.0, 360.0 and positioned in: " << glog.name()
345  << " number " << copy;
346 #endif
347  positionMix(glog, name, copy, thick_[ii], matter, rins, rMixLayer_[i], routs, zz, cpv);
348  }
349  DDTranslation r1(0, 0, zz);
350  DDRotation rot;
351  cpv.position(glog, module, copy, r1, rot);
352  ++copyNumber_[ii];
353 #ifdef EDM_ML_DEBUG
354  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog.name() << " number " << copy << " positioned in "
355  << module.name() << " at " << r1 << " with no rotation";
356 #endif
357  zz += hthick;
358  } // End of loop over layers in a block
359  zi = zo;
360  laymin = laymax;
361  // Make consistency check of all the partitions of the block
362  if (std::abs(thickTot - layerThick_[i]) >= tol2_) {
363  if (thickTot > layerThick_[i]) {
364  edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " is smaller than " << thickTot
365  << ": thickness of all its components **** ERROR ****";
366  } else {
367  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " does not match with "
368  << thickTot << " of the components";
369  }
370  }
371  } // End of loop over blocks
372 }
Log< level::Info, true > LogVerbatim
std::vector< int > layerSense_
std::vector< int > copyNumber_
std::vector< double > rMaxFront_
static void radius(double zf, double zb, std::vector< double > const &zFront1, std::vector< double > const &rFront1, std::vector< double > const &slope1, std::vector< double > const &zFront2, std::vector< double > const &rFront2, std::vector< double > const &slope2, int flag, std::vector< double > &zz, std::vector< double > &rin, std::vector< double > &rout)
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
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< double > slopeT_
std::vector< int > layers_
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
static std::string to_string(const XMLCh *ch)
std::vector< double > rMinFront_
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
std::vector< double > thick_
std::vector< double > zFrontB_
Abs< T >::type abs(const T &t)
Definition: Abs.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:667
std::vector< int > layerType_
ii
Definition: cuy.py:589
const N & name() const
Definition: DDBase.h:59
std::vector< double > zFrontT_
const N & ddname() const
Definition: DDBase.h:61
static constexpr double tol2_
std::vector< double > slopeB_
std::vector< std::string > names_
static constexpr double tol1_
Log< level::Warning, false > LogWarning
void positionMix(const DDLogicalPart &glog, const std::string &name, int copy, double thick, const DDMaterial &matter, double rin, double rmid, double routF, double zz, DDCompactView &cpv)
std::vector< double > layerThick_
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
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:565
std::vector< std::string > materials_
std::vector< double > rMixLayer_

◆ execute()

void DDHGCalHEFileAlgo::execute ( DDCompactView cpv)
override

Definition at line 259 of file DDHGCalHEFileAlgo.cc.

References DDHGCalGeom::constructLayers(), dqmdumpme::k, and class-composition::parent.

259  {
260 #ifdef EDM_ML_DEBUG
261  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalHEFileAlgo...";
262  copies_.clear();
263 #endif
264  constructLayers(parent(), cpv);
265 #ifdef EDM_ML_DEBUG
266  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << copies_.size() << " different wafer copy numbers";
267  int k(0);
268  for (std::unordered_set<int>::const_iterator itr = copies_.begin(); itr != copies_.end(); ++itr, ++k) {
269  edm::LogVerbatim("HGCalGeom") << "Copy [" << k << "] : " << (*itr);
270  }
271  copies_.clear();
272  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalHEFileAlgo construction...";
273 #endif
274 }
Log< level::Info, true > LogVerbatim
std::unordered_set< int > copies_
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)

◆ initialize()

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

Definition at line 115 of file DDHGCalHEFileAlgo.cc.

References angle_units::operators::convertRadToDeg(), funct::cos(), dbl_to_int(), mps_fire::i, cuy::ii, createfilelist::int, dqmdumpme::k, DDCurrentNamespace::ns(), HGCalWaferIndex::waferLayer(), HGCalProperty::waferOrient(), HGCalProperty::waferPartial(), HGCalProperty::waferThick(), HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

119  {
120  wafers_ = vsArgs["WaferNames"];
121 #ifdef EDM_ML_DEBUG
122  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << wafers_.size() << " wafers";
123  for (unsigned int i = 0; i < wafers_.size(); ++i)
124  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << wafers_[i];
125 #endif
126  materials_ = vsArgs["MaterialNames"];
127  names_ = vsArgs["VolumeNames"];
128  thick_ = vArgs["Thickness"];
129  copyNumber_.resize(materials_.size(), 1);
130 #ifdef EDM_ML_DEBUG
131  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << materials_.size() << " types of volumes";
132  for (unsigned int i = 0; i < names_.size(); ++i)
133  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names_[i] << " of thickness " << thick_[i]
134  << " filled with " << materials_[i] << " first copy number " << copyNumber_[i];
135 #endif
136  layers_ = dbl_to_int(vArgs["Layers"]);
137  layerThick_ = vArgs["LayerThick"];
138  rMixLayer_ = vArgs["LayerRmix"];
139 #ifdef EDM_ML_DEBUG
140  edm::LogVerbatim("HGCalGeom") << "There are " << layers_.size() << " blocks";
141  for (unsigned int i = 0; i < layers_.size(); ++i)
142  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << layerThick_[i] << " Rmid " << rMixLayer_[i]
143  << " with " << layers_[i] << " layers";
144 #endif
145  layerType_ = dbl_to_int(vArgs["LayerType"]);
146  layerSense_ = dbl_to_int(vArgs["LayerSense"]);
147  firstLayer_ = (int)(nArgs["FirstLayer"]);
148  absorbMode_ = (int)(nArgs["AbsorberMode"]);
149  sensitiveMode_ = (int)(nArgs["SensitiveMode"]);
150 #ifdef EDM_ML_DEBUG
151  edm::LogVerbatim("HGCalGeom") << "First Layer " << firstLayer_ << " and "
152  << "Absober:Sensitive mode " << absorbMode_ << ":" << sensitiveMode_;
153 #endif
154  layerCenter_ = dbl_to_int(vArgs["LayerCenter"]);
155 #ifdef EDM_ML_DEBUG
156  for (unsigned int i = 0; i < layerCenter_.size(); ++i)
157  edm::LogVerbatim("HGCalGeom") << "LayerCenter [" << i << "] " << layerCenter_[i];
158 #endif
159  if (firstLayer_ > 0) {
160  for (unsigned int i = 0; i < layerType_.size(); ++i) {
161  if (layerSense_[i] > 0) {
162  int ii = layerType_[i];
164 #ifdef EDM_ML_DEBUG
165  edm::LogVerbatim("HGCalGeom") << "First copy number for layer type " << i << ":" << ii << " with "
166  << materials_[ii] << " changed to " << copyNumber_[ii];
167 #endif
168  break;
169  }
170  }
171  } else {
172  firstLayer_ = 1;
173  }
174 #ifdef EDM_ML_DEBUG
175  edm::LogVerbatim("HGCalGeom") << "There are " << layerType_.size() << " layers";
176  for (unsigned int i = 0; i < layerType_.size(); ++i)
177  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType_[i] << " sensitive class "
178  << layerSense_[i];
179 #endif
180  materialsTop_ = vsArgs["TopMaterialNames"];
181  namesTop_ = vsArgs["TopVolumeNames"];
182  layerThickTop_ = vArgs["TopLayerThickness"];
183  layerTypeTop_ = dbl_to_int(vArgs["TopLayerType"]);
184  copyNumberTop_.resize(materialsTop_.size(), 1);
185 #ifdef EDM_ML_DEBUG
186  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << materialsTop_.size() << " types of volumes in the top part";
187  for (unsigned int i = 0; i < materialsTop_.size(); ++i)
188  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesTop_[i] << " of thickness " << layerThickTop_[i]
189  << " filled with " << materialsTop_[i] << " first copy number " << copyNumberTop_[i];
190  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeTop_.size() << " layers in the top part";
191  for (unsigned int i = 0; i < layerTypeTop_.size(); ++i)
192  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerTypeTop_[i];
193 #endif
194  materialsBot_ = vsArgs["BottomMaterialNames"];
195  namesBot_ = vsArgs["BottomVolumeNames"];
196  layerTypeBot_ = dbl_to_int(vArgs["BottomLayerType"]);
197  layerSenseBot_ = dbl_to_int(vArgs["BottomLayerSense"]);
198  layerThickBot_ = vArgs["BottomLayerThickness"];
199  copyNumberBot_.resize(materialsBot_.size(), 1);
200 #ifdef EDM_ML_DEBUG
201  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << materialsBot_.size()
202  << " types of volumes in the bottom part";
203  for (unsigned int i = 0; i < materialsBot_.size(); ++i)
204  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesBot_[i] << " of thickness " << layerThickBot_[i]
205  << " filled with " << materialsBot_[i] << " first copy number " << copyNumberBot_[i];
206  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeBot_.size() << " layers in the bottom part";
207  for (unsigned int i = 0; i < layerTypeBot_.size(); ++i)
208  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerTypeBot_[i]
209  << " sensitive class " << layerSenseBot_[i];
210 #endif
211  zMinBlock_ = nArgs["zMinBlock"];
212  waferSize_ = nArgs["waferSize"];
213  waferSepar_ = nArgs["SensorSeparation"];
214  sectors_ = (int)(nArgs["Sectors"]);
215  alpha_ = (1._pi) / sectors_;
216  cosAlpha_ = cos(alpha_);
217 #ifdef EDM_ML_DEBUG
218  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: zStart " << zMinBlock_ << " wafer width " << waferSize_
219  << " separations " << waferSepar_ << " sectors " << sectors_ << ":"
220  << convertRadToDeg(alpha_) << ":" << cosAlpha_;
221 #endif
222  waferIndex_ = dbl_to_int(vArgs["WaferIndex"]);
223  waferProperty_ = dbl_to_int(vArgs["WaferProperties"]);
224 #ifdef EDM_ML_DEBUG
225  edm::LogVerbatim("HGCalGeom") << "waferProperties with " << waferIndex_.size() << " entries";
226  for (unsigned int k = 0; k < waferIndex_.size(); ++k)
227  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << waferIndex_[k] << " ("
230  << HGCalWaferIndex::waferV(waferIndex_[k]) << ") : ("
234 #endif
235  slopeB_ = vArgs["SlopeBottom"];
236  zFrontB_ = vArgs["ZFrontBottom"];
237  rMinFront_ = vArgs["RMinFront"];
238  slopeT_ = vArgs["SlopeTop"];
239  zFrontT_ = vArgs["ZFrontTop"];
240  rMaxFront_ = vArgs["RMaxFront"];
241 #ifdef EDM_ML_DEBUG
242  for (unsigned int i = 0; i < slopeB_.size(); ++i)
243  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFrontB_[i] << " Rmin " << rMinFront_[i]
244  << " Slope " << slopeB_[i];
245  for (unsigned int i = 0; i < slopeT_.size(); ++i)
246  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFrontT_[i] << " Rmax " << rMaxFront_[i]
247  << " Slope " << slopeT_[i];
248 #endif
250 #ifdef EDM_ML_DEBUG
251  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: NameSpace " << nameSpace_ << ":";
252 #endif
253 }
Log< level::Info, true > LogVerbatim
std::vector< int > layerSense_
std::vector< int > copyNumber_
std::vector< double > rMaxFront_
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< double > slopeT_
std::vector< std::string > wafers_
std::vector< int > layers_
std::vector< std::string > materialsTop_
std::vector< int > layerTypeTop_
static std::string & ns()
int32_t waferOrient(const int32_t property)
std::vector< double > rMinFront_
std::vector< double > thick_
std::vector< double > zFrontB_
std::vector< std::string > namesTop_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int32_t waferThick(const int32_t property)
std::vector< double > layerThickTop_
std::vector< int > layerType_
ii
Definition: cuy.py:589
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< int > layerTypeBot_
std::vector< double > zFrontT_
std::vector< std::string > materialsBot_
std::vector< int > copyNumberTop_
std::vector< int > copyNumberBot_
std::vector< int > layerCenter_
int32_t waferPartial(const int32_t property)
std::vector< int > layerSenseBot_
int32_t waferV(const int32_t index)
std::vector< int > waferIndex_
std::vector< double > slopeB_
std::vector< std::string > names_
std::vector< int > waferProperty_
std::vector< double > layerThick_
std::vector< std::string > namesBot_
std::vector< double > layerThickBot_
std::vector< std::string > materials_
std::vector< double > rMixLayer_

◆ positionMix()

void DDHGCalHEFileAlgo::positionMix ( const DDLogicalPart glog,
const std::string &  name,
int  copy,
double  thick,
const DDMaterial matter,
double  rin,
double  rmid,
double  routF,
double  zz,
DDCompactView cpv 
)
protected

Definition at line 374 of file DDHGCalHEFileAlgo.cc.

References funct::abs(), filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), HLT_2024v11_cff::eta1, HLT_2024v11_cff::eta2, dqmdumpme::first, cuy::ii, dqm-mbProfile::log, Skims_PA_cff::name, DDBase< N, C >::name(), DDCompactView::position(), makeMuonMisalignmentScenario::rot, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), to_string(), DDSolidFactory::tubs(), and geometryCSVtoXML::zz.

383  {
384  DDLogicalPart glog1;
385  DDTranslation tran;
386  DDRotation rot;
387  for (unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
388  int ii = layerTypeTop_[ly];
389  copyNumberTop_[ii] = copyM;
390  }
391  for (unsigned int ly = 0; ly < layerTypeBot_.size(); ++ly) {
392  int ii = layerTypeBot_[ly];
393  copyNumberBot_[ii] = copyM;
394  }
395  double hthick = 0.5 * thick;
396  // Make the top part first
397  std::string name = nameM + "Top";
398  DDSolid solid = DDSolidFactory::tubs(DDName(name, nameSpace_), hthick, rmid, rout, 0.0, 2._pi);
399  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
400 #ifdef EDM_ML_DEBUG
401  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matter.name()
402  << " of dimensions " << rmid << ", " << rout << ", " << hthick << ", 0.0, 360.0";
403 #endif
404  cpv.position(glog1, glog, 1, tran, rot);
405 #ifdef EDM_ML_DEBUG
406  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog1.name() << " number 1 positioned in " << glog.name()
407  << " at " << tran << " with no rotation";
408 #endif
409  double thickTot(0), zpos(-hthick);
410  for (unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
411  int ii = layerTypeTop_[ly];
412  int copy = copyNumberTop_[ii];
413  double hthickl = 0.5 * layerThickTop_[ii];
414  thickTot += layerThickTop_[ii];
416 #ifdef EDM_ML_DEBUG
417  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Layer " << ly << ":" << ii << " R " << rmid << ":" << rout
418  << " Thick " << layerThickTop_[ii];
419 #endif
421  DDMaterial matter1(matName);
422  solid = DDSolidFactory::tubs(DDName(name, nameSpace_), hthickl, rmid, rout, 0.0, 2._pi);
423  DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid);
424 #ifdef EDM_ML_DEBUG
425  double eta1 = -log(tan(0.5 * atan(rmid / zz)));
426  double eta2 = -log(tan(0.5 * atan(rout / zz)));
427  edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":" << rmid << ":" << rout << " eta " << eta1
428  << ":" << eta2;
429  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matName
430  << " of dimensions " << rmid << ", " << rout << ", " << hthickl << ", 0.0, 360.0";
431 #endif
432  zpos += hthickl;
433  DDTranslation r1(0, 0, zpos);
434  cpv.position(glog2, glog1, copy, r1, rot);
435 #ifdef EDM_ML_DEBUG
436  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Position " << glog2.name() << " number " << copy << " in "
437  << glog1.name() << " at " << r1 << " with no rotation";
438 #endif
439  ++copyNumberTop_[ii];
440  zpos += hthickl;
441  }
442  if (std::abs(thickTot - thick) >= tol2_) {
443  if (thickTot > thick) {
444  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick << " is smaller than " << thickTot
445  << ": thickness of all its components in the top part **** ERROR ****";
446  } else {
447  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick << " does not match with " << thickTot
448  << " of the components in top part";
449  }
450  }
451 
452  // Make the bottom part next
453  name = nameM + "Bottom";
454  solid = DDSolidFactory::tubs(DDName(name, nameSpace_), hthick, rin, rmid, 0.0, 2._pi);
455  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
456 #ifdef EDM_ML_DEBUG
457  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matter.name()
458  << " of dimensions " << rin << ", " << rmid << ", " << hthick << ", 0.0, 360.0";
459 #endif
460  cpv.position(glog1, glog, 1, tran, rot);
461 #ifdef EDM_ML_DEBUG
462  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog1.name() << " number 1 positioned in " << glog.name()
463  << " at " << tran << " with no rotation";
464 #endif
465  thickTot = 0;
466  zpos = -hthick;
467  for (unsigned int ly = 0; ly < layerTypeBot_.size(); ++ly) {
468  int ii = layerTypeBot_[ly];
469  int copy = copyNumberBot_[ii];
470  double hthickl = 0.5 * layerThickBot_[ii];
471  thickTot += layerThickBot_[ii];
473 #ifdef EDM_ML_DEBUG
474  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Layer " << ly << ":" << ii << " R " << rin << ":" << rmid
475  << " Thick " << layerThickBot_[ii];
476 #endif
478  DDMaterial matter1(matName);
479  solid = DDSolidFactory::tubs(DDName(name, nameSpace_), hthickl, rin, rmid, 0.0, 2._pi);
480  DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid);
481 #ifdef EDM_ML_DEBUG
482  double eta1 = -log(tan(0.5 * atan(rin / zz)));
483  double eta2 = -log(tan(0.5 * atan(rmid / zz)));
484  edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":" << rin << ":" << rmid << " eta " << eta1 << ":"
485  << eta2;
486  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matName
487  << " of dimensions " << rin << ", " << rmid << ", " << hthickl << ", 0.0, 360.0";
488 #endif
489  zpos += hthickl;
490  DDTranslation r1(0, 0, zpos);
491  cpv.position(glog2, glog1, copy, r1, rot);
492 #ifdef EDM_ML_DEBUG
493  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Position " << glog2.name() << " number " << copy << " in "
494  << glog1.name() << " at " << r1 << " with no rotation";
495 #endif
496  if (layerSenseBot_[ly] != 0) {
497 #ifdef EDM_ML_DEBUG
498  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: z " << (zz + zpos) << " Center " << copy << ":"
499  << (copy - firstLayer_) << ":" << layerCenter_[copy - firstLayer_];
500 #endif
501  positionSensitive(glog2, rin, rmid, zz + zpos, layerSenseBot_[ly], (copy - firstLayer_), cpv);
502  }
503  zpos += hthickl;
504  ++copyNumberBot_[ii];
505  }
506  if (std::abs(thickTot - thick) >= tol2_) {
507  if (thickTot > thick) {
508  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick << " is smaller than " << thickTot
509  << ": thickness of all its components in the top part **** ERROR ****";
510  } else {
511  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick << " does not match with " << thickTot
512  << " of the components in top part";
513  }
514  }
515 }
Log< level::Info, true > LogVerbatim
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
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::vector< std::string > materialsTop_
std::vector< int > layerTypeTop_
Log< level::Error, false > LogError
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
static std::string to_string(const XMLCh *ch)
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
std::vector< std::string > namesTop_
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.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:667
std::vector< double > layerThickTop_
ii
Definition: cuy.py:589
std::vector< int > layerTypeBot_
const N & name() const
Definition: DDBase.h:59
std::vector< std::string > materialsBot_
std::vector< int > copyNumberTop_
void positionSensitive(const DDLogicalPart &glog, double rin, double rout, double zpos, int layertype, int layer, DDCompactView &cpv)
const N & ddname() const
Definition: DDBase.h:61
std::vector< int > copyNumberBot_
std::vector< int > layerCenter_
std::vector< int > layerSenseBot_
static constexpr double tol2_
Log< level::Warning, false > LogWarning
std::vector< std::string > namesBot_
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::vector< double > layerThickBot_

◆ positionSensitive()

void DDHGCalHEFileAlgo::positionSensitive ( const DDLogicalPart glog,
double  rin,
double  rout,
double  zpos,
int  layertype,
int  layer,
DDCompactView cpv 
)
protected

Definition at line 517 of file DDHGCalHEFileAlgo.cc.

References funct::abs(), filterCSVwithJSON::copy, TCMET_cfi::corner, DDBase< N, C >::ddname(), DDSplit(), PVValHelper::dy, dqmdumpme::first, HGCalWaferType::getType(), createfilelist::int, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::iv, HGCalParameters::k_CornerSize, N, Skims_PA_cff::name, EgHLTOffHistBins_cfi::nr, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::ntot, HGCalTypes::packTypeUV(), DDCompactView::position(), dttmaxenums::R, idealTransformation::rotation, edm::second(), mathSSE::sqrt(), findQualityFiles::v, HGCalGeomTools::waferCorner(), and HGCalWaferIndex::waferIndex().

518  {
519  static const double sqrt3 = std::sqrt(3.0);
520  int layercenter = layerCenter_[layer];
521  double r = 0.5 * (waferSize_ + waferSepar_);
522  double R = 2.0 * r / sqrt3;
523  double dy = 0.75 * R;
524  int N = (int)(0.5 * rout / r) + 2;
525  const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
526 #ifdef EDM_ML_DEBUG
527  int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0), nin(0);
528  std::vector<int> ntype(6, 0);
529  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog.ddname() << " rin:rout " << rin << ":" << rout
530  << " zpos " << zpos << " N " << N << " for maximum u, v Offset; Shift " << xyoff.first
531  << ":" << xyoff.second << " WaferSize " << (waferSize_ + waferSepar_);
532 #endif
533  for (int u = -N; u <= N; ++u) {
534  for (int v = -N; v <= N; ++v) {
535 #ifdef EDM_ML_DEBUG
536  int iu = std::abs(u);
537  int iv = std::abs(v);
538 #endif
539  int nr = 2 * v;
540  int nc = -2 * u + v;
541  double xpos = xyoff.first + nc * r;
542  double ypos = xyoff.second + nr * dy;
543  const auto& corner = HGCalGeomTools::waferCorner(xpos, ypos, r, R, rin, rout, false);
544 #ifdef EDM_ML_DEBUG
545  ++ntot;
546 #endif
547  int indx = HGCalWaferIndex::waferIndex((layer + firstLayer_), u, v, false);
549  if (corner.first > 0 && type >= 0) {
550  int copy = HGCalTypes::packTypeUV(type, u, v);
551  if (layertype > 1)
552  type += 3;
553 #ifdef EDM_ML_DEBUG
554  edm::LogVerbatim("HGCalGeom") << " DDHGCalHEFileAlgo: " << wafers_[type] << " number " << copy << " type "
555  << type << " layer:u:v:indx " << (layer + firstLayer_) << ":" << u << ":" << v
556  << ":" << indx;
557  if (iu > ium)
558  ium = iu;
559  if (iv > ivm)
560  ivm = iv;
561  kount++;
562  if (copies_.count(copy) == 0)
563  copies_.insert(copy);
564 #endif
565  if (corner.first == (int)(HGCalParameters::k_CornerSize)) {
566 #ifdef EDM_ML_DEBUG
567  if (iu > iumAll)
568  iumAll = iu;
569  if (iv > ivmAll)
570  ivmAll = iv;
571  ++nin;
572 #endif
573  DDTranslation tran(xpos, ypos, 0.0);
576  cpv.position(name, glog.ddname(), copy, tran, rotation);
577 #ifdef EDM_ML_DEBUG
578  ++ntype[type];
579  edm::LogVerbatim("HGCalGeom") << " DDHGCalHEFileAlgo: " << name << " number " << copy << " type " << layertype
580  << ":" << type << " positioned in " << glog.ddname() << " at " << tran
581  << " with no rotation";
582 #endif
583  }
584  }
585  }
586  }
587 #ifdef EDM_ML_DEBUG
588  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Maximum # of u " << ium << ":" << iumAll << " # of v " << ivm
589  << ":" << ivmAll << " and " << nin << ":" << kount << ":" << ntot << " wafers ("
590  << ntype[0] << ":" << ntype[1] << ":" << ntype[2] << ":" << ntype[3] << ":" << ntype[4]
591  << ":" << ntype[5] << ") for " << glog.ddname() << " R " << rin << ":" << rout;
592 #endif
593 }
Log< level::Info, true > LogVerbatim
static int getType(int index, const HGCalParameters::waferInfo_map &wafers)
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 > wafers_
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
HGCalGeomTools geomTools_
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
static constexpr uint32_t k_CornerSize
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
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:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::unordered_set< int > copies_
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
#define N
Definition: blowfish.cc:9
const N & ddname() const
Definition: DDBase.h:61
std::vector< int > layerCenter_
std::vector< int > waferIndex_
static int32_t packTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:3
std::vector< int > waferProperty_
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

Member Data Documentation

◆ absorbMode_

int DDHGCalHEFileAlgo::absorbMode_
private

Definition at line 77 of file DDHGCalHEFileAlgo.cc.

◆ alpha_

double DDHGCalHEFileAlgo::alpha_
private

Definition at line 106 of file DDHGCalHEFileAlgo.cc.

◆ copies_

std::unordered_set<int> DDHGCalHEFileAlgo::copies_
private

Definition at line 105 of file DDHGCalHEFileAlgo.cc.

◆ copyNumber_

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

Definition at line 70 of file DDHGCalHEFileAlgo.cc.

◆ copyNumberBot_

std::vector<int> DDHGCalHEFileAlgo::copyNumberBot_
private

Definition at line 88 of file DDHGCalHEFileAlgo.cc.

◆ copyNumberTop_

std::vector<int> DDHGCalHEFileAlgo::copyNumberTop_
private

Definition at line 83 of file DDHGCalHEFileAlgo.cc.

◆ cosAlpha_

double DDHGCalHEFileAlgo::cosAlpha_
private

Definition at line 106 of file DDHGCalHEFileAlgo.cc.

◆ firstLayer_

int DDHGCalHEFileAlgo::firstLayer_
private

Definition at line 76 of file DDHGCalHEFileAlgo.cc.

◆ geomTools_

HGCalGeomTools DDHGCalHEFileAlgo::geomTools_
private

Definition at line 61 of file DDHGCalHEFileAlgo.cc.

◆ layerCenter_

std::vector<int> DDHGCalHEFileAlgo::layerCenter_
private

Definition at line 90 of file DDHGCalHEFileAlgo.cc.

◆ layers_

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

Definition at line 71 of file DDHGCalHEFileAlgo.cc.

◆ layerSense_

std::vector<int> DDHGCalHEFileAlgo::layerSense_
private

Definition at line 75 of file DDHGCalHEFileAlgo.cc.

◆ layerSenseBot_

std::vector<int> DDHGCalHEFileAlgo::layerSenseBot_
private

Definition at line 89 of file DDHGCalHEFileAlgo.cc.

◆ layerThick_

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

Definition at line 72 of file DDHGCalHEFileAlgo.cc.

◆ layerThickBot_

std::vector<double> DDHGCalHEFileAlgo::layerThickBot_
private

Definition at line 86 of file DDHGCalHEFileAlgo.cc.

◆ layerThickTop_

std::vector<double> DDHGCalHEFileAlgo::layerThickTop_
private

Definition at line 81 of file DDHGCalHEFileAlgo.cc.

◆ layerType_

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

Definition at line 74 of file DDHGCalHEFileAlgo.cc.

◆ layerTypeBot_

std::vector<int> DDHGCalHEFileAlgo::layerTypeBot_
private

Definition at line 87 of file DDHGCalHEFileAlgo.cc.

◆ layerTypeTop_

std::vector<int> DDHGCalHEFileAlgo::layerTypeTop_
private

Definition at line 82 of file DDHGCalHEFileAlgo.cc.

◆ materials_

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

Definition at line 67 of file DDHGCalHEFileAlgo.cc.

◆ materialsBot_

std::vector<std::string> DDHGCalHEFileAlgo::materialsBot_
private

Definition at line 84 of file DDHGCalHEFileAlgo.cc.

◆ materialsTop_

std::vector<std::string> DDHGCalHEFileAlgo::materialsTop_
private

Definition at line 79 of file DDHGCalHEFileAlgo.cc.

◆ names_

std::vector<std::string> DDHGCalHEFileAlgo::names_
private

Definition at line 68 of file DDHGCalHEFileAlgo.cc.

◆ namesBot_

std::vector<std::string> DDHGCalHEFileAlgo::namesBot_
private

Definition at line 85 of file DDHGCalHEFileAlgo.cc.

◆ nameSpace_

std::string DDHGCalHEFileAlgo::nameSpace_
private

Definition at line 104 of file DDHGCalHEFileAlgo.cc.

◆ namesTop_

std::vector<std::string> DDHGCalHEFileAlgo::namesTop_
private

Definition at line 80 of file DDHGCalHEFileAlgo.cc.

◆ rMaxFront_

std::vector<double> DDHGCalHEFileAlgo::rMaxFront_
private

Definition at line 103 of file DDHGCalHEFileAlgo.cc.

◆ rMinFront_

std::vector<double> DDHGCalHEFileAlgo::rMinFront_
private

Definition at line 100 of file DDHGCalHEFileAlgo.cc.

◆ rMixLayer_

std::vector<double> DDHGCalHEFileAlgo::rMixLayer_
private

Definition at line 73 of file DDHGCalHEFileAlgo.cc.

◆ sectors_

int DDHGCalHEFileAlgo::sectors_
private

Definition at line 97 of file DDHGCalHEFileAlgo.cc.

◆ sensitiveMode_

int DDHGCalHEFileAlgo::sensitiveMode_
private

Definition at line 78 of file DDHGCalHEFileAlgo.cc.

◆ slopeB_

std::vector<double> DDHGCalHEFileAlgo::slopeB_
private

Definition at line 98 of file DDHGCalHEFileAlgo.cc.

◆ slopeT_

std::vector<double> DDHGCalHEFileAlgo::slopeT_
private

Definition at line 101 of file DDHGCalHEFileAlgo.cc.

◆ thick_

std::vector<double> DDHGCalHEFileAlgo::thick_
private

Definition at line 69 of file DDHGCalHEFileAlgo.cc.

◆ tol1_

constexpr double DDHGCalHEFileAlgo::tol1_ = 0.01
staticprivate

Definition at line 63 of file DDHGCalHEFileAlgo.cc.

◆ tol2_

constexpr double DDHGCalHEFileAlgo::tol2_ = 0.00001
staticprivate

Definition at line 64 of file DDHGCalHEFileAlgo.cc.

◆ waferIndex_

std::vector<int> DDHGCalHEFileAlgo::waferIndex_
private

Definition at line 93 of file DDHGCalHEFileAlgo.cc.

◆ waferProperty_

std::vector<int> DDHGCalHEFileAlgo::waferProperty_
private

Definition at line 94 of file DDHGCalHEFileAlgo.cc.

◆ wafers_

std::vector<std::string> DDHGCalHEFileAlgo::wafers_
private

Definition at line 66 of file DDHGCalHEFileAlgo.cc.

◆ waferSepar_

double DDHGCalHEFileAlgo::waferSepar_
private

Definition at line 96 of file DDHGCalHEFileAlgo.cc.

◆ waferSize_

double DDHGCalHEFileAlgo::waferSize_
private

Definition at line 95 of file DDHGCalHEFileAlgo.cc.

◆ zFrontB_

std::vector<double> DDHGCalHEFileAlgo::zFrontB_
private

Definition at line 99 of file DDHGCalHEFileAlgo.cc.

◆ zFrontT_

std::vector<double> DDHGCalHEFileAlgo::zFrontT_
private

Definition at line 102 of file DDHGCalHEFileAlgo.cc.

◆ zMinBlock_

double DDHGCalHEFileAlgo::zMinBlock_
private

Definition at line 92 of file DDHGCalHEFileAlgo.cc.