CMS 3D CMS Logo

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

Public Member Functions

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

Protected Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 31 of file DDHGCalModuleAlgo.cc.

Constructor & Destructor Documentation

DDHGCalModuleAlgo::DDHGCalModuleAlgo ( )

Definition at line 73 of file DDHGCalModuleAlgo.cc.

73  {
74 #ifdef EDM_ML_DEBUG
75  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: Creating an instance";
76 #endif
77 }
DDHGCalModuleAlgo::~DDHGCalModuleAlgo ( )
override

Definition at line 79 of file DDHGCalModuleAlgo.cc.

79 {}

Member Function Documentation

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

Definition at line 166 of file DDHGCalModuleAlgo.cc.

References zMuMuMuonUserData::alpha, angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), DDBase< N, C >::ddname(), DDSplit(), dqmdumpme::first, mps_fire::i, cuy::ii, dqmdumpme::k, hgcalTopologyTester_cfi::layers, Skims_PA_cff::name, DDBase< N, C >::name(), names, angle_units::piRadians(), DDSolidFactory::polyhedra(), DDCompactView::position(), diffTwoXMLs::r1, photonAnalyzer_cfi::rMax, makeMuonMisalignmentScenario::rot, edm::second(), volumeBasedMagneticField_1103l_cfi::sectors, AlCaHLTBitMon_QueryRunRegistry::string, DDSolidFactory::tubs(), and geometryCSVtoXML::zz.

166  {
167 #ifdef EDM_ML_DEBUG
168  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo test: \t\tInside Layers";
169 #endif
170  double zi(zMinBlock);
171  int laymin(0);
172  const double tol(0.01);
173  for (unsigned int i = 0; i < layers.size(); i++) {
174  double zo = zi + layerThick[i];
175  double routF = rMax(zi);
176  int laymax = laymin + layers[i];
177  double zz = zi;
178  double thickTot(0);
179  for (int ly = laymin; ly < laymax; ++ly) {
180  int ii = layerType[ly];
181  int copy = copyNumber[ii];
182  double rinB = (layerSense[ly] == 0) ? (zo * slopeB[0]) : (zo * slopeB[1]);
183  zz += (0.5 * thick[ii]);
184  thickTot += thick[ii];
185 
186  std::string name = "HGCal" + names[ii] + std::to_string(copy);
187 #ifdef EDM_ML_DEBUG
188  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo test: Layer " << ly << ":" << ii << " Front " << zi << ", "
189  << routF << " Back " << zo << ", " << rinB << " superlayer thickness "
190  << layerThick[i];
191 #endif
192  DDName matName(DDSplit(materials[ii]).first, DDSplit(materials[ii]).second);
193  DDMaterial matter(matName);
194  DDLogicalPart glog;
195  if (layerSense[ly] == 0) {
197  double rmax = routF * cos(alpha) - tol;
198  std::vector<double> pgonZ, pgonRin, pgonRout;
199  pgonZ.emplace_back(-0.5 * thick[ii]);
200  pgonZ.emplace_back(0.5 * thick[ii]);
201  pgonRin.emplace_back(rinB);
202  pgonRin.emplace_back(rinB);
203  pgonRout.emplace_back(rmax);
204  pgonRout.emplace_back(rmax);
206  DDName(name, idNameSpace), sectors, -alpha, 2 * geant_units::piRadians, pgonZ, pgonRin, pgonRout);
207  glog = DDLogicalPart(solid.ddname(), matter, solid);
208 #ifdef EDM_ML_DEBUG
209  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: " << solid.name() << " polyhedra of " << sectors
210  << " sectors covering " << convertRadToDeg(-alpha) << ":"
211  << (360.0 + convertRadToDeg(-alpha)) << " with " << pgonZ.size() << " sections";
212  for (unsigned int k = 0; k < pgonZ.size(); ++k)
213  edm::LogVerbatim("HGCalGeom") << "[" << k << "] z " << pgonZ[k] << " R " << pgonRin[k] << ":" << pgonRout[k];
214 #endif
215  } else {
217  DDName(name, idNameSpace), 0.5 * thick[ii], rinB, routF, 0.0, 2 * geant_units::piRadians);
218  glog = DDLogicalPart(solid.ddname(), matter, solid);
219 #ifdef EDM_ML_DEBUG
220  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: " << solid.name() << " Tubs made of " << matName
221  << " of dimensions " << rinB << ", " << routF << ", " << 0.5 * thick[ii]
222  << ", 0.0, 360.0";
223 #endif
224  positionSensitive(glog, rinB, routF, cpv);
225  }
226  DDTranslation r1(0, 0, zz);
227  DDRotation rot;
228  cpv.position(glog, module, copy, r1, rot);
229  ++copyNumber[ii];
230 #ifdef EDM_ML_DEBUG
231  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo test: " << glog.name() << " number " << copy
232  << " positioned in " << module.name() << " at " << r1 << " with " << rot
233  << std::endl;
234 #endif
235  zz += (0.5 * thick[ii]);
236  } // End of loop over layers in a block
237  zi = zo;
238  laymin = laymax;
239  if (fabs(thickTot - layerThick[i]) < 0.00001) {
240  } else if (thickTot > layerThick[i]) {
241  edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick[i] << " is smaller than thickness "
242  << thickTot << " of all its components **** ERROR ****\n";
243  } else if (thickTot < layerThick[i]) {
244  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << layerThick[i] << " does not match with "
245  << thickTot << " of the components\n";
246  }
247  } // End of loop over blocks
248 }
std::vector< int > copyNumber
std::vector< double > thick
const N & name() const
Definition: DDBase.h:59
void positionSensitive(DDLogicalPart &glog, double rin, double rout, DDCompactView &cpv)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< std::string > names
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
std::vector< std::string > materials
U second(std::pair< T, U > const &p)
constexpr long double piRadians(M_PIl)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:653
ii
Definition: cuy.py:590
std::vector< double > slopeB
std::vector< int > layerType
std::vector< int > layers
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
alpha
zGenParticlesMatch = cms.InputTag(""),
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
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:551
std::vector< double > layerThick
double rMax(double z)
std::vector< int > layerSense
const N & ddname() const
Definition: DDBase.h:61
void DDHGCalModuleAlgo::execute ( DDCompactView cpv)
override

Definition at line 151 of file DDHGCalModuleAlgo.cc.

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

151  {
152 #ifdef EDM_ML_DEBUG
153  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalModuleAlgo...";
154 #endif
155  copies.clear();
156  constructLayers(parent(), cpv);
157 #ifdef EDM_ML_DEBUG
158  edm::LogVerbatim("HGCalGeom") << copies.size() << " different wafer copy numbers";
159 #endif
160  copies.clear();
161 #ifdef EDM_ML_DEBUG
162  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalModuleAlgo construction";
163 #endif
164 }
std::unordered_set< int > copies
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
void DDHGCalModuleAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 81 of file DDHGCalModuleAlgo.cc.

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

85  {
86  wafer = vsArgs["WaferName"];
87 #ifdef EDM_ML_DEBUG
88  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: " << wafer.size() << " wafers";
89  for (unsigned int i = 0; i < wafer.size(); ++i)
90  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << wafer[i];
91 #endif
92  materials = vsArgs["MaterialNames"];
93  names = vsArgs["VolumeNames"];
94  thick = vArgs["Thickness"];
95  for (unsigned int i = 0; i < materials.size(); ++i) {
96  copyNumber.emplace_back(1);
97  }
98 #ifdef EDM_ML_DEBUG
99  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: " << materials.size() << " types of volumes";
100  for (unsigned int i = 0; i < names.size(); ++i)
101  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names[i] << " of thickness " << thick[i]
102  << " filled with " << materials[i] << " first copy number " << copyNumber[i];
103 #endif
104  layers = dbl_to_int(vArgs["Layers"]);
105  layerThick = vArgs["LayerThick"];
106 #ifdef EDM_ML_DEBUG
107  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: " << layers.size() << " blocks";
108  for (unsigned int i = 0; i < layers.size(); ++i)
109  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << layerThick[i] << " with " << layers[i]
110  << " layers";
111 #endif
112  layerType = dbl_to_int(vArgs["LayerType"]);
113  layerSense = dbl_to_int(vArgs["LayerSense"]);
114 #ifdef EDM_ML_DEBUG
115  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: " << layerType.size() << " layers";
116  for (unsigned int i = 0; i < layerType.size(); ++i)
117  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType[i] << " sensitive class "
118  << layerSense[i];
119 #endif
120  zMinBlock = nArgs["zMinBlock"];
121  rMaxFine = nArgs["rMaxFine"];
122  waferW = nArgs["waferW"];
123  waferGap = nArgs["waferGap"];
124  sectors = (int)(nArgs["Sectors"]);
125 #ifdef EDM_ML_DEBUG
126  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: zStart " << zMinBlock << " rFineCoarse " << rMaxFine
127  << " wafer width " << waferW << " gap among wafers " << waferGap << " sectors "
128  << sectors;
129 #endif
130  slopeB = vArgs["SlopeBottom"];
131  slopeT = vArgs["SlopeTop"];
132  zFront = vArgs["ZFront"];
133  rMaxFront = vArgs["RMaxFront"];
134 #ifdef EDM_ML_DEBUG
135  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: Bottom slopes " << slopeB[0] << ":" << slopeB[1] << " and "
136  << slopeT.size() << " slopes for top";
137  for (unsigned int i = 0; i < slopeT.size(); ++i)
138  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFront[i] << " Rmax " << rMaxFront[i] << " Slope "
139  << slopeT[i];
140 #endif
142 #ifdef EDM_ML_DEBUG
143  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: NameSpace " << idNameSpace;
144 #endif
145 }
std::vector< int > copyNumber
std::vector< double > thick
std::vector< std::string > names
static std::string & ns()
std::vector< std::string > materials
std::vector< double > rMaxFront
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::vector< double > slopeB
std::vector< int > layerType
std::vector< int > layers
std::vector< double > slopeT
std::vector< std::string > wafer
std::vector< double > zFront
std::vector< double > layerThick
std::vector< int > layerSense
void DDHGCalModuleAlgo::positionSensitive ( DDLogicalPart glog,
double  rin,
double  rout,
DDCompactView cpv 
)
protected

Definition at line 269 of file DDHGCalModuleAlgo.cc.

References filterCSVwithJSON::copy, distTCMET_cfi::corner, DDBase< N, C >::ddname(), DDSplit(), DEFINE_EDM_PLUGIN, PVValHelper::dx, PVValHelper::dy, createfilelist::int, HGCalParameters::k_CornerSize, Skims_PA_cff::name, EgHLTOffHistBins_cfi::nr, DDCompactView::position(), idealTransformation::rotation, findQualityFiles::rr, mathSSE::sqrt(), funct::tan(), and HGCalGeomTools::waferCorner().

269  {
270  double ww = (waferW + waferGap);
271  double dx = 0.5 * ww;
272  double dy = 3.0 * dx * tan(30._deg);
273  double rr = 2.0 * dx * tan(30._deg);
274  int ncol = (int)(2.0 * rout / ww) + 1;
275  int nrow = (int)(rout / (ww * tan(30._deg))) + 1;
276  int incm(0), inrm(0), kount(0);
277 #ifdef EDM_ML_DEBUG
278  edm::LogVerbatim("HGCalGeom") << glog.ddname() << " rout " << rout << " Row " << nrow << " Column " << ncol;
279 #endif
280  for (int nr = -nrow; nr <= nrow; ++nr) {
281  int inr = (nr >= 0) ? nr : -nr;
282  for (int nc = -ncol; nc <= ncol; ++nc) {
283  int inc = (nc >= 0) ? nc : -nc;
284  if (inr % 2 == inc % 2) {
285  double xpos = nc * dx;
286  double ypos = nr * dy;
287  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, rin, rout, true);
288  if (corner.first == (int)(HGCalParameters::k_CornerSize)) {
289  double rpos = std::sqrt(xpos * xpos + ypos * ypos);
290  DDTranslation tran(xpos, ypos, 0.0);
292  int copy = inr * 100 + inc;
293  if (nc < 0)
294  copy += 10000;
295  if (nr < 0)
296  copy += 100000;
297  DDName name = (rpos < rMaxFine) ? DDName(DDSplit(wafer[0]).first, DDSplit(wafer[0]).second)
298  : DDName(DDSplit(wafer[1]).first, DDSplit(wafer[1]).second);
299  cpv.position(name, glog.ddname(), copy, tran, rotation);
300  if (inc > incm)
301  incm = inc;
302  if (inr > inrm)
303  inrm = inr;
304  kount++;
305  if (copies.count(copy) == 0)
306  copies.insert(copy);
307 #ifdef EDM_ML_DEBUG
308  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: " << name << " number " << copy << " positioned in "
309  << glog.ddname() << " at " << tran << " with " << rotation << std::endl;
310 #endif
311  }
312  }
313  }
314  }
315 #ifdef EDM_ML_DEBUG
316  edm::LogVerbatim("HGCalGeom") << "DDHGCalModuleAlgo: # of columns " << incm << " # of rows " << inrm << " and "
317  << kount << " wafers for " << glog.ddname();
318 #endif
319 }
std::unordered_set< int > copies
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
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
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
static uint32_t k_CornerSize
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< std::string > wafer
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
const N & ddname() const
Definition: DDBase.h:61
double DDHGCalModuleAlgo::rMax ( double  z)
protected

Definition at line 250 of file DDHGCalModuleAlgo.cc.

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

250  {
251  double r(0);
252 #ifdef EDM_ML_DEBUG
253  unsigned int ik(0);
254 #endif
255  for (unsigned int k = 0; k < slopeT.size(); ++k) {
256  if (z < zFront[k])
257  break;
258  r = rMaxFront[k] + (z - zFront[k]) * slopeT[k];
259 #ifdef EDM_ML_DEBUG
260  ik = k;
261 #endif
262  }
263 #ifdef EDM_ML_DEBUG
264  edm::LogVerbatim("HGCalGeom") << "rMax : " << z << ":" << ik << ":" << r << std::endl;
265 #endif
266  return r;
267 }
std::vector< double > rMaxFront
std::vector< double > slopeT
std::vector< double > zFront

Member Data Documentation

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

Definition at line 70 of file DDHGCalModuleAlgo.cc.

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

Definition at line 54 of file DDHGCalModuleAlgo.cc.

std::string DDHGCalModuleAlgo::idName
private

Definition at line 68 of file DDHGCalModuleAlgo.cc.

std::string DDHGCalModuleAlgo::idNameSpace
private

Definition at line 69 of file DDHGCalModuleAlgo.cc.

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

Definition at line 55 of file DDHGCalModuleAlgo.cc.

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

Definition at line 58 of file DDHGCalModuleAlgo.cc.

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

Definition at line 56 of file DDHGCalModuleAlgo.cc.

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

Definition at line 57 of file DDHGCalModuleAlgo.cc.

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

Definition at line 51 of file DDHGCalModuleAlgo.cc.

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

Definition at line 52 of file DDHGCalModuleAlgo.cc.

double DDHGCalModuleAlgo::rMaxFine
private

Definition at line 60 of file DDHGCalModuleAlgo.cc.

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

Definition at line 67 of file DDHGCalModuleAlgo.cc.

int DDHGCalModuleAlgo::sectors
private

Definition at line 63 of file DDHGCalModuleAlgo.cc.

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

Definition at line 64 of file DDHGCalModuleAlgo.cc.

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

Definition at line 65 of file DDHGCalModuleAlgo.cc.

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

Definition at line 53 of file DDHGCalModuleAlgo.cc.

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

Definition at line 50 of file DDHGCalModuleAlgo.cc.

double DDHGCalModuleAlgo::waferGap
private

Definition at line 62 of file DDHGCalModuleAlgo.cc.

double DDHGCalModuleAlgo::waferW
private

Definition at line 61 of file DDHGCalModuleAlgo.cc.

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

Definition at line 66 of file DDHGCalModuleAlgo.cc.

double DDHGCalModuleAlgo::zMinBlock
private

Definition at line 59 of file DDHGCalModuleAlgo.cc.