CMS 3D CMS Logo

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

Public Member Functions

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

Protected Member Functions

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

Private Attributes

double absorbH_
 
double absorbW_
 
std::unordered_set< int > copies_
 
std::vector< int > copyNumber_
 
std::vector< std::string > covers_
 
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 24 of file DDHGCalTBModule.cc.

Constructor & Destructor Documentation

DDHGCalTBModule::DDHGCalTBModule ( )

Definition at line 69 of file DDHGCalTBModule.cc.

69  {
70 #ifdef EDM_ML_DEBUG
71  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule info: Creating an instance";
72 #endif
73 }
DDHGCalTBModule::~DDHGCalTBModule ( )
override

Definition at line 75 of file DDHGCalTBModule.cc.

75 {}

Member Function Documentation

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

Definition at line 174 of file DDHGCalTBModule.cc.

References DDSolidFactory::box(), filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), dqmdumpme::first, mps_fire::i, cuy::ii, Skims_PA_cff::name, DDBase< N, C >::name(), angle_units::piRadians(), DDCompactView::position(), diffTwoXMLs::r1, photonAnalyzer_cfi::rMax, makeMuonMisalignmentScenario::rot, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, DDSolidFactory::tubs(), and geometryCSVtoXML::zz.

174  {
175 #ifdef EDM_ML_DEBUG
176  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule test: \t\tInside Layers";
177 #endif
178  double zi(zMinBlock_);
179  int laymin(0);
180  for (unsigned int i = 0; i < layers_.size(); i++) {
181  double zo = zi + layerThick_[i];
182  double routF = rMax(zi);
183  int laymax = laymin + layers_[i];
184  double zz = zi;
185  double thickTot(0);
186  for (int ly = laymin; ly < laymax; ++ly) {
187  int ii = layerType_[ly];
188  int copy = copyNumber_[ii];
189  double rinB = (layerSense_[ly] == 0) ? (zo * slopeB_[0]) : (zo * slopeB_[1]);
190  zz += (0.5 * thick_[ii]);
191  thickTot += thick_[ii];
192 
193  std::string name = "HGCal" + names_[ii] + std::to_string(copy);
194 #ifdef EDM_ML_DEBUG
195  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: Layer " << ly << ":" << ii << " Front " << zi << ", " << routF
196  << " Back " << zo << ", " << rinB << " superlayer thickness " << layerThick_[i];
197 #endif
198  DDName matName(DDSplit(materials_[ii]).first, DDSplit(materials_[ii]).second);
199  DDMaterial matter(matName);
200  DDLogicalPart glog;
201  if (layerSense_[ly] == 0) {
203  glog = DDLogicalPart(solid.ddname(), matter, solid);
204 #ifdef EDM_ML_DEBUG
205  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule test: " << solid.name() << " box of dimension " << absorbW_
206  << ":" << absorbH_ << ":" << 0.5 * thick_[ii];
207 #endif
208  } else {
210  DDName(name, idNameSpace_), 0.5 * thick_[ii], rinB, routF, 0.0, 2 * geant_units::piRadians);
211  glog = DDLogicalPart(solid.ddname(), matter, solid);
212 #ifdef EDM_ML_DEBUG
213  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << solid.name() << " Tubs made of " << matName
214  << " of dimensions " << rinB << ", " << routF << ", " << 0.5 * thick_[ii]
215  << ", 0.0, 360.0";
216 #endif
217  positionSensitive(glog, layerSense_[ly], rinB, routF, cpv);
218  }
219  DDTranslation r1(0, 0, zz);
220  DDRotation rot;
221  cpv.position(glog, module, copy, r1, rot);
222  ++copyNumber_[ii];
223 #ifdef EDM_ML_DEBUG
224  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule test: " << glog.name() << " number " << copy
225  << " positioned in " << module.name() << " at " << r1 << " with " << rot;
226 #endif
227  zz += (0.5 * thick_[ii]);
228  } // End of loop over layers in a block
229  zi = zo;
230  laymin = laymax;
231  if (fabs(thickTot - layerThick_[i]) < 0.00001) {
232  } else if (thickTot > layerThick_[i]) {
233  edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " is smaller than thickness "
234  << thickTot << " of all its components **** ERROR ****\n";
235  } else if (thickTot < layerThick_[i]) {
236  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " does not match with "
237  << thickTot << " of the components\n";
238  }
239  } // End of loop over blocks
240 }
std::vector< std::string > names_
const N & name() const
Definition: DDBase.h:59
std::vector< double > layerThick_
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
void positionSensitive(DDLogicalPart &glog, int type, double rin, double rout, DDCompactView &cpv)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
std::vector< int > layerSense_
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
U second(std::pair< T, U > const &p)
constexpr long double piRadians(M_PIl)
std::vector< int > layerType_
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
std::vector< int > copyNumber_
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:533
ii
Definition: cuy.py:590
std::string idNameSpace_
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)
std::vector< double > slopeB_
std::vector< double > thick_
std::vector< std::string > materials_
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
double rMax(double z)
const N & ddname() const
Definition: DDBase.h:61
void DDHGCalTBModule::execute ( DDCompactView cpv)
override

Definition at line 159 of file DDHGCalTBModule.cc.

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

159  {
160 #ifdef EDM_ML_DEBUG
161  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalTBModule...";
162 #endif
163  copies_.clear();
164  constructLayers(parent(), cpv);
165 #ifdef EDM_ML_DEBUG
166  edm::LogVerbatim("HGCalGeom") << copies_.size() << " different wafer copy numbers";
167 #endif
168  copies_.clear();
169 #ifdef EDM_ML_DEBUG
170  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalTBModule construction ...";
171 #endif
172 }
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
std::unordered_set< int > copies_
void DDHGCalTBModule::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 77 of file DDHGCalTBModule.cc.

References dbl_to_int(), mps_fire::i, createfilelist::int, and DDCurrentNamespace::ns().

81  {
82  wafer_ = vsArgs["WaferName"];
83  covers_ = vsArgs["CoverName"];
84 #ifdef EDM_ML_DEBUG
85  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << wafer_.size() << " wafers";
86  unsigned int i(0);
87  for (auto wafer : wafer_) {
88  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << wafer;
89  ++i;
90  }
91  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << covers_.size() << " covers";
92  i = 0;
93  for (auto cover : covers_) {
94  edm::LogVerbatim("HGCalGeom") << "Cover[" << i << "] " << cover;
95  ++i;
96  }
97 #endif
98  materials_ = vsArgs["MaterialNames"];
99  names_ = vsArgs["VolumeNames"];
100  thick_ = vArgs["Thickness"];
101  for (unsigned int i = 0; i < materials_.size(); ++i) {
102  copyNumber_.emplace_back(1);
103  }
104 #ifdef EDM_ML_DEBUG
105  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << materials_.size() << " types of volumes";
106  for (unsigned int i = 0; i < names_.size(); ++i)
107  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names_[i] << " of thickness " << thick_[i]
108  << " filled with " << materials_[i] << " first copy number " << copyNumber_[i];
109 #endif
110  layers_ = dbl_to_int(vArgs["Layers"]);
111  layerThick_ = vArgs["LayerThick"];
112 #ifdef EDM_ML_DEBUG
113  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << layers_.size() << " blocks";
114  for (unsigned int i = 0; i < layers_.size(); ++i)
115  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << layerThick_[i] << " with " << layers_[i]
116  << " layers";
117 #endif
118  layerType_ = dbl_to_int(vArgs["LayerType"]);
119  layerSense_ = dbl_to_int(vArgs["LayerSense"]);
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << layerType_.size() << " layers";
122  for (unsigned int i = 0; i < layerType_.size(); ++i)
123  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType_[i] << " sensitive class "
124  << layerSense_[i];
125 #endif
126  zMinBlock_ = nArgs["zMinBlock"];
127  rMaxFine_ = nArgs["rMaxFine"];
128  waferW_ = nArgs["waferW"];
129  waferGap_ = nArgs["waferGap"];
130  absorbW_ = nArgs["absorberW"];
131  absorbH_ = nArgs["absorberH"];
132  sectors_ = (int)(nArgs["Sectors"]);
133 #ifdef EDM_ML_DEBUG
134  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: zStart " << zMinBlock_ << " rFineCoarse " << rMaxFine_
135  << " wafer width " << waferW_ << " gap among wafers " << waferGap_ << " absorber width "
136  << absorbW_ << " absorber height " << absorbH_ << " sectors " << sectors_;
137 #endif
138  slopeB_ = vArgs["SlopeBottom"];
139  slopeT_ = vArgs["SlopeTop"];
140  zFront_ = vArgs["ZFront"];
141  rMaxFront_ = vArgs["RMaxFront"];
142 #ifdef EDM_ML_DEBUG
143  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: Bottom slopes " << slopeB_[0] << ":" << slopeB_[1] << " and "
144  << slopeT_.size() << " slopes for top";
145  for (unsigned int i = 0; i < slopeT_.size(); ++i)
146  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFront_[i] << " Rmax " << rMaxFront_[i] << " Slope "
147  << slopeT_[i];
148 #endif
150 #ifdef EDM_ML_DEBUG
151  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: NameSpace " << idNameSpace_;
152 #endif
153 }
std::vector< std::string > names_
std::vector< std::string > wafer_
std::vector< double > layerThick_
static std::string & ns()
std::vector< double > rMaxFront_
std::vector< int > layerSense_
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 > zFront_
std::vector< int > layerType_
std::vector< int > copyNumber_
std::vector< double > slopeT_
std::string idNameSpace_
std::vector< int > layers_
std::vector< std::string > covers_
std::vector< double > slopeB_
std::vector< double > thick_
std::vector< std::string > materials_
void DDHGCalTBModule::positionSensitive ( DDLogicalPart glog,
int  type,
double  rin,
double  rout,
DDCompactView cpv 
)
protected

Definition at line 261 of file DDHGCalTBModule.cc.

References filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), DEFINE_EDM_PLUGIN, PVValHelper::dx, PVValHelper::dy, dqmdumpme::first, createfilelist::int, dqmdumpme::k, Skims_PA_cff::name, EgHLTOffHistBins_cfi::nr, DDCompactView::position(), idealTransformation::rotation, findQualityFiles::rr, edm::second(), mathSSE::sqrt(), and funct::tan().

261  {
262  double ww = (waferW_ + waferGap_);
263  double dx = 0.5 * ww;
264  double dy = 3.0 * dx * tan(30._deg);
265  double rr = 2.0 * dx * tan(30._deg);
266  int ncol = (int)(2.0 * rout / ww) + 1;
267  int nrow = (int)(rout / (ww * tan(30._deg))) + 1;
268  int incm(0), inrm(0), kount(0);
269  double xc[6], yc[6];
270 #ifdef EDM_ML_DEBUG
271  edm::LogVerbatim("HGCalGeom") << glog.ddname() << " rout " << rout << " Row " << nrow << " Column " << ncol;
272 #endif
273  for (int nr = -nrow; nr <= nrow; ++nr) {
274  int inr = (nr >= 0) ? nr : -nr;
275  for (int nc = -ncol; nc <= ncol; ++nc) {
276  int inc = (nc >= 0) ? nc : -nc;
277  if (inr % 2 == inc % 2) {
278  double xpos = nc * dx;
279  double ypos = nr * dy;
280  xc[0] = xpos + dx;
281  yc[0] = ypos - 0.5 * rr;
282  xc[1] = xpos + dx;
283  yc[1] = ypos + 0.5 * rr;
284  xc[2] = xpos;
285  yc[2] = ypos + rr;
286  xc[3] = xpos - dx;
287  yc[3] = ypos + 0.5 * rr;
288  xc[4] = xpos + dx;
289  yc[4] = ypos - 0.5 * rr;
290  xc[5] = xpos;
291  yc[5] = ypos - rr;
292  bool cornerAll(true);
293  for (int k = 0; k < 6; ++k) {
294  double rpos = std::sqrt(xc[k] * xc[k] + yc[k] * yc[k]);
295  if (rpos < rin || rpos > rout)
296  cornerAll = false;
297  }
298  if (cornerAll) {
299  double rpos = std::sqrt(xpos * xpos + ypos * ypos);
300  DDTranslation tran(xpos, ypos, 0.0);
302  int copy = inr * 100 + inc;
303  if (nc < 0)
304  copy += 10000;
305  if (nr < 0)
306  copy += 100000;
307  DDName name;
308  if (type == 1) {
309  name = (rpos < rMaxFine_) ? DDName(DDSplit(wafer_[0]).first, DDSplit(wafer_[0]).second)
310  : DDName(DDSplit(wafer_[1]).first, DDSplit(wafer_[1]).second);
311  } else {
312  name = DDName(DDSplit(covers_[type - 2]).first, DDSplit(covers_[type - 2]).second);
313  }
314  cpv.position(name, glog.ddname(), copy, tran, rotation);
315  if (inc > incm)
316  incm = inc;
317  if (inr > inrm)
318  inrm = inr;
319  kount++;
320  if (copies_.count(copy) == 0 && type == 1)
321  copies_.insert(copy);
322 #ifdef EDM_ML_DEBUG
323  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << name << " number " << copy << " positioned in "
324  << glog.ddname() << " at " << tran << " with " << rotation;
325 #endif
326  }
327  }
328  }
329  }
330 #ifdef EDM_ML_DEBUG
331  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: # of columns " << incm << " # of rows " << inrm << " and " << kount
332  << " wafers for " << glog.ddname();
333 #endif
334 }
type
Definition: HCALResponse.h:21
std::vector< std::string > wafer_
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
U second(std::pair< T, U > const &p)
T sqrt(T t)
Definition: SSEVec.h:19
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< std::string > covers_
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::unordered_set< int > copies_
const N & ddname() const
Definition: DDBase.h:61
double DDHGCalTBModule::rMax ( double  z)
protected

Definition at line 242 of file DDHGCalTBModule.cc.

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

242  {
243  double r(0);
244 #ifdef EDM_ML_DEBUG
245  unsigned int ik(0);
246 #endif
247  for (unsigned int k = 0; k < slopeT_.size(); ++k) {
248  if (z < zFront_[k])
249  break;
250  r = rMaxFront_[k] + (z - zFront_[k]) * slopeT_[k];
251 #ifdef EDM_ML_DEBUG
252  ik = k;
253 #endif
254  }
255 #ifdef EDM_ML_DEBUG
256  edm::LogVerbatim("HGCalGeom") << "rMax : " << z << ":" << ik << ":" << r;
257 #endif
258  return r;
259 }
std::vector< double > rMaxFront_
std::vector< double > zFront_
std::vector< double > slopeT_

Member Data Documentation

double DDHGCalTBModule::absorbH_
private

Definition at line 58 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::absorbW_
private

Definition at line 57 of file DDHGCalTBModule.cc.

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

Definition at line 66 of file DDHGCalTBModule.cc.

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

Definition at line 48 of file DDHGCalTBModule.cc.

std::vector<std::string> DDHGCalTBModule::covers_
private

Definition at line 44 of file DDHGCalTBModule.cc.

std::string DDHGCalTBModule::idName_
private

Definition at line 64 of file DDHGCalTBModule.cc.

std::string DDHGCalTBModule::idNameSpace_
private

Definition at line 65 of file DDHGCalTBModule.cc.

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

Definition at line 49 of file DDHGCalTBModule.cc.

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

Definition at line 52 of file DDHGCalTBModule.cc.

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

Definition at line 50 of file DDHGCalTBModule.cc.

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

Definition at line 51 of file DDHGCalTBModule.cc.

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

Definition at line 45 of file DDHGCalTBModule.cc.

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

Definition at line 46 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::rMaxFine_
private

Definition at line 54 of file DDHGCalTBModule.cc.

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

Definition at line 63 of file DDHGCalTBModule.cc.

int DDHGCalTBModule::sectors_
private

Definition at line 59 of file DDHGCalTBModule.cc.

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

Definition at line 60 of file DDHGCalTBModule.cc.

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

Definition at line 61 of file DDHGCalTBModule.cc.

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

Definition at line 47 of file DDHGCalTBModule.cc.

std::vector<std::string> DDHGCalTBModule::wafer_
private

Definition at line 43 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::waferGap_
private

Definition at line 56 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::waferW_
private

Definition at line 55 of file DDHGCalTBModule.cc.

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

Definition at line 62 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::zMinBlock_
private

Definition at line 53 of file DDHGCalTBModule.cc.