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 22 of file DDAHcalModuleAlgo.cc.

References gather_cfg::cout.

22  {
23 #ifdef EDM_ML_DEBUG
24  std::cout << "DDAHcalModuleAlgo info: Creating an instance" << std::endl;
25 #endif
26 }
DDAHcalModuleAlgo::~DDAHcalModuleAlgo ( )
override

Definition at line 28 of file DDAHcalModuleAlgo.cc.

28 {}

Member Function Documentation

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

Definition at line 111 of file DDAHcalModuleAlgo.cc.

References DDSolidFactory::box(), popcon2dropbox::copy(), copyNumber, gather_cfg::cout, 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().

112  {
113 
114 #ifdef EDM_ML_DEBUG
115  std::cout << "DDAHcalModuleAlgo test: \t\tInside Layers" << std::endl;
116 #endif
117  double zi(zMinBlock);
118  int laymin(0);
119  for (unsigned int i=0; i<layers.size(); i++) {
120  double zo = zi + layerThick[i];
121  int laymax = laymin+layers[i];
122  double zz = zi;
123  double thickTot(0);
124  for (int ly=laymin; ly<laymax; ++ly) {
125  int ii = layerType[ly];
126  int copy = copyNumber[ii];
127  zz += (0.5*thick[ii]);
128  thickTot += thick[ii];
129 
130  std::string name = "HGCal"+names[ii]+std::to_string(copy);
131 #ifdef EDM_ML_DEBUG
132  std::cout << "DDAHcalModuleAlgo test: Layer " << ly << ":" << ii
133  << " Front " << zi << " Back " << zo
134  << " superlayer thickness " << layerThick[i] << std::endl;
135 #endif
136  DDName matName(DDSplit(materials[ii]).first,
137  DDSplit(materials[ii]).second);
138  DDMaterial matter(matName);
139  DDLogicalPart glog;
140  if (layerSense[ly] == 0) {
142  0.5*widths[0], 0.5*heights[0],
143  0.5*thick[ii]);
144  glog = DDLogicalPart(solid.ddname(), matter, solid);
145 #ifdef EDM_ML_DEBUG
146  std::cout << "DDAHcalModuleAlgo test: " << solid.name()
147  << " Box made of " << matName << " of dimensions "
148  << 0.5*widths[0] << ", " << 0.5*heights[0] << ", "
149  << 0.5*thick[ii] << std::endl;
150 #endif
151  } else {
153  0.5*widths[1], 0.5*heights[1],
154  0.5*thick[ii]);
155  glog = DDLogicalPart(solid.ddname(), matter, solid);
156 #ifdef EDM_ML_DEBUG
157  std::cout << "DDAHcalModuleAlgo test: " << solid.name()
158  << " Box made of " << matName << " of dimensions "
159  << 0.5*widths[1] << ", " << 0.5*heights[1] << ", "
160  << 0.5*thick[ii] << std::endl;
161 #endif
162  positionSensitive(glog,cpv);
163  }
164  DDTranslation r1(0,0,zz);
165  DDRotation rot;
166  cpv.position(glog, module, copy, r1, rot);
167  ++copyNumber[ii];
168 #ifdef EDM_ML_DEBUG
169  std::cout << "DDAHcalModuleAlgo test: " << glog.name() << " number "
170  << copy << " positioned in " << module.name() << " at " << r1
171  << " with " << rot << std::endl;
172 #endif
173  zz += (0.5*thick[ii]);
174  } // End of loop over layers in a block
175  zi = zo;
176  laymin = laymax;
177  if (fabs(thickTot-layerThick[i]) < 0.00001) {
178  } else if (thickTot > layerThick[i]) {
179  edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick[i]
180  << " is smaller than thickness " << thickTot
181  << " of all its components **** ERROR ****\n";
182  } else if (thickTot < layerThick[i]) {
183  edm::LogWarning("HGCalGeom") << "Thickness of the partition "
184  << layerThick[i] << " does not match with "
185  << thickTot << " of the components\n";
186  }
187  } // End of loop over blocks
188 }
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 100 of file DDAHcalModuleAlgo.cc.

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

100  {
101 
102 #ifdef EDM_ML_DEBUG
103  std::cout << "==>> Constructing DDAHcalModuleAlgo..." << std::endl;
104 #endif
105  constructLayers (parent(), cpv);
106 #ifdef EDM_ML_DEBUG
107  std::cout << "<<== End of DDAHcalModuleAlgo construction ..." << std::endl;
108 #endif
109 }
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 30 of file DDAHcalModuleAlgo.cc.

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

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

References popcon2dropbox::copy(), gather_cfg::cout, 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().

191  {
192  int ncol = tileN[0]/2;
193  int nrow = tileN[1]/2;
194 #ifdef EDM_ML_DEBUG
195  int kount(0);
196  std::cout << glog.ddname() << " Row " << nrow << " Column " << ncol
197  << std::endl;
198 #endif
199  for (int nr=-nrow; nr <= nrow; ++nr) {
200  int inr = (nr >= 0) ? nr : -nr;
201  double ypos = (nr >= 0) ? (inr-0.5)*tileStep[1] : -(inr-0.5)*tileStep[1];
202  for (int nc=-ncol; nc <= ncol; ++nc) {
203  int inc = (nc >= 0) ? nc : -nc;
204  double xpos = (nc >= 0) ? (inc-0.5)*tileStep[0] : -(inc-0.5)*tileStep[0];
205  if (nr != 0 && nc != 0) {
206  DDTranslation tran(xpos, ypos, 0.0);
208  int copy = inr*10 + inc;
209  if (nc < 0) copy += 100;
210  if (nr < 0) copy += 1000;
212  cpv.position(name, glog.ddname(), copy, tran, rotation);
213 #ifdef EDM_ML_DEBUG
214  kount++;
215  std::cout << "DDAHcalModuleAlgo: " << name << " number " << copy
216  << " positioned in " << glog.ddname() << " at " << tran
217  << " with " << rotation << std::endl;
218 #endif
219  }
220  }
221  }
222 #ifdef EDM_ML_DEBUG
223  std::cout << "DDAHcalModuleAlgo: " << kount << " tiles for "
224  << glog.ddname() << std::endl;
225 #endif
226 }
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 48 of file DDAHcalModuleAlgo.h.

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

Definition at line 36 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 42 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::string DDAHcalModuleAlgo::idName
private

Definition at line 46 of file DDAHcalModuleAlgo.h.

std::string DDAHcalModuleAlgo::idNameSpace
private

Definition at line 47 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 37 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 40 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 38 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 39 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 33 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 34 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

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

Definition at line 35 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

std::string DDAHcalModuleAlgo::tile
private

Definition at line 32 of file DDAHcalModuleAlgo.h.

Referenced by initialize(), and positionSensitive().

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

Definition at line 43 of file DDAHcalModuleAlgo.h.

Referenced by initialize(), and positionSensitive().

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

Definition at line 44 of file DDAHcalModuleAlgo.h.

Referenced by initialize(), and positionSensitive().

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

Definition at line 41 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().

double DDAHcalModuleAlgo::zMinBlock
private

Definition at line 45 of file DDAHcalModuleAlgo.h.

Referenced by constructLayers(), and initialize().