CMS 3D CMS Logo

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

#include <DDAHcalModuleAlgo.h>

Inheritance diagram for DDAHcalModuleAlgo:

Public Member Functions

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

Protected Member Functions

void constructLayers (const DDLogicalPart &, DDCompactView &cpv)
 
void positionSensitive (DDLogicalPart &glog, DDCompactView &cpv)
 

Private Attributes

std::unordered_set< int > copies
 
std::vector< int > copyNumber
 
std::vector< double > heights
 
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
 
std::vector< double > thick
 
std::string tile
 
std::vector< int > tileN
 
std::vector< double > tileStep
 
std::vector< double > widths
 
double zMinBlock
 

Detailed Description

Definition at line 11 of file DDAHcalModuleAlgo.h.

Constructor & Destructor Documentation

DDAHcalModuleAlgo::DDAHcalModuleAlgo ( )

Definition at line 20 of file DDAHcalModuleAlgo.cc.

20  {
21 #ifdef EDM_ML_DEBUG
22  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: Creating an instance";
23 #endif
24 }
DDAHcalModuleAlgo::~DDAHcalModuleAlgo ( )
override

Definition at line 26 of file DDAHcalModuleAlgo.cc.

26 {}

Member Function Documentation

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

Definition at line 113 of file DDAHcalModuleAlgo.cc.

References DDSolidFactory::box(), popcon2dropbox::copy(), copyNumber, DDBase< N, C >::ddname(), DDSplit(), plotBeamSpotDB::first, heights, mps_fire::i, idNameSpace, cuy::ii, layers, layerSense, layerThick, layerType, materials, dataset::name, DDBase< N, C >::name(), names, DDCompactView::position(), positionSensitive(), diffTwoXMLs::r1, makeMuonMisalignmentScenario::rot, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, thick, widths, zMinBlock, and geometryCSVtoXML::zz.

Referenced by execute().

114  {
115 #ifdef EDM_ML_DEBUG
116  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo test: \t\tInside Layers";
117 #endif
118  double zi(zMinBlock);
119  int laymin(0);
120  for (unsigned int i = 0; i < layers.size(); i++) {
121  double zo = zi + layerThick[i];
122  int laymax = laymin + layers[i];
123  double zz = zi;
124  double thickTot(0);
125  for (int ly = laymin; ly < laymax; ++ly) {
126  int ii = layerType[ly];
127  int copy = copyNumber[ii];
128  zz += (0.5 * thick[ii]);
129  thickTot += thick[ii];
130 
131  std::string name = "HGCal" + names[ii] + std::to_string(copy);
132 #ifdef EDM_ML_DEBUG
133  edm::LogVerbatim("HGCalGeom")
134  << "DDAHcalModuleAlgo test: Layer " << ly << ":" << ii << " Front "
135  << zi << " Back " << zo << " superlayer thickness " << layerThick[i];
136 #endif
137  DDName matName(DDSplit(materials[ii]).first,
138  DDSplit(materials[ii]).second);
139  DDMaterial matter(matName);
140  DDLogicalPart glog;
141  if (layerSense[ly] == 0) {
142  DDSolid solid =
143  DDSolidFactory::box(DDName(name, idNameSpace), 0.5 * widths[0],
144  0.5 * heights[0], 0.5 * thick[ii]);
145  glog = DDLogicalPart(solid.ddname(), matter, solid);
146 #ifdef EDM_ML_DEBUG
147  edm::LogVerbatim("HGCalGeom")
148  << "DDAHcalModuleAlgo: " << solid.name() << " Box made of "
149  << matName << " of dimensions " << 0.5 * widths[0] << ", "
150  << 0.5 * heights[0] << ", " << 0.5 * thick[ii];
151 #endif
152  } else {
153  DDSolid solid =
154  DDSolidFactory::box(DDName(name, idNameSpace), 0.5 * widths[1],
155  0.5 * heights[1], 0.5 * thick[ii]);
156  glog = DDLogicalPart(solid.ddname(), matter, solid);
157 #ifdef EDM_ML_DEBUG
158  edm::LogVerbatim("HGCalGeom")
159  << "DDAHcalModuleAlgo: " << solid.name() << " Box made of "
160  << matName << " of dimensions " << 0.5 * widths[1] << ", "
161  << 0.5 * heights[1] << ", " << 0.5 * thick[ii];
162 #endif
163  positionSensitive(glog, cpv);
164  }
165  DDTranslation r1(0, 0, zz);
166  DDRotation rot;
167  cpv.position(glog, module, copy, r1, rot);
168  ++copyNumber[ii];
169 #ifdef EDM_ML_DEBUG
170  edm::LogVerbatim("HGCalGeom")
171  << "DDAHcalModuleAlgo: " << glog.name() << " number " << copy
172  << " positioned in " << module.name() << " at " << r1 << " with "
173  << rot;
174 #endif
175  zz += (0.5 * thick[ii]);
176  } // End of loop over layers in a block
177  zi = zo;
178  laymin = laymax;
179  if (fabs(thickTot - layerThick[i]) < 0.00001) {
180  } else if (thickTot > layerThick[i]) {
181  edm::LogError("HGCalGeom")
182  << "Thickness of the partition " << layerThick[i]
183  << " is smaller than thickness " << thickTot
184  << " of all its components **** ERROR ****\n";
185  } else if (thickTot < layerThick[i]) {
186  edm::LogWarning("HGCalGeom")
187  << "Thickness of the partition " << layerThick[i]
188  << " does not match with " << thickTot << " of the components\n";
189  }
190  } // End of loop over blocks
191 }
std::vector< int > layerType
std::vector< std::string > materials
std::vector< double > widths
const N & name() const
Definition: DDBase.h:74
std::vector< int > copyNumber
def copy(args, dbName)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
std::vector< double > heights
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:68
U second(std::pair< T, U > const &p)
std::vector< double > thick
std::vector< std::string > names
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
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:704
ii
Definition: cuy.py:590
std::vector< double > layerThick
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< int > layers
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::vector< int > layerSense
void positionSensitive(DDLogicalPart &glog, DDCompactView &cpv)
std::string idNameSpace
const N & ddname() const
Definition: DDBase.h:76
void DDAHcalModuleAlgo::execute ( DDCompactView cpv)
override

Definition at line 103 of file DDAHcalModuleAlgo.cc.

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

103  {
104 #ifdef EDM_ML_DEBUG
105  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDAHcalModuleAlgo...";
106 #endif
107  constructLayers(parent(), cpv);
108 #ifdef EDM_ML_DEBUG
109  edm::LogVerbatim("HGCalGeom") <<"<<== End of DDAHcalModuleAlgo construction";
110 #endif
111 }
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
void DDAHcalModuleAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 28 of file DDAHcalModuleAlgo.cc.

References copyNumber, dbl_to_int(), heights, mps_fire::i, idNameSpace, layers, layerSense, layerThick, layerType, materials, names, DDCurrentNamespace::ns(), thick, tile, tileN, tileStep, widths, and zMinBlock.

32  {
33  tile = sArgs["TileName"];
34 #ifdef EDM_ML_DEBUG
35  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: Tile " << tile;
36 #endif
37  materials = vsArgs["MaterialNames"];
38  names = vsArgs["VolumeNames"];
39  thick = vArgs["Thickness"];
40  for (unsigned int i = 0; i < materials.size(); ++i) {
41  copyNumber.emplace_back(1);
42  }
43 #ifdef EDM_ML_DEBUG
44  edm::LogVerbatim("HGCalGeom")
45  << "DDAHcalModuleAlgo: " << materials.size() << " types of volumes";
46  for (unsigned int i = 0; i < names.size(); ++i)
47  edm::LogVerbatim("HGCalGeom")
48  << "Volume [" << i << "] " << names[i] << " of thickness " << thick[i]
49  << " filled with " << materials[i] << " first copy number "
50  << copyNumber[i];
51 #endif
52  layers = dbl_to_int(vArgs["Layers"]);
53  layerThick = vArgs["LayerThick"];
54 #ifdef EDM_ML_DEBUG
55  edm::LogVerbatim("HGCalGeom")
56  << "DDAHcalModuleAlgo: " << layers.size() << " blocks";
57  for (unsigned int i = 0; i < layers.size(); ++i)
58  edm::LogVerbatim("HGCalGeom")
59  << "Block [" << i << "] of thickness " << layerThick[i] << " with "
60  << layers[i] << " layers";
61 #endif
62  layerType = dbl_to_int(vArgs["LayerType"]);
63  layerSense = dbl_to_int(vArgs["LayerSense"]);
64 #ifdef EDM_ML_DEBUG
65  edm::LogVerbatim("HGCalGeom")
66  << "DDAHcalModuleAlgo: " << layerType.size() << " layers";
67  for (unsigned int i = 0; i < layerType.size(); ++i)
68  edm::LogVerbatim("HGCalGeom")
69  << "Layer [" << i << "] with material type " << layerType[i]
70  << " sensitive class " << layerSense[i];
71 #endif
72  widths = vArgs["Widths"];
73  heights = vArgs["Heights"];
74 #ifdef EDM_ML_DEBUG
75  edm::LogVerbatim("HGCalGeom")
76  << "DDAHcalModuleAlgo: " << widths.size() << " sizes for width "
77  << "and height:";
78  for (unsigned int i = 0; i < widths.size(); ++i)
79  edm::LogVerbatim("HGCalGeom")
80  << " [" << i << "] " << widths[i] << ":" << heights[i];
81 #endif
82  tileN = dbl_to_int(vArgs["TileN"]);
83  tileStep = vArgs["TileStep"];
84 #ifdef EDM_ML_DEBUG
85  edm::LogVerbatim("HGCalGeom")
86  << "DDAHcalModuleAlgo: " << tileN.size() << " tile positioning parameters";
87  for (unsigned int i = 0; i < tileN.size(); ++i)
88  edm::LogVerbatim("HGCalGeom")
89  << " [" << i << "] " << tileN[i] << ":" << tileStep[i];
90 #endif
91  zMinBlock = nArgs["zMinBlock"];
93 #ifdef EDM_ML_DEBUG
94  edm::LogVerbatim("HGCalGeom")
95  << "DDAHcalModuleAlgo: NameSpace " << idNameSpace;
96 #endif
97 }
std::vector< int > layerType
std::vector< std::string > materials
std::vector< double > widths
std::vector< int > copyNumber
std::vector< double > heights
static std::string & ns()
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 > thick
std::vector< std::string > names
std::vector< double > layerThick
std::vector< double > tileStep
std::vector< int > layers
std::vector< int > tileN
std::vector< int > layerSense
std::string idNameSpace
void DDAHcalModuleAlgo::positionSensitive ( DDLogicalPart glog,
DDCompactView cpv 
)
protected

Definition at line 193 of file DDAHcalModuleAlgo.cc.

References popcon2dropbox::copy(), DDBase< N, C >::ddname(), DDSplit(), plotBeamSpotDB::first, dataset::name, create_public_lumi_plots::ncol, DDCompactView::position(), idealTransformation::rotation, edm::second(), tile, tileN, and tileStep.

Referenced by constructLayers().

194  {
195  int ncol = tileN[0] / 2;
196  int nrow = tileN[1] / 2;
197 #ifdef EDM_ML_DEBUG
198  int kount(0);
199  edm::LogVerbatim("HGCalGeom")
200  << glog.ddname() << " Row " << nrow << " Column " << ncol;
201 #endif
202  for (int nr = -nrow; nr <= nrow; ++nr) {
203  int inr = (nr >= 0) ? nr : -nr;
204  double ypos =
205  (nr >= 0) ? (inr - 0.5) * tileStep[1] : -(inr - 0.5) * tileStep[1];
206  for (int nc = -ncol; nc <= ncol; ++nc) {
207  int inc = (nc >= 0) ? nc : -nc;
208  double xpos =
209  (nc >= 0) ? (inc - 0.5) * tileStep[0] : -(inc - 0.5) * tileStep[0];
210  if (nr != 0 && nc != 0) {
211  DDTranslation tran(xpos, ypos, 0.0);
213  int copy = inr * 10 + inc;
214  if (nc < 0) copy += 100;
215  if (nr < 0) copy += 1000;
217  cpv.position(name, glog.ddname(), copy, tran, rotation);
218 #ifdef EDM_ML_DEBUG
219  kount++;
220  edm::LogVerbatim("HGCalGeom")
221  << "DDAHcalModuleAlgo: " << name << " number " << copy
222  << " positioned in " << glog.ddname() << " at " << tran
223  << " with " << rotation;
224 #endif
225  }
226  }
227  }
228 #ifdef EDM_ML_DEBUG
229  edm::LogVerbatim("HGCalGeom")
230  << "DDAHcalModuleAlgo: " << kount << " tiles for " << glog.ddname();
231 #endif
232 }
def copy(args, dbName)
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:68
U second(std::pair< T, U > const &p)
std::vector< double > tileStep
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< int > tileN
const N & ddname() const
Definition: DDBase.h:76

Member Data Documentation

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

Definition at line 44 of file DDAHcalModuleAlgo.h.

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

Definition at line 32 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::vector<double> DDAHcalModuleAlgo::heights
private

Definition at line 38 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::string DDAHcalModuleAlgo::idName
private

Definition at line 42 of file DDAHcalModuleAlgo.h.

std::string DDAHcalModuleAlgo::idNameSpace
private

Definition at line 43 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 33 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 36 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 34 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 35 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 29 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 30 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 31 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::string DDAHcalModuleAlgo::tile
private

Definition at line 28 of file DDAHcalModuleAlgo.h.

Referenced by initialize(), and positionSensitive().

std::vector<int> DDAHcalModuleAlgo::tileN
private

Definition at line 39 of file DDAHcalModuleAlgo.h.

Referenced by initialize(), and positionSensitive().

std::vector<double> DDAHcalModuleAlgo::tileStep
private

Definition at line 40 of file DDAHcalModuleAlgo.h.

Referenced by initialize(), and positionSensitive().

std::vector<double> DDAHcalModuleAlgo::widths
private

Definition at line 37 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

double DDAHcalModuleAlgo::zMinBlock
private

Definition at line 41 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().