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)
19 #include "AliEMCALShishKebabModule.h"
20 #include "AliEMCALGeometry.h"
26 ClassImp(AliEMCALShishKebabModule)
28 AliEMCALGeometry *AliEMCALShishKebabModule::fgGeometry=0;
29 Double_t AliEMCALShishKebabModule::fga=0.;
30 Double_t AliEMCALShishKebabModule::fgb=0.;
31 Double_t AliEMCALShishKebabModule::fgr=0.;
33 AliEMCALShishKebabModule::AliEMCALShishKebabModule(double theta) : TNamed()
34 { // theta in radians ; first object shold be with theta=pi/2.
40 } else Warning("AliEMCALShishKebabModule(theta)","You should call this constractor just once !!");
44 AliEMCALShishKebabModule::AliEMCALShishKebabModule(AliEMCALShishKebabModule &leftNeighbor) : TNamed()
46 TObject::SetUniqueID(leftNeighbor.GetUniqueID()+1);
47 Init(leftNeighbor.GetA(),leftNeighbor.GetB());
50 void AliEMCALShishKebabModule::Init(double A, double B)
52 Double_t thetaMin, thetaMax, par[4];
55 // DefineSecondModuleFirstAssumption();
56 thetaMax = TMath::ATan2(fgr, 1.4*fga);
57 thetaMin = TMath::ATan2(fgr, 1.6*fga);
58 fTheta = Solve(AliEMCALShishKebabModule::Y2, thetaMin,thetaMax,npar,par);
66 thetaMax = TMath::ATan2(fgr,x + 0.5*fga);
67 thetaMin = TMath::ATan2(fgr,x + 1.5*fga);
68 fTheta = Solve(AliEMCALShishKebabModule::YALL, thetaMin,thetaMax,npar,par);
71 Double_t rOK = fgr / TMath::Sin(fTheta) + (fga/2.)/TMath::Tan(fTheta) + fgb/2.;
72 fOK.SetMagPhi(rOK, fTheta);
73 // have to define A and B
74 fA = TMath::Tan(fTheta);
75 fB = -fga/(2.*TMath::Cos(fTheta));
79 void AliEMCALShishKebabModule::DefineFirstModule()
81 fOK.Set(fga/2., fgr + fgb/2.); // position the center of module vs o
84 fA = -999.; // fA=infinite in this case
85 TObject::SetUniqueID(1); //
88 void AliEMCALShishKebabModule::DefineSecondModuleFirstAssumption()
89 { // Keep for testing and checking
90 // cos(theta) << 1, theta ~ pi/2.; a/r = 11.4/462.54 = 0.0246465 << 1;
91 // theta=1.53382 from this case; theta=1.533869 from TGraph::Zero
92 Double_t x = (3.*fga)/(2.*fgr);
93 fTheta = TMath::ACos(x);
95 Double_t rOK = fgr / TMath::Sin(fTheta) + (fga/2.)/TMath::Tan(fTheta) + fgb/2.;
96 fOK.SetMagPhi(rOK, fTheta);
97 // have to define A and B
98 fA = TMath::Tan(fTheta);
99 fB = -fga/(2.*TMath::Cos(fTheta));
104 Double_t AliEMCALShishKebabModule::Solve(Double_t (*fcn)(Double_t*,Double_t*),
105 Double_t xmin, Double_t xmax, Int_t npar, Double_t *par, Double_t eps, Int_t maxIter)
107 if(npar); // unused now
111 gr.Zero(k, xmin,xmax, eps, X,Y, maxIter); // remember initial interval
114 gr.Zero(k, xmin,xmax, eps, X,Y, maxIter);
119 Double_t AliEMCALShishKebabModule::Y2(double *x, double *par)
120 { // For position calulation of second module
122 Double_t theta = x[0];
123 Double_t cos = TMath::Cos(theta);
124 Double_t sin = TMath::Sin(theta);
125 Double_t y1 = fgr*cos/sin + fga/(2.*sin) - fga*sin;
126 Double_t y2 = fga, y = y1-y2;;
127 // printf(" theta %f Y %12.5e \n", theta, y);
131 Double_t AliEMCALShishKebabModule::YALL(double *x, double *par)
132 { // For position calulation of 3th, 4th to 30th modules
133 Double_t a=par[0], r=par[1], A=par[2], B=par[3];
134 Double_t theta = x[0];
135 Double_t cos = TMath::Cos(theta);
136 Double_t sin = TMath::Sin(theta);
138 Double_t y1 = r + a*cos;
139 Double_t y2 = A*(r*cos/sin + a/(2.*sin) - a*sin) + B;
141 // printf(" theta %f Y %12.5e \n", theta, y);
145 void AliEMCALShishKebabModule::DefineName(double theta)
148 // sprintf(name,"theta_%5.2f",theta*180./TMath::Pi());
149 sprintf(name,"%2i(%5.2f)", TObject::GetUniqueID(), theta*180./TMath::Pi());
153 Bool_t AliEMCALShishKebabModule::GetParameters()
155 fgGeometry = AliEMCALGeometry::GetInstance();
156 // if(!fgGeometry) assert(0);
158 Warning("GetParameters()"," No geometry ");
162 fga = (Double_t)fgGeometry->GetPhiModuleSize();
163 fgb = (Double_t)fgGeometry->GetLongModuleSize();
164 fgr = (Double_t)(fgGeometry->GetIPDistance() + fgGeometry->GetSteelFrontThickness());
170 void AliEMCALShishKebabModule::PrintShish(int pri) const
173 Info("PrintShish()", " a %7.2f | b %7.2f | r %7.2f ", fga, fgb, fgr);
174 printf(" fTheta %f : %5.2f : cos(theta) %f\n", fTheta, GetThetaInDegree(),TMath::Cos(fTheta));
176 printf("%i %s | theta %f -> %f\n", GetUniqueID(), GetName(), fTheta, fOK.Phi());
177 printf(" A %f B %f \n", fA, fB);