]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHParam.cxx
Adding MUON HLT code to the repository.
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.cxx
CommitLineData
53fd478b 1// **************************************************************************
2// * Copyright(c) 1998-1999, 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// **************************************************************************
56148d0e 15#include "AliRICHParam.h"
101624cd 16#include "AliESD.h"
e42a7b46 17#include "AliRICHChamber.h"
a25b3368 18#include <TCanvas.h>
19#include <TLatex.h>
20#include <THStack.h>
21#include <TLegend.h>
22#include <TView.h>
23#include <TPolyMarker3D.h>
24#include <TPolyLine3D.h>
d3eb6079 25#include <TPolyLine.h>
101624cd 26#include <TSystem.h>
d0831219 27#include <TVector2.h>
28#include <TVector3.h>
29#include <TRotation.h>
30
56148d0e 31
ed3ceb24 32ClassImp(AliRICHParam)
a25b3368 33Bool_t AliRICHParam::fgIsWireSag =kTRUE; //take ware sagita into account?
34Bool_t AliRICHParam::fgIsResolveClusters =kTRUE; //do cluster resolving?
d3eb6079 35Bool_t AliRICHParam::fgIsFeedback =kTRUE; //generate feedback photons?
a25b3368 36Bool_t AliRICHParam::fgIsRadioSrc =kFALSE; //put radioactive source instead of radiators?
37Bool_t AliRICHParam::fgIsAerogel =kFALSE; //special aerogel configuration
38Bool_t AliRICHParam::fgIsTestBeam =kFALSE; //special test beam configuration
39
e42a7b46 40Int_t AliRICHParam::fgHV[kNsectors] ={2050,2050,2050,2050,2050,2050};
08479a10 41Int_t AliRICHParam::fgNsigmaTh =4;
e42a7b46 42Float_t AliRICHParam::fgSigmaThMean =1.132; //QDC
43Float_t AliRICHParam::fgSigmaThSpread =0.035; //
101624cd 44Double_t AliRICHParam::fgErrChrom[4][330]; //
45Double_t AliRICHParam::fgErrGeom[4][330]; //
46Double_t AliRICHParam::fgErrLoc[4][330]; //Chromatic, Geometric and Localization array to parametrize SigmaCerenkov
47
08479a10 48
3582c1f9 49//__________________________________________________________________________________________________
c4a03891 50void AliRICHParam::Print(Option_t*) const
3582c1f9 51{
ae754cdf 52//print some usefull (hopefully) info on some internal guts of RICH parametrisation
d3eb6079 53 AliInfo(Form("Pads in chamber (%3i,%3i) in sector (%2i,%2i) pad size (%4.2f,%4.2f)",NpadsX(),NpadsY(),NpadsXsec(),NpadsYsec(),PadSizeX(),PadSizeY()));
a25b3368 54 AliInfo(Form("Resolve clusters %i sagita %i Radio source %i Aerogel %i TestBeam %i",
55 IsResolveClusters(),IsWireSag(),IsRadioSrc(),IsAerogel(),IsTestBeam()));
56 fpChambers->Print();
998b831f 57}//Print()
3582c1f9 58//__________________________________________________________________________________________________
e42a7b46 59void AliRICHParam::CreateChambers()
60{
61//Create all RICH Chambers on each call. Previous chambers deleted.
62 if(fpChambers) delete fpChambers;
a25b3368 63 if(fgIsTestBeam){
998b831f 64 fpChambers=new TObjArray(1);//test beam configuration 1 chamber
65 fpChambers->AddAt(new AliRICHChamber(0),0);
66 }else{
67 fpChambers=new TObjArray(kNchambers);//normal configuration 7 chambers
68 for(int iChamberN=0;iChamberN<kNchambers;iChamberN++) fpChambers->AddAt(new AliRICHChamber(iChamberN+1),iChamberN);
69 }
e42a7b46 70 fpChambers->SetOwner();
998b831f 71}//CreateChambers()
a25b3368 72//__________________________________________________________________________________________________
73Float_t AliRICHParam::AbsCH4(Float_t eV)
74{
75//Evaluate the absorbtion lenght of CH4 for a photon of energy eV in electron-volts
76 const Float_t kLoschmidt=2.686763e19; // LOSCHMIDT NUMBER IN CM-3
77 const Float_t kPressure=750.0; //mm of Hg
78 const Float_t kTemperature=283.0; //K (10 grad C)
79 const Float_t kPn=kPressure/760.;
80 const Float_t kTn=kTemperature/273.16;
81 const Float_t kC0=-1.655279e-1;
82 const Float_t kC1= 6.307392e-2;
83 const Float_t kC2=-8.011441e-3;
84 const Float_t kC3= 3.392126e-4;
85
86 Float_t crossSection=0;
87 if (eV<7.75)
88 crossSection=0.06e-22;
89 else //------ METHANE CROSS SECTION cm-2 ASTROPH. J. 214, L47 (1978)
90 crossSection=(kC0+kC1*eV+kC2*eV*eV+kC3*eV*eV*eV)*1.e-18;
91
92 Float_t density=kLoschmidt*kPn/kTn; //CH4 molecular concentration (cm^-3)
93 return 1.0/(density*crossSection);
94}//AbsoCH4()
95//__________________________________________________________________________________________________
96void AliRICHParam::TestSeg()
ae754cdf 97{
98//Provides a set of pictures to test segementation currently in use.
d3eb6079 99 new TCanvas("pads","PC segmentation - pads display",700,600);
100 gPad->Range(-5,-5,PcSizeX()+5,PcSizeY()+15);
101 TVector p(2); TVector2 c; TVector2 b; //current: pad, pad center, pad boundary
102// list of corners:
103 Double_t x0=0,x1=SectorSizeX(),x2=SectorSizeX()+DeadZone(), x3=PcSizeX();
104 Double_t y0=0,y1=SectorSizeY(),y2=SectorSizeY()+DeadZone(),y3=2*SectorSizeY()+DeadZone(),y4=PcSizeY()-SectorSizeY(),y5=PcSizeY();
105 DrawSectors();
106//header
107 TLatex t;
108 t.SetTextSize(0.02); t.SetTextColor(kBlack); t.SetTextAlign(11);
109 t.DrawLatex(0,PcSizeY()+10,Form("IP in front of this page. pad size %.2fx%.2fcm dead zone %.2fcm",PadSizeX(),PadSizeY(),DeadZone()));
110 t.DrawLatex(0,PcSizeY()+ 5,Form("Pc %.2fx%.2f cm %ix%i pads Sec %.2fx%.2f cm %ix%i pads",
111 PcSizeX() , PcSizeY() , NpadsX() , NpadsY() ,
112 SectorSizeX() , SectorSizeY() , NpadsXsec() , NpadsYsec() ));
113//sectors
114 t.SetTextSize(0.015); t.SetTextColor(kRed); t.SetTextAlign(22);
115 c=Pad2Loc( 40, 24); t.DrawText(c.X(),c.Y(),Form("sec 1 (%.2f,%.2f)",c.X(),c.Y() ));
116 c=Pad2Loc( 40, 75); t.DrawText(c.X(),c.Y(),Form("sec 3 (%.2f,%.2f)",c.X(),c.Y() ));
117 c=Pad2Loc( 40,121); t.DrawText(c.X(),c.Y(),Form("sec 5 (%.2f,%.2f)",c.X(),c.Y() ));
118 c=Pad2Loc(120, 24); t.DrawText(c.X(),c.Y(),Form("sec 2 (%.2f,%.2f)",c.X(),c.Y() ));
119 c=Pad2Loc(120, 75); t.DrawText(c.X(),c.Y(),Form("sec 4 (%.2f,%.2f)",c.X(),c.Y() ));
120 c=Pad2Loc(120,121); t.DrawText(c.X(),c.Y(),Form("sec 6 (%.2f,%.2f)",c.X(),c.Y() ));
121//coners
122 t.SetTextSize(0.015); t.SetTextColor(kBlue);
123
124 b.Set(x0,y0);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(11);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
125 b.Set(x0,y1);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(13);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
126 b.Set(x0,y2);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(11);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
127 b.Set(x0,y3);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(13);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
128 b.Set(x0,y4);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(11);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
129 b.Set(x0,y5);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(13);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
a25b3368 130
d3eb6079 131 b.Set(x1,y0);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(31);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
132 b.Set(x1,y1);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(33);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
133 b.Set(x1,y2);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(31);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
134 b.Set(x1,y3);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(33);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
135 b.Set(x1,y4);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(31);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
136 b.Set(x1,y5);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(33);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
a25b3368 137
d3eb6079 138 b.Set(x2,y0);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(11);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
139 b.Set(x2,y1);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(13);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
140 b.Set(x2,y2);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(11);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
141 b.Set(x2,y3);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(13);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
142 b.Set(x2,y4);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(11);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
143 b.Set(x2,y5);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(13);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
a25b3368 144
d3eb6079 145 b.Set(x3,y0);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(31);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
146 b.Set(x3,y1);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(33);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
147 b.Set(x3,y2);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(31);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
148 b.Set(x3,y3);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(33);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
149 b.Set(x3,y4);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(31);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
150 b.Set(x3,y5);p=Loc2Pad(b);c=Pad2Loc(p);t.SetTextAlign(33);t.DrawText(c.X(),c.Y(),Form("(%.2f,%.2f)-(%.0f,%.0f)-(%.2f,%.2f)",b.X(),b.Y(),p(0),p(1),c.X(),c.Y()));
a25b3368 151}//TestSeg()
152//__________________________________________________________________________________________________
153void AliRICHParam::TestResp()
154{
ae754cdf 155//Provides a set of plot to check the response parametrisation currently in use.
a25b3368 156 TCanvas *pC=new TCanvas("c","Amplification test",900,800);
157 pC->Divide(1,2);
158
159
ae754cdf 160 const Int_t kNpoints=8;
a25b3368 161 THStack *pStackPhot=new THStack("StackPhot","photons");
162 THStack *pStackMip =new THStack("StackMip","mips");
163 TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");
ae754cdf 164 TH1F *apHphot[kNpoints];
165 TH1F *apHmip[kNpoints];
a25b3368 166
167 Double_t starty=0;
ae754cdf 168 Double_t deltay=AliRICHParam::SectorSizeY()/kNpoints;
a25b3368 169
ae754cdf 170 for(int i=0;i<kNpoints;i++){
a25b3368 171 apHphot[i]=new TH1F(Form("hphot%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apHphot[i]->SetLineColor(i);pStackPhot->Add(apHphot[i]);
172 apHmip[i] =new TH1F(Form("hmip%i",i),"Qdc for Mip;QDC;Counts",4000,0,4000); apHmip[i]->SetLineColor(i);pStackMip->Add(apHmip[i]);
173
174 pLeg->AddEntry(apHphot[i],Form("@(10,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-SectorSizeY()/2));
175 }
176
177
178 TVector2 x2(0,0);
179 for(Int_t i=0;i<10000;i++){//events loop
ae754cdf 180 for(int j=0;j<kNpoints;j++){
a25b3368 181 x2.Set(10,starty+j*deltay);
182 apHphot[j]->Fill(TotQdc(x2,0));
183 apHmip[j]->Fill(TotQdc(x2,gRandom->Landau(600,150)*1e-9));
184 }
185 }
186
187 pC->cd(1); pStackMip->Draw("nostack");
188 pC->cd(2); pStackPhot->Draw("nostack"); pLeg->Draw();
189}//TestResp()
190//__________________________________________________________________________________________________
191void AliRICHParam::TestTrans()
192{
ae754cdf 193//Provides a set of plots to test transformation methods
a25b3368 194 new TCanvas("trasform","Test LRS-MRS transform");
195 TLatex t; t.SetTextSize(0.02);
196
197 TView *pView=new TView(1);
198 pView->SetRange(-600,-600,-600,600,600,600);
199 DrawAxis();
200//Draw PC for all chambers by trasfering Pc plane using Pc2Mrs methode
201 Int_t iNpointsX=50,iNpointsY=50;
202 for(Int_t iChamberN=1;iChamberN<=7;iChamberN++){//chamber loop
203 TPolyMarker3D *pChamber=new TPolyMarker3D(iNpointsX*iNpointsY);
204 Int_t i=0;
205 for(Double_t x=0;x<PcSizeX();x+=PcSizeX()/iNpointsX)
206 for(Double_t y=0;y<PcSizeY();y+=PcSizeY()/iNpointsY){//step loop
207 TVector3 v3=C(iChamberN)->Pc2Mrs(TVector2(x,y));//from regular grid of local PC points to MRS presentation
208 pChamber->SetPoint(i++,v3.X(),v3.Y(),v3.Z());//Pc plane poing in MRS
209 }//step loop
210 pChamber->SetMarkerSize(1);
211 pChamber->SetMarkerColor(iChamberN);
212 pChamber->Draw();
213 t.SetNDC();t.SetTextColor(iChamberN); t.DrawText(0.1,iChamberN*0.1,Form("Chamber %i",iChamberN));
214 }//chamber loop
215// gPad->GetView()->RotateView(94,45);
216}//TestTrans()
217//__________________________________________________________________________________________________
218void AliRICHParam::DrawAxis()
219{
ae754cdf 220//Utility: draws axis on geometry scene
221 Double_t x[6]={0,0,0,300,0,0}; Double_t y[6]={0,0,0,0,300,0}; Double_t z[6]={0,0,0,0,0,300};
222 TPolyLine3D *pXaxis=new TPolyLine3D(2,x);pXaxis->SetLineColor(kRed); pXaxis->Draw();
223 TPolyLine3D *pYaxis=new TPolyLine3D(2,y);pYaxis->SetLineColor(kGreen); pYaxis->Draw();
224 TPolyLine3D *pZaxis=new TPolyLine3D(2,z);pZaxis->SetLineColor(kBlue); pZaxis->Draw();
a25b3368 225}
d3eb6079 226//__________________________________________________________________________________________________
227void AliRICHParam::DrawSectors()
228{
ae754cdf 229//Utility: draws RICH chamber sectors on event display.
d3eb6079 230 Double_t xLeft[5] = {0,0,SectorSizeX(),SectorSizeX(),0};
231 Double_t xRight[5] = {SectorSizeX()+DeadZone(),SectorSizeX()+DeadZone(),PcSizeX(),PcSizeX(),SectorSizeX()+DeadZone()};
232
233 Double_t yDown[5] = {0,SectorSizeY(),SectorSizeY(),0,0};
234 Double_t yCenter[5] = { SectorSizeY()+DeadZone(),2*SectorSizeY()+DeadZone(),2*SectorSizeY()+DeadZone(),
235 SectorSizeY()+DeadZone(),SectorSizeY()+DeadZone()};
236 Double_t yUp[5] = {2*SectorSizeY()+2*DeadZone(),PcSizeY(),PcSizeY(),2*SectorSizeY()+2*DeadZone(),2*SectorSizeY()+2*DeadZone()};
237
238 TPolyLine *sec1 = new TPolyLine(5,xLeft ,yDown); sec1->SetLineColor(21); sec1->Draw();
239 TPolyLine *sec2 = new TPolyLine(5,xRight,yDown); sec2->SetLineColor(21); sec2->Draw();
240 TPolyLine *sec3 = new TPolyLine(5,xLeft ,yCenter); sec3->SetLineColor(21); sec3->Draw();
241 TPolyLine *sec4 = new TPolyLine(5,xRight,yCenter); sec4->SetLineColor(21); sec4->Draw();
242 TPolyLine *sec5 = new TPolyLine(5,xLeft, yUp); sec5->SetLineColor(21); sec5->Draw();
243 TPolyLine *sec6 = new TPolyLine(5,xRight,yUp); sec6->SetLineColor(21); sec6->Draw();
244}//DrawSectors()
101624cd 245//__________________________________________________________________________________________________
246void AliRICHParam::ReadErrFiles()
247{
248// Read the three files corresponding to Chrom,Geom and Loc
249// They are parameters of a polynomial of 6th order...
250
251 static Bool_t count = kFALSE;
252
253 Float_t c0,c1,c2,c3,c;
254 Float_t g0,g1,g2,g3,g;
255 Float_t l0,l1,l2,l3,l;
256
257 FILE *pChromErr, *pGeomErr, *pLocErr;
258
259 if(!count) {
260 AliInfoGeneral("ReadErrFiles","reading RICH error parameters...");
261 pChromErr = fopen(Form("%s/RICH/RICHConfig/SigmaChromErr.txt",gSystem->Getenv("ALICE_ROOT")),"r");
262 pGeomErr = fopen(Form("%s/RICH/RICHConfig/SigmaGeomErr.txt",gSystem->Getenv("ALICE_ROOT")),"r");
263 pLocErr = fopen(Form("%s/RICH/RICHConfig/SigmaLocErr.txt",gSystem->Getenv("ALICE_ROOT")),"r");
264 if(!pChromErr||!pGeomErr||!pLocErr) {AliErrorGeneral("ReadErrFiles"," RICH ERROR READING Parameter FILES: can't open files!!! ");return;}
265 for(Int_t i=0;i<330;i++) {
266 fscanf(pChromErr,"%f%f%f%f%f\n",&c0,&c1,&c2,&c3,&c);
267 fscanf(pGeomErr,"%f%f%f%f%f\n",&g0,&g1,&g2,&g3,&g);
268 fscanf(pLocErr,"%f%f%f%f%f\n",&l0,&l1,&l2,&l3,&l);
269 fgErrChrom[0][i] = c0;
270 fgErrChrom[1][i] = c1;
271 fgErrChrom[2][i] = c2;
272 fgErrChrom[3][i] = c3;
273 fgErrGeom[0][i] = g0;
274 fgErrGeom[1][i] = g1;
275 fgErrGeom[2][i] = g2;
276 fgErrGeom[3][i] = g3;
277 fgErrLoc[0][i] = l0;
278 fgErrLoc[1][i] = l1;
279 fgErrLoc[2][i] = l2;
280 fgErrLoc[3][i] = l3;
281 }
282 AliInfoGeneral("ReadErrFiles","DONE successfully!");
283 fclose(pChromErr);
284 fclose(pGeomErr);
285 fclose(pLocErr);
286 }
287 count = kTRUE;
288}//ReadErrFiles()
289//__________________________________________________________________________________________________
290TVector3 AliRICHParam::SigmaSinglePhoton(Int_t partID, Double_t mom, Double_t theta, Double_t phi)
291
292{
293// Find sigma for single photon. It returns the thrree different errors. If you want
294// to have the error---> TVector3.Mag()
295
296 TVector3 v(-999,-999,-999);
297 Double_t pmom;
298
299 ReadErrFiles();
300 Double_t mass = AliPID::ParticleMass(partID);
301 Double_t massRef = AliPID::ParticleMass(AliPID::kProton); // all the files are calculated for protons...so mass ref is proton mass
302 pmom = mom*massRef/mass; // normalized momentum respect to proton...
303 if(pmom>6.5) pmom = 6.5;
304 Double_t oneOverRefIndex = 1/RefIdxC6F14(6.755);
305 Double_t pmin = mass*oneOverRefIndex/TMath::Sqrt(1-oneOverRefIndex*oneOverRefIndex);
306 if(pmom<pmin) return v;
307 v.SetX(Interpolate(fgErrChrom,pmom,theta,phi));
308 v.SetY(Interpolate(fgErrGeom,pmom,theta,phi));
309 v.SetZ(Interpolate(fgErrLoc,pmom,theta,phi));
310
311 return v;
312}//SigmaSinglePhoton
313//__________________________________________________________________________________________________
314Double_t AliRICHParam::Interpolate(Double_t par[4][330], Double_t x, Double_t y, Double_t phi)
315
316{
317 static Double_t amin = 1.15; static Double_t astep = 0.2;
318 static Double_t bmin = 0; static Double_t bstep = 1;
319
320 Double_t Phi = (phi - 180)/300.;
321
322 Double_t Sigma[30][11];
323
324 for(Int_t j=0;j<11;j++) { for(Int_t i=0;i<30;i++) {
325 Sigma[i][j] = par[0][j+11*i] + par[1][j+11*i]*Phi*Phi + par[2][j+11*i]*TMath::Power(Phi,4) + par[3][j+11*i]*TMath::Power(Phi,6);
326 }
327 }
328
329 Int_t i=0;Int_t j=0;
330
331 i = (Int_t)((x-amin)/astep);
332 j = (Int_t)((y-bmin)/bstep);
333 Double_t ai = amin+i*astep;
334 Double_t ai1 = ai+astep;
335 Double_t bj = bmin+j*bstep;
336 Double_t bj1 = bj+bstep;
337 Double_t t = (x-ai)/(ai1-ai);
338 Double_t gj = (1-t)*Sigma[i][j]+t*Sigma[i+1][j];
339 Double_t gj1 = (1-t)*Sigma[i][j+1]+t*Sigma[i+1][j+1];
340 Double_t u = (y-bj)/(bj1-bj);
341 return (1-u)*gj+u*gj1;
342}//Interpolate
d0831219 343//__________________________________________________________________________________________________
56030c8d 344TVector3 AliRICHParam::ForwardTracing(TVector3 entranceTrackPoint, TVector3 vectorTrack, Double_t thetaC, Double_t phiC)
d0831219 345{
346//
f770edb5 347 TVector3 vBad(-999,-999,-999);
d0831219 348 TVector3 nPlane(0,0,1);
349 Double_t planeZposition = 0.5*Zfreon();
350 TVector3 planePoint(0,0,planeZposition);
351 TVector3 emissionPoint = PlaneIntersect(vectorTrack,entranceTrackPoint,nPlane,planePoint);
56030c8d 352// emissionPoint.Dump();
d0831219 353 Double_t thetaout,phiout;
354 AnglesInDRS(vectorTrack.Theta(),vectorTrack.Phi(),thetaC,phiC,thetaout,phiout);
355// cout << "thetaout "<<thetaout << " phiout " << phiout << endl;
356 TVector3 vectorPhotonInC6F14;
357 vectorPhotonInC6F14.SetMagThetaPhi(1,thetaout,phiout);
56030c8d 358// vectorPhotonInC6F14.Dump();
d0831219 359// planeZposition=AliRICHParam::C6F14Thickness();
360 planeZposition=Zfreon();
361 planePoint.SetXYZ(0,0,planeZposition);
362 TVector3 entranceToSiO2Point = PlaneIntersect(vectorPhotonInC6F14,emissionPoint,nPlane,planePoint);
56030c8d 363// entranceToSiO2Point.Dump();
d0831219 364
365 Double_t photonEn = MeanCkovEnergy();
f770edb5 366 Double_t angleInSiO2 = SnellAngle(RefIdxC6F14(photonEn),RefIdxSiO2(photonEn),vectorPhotonInC6F14.Theta());if(angleInSiO2<0) return vBad;
d0831219 367 TVector3 vectorPhotonInSiO2;
56030c8d 368 vectorPhotonInSiO2.SetMagThetaPhi(1,angleInSiO2,phiout);
d0831219 369// planeZposition+=AliRICHParam::SiO2Thickness();
370 planeZposition+=Zwin();
371 planePoint.SetXYZ(0,0,planeZposition);
372 TVector3 entranceToCH4 = PlaneIntersect(vectorPhotonInSiO2,entranceToSiO2Point,nPlane,planePoint);
56030c8d 373// entranceToCH4.Dump();
d0831219 374
375 // Double_t angleInCH4 = SnellAngle(AliRICHParam::IndOfRefSiO2(6.755),AliRICHParam::IndOfRefCH4,angleInSiO2);
f770edb5 376 Double_t angleInCH4 = SnellAngle(RefIdxSiO2(photonEn),RefIdxCH4(photonEn),vectorPhotonInSiO2.Theta());if(angleInCH4<0) return vBad;
d0831219 377 TVector3 vectorPhotonInCH4;
56030c8d 378 vectorPhotonInCH4.SetMagThetaPhi(1,angleInCH4,phiout);
d0831219 379// planeZposition+=AliRICHParam::GapProx();
380 planeZposition+=Pc2Win();
381 planePoint.SetXYZ(0,0,planeZposition);
382 TVector3 impactToPC = PlaneIntersect(vectorPhotonInCH4,entranceToCH4,nPlane,planePoint);
56030c8d 383// impactToPC.Dump();
384 return impactToPC;
d0831219 385}//FowardTracing
386//__________________________________________________________________________________________________
387TVector3 AliRICHParam::PlaneIntersect(TVector3 vstart,TVector3 p0,TVector3 n,TVector3 v0)
388{
389//
390 TVector3 parallel(-999,-999,-999);
391 // vstart = given vector
392 // p0 = origin of the given vector
393 // n = normal to a given plane
394 // v0 = point of the given plane
395// cout << " n*vstart = " << n*vstart << endl;
396 if(n*vstart==0) return parallel;
397 TVector3 diff=v0-p0;
398 Double_t sint=(n*diff)/(n*vstart);
399 return p0+sint*vstart;
400}//PlaneIntersect
401//__________________________________________________________________________________________________
402Double_t AliRICHParam::SnellAngle(Float_t n1, Float_t n2, Float_t theta1)
403{
404// Snell law
405// Compute the Snell angle
406
407 Double_t sinrefractangle;
408 Double_t refractangle;
409
410 sinrefractangle = (n1/n2)*sin(theta1);
411
412 if(sinrefractangle>1.) {
413 // cout << " PROBLEMS IN SNELL ANGLE !!!!! " << endl;
f770edb5 414 refractangle = -999.;
d0831219 415 return refractangle;
416 }
417
418 refractangle = asin(sinrefractangle);
419 return refractangle;
420}//SnellAngle
421//__________________________________________________________________________________________________
422void AliRICHParam::AnglesInDRS(Double_t trackTheta,Double_t trackPhi,Double_t thetaCerenkov,Double_t phiCerenkov,Double_t &tout,Double_t &pout)
423{
424// Setup the rotation matrix of the track...
425
426 TRotation mtheta;
427 TRotation mphi;
428 TRotation minv;
429 TRotation mrot;
430
431 mtheta.RotateY(trackTheta);
432 mphi.RotateZ(trackPhi);
433
434 mrot = mphi * mtheta;
435 // minv = mrot.Inverse();
436
437 TVector3 photonInRadiator(1,1,1);
438
439 photonInRadiator.SetTheta(thetaCerenkov);
440 photonInRadiator.SetPhi(phiCerenkov);
441 photonInRadiator = mrot * photonInRadiator;
442 tout=photonInRadiator.Theta();
443 pout=photonInRadiator.Phi();
444}//AnglesInDRS
56030c8d 445//__________________________________________________________________________________________________
446
d0831219 447//__________________________________________________________________________________________________
448//__________________________________________________________________________________________________
449/*
450void DrawRing()
451{
452
453 // Float_t xGraph[1000],yGraph[1000];
454
455 Float_t type;
456 Float_t MassOfParticle;
457 Float_t beta;
458 Float_t nfreon;
459
460 Float_t ThetaCerenkov;
461
462 Float_t Xtoentr = GetEntranceX();
463 Float_t Ytoentr = GetEntranceY();
464
465 Float_t pmod = GetTrackMomentum();
466 Float_t TrackTheta = GetTrackTheta();
467 Float_t TrackPhi = GetTrackPhi();
468
469 SetPhotonEnergy(AliRICHParam::MeanCkovEnergy());
470 SetFreonRefractiveIndex();
471
472 SetEmissionPoint(RadiatorWidth/2.);
473
474 ThetaCerenkov = GetThetaCerenkov();
475 FindBetaFromTheta(ThetaCerenkov);
476 nfreon = GetFreonRefractiveIndex();
477
478 Int_t nPoints = 100;
479
480 Int_t nPointsToDraw = 0;
481 for(Int_t i=0;i<nPoints;i++)
482 {
483 Float_t phpad = 2*TMath::Pi()*i/nPoints;
484 SetThetaPhotonInTRS(thetacer);
485 SetPhiPhotonInTRS(phpad);
486 FindPhotonAnglesInDRS();
487 Float_t Radius = FromEmissionToCathode();
488 if (Radius == 999.) continue;
489 xGraph[nPointsToDraw] = GetXPointOnCathode() + GetShiftX();
490 yGraph[nPointsToDraw] = GetYPointOnCathode() + GetShiftY();
491 nPointsToDraw++;
492 }
493 gra = new TGraph(nPointsToDraw,xGraph,yGraph);
494 gra->Draw("AC");
495}
496//__________________________________________________________________________________________________
497*/