1 /**************************************************************************
2 * Copyright(c) 1998-2006, 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 //_________________________________________________________________________
19 // Main class for "twist" geometry of Shish-Kebab case.
20 // Author: Aleksei Pavlinov(WSU).
22 // See web page with description of Shish-Kebab geometries:
23 // http://pdsfweb01.nersc.gov/~pavlinov/ALICE/SHISHKEBAB/RES/shishkebabALICE.html
24 //_________________________________________________________________________
26 #include "AliEMCALShishKebabModule.h"
27 #include "AliEMCALGeometry.h"
31 ClassImp(AliEMCALShishKebabModule)
33 AliEMCALGeometry *AliEMCALShishKebabModule::fgGeometry=0;
34 Double_t AliEMCALShishKebabModule::fga=0.;
35 Double_t AliEMCALShishKebabModule::fgb=0.;
36 Double_t AliEMCALShishKebabModule::fgr=0.;
38 //_________________________________________________________________________
39 AliEMCALShishKebabModule::AliEMCALShishKebabModule()
46 // theta in radians ; first object shold be with theta=pi/2.
48 fTheta = TMath::PiOver2();
54 Warning("AliEMCALShishKebabModule(theta)","You should call this constractor just once !!");
58 //_________________________________________________________________________
59 AliEMCALShishKebabModule::AliEMCALShishKebabModule(AliEMCALShishKebabModule &leftNeighbor)
67 TObject::SetUniqueID(leftNeighbor.GetUniqueID()+1);
68 Init(leftNeighbor.GetA(),leftNeighbor.GetB());
71 //_________________________________________________________________________
72 AliEMCALShishKebabModule::AliEMCALShishKebabModule(const AliEMCALShishKebabModule& mod)
73 : TNamed(mod.GetName(),mod.GetTitle()),
82 //_________________________________________________________________________
83 void AliEMCALShishKebabModule::Init(Double_t A, Double_t B)
86 // Initialisation method
88 Double_t thetaMin, thetaMax, par[4];
91 // DefineSecondModuleFirstAssumption();
92 thetaMax = TMath::ATan2(fgr, 1.4*fga);
93 thetaMin = TMath::ATan2(fgr, 1.6*fga);
94 fTheta = Solve(AliEMCALShishKebabModule::Y2, thetaMin,thetaMax,npar,par);
102 thetaMax = TMath::ATan2(fgr,x + 0.5*fga);
103 thetaMin = TMath::ATan2(fgr,x + 1.5*fga);
104 fTheta = Solve(AliEMCALShishKebabModule::YALL, thetaMin,thetaMax,npar,par);
107 Double_t rOK = fgr / TMath::Sin(fTheta) + (fga/2.)/TMath::Tan(fTheta) + fgb/2.;
108 fOK.SetMagPhi(rOK, fTheta);
109 // have to define A and B
110 fA = TMath::Tan(fTheta);
111 fB = -fga/(2.*TMath::Cos(fTheta));
115 //_________________________________________________________________________
116 void AliEMCALShishKebabModule::DefineFirstModule()
118 // Define first module
119 fOK.Set(fga/2., fgr + fgb/2.); // position the center of module vs o
122 fA = -999.; // fA=infinite in this case
123 TObject::SetUniqueID(1); //
126 //_________________________________________________________________________
127 void AliEMCALShishKebabModule::DefineSecondModuleFirstAssumption()
128 { // Keep for testing and checking
129 // cos(theta) << 1, theta ~ pi/2.; a/r = 11.4/462.54 = 0.0246465 << 1;
130 // theta=1.53382 from this case; theta=1.533869 from TGraph::Zero
131 Double_t x = (3.*fga)/(2.*fgr);
132 fTheta = TMath::ACos(x);
134 Double_t rOK = fgr / TMath::Sin(fTheta) + (fga/2.)/TMath::Tan(fTheta) + fgb/2.;
135 fOK.SetMagPhi(rOK, fTheta);
136 // have to define A and B
137 fA = TMath::Tan(fTheta);
138 fB = -fga/(2.*TMath::Cos(fTheta));
143 //_________________________________________________________________________
144 Double_t AliEMCALShishKebabModule::Solve(Double_t (*fcn)(Double_t*,Double_t*),
145 Double_t xmin, Double_t xmax, Int_t npar, Double_t *par, Double_t eps, Int_t maxIter)
147 // Find out "zero" using TGraph method
148 if(npar); // unused now
152 gr.Zero(k, xmin,xmax, eps, x,y, maxIter); // remember initial interval
155 gr.Zero(k, xmin,xmax, eps, x,y, maxIter);
160 //_________________________________________________________________________
161 Double_t AliEMCALShishKebabModule::Y2(Double_t *x, Double_t *par)
163 // For position calulation of second module
165 Double_t theta = x[0];
166 Double_t cos = TMath::Cos(theta);
167 Double_t sin = TMath::Sin(theta);
168 Double_t y1 = fgr*cos/sin + fga/(2.*sin) - fga*sin;
169 Double_t y2 = fga, y = y1-y2;;
170 // printf(" theta %f Y %12.5e \n", theta, y);
174 //_________________________________________________________________________
175 Double_t AliEMCALShishKebabModule::YALL(Double_t *x, Double_t *par)
177 // For position calulation of 3th, 4th to 30th modules
178 Double_t a=par[0], r=par[1], aa=par[2], bb=par[3];
179 Double_t theta = x[0];
180 Double_t cos = TMath::Cos(theta);
181 Double_t sin = TMath::Sin(theta);
183 Double_t y1 = r + a*cos;
184 Double_t y2 = aa*(r*cos/sin + a/(2.*sin) - a*sin) + bb;
186 // printf(" theta %f Y %12.5e \n", theta, y);
190 //_________________________________________________________________________
191 void AliEMCALShishKebabModule::DefineName(Double_t theta)
193 // Define name of object
194 SetName(Form("%2i(%5.2f)", TObject::GetUniqueID(), theta*TMath::RadToDeg()));
197 //_________________________________________________________________________
198 Bool_t AliEMCALShishKebabModule::GetParameters()
200 // Get needing module parameters from EMCAL geometry
201 fgGeometry = AliEMCALGeometry::GetInstance();
203 Warning("GetParameters()"," No geometry ");
207 fga = (Double_t)fgGeometry->GetPhiModuleSize();
208 fgb = (Double_t)fgGeometry->GetLongModuleSize();
209 fgr = (Double_t)(fgGeometry->GetIPDistance() + fgGeometry->GetSteelFrontThickness());
214 //_________________________________________________________________________
215 void AliEMCALShishKebabModule::PrintShish(Int_t pri) const
219 Info("PrintShish()", " a %7.2f | b %7.2f | r %7.2f ", fga, fgb, fgr);
220 printf(" fTheta %f : %5.2f : cos(theta) %f\n", fTheta, GetThetaInDegree(),TMath::Cos(fTheta));
222 printf("%i %s | theta %f -> %f\n", GetUniqueID(), GetName(), fTheta, fOK.Phi());
223 printf(" A %f B %f \n", fA, fB);
230 //_________________________________________________________________________
231 Double_t AliEMCALShishKebabModule::GetThetaInDegree() const
233 return fTheta*TMath::RadToDeg();