CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
HGCalHEFileAlgo Struct Reference

Public Member Functions

 HGCalHEFileAlgo ()
 
 HGCalHEFileAlgo (cms::DDParsingContext &ctxt, xml_h e)
 
void positionMix (cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, const std::string &nameM, int copyM, double thick, const dd4hep::Material &matter, double rin, double rmid, double rout, double zz)
 
void positionSensitive (cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, double rin, double rout, double zpos, int layertype, int layer)
 

Public 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 > layerNumbers_
 
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 > namesBot_
 
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 > thickness_
 
std::vector< std::string > volumeNames_
 
std::vector< int > waferIndex_
 
std::vector< std::string > waferNames_
 
std::vector< int > waferProperty_
 
double waferSepar_
 
double waferSize_
 
std::vector< double > zFrontB_
 
std::vector< double > zFrontT_
 
double zMinBlock_
 

Static Public Attributes

static constexpr double tol2_ = 0.00001 * dd4hep::mm
 

Detailed Description

Definition at line 27 of file DDHGCalHEFileAlgo.cc.

Constructor & Destructor Documentation

◆ HGCalHEFileAlgo() [1/2]

HGCalHEFileAlgo::HGCalHEFileAlgo ( )
inline

Definition at line 28 of file DDHGCalHEFileAlgo.cc.

References Exception.

28 { throw cms::Exception("HGCalGeom") << "Wrong initialization to HGCalHEFileAlgo"; }

◆ HGCalHEFileAlgo() [2/2]

HGCalHEFileAlgo::HGCalHEFileAlgo ( cms::DDParsingContext ctxt,
xml_h  e 
)
inline

Definition at line 29 of file DDHGCalHEFileAlgo.cc.

References funct::abs(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), writedatasetfile::args, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), cms::convert2mm(), angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), MillePedeFileConverter_cfg::e, mps_fire::i, cuy::ii, l1ctLayer1_patternWriters_cff::isec, dqmdumpme::k, cms::DDNamespace::material(), g4SimHits_cfi::Material, SiStripPI::min, Skims_PA_cff::name, cms::DDNamespace::name(), HGCalGeometryMode::Polyhedra, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), HGCalGeomTools::radius(), AlCaHLTBitMon_QueryRunRegistry::string, to_string(), cms::DDNamespace::volume(), HGCalWaferIndex::waferLayer(), HGCalProperty::waferOrient(), HGCalProperty::waferPartial(), HGCalProperty::waferThick(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and geometryCSVtoXML::zz.

29  {
30  cms::DDNamespace ns(ctxt, e, true);
32 
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Creating an instance";
35 #endif
36 
37  static constexpr double tol1 = 0.01 * dd4hep::mm;
38  dd4hep::Volume mother = ns.volume(args.parentName());
39 
40  waferNames_ = args.value<std::vector<std::string>>("WaferNames");
41 #ifdef EDM_ML_DEBUG
42  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << waferNames_.size() << " wafers";
43  for (unsigned int i = 0; i < waferNames_.size(); ++i)
44  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << waferNames_[i];
45 #endif
46  materials_ = args.value<std::vector<std::string>>("MaterialNames");
47  volumeNames_ = args.value<std::vector<std::string>>("VolumeNames");
48  thickness_ = args.value<std::vector<double>>("Thickness");
49  copyNumber_.resize(materials_.size(), 1);
50 #ifdef EDM_ML_DEBUG
51  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << materials_.size() << " types of volumes";
52  for (unsigned int i = 0; i < volumeNames_.size(); ++i)
53  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << volumeNames_[i] << " of thickness "
54  << cms::convert2mm(thickness_[i]) << " filled with " << materials_[i]
55  << " first copy number " << copyNumber_[i];
56 #endif
57  layerNumbers_ = args.value<std::vector<int>>("Layers");
58  layerThick_ = args.value<std::vector<double>>("LayerThick");
59  rMixLayer_ = args.value<std::vector<double>>("LayerRmix");
60 #ifdef EDM_ML_DEBUG
61  edm::LogVerbatim("HGCalGeom") << "There are " << layerNumbers_.size() << " blocks";
62  for (unsigned int i = 0; i < layerNumbers_.size(); ++i)
63  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << cms::convert2mm(layerThick_[i])
64  << " Rmid " << cms::convert2mm(rMixLayer_[i]) << " with " << layerNumbers_[i]
65  << " layers";
66 #endif
67  layerType_ = args.value<std::vector<int>>("LayerType");
68  layerSense_ = args.value<std::vector<int>>("LayerSense");
69  firstLayer_ = args.value<int>("FirstLayer");
70  absorbMode_ = args.value<int>("AbsorberMode");
71  sensitiveMode_ = args.value<int>("SensitiveMode");
72 #ifdef EDM_ML_DEBUG
73  edm::LogVerbatim("HGCalGeom") << "First Layer " << firstLayer_ << " and "
74  << "Absober:Sensitive mode " << absorbMode_ << ":" << sensitiveMode_;
75 #endif
76  layerCenter_ = args.value<std::vector<int>>("LayerCenter");
77 #ifdef EDM_ML_DEBUG
78  for (unsigned int i = 0; i < layerCenter_.size(); ++i)
79  edm::LogVerbatim("HGCalGeom") << "LayerCenter [" << i << "] " << layerCenter_[i];
80 #endif
81  if (firstLayer_ > 0) {
82  for (unsigned int i = 0; i < layerType_.size(); ++i) {
83  if (layerSense_[i] > 0) {
84  int ii = layerType_[i];
86 #ifdef EDM_ML_DEBUG
87  edm::LogVerbatim("HGCalGeom") << "First copy number for layer type " << i << ":" << ii << " with "
88  << materials_[ii] << " changed to " << copyNumber_[ii];
89 #endif
90  break;
91  }
92  }
93  } else {
94  firstLayer_ = 1;
95  }
96 #ifdef EDM_ML_DEBUG
97  edm::LogVerbatim("HGCalGeom") << "There are " << layerType_.size() << " layers";
98  for (unsigned int i = 0; i < layerType_.size(); ++i)
99  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType_[i] << " sensitive class "
100  << layerSense_[i];
101 #endif
102  materialsTop_ = args.value<std::vector<std::string>>("TopMaterialNames");
103  namesTop_ = args.value<std::vector<std::string>>("TopVolumeNames");
104  layerThickTop_ = args.value<std::vector<double>>("TopLayerThickness");
105  layerTypeTop_ = args.value<std::vector<int>>("TopLayerType");
106  copyNumberTop_.resize(materialsTop_.size(), 1);
107 #ifdef EDM_ML_DEBUG
108  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << materialsTop_.size()
109  << " types of volumes in the top part";
110  for (unsigned int i = 0; i < materialsTop_.size(); ++i)
111  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesTop_[i] << " of thickness "
112  << cms::convert2mm(layerThickTop_[i]) << " filled with " << materialsTop_[i]
113  << " first copy number " << copyNumberTop_[i];
114  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeTop_.size() << " layers in the top part";
115  for (unsigned int i = 0; i < layerTypeTop_.size(); ++i)
116  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerTypeTop_[i];
117 #endif
118  materialsBot_ = args.value<std::vector<std::string>>("BottomMaterialNames");
119  namesBot_ = args.value<std::vector<std::string>>("BottomVolumeNames");
120  layerTypeBot_ = args.value<std::vector<int>>("BottomLayerType");
121  layerSenseBot_ = args.value<std::vector<int>>("BottomLayerSense");
122  layerThickBot_ = args.value<std::vector<double>>("BottomLayerThickness");
123  copyNumberBot_.resize(materialsBot_.size(), 1);
124 #ifdef EDM_ML_DEBUG
125  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << materialsBot_.size()
126  << " types of volumes in the bottom part";
127  for (unsigned int i = 0; i < materialsBot_.size(); ++i)
128  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesBot_[i] << " of thickness "
129  << cms::convert2mm(layerThickBot_[i]) << " filled with " << materialsBot_[i]
130  << " first copy number " << copyNumberBot_[i];
131  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeBot_.size() << " layers in the bottom part";
132  for (unsigned int i = 0; i < layerTypeBot_.size(); ++i)
133  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerTypeBot_[i]
134  << " sensitive class " << layerSenseBot_[i];
135 #endif
136  zMinBlock_ = args.value<double>("zMinBlock");
137  waferSize_ = args.value<double>("waferSize");
138  waferSepar_ = args.value<double>("SensorSeparation");
139  sectors_ = args.value<int>("Sectors");
140  alpha_ = (1._pi) / sectors_;
141  cosAlpha_ = cos(alpha_);
142 #ifdef EDM_ML_DEBUG
143  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: zStart " << cms::convert2mm(zMinBlock_) << " wafer width "
144  << cms::convert2mm(waferSize_) << " separations " << cms::convert2mm(waferSepar_)
145  << " sectors " << sectors_ << ":" << convertRadToDeg(alpha_) << ":" << cosAlpha_;
146 #endif
147  waferIndex_ = args.value<std::vector<int>>("WaferIndex");
148  waferProperty_ = args.value<std::vector<int>>("WaferProperties");
149 #ifdef EDM_ML_DEBUG
150  edm::LogVerbatim("HGCalGeom") << "waferProperties with " << waferIndex_.size() << " entries";
151  for (unsigned int k = 0; k < waferIndex_.size(); ++k)
152  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << waferIndex_[k] << " ("
155  << HGCalWaferIndex::waferV(waferIndex_[k]) << ") : ("
159 #endif
160  slopeB_ = args.value<std::vector<double>>("SlopeBottom");
161  zFrontB_ = args.value<std::vector<double>>("ZFrontBottom");
162  rMinFront_ = args.value<std::vector<double>>("RMinFront");
163  slopeT_ = args.value<std::vector<double>>("SlopeTop");
164  zFrontT_ = args.value<std::vector<double>>("ZFrontTop");
165  rMaxFront_ = args.value<std::vector<double>>("RMaxFront");
166 #ifdef EDM_ML_DEBUG
167  for (unsigned int i = 0; i < slopeB_.size(); ++i)
168  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << cms::convert2mm(zFrontB_[i]) << " Rmin "
169  << cms::convert2mm(rMinFront_[i]) << " Slope " << slopeB_[i];
170  for (unsigned int i = 0; i < slopeT_.size(); ++i)
171  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << cms::convert2mm(zFrontT_[i]) << " Rmax "
172  << cms::convert2mm(rMaxFront_[i]) << " Slope " << slopeT_[i];
173  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: NameSpace " << ns.name();
174 
175  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalHEFileAlgo...";
176  copies_.clear();
177 #endif
178 
179  double zi(zMinBlock_);
180  int laymin(0);
181  for (unsigned int i = 0; i < layerNumbers_.size(); i++) {
182  double zo = zi + layerThick_[i];
183  double routF = HGCalGeomTools::radius(zi, zFrontT_, rMaxFront_, slopeT_);
184  int laymax = laymin + layerNumbers_[i];
185  double zz = zi;
186  double thickTot(0);
187  for (int ly = laymin; ly < laymax; ++ly) {
188  int ii = layerType_[ly];
189  int copy = copyNumber_[ii];
190  double hthick = 0.5 * thickness_[ii];
191  double rinB = HGCalGeomTools::radius(zo, zFrontB_, rMinFront_, slopeB_);
192  zz += hthick;
193  thickTot += thickness_[ii];
194 
196 
197 #ifdef EDM_ML_DEBUG
198  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Layer " << ly << ":" << ii << " Front "
199  << cms::convert2mm(zi) << ", " << cms::convert2mm(routF) << " Back "
200  << cms::convert2mm(zo) << ", " << cms::convert2mm(rinB)
201  << " superlayer thickness " << cms::convert2mm(layerThick_[i]);
202 #endif
203 
204  dd4hep::Material matter = ns.material(materials_[ii]);
205  dd4hep::Volume glog;
206 
207  if (layerSense_[ly] < 1) {
208  std::vector<double> pgonZ, pgonRin, pgonRout;
209  double rmax =
210  (std::min(routF, HGCalGeomTools::radius(zz + hthick, zFrontT_, rMaxFront_, slopeT_)) * cosAlpha_) - tol1;
211  HGCalGeomTools::radius(zz - hthick,
212  zz + hthick,
213  zFrontB_,
214  rMinFront_,
215  slopeB_,
216  zFrontT_,
217  rMaxFront_,
218  slopeT_,
219  -layerSense_[ly],
220  pgonZ,
221  pgonRin,
222  pgonRout);
223  for (unsigned int isec = 0; isec < pgonZ.size(); ++isec) {
224  pgonZ[isec] -= zz;
225  if (layerSense_[ly] == 0 || absorbMode_ == 0)
226  pgonRout[isec] = rmax;
227  else
228  pgonRout[isec] = pgonRout[isec] * cosAlpha_ - tol1;
229  }
230 
231  dd4hep::Solid solid = dd4hep::Polyhedra(sectors_, -alpha_, 2._pi, pgonZ, pgonRin, pgonRout);
232  ns.addSolidNS(ns.prepend(name), solid);
233  glog = dd4hep::Volume(solid.name(), solid, matter);
234  ns.addVolumeNS(glog);
235 #ifdef EDM_ML_DEBUG
236  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " polyhedra of " << sectors_
237  << " sectors covering " << convertRadToDeg(-alpha_) << ":"
238  << convertRadToDeg(-alpha_ + 2._pi) << " with " << pgonZ.size() << " sections";
239  for (unsigned int k = 0; k < pgonZ.size(); ++k)
240  edm::LogVerbatim("HGCalGeom") << "[" << k << "] z " << cms::convert2mm(pgonZ[k]) << " R "
241  << cms::convert2mm(pgonRin[k]) << ":" << cms::convert2mm(pgonRout[k]);
242 #endif
243  } else {
244  double rins =
246  double routs =
247  (sensitiveMode_ < 1) ? routF : HGCalGeomTools::radius(zz - hthick, zFrontT_, rMaxFront_, slopeT_);
248  dd4hep::Solid solid = dd4hep::Tube(rins, routs, hthick, 0.0, 2._pi);
249  ns.addSolidNS(ns.prepend(name), solid);
250  glog = dd4hep::Volume(solid.name(), solid, matter);
251  ns.addVolumeNS(glog);
252 
253 #ifdef EDM_ML_DEBUG
254  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matter.name()
255  << " of dimensions " << cms::convert2mm(rinB) << ":" << cms::convert2mm(rins)
256  << ", " << cms::convert2mm(routF) << ":" << cms::convert2mm(routs) << ", "
257  << cms::convert2mm(hthick) << ", 0.0, 360.0 and positioned in: " << glog.name()
258  << " number " << copy;
259 #endif
260  positionMix(ctxt, e, glog, name, copy, thickness_[ii], matter, rins, rMixLayer_[i], routs, zz);
261  }
262 
263  dd4hep::Position r1(0, 0, zz);
264  mother.placeVolume(glog, copy, r1);
265  ++copyNumber_[ii];
266 #ifdef EDM_ML_DEBUG
267  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog.name() << " number " << copy << " positioned in "
268  << mother.name() << " at (0,0," << cms::convert2mm(zz) << ") with no rotation";
269 #endif
270  zz += hthick;
271  } // End of loop over layers in a block
272  zi = zo;
273  laymin = laymax;
274  if (std::abs(thickTot - layerThick_[i]) > tol2_) {
275  if (thickTot > layerThick_[i]) {
276  edm::LogError("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(layerThick_[i])
277  << " is smaller than " << cms::convert2mm(thickTot)
278  << ": thickness of all its components **** ERROR ****";
279  } else {
280  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(layerThick_[i])
281  << " does not match with " << cms::convert2mm(thickTot) << " of the components";
282  }
283  }
284  } // End of loop over blocks
285 
286 #ifdef EDM_ML_DEBUG
287  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << copies_.size() << " different wafer copy numbers";
288  int k(0);
289  for (std::unordered_set<int>::const_iterator itr = copies_.begin(); itr != copies_.end(); ++itr, ++k) {
290  edm::LogVerbatim("HGCalGeom") << "Copy [" << k << "] : " << (*itr);
291  }
292  copies_.clear();
293  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalHEFileAlgo construction...";
294 #endif
295  }
Log< level::Info, true > LogVerbatim
std::vector< std::string > namesBot_
std::vector< int > copyNumberBot_
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)
std::vector< std::string > materialsBot_
std::vector< double > rMinFront_
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
static constexpr double tol2_
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
std::vector< double > layerThickBot_
std::vector< int > layerTypeTop_
std::vector< double > thickness_
Log< level::Error, false > LogError
std::vector< double > layerThickTop_
std::vector< double > slopeB_
std::vector< std::string > namesTop_
std::vector< int > copyNumber_
int32_t waferOrient(const int32_t property)
static std::string to_string(const XMLCh *ch)
std::vector< int > copyNumberTop_
std::vector< std::string > materialsTop_
std::vector< std::string > volumeNames_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > zFrontT_
int32_t waferThick(const int32_t property)
std::unordered_set< int > copies_
std::vector< std::string > waferNames_
dd4hep::Volume Volume
ii
Definition: cuy.py:589
std::vector< int > waferProperty_
std::vector< double > slopeT_
std::vector< int > waferIndex_
std::vector< int > layerTypeBot_
std::vector< int > layerNumbers_
void positionMix(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, const std::string &nameM, int copyM, double thick, const dd4hep::Material &matter, double rin, double rmid, double rout, double zz)
std::vector< int > layerSense_
int32_t waferPartial(const int32_t property)
std::vector< double > rMaxFront_
std::vector< double > layerThick_
std::vector< int > layerSenseBot_
int32_t waferV(const int32_t index)
std::vector< double > zFrontB_
std::vector< int > layerCenter_
std::vector< int > layerType_
Log< level::Warning, false > LogWarning
std::vector< std::string > materials_
std::vector< double > rMixLayer_

Member Function Documentation

◆ positionMix()

void HGCalHEFileAlgo::positionMix ( cms::DDParsingContext ctxt,
xml_h  e,
const dd4hep::Volume &  glog,
const std::string &  nameM,
int  copyM,
double  thick,
const dd4hep::Material &  matter,
double  rin,
double  rmid,
double  rout,
double  zz 
)
inline

Definition at line 297 of file DDHGCalHEFileAlgo.cc.

References funct::abs(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), cms::convert2mm(), filterCSVwithJSON::copy, MillePedeFileConverter_cfg::e, HLT_2024v11_cff::eta1, HLT_2024v11_cff::eta2, cuy::ii, dqm-mbProfile::log, cms::DDNamespace::material(), g4SimHits_cfi::Material, Skims_PA_cff::name, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), to_string(), and geometryCSVtoXML::zz.

307  {
308  cms::DDNamespace ns(ctxt, e, true);
309 
310  dd4hep::Volume glog1;
311  for (unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
312  int ii = layerTypeTop_[ly];
313  copyNumberTop_[ii] = copyM;
314  }
315  for (unsigned int ly = 0; ly < layerTypeBot_.size(); ++ly) {
316  int ii = layerTypeBot_[ly];
317  copyNumberBot_[ii] = copyM;
318  }
319  double hthick = 0.5 * thick;
320  // Make the top part first
321  std::string name = nameM + "Top";
322 
323  dd4hep::Solid solid = dd4hep::Tube(rmid, rout, hthick, 0.0, 2._pi);
324  ns.addSolidNS(ns.prepend(name), solid);
325  glog1 = dd4hep::Volume(solid.name(), solid, matter);
326  ns.addVolumeNS(glog1);
327 #ifdef EDM_ML_DEBUG
328  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matter.name()
329  << " of dimensions " << cms::convert2mm(rmid) << ", " << cms::convert2mm(rout) << ", "
330  << cms::convert2mm(hthick) << ", 0.0, 360.0";
331 #endif
332  glog.placeVolume(glog1, 1);
333 
334 #ifdef EDM_ML_DEBUG
335  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog1.name() << " number 1 positioned in " << glog.name()
336  << " at (0,0,0) with no rotation";
337 #endif
338  double thickTot(0), zpos(-hthick);
339  for (unsigned int ly = 0; ly < layerTypeTop_.size(); ++ly) {
340  int ii = layerTypeTop_[ly];
341  int copy = copyNumberTop_[ii];
342  double hthickl = 0.5 * layerThickTop_[ii];
343  thickTot += layerThickTop_[ii];
345 #ifdef EDM_ML_DEBUG
346  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Layer " << ly << ":" << ii << " R " << cms::convert2mm(rmid)
347  << ":" << cms::convert2mm(rout) << " Thick " << cms::convert2mm(layerThickTop_[ii]);
348 #endif
349 
350  dd4hep::Material matter1 = ns.material(materialsTop_[ii]);
351  solid = dd4hep::Tube(rmid, rout, hthickl, 0.0, 2._pi);
352  ns.addSolidNS(ns.prepend(name), solid);
353  dd4hep::Volume glog2 = dd4hep::Volume(solid.name(), solid, matter1);
354  ns.addVolumeNS(glog2);
355 
356 #ifdef EDM_ML_DEBUG
357  double eta1 = -log(tan(0.5 * atan(rmid / zz)));
358  double eta2 = -log(tan(0.5 * atan(rout / zz)));
359  edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << cms::convert2mm(zz) << ":" << cms::convert2mm(rmid)
360  << ":" << cms::convert2mm(rout) << " eta " << eta1 << ":" << eta2;
361  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matter1.name()
362  << " of dimensions " << cms::convert2mm(rmid) << ", " << cms::convert2mm(rout)
363  << ", " << cms::convert2mm(hthickl) << ", 0.0, 360.0";
364 #endif
365  zpos += hthickl;
366 
367  dd4hep::Position r1(0, 0, zpos);
368  glog1.placeVolume(glog2, copy, r1);
369 
370 #ifdef EDM_ML_DEBUG
371  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Position " << glog2.name() << " number " << copy << " in "
372  << glog1.name() << " at (0,0," << cms::convert2mm(zpos) << ") with no rotation";
373 #endif
374  ++copyNumberTop_[ii];
375  zpos += hthickl;
376  }
377  if (std::abs(thickTot - thick) > tol2_) {
378  if (thickTot > thick) {
379  edm::LogError("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(thick) << " is smaller than "
380  << cms::convert2mm(thickTot)
381  << ": thickness of all its components in the top part **** ERROR ****";
382  } else {
383  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(thick)
384  << " does not match with " << cms::convert2mm(thickTot)
385  << " of the components in top part";
386  }
387  }
388 
389  // Make the bottom part next
390  name = nameM + "Bottom";
391 
392  solid = dd4hep::Tube(rin, rmid, hthick, 0.0, 2._pi);
393  ns.addSolidNS(ns.prepend(name), solid);
394  glog1 = dd4hep::Volume(solid.name(), solid, matter);
395  ns.addVolumeNS(glog1);
396 
397 #ifdef EDM_ML_DEBUG
398  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matter.name()
399  << " of dimensions " << cms::convert2mm(rin) << ", " << cms::convert2mm(rmid) << ", "
400  << cms::convert2mm(hthick) << ", 0.0, 360.0";
401 #endif
402 
403  glog.placeVolume(glog1, 1);
404 #ifdef EDM_ML_DEBUG
405  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog1.name() << " number 1 positioned in " << glog.name()
406  << " at (0,0,0) with no rotation";
407 #endif
408  thickTot = 0;
409  zpos = -hthick;
410  for (unsigned int ly = 0; ly < layerTypeBot_.size(); ++ly) {
411  int ii = layerTypeBot_[ly];
412  int copy = copyNumberBot_[ii];
413  double hthickl = 0.5 * layerThickBot_[ii];
414  thickTot += layerThickBot_[ii];
416 #ifdef EDM_ML_DEBUG
417  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Layer " << ly << ":" << ii << " R " << cms::convert2mm(rin)
418  << ":" << cms::convert2mm(rmid) << " Thick " << cms::convert2mm(layerThickBot_[ii]);
419 #endif
420 
421  dd4hep::Material matter1 = ns.material(materialsBot_[ii]);
422  solid = dd4hep::Tube(rin, rmid, hthickl, 0.0, 2._pi);
423  ns.addSolidNS(ns.prepend(name), solid);
424  dd4hep::Volume glog2 = dd4hep::Volume(solid.name(), solid, matter1);
425  ns.addVolumeNS(glog2);
426 
427 #ifdef EDM_ML_DEBUG
428  double eta1 = -log(tan(0.5 * atan(rin / zz)));
429  double eta2 = -log(tan(0.5 * atan(rmid / zz)));
430  edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << cms::convert2mm(zz) << ":" << cms::convert2mm(rin)
431  << ":" << cms::convert2mm(rmid) << " eta " << eta1 << ":" << eta2;
432  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << solid.name() << " Tubs made of " << matter1.name()
433  << " of dimensions " << cms::convert2mm(rin) << ", " << cms::convert2mm(rmid)
434  << ", " << cms::convert2mm(hthickl) << ", 0.0, 360.0";
435 #endif
436  zpos += hthickl;
437 
438  dd4hep::Position r1(0, 0, zpos);
439  glog1.placeVolume(glog2, copy, r1);
440 #ifdef EDM_ML_DEBUG
441  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Position " << glog2.name() << " number " << copy << " in "
442  << glog1.name() << " at (0,0," << cms::convert2mm(zpos) << ") with no rotation";
443 #endif
444  if (layerSenseBot_[ly] != 0) {
445 #ifdef EDM_ML_DEBUG
446  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: z " << cms::convert2mm((zz + zpos)) << " Center " << copy
447  << ":" << (copy - firstLayer_) << ":" << layerCenter_[copy - firstLayer_];
448 #endif
449  positionSensitive(ctxt, e, glog2, rin, rmid, zz + zpos, layerSenseBot_[ly], (copy - firstLayer_));
450  }
451  zpos += hthickl;
452  ++copyNumberBot_[ii];
453  }
454  if (std::abs(thickTot - thick) > tol2_) {
455  if (thickTot > thick) {
456  edm::LogError("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(thick) << " is smaller than "
457  << cms::convert2mm(thickTot)
458  << ": thickness of all its components in the top part **** ERROR ****";
459  } else {
460  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << cms::convert2mm(thick)
461  << " does not match with " << cms::convert2mm(thickTot)
462  << " of the components in top part";
463  }
464  }
465  }
Log< level::Info, true > LogVerbatim
std::vector< std::string > namesBot_
std::vector< int > copyNumberBot_
std::vector< std::string > materialsBot_
static constexpr double tol2_
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
std::vector< double > layerThickBot_
std::vector< int > layerTypeTop_
Log< level::Error, false > LogError
std::vector< double > layerThickTop_
std::vector< std::string > namesTop_
static std::string to_string(const XMLCh *ch)
std::vector< int > copyNumberTop_
std::vector< std::string > materialsTop_
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dd4hep::Volume Volume
ii
Definition: cuy.py:589
std::vector< int > layerTypeBot_
std::vector< int > layerSenseBot_
std::vector< int > layerCenter_
Log< level::Warning, false > LogWarning
void positionSensitive(cms::DDParsingContext &ctxt, xml_h e, const dd4hep::Volume &glog, double rin, double rout, double zpos, int layertype, int layer)

◆ positionSensitive()

void HGCalHEFileAlgo::positionSensitive ( cms::DDParsingContext ctxt,
xml_h  e,
const dd4hep::Volume &  glog,
double  rin,
double  rout,
double  zpos,
int  layertype,
int  layer 
)
inline

Definition at line 467 of file DDHGCalHEFileAlgo.cc.

References funct::abs(), cms::convert2mm(), filterCSVwithJSON::copy, TCMET_cfi::corner, PVValHelper::dy, MillePedeFileConverter_cfg::e, HGCalWaferType::getType(), createfilelist::int, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::iv, HGCalParameters::k_CornerSize, N, EgHLTOffHistBins_cfi::nr, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::ntot, HGCalTypes::packTypeUV(), PixelTestBeamValidation_cfi::Position, dttmaxenums::R, mathSSE::sqrt(), findQualityFiles::v, cms::DDNamespace::volume(), HGCalGeomTools::waferCorner(), and HGCalWaferIndex::waferIndex().

474  {
475  cms::DDNamespace ns(ctxt, e, true);
476  int layercenter = layerCenter_[layer];
477  static const double sqrt3 = std::sqrt(3.0);
478  double r = 0.5 * (waferSize_ + waferSepar_);
479  double R = 2.0 * r / sqrt3;
480  double dy = 0.75 * R;
481  int N = (int)(0.5 * rout / r) + 2;
482  const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
483 #ifdef EDM_ML_DEBUG
484  int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0), nin(0);
485  std::vector<int> ntype(6, 0);
486  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog.name() << " rin:rout " << cms::convert2mm(rin) << ":"
487  << cms::convert2mm(rout) << " zpos " << cms::convert2mm(zpos) << " N " << N
488  << " for maximum u, v Offset; Shift " << cms::convert2mm(xyoff.first) << ":"
489  << cms::convert2mm(xyoff.second) << " WaferSize "
491 #endif
492  for (int u = -N; u <= N; ++u) {
493  for (int v = -N; v <= N; ++v) {
494 #ifdef EDM_ML_DEBUG
495  int iu = std::abs(u);
496  int iv = std::abs(v);
497 #endif
498  int nr = 2 * v;
499  int nc = -2 * u + v;
500  double xpos = xyoff.first + nc * r;
501  double ypos = xyoff.second + nr * dy;
502  const auto& corner = HGCalGeomTools::waferCorner(xpos, ypos, r, R, rin, rout, false);
503 #ifdef EDM_ML_DEBUG
504  ++ntot;
505 #endif
506  int indx = HGCalWaferIndex::waferIndex((layer + firstLayer_), u, v, false);
508  if (corner.first > 0 && type >= 0) {
509  int copy = HGCalTypes::packTypeUV(type, u, v);
510  if (layertype > 1)
511  type += 3;
512 #ifdef EDM_ML_DEBUG
513  edm::LogVerbatim("HGCalGeom") << " DDHGCalHEFileAlgo: " << waferNames_[type] << " number " << copy << " type "
514  << type << " layer:u:v:indx " << (layer + firstLayer_) << ":" << u << ":" << v
515  << ":" << indx;
516  if (iu > ium)
517  ium = iu;
518  if (iv > ivm)
519  ivm = iv;
520  kount++;
521  if (copies_.count(copy) == 0)
522  copies_.insert(copy);
523 #endif
524  if (corner.first == (int)(HGCalParameters::k_CornerSize)) {
525 #ifdef EDM_ML_DEBUG
526  if (iu > iumAll)
527  iumAll = iu;
528  if (iv > ivmAll)
529  ivmAll = iv;
530  ++nin;
531 #endif
532  dd4hep::Position tran(xpos, ypos, 0.0);
533  glog.placeVolume(ns.volume(waferNames_[type]), copy, tran);
534 #ifdef EDM_ML_DEBUG
535  ++ntype[type];
536  edm::LogVerbatim("HGCalGeom")
537  << "DDHGCalHEFileAlgo: " << waferNames_[type] << " number " << copy << " type " << layertype << ":"
538  << type << " positioned in " << glog.name() << " at (" << cms::convert2mm(xpos) << ", "
539  << cms::convert2mm(ypos) << ", 0) with no rotation";
540 #endif
541  }
542  }
543  }
544  }
545 #ifdef EDM_ML_DEBUG
546  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: Maximum # of u " << ium << ":" << iumAll << " # of v " << ivm
547  << ":" << ivmAll << " and " << nin << ":" << kount << ":" << ntot << " wafers ("
548  << ntype[0] << ":" << ntype[1] << ":" << ntype[2] << ":" << ntype[3] << ":"
549  << ntype[4] << ":" << ntype[5] << ") for " << glog.name() << " R "
550  << cms::convert2mm(rin) << ":" << cms::convert2mm(rout);
551 #endif
552  }
Log< level::Info, true > LogVerbatim
static int getType(int index, const HGCalParameters::waferInfo_map &wafers)
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
HGCalGeomTools geomTools_
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
static constexpr uint32_t k_CornerSize
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
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::unordered_set< int > copies_
std::vector< std::string > waferNames_
std::vector< int > waferProperty_
#define N
Definition: blowfish.cc:9
std::vector< int > waferIndex_
static int32_t packTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:3
std::vector< int > layerCenter_

Member Data Documentation

◆ absorbMode_

int HGCalHEFileAlgo::absorbMode_

Definition at line 569 of file DDHGCalHEFileAlgo.cc.

◆ alpha_

double HGCalHEFileAlgo::alpha_

Definition at line 597 of file DDHGCalHEFileAlgo.cc.

◆ copies_

std::unordered_set<int> HGCalHEFileAlgo::copies_

Definition at line 596 of file DDHGCalHEFileAlgo.cc.

◆ copyNumber_

std::vector<int> HGCalHEFileAlgo::copyNumber_

Definition at line 562 of file DDHGCalHEFileAlgo.cc.

◆ copyNumberBot_

std::vector<int> HGCalHEFileAlgo::copyNumberBot_

Definition at line 580 of file DDHGCalHEFileAlgo.cc.

◆ copyNumberTop_

std::vector<int> HGCalHEFileAlgo::copyNumberTop_

Definition at line 575 of file DDHGCalHEFileAlgo.cc.

◆ cosAlpha_

double HGCalHEFileAlgo::cosAlpha_

Definition at line 597 of file DDHGCalHEFileAlgo.cc.

◆ firstLayer_

int HGCalHEFileAlgo::firstLayer_

Definition at line 568 of file DDHGCalHEFileAlgo.cc.

◆ geomTools_

HGCalGeomTools HGCalHEFileAlgo::geomTools_

Definition at line 555 of file DDHGCalHEFileAlgo.cc.

◆ layerCenter_

std::vector<int> HGCalHEFileAlgo::layerCenter_

Definition at line 582 of file DDHGCalHEFileAlgo.cc.

◆ layerNumbers_

std::vector<int> HGCalHEFileAlgo::layerNumbers_

Definition at line 563 of file DDHGCalHEFileAlgo.cc.

◆ layerSense_

std::vector<int> HGCalHEFileAlgo::layerSense_

Definition at line 567 of file DDHGCalHEFileAlgo.cc.

◆ layerSenseBot_

std::vector<int> HGCalHEFileAlgo::layerSenseBot_

Definition at line 581 of file DDHGCalHEFileAlgo.cc.

◆ layerThick_

std::vector<double> HGCalHEFileAlgo::layerThick_

Definition at line 564 of file DDHGCalHEFileAlgo.cc.

◆ layerThickBot_

std::vector<double> HGCalHEFileAlgo::layerThickBot_

Definition at line 578 of file DDHGCalHEFileAlgo.cc.

◆ layerThickTop_

std::vector<double> HGCalHEFileAlgo::layerThickTop_

Definition at line 573 of file DDHGCalHEFileAlgo.cc.

◆ layerType_

std::vector<int> HGCalHEFileAlgo::layerType_

Definition at line 566 of file DDHGCalHEFileAlgo.cc.

◆ layerTypeBot_

std::vector<int> HGCalHEFileAlgo::layerTypeBot_

Definition at line 579 of file DDHGCalHEFileAlgo.cc.

◆ layerTypeTop_

std::vector<int> HGCalHEFileAlgo::layerTypeTop_

Definition at line 574 of file DDHGCalHEFileAlgo.cc.

◆ materials_

std::vector<std::string> HGCalHEFileAlgo::materials_

Definition at line 559 of file DDHGCalHEFileAlgo.cc.

◆ materialsBot_

std::vector<std::string> HGCalHEFileAlgo::materialsBot_

Definition at line 576 of file DDHGCalHEFileAlgo.cc.

◆ materialsTop_

std::vector<std::string> HGCalHEFileAlgo::materialsTop_

Definition at line 571 of file DDHGCalHEFileAlgo.cc.

◆ namesBot_

std::vector<std::string> HGCalHEFileAlgo::namesBot_

Definition at line 577 of file DDHGCalHEFileAlgo.cc.

◆ namesTop_

std::vector<std::string> HGCalHEFileAlgo::namesTop_

Definition at line 572 of file DDHGCalHEFileAlgo.cc.

◆ rMaxFront_

std::vector<double> HGCalHEFileAlgo::rMaxFront_

Definition at line 595 of file DDHGCalHEFileAlgo.cc.

◆ rMinFront_

std::vector<double> HGCalHEFileAlgo::rMinFront_

Definition at line 592 of file DDHGCalHEFileAlgo.cc.

◆ rMixLayer_

std::vector<double> HGCalHEFileAlgo::rMixLayer_

Definition at line 565 of file DDHGCalHEFileAlgo.cc.

◆ sectors_

int HGCalHEFileAlgo::sectors_

Definition at line 587 of file DDHGCalHEFileAlgo.cc.

◆ sensitiveMode_

int HGCalHEFileAlgo::sensitiveMode_

Definition at line 570 of file DDHGCalHEFileAlgo.cc.

◆ slopeB_

std::vector<double> HGCalHEFileAlgo::slopeB_

Definition at line 590 of file DDHGCalHEFileAlgo.cc.

◆ slopeT_

std::vector<double> HGCalHEFileAlgo::slopeT_

Definition at line 593 of file DDHGCalHEFileAlgo.cc.

◆ thickness_

std::vector<double> HGCalHEFileAlgo::thickness_

Definition at line 561 of file DDHGCalHEFileAlgo.cc.

◆ tol2_

constexpr double HGCalHEFileAlgo::tol2_ = 0.00001 * dd4hep::mm
static

Definition at line 556 of file DDHGCalHEFileAlgo.cc.

◆ volumeNames_

std::vector<std::string> HGCalHEFileAlgo::volumeNames_

Definition at line 560 of file DDHGCalHEFileAlgo.cc.

◆ waferIndex_

std::vector<int> HGCalHEFileAlgo::waferIndex_

Definition at line 588 of file DDHGCalHEFileAlgo.cc.

◆ waferNames_

std::vector<std::string> HGCalHEFileAlgo::waferNames_

Definition at line 558 of file DDHGCalHEFileAlgo.cc.

◆ waferProperty_

std::vector<int> HGCalHEFileAlgo::waferProperty_

Definition at line 589 of file DDHGCalHEFileAlgo.cc.

◆ waferSepar_

double HGCalHEFileAlgo::waferSepar_

Definition at line 586 of file DDHGCalHEFileAlgo.cc.

◆ waferSize_

double HGCalHEFileAlgo::waferSize_

Definition at line 585 of file DDHGCalHEFileAlgo.cc.

◆ zFrontB_

std::vector<double> HGCalHEFileAlgo::zFrontB_

Definition at line 591 of file DDHGCalHEFileAlgo.cc.

◆ zFrontT_

std::vector<double> HGCalHEFileAlgo::zFrontT_

Definition at line 594 of file DDHGCalHEFileAlgo.cc.

◆ zMinBlock_

double HGCalHEFileAlgo::zMinBlock_

Definition at line 584 of file DDHGCalHEFileAlgo.cc.