CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDHGCalPassive Class Reference
Inheritance diagram for DDHGCalPassive:

Public Member Functions

 DDHGCalPassive ()
 
void execute (DDCompactView &cpv) override
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
 
 ~DDHGCalPassive () override=default
 

Private Attributes

std::vector< int > absN_
 
std::vector< std::string > absNames_
 
std::vector< double > absX_
 
std::vector< double > absY_
 
double dphi_
 
std::vector< std::string > layerMaterial_
 
std::vector< std::string > layerNames_
 
std::vector< double > layerThick_
 
std::vector< int > layerType_
 
std::string moduleMaterial_
 
double moduleThick_
 
double phi0_
 
int position_
 
int sectors_
 
std::vector< std::string > tagpos_
 
std::vector< std::string > tagsector_
 
std::vector< int > xsignpos_
 

Detailed Description

Definition at line 28 of file DDHGCalPassive.cc.

Constructor & Destructor Documentation

◆ DDHGCalPassive()

DDHGCalPassive::DDHGCalPassive ( )

Definition at line 61 of file DDHGCalPassive.cc.

61  {
62 #ifdef EDM_ML_DEBUG
63  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: Creating an instance";
64 #endif
65 }
Log< level::Info, true > LogVerbatim

◆ ~DDHGCalPassive()

DDHGCalPassive::~DDHGCalPassive ( )
overridedefault

Member Function Documentation

◆ execute()

void DDHGCalPassive::execute ( DDCompactView cpv)
override

Definition at line 132 of file DDHGCalPassive.cc.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), funct::cos(), DDBase< N, C >::ddname(), DDSplit(), DDSolidFactory::extrudedpolygon(), dqmdumpme::first, mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, testProducerWithPsetDescEmpty_cfi::i3, dqmiolumiharvest::j, isotrackApplyRegressor::k, GetRecoTauVFromDQM_MC_cff::kk, MainPageGenerator::l, DDBase< N, C >::name(), class-composition::parent, DDCompactView::position(), makeMuonMisalignmentScenario::rot, isotrackNtupler::scale, edm::second(), funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and zw().

132  {
133 #ifdef EDM_ML_DEBUG
134  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalPassive...";
135 #endif
136  static constexpr double tol = 0.00001;
137 
138  // Loop over positions
139  for (unsigned int i1 = 0; i1 < tagpos_.size(); ++i1) {
140  // Loop over sectors
141  for (int i2 = 0; i2 < sectors_; ++i2) {
142  double phi = phi0_ + i2 * dphi_;
143  double cphi = std::cos(phi);
144  double sphi = std::sin(phi);
145  // Loop over passive volumes
146  int j(0);
147  for (unsigned i3 = 0; i3 < absNames_.size(); ++i3) {
148  //First make the mother
149  std::string parentName = parent().name().name() + absNames_[i3] + tagsector_[i2] + tagpos_[i1];
150  std::vector<double> zw = {-0.5 * moduleThick_, 0.5 * moduleThick_};
151  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
152  std::vector<double> xM(absN_[i3], 0), yM(absN_[i3], 0);
153  for (int k = 0; k < absN_[i3]; ++k) {
154  xM[k] = xsignpos_[i1] * (cphi * absX_[j + k] + sphi * absY_[j + k]);
155  yM[k] = -sphi * absX_[j + k] + cphi * absY_[j + k];
156  }
157  j += absN_[i3];
158  DDSolid solid = DDSolidFactory::extrudedpolygon(parentName, xM, yM, zw, zx, zy, scale);
160  DDMaterial matter(matName);
161  DDLogicalPart glogM = DDLogicalPart(solid.ddname(), matter, solid);
162 #ifdef EDM_ML_DEBUG
163  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: " << solid.name() << " extruded polygon made of " << matName
164  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
165  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
166  << " and " << xM.size() << " edges";
167  for (unsigned int kk = 0; kk < xM.size(); ++kk)
168  edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << xM[kk] << ":" << yM[kk];
169 #endif
170  // Then the layers
171  std::vector<DDLogicalPart> glogs(layerMaterial_.size());
172  std::vector<int> copyNumber(layerMaterial_.size(), 1);
173  double zi(-0.5 * moduleThick_), thickTot(0.0);
174  for (unsigned int l = 0; l < layerType_.size(); l++) {
175  unsigned int i = layerType_[l];
176  if (copyNumber[i] == 1) {
177  zw[0] = -0.5 * layerThick_[i];
178  zw[1] = 0.5 * layerThick_[i];
179  std::string layerName = parentName + layerNames_[i];
180  solid = DDSolidFactory::extrudedpolygon(layerName, xM, yM, zw, zx, zy, scale);
182  DDMaterial matter(matN);
183  glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
184 #ifdef EDM_ML_DEBUG
185  edm::LogVerbatim("HGCalGeom")
186  << "DDHGCalPassive: Layer " << i << ":" << l << ":" << solid.name() << " extruded polygon made of "
187  << matN << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
188  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1] << " and " << xM.size()
189  << " edges";
190  for (unsigned int kk = 0; kk < xM.size(); ++kk)
191  edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << xM[kk] << ":" << yM[kk];
192 #endif
193  }
194  DDTranslation tran0(0, 0, (zi + 0.5 * layerThick_[i]));
195  DDRotation rot;
196  cpv.position(glogs[i], glogM, copyNumber[i], tran0, rot);
197 #ifdef EDM_ML_DEBUG
198  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: " << glogs[i].name() << " number " << copyNumber[i]
199  << " positioned in " << glogM.name() << " at " << tran0 << " with no rotation";
200 #endif
201  ++copyNumber[i];
202  zi += layerThick_[i];
203  thickTot += layerThick_[i];
204  }
205  if ((std::abs(thickTot - moduleThick_) >= tol) && (!layerType_.empty())) {
206  if (thickTot > moduleThick_) {
207  edm::LogError("HGCalGeom") << "Thickness of the partition " << moduleThick_ << " is smaller than "
208  << thickTot << ": thickness of all its components **** ERROR ****";
209  } else {
210  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << moduleThick_ << " does not match with "
211  << thickTot << " of the components";
212  }
213  }
214  }
215  }
216  }
217 }
Log< level::Info, true > LogVerbatim
std::vector< double > absX_
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
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< std::string > layerNames_
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
Log< level::Error, false > LogError
std::vector< std::string > layerMaterial_
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 > xsignpos_
std::vector< std::string > absNames_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::string moduleMaterial_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
std::vector< double > absY_
std::vector< double > layerThick_
std::vector< int > layerType_
const N & name() const
Definition: DDBase.h:58
std::vector< int > absN_
static DDSolid extrudedpolygon(const DDName &name, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< double > &zx, const std::vector< double > &zy, const std::vector< double > &zscale)
Definition: DDSolid.cc:584
std::vector< std::string > tagsector_
const N & ddname() const
Definition: DDBase.h:60
std::vector< std::string > tagpos_
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:84
Log< level::Warning, false > LogWarning
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

◆ initialize()

void DDHGCalPassive::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 67 of file DDHGCalPassive.cc.

References angle_units::operators::convertDegToRad(), angle_units::operators::convertRadToDeg(), dbl_to_int(), mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, class-composition::parent, and to_string().

71  {
72  moduleMaterial_ = sArgs["ModuleMaterial"];
73  moduleThick_ = nArgs["ModuleThick"];
74  sectors_ = static_cast<int>(nArgs["Sectors"]);
75  position_ = static_cast<int>(nArgs["Position"]);
76  phi0_ = convertDegToRad(nArgs["PhiStart"]);
77  dphi_ = (2._pi) / sectors_;
78  if (position_ == 0) {
79  tagpos_.emplace_back("PN");
80  xsignpos_.emplace_back(-1);
81  } else {
82  tagpos_.emplace_back("PP");
83  xsignpos_.emplace_back(1);
84  }
85  for (int k = 0; k < sectors_; ++k)
86  tagsector_.emplace_back("F" + std::to_string(k));
87 #ifdef EDM_ML_DEBUG
88  std::ostringstream st0, st1;
89  for (unsigned int k = 0; k < tagsector_.size(); ++k)
90  st0 << ": " << tagsector_[k];
91  for (unsigned int k = 0; k < tagpos_.size(); ++k)
92  st1 << " " << tagpos_[k] << ":" << xsignpos_[k];
93  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: " << tagpos_.size() << " Modules with base name " << parent().name()
94  << " made of " << moduleMaterial_ << " T " << moduleThick_ << " having " << sectors_
95  << " sectors" << st0.str() << " phi0 " << convertRadToDeg(phi0_) << " dphi "
96  << convertRadToDeg(dphi_) << " Tags:" << st1.str();
97 #endif
98 
99  layerNames_ = vsArgs["LayerNames"];
100  layerMaterial_ = vsArgs["LayerMaterials"];
101  layerThick_ = vArgs["LayerThickness"];
102  layerType_ = dbl_to_int(vArgs["LayerType"]);
103 #ifdef EDM_ML_DEBUG
104  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: " << layerNames_.size() << " types of volumes";
105  for (unsigned int i = 0; i < layerNames_.size(); ++i)
106  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << layerNames_[i] << " of thickness " << layerThick_[i]
107  << " filled with " << layerMaterial_[i];
108  std::ostringstream st2;
109  for (unsigned int i = 0; i < layerType_.size(); ++i)
110  st2 << " [" << i << "] " << layerType_[i];
111  edm::LogVerbatim("HGCalGeom") << "There are " << layerType_.size() << " blocks" << st2.str();
112 #endif
113 
114  absNames_ = vsArgs["AbsorberName"];
115  absN_ = dbl_to_int(vArgs["AbsorberN"]);
116  absX_ = vArgs["AbsorberX"];
117  absY_ = vArgs["AbsorberY"];
118 #ifdef EDM_ML_DEBUG
119  edm::LogVerbatim("HGCalGeom") << "There are " << absNames_.size() << " basic absorber shapes:";
120  unsigned int j(0);
121  for (unsigned int k = 0; k < absNames_.size(); ++k) {
122  std::ostringstream st3;
123  st3 << absNames_[k] << " with " << absN_[k] << " points:";
124  for (int i = 0; i < absN_[k]; ++i)
125  st3 << " (" << absX_[j + i] << ", " << absY_[j + i] << ")";
126  j += absN_[k];
127  edm::LogVerbatim("HGCalGeom") << st3.str();
128  }
129 #endif
130 }
Log< level::Info, true > LogVerbatim
std::vector< double > absX_
constexpr double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< std::string > layerNames_
std::vector< std::string > layerMaterial_
static std::string to_string(const XMLCh *ch)
std::vector< int > xsignpos_
std::vector< std::string > absNames_
std::string moduleMaterial_
std::vector< double > absY_
std::vector< double > layerThick_
std::vector< int > layerType_
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< int > absN_
std::vector< std::string > tagsector_
std::vector< std::string > tagpos_

Member Data Documentation

◆ absN_

std::vector<int> DDHGCalPassive::absN_
private

Definition at line 52 of file DDHGCalPassive.cc.

◆ absNames_

std::vector<std::string> DDHGCalPassive::absNames_
private

Definition at line 51 of file DDHGCalPassive.cc.

◆ absX_

std::vector<double> DDHGCalPassive::absX_
private

Definition at line 53 of file DDHGCalPassive.cc.

◆ absY_

std::vector<double> DDHGCalPassive::absY_
private

Definition at line 54 of file DDHGCalPassive.cc.

◆ dphi_

double DDHGCalPassive::dphi_
private

Definition at line 50 of file DDHGCalPassive.cc.

◆ layerMaterial_

std::vector<std::string> DDHGCalPassive::layerMaterial_
private

Definition at line 56 of file DDHGCalPassive.cc.

◆ layerNames_

std::vector<std::string> DDHGCalPassive::layerNames_
private

Definition at line 55 of file DDHGCalPassive.cc.

◆ layerThick_

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

Definition at line 57 of file DDHGCalPassive.cc.

◆ layerType_

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

Definition at line 58 of file DDHGCalPassive.cc.

◆ moduleMaterial_

std::string DDHGCalPassive::moduleMaterial_
private

Definition at line 42 of file DDHGCalPassive.cc.

◆ moduleThick_

double DDHGCalPassive::moduleThick_
private

Definition at line 43 of file DDHGCalPassive.cc.

◆ phi0_

double DDHGCalPassive::phi0_
private

Definition at line 49 of file DDHGCalPassive.cc.

◆ position_

int DDHGCalPassive::position_
private

Definition at line 46 of file DDHGCalPassive.cc.

◆ sectors_

int DDHGCalPassive::sectors_
private

Definition at line 44 of file DDHGCalPassive.cc.

◆ tagpos_

std::vector<std::string> DDHGCalPassive::tagpos_
private

Definition at line 47 of file DDHGCalPassive.cc.

◆ tagsector_

std::vector<std::string> DDHGCalPassive::tagsector_
private

Definition at line 45 of file DDHGCalPassive.cc.

◆ xsignpos_

std::vector<int> DDHGCalPassive::xsignpos_
private

Definition at line 48 of file DDHGCalPassive.cc.