1 /**************************************************************************
2 * Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //*-- Author: Aleksei Pavlinov(WSU)
20 #include "AliEMCALShishKebabTrd1Module.h"
22 #include "AliEMCALGeometry.h"
24 #include "Riostream.h"
27 ClassImp(AliEMCALShishKebabTrd1Module)
29 AliEMCALGeometry *AliEMCALShishKebabTrd1Module::fgGeometry=0;
30 Double_t AliEMCALShishKebabTrd1Module::fga=0.;
31 Double_t AliEMCALShishKebabTrd1Module::fga2=0.;
32 Double_t AliEMCALShishKebabTrd1Module::fgb=0.;
33 Double_t AliEMCALShishKebabTrd1Module::fgr=0.;
34 Double_t AliEMCALShishKebabTrd1Module::fgangle=0.; // around one degree
35 Double_t AliEMCALShishKebabTrd1Module::fgtanBetta=0; //
37 AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(double theta, AliEMCALGeometry *g) : TNamed()
38 { // theta in radians ; first object shold be with theta=pi/2.
39 cout<< " theta " << theta << " geometry " << g << endl;
46 } else Warning("AliEMCALShishKebabTrd1Module(theta)","You should call this constractor just once !!");
50 AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(AliEMCALShishKebabTrd1Module &leftNeighbor) : TNamed()
52 // printf("** Left Neighbor : %s **\n", leftNeighbor.GetName());
53 TObject::SetUniqueID(leftNeighbor.GetUniqueID()+1);
54 fTheta = leftNeighbor.GetTheta() - fgangle;
55 Init(leftNeighbor.GetA(),leftNeighbor.GetB());
58 void AliEMCALShishKebabTrd1Module::Init(double A, double B)
59 { // Define parameter module from parameters A,B from previos.
60 Double_t yl = (fgb/2)*TMath::Sin(fTheta) + (fga/2)*TMath::Cos(fTheta) + fgr, y = yl;
61 Double_t xl = (yl - B) / A; // y=A*x+B
63 // Double_t xp1 = (fga/2. + fgb/2.*fgtanBetta)/(TMath::Sin(fTheta) + fgtanBetta*TMath::Cos(fTheta));
64 // printf(" xp1 %9.3f \n ", xp1);
65 // xp1 == xp => both methods give the same results - 3-feb-05
66 Double_t alpha = TMath::Pi()/2. + fgangle/2;
67 Double_t xt = (fga+fga2)*TMath::Tan(fTheta)*TMath::Tan(alpha)/(4.*(1.-TMath::Tan(fTheta)*TMath::Tan(alpha)));
68 Double_t yt = xt / TMath::Tan(fTheta), xp = TMath::Sqrt(xt*xt + yt*yt);
71 // printf(" yl %9.3f | xl %9.3f | xp %9.3f \n", yl, xl, xp);
73 // have to define A and B;
74 Double_t yCprev = fgr + fga*TMath::Cos(fTheta);
75 Double_t xCprev = (yCprev - B) / A;
76 Double_t xA = xCprev + fga*TMath::Sin(fTheta), yA = fgr;
78 fThetaA = fTheta - fgangle/2.;
79 fA = TMath::Tan(fThetaA); // !!
84 Double_t kk1 = (fga+fga2)/(2.*4.); // kk1=kk2
86 Double_t xk1 = fOK.X() - kk1*TMath::Sin(fTheta);
87 Double_t yk1 = fOK.Y() + kk1*TMath::Cos(fTheta) - fgr;
90 Double_t xk2 = fOK.X() + kk1*TMath::Sin(fTheta);
91 Double_t yk2 = fOK.Y() - kk1*TMath::Cos(fTheta) - fgr;
95 void AliEMCALShishKebabTrd1Module::DefineFirstModule()
97 fOK.Set(fga2/2., fgr + fgb/2.); // position the center of module vs o
99 // parameters of right line : y = A*z + B in system where zero point is IP.
100 fThetaA = fTheta - fgangle/2.;
101 fA = TMath::Tan(fThetaA);
102 Double_t xA = fga/2. + fga2/2., yA = fgr;
105 Double_t kk1 = (fga+fga2)/(2.*4.); // kk1=kk2
106 fOK1.Set(fOK.X() - kk1, fOK.Y()-fgr);
107 fOK2.Set(fOK.X() + kk1, fOK.Y()-fgr);
109 TObject::SetUniqueID(1); //
112 void AliEMCALShishKebabTrd1Module::DefineName(double theta)
115 // sprintf(name,"theta_%5.2f",theta*180./TMath::Pi());
116 sprintf(name,"%2i(%5.2f)", TObject::GetUniqueID(), theta*180./TMath::Pi());
120 Bool_t AliEMCALShishKebabTrd1Module::GetParameters()
122 if(!fgGeometry) fgGeometry = AliEMCALGeometry::GetInstance();
123 TString sn(fgGeometry->GetName()); // 2-Feb-05
126 Warning("GetParameters()"," No geometry ");
130 fga = (Double_t)fgGeometry->GetEtaModuleSize();
131 fgb = (Double_t)fgGeometry->GetLongModuleSize();
132 fgangle = Double_t(fgGeometry->GetTrd1Angle())*TMath::DegToRad();
133 fgtanBetta = TMath::Tan(fgangle/2.);
134 fgr = (Double_t)fgGeometry->GetIPDistance();
135 if(!sn.Contains("TRD2")) fgr += fgGeometry->GetSteelFrontThickness();
136 fga2 = Double_t(fgGeometry->Get2Trd1Dx2());
142 void AliEMCALShishKebabTrd1Module::PrintShish(int pri) const
145 Info("\n PrintShish()", "\n a %7.3f:%7.3f | b %7.2f | r %7.2f \n TRD1 angle %7.6f(%5.2f) | tanBetta %7.6f",
146 fga, fga2, fgb, fgr, fgangle, fgangle*TMath::RadToDeg(), fgtanBetta);
147 printf(" fTheta %f : %5.2f : cos(theta) %f\n",
148 fTheta, GetThetaInDegree(),TMath::Cos(fTheta));
150 printf("\n%i |%s| theta %f : fOK.Phi = %f(%5.2f)\n",
151 GetUniqueID(), GetName(), fTheta, fOK.Phi(),fOK.Phi()*TMath::RadToDeg());
152 printf(" A %f B %f | fThetaA %7.6f(%5.2f)\n", fA,fB, fThetaA,fThetaA*TMath::RadToDeg());
153 printf(" fOK : X %8.3f: Y %8.3f \n", fOK.X(), fOK.Y());
154 printf(" fOK1 : X %8.3f: Y %8.3f (in SM, ieta=2)\n", fOK1.X(), fOK1.Y());
155 printf(" fOK2 : X %8.3f: Y %8.3f (in SM, ieta=1)\n\n", fOK2.X(), fOK2.Y());