CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes
HGCalHEAlgo Struct Reference

Public Member Functions

 HGCalHEAlgo ()
 
 HGCalHEAlgo (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 layercenter)
 

Public Attributes

int absorbMode_
 
double alpha_
 
int choiceType_
 
std::unordered_set< int > copies_
 
std::vector< int > copyNumber_
 
std::vector< int > copyNumberBot_
 
std::vector< int > copyNumberTop_
 
double cosAlpha_
 
int firstLayer_
 
double fracAreaMin_
 
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_
 
int nCutRadPar_
 
std::vector< double > rad100to200_
 
std::vector< double > rad200to300_
 
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< std::string > waferNames_
 
double waferSepar_
 
double waferSize_
 
std::unique_ptr< HGCalWaferTypewaferType_
 
std::vector< double > zFrontB_
 
std::vector< double > zFrontT_
 
double zMinBlock_
 
double zMinRadPar_
 

Static Public Attributes

static constexpr double tol1_ = 0.01 * dd4hep::mm
 
static constexpr double tol2_ = 0.00001 * dd4hep::mm
 

Detailed Description

Definition at line 27 of file DDHGCalHEAlgo.cc.

Constructor & Destructor Documentation

HGCalHEAlgo::HGCalHEAlgo ( )
inline

Definition at line 28 of file DDHGCalHEAlgo.cc.

References Exception.

28 { throw cms::Exception("HGCalGeom") << "Wrong initialization to HGCalHEAlgo"; }
HGCalHEAlgo::HGCalHEAlgo ( cms::DDParsingContext ctxt,
xml_h  e 
)
inline

Definition at line 29 of file DDHGCalHEAlgo.cc.

References funct::abs(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), writedatasetfile::args, cms::convert2mm(), angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), mps_fire::i, cuy::ii, isotrackApplyRegressor::k, cms::DDNamespace::material(), SiStripPI::min, mergeVDriftHistosByStation::name, cms::DDNamespace::name(), cms::DDAlgoArguments::parentName(), HGCalGeometryMode::Polyhedra, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, HGCalGeomTools::radius(), AlCaHLTBitMon_QueryRunRegistry::string, cond::impl::to_string(), cms::DDAlgoArguments::value(), and cms::DDNamespace::volume().

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

Member Function Documentation

void HGCalHEAlgo::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 307 of file DDHGCalHEAlgo.cc.

References funct::abs(), cms::DDNamespace::addSolidNS(), cms::DDNamespace::addVolumeNS(), cms::convert2mm(), filterCSVwithJSON::copy, HLT_FULL_cff::eta1, HLT_FULL_cff::eta2, cuy::ii, log, cms::DDNamespace::material(), mergeVDriftHistosByStation::name, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), and cond::impl::to_string().

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

Definition at line 477 of file DDHGCalHEAlgo.cc.

References funct::abs(), cms::convert2mm(), filterCSVwithJSON::copy, PVValHelper::dy, gpuVertexFinder::iv, HGCalParameters::k_CornerSize, N, nin, gpuPixelDoublets::ntot, HGCalTypes::packTypeUV(), PixelTestBeamValidation_cfi::Position, dttmaxenums::R, alignCSCRings::r, mathSSE::sqrt(), findQualityFiles::v, cms::DDNamespace::volume(), and HGCalGeomTools::waferCorner().

484  {
485  cms::DDNamespace ns(ctxt, e, true);
486  static const double sqrt3 = std::sqrt(3.0);
487  double r = 0.5 * (waferSize_ + waferSepar_);
488  double R = 2.0 * r / sqrt3;
489  double dy = 0.75 * R;
490  int N = (int)(0.5 * rout / r) + 2;
491  const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
492 #ifdef EDM_ML_DEBUG
493  int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0), nin(0);
494  std::vector<int> ntype(6, 0);
495  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog.name() << " rout " << cms::convert2mm(rout) << " N " << N
496  << " for maximum u, v Offset; Shift " << cms::convert2mm(xyoff.first) << ":"
497  << cms::convert2mm(xyoff.second) << " WaferSize "
499 #endif
500  for (int u = -N; u <= N; ++u) {
501  for (int v = -N; v <= N; ++v) {
502  int nr = 2 * v;
503  int nc = -2 * u + v;
504  double xpos = xyoff.first + nc * r;
505  double ypos = xyoff.second + nr * dy;
506  const auto& corner = HGCalGeomTools::waferCorner(xpos, ypos, r, R, rin, rout, false);
507 #ifdef EDM_ML_DEBUG
508  int iu = std::abs(u);
509  int iv = std::abs(v);
510  ++ntot;
511 #endif
512  if (corner.first > 0) {
513  int type = waferType_->getType((xpos / dd4hep::mm), (ypos / dd4hep::mm), (zpos / dd4hep::mm));
514  int copy = HGCalTypes::packTypeUV(type, u, v);
515 #ifdef EDM_ML_DEBUG
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 
533  dd4hep::Position tran(xpos, ypos, 0.0);
534  if (layertype > 1)
535  type += 3;
536  glog.placeVolume(ns.volume(waferNames_[type]), copy, tran);
537 
538 #ifdef EDM_ML_DEBUG
539  ++ntype[type];
540  edm::LogVerbatim("HGCalGeom")
541  << "DDHGCalHEAlgo: " << glog.name() << " number " << copy << " positioned in " << glog.name() << " at ("
542  << cms::convert2mm(xpos) << "," << cms::convert2mm(ypos) << ",0) with no rotation";
543 #endif
544  }
545  }
546  }
547  }
548 #ifdef EDM_ML_DEBUG
549  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Maximum # of u " << ium << ":" << iumAll << " # of v " << ivm
550  << ":" << ivmAll << " and " << nin << ":" << kount << ":" << ntot << " wafers ("
551  << ntype[0] << ":" << ntype[1] << ":" << ntype[2] << ":" << ntype[3] << ":"
552  << ntype[4] << ":" << ntype[5] << ") for " << glog.name() << " R "
553  << cms::convert2mm(rin) << ":" << cms::convert2mm(rout);
554 #endif
555  }
Log< level::Info, true > LogVerbatim
HGCalGeomTools geomTools_
std::unordered_set< int > copies_
int32_t *__restrict__ iv
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
double waferSepar_
static constexpr uint32_t k_CornerSize
int nin
std::vector< std::string > waferNames_
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
std::unique_ptr< HGCalWaferType > waferType_
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define N
Definition: blowfish.cc:9
double waferSize_
static int32_t packTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:3
__shared__ uint32_t ntot

Member Data Documentation

int HGCalHEAlgo::absorbMode_

Definition at line 572 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::alpha_

Definition at line 604 of file DDHGCalHEAlgo.cc.

int HGCalHEAlgo::choiceType_

Definition at line 591 of file DDHGCalHEAlgo.cc.

std::unordered_set<int> HGCalHEAlgo::copies_

Definition at line 603 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::copyNumber_

Definition at line 565 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::copyNumberBot_

Definition at line 583 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::copyNumberTop_

Definition at line 578 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::cosAlpha_

Definition at line 604 of file DDHGCalHEAlgo.cc.

int HGCalHEAlgo::firstLayer_

Definition at line 571 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::fracAreaMin_

Definition at line 593 of file DDHGCalHEAlgo.cc.

HGCalGeomTools HGCalHEAlgo::geomTools_

Definition at line 558 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerCenter_

Definition at line 585 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerNumbers_

Definition at line 566 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerSense_

Definition at line 570 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerSenseBot_

Definition at line 584 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::layerThick_

Definition at line 567 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::layerThickBot_

Definition at line 581 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::layerThickTop_

Definition at line 576 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerType_

Definition at line 569 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerTypeBot_

Definition at line 582 of file DDHGCalHEAlgo.cc.

std::vector<int> HGCalHEAlgo::layerTypeTop_

Definition at line 577 of file DDHGCalHEAlgo.cc.

std::vector<std::string> HGCalHEAlgo::materials_

Definition at line 562 of file DDHGCalHEAlgo.cc.

std::vector<std::string> HGCalHEAlgo::materialsBot_

Definition at line 579 of file DDHGCalHEAlgo.cc.

std::vector<std::string> HGCalHEAlgo::materialsTop_

Definition at line 574 of file DDHGCalHEAlgo.cc.

std::vector<std::string> HGCalHEAlgo::namesBot_

Definition at line 580 of file DDHGCalHEAlgo.cc.

std::vector<std::string> HGCalHEAlgo::namesTop_

Definition at line 575 of file DDHGCalHEAlgo.cc.

int HGCalHEAlgo::nCutRadPar_

Definition at line 592 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rad100to200_

Definition at line 588 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rad200to300_

Definition at line 589 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rMaxFront_

Definition at line 602 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rMinFront_

Definition at line 599 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::rMixLayer_

Definition at line 568 of file DDHGCalHEAlgo.cc.

int HGCalHEAlgo::sectors_

Definition at line 596 of file DDHGCalHEAlgo.cc.

int HGCalHEAlgo::sensitiveMode_

Definition at line 573 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::slopeB_

Definition at line 597 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::slopeT_

Definition at line 600 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::thickness_

Definition at line 564 of file DDHGCalHEAlgo.cc.

constexpr double HGCalHEAlgo::tol1_ = 0.01 * dd4hep::mm
static

Definition at line 606 of file DDHGCalHEAlgo.cc.

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

Definition at line 607 of file DDHGCalHEAlgo.cc.

std::vector<std::string> HGCalHEAlgo::volumeNames_

Definition at line 563 of file DDHGCalHEAlgo.cc.

std::vector<std::string> HGCalHEAlgo::waferNames_

Definition at line 561 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::waferSepar_

Definition at line 595 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::waferSize_

Definition at line 594 of file DDHGCalHEAlgo.cc.

std::unique_ptr<HGCalWaferType> HGCalHEAlgo::waferType_

Definition at line 559 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::zFrontB_

Definition at line 598 of file DDHGCalHEAlgo.cc.

std::vector<double> HGCalHEAlgo::zFrontT_

Definition at line 601 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::zMinBlock_

Definition at line 587 of file DDHGCalHEAlgo.cc.

double HGCalHEAlgo::zMinRadPar_

Definition at line 590 of file DDHGCalHEAlgo.cc.