CMS 3D CMS Logo

DDTBH4Algo.cc
Go to the documentation of this file.
1 // File: DDTBH4Algo.cc
3 // Description: Position inside the mother according to (eta,phi)
5 
6 #include <cmath>
7 #include <algorithm>
8 
15 #include "CLHEP/Units/GlobalSystemOfUnits.h"
16 
18  : m_idNameSpace(""),
19  m_BLZBeg(0),
20  m_BLZEnd(0),
21  m_BLZPiv(0),
22  m_BLRadius(0),
23  m_VacName(""),
24  m_VacMat(""),
25  m_vecVacZBeg(),
26  m_vecVacZEnd(),
27  m_WinName(""),
28  m_vecWinMat(),
29  m_vecWinZBeg(),
30  m_vecWinThick(),
31  m_TrgMat(""),
32  m_HoleMat(""),
33  m_TrgVetoHoleRadius(0),
34  m_vecTrgName(),
35  m_vecTrgSide(),
36  m_vecTrgThick(),
37  m_vecTrgPhi(),
38  m_vecTrgXOff(),
39  m_vecTrgYOff(),
40  m_vecTrgZPiv(),
41  m_FibFibName(""),
42  m_FibCladName(""),
43  m_FibFibMat(""),
44  m_FibCladMat(""),
45  m_FibSide(0),
46  m_FibCladThick(0),
47  m_FibLength(0),
48  m_vecFibPhi(),
49  m_vecFibXOff(),
50  m_vecFibYOff(),
51  m_vecFibZPiv()
52 
53 {
54  edm::LogVerbatim("EcalGeom") << "creating an instance if DDTBH4Algo";
55  LogDebug("EcalGeom") << "DDTBH4Algo test: Creating an instance";
56 }
57 
59 
60 DDRotation DDTBH4Algo::myrot(const std::string& s, const CLHEP::HepRotation& r) const {
61  return DDrot(
62  ddname(idNameSpace() + ":" + s),
63  std::make_unique<DDRotationMatrix>(r.xx(), r.xy(), r.xz(), r.yx(), r.yy(), r.yz(), r.zx(), r.zy(), r.zz()));
64 }
65 
67 
69  const std::pair<std::string, std::string> temp(DDSplit(s));
70  return DDName(temp.first, temp.second);
71 }
72 
74  const DDVectorArguments& vArgs,
75  const DDMapArguments& mArgs,
76  const DDStringArguments& sArgs,
77  const DDStringVectorArguments& vsArgs) {
79  m_BLZBeg = nArgs["BLZBeg"];
80  m_BLZEnd = nArgs["BLZEnd"];
81  m_BLZPiv = nArgs["BLZPiv"];
82  m_BLRadius = nArgs["BLRadius"];
83  m_VacName = sArgs["VacName"];
84  m_VacMat = sArgs["VacMat"];
85  m_vecVacZBeg = vArgs["VacZBeg"];
86  m_vecVacZEnd = vArgs["VacZEnd"];
87 
88  m_WinName = sArgs["WinName"];
89  m_vecWinMat = vsArgs["WinMat"];
90  m_vecWinZBeg = vArgs["WinZBeg"];
91  m_vecWinThick = vArgs["WinThick"];
92 
93  m_TrgMat = sArgs["TrgMat"];
94  m_HoleMat = sArgs["HoleMat"];
95  m_TrgVetoHoleRadius = nArgs["TrgVetoHoleRadius"];
96  m_vecTrgName = vsArgs["TrgName"];
97  m_vecTrgSide = vArgs["TrgSide"];
98  m_vecTrgThick = vArgs["TrgThick"];
99  m_vecTrgPhi = vArgs["TrgPhi"];
100  m_vecTrgXOff = vArgs["TrgXOff"];
101  m_vecTrgYOff = vArgs["TrgYOff"];
102  m_vecTrgZPiv = vArgs["TrgZPiv"];
103 
104  m_FibFibName = sArgs["FibFibName"];
105  m_FibCladName = sArgs["FibCladName"];
106  m_FibFibMat = sArgs["FibFibMat"];
107  m_FibCladMat = sArgs["FibCladMat"];
108  m_FibSide = nArgs["FibSide"];
109  m_FibCladThick = nArgs["FibCladThick"];
110  m_FibLength = nArgs["FibLength"];
111  m_vecFibPhi = vArgs["FibPhi"];
112  m_vecFibXOff = vArgs["FibXOff"];
113  m_vecFibYOff = vArgs["FibYOff"];
114  m_vecFibZPiv = vArgs["FibZPiv"];
115 }
116 
118  const unsigned int copyOne(1);
119 
120  const double halfZbl((blZEnd() - blZBeg()) / 2.);
121  for (unsigned int i(0); i != vecVacZBeg().size(); ++i) {
122  DDName vacNameNm(ddname(vacName() + std::to_string(i + 1)));
123  const double halfZvac((vecVacZEnd()[i] - vecVacZBeg()[i]) / 2.);
124  DDSolid vTubeSolid(DDSolidFactory::tubs(vacNameNm, halfZvac, 0, blRadius(), 0 * deg, 360 * deg));
125  const DDLogicalPart vacLog(vacNameNm, vacMat(), vTubeSolid);
126 
127  cpv.position(vacLog,
128  parent().name(),
129  1 + i,
130  DDTranslation(0, 0, -halfZbl + halfZvac + vecVacZBeg()[i] - blZBeg()),
131  DDRotation());
132  }
133 
134  for (unsigned int i(0); i != vecWinZBeg().size(); ++i) {
135  DDName wName(ddname(winName() + std::to_string(i + 1)));
136  DDSolid wTubeSolid(DDSolidFactory::tubs(wName, vecWinThick()[i] / 2., 0, blRadius(), 0 * deg, 360 * deg));
137  const DDLogicalPart wLog(wName, ddmat(vecWinMat()[i]), wTubeSolid);
138 
139  const double off(0 < vecWinZBeg()[i] ? vecWinZBeg()[i] : fabs(vecWinZBeg()[i]) - vecWinThick()[i]);
140 
141  cpv.position(wLog,
142  parent().name(),
143  1 + i,
144  DDTranslation(0, 0, -halfZbl + vecWinThick()[i] / 2. + off - blZBeg()),
145  DDRotation());
146  }
147 
148  for (unsigned int i(0); i != vecTrgName().size(); ++i) {
150  DDSolid tSolid(DDSolidFactory::box(tName, vecTrgSide()[i] / 2., vecTrgSide()[i] / 2., vecTrgThick()[i] / 2.));
151  const DDLogicalPart tLog(tName, trgMat(), tSolid);
152 
153  if (tName.name() == "VETO") {
154  DDName vName(ddname(tName.name() + "Hole"));
155  DDSolid vTubeSolid(
156  DDSolidFactory::tubs(vName, vecTrgThick()[i] / 2., 0, trgVetoHoleRadius(), 0 * deg, 360 * deg));
157  const DDLogicalPart vLog(vName, holeMat(), vTubeSolid);
158 
159  cpv.position(vLog, tName, copyOne, DDTranslation(0, 0, 0), DDRotation());
160  }
161 
162  cpv.position(tLog,
163  parent().name(),
164  copyOne,
165  DDTranslation(vecTrgXOff()[i], vecTrgYOff()[i], vecTrgZPiv()[i] - halfZbl + blZPiv() - blZBeg()),
166  myrot(tName.name() + "Rot", CLHEP::HepRotationZ(vecTrgPhi()[i])));
167  }
168 
169  DDName pName(fibCladName());
170  const double planeWidth(32.5 * fibSide() + 33.5 * fibCladThick());
171  const double planeThick(2 * fibSide() + 3 * fibCladThick());
172  DDSolid pSolid(DDSolidFactory::box(pName, planeWidth / 2., fibLength() / 2., planeThick / 2.));
173  const DDLogicalPart pLog(pName, fibCladMat(), pSolid);
174 
175  DDSolid fSolid(DDSolidFactory::box(fibFibName(), fibSide() / 2., fibLength() / 2., fibSide() / 2.));
176 
177  const DDLogicalPart fLog(fibFibName(), fibFibMat(), fSolid);
178 
179  for (unsigned int j(0); j != 32; ++j) {
180  const double xoff(planeWidth / 2. - (1 + j) * fibCladThick() - (1 + j) * fibSide());
181  const double zoff(-planeThick / 2 + fibCladThick() + fibSide() / 2.);
182  cpv.position(fLog, pName, 1 + j, DDTranslation(xoff, 0, zoff), DDRotation());
183 
184  cpv.position(fLog, pName, 33 + j, DDTranslation(xoff + (fibCladThick() + fibSide()) / 2., 0, -zoff), DDRotation());
185  }
186  for (unsigned int i(0); i != vecFibZPiv().size(); ++i) {
187  cpv.position(
188  pLog,
189  parent().name(),
190  1 + i,
192  vecFibXOff()[i] - 0.5 * fibSide(), vecFibYOff()[i], vecFibZPiv()[i] - halfZbl + blZPiv() - blZBeg()),
193  myrot(pName.name() + "Rot" + std::to_string(i), CLHEP::HepRotationZ(vecFibPhi()[i])));
194  }
195 }
Log< level::Info, true > LogVerbatim
std::string m_idNameSpace
Definition: DDTBH4Algo.h:72
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Definition: DDTBH4Algo.cc:73
std::string m_HoleMat
Definition: DDTBH4Algo.h:88
DDMaterial holeMat() const
Definition: DDTBH4Algo.h:49
std::vector< double > m_vecFibXOff
Definition: DDTBH4Algo.h:106
const std::vector< double > & vecTrgPhi() const
Definition: DDTBH4Algo.h:54
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
std::string m_TrgMat
Definition: DDTBH4Algo.h:87
const std::vector< double > & vecVacZBeg() const
Definition: DDTBH4Algo.h:41
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDMaterial ddmat(const std::string &s) const
Definition: DDTBH4Algo.cc:66
std::string m_FibCladMat
Definition: DDTBH4Algo.h:101
std::vector< double > m_vecWinThick
Definition: DDTBH4Algo.h:85
const std::vector< double > & vecTrgSide() const
Definition: DDTBH4Algo.h:52
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
static std::string & ns()
double blZBeg() const
Definition: DDTBH4Algo.h:35
std::vector< double > m_vecTrgYOff
Definition: DDTBH4Algo.h:95
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
std::string m_VacName
Definition: DDTBH4Algo.h:78
double m_FibLength
Definition: DDTBH4Algo.h:104
std::vector< double > m_vecTrgXOff
Definition: DDTBH4Algo.h:94
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
static std::string to_string(const XMLCh *ch)
DDName fibFibName() const
Definition: DDTBH4Algo.h:59
double m_TrgVetoHoleRadius
Definition: DDTBH4Algo.h:89
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
double m_FibSide
Definition: DDTBH4Algo.h:102
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
double m_FibCladThick
Definition: DDTBH4Algo.h:103
const std::vector< double > & vecVacZEnd() const
Definition: DDTBH4Algo.h:42
const std::vector< double > & vecTrgYOff() const
Definition: DDTBH4Algo.h:56
DDMaterial vacMat() const
Definition: DDTBH4Algo.h:40
const std::vector< double > & vecTrgThick() const
Definition: DDTBH4Algo.h:53
DDMaterial trgMat() const
Definition: DDTBH4Algo.h:48
const std::vector< double > & vecFibXOff() const
Definition: DDTBH4Algo.h:67
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:67
double m_BLZEnd
Definition: DDTBH4Algo.h:75
std::vector< double > m_vecWinZBeg
Definition: DDTBH4Algo.h:84
double trgVetoHoleRadius() const
Definition: DDTBH4Algo.h:50
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:667
std::vector< double > m_vecFibZPiv
Definition: DDTBH4Algo.h:108
std::string m_FibCladName
Definition: DDTBH4Algo.h:99
std::vector< std::string > m_vecWinMat
Definition: DDTBH4Algo.h:83
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
~DDTBH4Algo() override
Definition: DDTBH4Algo.cc:58
double m_BLZPiv
Definition: DDTBH4Algo.h:76
std::vector< double > m_vecTrgThick
Definition: DDTBH4Algo.h:92
std::vector< double > m_vecVacZEnd
Definition: DDTBH4Algo.h:81
std::vector< double > m_vecTrgSide
Definition: DDTBH4Algo.h:91
const std::vector< double > & vecFibZPiv() const
Definition: DDTBH4Algo.h:69
std::vector< double > m_vecTrgPhi
Definition: DDTBH4Algo.h:93
std::vector< double > m_vecFibPhi
Definition: DDTBH4Algo.h:105
double blRadius() const
Definition: DDTBH4Algo.h:38
std::vector< std::string > m_vecTrgName
Definition: DDTBH4Algo.h:90
const std::vector< double > & vecTrgZPiv() const
Definition: DDTBH4Algo.h:57
std::string vacName() const
Definition: DDTBH4Algo.h:39
std::string m_VacMat
Definition: DDTBH4Algo.h:79
DDName ddname(const std::string &s) const
Definition: DDTBH4Algo.cc:68
DDMaterial fibFibMat() const
Definition: DDTBH4Algo.h:61
double fibSide() const
Definition: DDTBH4Algo.h:63
std::string winName() const
Definition: DDTBH4Algo.h:43
std::vector< double > m_vecTrgZPiv
Definition: DDTBH4Algo.h:96
std::string m_FibFibMat
Definition: DDTBH4Algo.h:100
DDRotation myrot(const std::string &s, const CLHEP::HepRotation &r) const
Definition: DDTBH4Algo.cc:60
const std::vector< double > & vecWinThick() const
Definition: DDTBH4Algo.h:46
double m_BLZBeg
Definition: DDTBH4Algo.h:74
const std::string & idNameSpace() const
Definition: DDTBH4Algo.h:33
double fibLength() const
Definition: DDTBH4Algo.h:65
std::vector< double > m_vecVacZBeg
Definition: DDTBH4Algo.h:80
const std::vector< double > & vecFibPhi() const
Definition: DDTBH4Algo.h:66
const std::vector< double > & vecFibYOff() const
Definition: DDTBH4Algo.h:68
const std::vector< double > & vecWinZBeg() const
Definition: DDTBH4Algo.h:45
double m_BLRadius
Definition: DDTBH4Algo.h:77
void execute(DDCompactView &cpv) override
Definition: DDTBH4Algo.cc:117
const std::vector< std::string > & vecTrgName() const
Definition: DDTBH4Algo.h:51
std::vector< double > m_vecFibYOff
Definition: DDTBH4Algo.h:107
double fibCladThick() const
Definition: DDTBH4Algo.h:64
double blZEnd() const
Definition: DDTBH4Algo.h:36
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
DDMaterial fibCladMat() const
Definition: DDTBH4Algo.h:62
DDName fibCladName() const
Definition: DDTBH4Algo.h:60
std::string m_WinName
Definition: DDTBH4Algo.h:82
std::string m_FibFibName
Definition: DDTBH4Algo.h:98
const std::vector< std::string > & vecWinMat() const
Definition: DDTBH4Algo.h:44
double blZPiv() const
Definition: DDTBH4Algo.h:37
const std::vector< double > & vecTrgXOff() const
Definition: DDTBH4Algo.h:55
#define LogDebug(id)