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 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ constructLayers()

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

Definition at line 139 of file DDAHcalModuleAlgo.cc.

References DDSolidFactory::box(), filterCSVwithJSON::copy, copyNumber_, DDBase< N, C >::ddname(), DDSplit(), first, heights_, mps_fire::i, idNameSpace_, cuy::ii, layers_, layerSense_, layerThick_, layerType_, materials_, callgraph::module, Skims_PA_cff::name, DDBase< N, C >::name(), names_, DDCompactView::position(), positionSensitive(), diffTwoXMLs::r1, makeMuonMisalignmentScenario::rot, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, thick_, cond::impl::to_string(), tol_, widths_, zMinBlock_, and geometryCSVtoXML::zz.

Referenced by execute().

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 }
std::string idNameSpace_
std::vector< double > heights_
Log< level::Info, true > LogVerbatim
static constexpr double tol_
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
std::vector< double > layerThick_
std::vector< int > layers_
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::string to_string(const V &value)
Definition: OMSAccess.h:71
std::vector< std::string > materials_
Log< level::Error, false > LogError
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
std::vector< int > layerType_
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:547
ii
Definition: cuy.py:589
const N & name() const
Definition: DDBase.h:59
std::vector< double > widths_
std::vector< int > copyNumber_
const N & ddname() const
Definition: DDBase.h:61
std::vector< int > layerSense_
std::vector< std::string > names_
Log< level::Warning, false > LogWarning
std::vector< double > thick_
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void positionSensitive(DDLogicalPart &glog, DDCompactView &cpv)

◆ execute()

void DDAHcalModuleAlgo::execute ( DDCompactView cpv)
override

Definition at line 129 of file DDAHcalModuleAlgo.cc.

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

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 }
Log< level::Info, true > LogVerbatim
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)

◆ 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.

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_.

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 }
std::string idNameSpace_
std::vector< double > heights_
Log< level::Info, true > LogVerbatim
std::vector< double > layerThick_
std::vector< int > layers_
static std::string & ns()
std::vector< std::string > materials_
std::vector< int > layerType_
std::vector< double > tileStep_
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 > widths_
std::vector< int > copyNumber_
std::vector< int > layerSense_
std::vector< std::string > names_
std::vector< int > tileN_
std::vector< double > thick_

◆ positionSensitive()

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

Definition at line 208 of file DDAHcalModuleAlgo.cc.

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

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 }
Log< level::Info, true > LogVerbatim
static constexpr int kSignRowColumn_
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
std::vector< double > tileStep_
static constexpr int kRowColumn_
const N & ddname() const
Definition: DDBase.h:61
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
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
static constexpr int kColumn_
Constants used.

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
staticprivate

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