CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
DDAHcalModuleAlgo Class Reference
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::vector< int > copyNumber
 
std::vector< double > heights
 
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 26 of file DDAHcalModuleAlgo.cc.

Constructor & Destructor Documentation

DDAHcalModuleAlgo::DDAHcalModuleAlgo ( )

Definition at line 61 of file DDAHcalModuleAlgo.cc.

61  {
62 #ifdef EDM_ML_DEBUG
63  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: Creating an instance";
64 #endif
65 }
DDAHcalModuleAlgo::~DDAHcalModuleAlgo ( )
override

Definition at line 67 of file DDAHcalModuleAlgo.cc.

67 {}

Member Function Documentation

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

Definition at line 142 of file DDAHcalModuleAlgo.cc.

References DDSolidFactory::box(), filterCSVwithJSON::copy, copyNumber, DDBase< N, C >::ddname(), DDSplit(), dqmdumpme::first, heights, mps_fire::i, idNameSpace, cuy::ii, layers, layerSense, layerThick, layerType, materials, Skims_PA_cff::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().

142  {
143 #ifdef EDM_ML_DEBUG
144  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo test: \t\tInside Layers";
145 #endif
146  double zi(zMinBlock);
147  int laymin(0);
148  for (unsigned int i = 0; i < layers.size(); i++) {
149  double zo = zi + layerThick[i];
150  int laymax = laymin + layers[i];
151  double zz = zi;
152  double thickTot(0);
153  for (int ly = laymin; ly < laymax; ++ly) {
154  int ii = layerType[ly];
155  int copy = copyNumber[ii];
156  zz += (0.5 * thick[ii]);
157  thickTot += thick[ii];
158 
159  std::string name = "HGCal" + names[ii] + std::to_string(copy);
160 #ifdef EDM_ML_DEBUG
161  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo test: Layer " << ly << ":" << ii << " Front " << zi
162  << " Back " << zo << " superlayer thickness " << layerThick[i];
163 #endif
164  DDName matName(DDSplit(materials[ii]).first, DDSplit(materials[ii]).second);
165  DDMaterial matter(matName);
166  DDLogicalPart glog;
167  if (layerSense[ly] == 0) {
168  DDSolid solid =
169  DDSolidFactory::box(DDName(name, idNameSpace), 0.5 * widths[0], 0.5 * heights[0], 0.5 * thick[ii]);
170  glog = DDLogicalPart(solid.ddname(), matter, solid);
171 #ifdef EDM_ML_DEBUG
172  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << solid.name() << " Box made of " << matName
173  << " of dimensions " << 0.5 * widths[0] << ", " << 0.5 * heights[0] << ", "
174  << 0.5 * thick[ii];
175 #endif
176  } else {
177  DDSolid solid =
178  DDSolidFactory::box(DDName(name, idNameSpace), 0.5 * widths[1], 0.5 * heights[1], 0.5 * thick[ii]);
179  glog = DDLogicalPart(solid.ddname(), matter, solid);
180 #ifdef EDM_ML_DEBUG
181  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << solid.name() << " Box made of " << matName
182  << " of dimensions " << 0.5 * widths[1] << ", " << 0.5 * heights[1] << ", "
183  << 0.5 * thick[ii];
184 #endif
185  positionSensitive(glog, cpv);
186  }
187  DDTranslation r1(0, 0, zz);
188  DDRotation rot;
189  cpv.position(glog, module, copy, r1, rot);
190  ++copyNumber[ii];
191 #ifdef EDM_ML_DEBUG
192  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << glog.name() << " number " << copy << " positioned in "
193  << module.name() << " at " << r1 << " with " << rot;
194 #endif
195  zz += (0.5 * thick[ii]);
196  } // End of loop over layers in a block
197  zi = zo;
198  laymin = laymax;
199  if (fabs(thickTot - layerThick[i]) < 0.00001) {
200  } else if (thickTot > layerThick[i]) {
201  edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick[i] << " is smaller than thickness "
202  << thickTot << " of all its components **** ERROR ****\n";
203  } else if (thickTot < layerThick[i]) {
204  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << layerThick[i] << " does not match with "
205  << thickTot << " of the components\n";
206  }
207  } // End of loop over blocks
208 }
std::vector< int > layerType
std::vector< std::string > materials
std::vector< double > widths
const N & name() const
Definition: DDBase.h:59
std::vector< int > copyNumber
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
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:57
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:533
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)
const N & ddname() const
Definition: DDBase.h:61
void DDAHcalModuleAlgo::execute ( DDCompactView cpv)
override

Definition at line 132 of file DDAHcalModuleAlgo.cc.

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

132  {
133 #ifdef EDM_ML_DEBUG
134  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDAHcalModuleAlgo...";
135 #endif
136  constructLayers(parent(), cpv);
137 #ifdef EDM_ML_DEBUG
138  edm::LogVerbatim("HGCalGeom") << "<<== End of DDAHcalModuleAlgo construction";
139 #endif
140 }
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 69 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.

73  {
74  tile = sArgs["TileName"];
75 #ifdef EDM_ML_DEBUG
76  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: Tile " << tile;
77 #endif
78  materials = vsArgs["MaterialNames"];
79  names = vsArgs["VolumeNames"];
80  thick = vArgs["Thickness"];
81  for (unsigned int i = 0; i < materials.size(); ++i) {
82  copyNumber.emplace_back(1);
83  }
84 #ifdef EDM_ML_DEBUG
85  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << materials.size() << " types of volumes";
86  for (unsigned int i = 0; i < names.size(); ++i)
87  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names[i] << " of thickness " << thick[i]
88  << " filled with " << materials[i] << " first copy number " << copyNumber[i];
89 #endif
90  layers = dbl_to_int(vArgs["Layers"]);
91  layerThick = vArgs["LayerThick"];
92 #ifdef EDM_ML_DEBUG
93  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << layers.size() << " blocks";
94  for (unsigned int i = 0; i < layers.size(); ++i)
95  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << layerThick[i] << " with " << layers[i]
96  << " layers";
97 #endif
98  layerType = dbl_to_int(vArgs["LayerType"]);
99  layerSense = dbl_to_int(vArgs["LayerSense"]);
100 #ifdef EDM_ML_DEBUG
101  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << layerType.size() << " layers";
102  for (unsigned int i = 0; i < layerType.size(); ++i)
103  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType[i] << " sensitive class "
104  << layerSense[i];
105 #endif
106  widths = vArgs["Widths"];
107  heights = vArgs["Heights"];
108 #ifdef EDM_ML_DEBUG
109  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << widths.size() << " sizes for width "
110  << "and height:";
111  for (unsigned int i = 0; i < widths.size(); ++i)
112  edm::LogVerbatim("HGCalGeom") << " [" << i << "] " << widths[i] << ":" << heights[i];
113 #endif
114  tileN = dbl_to_int(vArgs["TileN"]);
115  tileStep = vArgs["TileStep"];
116 #ifdef EDM_ML_DEBUG
117  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << tileN.size() << " tile positioning parameters";
118  for (unsigned int i = 0; i < tileN.size(); ++i)
119  edm::LogVerbatim("HGCalGeom") << " [" << i << "] " << tileN[i] << ":" << tileStep[i];
120 #endif
121  zMinBlock = nArgs["zMinBlock"];
123 #ifdef EDM_ML_DEBUG
124  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: zStart " << zMinBlock << " NameSpace " << idNameSpace;
125 #endif
126 }
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
void DDAHcalModuleAlgo::positionSensitive ( DDLogicalPart glog,
DDCompactView cpv 
)
protected

Definition at line 210 of file DDAHcalModuleAlgo.cc.

References filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), DEFINE_EDM_PLUGIN, dqmdumpme::first, AHCalParameters::kColumn_, AHCalParameters::kRowColumn_, AHCalParameters::kSignRowColumn_, Skims_PA_cff::name, EgHLTOffHistBins_cfi::nr, DDCompactView::position(), idealTransformation::rotation, edm::second(), tile, tileN, and tileStep.

Referenced by constructLayers().

210  {
211  int ncol = tileN[0] / 2;
212  int nrow = tileN[1] / 2;
213 #ifdef EDM_ML_DEBUG
214  int kount(0);
215  edm::LogVerbatim("HGCalGeom") << glog.ddname() << " Row " << nrow << " Column " << ncol;
216 #endif
217  for (int nr = -nrow; nr <= nrow; ++nr) {
218  int inr = (nr >= 0) ? nr : -nr;
219  double ypos = (nr >= 0) ? (inr - 0.5) * tileStep[1] : -(inr - 0.5) * tileStep[1];
220  for (int nc = -ncol; nc <= ncol; ++nc) {
221  int inc = (nc >= 0) ? nc : -nc;
222  double xpos = (nc >= 0) ? (inc - 0.5) * tileStep[0] : -(inc - 0.5) * tileStep[0];
223  if (nr != 0 && nc != 0) {
224  DDTranslation tran(xpos, ypos, 0.0);
226  int copy = inr * AHCalParameters::kColumn_ + inc;
227  if (nc < 0)
229  if (nr < 0)
232  cpv.position(name, glog.ddname(), copy, tran, rotation);
233 #ifdef EDM_ML_DEBUG
234  kount++;
235  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << name << " number " << copy << " positioned in "
236  << glog.ddname() << " at " << tran << " with " << rotation;
237 #endif
238  }
239  }
240  }
241 #ifdef EDM_ML_DEBUG
242  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << kount << " tiles for " << glog.ddname();
243 #endif
244 }
static constexpr int kSignRowColumn_
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)
static constexpr int kRowColumn_
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::vector< int > tileN
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
static constexpr int kColumn_
Constants used.
const N & ddname() const
Definition: DDBase.h:61

Member Data Documentation

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

Definition at line 48 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

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

Definition at line 54 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

std::string DDAHcalModuleAlgo::idNameSpace
private

Definition at line 58 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

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

Definition at line 49 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

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

Definition at line 52 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

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

Definition at line 50 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

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

Definition at line 51 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

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

Definition at line 45 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

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

Definition at line 46 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

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

Definition at line 47 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

std::string DDAHcalModuleAlgo::tile
private

Definition at line 44 of file DDAHcalModuleAlgo.cc.

Referenced by initialize(), and positionSensitive().

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

Definition at line 55 of file DDAHcalModuleAlgo.cc.

Referenced by initialize(), and positionSensitive().

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

Definition at line 56 of file DDAHcalModuleAlgo.cc.

Referenced by initialize(), and positionSensitive().

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

Definition at line 53 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

double DDAHcalModuleAlgo::zMinBlock
private

Definition at line 57 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().