CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DDEcalAPDAlgo.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <algorithm>
3 
9 #include <string>
10 #include <vector>
11 
18 
19 class DDEcalAPDAlgo : public DDAlgorithm {
20 public:
21  //Constructor and Destructor
22  DDEcalAPDAlgo();
23  ~DDEcalAPDAlgo() override;
24 
25  void initialize(const DDNumericArguments& nArgs,
26  const DDVectorArguments& vArgs,
27  const DDMapArguments& mArgs,
28  const DDStringArguments& sArgs,
29  const DDStringVectorArguments& vsArgs) override;
30  void execute(DDCompactView& cpv) override;
31 
32 protected:
33 private:
34  DDName ddname(const std::string& s) const;
35 
36  const std::vector<double>& vecCerPos() const { return m_vecCerPos; }
37  int apdHere() const { return m_APDHere; }
38 
39  DDName capName() const { return ddname(m_capName); }
40  DDMaterial capMat() const { return DDMaterial(ddname(m_capMat)); }
41  double capXSize() const { return m_capXSize; }
42  double capYSize() const { return m_capYSize; }
43  double capThick() const { return m_capThick; }
44 
45  DDName cerName() const { return ddname(m_CERName); }
46  DDMaterial cerMat() const { return DDMaterial(ddname(m_CERMat)); }
47  double cerXSize() const { return m_CERXSize; }
48  double cerYSize() const { return m_CERYSize; }
49  double cerThick() const { return m_CERThick; }
50 
51  DDName bsiName() const { return ddname(m_BSiName); }
52  DDMaterial bsiMat() const { return DDMaterial(ddname(m_BSiMat)); }
53  double bsiXSize() const { return m_BSiXSize; }
54  double bsiYSize() const { return m_BSiYSize; }
55  double bsiThick() const { return m_BSiThick; }
56 
57  DDName sglName() const { return ddname(m_SGLName); }
58  DDMaterial sglMat() const { return DDMaterial(ddname(m_SGLMat)); }
59  double sglThick() const { return m_SGLThick; }
60 
61  DDName atjName() const { return ddname(m_ATJName); }
62  DDMaterial atjMat() const { return DDMaterial(ddname(m_ATJMat)); }
63  double atjThick() const { return m_ATJThick; }
64 
65  DDName aglName() const { return ddname(m_AGLName); }
66  DDMaterial aglMat() const { return DDMaterial(ddname(m_AGLMat)); }
67  double aglThick() const { return m_AGLThick; }
68 
69  DDName andName() const { return ddname(m_ANDName); }
70  DDMaterial andMat() const { return DDMaterial(ddname(m_ANDMat)); }
71  double andThick() const { return m_ANDThick; }
72 
73  DDName apdName() const { return ddname(m_APDName); }
74  DDMaterial apdMat() const { return DDMaterial(ddname(m_APDMat)); }
75  double apdSide() const { return m_APDSide; }
76  double apdThick() const { return m_APDThick; }
77  double apdZ() const { return m_APDZ; }
78  double apdX1() const { return m_APDX1; }
79  double apdX2() const { return m_APDX2; }
80 
81 private:
82  std::string m_idNameSpace; //Namespace of this and ALL sub-parts
83 
84  std::vector<double> m_vecCerPos; // Translation
85  int m_APDHere;
86 
87  std::string m_capName; // Capsule
89  double m_capXSize; //
90  double m_capYSize; //
91  double m_capThick; //
92 
93  std::string m_CERName; // Ceramic
95  double m_CERXSize; //
96  double m_CERYSize; //
97  double m_CERThick; //
98 
99  std::string m_BSiName; // Bulk Silicon
101  double m_BSiXSize; //
102  double m_BSiYSize; //
103  double m_BSiThick; //
104 
107  double m_APDSide; //
108  double m_APDThick; //
109  double m_APDZ; //
110  double m_APDX1; //
111  double m_APDX2; //
112 
113  std::string m_ATJName; // After-The-Junction
115  double m_ATJThick; //
116 
117  std::string m_SGLName; // APD-Silicone glue
119  double m_SGLThick; //
120 
121  std::string m_AGLName; // APD-Glue
123  double m_AGLThick; //
124 
125  std::string m_ANDName; // APD-Non-Depleted
127  double m_ANDThick; //
128 };
129 
131  : m_vecCerPos(),
132  m_APDHere(0),
133 
134  m_capName(""),
135  m_capMat(""),
136  m_capXSize(0),
137  m_capYSize(0),
138  m_capThick(0),
139 
140  m_CERName(""),
141  m_CERMat(""),
142  m_CERXSize(0),
143  m_CERYSize(0),
144  m_CERThick(0),
145 
146  m_BSiName(""),
147  m_BSiMat(""),
148  m_BSiXSize(0),
149  m_BSiYSize(0),
150  m_BSiThick(0),
151 
152  m_APDName(""),
153  m_APDMat(""),
154  m_APDSide(0),
155  m_APDThick(0),
156  m_APDZ(0),
157  m_APDX1(0),
158  m_APDX2(0),
159 
160  m_ATJName(""),
161  m_ATJMat(""),
162  m_ATJThick(0),
163 
164  m_SGLName(""),
165  m_SGLMat(""),
166  m_SGLThick(0),
167 
168  m_AGLName(""),
169  m_AGLMat(""),
170  m_AGLThick(0),
171 
172  m_ANDName(""),
173  m_ANDMat(""),
174  m_ANDThick(0) {
175  LogDebug("EcalGeom") << "DDEcalAPDAlgo info: Creating an instance";
176 }
177 
179 
181  const DDVectorArguments& vArgs,
182  const DDMapArguments& mArgs,
183  const DDStringArguments& sArgs,
184  const DDStringVectorArguments& vsArgs) {
185  LogDebug("EcalGeom") << "DDEcalAPDAlgo info: Initialize";
186 
187  m_idNameSpace = parent().name().ns();
188 
189  m_vecCerPos = vArgs["CerPos"];
190  m_APDHere = (int)(nArgs["APDHere"]);
191 
192  m_capName = sArgs["CapName"];
193  m_capMat = sArgs["CapMat"];
194  m_capXSize = nArgs["CapXSize"];
195  m_capYSize = nArgs["CapYSize"];
196  m_capThick = nArgs["CapThick"];
197 
198  m_CERName = sArgs["CerName"];
199  m_CERMat = sArgs["CerMat"];
200  m_CERXSize = nArgs["CerXSize"];
201  m_CERYSize = nArgs["CerYSize"];
202  m_CERThick = nArgs["CerThick"];
203 
204  m_BSiName = sArgs["BSiName"];
205  m_BSiMat = sArgs["BSiMat"];
206  m_BSiXSize = nArgs["BSiXSize"];
207  m_BSiYSize = nArgs["BSiYSize"];
208  m_BSiThick = nArgs["BSiThick"];
209 
210  m_APDName = sArgs["APDName"];
211  m_APDMat = sArgs["APDMat"];
212  m_APDSide = nArgs["APDSide"];
213  m_APDThick = nArgs["APDThick"];
214  m_APDZ = nArgs["APDZ"];
215  m_APDX1 = nArgs["APDX1"];
216  m_APDX2 = nArgs["APDX2"];
217 
218  m_ATJName = sArgs["ATJName"];
219  m_ATJMat = sArgs["ATJMat"];
220  m_ATJThick = nArgs["ATJThick"];
221 
222  m_SGLName = sArgs["SGLName"];
223  m_SGLMat = sArgs["SGLMat"];
224  m_SGLThick = nArgs["SGLThick"];
225 
226  m_AGLName = sArgs["AGLName"];
227  m_AGLMat = sArgs["AGLMat"];
228  m_AGLThick = nArgs["AGLThick"];
229 
230  m_ANDName = sArgs["ANDName"];
231  m_ANDMat = sArgs["ANDMat"];
232  m_ANDThick = nArgs["ANDThick"];
233 
234  LogDebug("EcalGeom") << "DDEcalAPDAlgo info: end initialize";
235 }
236 
238 // DDEcalBarrelAlgo methods...
240 
242  LogDebug("EcalGeom") << "******** DDEcalAPDAlgo execute!" << std::endl;
243 
244  //++++++++++++++++++++++++++++++++++ APD ++++++++++++++++++++++++++++++++++
245  const DDName capDDName(capName().name());
246 
247  DDSolid capSolid(DDSolidFactory::box(capDDName, capXSize() / 2., capYSize() / 2., capThick() / 2.));
248 
249  const unsigned int copyCAP(1);
250 
251  const DDLogicalPart capLog(capDDName, capMat(), capSolid);
252 
253  const DDName sglDDName(sglName().name());
254 
255  DDSolid sglSolid(DDSolidFactory::box(sglDDName, capXSize() / 2., capYSize() / 2., sglThick() / 2.));
256 
257  const DDLogicalPart sglLog(sglDDName, sglMat(), sglSolid);
258 
259  const unsigned int copySGL(1);
260 
261  const DDName cerDDName(cerName().name());
262 
263  DDSolid cerSolid(DDSolidFactory::box(cerDDName, cerXSize() / 2., cerYSize() / 2., cerThick() / 2.));
264 
265  const DDLogicalPart cerLog(cerDDName, cerMat(), cerSolid);
266 
267  const unsigned int copyCER(1);
268 
269  const DDName bsiDDName(bsiName().name());
270 
271  DDSolid bsiSolid(DDSolidFactory::box(bsiDDName, bsiXSize() / 2., bsiYSize() / 2., bsiThick() / 2.));
272 
273  const DDLogicalPart bsiLog(bsiDDName, bsiMat(), bsiSolid);
274 
275  const unsigned int copyBSi(1);
276 
277  const DDName atjDDName(atjName().name());
278 
279  DDSolid atjSolid(DDSolidFactory::box(atjDDName, apdSide() / 2., apdSide() / 2., atjThick() / 2.));
280 
281  const DDLogicalPart atjLog(atjDDName, atjMat(), atjSolid);
282 
283  const unsigned int copyATJ(1);
284 
285  const DDName aglDDName(aglName().name());
286 
287  DDSolid aglSolid(DDSolidFactory::box(aglDDName, bsiXSize() / 2., bsiYSize() / 2., aglThick() / 2.));
288 
289  const DDLogicalPart aglLog(aglDDName, aglMat(), aglSolid);
290 
291  const unsigned int copyAGL(1);
292 
293  const DDName andDDName(andName().name());
294 
295  DDSolid andSolid(DDSolidFactory::box(andDDName, apdSide() / 2., apdSide() / 2., andThick() / 2.));
296 
297  const DDLogicalPart andLog(andDDName, andMat(), andSolid);
298 
299  const unsigned int copyAND(1);
300 
301  const DDName apdDDName(apdName().name());
302 
303  DDSolid apdSolid(DDSolidFactory::box(apdDDName, apdSide() / 2., apdSide() / 2., apdThick() / 2.));
304 
305  const DDLogicalPart apdLog(apdDDName, apdMat(), apdSolid);
306 
307  const unsigned int copyAPD(1);
308 
309  if (0 != apdHere()) {
310  cpv.position(aglLog, bsiLog, copyAGL, DDTranslation(0, 0, -aglThick() / 2. + bsiThick() / 2.), DDRotation());
311 
312  cpv.position(
313  andLog, bsiLog, copyAND, DDTranslation(0, 0, -andThick() / 2. - aglThick() + bsiThick() / 2.), DDRotation());
314 
315  cpv.position(apdLog,
316  bsiLog,
317  copyAPD,
318  DDTranslation(0, 0, -apdThick() / 2. - andThick() - aglThick() + bsiThick() / 2.),
319  DDRotation());
320 
321  cpv.position(atjLog,
322  bsiLog,
323  copyATJ,
324  DDTranslation(0, 0, -atjThick() / 2. - apdThick() - andThick() - aglThick() + bsiThick() / 2.),
325  DDRotation());
326 
327  cpv.position(bsiLog, cerLog, copyBSi, DDTranslation(0, 0, -bsiThick() / 2. + cerThick() / 2.), DDRotation());
328 
329  cpv.position(sglLog, capLog, copySGL, DDTranslation(0, 0, -sglThick() / 2. + capThick() / 2.), DDRotation());
330 
331  cpv.position(
332  cerLog, capLog, copyCER, DDTranslation(0, 0, -sglThick() - cerThick() / 2. + capThick() / 2.), DDRotation());
333 
334  cpv.position(
335  capLog, parent().name(), copyCAP, DDTranslation(vecCerPos()[0], vecCerPos()[1], vecCerPos()[2]), DDRotation());
336  }
337 
338  LogDebug("EcalGeom") << "******** DDEcalAPDAlgo test: end it...";
339 }
340 
342  const std::pair<std::string, std::string> temp(DDSplit(s));
343  if (temp.second.empty()) {
344  return DDName(temp.first, m_idNameSpace);
345  } else {
346  return DDName(temp.first, temp.second);
347  }
348 }
349 
351 
352 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDEcalAPDAlgo, "ecal:DDEcalAPDAlgo");
DDMaterial sglMat() const
DDName cerName() const
std::string m_BSiName
double bsiThick() const
std::string m_ATJMat
DDMaterial bsiMat() const
DDName atjName() const
DDMaterial apdMat() const
DDMaterial aglMat() const
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
int apdHere() const
std::string m_SGLName
const std::vector< double > & vecCerPos() const
double cerThick() const
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
std::string m_BSiMat
std::string m_AGLMat
double apdZ() const
DDName ddname(const std::string &s) const
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
double cerYSize() const
double apdSide() const
double andThick() const
std::string m_CERName
std::string m_idNameSpace
std::string m_capMat
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
~DDEcalAPDAlgo() override
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
double sglThick() const
std::string m_CERMat
std::string m_APDName
DDMaterial cerMat() const
double bsiXSize() const
std::string m_APDMat
std::string m_AGLName
DDName sglName() const
double capThick() const
double apdX1() const
DDMaterial capMat() const
double apdThick() const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
double capXSize() const
DDName aglName() const
std::string m_SGLMat
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
DDMaterial atjMat() const
DDName apdName() const
double bsiYSize() const
std::string m_capName
double cerXSize() const
DDMaterial andMat() const
double atjThick() const
std::string m_ANDMat
void execute(DDCompactView &cpv) override
std::vector< double > m_vecCerPos
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
std::string m_ATJName
double capYSize() const
#define DEFINE_EDM_PLUGIN(factory, type, name)
DDName bsiName() const
DDName andName() const
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
DDName capName() const
double apdX2() const
double aglThick() const
std::string m_ANDName
#define LogDebug(id)