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

double dphi_
 
std::vector< std::string > layerNames_
 
std::vector< double > layerThick_
 
std::vector< int > layerType_
 
std::string material_
 
std::vector< std::string > materials_
 
double moduleThick_
 
int parts_
 
double phi0_
 
std::vector< double > rMaxFront_
 
std::vector< double > rMinFront_
 
int sectors_
 
double shiftBot_
 
double shiftTop_
 
std::vector< double > slopeB_
 
std::vector< double > slopeT_
 
std::vector< std::string > tagLayer_
 
std::vector< std::string > tagSector_
 
double thick_
 
std::vector< double > zFrontB_
 
std::vector< double > zFrontT_
 
double zMinBlock_
 

Detailed Description

Definition at line 28 of file DDHGCalPassive.cc.

Constructor & Destructor Documentation

◆ DDHGCalPassive()

DDHGCalPassive::DDHGCalPassive ( )

Definition at line 66 of file DDHGCalPassive.cc.

66  {
67 #ifdef EDM_ML_DEBUG
68  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: Creating an instance";
69 #endif
70 }
Log< level::Info, true > LogVerbatim

◆ ~DDHGCalPassive()

DDHGCalPassive::~DDHGCalPassive ( )
overridedefault

Member Function Documentation

◆ execute()

void DDHGCalPassive::execute ( DDCompactView cpv)
override

Definition at line 134 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, dqmiolumiharvest::j, dqmdumpme::k, GetRecoTauVFromDQM_MC_cff::kk, MainPageGenerator::l, eostools::move(), DDBase< N, C >::name(), class-composition::parent, DDCompactView::position(), HGCalGeomTools::radius(), makeMuonMisalignmentScenario::rot, l1tEGammaCrystalsEmulatorProducer_cfi::scale, edm::second(), funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and zw().

134  {
135 #ifdef EDM_ML_DEBUG
136  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalPassive...";
137 #endif
138  static constexpr double tol = 0.00001;
139 
140  // Loop over Layers
141  double zim(zMinBlock_);
142  //Loop over layers
143  for (unsigned int j = 0; j < tagLayer_.size(); ++j) {
145  double zo = zim + moduleThick_;
147  zim += moduleThick_;
148  for (unsigned int k = 0; k < tagSector_.size(); ++k) {
149  std::string parentName = parent().name().name() + tagLayer_[j] + tagSector_[k];
150  double phi1 = phi0_ + k * dphi_;
151  double phi2 = phi1 + dphi_;
152  double phi0 = phi1 + 0.5 * dphi_;
153  // First the mother
154  std::vector<double> xM, yM;
155  if (parts_ == 1) {
156  xM = {rinB * cos(phi1), routF * cos(phi1), routF * cos(phi2), rinB * cos(phi2)};
157  yM = {rinB * sin(phi1), routF * sin(phi1), routF * sin(phi2), rinB * sin(phi2)};
158  } else {
159  // workaround for https://github.com/cms-sw/cmssw/issues/44931#issuecomment-2134850535
160  std::vector<double> xTmp = {rinB * cos(phi1),
161  routF * cos(phi1),
162  routF * cos(phi0),
163  routF * cos(phi2),
164  rinB * cos(phi2),
165  rinB * cos(phi0)};
166  std::vector<double> yTmp = {rinB * sin(phi1),
167  routF * sin(phi1),
168  routF * sin(phi0),
169  routF * sin(phi2),
170  rinB * sin(phi2),
171  rinB * sin(phi0)};
172  xM = std::move(xTmp);
173  yM = std::move(yTmp);
174  }
175  std::vector<double> zw = {-0.5 * thick_, 0.5 * thick_};
176  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
177  DDSolid solid = DDSolidFactory::extrudedpolygon(parentName, xM, yM, zw, zx, zy, scale);
179  DDMaterial matter(matName);
180  DDLogicalPart glogM = DDLogicalPart(solid.ddname(), matter, solid);
181 #ifdef EDM_ML_DEBUG
182  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: " << solid.name() << " extruded polygon made of " << matName
183  << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
184  << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
185  << " and " << xM.size() << " edges";
186  for (unsigned int kk = 0; kk < xM.size(); ++kk)
187  edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << xM[kk] << ":" << yM[kk];
188 #endif
189 
190  // Then the layers
191  std::vector<DDLogicalPart> glogs(materials_.size());
192  std::vector<int> copyNumber(materials_.size(), 1);
193  double zi(-0.5 * thick_), thickTot(0.0);
194  for (unsigned int l = 0; l < layerType_.size(); l++) {
195  unsigned int i = layerType_[l];
196  if (copyNumber[i] == 1) {
197  zw[0] = -0.5 * layerThick_[i];
198  zw[1] = 0.5 * layerThick_[i];
199  std::string layerName = parentName + layerNames_[i];
200  solid = DDSolidFactory::extrudedpolygon(layerName, xM, yM, zw, zx, zy, scale);
202  DDMaterial matter(matN);
203  glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
204 #ifdef EDM_ML_DEBUG
205  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: Layer " << i << ":" << l << ":" << solid.name()
206  << " extruded polygon made of " << matN << " z|x|y|s (0) " << zw[0] << ":"
207  << zx[0] << ":" << zy[0] << ":" << scale[0] << " z|x|y|s (1) " << zw[1] << ":"
208  << zx[1] << ":" << zy[1] << ":" << scale[1] << " and " << xM.size() << " edges";
209  for (unsigned int kk = 0; kk < xM.size(); ++kk)
210  edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << xM[kk] << ":" << yM[kk];
211 #endif
212  }
213  DDTranslation tran0(0, 0, (zi + 0.5 * layerThick_[i]));
214  DDRotation rot;
215  cpv.position(glogs[i], glogM, copyNumber[i], tran0, rot);
216 #ifdef EDM_ML_DEBUG
217  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: " << glogs[i].name() << " number " << copyNumber[i]
218  << " positioned in " << glogM.name() << " at " << tran0 << " with no rotation";
219 #endif
220  ++copyNumber[i];
221  zi += layerThick_[i];
222  thickTot += layerThick_[i];
223  }
224  if ((std::abs(thickTot - thick_) >= tol) && (!layerType_.empty())) {
225  if (thickTot > thick_) {
226  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick_ << " is smaller than " << thickTot
227  << ": thickness of all its components **** ERROR ****";
228  } else {
229  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick_ << " does not match with " << thickTot
230  << " of the components";
231  }
232  }
233  }
234  }
235 }
Log< level::Info, true > LogVerbatim
static void radius(double zf, double zb, std::vector< double > const &zFront1, std::vector< double > const &rFront1, std::vector< double > const &slope1, std::vector< double > const &zFront2, std::vector< double > const &rFront2, std::vector< double > const &slope2, int flag, std::vector< double > &zz, std::vector< double > &rin, std::vector< double > &rout)
std::vector< double > rMaxFront_
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< std::string > tagSector_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< std::string > tagLayer_
std::vector< std::string > layerNames_
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
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< std::string > materials_
std::vector< double > zFrontB_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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 > rMinFront_
std::vector< double > layerThick_
std::vector< int > layerType_
std::vector< double > zFrontT_
const N & name() const
Definition: DDBase.h:59
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
const N & ddname() const
Definition: DDBase.h:61
std::string material_
std::vector< double > slopeB_
std::vector< double > slopeT_
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
def move(src, dest)
Definition: eostools.py:511

◆ initialize()

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

Definition at line 72 of file DDHGCalPassive.cc.

References angle_units::operators::convertDegToRad(), angle_units::operators::convertRadToDeg(), dbl_to_int(), mps_fire::i, and class-composition::parent.

76  {
77  material_ = sArgs["ModuleMaterial"];
78  thick_ = nArgs["Thickness"];
79  zMinBlock_ = nArgs["zMinBlock"];
80  moduleThick_ = nArgs["ModuleThick"];
81  tagLayer_ = vsArgs["TagLayer"];
82  tagSector_ = vsArgs["TagSector"];
83  parts_ = static_cast<int>(nArgs["Parts"]);
84  phi0_ = convertDegToRad(nArgs["PhiStart"]);
85  dphi_ = (2._pi) / tagSector_.size();
86 #ifdef EDM_ML_DEBUG
87  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: " << tagLayer_.size() << " Modules with base name "
88  << parent().name() << " made of " << material_ << " T " << thick_ << " Sectors "
89  << tagSector_.size() << " Parts " << parts_ << " phi0 " << convertRadToDeg(phi0_);
90  for (unsigned int i = 0; i < tagLayer_.size(); ++i)
91  edm::LogVerbatim("HGCalGeom") << "Layer " << i << " Tag " << tagLayer_[i] << " T " << moduleThick_;
92  for (unsigned int i = 0; i < tagSector_.size(); ++i)
93  edm::LogVerbatim("HGCalGeom") << "Sector " << i << " Tag " << tagSector_[i] << " W " << convertRadToDeg(dphi_);
94 #endif
95 
96  layerNames_ = vsArgs["LayerNames"];
97  materials_ = vsArgs["LayerMaterials"];
98  layerThick_ = vArgs["LayerThickness"];
99 #ifdef EDM_ML_DEBUG
100  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassive: " << layerNames_.size() << " types of volumes";
101  for (unsigned int i = 0; i < layerNames_.size(); ++i)
102  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << layerNames_[i] << " of thickness " << layerThick_[i]
103  << " filled with " << materials_[i];
104 #endif
105  layerType_ = dbl_to_int(vArgs["LayerType"]);
106 #ifdef EDM_ML_DEBUG
107  std::ostringstream st1;
108  for (unsigned int i = 0; i < layerType_.size(); ++i)
109  st1 << " [" << i << "] " << layerType_[i];
110  edm::LogVerbatim("HGCalGeom") << "There are " << layerType_.size() << " blocks" << st1.str();
111 #endif
112 
113  shiftTop_ = nArgs["ShiftTop"];
114  shiftBot_ = nArgs["ShiftBottom"];
115 #ifdef EDM_ML_DEBUG
116  edm::LogVerbatim("HGCalGeom") << "Shifts st the top " << shiftTop_ << " and at the bottom " << shiftBot_;
117 #endif
118  slopeB_ = vArgs["SlopeBottom"];
119  zFrontB_ = vArgs["ZFrontBottom"];
120  rMinFront_ = vArgs["RMinFront"];
121  slopeT_ = vArgs["SlopeTop"];
122  zFrontT_ = vArgs["ZFrontTop"];
123  rMaxFront_ = vArgs["RMaxFront"];
124 #ifdef EDM_ML_DEBUG
125  for (unsigned int i = 0; i < slopeB_.size(); ++i)
126  edm::LogVerbatim("HGCalGeom") << "Bottom Block [" << i << "] Zmin " << zFrontB_[i] << " Rmin " << rMinFront_[i]
127  << " Slope " << slopeB_[i];
128  for (unsigned int i = 0; i < slopeT_.size(); ++i)
129  edm::LogVerbatim("HGCalGeom") << "Top Block [" << i << "] Zmin " << zFrontT_[i] << " Rmax " << rMaxFront_[i]
130  << " Slope " << slopeT_[i];
131 #endif
132 }
Log< level::Info, true > LogVerbatim
constexpr double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
std::vector< double > rMaxFront_
std::vector< std::string > tagSector_
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
std::vector< std::string > tagLayer_
std::vector< std::string > layerNames_
std::vector< std::string > materials_
std::vector< double > zFrontB_
std::vector< double > rMinFront_
std::vector< double > layerThick_
std::vector< int > layerType_
std::vector< double > zFrontT_
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::string material_
std::vector< double > slopeB_
std::vector< double > slopeT_

Member Data Documentation

◆ dphi_

double DDHGCalPassive::dphi_
private

Definition at line 51 of file DDHGCalPassive.cc.

◆ layerNames_

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

Definition at line 54 of file DDHGCalPassive.cc.

◆ layerThick_

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

Definition at line 56 of file DDHGCalPassive.cc.

◆ layerType_

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

Definition at line 57 of file DDHGCalPassive.cc.

◆ material_

std::string DDHGCalPassive::material_
private

Definition at line 42 of file DDHGCalPassive.cc.

◆ materials_

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

Definition at line 55 of file DDHGCalPassive.cc.

◆ moduleThick_

double DDHGCalPassive::moduleThick_
private

Definition at line 45 of file DDHGCalPassive.cc.

◆ parts_

int DDHGCalPassive::parts_
private

Definition at line 48 of file DDHGCalPassive.cc.

◆ phi0_

double DDHGCalPassive::phi0_
private

Definition at line 50 of file DDHGCalPassive.cc.

◆ rMaxFront_

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

Definition at line 63 of file DDHGCalPassive.cc.

◆ rMinFront_

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

Definition at line 60 of file DDHGCalPassive.cc.

◆ sectors_

int DDHGCalPassive::sectors_
private

Definition at line 47 of file DDHGCalPassive.cc.

◆ shiftBot_

double DDHGCalPassive::shiftBot_
private

Definition at line 53 of file DDHGCalPassive.cc.

◆ shiftTop_

double DDHGCalPassive::shiftTop_
private

Definition at line 52 of file DDHGCalPassive.cc.

◆ slopeB_

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

Definition at line 58 of file DDHGCalPassive.cc.

◆ slopeT_

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

Definition at line 61 of file DDHGCalPassive.cc.

◆ tagLayer_

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

Definition at line 46 of file DDHGCalPassive.cc.

◆ tagSector_

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

Definition at line 49 of file DDHGCalPassive.cc.

◆ thick_

double DDHGCalPassive::thick_
private

Definition at line 43 of file DDHGCalPassive.cc.

◆ zFrontB_

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

Definition at line 59 of file DDHGCalPassive.cc.

◆ zFrontT_

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

Definition at line 62 of file DDHGCalPassive.cc.

◆ zMinBlock_

double DDHGCalPassive::zMinBlock_
private

Definition at line 44 of file DDHGCalPassive.cc.