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/SystemOfUnits.h>
16 
17 using CLHEP::deg;
18 
20  : m_idNameSpace(""),
21  m_BLZBeg(0),
22  m_BLZEnd(0),
23  m_BLZPiv(0),
24  m_BLRadius(0),
25  m_VacName(""),
26  m_VacMat(""),
27  m_vecVacZBeg(),
28  m_vecVacZEnd(),
29  m_WinName(""),
30  m_vecWinMat(),
31  m_vecWinZBeg(),
32  m_vecWinThick(),
33  m_TrgMat(""),
34  m_HoleMat(""),
35  m_TrgVetoHoleRadius(0),
36  m_vecTrgName(),
37  m_vecTrgSide(),
38  m_vecTrgThick(),
39  m_vecTrgPhi(),
40  m_vecTrgXOff(),
41  m_vecTrgYOff(),
42  m_vecTrgZPiv(),
43  m_FibFibName(""),
44  m_FibCladName(""),
45  m_FibFibMat(""),
46  m_FibCladMat(""),
47  m_FibSide(0),
48  m_FibCladThick(0),
49  m_FibLength(0),
50  m_vecFibPhi(),
51  m_vecFibXOff(),
52  m_vecFibYOff(),
53  m_vecFibZPiv()
54 
55 {
56  edm::LogVerbatim("EcalGeom") << "creating an instance if DDTBH4Algo";
57  LogDebug("EcalGeom") << "DDTBH4Algo test: Creating an instance";
58 }
59 
61 
62 DDRotation DDTBH4Algo::myrot(const std::string& s, const CLHEP::HepRotation& r) const {
63  return DDrot(
64  ddname(idNameSpace() + ":" + s),
65  std::make_unique<DDRotationMatrix>(r.xx(), r.xy(), r.xz(), r.yx(), r.yy(), r.yz(), r.zx(), r.zy(), r.zz()));
66 }
67 
69 
71  const std::pair<std::string, std::string> temp(DDSplit(s));
72  return DDName(temp.first, temp.second);
73 }
74 
76  const DDVectorArguments& vArgs,
77  const DDMapArguments& mArgs,
78  const DDStringArguments& sArgs,
79  const DDStringVectorArguments& vsArgs) {
81  m_BLZBeg = nArgs["BLZBeg"];
82  m_BLZEnd = nArgs["BLZEnd"];
83  m_BLZPiv = nArgs["BLZPiv"];
84  m_BLRadius = nArgs["BLRadius"];
85  m_VacName = sArgs["VacName"];
86  m_VacMat = sArgs["VacMat"];
87  m_vecVacZBeg = vArgs["VacZBeg"];
88  m_vecVacZEnd = vArgs["VacZEnd"];
89 
90  m_WinName = sArgs["WinName"];
91  m_vecWinMat = vsArgs["WinMat"];
92  m_vecWinZBeg = vArgs["WinZBeg"];
93  m_vecWinThick = vArgs["WinThick"];
94 
95  m_TrgMat = sArgs["TrgMat"];
96  m_HoleMat = sArgs["HoleMat"];
97  m_TrgVetoHoleRadius = nArgs["TrgVetoHoleRadius"];
98  m_vecTrgName = vsArgs["TrgName"];
99  m_vecTrgSide = vArgs["TrgSide"];
100  m_vecTrgThick = vArgs["TrgThick"];
101  m_vecTrgPhi = vArgs["TrgPhi"];
102  m_vecTrgXOff = vArgs["TrgXOff"];
103  m_vecTrgYOff = vArgs["TrgYOff"];
104  m_vecTrgZPiv = vArgs["TrgZPiv"];
105 
106  m_FibFibName = sArgs["FibFibName"];
107  m_FibCladName = sArgs["FibCladName"];
108  m_FibFibMat = sArgs["FibFibMat"];
109  m_FibCladMat = sArgs["FibCladMat"];
110  m_FibSide = nArgs["FibSide"];
111  m_FibCladThick = nArgs["FibCladThick"];
112  m_FibLength = nArgs["FibLength"];
113  m_vecFibPhi = vArgs["FibPhi"];
114  m_vecFibXOff = vArgs["FibXOff"];
115  m_vecFibYOff = vArgs["FibYOff"];
116  m_vecFibZPiv = vArgs["FibZPiv"];
117 }
118 
120  const unsigned int copyOne(1);
121 
122  const double halfZbl((blZEnd() - blZBeg()) / 2.);
123  for (unsigned int i(0); i != vecVacZBeg().size(); ++i) {
124  DDName vacNameNm(ddname(vacName() + std::to_string(i + 1)));
125  const double halfZvac((vecVacZEnd()[i] - vecVacZBeg()[i]) / 2.);
126  DDSolid vTubeSolid(DDSolidFactory::tubs(vacNameNm, halfZvac, 0, blRadius(), 0 * deg, 360 * deg));
127  const DDLogicalPart vacLog(vacNameNm, vacMat(), vTubeSolid);
128 
129  cpv.position(vacLog,
130  parent().name(),
131  1 + i,
132  DDTranslation(0, 0, -halfZbl + halfZvac + vecVacZBeg()[i] - blZBeg()),
133  DDRotation());
134  }
135 
136  for (unsigned int i(0); i != vecWinZBeg().size(); ++i) {
137  DDName wName(ddname(winName() + std::to_string(i + 1)));
138  DDSolid wTubeSolid(DDSolidFactory::tubs(wName, vecWinThick()[i] / 2., 0, blRadius(), 0 * deg, 360 * deg));
139  const DDLogicalPart wLog(wName, ddmat(vecWinMat()[i]), wTubeSolid);
140 
141  const double off(0 < vecWinZBeg()[i] ? vecWinZBeg()[i] : fabs(vecWinZBeg()[i]) - vecWinThick()[i]);
142 
143  cpv.position(wLog,
144  parent().name(),
145  1 + i,
146  DDTranslation(0, 0, -halfZbl + vecWinThick()[i] / 2. + off - blZBeg()),
147  DDRotation());
148  }
149 
150  for (unsigned int i(0); i != vecTrgName().size(); ++i) {
152  DDSolid tSolid(DDSolidFactory::box(tName, vecTrgSide()[i] / 2., vecTrgSide()[i] / 2., vecTrgThick()[i] / 2.));
153  const DDLogicalPart tLog(tName, trgMat(), tSolid);
154 
155  if (tName.name() == "VETO") {
156  DDName vName(ddname(tName.name() + "Hole"));
157  DDSolid vTubeSolid(
158  DDSolidFactory::tubs(vName, vecTrgThick()[i] / 2., 0, trgVetoHoleRadius(), 0 * deg, 360 * deg));
159  const DDLogicalPart vLog(vName, holeMat(), vTubeSolid);
160 
161  cpv.position(vLog, tName, copyOne, DDTranslation(0, 0, 0), DDRotation());
162  }
163 
164  cpv.position(tLog,
165  parent().name(),
166  copyOne,
167  DDTranslation(vecTrgXOff()[i], vecTrgYOff()[i], vecTrgZPiv()[i] - halfZbl + blZPiv() - blZBeg()),
168  myrot(tName.name() + "Rot", CLHEP::HepRotationZ(vecTrgPhi()[i])));
169  }
170 
171  DDName pName(fibCladName());
172  const double planeWidth(32.5 * fibSide() + 33.5 * fibCladThick());
173  const double planeThick(2 * fibSide() + 3 * fibCladThick());
174  DDSolid pSolid(DDSolidFactory::box(pName, planeWidth / 2., fibLength() / 2., planeThick / 2.));
175  const DDLogicalPart pLog(pName, fibCladMat(), pSolid);
176 
177  DDSolid fSolid(DDSolidFactory::box(fibFibName(), fibSide() / 2., fibLength() / 2., fibSide() / 2.));
178 
179  const DDLogicalPart fLog(fibFibName(), fibFibMat(), fSolid);
180 
181  for (unsigned int j(0); j != 32; ++j) {
182  const double xoff(planeWidth / 2. - (1 + j) * fibCladThick() - (1 + j) * fibSide());
183  const double zoff(-planeThick / 2 + fibCladThick() + fibSide() / 2.);
184  cpv.position(fLog, pName, 1 + j, DDTranslation(xoff, 0, zoff), DDRotation());
185 
186  cpv.position(fLog, pName, 33 + j, DDTranslation(xoff + (fibCladThick() + fibSide()) / 2., 0, -zoff), DDRotation());
187  }
188  for (unsigned int i(0); i != vecFibZPiv().size(); ++i) {
189  cpv.position(
190  pLog,
191  parent().name(),
192  1 + i,
194  vecFibXOff()[i] - 0.5 * fibSide(), vecFibYOff()[i], vecFibZPiv()[i] - halfZbl + blZPiv() - blZBeg()),
195  myrot(pName.name() + "Rot" + std::to_string(i), CLHEP::HepRotationZ(vecFibPhi()[i])));
196  }
197 }
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:75
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:68
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:60
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:70
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:62
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:119
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)