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 | 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 25 of file DDHGCalTBModule.cc.

Constructor & Destructor Documentation

DDHGCalTBModule::DDHGCalTBModule ( )

Definition at line 70 of file DDHGCalTBModule.cc.

70  {
71 #ifdef EDM_ML_DEBUG
72  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule info: Creating an instance";
73 #endif
74 }
Log< level::Info, true > LogVerbatim
DDHGCalTBModule::~DDHGCalTBModule ( )
override

Definition at line 76 of file DDHGCalTBModule.cc.

76 {}

Member Function Documentation

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

Definition at line 175 of file DDHGCalTBModule.cc.

References DDSolidFactory::box(), filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), first, mps_fire::i, cuy::ii, DDBase< N, C >::name(), mergeVDriftHistosByStation::name, DDCompactView::position(), diffTwoXMLs::r1, makeMuonMisalignmentScenario::rot, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, and DDSolidFactory::tubs().

175  {
176 #ifdef EDM_ML_DEBUG
177  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule test: \t\tInside Layers";
178 #endif
179  double zi(zMinBlock_);
180  int laymin(0);
181  for (unsigned int i = 0; i < layers_.size(); i++) {
182  double zo = zi + layerThick_[i];
183  double routF = rMax(zi);
184  int laymax = laymin + layers_[i];
185  double zz = zi;
186  double thickTot(0);
187  for (int ly = laymin; ly < laymax; ++ly) {
188  int ii = layerType_[ly];
189  int copy = copyNumber_[ii];
190  double rinB = (layerSense_[ly] == 0) ? (zo * slopeB_[0]) : (zo * slopeB_[1]);
191  zz += (0.5 * thick_[ii]);
192  thickTot += thick_[ii];
193 
194  std::string name = "HGCal" + names_[ii] + std::to_string(copy);
195 #ifdef EDM_ML_DEBUG
196  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: Layer " << ly << ":" << ii << " Front " << zi << ", " << routF
197  << " Back " << zo << ", " << rinB << " superlayer thickness " << layerThick_[i];
198 #endif
199  DDName matName(DDSplit(materials_[ii]).first, DDSplit(materials_[ii]).second);
200  DDMaterial matter(matName);
201  DDLogicalPart glog;
202  if (layerSense_[ly] == 0) {
204  glog = DDLogicalPart(solid.ddname(), matter, solid);
205 #ifdef EDM_ML_DEBUG
206  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule test: " << solid.name() << " box of dimension " << absorbW_
207  << ":" << absorbH_ << ":" << 0.5 * thick_[ii];
208 #endif
209  } else {
210  DDSolid solid = DDSolidFactory::tubs(DDName(name, idNameSpace_), 0.5 * thick_[ii], rinB, routF, 0.0, 2._pi);
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 }
Log< level::Info, true > LogVerbatim
std::vector< std::string > names_
const N & name() const
Definition: DDBase.h:59
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
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:17
Log< level::Error, false > LogError
int ii
Definition: cuy.py:589
std::vector< int > layerSense_
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
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:667
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:547
std::string idNameSpace_
std::vector< int > layers_
std::vector< double > slopeB_
std::vector< double > thick_
std::vector< std::string > materials_
Log< level::Warning, false > LogWarning
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
double rMax(double z)
const N & ddname() const
Definition: DDBase.h:61
void DDHGCalTBModule::execute ( DDCompactView cpv)
override

Definition at line 160 of file DDHGCalTBModule.cc.

References DDHGCalGeom::constructLayers(), and SpecificationBuilder_cfi::parent().

160  {
161 #ifdef EDM_ML_DEBUG
162  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalTBModule...";
163 #endif
164  copies_.clear();
165  constructLayers(parent(), cpv);
166 #ifdef EDM_ML_DEBUG
167  edm::LogVerbatim("HGCalGeom") << copies_.size() << " different wafer copy numbers";
168 #endif
169  copies_.clear();
170 #ifdef EDM_ML_DEBUG
171  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalTBModule construction ...";
172 #endif
173 }
Log< level::Info, true > LogVerbatim
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 78 of file DDHGCalTBModule.cc.

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

82  {
83  wafer_ = vsArgs["WaferName"];
84  covers_ = vsArgs["CoverName"];
85 #ifdef EDM_ML_DEBUG
86  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << wafer_.size() << " wafers";
87  unsigned int i(0);
88  for (auto wafer : wafer_) {
89  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << wafer;
90  ++i;
91  }
92  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << covers_.size() << " covers";
93  i = 0;
94  for (auto cover : covers_) {
95  edm::LogVerbatim("HGCalGeom") << "Cover[" << i << "] " << cover;
96  ++i;
97  }
98 #endif
99  materials_ = vsArgs["MaterialNames"];
100  names_ = vsArgs["VolumeNames"];
101  thick_ = vArgs["Thickness"];
102  for (unsigned int i = 0; i < materials_.size(); ++i) {
103  copyNumber_.emplace_back(1);
104  }
105 #ifdef EDM_ML_DEBUG
106  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << materials_.size() << " types of volumes";
107  for (unsigned int i = 0; i < names_.size(); ++i)
108  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names_[i] << " of thickness " << thick_[i]
109  << " filled with " << materials_[i] << " first copy number " << copyNumber_[i];
110 #endif
111  layers_ = dbl_to_int(vArgs["Layers"]);
112  layerThick_ = vArgs["LayerThick"];
113 #ifdef EDM_ML_DEBUG
114  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << layers_.size() << " blocks";
115  for (unsigned int i = 0; i < layers_.size(); ++i)
116  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << layerThick_[i] << " with " << layers_[i]
117  << " layers";
118 #endif
119  layerType_ = dbl_to_int(vArgs["LayerType"]);
120  layerSense_ = dbl_to_int(vArgs["LayerSense"]);
121 #ifdef EDM_ML_DEBUG
122  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << layerType_.size() << " layers";
123  for (unsigned int i = 0; i < layerType_.size(); ++i)
124  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType_[i] << " sensitive class "
125  << layerSense_[i];
126 #endif
127  zMinBlock_ = nArgs["zMinBlock"];
128  rMaxFine_ = nArgs["rMaxFine"];
129  waferW_ = nArgs["waferW"];
130  waferGap_ = nArgs["waferGap"];
131  absorbW_ = nArgs["absorberW"];
132  absorbH_ = nArgs["absorberH"];
133  sectors_ = (int)(nArgs["Sectors"]);
134 #ifdef EDM_ML_DEBUG
135  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: zStart " << zMinBlock_ << " rFineCoarse " << rMaxFine_
136  << " wafer width " << waferW_ << " gap among wafers " << waferGap_ << " absorber width "
137  << absorbW_ << " absorber height " << absorbH_ << " sectors " << sectors_;
138 #endif
139  slopeB_ = vArgs["SlopeBottom"];
140  slopeT_ = vArgs["SlopeTop"];
141  zFront_ = vArgs["ZFront"];
142  rMaxFront_ = vArgs["RMaxFront"];
143 #ifdef EDM_ML_DEBUG
144  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: Bottom slopes " << slopeB_[0] << ":" << slopeB_[1] << " and "
145  << slopeT_.size() << " slopes for top";
146  for (unsigned int i = 0; i < slopeT_.size(); ++i)
147  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFront_[i] << " Rmax " << rMaxFront_[i] << " Slope "
148  << slopeT_[i];
149 #endif
151 #ifdef EDM_ML_DEBUG
152  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: NameSpace " << idNameSpace_;
153 #endif
154 }
Log< level::Info, true > LogVerbatim
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< double > zFront_
std::vector< int > layerType_
std::vector< int > copyNumber_
std::vector< double > slopeT_
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::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(), PVValHelper::dx, PVValHelper::dy, first, isotrackApplyRegressor::k, mergeVDriftHistosByStation::name, HGCalTypes::packTypeUV(), 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 = HGCalTypes::packTypeUV(0, nc, nr);
303  DDName name;
304  if (type == 1) {
305  name = (rpos < rMaxFine_) ? DDName(DDSplit(wafer_[0]).first, DDSplit(wafer_[0]).second)
306  : DDName(DDSplit(wafer_[1]).first, DDSplit(wafer_[1]).second);
307  } else {
308  name = DDName(DDSplit(covers_[type - 2]).first, DDSplit(covers_[type - 2]).second);
309  }
310  cpv.position(name, glog.ddname(), copy, tran, rotation);
311  if (inc > incm)
312  incm = inc;
313  if (inr > inrm)
314  inrm = inr;
315  kount++;
316  if (copies_.count(copy) == 0 && type == 1)
317  copies_.insert(copy);
318 #ifdef EDM_ML_DEBUG
319  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: " << name << " number " << copy << " positioned in "
320  << glog.ddname() << " at " << tran << " with " << rotation;
321 #endif
322  }
323  }
324  }
325  }
326 #ifdef EDM_ML_DEBUG
327  edm::LogVerbatim("HGCalGeom") << "DDHGCalTBModule: # of columns " << incm << " # of rows " << inrm << " and " << kount
328  << " wafers for " << glog.ddname();
329 #endif
330 }
Log< level::Info, true > LogVerbatim
std::vector< std::string > wafer_
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
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_
static int32_t packTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:3
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_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
const N & ddname() const
Definition: DDBase.h:61
double DDHGCalTBModule::rMax ( double  z)
protected

Definition at line 242 of file DDHGCalTBModule.cc.

References isotrackApplyRegressor::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 }
Log< level::Info, true > LogVerbatim
std::vector< double > rMaxFront_
std::vector< double > zFront_
std::vector< double > slopeT_

Member Data Documentation

double DDHGCalTBModule::absorbH_
private

Definition at line 59 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::absorbW_
private

Definition at line 58 of file DDHGCalTBModule.cc.

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

Definition at line 67 of file DDHGCalTBModule.cc.

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

Definition at line 49 of file DDHGCalTBModule.cc.

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

Definition at line 45 of file DDHGCalTBModule.cc.

std::string DDHGCalTBModule::idName_
private

Definition at line 65 of file DDHGCalTBModule.cc.

std::string DDHGCalTBModule::idNameSpace_
private

Definition at line 66 of file DDHGCalTBModule.cc.

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

Definition at line 50 of file DDHGCalTBModule.cc.

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

Definition at line 53 of file DDHGCalTBModule.cc.

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

Definition at line 51 of file DDHGCalTBModule.cc.

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

Definition at line 52 of file DDHGCalTBModule.cc.

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

Definition at line 46 of file DDHGCalTBModule.cc.

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

Definition at line 47 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::rMaxFine_
private

Definition at line 55 of file DDHGCalTBModule.cc.

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

Definition at line 64 of file DDHGCalTBModule.cc.

int DDHGCalTBModule::sectors_
private

Definition at line 60 of file DDHGCalTBModule.cc.

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

Definition at line 61 of file DDHGCalTBModule.cc.

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

Definition at line 62 of file DDHGCalTBModule.cc.

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

Definition at line 48 of file DDHGCalTBModule.cc.

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

Definition at line 44 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::waferGap_
private

Definition at line 57 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::waferW_
private

Definition at line 56 of file DDHGCalTBModule.cc.

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

Definition at line 63 of file DDHGCalTBModule.cc.

double DDHGCalTBModule::zMinBlock_
private

Definition at line 54 of file DDHGCalTBModule.cc.