CMS 3D CMS Logo

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

Public Member Functions

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

Private Attributes

std::vector< std::string > layerNames_
 
std::vector< double > layerThick_
 
std::vector< int > layerType_
 
std::string material_
 
std::vector< std::string > materials_
 
std::vector< int > partialTypes_
 
std::vector< int > placementIndex_
 
std::vector< std::string > placementIndexTags_
 
std::vector< std::string > tags_
 
double thick_
 
double waferSepar_
 
double waferSize_
 

Detailed Description

Definition at line 21 of file DDHGCalPassivePartial.cc.

Constructor & Destructor Documentation

◆ DDHGCalPassivePartial()

DDHGCalPassivePartial::DDHGCalPassivePartial ( )
default

◆ ~DDHGCalPassivePartial()

DDHGCalPassivePartial::~DDHGCalPassivePartial ( )
overridedefault

Member Function Documentation

◆ execute()

void DDHGCalPassivePartial::execute ( DDCompactView cpv)
override

Definition at line 93 of file DDHGCalPassivePartial.cc.

References funct::abs(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), DDBase< N, C >::ddname(), DDSplit(), DDSolidFactory::extrudedpolygon(), dqmdumpme::first, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, MainPageGenerator::l, layerNames_, layerThick_, layerType_, visualization-live-secondInstance_cfg::m, material_, materials_, DDBase< N, C >::name(), class-composition::parent, partialTypes_, placementIndex_, placementIndexTags_, DDCompactView::position(), makeMuonMisalignmentScenario::rot, pfClustersFromCombinedCaloHF_cfi::scale, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, tags_, thick_, waferSize_, HGCalWaferMask::waferXY(), and zw().

93  {
94 #ifdef EDM_ML_DEBUG
95  edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalPassivePartial...";
96 #endif
97 
98  static constexpr double tol = 0.00001;
99  std::string parentName = parent().name().name();
100 
101  // Loop over all types
102  for (unsigned int k = 0; k < tags_.size(); ++k) {
103  for (unsigned int m = 0; m < placementIndex_.size(); ++m) {
104  // First the mother
105  std::string mother = parentName + placementIndexTags_[m] + tags_[k];
106  std::vector<std::pair<double, double> > wxy =
108  std::vector<double> xM, yM;
109  for (unsigned int i = 0; i < (wxy.size() - 1); ++i) {
110  xM.emplace_back(wxy[i].first);
111  yM.emplace_back(wxy[i].second);
112  }
113  std::vector<double> zw = {-0.5 * thick_, 0.5 * thick_};
114  std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
115  DDSolid solid = DDSolidFactory::extrudedpolygon(mother, xM, yM, zw, zx, zy, scale);
117  DDMaterial matter(matName);
118  DDLogicalPart glogM = DDLogicalPart(solid.ddname(), matter, solid);
119 #ifdef EDM_ML_DEBUG
120  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassivePartial: " << solid.name() << " extruded polygon made of "
121  << matName << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":"
122  << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":"
123  << scale[1] << " partial " << partialTypes_[k] << " placement index "
124  << placementIndex_[m] << " and " << xM.size() << " edges";
125  for (unsigned int j = 0; j < xM.size(); ++j)
126  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xM[j] << ":" << yM[j];
127 #endif
128 
129  // Then the layers
130  std::vector<DDLogicalPart> glogs(materials_.size());
131  std::vector<int> copyNumber(materials_.size(), 1);
132  double zi(-0.5 * thick_), thickTot(0.0);
133  for (unsigned int l = 0; l < layerType_.size(); l++) {
134  unsigned int i = layerType_[l];
135  wxy = HGCalWaferMask::waferXY(partialTypes_[k], placementIndex_[m], waferSize_, 0.0, 0.0, 0.0, false);
136  std::vector<double> xL, yL;
137  for (unsigned int i0 = 0; i0 < (wxy.size() - 1); ++i0) {
138  xL.emplace_back(wxy[i0].first);
139  yL.emplace_back(wxy[i0].second);
140  }
141 #ifdef EDM_ML_DEBUG
142  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassivePartial:Layer " << l << ":" << i << " T " << layerThick_[i]
143  << " Copy " << copyNumber[i] << " Partial type " << partialTypes_[k];
144 #endif
145  DDRotation rot;
146  if (copyNumber[i] == 1) {
147  zw[0] = -0.5 * layerThick_[i];
148  zw[1] = 0.5 * layerThick_[i];
149  std::string lname = mother + layerNames_[i];
150  solid = DDSolidFactory::extrudedpolygon(lname, xL, yL, zw, zx, zy, scale);
152  DDMaterial matter(matN);
153  glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
154 #ifdef EDM_ML_DEBUG
155  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassivePartial: " << solid.name() << " extruded polygon made of "
156  << matN << " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":"
157  << scale[0] << " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":"
158  << scale[1] << " partial " << partialTypes_[k] << " placement index "
159  << placementIndex_[m] << " and " << xL.size() << " edges";
160  for (unsigned int j = 0; j < xL.size(); ++j)
161  edm::LogVerbatim("HGCalGeom") << "[" << j << "] " << xL[j] << ":" << yL[j];
162 #endif
163  }
164  DDTranslation tran(0, 0, (zi + 0.5 * layerThick_[i]));
165  cpv.position(glogs[i], glogM, copyNumber[i], tran, rot);
166 #ifdef EDM_ML_DEBUG
167  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassivePartial: " << glogs[i].name() << " number " << copyNumber[i]
168  << " positioned in " << glogM.name() << " at " << tran << " with no rotation";
169 #endif
170  ++copyNumber[i];
171  zi += layerThick_[i];
172  thickTot += layerThick_[i];
173  }
174  if ((std::abs(thickTot - thick_) >= tol) && (!layerType_.empty())) {
175  if (thickTot > thick_) {
176  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick_ << " is smaller than " << thickTot
177  << ": thickness of all its components **** ERROR ****";
178  } else {
179  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick_ << " does not match with " << thickTot
180  << " of the components";
181  }
182  }
183  }
184  }
185 }
Log< level::Info, true > LogVerbatim
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
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
Log< level::Error, false > LogError
static std::vector< std::pair< double, double > > waferXY(const int &part, const int &orient, const int &zside, const double &waferSize, const double &offset, const double &xpos, const double &ypos, const bool &v17)
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_
std::vector< std::string > placementIndexTags_
std::vector< std::string > materials_
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< int > partialTypes_
const N & name() const
Definition: DDBase.h:59
std::vector< double > layerThick_
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::vector< int > placementIndex_
auto zw(V v) -> Vec2< typename std::remove_reference< decltype(v[0])>::type >
Definition: ExtVec.h:71
std::vector< std::string > layerNames_
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
std::vector< std::string > tags_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ initialize()

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

Definition at line 49 of file DDHGCalPassivePartial.cc.

References dbl_to_int(), mps_fire::i, dqmdumpme::k, layerNames_, layerThick_, layerType_, visualization-live-secondInstance_cfg::m, material_, materials_, class-composition::parent, partialTypes_, placementIndex_, placementIndexTags_, tags_, thick_, waferSepar_, and waferSize_.

53  {
54  material_ = sArgs["ModuleMaterial"];
55  thick_ = nArgs["ModuleThickness"];
56  waferSize_ = nArgs["WaferSize"];
57 #ifdef EDM_ML_DEBUG
58  waferSepar_ = nArgs["SensorSeparation"];
59  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassivePartial: Module " << parent().name() << " made of " << material_
60  << " T " << thick_ << " Wafer 2r " << waferSize_ << " Half Separation " << waferSepar_;
61 #endif
62  tags_ = vsArgs["Tags"];
63  partialTypes_ = dbl_to_int(vArgs["PartialTypes"]);
64  placementIndex_ = dbl_to_int(vArgs["PlacementIndex"]);
65  placementIndexTags_ = vsArgs["PlacementIndexTags"];
66 #ifdef EDM_ML_DEBUG
67  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassivePartial: " << tags_.size() << " variations of wafer types";
68  for (unsigned int k = 0; k < tags_.size(); ++k) {
69  for (unsigned int m = 0; m < placementIndex_.size(); ++m) {
70  edm::LogVerbatim("HGCalGeom") << "Type[" << k << "] " << tags_[k] << " Partial " << partialTypes_[k]
71  << " Placement Index " << placementIndex_[m] << " Tag " << placementIndexTags_[m];
72  }
73  }
74 #endif
75  layerNames_ = vsArgs["LayerNames"];
76  materials_ = vsArgs["LayerMaterials"];
77  layerThick_ = vArgs["LayerThickness"];
78 #ifdef EDM_ML_DEBUG
79  edm::LogVerbatim("HGCalGeom") << "DDHGCalPassivePartial: " << layerNames_.size() << " types of volumes";
80  for (unsigned int i = 0; i < layerNames_.size(); ++i)
81  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << layerNames_[i] << " of thickness " << layerThick_[i]
82  << " filled with " << materials_[i];
83 #endif
84  layerType_ = dbl_to_int(vArgs["LayerType"]);
85 #ifdef EDM_ML_DEBUG
86  std::ostringstream st1;
87  for (unsigned int i = 0; i < layerType_.size(); ++i)
88  st1 << " [" << i << "] " << layerType_[i];
89  edm::LogVerbatim("HGCalGeom") << "There are " << layerType_.size() << " blocks" << st1.str();
90 #endif
91 }
Log< level::Info, true > LogVerbatim
std::vector< int > layerType_
std::vector< std::string > placementIndexTags_
std::vector< std::string > materials_
std::vector< int > partialTypes_
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 > layerThick_
std::vector< int > placementIndex_
std::vector< std::string > layerNames_
std::vector< std::string > tags_

Member Data Documentation

◆ layerNames_

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

Definition at line 43 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ layerThick_

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

Definition at line 45 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ layerType_

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

Definition at line 46 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ material_

std::string DDHGCalPassivePartial::material_
private

Definition at line 35 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ materials_

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

Definition at line 44 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ partialTypes_

std::vector<int> DDHGCalPassivePartial::partialTypes_
private

Definition at line 40 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ placementIndex_

std::vector<int> DDHGCalPassivePartial::placementIndex_
private

Definition at line 41 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ placementIndexTags_

std::vector<std::string> DDHGCalPassivePartial::placementIndexTags_
private

Definition at line 42 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ tags_

std::vector<std::string> DDHGCalPassivePartial::tags_
private

Definition at line 39 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ thick_

double DDHGCalPassivePartial::thick_
private

Definition at line 36 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().

◆ waferSepar_

double DDHGCalPassivePartial::waferSepar_
private

Definition at line 38 of file DDHGCalPassivePartial.cc.

Referenced by initialize().

◆ waferSize_

double DDHGCalPassivePartial::waferSize_
private

Definition at line 37 of file DDHGCalPassivePartial.cc.

Referenced by execute(), and initialize().