CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes | Static 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
 

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_
 

Static Private Attributes

static constexpr double tol_ = 0.00001
 

Detailed Description

Definition at line 26 of file DDAHcalModuleAlgo.cc.

Constructor & Destructor Documentation

◆ DDAHcalModuleAlgo()

DDAHcalModuleAlgo::DDAHcalModuleAlgo ( )

Definition at line 62 of file DDAHcalModuleAlgo.cc.

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

Member Function Documentation

◆ constructLayers()

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

Definition at line 139 of file DDAHcalModuleAlgo.cc.

139  {
140 #ifdef EDM_ML_DEBUG
141  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo test: \t\tInside Layers";
142 #endif
143  double zi(zMinBlock_);
144  int laymin(0);
145  for (unsigned int i = 0; i < layers_.size(); i++) {
146  double zo = zi + layerThick_[i];
147  int laymax = laymin + layers_[i];
148  double zz = zi;
149  double thickTot(0);
150  for (int ly = laymin; ly < laymax; ++ly) {
151  int ii = layerType_[ly];
152  int copy = copyNumber_[ii];
153  zz += (0.5 * thick_[ii]);
154  thickTot += thick_[ii];
155 
156  std::string name = "HGCal" + names_[ii] + std::to_string(copy);
157 #ifdef EDM_ML_DEBUG
158  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo test: Layer " << ly << ":" << ii << " Front " << zi
159  << " Back " << zo << " superlayer thickness " << layerThick_[i];
160 #endif
162  DDMaterial matter(matName);
163  DDLogicalPart glog;
164  if (layerSense_[ly] == 0) {
165  DDSolid solid =
166  DDSolidFactory::box(DDName(name, idNameSpace_), 0.5 * widths_[0], 0.5 * heights_[0], 0.5 * thick_[ii]);
167  glog = DDLogicalPart(solid.ddname(), matter, solid);
168 #ifdef EDM_ML_DEBUG
169  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << solid.name() << " Box made of " << matName
170  << " of dimensions " << 0.5 * widths_[0] << ", " << 0.5 * heights_[0] << ", "
171  << 0.5 * thick_[ii];
172 #endif
173  } else {
174  DDSolid solid =
175  DDSolidFactory::box(DDName(name, idNameSpace_), 0.5 * widths_[1], 0.5 * heights_[1], 0.5 * thick_[ii]);
176  glog = DDLogicalPart(solid.ddname(), matter, solid);
177 #ifdef EDM_ML_DEBUG
178  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << solid.name() << " Box made of " << matName
179  << " of dimensions " << 0.5 * widths_[1] << ", " << 0.5 * heights_[1] << ", "
180  << 0.5 * thick_[ii];
181 #endif
182  positionSensitive(glog, cpv);
183  }
184  DDTranslation r1(0, 0, zz);
185  DDRotation rot;
186  cpv.position(glog, module, copy, r1, rot);
187  ++copyNumber_[ii];
188 #ifdef EDM_ML_DEBUG
189  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << glog.name() << " number " << copy << " positioned in "
190  << module.name() << " at " << r1 << " with " << rot;
191 #endif
192  zz += (0.5 * thick_[ii]);
193  } // End of loop over layers in a block
194  zi = zo;
195  laymin = laymax;
196  if (fabs(thickTot - layerThick_[i]) > tol_) {
197  if (thickTot > layerThick_[i]) {
198  edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " is smaller than thickness "
199  << thickTot << " of all its components **** ERROR ****\n";
200  } else {
201  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " does not match with "
202  << thickTot << " of the components\n";
203  }
204  }
205  } // End of loop over blocks
206 }

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_, tol_, widths_, zMinBlock_, and geometryCSVtoXML::zz.

Referenced by execute().

◆ execute()

void DDAHcalModuleAlgo::execute ( DDCompactView cpv)
override

Definition at line 129 of file DDAHcalModuleAlgo.cc.

129  {
130 #ifdef EDM_ML_DEBUG
131  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDAHcalModuleAlgo...";
132 #endif
133  constructLayers(parent(), cpv);
134 #ifdef EDM_ML_DEBUG
135  edm::LogVerbatim("HGCalGeom") << "<<== End of DDAHcalModuleAlgo construction";
136 #endif
137 }

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

72  {
73  tile_ = sArgs["TileName"];
74 #ifdef EDM_ML_DEBUG
75  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: Tile " << tile_;
76 #endif
77  materials_ = vsArgs["MaterialNames"];
78  names_ = vsArgs["VolumeNames"];
79  thick_ = vArgs["Thickness"];
80  copyNumber_.resize(materials_.size(), 1);
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << materials_.size() << " types of volumes";
83  for (unsigned int i = 0; i < names_.size(); ++i)
84  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names_[i] << " of thickness " << thick_[i]
85  << " filled with " << materials_[i] << " first copy number " << copyNumber_[i];
86 #endif
87  layers_ = dbl_to_int(vArgs["Layers"]);
88  layerThick_ = vArgs["LayerThick"];
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << layers_.size() << " blocks";
91  for (unsigned int i = 0; i < layers_.size(); ++i)
92  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness " << layerThick_[i] << " with " << layers_[i]
93  << " layers";
94 #endif
95  layerType_ = dbl_to_int(vArgs["LayerType"]);
96  layerSense_ = dbl_to_int(vArgs["LayerSense"]);
97 #ifdef EDM_ML_DEBUG
98  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << layerType_.size() << " layers";
99  for (unsigned int i = 0; i < layerType_.size(); ++i)
100  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type " << layerType_[i] << " sensitive class "
101  << layerSense_[i];
102 #endif
103  widths_ = vArgs["Widths"];
104  heights_ = vArgs["Heights"];
105 #ifdef EDM_ML_DEBUG
106  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << widths_.size() << " sizes for width "
107  << "and height:";
108  for (unsigned int i = 0; i < widths_.size(); ++i)
109  edm::LogVerbatim("HGCalGeom") << " [" << i << "] " << widths_[i] << ":" << heights_[i];
110 #endif
111  tileN_ = dbl_to_int(vArgs["TileN"]);
112  tileStep_ = vArgs["TileStep"];
113 #ifdef EDM_ML_DEBUG
114  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << tileN_.size() << " tile positioning parameters";
115  for (unsigned int i = 0; i < tileN_.size(); ++i)
116  edm::LogVerbatim("HGCalGeom") << " [" << i << "] " << tileN_[i] << ":" << tileStep_[i];
117 #endif
118  zMinBlock_ = nArgs["zMinBlock"];
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("HGCalGeom") << "DDHGCalModule: zStart " << zMinBlock_ << " NameSpace " << idNameSpace_;
122 #endif
123 }

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

208  {
209  int ncol = tileN_[0] / 2;
210  int nrow = tileN_[1] / 2;
211 #ifdef EDM_ML_DEBUG
212  int kount(0);
213  edm::LogVerbatim("HGCalGeom") << glog.ddname() << " Row " << nrow << " Column " << ncol;
214 #endif
215  for (int nr = -nrow; nr <= nrow; ++nr) {
216  int inr = (nr >= 0) ? nr : -nr;
217  double ypos = (nr >= 0) ? (inr - 0.5) * tileStep_[1] : -(inr - 0.5) * tileStep_[1];
218  for (int nc = -ncol; nc <= ncol; ++nc) {
219  int inc = (nc >= 0) ? nc : -nc;
220  double xpos = (nc >= 0) ? (inc - 0.5) * tileStep_[0] : -(inc - 0.5) * tileStep_[0];
221  if (nr != 0 && nc != 0) {
222  DDTranslation tran(xpos, ypos, 0.0);
224  int copy = inr * AHCalParameters::kColumn_ + inc;
225  if (nc < 0)
227  if (nr < 0)
230  cpv.position(name, glog.ddname(), copy, tran, rotation);
231 #ifdef EDM_ML_DEBUG
232  kount++;
233  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << name << " number " << copy << " positioned in "
234  << glog.ddname() << " at " << tran << " with " << rotation;
235 #endif
236  }
237  }
238  }
239 #ifdef EDM_ML_DEBUG
240  edm::LogVerbatim("HGCalGeom") << "DDAHcalModuleAlgo: " << kount << " tiles for " << glog.ddname();
241 #endif
242 }

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

Referenced by constructLayers(), and initialize().

◆ heights_

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

Definition at line 55 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ idNameSpace_

std::string DDAHcalModuleAlgo::idNameSpace_
private

Definition at line 59 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ layers_

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

Definition at line 50 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ layerSense_

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

Definition at line 53 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ layerThick_

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

Definition at line 51 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ layerType_

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

Definition at line 52 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ materials_

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

Definition at line 46 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ names_

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

Definition at line 47 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ thick_

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

Definition at line 48 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ tile_

std::string DDAHcalModuleAlgo::tile_
private

Definition at line 45 of file DDAHcalModuleAlgo.cc.

Referenced by initialize(), and positionSensitive().

◆ tileN_

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

Definition at line 56 of file DDAHcalModuleAlgo.cc.

Referenced by initialize(), and positionSensitive().

◆ tileStep_

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

Definition at line 57 of file DDAHcalModuleAlgo.cc.

Referenced by initialize(), and positionSensitive().

◆ tol_

constexpr double DDAHcalModuleAlgo::tol_ = 0.00001
staticconstexprprivate

Definition at line 43 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers().

◆ widths_

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

Definition at line 54 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

◆ zMinBlock_

double DDAHcalModuleAlgo::zMinBlock_
private

Definition at line 58 of file DDAHcalModuleAlgo.cc.

Referenced by constructLayers(), and initialize().

mps_fire.i
i
Definition: mps_fire.py:428
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
DDAHcalModuleAlgo::names_
std::vector< std::string > names_
Definition: DDAHcalModuleAlgo.cc:47
DDAHcalModuleAlgo::thick_
std::vector< double > thick_
Definition: DDAHcalModuleAlgo.cc:48
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDAHcalModuleAlgo::positionSensitive
void positionSensitive(DDLogicalPart &glog, DDCompactView &cpv)
Definition: DDAHcalModuleAlgo.cc:208
DDAHcalModuleAlgo::layerType_
std::vector< int > layerType_
Definition: DDAHcalModuleAlgo.cc:52
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
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
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
DDAHcalModuleAlgo::zMinBlock_
double zMinBlock_
Definition: DDAHcalModuleAlgo.cc:58
DDAHcalModuleAlgo::tileStep_
std::vector< double > tileStep_
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
DDAHcalModuleAlgo::materials_
std::vector< std::string > materials_
Definition: DDAHcalModuleAlgo.cc:46
DDAHcalModuleAlgo::layers_
std::vector< int > layers_
Definition: DDAHcalModuleAlgo.cc:50
DDAHcalModuleAlgo::widths_
std::vector< double > widths_
Definition: DDAHcalModuleAlgo.cc:54
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
AHCalParameters::kSignRowColumn_
static constexpr int kSignRowColumn_
Definition: AHCalParameters.h:31
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
EgHLTOffHistBins_cfi.nr
nr
Definition: EgHLTOffHistBins_cfi.py:4
DDBase::ddname
const N & ddname() const
Definition: DDBase.h:61
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDAHcalModuleAlgo::layerSense_
std::vector< int > layerSense_
Definition: DDAHcalModuleAlgo.cc:53
DDAHcalModuleAlgo::tile_
std::string tile_
Definition: DDAHcalModuleAlgo.cc:45
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AHCalParameters::kColumn_
static constexpr int kColumn_
Constants used.
Definition: AHCalParameters.h:27
DDAHcalModuleAlgo::tileN_
std::vector< int > tileN_
Definition: DDAHcalModuleAlgo.cc:56
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
DDAHcalModuleAlgo::idNameSpace_
std::string idNameSpace_
Definition: DDAHcalModuleAlgo.cc:59
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
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::heights_
std::vector< double > heights_
Definition: DDAHcalModuleAlgo.cc:55
DDAHcalModuleAlgo::constructLayers
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
Definition: DDAHcalModuleAlgo.cc:139
DDAHcalModuleAlgo::tol_
static constexpr double tol_
Definition: DDAHcalModuleAlgo.cc:43
DDAHcalModuleAlgo::copyNumber_
std::vector< int > copyNumber_
Definition: DDAHcalModuleAlgo.cc:49
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
edm::Log
Definition: MessageLogger.h:70
class-composition.parent
parent
Definition: class-composition.py:88
DDAHcalModuleAlgo::layerThick_
std::vector< double > layerThick_
Definition: DDAHcalModuleAlgo.cc:51
cuy.ii
ii
Definition: cuy.py:590
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:76