CMS 3D CMS Logo

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

#include <DDHGCalHEAlgo.h>

Inheritance diagram for DDHGCalHEAlgo:

Public Member Functions

 DDHGCalHEAlgo ()
 
void execute (DDCompactView &cpv) override
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
 
 ~DDHGCalHEAlgo () 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, DDCompactView &cpv)
 
void positionSensitive (const DDLogicalPart &glog, double rin, double rout, int layertype, DDCompactView &cpv)
 
double rMax (double z)
 

Private Attributes

std::unordered_set< int > copies_
 
std::vector< int > copyNumber_
 
std::vector< int > copyNumberBot_
 
std::vector< int > copyNumberTop_
 
int firstLayer_
 
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_
 
double rMaxFine_
 
std::vector< double > rMaxFront_
 
double rMinThick_
 
std::vector< double > rMixLayer_
 
int sectors_
 
std::vector< double > slopeB_
 
std::vector< double > slopeT_
 
std::vector< double > thick_
 
std::vector< std::string > wafers_
 
double waferSepar_
 
double waferSize_
 
std::vector< double > zFront_
 
double zMinBlock_
 

Detailed Description

Definition at line 12 of file DDHGCalHEAlgo.h.

Constructor & Destructor Documentation

DDHGCalHEAlgo::DDHGCalHEAlgo ( )

Definition at line 17 of file DDHGCalHEAlgo.cc.

17  {
18 #ifdef EDM_ML_DEBUG
19  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Creating an instance";
20 #endif
21 }
DDHGCalHEAlgo::~DDHGCalHEAlgo ( )
override

Definition at line 23 of file DDHGCalHEAlgo.cc.

23 {}

Member Function Documentation

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

Definition at line 190 of file DDHGCalHEAlgo.cc.

References alpha, popcon2dropbox::copy(), copyNumber_, funct::cos(), DDBase< N, C >::ddname(), DDSplit(), plotBeamSpotDB::first, mps_fire::i, cuy::ii, gen::k, layers_, layerSense_, layerThick_, layerType_, materials_, dataset::name, DDBase< N, C >::name(), names_, nameSpace_, pi, DDSolidFactory::polyhedra(), DDCompactView::position(), positionMix(), diffTwoXMLs::r1, rMax(), rMixLayer_, makeMuonMisalignmentScenario::rot, edm::second(), sectors_, slopeB_, AlCaHLTBitMon_QueryRunRegistry::string, thick_, DDSolidFactory::tubs(), zMinBlock_, and geometryCSVtoXML::zz.

Referenced by execute().

191  {
192 
193 #ifdef EDM_ML_DEBUG
194  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: \t\tInside Layers";
195 #endif
196  double zi(zMinBlock_);
197  int laymin(0);
198  const double tol(0.01);
199  for (unsigned int i=0; i<layers_.size(); i++) {
200  double zo = zi + layerThick_[i];
201  double routF = rMax(zi);
202  int laymax = laymin+layers_[i];
203  double zz = zi;
204  double thickTot(0);
205  std::vector<double> pgonZ(2), pgonRin(2), pgonRout(2);
206  for (int ly=laymin; ly<laymax; ++ly) {
207  int ii = layerType_[ly];
208  int copy = copyNumber_[ii];
209  double hthick = 0.5*thick_[ii];
210  double rinB = (layerSense_[ly] == 0) ? (zo*slopeB_[0]) :
211  (zo*slopeB_[1]);
212  zz += hthick;
213  thickTot += thick_[ii];
214 
215  std::string name = "HGCal"+names_[ii]+std::to_string(copy);
216 #ifdef EDM_ML_DEBUG
217  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":"
218  << ii << " Front " << zi << ", " << routF
219  << " Back " << zo << ", " << rinB
220  << " superlayer thickness "
221  << layerThick_[i];
222 #endif
223  DDName matName(DDSplit(materials_[ii]).first,
224  DDSplit(materials_[ii]).second);
225  DDMaterial matter(matName);
226  DDLogicalPart glog;
227  if (layerSense_[ly] == 0) {
228  double alpha = CLHEP::pi/sectors_;
229  double rmax = routF*cos(alpha) - tol;
230  pgonZ[0] =-hthick; pgonZ[1] = hthick;
231  pgonRin[0] = rinB; pgonRin[1] = rinB;
232  pgonRout[0] = rmax; pgonRout[1] = rmax;
234  sectors_,-alpha,CLHEP::twopi,
235  pgonZ, pgonRin, pgonRout);
236  glog = DDLogicalPart(solid.ddname(), matter, solid);
237 #ifdef EDM_ML_DEBUG
238  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
239  << " polyhedra of " << sectors_
240  << " sectors covering "
241  << -alpha/CLHEP::deg << ":"
242  << (-alpha+CLHEP::twopi)/CLHEP::deg
243  << " with " << pgonZ.size()<<" sections";
244  for (unsigned int k=0; k<pgonZ.size(); ++k)
245  edm::LogVerbatim("HGCalGeom") << "[" << k << "] z " << pgonZ[k]
246  << " R " << pgonRin[k] << ":"
247  << pgonRout[k];
248 #endif
249  } else {
251  hthick, rinB, routF, 0.0,
252  CLHEP::twopi);
253  glog = DDLogicalPart(solid.ddname(), matter, solid);
254 #ifdef EDM_ML_DEBUG
255  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
256  << " Tubs made of " << matName
257  << " of dimensions " << rinB
258  << ", " << routF << ", " << hthick
259  << ", 0.0, " << CLHEP::twopi/CLHEP::deg;
260  edm::LogVerbatim("HGCalGeom") << "Position in: " << glog.name()
261  << " number " << copy;
262 #endif
263  positionMix(glog, name, copy, thick_[ii], matter, rinB, rMixLayer_[i],
264  routF, cpv);
265  }
266  DDTranslation r1(0,0,zz);
267  DDRotation rot;
268  cpv.position(glog, module, copy, r1, rot);
269  ++copyNumber_[ii];
270 #ifdef EDM_ML_DEBUG
271  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog.name()
272  << " number " << copy
273  << " positioned in " << module.name()
274  << " at " << r1 << " with " << rot;
275 #endif
276  zz += hthick;
277  } // End of loop over layers in a block
278  zi = zo;
279  laymin = laymax;
280  if (fabs(thickTot-layerThick_[i]) < 0.00001) {
281  } else if (thickTot > layerThick_[i]) {
282  edm::LogError("HGCalGeom") << "Thickness of the partition "
283  << layerThick_[i] << " is smaller than "
284  << thickTot << ": thickness of all its "
285  << "components **** ERROR ****";
286  } else if (thickTot < layerThick_[i]) {
287  edm::LogWarning("HGCalGeom") << "Thickness of the partition "
288  << layerThick_[i] << " does not match with "
289  << thickTot << " of the components";
290  }
291  } // End of loop over blocks
292 }
std::vector< double > rMixLayer_
Definition: DDHGCalHEAlgo.h:47
float alpha
Definition: AMPTWrapper.h:95
const N & name() const
Definition: DDBase.h:78
double rMax(double z)
double zMinBlock_
Definition: DDHGCalHEAlgo.h:63
def copy(args, dbName)
std::vector< double > slopeB_
Definition: DDHGCalHEAlgo.h:69
std::vector< std::string > materials_
Definition: DDHGCalHEAlgo.h:41
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
std::string nameSpace_
Definition: DDHGCalHEAlgo.h:73
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
std::vector< double > thick_
Definition: DDHGCalHEAlgo.h:43
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
const Double_t pi
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
U second(std::pair< T, U > const &p)
std::vector< int > layerSense_
Definition: DDHGCalHEAlgo.h:49
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:986
std::vector< int > layers_
Definition: DDHGCalHEAlgo.h:45
ii
Definition: cuy.py:588
int k[5][pyjets_maxn]
void positionMix(const DDLogicalPart &glog, const std::string &name, int copy, double thick, const DDMaterial &matter, double rin, double rmid, double routF, DDCompactView &cpv)
std::vector< int > copyNumber_
Definition: DDHGCalHEAlgo.h:44
std::vector< int > layerType_
Definition: DDHGCalHEAlgo.h:48
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::vector< double > layerThick_
Definition: DDHGCalHEAlgo.h:46
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:846
std::vector< std::string > names_
Definition: DDHGCalHEAlgo.h:42
const N & ddname() const
Definition: DDBase.h:80
void DDHGCalHEAlgo::execute ( DDCompactView cpv)
override

Definition at line 170 of file DDHGCalHEAlgo.cc.

References constructLayers(), copies_, gen::k, and class-composition::parent.

170  {
171 
172 #ifdef EDM_ML_DEBUG
173  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalHEAlgo...";
174  copies_.clear();
175 #endif
176  constructLayers (parent(), cpv);
177 #ifdef EDM_ML_DEBUG
178  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << copies_.size()
179  << " different wafer copy numbers";
180  int k(0);
181  for (std::unordered_set<int>::const_iterator itr=copies_.begin();
182  itr != copies_.end(); ++itr,++k) {
183  edm::LogVerbatim("HGCalGeom") << "Copy [" << k << "] : " << (*itr);
184  }
185  copies_.clear();
186  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalHEAlgo construction...";
187 #endif
188 }
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
int k[5][pyjets_maxn]
std::unordered_set< int > copies_
Definition: DDHGCalHEAlgo.h:74
void DDHGCalHEAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 25 of file DDHGCalHEAlgo.cc.

References copyNumber_, copyNumberBot_, copyNumberTop_, dbl_to_int(), firstLayer_, mps_fire::i, cuy::ii, createfilelist::int, layers_, layerSense_, layerSenseBot_, layerThick_, layerThickBot_, layerThickTop_, layerType_, layerTypeBot_, layerTypeTop_, materials_, materialsBot_, materialsTop_, names_, namesBot_, nameSpace_, namesTop_, DDCurrentNamespace::ns(), rMaxFine_, rMaxFront_, rMinThick_, rMixLayer_, sectors_, slopeB_, slopeT_, thick_, wafers_, waferSepar_, waferSize_, zFront_, and zMinBlock_.

29  {
30 
31  wafers_ = vsArgs["WaferNames"];
32 #ifdef EDM_ML_DEBUG
33  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << wafers_.size()
34  << " wafers";
35  for (unsigned int i=0; i<wafers_.size(); ++i)
36  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << wafers_[i];
37 #endif
38  materials_ = vsArgs["MaterialNames"];
39  names_ = vsArgs["VolumeNames"];
40  thick_ = vArgs["Thickness"];
41  for (unsigned int i=0; i<materials_.size(); ++i) {
42  copyNumber_.emplace_back(1);
43  }
44 #ifdef EDM_ML_DEBUG
45  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << materials_.size()
46  << " types of volumes";
47  for (unsigned int i=0; i<names_.size(); ++i)
48  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names_[i]
49  << " of thickness " << thick_[i]
50  << " filled with " << materials_[i]
51  << " first copy number " << copyNumber_[i];
52 #endif
53  layers_ = dbl_to_int(vArgs["Layers"]);
54  layerThick_ = vArgs["LayerThick"];
55  rMixLayer_ = vArgs["LayerRmix"];
56 #ifdef EDM_ML_DEBUG
57  edm::LogVerbatim("HGCalGeom") << "There are " << layers_.size() << " blocks";
58  for (unsigned int i=0; i<layers_.size(); ++i)
59  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness "
60  << layerThick_[i] << " Rmid " <<rMixLayer_[i]
61  << " with " << layers_[i] << " layers";
62 #endif
63  layerType_ = dbl_to_int(vArgs["LayerType"]);
64  layerSense_ = dbl_to_int(vArgs["LayerSense"]);
65  firstLayer_ = (int)(nArgs["FirstLayer"]);
66  if (firstLayer_ > 0) {
67  for (unsigned int i=0; i<layerType_.size(); ++i) {
68  if (layerSense_[i] != 0) {
69  int ii = layerType_[i];
70  copyNumber_[ii] = firstLayer_;
71 #ifdef EDM_ML_DEBUG
72  edm::LogVerbatim("HGCalGeom") << "First copy number for layer type "
73  << i << ":" << ii << " with "
74  << materials_[ii] << " changed to "
75  << copyNumber_[ii];
76 #endif
77  break;
78  }
79  }
80  }
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("HGCalGeom") << "There are " << layerType_.size()
83  << " layers" ;
84  for (unsigned int i=0; i<layerType_.size(); ++i)
85  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type "
86  << layerType_[i] << " sensitive class "
87  << layerSense_[i];
88 #endif
89  materialsTop_ = vsArgs["TopMaterialNames"];
90  namesTop_ = vsArgs["TopVolumeNames"];
91  layerThickTop_= vArgs["TopLayerThickness"];
92  layerTypeTop_ = dbl_to_int(vArgs["TopLayerType"]);
93  for (unsigned int i=0; i<materialsTop_.size(); ++i) {
94  copyNumberTop_.emplace_back(1);
95  }
96 #ifdef EDM_ML_DEBUG
97  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << materialsTop_.size()
98  << " types of volumes in the top part";
99  for (unsigned int i=0; i<materialsTop_.size(); ++i)
100  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesTop_[i]
101  << " of thickness " << layerThickTop_[i]
102  << " filled with " << materialsTop_[i]
103  << " first copy number " <<copyNumberTop_[i];
104  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeTop_.size()
105  << " layers in the top part" ;
106  for (unsigned int i=0; i<layerTypeTop_.size(); ++i)
107  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type "
108  << layerTypeTop_[i];
109 #endif
110  materialsBot_ = vsArgs["BottomMaterialNames"];
111  namesBot_ = vsArgs["BottomVolumeNames"];
112  layerTypeBot_ = dbl_to_int(vArgs["BottomLayerType"]);
113  layerSenseBot_= dbl_to_int(vArgs["BottomLayerSense"]);
114  layerThickBot_= vArgs["BottomLayerThickness"];
115  for (unsigned int i=0; i<materialsBot_.size(); ++i) {
116  copyNumberBot_.emplace_back(1);
117  }
118 #ifdef EDM_ML_DEBUG
119  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << materialsBot_.size()
120  << " types of volumes in the bottom part";
121  for (unsigned int i=0; i<materialsBot_.size(); ++i)
122  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesBot_[i]
123  << " of thickness " << layerThickBot_[i]
124  << " filled with " << materialsBot_[i]
125  << " first copy number " <<copyNumberBot_[i];
126  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeBot_.size()
127  << " layers in the top part" ;
128  for (unsigned int i=0; i<layerTypeBot_.size(); ++i)
129  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type "
130  << layerTypeBot_[i] << " sensitive class "
131  << layerSenseBot_[i];
132 #endif
133  zMinBlock_ = nArgs["zMinBlock"];
134  rMaxFine_ = nArgs["rMaxFine"];
135  rMinThick_ = nArgs["rMinThick"];
136  waferSize_ = nArgs["waferSize"];
137  waferSepar_ = nArgs["SensorSeparation"];
138  sectors_ = (int)(nArgs["Sectors"]);
139 #ifdef EDM_ML_DEBUG
140  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: zStart " << zMinBlock_
141  << " rFineCoarse " << rMaxFine_
142  << " rMaxThick " << rMinThick_
143  << " wafer width " << waferSize_
144  << " separations " << waferSepar_
145  << " sectors " << sectors_;
146 #endif
147  slopeB_ = vArgs["SlopeBottom"];
148  slopeT_ = vArgs["SlopeTop"];
149  zFront_ = vArgs["ZFront"];
150  rMaxFront_ = vArgs["RMaxFront"];
151 #ifdef EDM_ML_DEBUG
152  edm::LogVerbatim("HGCalGeom") << "Bottom slopes " << slopeB_[0] << ":"
153  << slopeB_[1] << " and " << slopeT_.size()
154  << " slopes for top" ;
155  for (unsigned int i=0; i<slopeT_.size(); ++i)
156  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFront_[i]
157  << " Rmax " << rMaxFront_[i] << " Slope "
158  << slopeT_[i];
159 #endif
161 #ifdef EDM_ML_DEBUG
162  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: NameSpace " << nameSpace_;
163 #endif
164 }
std::vector< double > rMixLayer_
Definition: DDHGCalHEAlgo.h:47
std::vector< int > layerTypeTop_
Definition: DDHGCalHEAlgo.h:54
std::vector< double > layerThickBot_
Definition: DDHGCalHEAlgo.h:58
double zMinBlock_
Definition: DDHGCalHEAlgo.h:63
std::vector< double > slopeB_
Definition: DDHGCalHEAlgo.h:69
std::vector< std::string > materials_
Definition: DDHGCalHEAlgo.h:41
double rMaxFine_
Definition: DDHGCalHEAlgo.h:64
std::string nameSpace_
Definition: DDHGCalHEAlgo.h:73
double rMinThick_
Definition: DDHGCalHEAlgo.h:65
static std::string & ns()
std::vector< double > thick_
Definition: DDHGCalHEAlgo.h:43
std::vector< std::string > namesTop_
Definition: DDHGCalHEAlgo.h:52
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 > layerSense_
Definition: DDHGCalHEAlgo.h:49
std::vector< int > copyNumberBot_
Definition: DDHGCalHEAlgo.h:60
std::vector< std::string > materialsBot_
Definition: DDHGCalHEAlgo.h:56
std::vector< double > slopeT_
Definition: DDHGCalHEAlgo.h:70
std::vector< int > layers_
Definition: DDHGCalHEAlgo.h:45
ii
Definition: cuy.py:588
std::vector< double > layerThickTop_
Definition: DDHGCalHEAlgo.h:53
std::vector< int > copyNumber_
Definition: DDHGCalHEAlgo.h:44
double waferSepar_
Definition: DDHGCalHEAlgo.h:67
std::vector< int > layerType_
Definition: DDHGCalHEAlgo.h:48
std::vector< std::string > materialsTop_
Definition: DDHGCalHEAlgo.h:51
std::vector< double > zFront_
Definition: DDHGCalHEAlgo.h:71
std::vector< int > copyNumberTop_
Definition: DDHGCalHEAlgo.h:55
std::vector< int > layerSenseBot_
Definition: DDHGCalHEAlgo.h:61
std::vector< std::string > wafers_
Definition: DDHGCalHEAlgo.h:40
std::vector< std::string > namesBot_
Definition: DDHGCalHEAlgo.h:57
std::vector< double > layerThick_
Definition: DDHGCalHEAlgo.h:46
std::vector< std::string > names_
Definition: DDHGCalHEAlgo.h:42
std::vector< int > layerTypeBot_
Definition: DDHGCalHEAlgo.h:59
std::vector< double > rMaxFront_
Definition: DDHGCalHEAlgo.h:72
double waferSize_
Definition: DDHGCalHEAlgo.h:66
void DDHGCalHEAlgo::positionMix ( const DDLogicalPart glog,
const std::string &  name,
int  copy,
double  thick,
const DDMaterial matter,
double  rin,
double  rmid,
double  routF,
DDCompactView cpv 
)
protected

Definition at line 313 of file DDHGCalHEAlgo.cc.

References popcon2dropbox::copy(), copyNumberBot_, copyNumberTop_, DDBase< N, C >::ddname(), DDSplit(), plotBeamSpotDB::first, cuy::ii, layerSenseBot_, layerThickBot_, layerThickTop_, layerTypeBot_, layerTypeTop_, materialsBot_, materialsTop_, dataset::name, DDBase< N, C >::name(), namesBot_, nameSpace_, namesTop_, DDCompactView::position(), positionSensitive(), diffTwoXMLs::r1, makeMuonMisalignmentScenario::rot, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, and DDSolidFactory::tubs().

Referenced by constructLayers().

317  {
318 
319  DDLogicalPart glog1;
320  DDTranslation tran;
321  DDRotation rot;
322  for (unsigned int ly=0; ly<layerTypeTop_.size(); ++ly) {
323  int ii = layerTypeTop_[ly];
324  copyNumberTop_[ii] = copyM;
325  }
326  for (unsigned int ly=0; ly<layerTypeBot_.size(); ++ly) {
327  int ii = layerTypeBot_[ly];
328  copyNumberBot_[ii] = copyM;
329  }
330  double hthick = 0.5*thick;
331  // Make the top part first
332  std::string name = nameM+"Top";
334  hthick, rmid, rout, 0.0,
335  CLHEP::twopi);
336  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
337 #ifdef EDM_ML_DEBUG
338  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
339  << " Tubs made of " << matter.name()
340  << " of dimensions " << rmid << ", " << rout
341  << ", " << hthick << ", 0.0, "
342  << CLHEP::twopi/CLHEP::deg;
343 #endif
344  cpv.position(glog1, glog, 1, tran, rot);
345 #ifdef EDM_ML_DEBUG
346  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog1.name()
347  << " number 1 positioned in " << glog.name()
348  << " at " << tran << " with " << rot;
349 #endif
350  double thickTot(0), zpos(-hthick);
351  for (unsigned int ly=0; ly<layerTypeTop_.size(); ++ly) {
352  int ii = layerTypeTop_[ly];
353  int copy = copyNumberTop_[ii];
354  double hthickl = 0.5*layerThickTop_[ii];
355  thickTot += layerThickTop_[ii];
356  name = nameM+namesTop_[ii]+std::to_string(copy);
357 #ifdef EDM_ML_DEBUG
358  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii
359  << " R " << rmid << ":" << rout << " Thick "
360  << layerThickTop_[ii];
361 #endif
362  DDName matName(DDSplit(materialsTop_[ii]).first,
364  DDMaterial matter1(matName);
365  solid = DDSolidFactory::tubs(DDName(name,nameSpace_), hthickl, rmid, rout,
366  0.0, CLHEP::twopi);
367  DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid);
368 #ifdef EDM_ML_DEBUG
369  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
370  << " Tubs made of " << matName
371  << " of dimensions " << rmid << ", " << rout
372  << ", " << hthickl <<", 0.0, "
373  << CLHEP::twopi/CLHEP::deg;
374 #endif
375  zpos += hthickl;
376  DDTranslation r1(0,0,zpos);
377  cpv.position(glog2, glog1, copy, r1, rot);
378 #ifdef EDM_ML_DEBUG
379  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Position " << glog2.name()
380  << " number " << copy << " in "
381  << glog1.name() << " at " << r1
382  << " with " << rot;
383 #endif
384  ++copyNumberTop_[ii];
385  zpos += hthickl;
386  }
387  if (fabs(thickTot-thick) < 0.00001) {
388  } else if (thickTot > thick) {
389  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick
390  << " is smaller than " << thickTot
391  << ": thickness of all its components in "
392  << "the top part **** ERROR ****";
393  } else if (thickTot < thick) {
394  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick
395  << " does not match with " << thickTot
396  << " of the components in top part";
397  }
398 
399  // Make the bottom part next
400  name = nameM+"Bottom";
401  solid = DDSolidFactory::tubs(DDName(name, nameSpace_),
402  hthick, rin, rmid, 0.0, CLHEP::twopi);
403  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
404 #ifdef EDM_ML_DEBUG
405  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
406  << " Tubs made of " << matter.name()
407  << " of dimensions " << rin << ", " << rmid
408  << ", " << hthick << ", 0.0, "
409  << CLHEP::twopi/CLHEP::deg;
410 #endif
411  cpv.position(glog1, glog, 1, tran, rot);
412 #ifdef EDM_ML_DEBUG
413  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog1.name()
414  << " number 1 positioned in " << glog.name()
415  << " at " << tran << " with " << rot;
416 #endif
417  thickTot = 0;
418  zpos =-hthick;
419  for (unsigned int ly=0; ly<layerTypeBot_.size(); ++ly) {
420  int ii = layerTypeBot_[ly];
421  int copy = copyNumberBot_[ii];
422  double hthickl = 0.5*layerThickBot_[ii];
423  thickTot += layerThickBot_[ii];
424  name = nameM+namesBot_[ii]+std::to_string(copy);
425 #ifdef EDM_ML_DEBUG
426  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii
427  << " R " << rin << ":" << rmid << " Thick "
428  << layerThickBot_[ii];
429 #endif
430  DDName matName(DDSplit(materialsBot_[ii]).first,
432  DDMaterial matter1(matName);
433  solid = DDSolidFactory::tubs(DDName(name,nameSpace_), hthickl, rin, rmid,
434  0.0, CLHEP::twopi);
435  DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid);
436 #ifdef EDM_ML_DEBUG
437  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
438  << " Tubs made of " << matName
439  << " of dimensions " << rin << ", " << rmid
440  << ", " << hthickl <<", 0.0, "
441  << CLHEP::twopi/CLHEP::deg;
442 #endif
443  zpos += hthickl;
444  DDTranslation r1(0,0,zpos);
445  cpv.position(glog2, glog1, copy, r1, rot);
446 #ifdef EDM_ML_DEBUG
447  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Position " << glog2.name()
448  << " number " << copy << " in "
449  << glog1.name() << " at " << r1
450  << " with " << rot;
451 #endif
452  zpos += hthickl;
453  ++copyNumberBot_[ii];
454  if (layerSenseBot_[ly] != 0)
455  positionSensitive(glog2,rin,rmid,layerSenseBot_[ly],cpv);
456  }
457  if (fabs(thickTot-thick) < 0.00001) {
458  } else if (thickTot > thick) {
459  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick
460  << " is smaller than " << thickTot
461  << ": thickness of all its components in "
462  << "the top part **** ERROR ****";
463  } else if (thickTot < thick) {
464  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick
465  << " does not match with " << thickTot
466  << " of the components in top part";
467  }
468 }
std::vector< int > layerTypeTop_
Definition: DDHGCalHEAlgo.h:54
std::vector< double > layerThickBot_
Definition: DDHGCalHEAlgo.h:58
const N & name() const
Definition: DDBase.h:78
def copy(args, dbName)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
std::string nameSpace_
Definition: DDHGCalHEAlgo.h:73
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
std::vector< std::string > namesTop_
Definition: DDHGCalHEAlgo.h:52
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
U second(std::pair< T, U > const &p)
std::vector< int > copyNumberBot_
Definition: DDHGCalHEAlgo.h:60
std::vector< std::string > materialsBot_
Definition: DDHGCalHEAlgo.h:56
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:986
ii
Definition: cuy.py:588
std::vector< double > layerThickTop_
Definition: DDHGCalHEAlgo.h:53
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< std::string > materialsTop_
Definition: DDHGCalHEAlgo.h:51
std::vector< int > copyNumberTop_
Definition: DDHGCalHEAlgo.h:55
void positionSensitive(const DDLogicalPart &glog, double rin, double rout, int layertype, DDCompactView &cpv)
std::vector< int > layerSenseBot_
Definition: DDHGCalHEAlgo.h:61
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::vector< std::string > namesBot_
Definition: DDHGCalHEAlgo.h:57
std::vector< int > layerTypeBot_
Definition: DDHGCalHEAlgo.h:59
const N & ddname() const
Definition: DDBase.h:80
void DDHGCalHEAlgo::positionSensitive ( const DDLogicalPart glog,
double  rin,
double  rout,
int  layertype,
DDCompactView cpv 
)
protected

Definition at line 470 of file DDHGCalHEAlgo.cc.

References funct::abs(), copies_, popcon2dropbox::copy(), DDBase< N, C >::ddname(), DDSplit(), PVValHelper::dy, plotBeamSpotDB::first, createfilelist::int, gen::k, N, dataset::name, nin, DDCompactView::position(), dttmaxenums::R, alignCSCRings::r, rMaxFine_, rMinThick_, idealTransformation::rotation, edm::second(), mathSSE::sqrt(), findQualityFiles::v, wafers_, waferSepar_, and waferSize_.

Referenced by positionMix().

472  {
473  static const double sqrt3 = std::sqrt(3.0);
474  double r = 0.5*(waferSize_ + waferSepar_);
475  double R = 2.0*r/sqrt3;
476  double dy = 0.75*R;
477  int N = (int)(0.5*rout/r) + 2;
478  double xc[6], yc[6];
479 #ifdef EDM_ML_DEBUG
480  int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0), nin(0);
481  std::vector<int> ntype(6,0);
482  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog.ddname()
483  << " rout " << rout << " N " << N
484  << " for maximum u, v";
485 #endif
486  for (int u = -N; u <= N; ++u) {
487  int iu = std::abs(u);
488  for (int v = -N; v <= N; ++v) {
489  int iv = std::abs(v);
490  int nr = 2*v;
491  int nc =-2*u+v;
492  double xpos = nc*r;
493  double ypos = nr*dy;
494  xc[0] = xpos+r; yc[0] = ypos+0.5*R;
495  xc[1] = xpos; yc[1] = ypos+R;
496  xc[2] = xpos-r; yc[2] = ypos+0.5*R;
497  xc[3] = xpos-r; yc[3] = ypos-0.5*R;
498  xc[4] = xpos; yc[4] = ypos-R;
499  xc[5] = xpos+r; yc[5] = ypos-0.5*R;
500  bool cornerOne(false), cornerAll(true);
501  for (int k=0; k<6; ++k) {
502  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
503  if (rpos >= rin && rpos <= rout) cornerOne = true;
504  else cornerAll = false;
505  }
506 #ifdef EDM_ML_DEBUG
507  ++ntot;
508 #endif
509  if (cornerOne) {
510  int copy = iv*100 + iu;
511  if (u < 0) copy += 10000;
512  if (v < 0) copy += 100000;
513 #ifdef EDM_ML_DEBUG
514  if (iu > ium) ium = iu;
515  if (iv > ivm) ivm = iv;
516  kount++;
517  if (copies_.count(copy) == 0) copies_.insert(copy);
518 #endif
519  if (cornerAll) {
520 #ifdef EDM_ML_DEBUG
521  if (iu > iumAll) iumAll = iu;
522  if (iv > ivmAll) ivmAll = iv;
523  ++nin;
524 #endif
525  double rpos = std::sqrt(xpos*xpos+ypos*ypos);
526  DDTranslation tran(xpos, ypos, 0.0);
528  int type = (rpos < rMaxFine_) ? 0 : ((rpos < rMinThick_) ? 1 : 2);
529  if (layertype > 1) type += 3;
531  DDSplit(wafers_[type]).second);
532  cpv.position(name, glog.ddname(), copy, tran, rotation);
533 #ifdef EDM_ML_DEBUG
534  ++ntype[type];
535  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << name
536  << " number " << copy
537  << " positioned in " << glog.ddname()
538  << " at " << tran
539  << " with " << rotation;
540 #endif
541  }
542  }
543  }
544  }
545 #ifdef EDM_ML_DEBUG
546  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Maximum # of u " << ium
547  << ":" << iumAll << " # of v " << ivm << ":"
548  << ivmAll << " and " << nin << ":" << kount
549  << ":" << ntot << " wafers (" << ntype[0]
550  << ":" << ntype[1] << ":" << ntype[2] << ":"
551  << ntype[3] << ":" << ntype[4] << ":"
552  << ntype[5] << ") for " << glog.ddname()
553  << " R " << rin << ":" << rout;
554 #endif
555 }
type
Definition: HCALResponse.h:21
def copy(args, dbName)
double rMaxFine_
Definition: DDHGCalHEAlgo.h:64
double rMinThick_
Definition: DDHGCalHEAlgo.h:65
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
int nin
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
U second(std::pair< T, U > const &p)
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
#define N
Definition: blowfish.cc:9
std::unordered_set< int > copies_
Definition: DDHGCalHEAlgo.h:74
double waferSepar_
Definition: DDHGCalHEAlgo.h:67
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::vector< std::string > wafers_
Definition: DDHGCalHEAlgo.h:40
double waferSize_
Definition: DDHGCalHEAlgo.h:66
const N & ddname() const
Definition: DDBase.h:80
double DDHGCalHEAlgo::rMax ( double  z)
protected

Definition at line 294 of file DDHGCalHEAlgo.cc.

References gen::k, alignCSCRings::r, rMaxFront_, slopeT_, and zFront_.

Referenced by constructLayers().

294  {
295  double r(0);
296 #ifdef EDM_ML_DEBUG
297  unsigned int ik(0);
298 #endif
299  for (unsigned int k=0; k<slopeT_.size(); ++k) {
300  if (z < zFront_[k]) break;
301  r = rMaxFront_[k] + (z - zFront_[k]) * slopeT_[k];
302 #ifdef EDM_ML_DEBUG
303  ik = k;
304 #endif
305  }
306 #ifdef EDM_ML_DEBUG
307  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: rMax : " << z << ":" << ik
308  << ":" << r;
309 #endif
310  return r;
311 }
std::vector< double > slopeT_
Definition: DDHGCalHEAlgo.h:70
int k[5][pyjets_maxn]
std::vector< double > zFront_
Definition: DDHGCalHEAlgo.h:71
std::vector< double > rMaxFront_
Definition: DDHGCalHEAlgo.h:72

Member Data Documentation

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

Definition at line 74 of file DDHGCalHEAlgo.h.

Referenced by execute(), and positionSensitive().

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

Definition at line 44 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 60 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

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

Definition at line 55 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

int DDHGCalHEAlgo::firstLayer_
private

Definition at line 50 of file DDHGCalHEAlgo.h.

Referenced by initialize().

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

Definition at line 45 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 49 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 61 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

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

Definition at line 46 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 58 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

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

Definition at line 53 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

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

Definition at line 48 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 59 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

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

Definition at line 54 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

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

Definition at line 41 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 56 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

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

Definition at line 51 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

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

Definition at line 42 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 57 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

std::string DDHGCalHEAlgo::nameSpace_
private

Definition at line 73 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), initialize(), and positionMix().

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

Definition at line 52 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionMix().

double DDHGCalHEAlgo::rMaxFine_
private

Definition at line 64 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionSensitive().

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

Definition at line 72 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and rMax().

double DDHGCalHEAlgo::rMinThick_
private

Definition at line 65 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionSensitive().

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

Definition at line 47 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

int DDHGCalHEAlgo::sectors_
private

Definition at line 68 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 69 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 70 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and rMax().

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

Definition at line 43 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 40 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionSensitive().

double DDHGCalHEAlgo::waferSepar_
private

Definition at line 67 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionSensitive().

double DDHGCalHEAlgo::waferSize_
private

Definition at line 66 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and positionSensitive().

std::vector<double> DDHGCalHEAlgo::zFront_
private

Definition at line 71 of file DDHGCalHEAlgo.h.

Referenced by initialize(), and rMax().

double DDHGCalHEAlgo::zMinBlock_
private

Definition at line 63 of file DDHGCalHEAlgo.h.

Referenced by constructLayers(), and initialize().