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::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::~DDAHcalModuleAlgo ( )
override

Definition at line 67 of file DDAHcalModuleAlgo.cc.

67 {}

Member Function Documentation

◆ constructLayers()

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

Definition at line 142 of file DDAHcalModuleAlgo.cc.

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
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 }

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().

◆ execute()

void DDAHcalModuleAlgo::execute ( DDCompactView cpv)
override

Definition at line 132 of file DDAHcalModuleAlgo.cc.

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 }

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

◆ initialize()

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.

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 }

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.

◆ positionSensitive()

void DDAHcalModuleAlgo::positionSensitive ( DDLogicalPart glog,
DDCompactView cpv 
)
protected

Definition at line 210 of file DDAHcalModuleAlgo.cc.

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 }

References filterCSVwithJSON::copy, DDBase< N, C >::ddname(), DDSplit(), 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().

Member Data Documentation

◆ copyNumber

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

Definition at line 48 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ heights

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

Definition at line 54 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ idNameSpace

std::string DDAHcalModuleAlgo::idNameSpace
private

Definition at line 58 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ layers

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

Definition at line 49 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ layerSense

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

Definition at line 52 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ layerThick

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

Definition at line 50 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ layerType

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

Definition at line 51 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ materials

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

Definition at line 45 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ names

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

Definition at line 46 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ thick

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

Definition at line 47 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ tile

std::string DDAHcalModuleAlgo::tile
private

Definition at line 44 of file DDAHcalModuleAlgo.cc.

Referenced by initialize(), and positionSensitive().

◆ tileN

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

Definition at line 55 of file DDAHcalModuleAlgo.cc.

Referenced by initialize(), and positionSensitive().

◆ tileStep

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

Definition at line 56 of file DDAHcalModuleAlgo.cc.

Referenced by initialize(), and positionSensitive().

◆ widths

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

Definition at line 53 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ zMinBlock

double DDAHcalModuleAlgo::zMinBlock
private

Definition at line 57 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

mps_fire.i
i
Definition: mps_fire.py:355
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
DDAHcalModuleAlgo::heights
std::vector< double > heights
Definition: DDAHcalModuleAlgo.cc:54
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
DDAHcalModuleAlgo::layerSense
std::vector< int > layerSense
Definition: DDAHcalModuleAlgo.cc:52
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDAHcalModuleAlgo::positionSensitive
void positionSensitive(DDLogicalPart &glog, DDCompactView &cpv)
Definition: DDAHcalModuleAlgo.cc:210
DDAHcalModuleAlgo::tile
std::string tile
Definition: DDAHcalModuleAlgo.cc:44
DDAHcalModuleAlgo::materials
std::vector< std::string > materials
Definition: DDAHcalModuleAlgo.cc:45
DDAHcalModuleAlgo::widths
std::vector< double > widths
Definition: DDAHcalModuleAlgo.cc:53
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
dbl_to_int
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
dqmdumpme.first
first
Definition: dqmdumpme.py:55
DDAHcalModuleAlgo::copyNumber
std::vector< int > copyNumber
Definition: DDAHcalModuleAlgo.cc:48
DDAHcalModuleAlgo::zMinBlock
double zMinBlock
Definition: DDAHcalModuleAlgo.cc:57
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDBase::name
const N & name() const
Definition: DDBase.h:59
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
DDAHcalModuleAlgo::layers
std::vector< int > layers
Definition: DDAHcalModuleAlgo.cc:49
AHCalParameters::kSignRowColumn_
static constexpr int kSignRowColumn_
Definition: AHCalParameters.h:31
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
edm::LogError
Definition: MessageLogger.h:183
EgHLTOffHistBins_cfi.nr
nr
Definition: EgHLTOffHistBins_cfi.py:4
DDBase::ddname
const N & ddname() const
Definition: DDBase.h:61
DDAHcalModuleAlgo::thick
std::vector< double > thick
Definition: DDAHcalModuleAlgo.cc:47
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
edm::LogVerbatim
Definition: MessageLogger.h:297
AHCalParameters::kColumn_
static constexpr int kColumn_
Constants used.
Definition: AHCalParameters.h:27
module
Definition: vlib.h:198
DDAHcalModuleAlgo::names
std::vector< std::string > names
Definition: DDAHcalModuleAlgo.cc:46
DDAHcalModuleAlgo::tileN
std::vector< int > tileN
Definition: DDAHcalModuleAlgo.cc:55
DDAHcalModuleAlgo::idNameSpace
std::string idNameSpace
Definition: DDAHcalModuleAlgo.cc:58
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
DDAHcalModuleAlgo::layerType
std::vector< int > layerType
Definition: DDAHcalModuleAlgo.cc:51
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
DDAHcalModuleAlgo::constructLayers
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
Definition: DDAHcalModuleAlgo.cc:142
DDAHcalModuleAlgo::layerThick
std::vector< double > layerThick
Definition: DDAHcalModuleAlgo.cc:50
DDSolidFactory::box
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
AHCalParameters::kRowColumn_
static constexpr int kRowColumn_
Definition: AHCalParameters.h:30
class-composition.parent
parent
Definition: class-composition.py:88
cuy.ii
ii
Definition: cuy.py:590
DDAHcalModuleAlgo::tileStep
std::vector< double > tileStep
Definition: DDAHcalModuleAlgo.cc:56
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
DDCompactView::position
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Definition: DDCompactView.cc:66