Project
Loading...
Searching...
No Matches
ShishKebabTrd1Module.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <cassert>
13
14#include "RStringView.h"
15
16#include "EMCALBase/Geometry.h"
18
19using namespace o2::emcal;
20
21Double_t ShishKebabTrd1Module::sa = 0.;
22Double_t ShishKebabTrd1Module::sa2 = 0.;
23Double_t ShishKebabTrd1Module::sb = 0.;
24Double_t ShishKebabTrd1Module::sr = 0.;
25Double_t ShishKebabTrd1Module::sangle = 0.; // around one degree
27
29 : mGeometry(g),
30 mOK(),
31 mTheta(theta),
32 mOK1(),
33 mOK2(),
34 mOB(),
35 mOB1(),
36 mOB2(),
37 mOK3X3(),
38 mORB(),
39 mORT()
40{
41 std::string_view sname = g->GetName();
42 Int_t key = 0;
43 if (sname.find("v1") != std::string::npos || sname.find("V1") != std::string::npos) {
44 key = 1; // EMCAL_COMPLETEV1 vs EMCAL_COMPLETEv1 (or other)
45 }
46
47 if (SetParameters()) {
49 }
50
51 // DefineName(mTheta);
52 LOG(debug4) << "o2::emcal::ShishKebabTrd1Module - first module key=" << key << ": theta " << std::setw(1)
53 << std::setprecision(4) << mTheta << " geometry " << g;
54}
55
57 : mGeometry(leftNeighbor.mGeometry),
58 mOK(),
59 mTheta(0.),
60 mOK1(),
61 mOK2(),
62 mOB(),
63 mOB1(),
64 mOB2(),
65 mOK3X3(),
66 mORB(),
67 mORT()
68{
69 // printf("** Left Neighbor : %s **\n", leftNeighbor.GetName());
70 mTheta = leftNeighbor.GetTheta() - sangle;
71 Init(leftNeighbor.GetA(), leftNeighbor.GetB());
72}
73
75 : mGeometry(mod.mGeometry),
76 mOK(mod.mOK),
77 mA(mod.mA),
78 mB(mod.mB),
79 mThetaA(mod.mThetaA),
80 mTheta(mod.mTheta),
81 mOK1(mod.mOK1),
82 mOK2(mod.mOK2),
83 mOB(mod.mOB),
84 mOB1(mod.mOB1),
85 mOB2(mod.mOB2),
86 mThetaOB1(mod.mThetaOB1),
87 mThetaOB2(mod.mThetaOB2),
88 mORB(mod.mORB),
89 mORT(mod.mORT)
90{
91 for (Int_t i = 0; i < 3; i++) {
92 mOK3X3[i] = mod.mOK3X3[i];
93 }
94}
95
96void ShishKebabTrd1Module::Init(Double_t A, Double_t B)
97{
98 // Define parameter module from parameters A,B from previous.
99 Double_t yl = (sb / 2) * TMath::Sin(mTheta) + (sa / 2) * TMath::Cos(mTheta) + sr, y = yl;
100 Double_t xl = (yl - B) / A; // y=A*x+B
101
102 // Double_t xp1 = (fga/2. + fgb/2.*fgtanBetta)/(TMath::Sin(fTheta) + fgtanBetta*TMath::Cos(fTheta));
103 // printf(" xp1 %9.3f \n ", xp1);
104 // xp1 == xp => both methods give the same results - 3-feb-05
105 Double_t alpha = TMath::Pi() / 2. + sangle / 2;
106 Double_t xt =
107 (sa + sa2) * TMath::Tan(mTheta) * TMath::Tan(alpha) / (4. * (1. - TMath::Tan(mTheta) * TMath::Tan(alpha)));
108 Double_t yt = xt / TMath::Tan(mTheta), xp = TMath::Sqrt(xt * xt + yt * yt);
109 Double_t x = xl + xp;
110 mOK.Set(x, y);
111 // printf(" yl %9.3f | xl %9.3f | xp %9.3f \n", yl, xl, xp);
112
113 // have to define A and B;
114 Double_t yCprev = sr + sa * TMath::Cos(mTheta);
115 Double_t xCprev = (yCprev - B) / A;
116 Double_t xA = xCprev + sa * TMath::Sin(mTheta), yA = sr;
117
118 mThetaA = mTheta - sangle / 2.;
119 mA = TMath::Tan(mThetaA); // !!
120 mB = yA - mA * xA;
121
123}
124
126{
127 // Define some parameters
128 // DefineName(mTheta);
129 // Centers of cells - 2X2 case
130 Double_t kk1 = (sa + sa2) / (2. * 4.); // kk1=kk2
131
132 Double_t xk1 = mOK.X() - kk1 * TMath::Sin(mTheta);
133 Double_t yk1 = mOK.Y() + kk1 * TMath::Cos(mTheta) - sr;
134 mOK1.Set(xk1, yk1);
135
136 Double_t xk2 = mOK.X() + kk1 * TMath::Sin(mTheta);
137 Double_t yk2 = mOK.Y() - kk1 * TMath::Cos(mTheta) - sr;
138 mOK2.Set(xk2, yk2);
139
140 // Centers of cells - 3X3 case; Nov 9,2006
141 mOK3X3[1].Set(mOK.X(), mOK.Y() - sr); // coincide with module center
142
143 kk1 = ((sa + sa2) / 4. + sa / 6.) / 2.;
144
145 xk1 = mOK.X() - kk1 * TMath::Sin(mTheta);
146 yk1 = mOK.Y() + kk1 * TMath::Cos(mTheta) - sr;
147 mOK3X3[0].Set(xk1, yk1);
148
149 xk2 = mOK.X() + kk1 * TMath::Sin(mTheta);
150 yk2 = mOK.Y() - kk1 * TMath::Cos(mTheta) - sr;
151 mOK3X3[2].Set(xk2, yk2);
152
153 // May 15, 2006; position of module(cells) center face
154 mOB.Set(mOK.X() - sb / 2. * TMath::Cos(mTheta), mOK.Y() - sb / 2. * TMath::Sin(mTheta) - sr);
155 mOB1.Set(mOB.X() - sa / 4. * TMath::Sin(mTheta), mOB.Y() + sa / 4. * TMath::Cos(mTheta));
156 mOB2.Set(mOB.X() + sa / 4. * TMath::Sin(mTheta), mOB.Y() - sa / 4. * TMath::Cos(mTheta));
157 // Jul 30, 2007 - for taking into account a position of shower maximum
158 mThetaOB1 = mTheta - sangle / 4.; // ??
159 mThetaOB2 = mTheta + sangle / 4.;
160
161 // Position of right/top point of module
162 // Gives the posibility to estimate SM size in z direction
163 Double_t xBottom = (sr - mB) / mA;
164 Double_t yBottom = sr;
165 mORB.Set(xBottom, yBottom);
166
167 Double_t l = sb / TMath::Cos(sangle / 2.); // length of lateral module side
168 Double_t xTop = xBottom + l * TMath::Cos(TMath::ATan(mA));
169 Double_t yTop = mA * xTop + mB;
170 mORT.Set(xTop, yTop);
171}
172
174{
175 // Define first module
176 if (key == 0) {
177 // theta in radians ; first object theta=pi/2.
178 mTheta = TMath::PiOver2();
179 mOK.Set(sa2 / 2., sr + sb / 2.); // position the center of module vs o
180
181 // parameters of right line : y = A*z + B in system where zero point is IP.
182 mThetaA = mTheta - sangle / 2.;
183 mA = TMath::Tan(mThetaA);
184 Double_t xA = sa / 2. + sa2 / 2.;
185 Double_t yA = sr;
186 mB = yA - mA * xA;
187 } else if (key == 1) {
188 // theta in radians ; first object theta = 90-0.75 = 89.25 degree
189 mTheta = 89.25 * TMath::DegToRad();
190 Double_t al1 = sangle / 2.;
191 Double_t x = 0.5 * (sa * TMath::Cos(al1) + sb * TMath::Sin(al1));
192 Double_t y = 0.5 * (sb + sa * TMath::Sin(al1)) * TMath::Cos(al1);
193 mOK.Set(x, sr + y);
194 // parameters of right line : y = A*z + B in system where zero point is IP.
195 mThetaA = mTheta - sangle / 2.;
196 mA = TMath::Tan(mThetaA);
197 Double_t xA = sa * TMath::Cos(al1);
198 Double_t yA = sr;
199 mB = yA - mA * xA;
200 } else {
201 LOG(error) << "key=" << key << " : wrong case \n";
202 assert(0);
203 }
204
206}
207
209{
210 if (!mGeometry) {
211 LOG(warning) << "GetParameters(): << No geometry\n";
212 return kFALSE;
213 }
214
215 TString sn(mGeometry->GetName()); // 2-Feb-05
216 sn.ToUpper();
217
218 sa = (Double_t)mGeometry->GetEtaModuleSize();
219 sb = (Double_t)mGeometry->GetLongModuleSize();
220 sangle = Double_t(mGeometry->GetTrd1Angle()) * TMath::DegToRad();
221 stanBetta = TMath::Tan(sangle / 2.);
222 sr = (Double_t)mGeometry->GetIPDistance();
223
225
226 sa2 = Double_t(mGeometry->Get2Trd1Dx2());
227 // PH PrintShish(0);
228 return kTRUE;
229}
230
231//
232// Service methods
233//
234
236{
237 if (pri >= 0) {
238 if (pri >= 1) {
239 printf("PrintShish() \n a %7.3f:%7.3f | b %7.2f | r %7.2f \n TRD1 angle %7.6f(%5.2f) | tanBetta %7.6f", sa, sa2,
240 sb, sr, sangle, sangle * TMath::RadToDeg(), stanBetta);
241 printf(" fTheta %f : %5.2f : cos(theta) %f\n", mTheta, GetThetaInDegree(), TMath::Cos(mTheta));
242 printf(" OK : theta %f : phi = %f(%5.2f) \n", mTheta, mOK.Phi(), mOK.Phi() * TMath::RadToDeg());
243 }
244
245 printf(" y %9.3f x %9.3f xrb %9.3f (right bottom on r=%9.3f ) \n", mOK.X(), mOK.Y(), mORB.X(), mORB.Y());
246
247 if (pri >= 2) {
248 printf(" A %f B %f | fThetaA %7.6f(%5.2f)\n", mA, mB, mThetaA, mThetaA * TMath::RadToDeg());
249 printf(" fOK : X %9.4f: Y %9.4f : eta %5.3f\n", mOK.X(), mOK.Y(), GetEtaOfCenterOfModule());
250 printf(" fOK1 : X %9.4f: Y %9.4f : (local, ieta=2)\n", mOK1.X(), mOK1.Y());
251 printf(" fOK2 : X %9.4f: Y %9.4f : (local, ieta=1)\n\n", mOK2.X(), mOK2.Y());
252 printf(" fOB : X %9.4f: Y %9.4f \n", mOB.X(), mOB.Y());
253 printf(" fOB1 : X %9.4f: Y %9.4f (local, ieta=2)\n", mOB1.X(), mOB1.Y());
254 printf(" fOB2 : X %9.4f: Y %9.4f (local, ieta=1)\n", mOB2.X(), mOB2.Y());
255 // 3X3
256 printf(" 3X3 \n");
257 for (int ieta = 0; ieta < 3; ieta++) {
258 printf(" fOK3X3[%i] : X %9.4f: Y %9.4f (local) \n", ieta, mOK3X3[ieta].X(), mOK3X3[ieta].Y());
259 }
260 // fOK.Dump();
262 }
263 }
264}
265
266Double_t ShishKebabTrd1Module::GetThetaInDegree() const { return mTheta * TMath::RadToDeg(); }
267
268Double_t ShishKebabTrd1Module::GetEtaOfCenterOfModule() const { return -TMath::Log(TMath::Tan(mOK.Phi() / 2.)); }
269
270void ShishKebabTrd1Module::GetPositionAtCenterCellLine(Int_t ieta, Double_t dist, TVector2& v) const
271{
272 // Jul 30, 2007
273 Double_t theta = 0., x = 0., y = 0.;
274 if (ieta == 0) {
275 v = mOB2;
276 theta = mTheta;
277 } else if (ieta == 1) {
278 v = mOB1;
279 theta = mTheta;
280 } else {
281 assert(0);
282 }
283
284 x = v.X() + TMath::Cos(theta) * dist;
285 y = v.Y() + TMath::Sin(theta) * dist;
286 // printf(" GetPositionAtCenterCellLine() %s : dist %f : ieta %i : x %f %f v.X() | y %f %f v.Y() : cos %f sin %f \n",
287 // GetName(), dist, ieta, v.X(),x, y,v.Y(),TMath::Cos(theta),TMath::Sin(theta));
288 v.Set(x, y);
289}
290
292{
293 // Right bottom point of module
294 Double_t thetaBottom = TMath::ATan2(mORB.Y(), mORB.X());
295 Double_t etaBottom = ThetaToEta(thetaBottom);
296
297 // Right top point of module
298 Double_t thetaTop = TMath::ATan2(mORT.Y(), mORT.X());
299 Double_t etaTop = ThetaToEta(thetaTop);
300
301 LOG(debug) << " Right bottom point of module : eta " << std::setw(5) << std::setprecision(4) << etaBottom
302 << " : theta " << std::setw(6) << std::setprecision(4) << thetaBottom << " (" << std::setw(6)
303 << std::setprecision(2) << thetaBottom * TMath::RadToDeg() << " ) : x(zglob) " << std::setw(7)
304 << std::setprecision(2) << mORB.X() << " y(phi) " << std::setw(5) << std::setprecision(2) << mORB.Y();
305 LOG(debug) << " Right top point of module : eta " << std::setw(5) << std::setprecision(4) << etaTop << ": theta "
306 << std::setw(6) << std::setprecision(4) << thetaTop << " (" << std::setw(6) << std::setprecision(2)
307 << thetaTop * TMath::RadToDeg() << ") : x(zglob) " << std::setw(7) << std::setprecision(2) << mORT.X()
308 << " y(phi) " << std::setw(5) << std::setprecision(2) << mORT.Y();
309 return etaBottom > etaTop ? etaBottom : etaTop;
310}
int32_t i
std::ostringstream debug
StringRef key
Definition A.h:16
Definition B.h:16
EMCAL geometry definition.
Definition Geometry.h:40
Float_t Get2Trd1Dx2() const
Definition Geometry.h:223
Float_t GetSteelFrontThickness() const
Definition Geometry.h:266
Float_t GetLongModuleSize() const
Definition Geometry.h:221
const std::string & GetName() const
Definition Geometry.h:109
Float_t GetIPDistance() const
Definition Geometry.h:180
Float_t GetTrd1Angle() const
Definition Geometry.h:222
Float_t GetEtaModuleSize() const
Definition Geometry.h:210
Main class for TRD1 geometry of Shish-Kebab case.
Double_t mB
system where zero point is IP.
void Init(Double_t A, Double_t B)
Init (add explanation)
static Double_t sangle
in rad (1.5 degree)
Bool_t SetParameters()
Recover module parameters stored in geometry.
Double_t mThetaOB2
theta of cell center line (go through OB2)
ShishKebabTrd1Module(Double_t theta=0.0, Geometry *g=nullptr)
Constructor.
TVector2 mOK
position the module center in ALICE system; x->y; z->x;
Double_t mThetaOB1
theta of cell center line (go through OB1)
Double_t mThetaA
angle coresponding fA - for convinience
TVector2 mORB
position of right/bottom point of module
Double_t mTheta
theta angle of perpendicular to SK module
Double_t mA
parameters of right line : y = A*z + B
static Double_t stanBetta
tan(fgangle/2.)
static Double_t sr
radius to IP
void DefineFirstModule(const Int_t key=0)
static Double_t ThetaToEta(Double_t theta)
void GetPositionAtCenterCellLine(Int_t ieta, Double_t dist, TVector2 &v) const
Geometry * mGeometry
! pointer to geometry info
TVector2 mORT
position of right/top point of module
void DefineAllStuff()
Define more things (add explanation)
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLboolean GLboolean g
Definition glcorearb.h:1233
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"