]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALShishKebabTrd1Module.cxx
Using the recommended way of forward declarations for TVector and TMatrix (see v5...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALShishKebabTrd1Module.cxx
CommitLineData
1963b290 1/**************************************************************************
2 * Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18//*-- Author: Aleksei Pavlinov(WSU)
19
20#include "AliEMCALShishKebabTrd1Module.h"
21#include <assert.h>
22#include <TMath.h>
23#include "AliEMCALGeometry.h"
24
25ClassImp(AliEMCALShishKebabTrd1Module)
26
27 AliEMCALGeometry *AliEMCALShishKebabTrd1Module::fgGeometry=0;
28 Double_t AliEMCALShishKebabTrd1Module::fga=0.;
29 Double_t AliEMCALShishKebabTrd1Module::fga2=0.;
30 Double_t AliEMCALShishKebabTrd1Module::fgb=0.;
31 Double_t AliEMCALShishKebabTrd1Module::fgr=0.;
32 Double_t AliEMCALShishKebabTrd1Module::fgangle=0.; // one degrre
33 Double_t AliEMCALShishKebabTrd1Module::fgtanBetta=0; //
34
eb0b1051 35AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(double theta) : TNamed()
1963b290 36{ // theta in radians ; first object shold be with theta=pi/2.
37 fTheta = theta;
38 if(fgGeometry==0) {
39 if(GetParameters()) {
40 DefineFirstModule();
41 }
42 } else Warning("AliEMCALShishKebabTrd1Module(theta)","You should call this constractor just once !!");
43 DefineName(fTheta);
44}
45
46AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(AliEMCALShishKebabTrd1Module &leftNeighbor) : TNamed()
47{ // 22-sep-04
48 // printf("** Left Neighbor : %s **\n", leftNeighbor.GetName());
49 TObject::SetUniqueID(leftNeighbor.GetUniqueID()+1);
50 fTheta = leftNeighbor.GetTheta() - fgangle;
51 Init(leftNeighbor.GetA(),leftNeighbor.GetB());
52}
53
eb0b1051 54void AliEMCALShishKebabTrd1Module::Init(double A, double B)
1963b290 55{ // Define parameter module from parameters A,B from previos.
56 Double_t yl = (fgb/2)*TMath::Sin(fTheta) + (fga/2)*TMath::Cos(fTheta) + fgr, y = yl;
57 Double_t xl = (yl - B) / A; // y=A*x+B
58
59 // Double_t xp1 = (fga/2. + fgb/2.*fgtanBetta)/(TMath::Sin(fTheta) + fgtanBetta*TMath::Cos(fTheta));
60 // printf(" xp1 %9.3f \n ", xp1);
61 // xp1 == xp => both methods give the same results - 3-feb-05
62 Double_t alpha = TMath::Pi()/2. + fgangle/2;
63 Double_t xt = (fga+fga2)*TMath::Tan(fTheta)*TMath::Tan(alpha)/(4.*(1.-TMath::Tan(fTheta)*TMath::Tan(alpha)));
64 Double_t yt = xt / TMath::Tan(fTheta), xp = TMath::Sqrt(xt*xt + yt*yt);
65 Double_t x = xl + xp;
66 fOK.Set(x, y);
67 // printf(" yl %9.3f | xl %9.3f | xp %9.3f \n", yl, xl, xp);
68
69 // have to define A and B;
70 Double_t yCprev = fgr + fga*TMath::Cos(fTheta);
71 Double_t xCprev = (yCprev - B) / A;
72 Double_t xA = xCprev + fga*TMath::Sin(fTheta), yA = fgr;
73
74 fThetaA = fTheta - fgangle/2.;
75 fA = TMath::Tan(fThetaA); // !!
76 fB = yA - fA*xA;
77
78 DefineName(fTheta);
79 // Centers of modules
80 Double_t kk1 = (fga+fga2)/(2.*4.); // kk1=kk2
81
82 Double_t xk1 = fOK.X() - kk1*TMath::Sin(fTheta);
83 Double_t yk1 = fOK.Y() + kk1*TMath::Cos(fTheta);
84 fOK1.Set(xk1,yk1);
85
86 Double_t xk2 = fOK.X() + kk1*TMath::Sin(fTheta);
87 Double_t yk2 = fOK.Y() - kk1*TMath::Cos(fTheta);
88 fOK2.Set(xk2,yk2);
89}
90
91void AliEMCALShishKebabTrd1Module::DefineFirstModule()
92{
93 fOK.Set(fga2/2., fgr + fgb/2.); // position the center of module vs o
94
95 // parameters of right line : y = A*z + B in system where zero point is IP.
96 fThetaA = fTheta - fgangle/2.;
97 fA = TMath::Tan(fThetaA);
98 Double_t xA = fga/2. + fga2/2., yA = fgr;
99 fB = yA - fA*xA;
100
101 Double_t kk1 = (fga+fga2)/(2.*4.); // kk1=kk2
102 fOK1.Set(fOK.X() - kk1, fOK.Y());
103 fOK2.Set(fOK.X() + kk1, fOK.Y());
104
105 TObject::SetUniqueID(1); //
106}
107
eb0b1051 108void AliEMCALShishKebabTrd1Module::DefineName(double theta)
1963b290 109{
110 char name[100];
111 // sprintf(name,"theta_%5.2f",theta*180./TMath::Pi());
112 sprintf(name,"%2i(%5.2f)", TObject::GetUniqueID(), theta*180./TMath::Pi());
113 SetName(name);
114}
115
116Bool_t AliEMCALShishKebabTrd1Module::GetParameters()
117{
118 fgGeometry = AliEMCALGeometry::GetInstance();
119 TString sn(fgGeometry->GetName()); // 2-Feb-05
120 sn.ToUpper();
121 if(!fgGeometry) {
122 Warning("GetParameters()"," No geometry ");
123 return kFALSE;
124 }
125
126 fga = (Double_t)fgGeometry->GetEtaModuleSize();
127 fgb = (Double_t)fgGeometry->GetLongModuleSize();
128 fgangle = Double_t(fgGeometry->GetTrd1Angle())*TMath::DegToRad();
129 fgtanBetta = TMath::Tan(fgangle/2.);
130 fgr = (Double_t)fgGeometry->GetIPDistance();
131 if(!sn.Contains("TRD2")) fgr += fgGeometry->GetSteelFrontThickness();
132 fga2 = Double_t(fgGeometry->Get2Trd1Dx2());
133 Print(0);
134 return kTRUE;
135}
136
137// service methods
eb0b1051 138void AliEMCALShishKebabTrd1Module::Print(int pri) const
1963b290 139{
140 if(pri>=0) {
141 Info("Print()", "\n a %7.3f:%7.3f | b %7.2f | r %7.2f \n TRD1 angle %7.6f(%5.2f) | tanBetta %7.6f",
142 fga, fga2, fgb, fgr, fgangle, fgangle*TMath::RadToDeg(), fgtanBetta);
143 printf(" fTheta %f : %5.2f : cos(theta) %f\n",
144 fTheta, GetThetaInDegree(),TMath::Cos(fTheta));
145 if(pri>0) {
146 printf("\n%i |%s| theta %f : fOK.Phi = %f(%5.2f)\n",
147 GetUniqueID(), GetName(), fTheta, fOK.Phi(),fOK.Phi()*TMath::RadToDeg());
148 printf(" A %f B %f | fThetaA %7.6f(%5.2f)\n", fA,fB, fThetaA,fThetaA*TMath::RadToDeg());
149 fOK.Dump();
150 printf(" fOK : X %8.3f: Y %8.3f \n", fOK.X(), fOK.Y());
151 printf(" fOK1 : X %8.3f: Y %8.3f \n", fOK1.X(), fOK1.Y());
152 printf(" fOK2 : X %8.3f: Y %8.3f \n", fOK2.X(), fOK2.Y());
153 }
154 }
155}