CMS 3D CMS Logo

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

#include <DDHGCalTBModule.h>

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 11 of file DDHGCalTBModule.h.

Constructor & Destructor Documentation

DDHGCalTBModule::DDHGCalTBModule ( )

Definition at line 17 of file DDHGCalTBModule.cc.

References gather_cfg::cout.

17  {
18 #ifdef EDM_ML_DEBUG
19  std::cout << "DDHGCalTBModule info: Creating an instance" << std::endl;
20 #endif
21 }
DDHGCalTBModule::~DDHGCalTBModule ( )
override

Definition at line 23 of file DDHGCalTBModule.cc.

23 {}

Member Function Documentation

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

Definition at line 125 of file DDHGCalTBModule.cc.

References absorbH_, absorbW_, DDSolidFactory::box(), popcon2dropbox::copy(), copyNumber_, gather_cfg::cout, DDBase< N, C >::ddname(), DDSplit(), plotBeamSpotDB::first, mps_fire::i, idNameSpace_, cuy::ii, layers_, layerSense_, layerThick_, layerType_, materials_, dataset::name, DDBase< N, C >::name(), names_, DDCompactView::position(), positionSensitive(), diffTwoXMLs::r1, rMax(), makeMuonMisalignmentScenario::rot, edm::second(), slopeB_, AlCaHLTBitMon_QueryRunRegistry::string, thick_, DDSolidFactory::tubs(), zMinBlock_, and geometryCSVtoXML::zz.

Referenced by execute().

126  {
127 
128 #ifdef EDM_ML_DEBUG
129  std::cout << "DDHGCalTBModule test: \t\tInside Layers" << std::endl;
130 #endif
131  double zi(zMinBlock_);
132  int laymin(0);
133  for (unsigned int i=0; i<layers_.size(); i++) {
134  double zo = zi + layerThick_[i];
135  double routF = rMax(zi);
136  int laymax = laymin+layers_[i];
137  double zz = zi;
138  double thickTot(0);
139  for (int ly=laymin; ly<laymax; ++ly) {
140  int ii = layerType_[ly];
141  int copy = copyNumber_[ii];
142  double rinB = (layerSense_[ly] == 0) ? (zo*slopeB_[0]) : (zo*slopeB_[1]);
143  zz += (0.5*thick_[ii]);
144  thickTot += thick_[ii];
145 
146  std::string name = "HGCal"+names_[ii]+std::to_string(copy);
147 #ifdef EDM_ML_DEBUG
148  std::cout << "DDHGCalTBModule test: Layer " << ly << ":" << ii
149  << " Front " << zi << ", " << routF << " Back " << zo << ", "
150  << rinB << " superlayer thickness " << layerThick_[i]
151  << std::endl;
152 #endif
153  DDName matName(DDSplit(materials_[ii]).first,
154  DDSplit(materials_[ii]).second);
155  DDMaterial matter(matName);
156  DDLogicalPart glog;
157  if (layerSense_[ly] == 0) {
159  absorbW_, absorbH_, 0.5*thick_[ii]);
160  glog = DDLogicalPart(solid.ddname(), matter, solid);
161 #ifdef EDM_ML_DEBUG
162  std::cout << "DDHGCalTBModule test: " << solid.name()
163  << " box of dimension " << absorbW_ << ":" << absorbH_
164  << ":" << 0.5*thick_[ii] << std::endl;
165 #endif
166  } else {
168  0.5*thick_[ii], rinB, routF, 0.0,
169  CLHEP::twopi);
170  glog = DDLogicalPart(solid.ddname(), matter, solid);
171 #ifdef EDM_ML_DEBUG
172  std::cout << "DDHGCalTBModule test: " << solid.name()
173  << " Tubs made of " << matName << " of dimensions " << rinB
174  << ", " << routF << ", " << 0.5*thick_[ii] << ", 0.0, "
175  << CLHEP::twopi/CLHEP::deg << std::endl;
176 #endif
177  positionSensitive(glog,layerSense_[ly],rinB,routF,cpv);
178  }
179  DDTranslation r1(0,0,zz);
180  DDRotation rot;
181  cpv.position(glog, module, copy, r1, rot);
182  ++copyNumber_[ii];
183 #ifdef EDM_ML_DEBUG
184  std::cout << "DDHGCalTBModule test: " << glog.name() << " number "
185  << copy << " positioned in " << module.name() << " at " << r1
186  << " with " << rot << std::endl;
187 #endif
188  zz += (0.5*thick_[ii]);
189  } // End of loop over layers in a block
190  zi = zo;
191  laymin = laymax;
192  if (fabs(thickTot-layerThick_[i]) < 0.00001) {
193  } else if (thickTot > layerThick_[i]) {
194  edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick_[i]
195  << " is smaller than thickness " << thickTot
196  << " of all its components **** ERROR ****\n";
197  } else if (thickTot < layerThick_[i]) {
198  edm::LogWarning("HGCalGeom") << "Thickness of the partition "
199  << layerThick_[i] << " does not match with "
200  << thickTot << " of the components\n";
201  }
202  } // End of loop over blocks
203 }
std::vector< std::string > names_
const N & name() const
Definition: DDBase.h:78
std::vector< double > layerThick_
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
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: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 > layerType_
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 > 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:819
ii
Definition: cuy.py:588
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::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 > materials_
double rMax(double z)
const N & ddname() const
Definition: DDBase.h:80
void DDHGCalTBModule::execute ( DDCompactView cpv)
override

Definition at line 109 of file DDHGCalTBModule.cc.

References constructLayers(), copies_, gather_cfg::cout, and class-composition::parent.

109  {
110 
111 #ifdef EDM_ML_DEBUG
112  std::cout << "==>> Constructing DDHGCalTBModule..." << std::endl;
113 #endif
114  copies_.clear();
115  constructLayers (parent(), cpv);
116 #ifdef EDM_ML_DEBUG
117  std::cout << copies_.size() << " different wafer copy numbers" << std::endl;
118 #endif
119  copies_.clear();
120 #ifdef EDM_ML_DEBUG
121  std::cout << "<<== End of DDHGCalTBModule construction ..." << std::endl;
122 #endif
123 }
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 25 of file DDHGCalTBModule.cc.

References absorbH_, absorbW_, copyNumber_, gather_cfg::cout, covers_, dbl_to_int(), mps_fire::i, idNameSpace_, createfilelist::int, layers_, layerSense_, layerThick_, layerType_, materials_, names_, DDCurrentNamespace::ns(), rMaxFine_, rMaxFront_, sectors_, slopeB_, slopeT_, thick_, wafer_, waferGap_, waferW_, zFront_, and zMinBlock_.

29  {
30 
31  wafer_ = vsArgs["WaferName"];
32  covers_ = vsArgs["CoverName"];
33 #ifdef EDM_ML_DEBUG
34  std::cout << "DDHGCalTBModule: " << wafer_.size() << " wafers" << std::endl;
35  unsigned int i(0);
36  for (auto wafer : wafer_) {
37  std::cout << "Wafer[" << i << "] " << wafer << std::endl; ++i;}
38  std::cout << "DDHGCalTBModule: " << covers_.size() << " covers" << std::endl;
39  i = 0;
40  for (auto cover : covers_) {
41  std::cout << "Cover[" << i << "] " << cover << std::endl; ++i;}
42 #endif
43  materials_ = vsArgs["MaterialNames"];
44  names_ = vsArgs["VolumeNames"];
45  thick_ = vArgs["Thickness"];
46  for (unsigned int i=0; i<materials_.size(); ++i) {
47  copyNumber_.emplace_back(1);
48  }
49 #ifdef EDM_ML_DEBUG
50  std::cout << "DDHGCalTBModule: " << materials_.size()
51  << " types of volumes" << std::endl;
52  for (unsigned int i=0; i<names_.size(); ++i)
53  std::cout << "Volume [" << i << "] " << names_[i] << " of thickness "
54  << thick_[i] << " filled with " << materials_[i]
55  << " first copy number " << copyNumber_[i] << std::endl;
56 #endif
57  layers_ = dbl_to_int(vArgs["Layers"]);
58  layerThick_ = vArgs["LayerThick"];
59 #ifdef EDM_ML_DEBUG
60  std::cout << "DDHGCalTBModule: " << layers_.size() << " blocks" <<std::endl;
61  for (unsigned int i=0; i<layers_.size(); ++i)
62  std::cout << "Block [" << i << "] of thickness " << layerThick_[i]
63  << " with " << layers_[i] << " layers" << std::endl;
64 #endif
65  layerType_ = dbl_to_int(vArgs["LayerType"]);
66  layerSense_ = dbl_to_int(vArgs["LayerSense"]);
67 #ifdef EDM_ML_DEBUG
68  std::cout << "DDHGCalTBModule: " << layerType_.size() << " layers"
69  << std::endl;
70  for (unsigned int i=0; i<layerType_.size(); ++i)
71  std::cout << "Layer [" << i << "] with material type " << layerType_[i]
72  << " sensitive class " << layerSense_[i] << std::endl;
73 #endif
74  zMinBlock_ = nArgs["zMinBlock"];
75  rMaxFine_ = nArgs["rMaxFine"];
76  waferW_ = nArgs["waferW"];
77  waferGap_ = nArgs["waferGap"];
78  absorbW_ = nArgs["absorberW"];
79  absorbH_ = nArgs["absorberH"];
80  sectors_ = (int)(nArgs["Sectors"]);
81 #ifdef EDM_ML_DEBUG
82  std::cout << "DDHGCalTBModule: zStart " << zMinBlock_ << " rFineCoarse "
83  << rMaxFine_ << " wafer width " << waferW_ << " gap among wafers "
84  << waferGap_ << " absorber width " << absorbW_ <<" absorber height "
85  << absorbH_ << " sectors " << sectors_ << std::endl;
86 #endif
87  slopeB_ = vArgs["SlopeBottom"];
88  slopeT_ = vArgs["SlopeTop"];
89  zFront_ = vArgs["ZFront"];
90  rMaxFront_ = vArgs["RMaxFront"];
91 #ifdef EDM_ML_DEBUG
92  std::cout << "DDHGCalTBModule: Bottom slopes " << slopeB_[0] << ":"
93  << slopeB_[1] << " and " << slopeT_.size() << " slopes for top"
94  << std::endl;
95  for (unsigned int i=0; i<slopeT_.size(); ++i)
96  std::cout << "Block [" << i << "] Zmin " << zFront_[i] << " Rmax "
97  << rMaxFront_[i] << " Slope " << slopeT_[i] << std::endl;
98 #endif
100 #ifdef EDM_ML_DEBUG
101  std::cout << "DDHGCalTBModule: NameSpace " << idNameSpace_ << std::endl;
102 #endif
103 }
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 223 of file DDHGCalTBModule.cc.

References copies_, popcon2dropbox::copy(), gather_cfg::cout, covers_, DDBase< N, C >::ddname(), DDSplit(), PVValHelper::dx, PVValHelper::dy, plotBeamSpotDB::first, createfilelist::int, gen::k, dataset::name, create_public_lumi_plots::ncol, DDCompactView::position(), rMaxFine_, idealTransformation::rotation, findQualityFiles::rr, edm::second(), mathSSE::sqrt(), funct::tan(), wafer_, waferGap_, and waferW_.

Referenced by constructLayers().

225  {
226  double ww = (waferW_+waferGap_);
227  double dx = 0.5*ww;
228  double dy = 3.0*dx*tan(30.0*CLHEP::deg);
229  double rr = 2.0*dx*tan(30.0*CLHEP::deg);
230  int ncol = (int)(2.0*rout/ww) + 1;
231  int nrow = (int)(rout/(ww*tan(30.0*CLHEP::deg))) + 1;
232  int incm(0), inrm(0), kount(0);
233  double xc[6], yc[6];
234 #ifdef EDM_ML_DEBUG
235  std::cout << glog.ddname() << " rout " << rout << " Row " << nrow
236  << " Column " << ncol << std::endl;
237 #endif
238  for (int nr=-nrow; nr <= nrow; ++nr) {
239  int inr = (nr >= 0) ? nr : -nr;
240  for (int nc=-ncol; nc <= ncol; ++nc) {
241  int inc = (nc >= 0) ? nc : -nc;
242  if (inr%2 == inc%2) {
243  double xpos = nc*dx;
244  double ypos = nr*dy;
245  xc[0] = xpos+dx; yc[0] = ypos-0.5*rr;
246  xc[1] = xpos+dx; yc[1] = ypos+0.5*rr;
247  xc[2] = xpos; yc[2] = ypos+rr;
248  xc[3] = xpos-dx; yc[3] = ypos+0.5*rr;
249  xc[4] = xpos+dx; yc[4] = ypos-0.5*rr;
250  xc[5] = xpos; yc[5] = ypos-rr;
251  bool cornerAll(true);
252  for (int k=0; k<6; ++k) {
253  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
254  if (rpos < rin || rpos > rout) cornerAll = false;
255  }
256  if (cornerAll) {
257  double rpos = std::sqrt(xpos*xpos+ypos*ypos);
258  DDTranslation tran(xpos, ypos, 0.0);
260  int copy = inr*100 + inc;
261  if (nc < 0) copy += 10000;
262  if (nr < 0) copy += 100000;
263  DDName name;
264  if (type == 1) {
265  name = (rpos < rMaxFine_) ?
266  DDName(DDSplit(wafer_[0]).first, DDSplit(wafer_[0]).second) :
267  DDName(DDSplit(wafer_[1]).first, DDSplit(wafer_[1]).second);
268  } else {
269  name = DDName(DDSplit(covers_[type-2]).first,
270  DDSplit(covers_[type-2]).second);
271  }
272  cpv.position(name, glog.ddname(), copy, tran, rotation);
273  if (inc > incm) incm = inc;
274  if (inr > inrm) inrm = inr;
275  kount++;
276  if (copies_.count(copy) == 0 && type == 1)
277  copies_.insert(copy);
278 #ifdef EDM_ML_DEBUG
279  std::cout << "DDHGCalTBModule: " << name << " number " << copy
280  << " positioned in " << glog.ddname() << " at " << tran
281  << " with " << rotation << std::endl;
282 #endif
283  }
284  }
285  }
286  }
287 #ifdef EDM_ML_DEBUG
288  std::cout << "DDHGCalTBModule: # of columns " << incm << " # of rows "
289  << inrm << " and " << kount << " wafers for " << glog.ddname()
290  << std::endl;
291 #endif
292 }
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:67
U second(std::pair< T, U > const &p)
T sqrt(T t)
Definition: SSEVec.h:18
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
int k[5][pyjets_maxn]
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:80
double DDHGCalTBModule::rMax ( double  z)
protected

Definition at line 205 of file DDHGCalTBModule.cc.

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

Referenced by constructLayers().

205  {
206  double r(0);
207 #ifdef EDM_ML_DEBUG
208  unsigned int ik(0);
209 #endif
210  for (unsigned int k=0; k<slopeT_.size(); ++k) {
211  if (z < zFront_[k]) break;
212  r = rMaxFront_[k] + (z - zFront_[k]) * slopeT_[k];
213 #ifdef EDM_ML_DEBUG
214  ik = k;
215 #endif
216  }
217 #ifdef EDM_ML_DEBUG
218  std::cout << "rMax : " << z << ":" << ik << ":" << r << std::endl;
219 #endif
220  return r;
221 }
std::vector< double > rMaxFront_
std::vector< double > zFront_
std::vector< double > slopeT_
int k[5][pyjets_maxn]

Member Data Documentation

double DDHGCalTBModule::absorbH_
private

Definition at line 49 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

double DDHGCalTBModule::absorbW_
private

Definition at line 48 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 57 of file DDHGCalTBModule.h.

Referenced by execute(), and positionSensitive().

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

Definition at line 39 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 35 of file DDHGCalTBModule.h.

Referenced by initialize(), and positionSensitive().

std::string DDHGCalTBModule::idName_
private

Definition at line 55 of file DDHGCalTBModule.h.

std::string DDHGCalTBModule::idNameSpace_
private

Definition at line 56 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 40 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 43 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 41 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 42 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 36 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 37 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

double DDHGCalTBModule::rMaxFine_
private

Definition at line 45 of file DDHGCalTBModule.h.

Referenced by initialize(), and positionSensitive().

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

Definition at line 54 of file DDHGCalTBModule.h.

Referenced by initialize(), and rMax().

int DDHGCalTBModule::sectors_
private

Definition at line 50 of file DDHGCalTBModule.h.

Referenced by initialize().

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

Definition at line 51 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 52 of file DDHGCalTBModule.h.

Referenced by initialize(), and rMax().

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

Definition at line 38 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 34 of file DDHGCalTBModule.h.

Referenced by initialize(), and positionSensitive().

double DDHGCalTBModule::waferGap_
private

Definition at line 47 of file DDHGCalTBModule.h.

Referenced by initialize(), and positionSensitive().

double DDHGCalTBModule::waferW_
private

Definition at line 46 of file DDHGCalTBModule.h.

Referenced by initialize(), and positionSensitive().

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

Definition at line 53 of file DDHGCalTBModule.h.

Referenced by initialize(), and rMax().

double DDHGCalTBModule::zMinBlock_
private

Definition at line 44 of file DDHGCalTBModule.h.

Referenced by constructLayers(), and initialize().