]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHParam.cxx
4145510e3bafc9986cca032a830e24c635d8d81c
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.cxx
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 //  **************************************************************************
15 #include "AliRICHParam.h"
16 #include "AliRICHChamber.h"
17 #include "AliRICHDisplFast.h"
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>
25
26 ClassImp(AliRICHParam)
27 Bool_t   AliRICHParam::fgIsWireSag            =kTRUE;   //take ware sagita into account?
28 Bool_t   AliRICHParam::fgIsResolveClusters    =kTRUE;   //do cluster resolving?
29 Bool_t   AliRICHParam::fgIsRadioSrc           =kFALSE;  //put radioactive source instead of radiators?
30 Bool_t   AliRICHParam::fgIsAerogel            =kFALSE;  //special aerogel configuration
31 Bool_t   AliRICHParam::fgIsTestBeam           =kFALSE;  //special test beam configuration
32
33 Int_t    AliRICHParam::fgHV[kNsectors]        ={2050,2050,2050,2050,2050,2050};
34 Int_t    AliRICHParam::fgNsigmaTh             =4;
35 Float_t  AliRICHParam::fgSigmaThMean          =1.132; //QDC 
36 Float_t  AliRICHParam::fgSigmaThSpread        =0.035; //     
37
38 //__________________________________________________________________________________________________
39 void AliRICHParam::Print(Option_t*)
40 {
41   AliInfo(Form("Pads in chamber (%3i,%3i) in sector (%2i,%2i)",NpadsX(),NpadsY(),NpadsXsec(),NpadsYsec()));
42   AliInfo(Form("Resolve clusters %i sagita %i Radio source %i Aerogel %i TestBeam %i",
43                 IsResolveClusters(),IsWireSag(),IsRadioSrc(),IsAerogel(),IsTestBeam())); 
44   fpChambers->Print();
45 }//Print()
46 //__________________________________________________________________________________________________
47 void AliRICHParam::CreateChambers()
48 {
49 //Create all RICH Chambers on each call. Previous chambers deleted.
50   if(fpChambers) delete fpChambers;
51   if(fgIsTestBeam){ 
52     fpChambers=new TObjArray(1);//test beam configuration 1 chamber
53     fpChambers->AddAt(new AliRICHChamber(0),0);  
54   }else{ 
55     fpChambers=new TObjArray(kNchambers);//normal configuration 7 chambers
56     for(int iChamberN=0;iChamberN<kNchambers;iChamberN++)  fpChambers->AddAt(new AliRICHChamber(iChamberN+1),iChamberN);  
57   }
58   fpChambers->SetOwner();
59 }//CreateChambers()
60 //__________________________________________________________________________________________________
61 Float_t AliRICHParam::AbsCH4(Float_t eV)
62 {
63 //Evaluate the absorbtion lenght of CH4 for a photon of energy eV in electron-volts
64   const Float_t kLoschmidt=2.686763e19;                                      // LOSCHMIDT NUMBER IN CM-3
65   const Float_t kPressure=750.0;          //mm of Hg
66   const Float_t kTemperature=283.0;       //K (10 grad C)                               
67   const Float_t kPn=kPressure/760.;
68   const Float_t kTn=kTemperature/273.16;
69   const Float_t kC0=-1.655279e-1;
70   const Float_t kC1= 6.307392e-2;
71   const Float_t kC2=-8.011441e-3;
72   const Float_t kC3= 3.392126e-4;
73                 
74   Float_t crossSection=0;                        
75   if (eV<7.75) 
76     crossSection=0.06e-22;
77   else                 //------ METHANE CROSS SECTION cm-2 ASTROPH. J. 214, L47 (1978)                                               
78     crossSection=(kC0+kC1*eV+kC2*eV*eV+kC3*eV*eV*eV)*1.e-18;
79     
80     Float_t density=kLoschmidt*kPn/kTn; //CH4 molecular concentration (cm^-3)
81     return 1.0/(density*crossSection);
82 }//AbsoCH4()
83 //__________________________________________________________________________________________________
84 void AliRICHParam::TestSeg()
85 {
86   
87   new TCanvas("name","PC segmentation");
88   gPad->Range(-20,-20,200,150);
89   AliRICHDisplFast::DrawSectors();
90   
91   TLatex t; t.SetTextSize(0.02);
92   t.DrawText(0,140,"View from interaction point");
93   t.DrawLatex(PcSizeX()+10,120,Form("Pc  %6.2fx%6.2fcm %3ix%3ipads",PcSizeX()    ,PcSizeY(),    NpadsX()   ,NpadsY()));
94   t.DrawLatex(PcSizeX()+10,115,Form("Sec %6.2fx%5.2fcm %3ix%2ipads",SectorSizeX(),SectorSizeY(),NpadsXsec(),NpadsYsec()));
95   t.DrawLatex(PcSizeX()+10,110,Form("Pad %6.2fx%4.2fcm DeadZone %6.2fcm",PadSizeX()   ,PadSizeY(),DeadZone()));
96   
97   TVector2 v2;
98   t.SetTextAlign(12);
99   v2=AliRICHParam::Pad2Loc( 1,24);  t.DrawText(v2.X(),v2.Y(),"sec 1");  
100   v2=AliRICHParam::Pad2Loc(81,24);  t.DrawText(v2.X(),v2.Y(),"sec 2");  
101   v2=AliRICHParam::Pad2Loc( 1,70);  t.DrawText(v2.X(),v2.Y(),"sec 3");  
102   v2=AliRICHParam::Pad2Loc(81,70);  t.DrawText(v2.X(),v2.Y(),"sec 4");  
103   v2=AliRICHParam::Pad2Loc( 1,120); t.DrawText(v2.X(),v2.Y(),"sec 5");  
104   v2=AliRICHParam::Pad2Loc(81,120); t.DrawText(v2.X(),v2.Y(),"sec 6");  
105   
106 //  TGaxis *pAx=new TGaxis(0,0,140,  0,0,140,510,"-="); pAx->SetTitle("x, cm"); pAx->SetTextSize(0.05); pAx->Draw();
107 //  TGaxis *pAy=new TGaxis(0,0,  0,140,0,140,510,"-="); pAy->SetTitle("y, cm"); pAy->SetTextSize(0.05); pAy->Draw();
108    
109   
110   t.SetTextColor(kBlue);  
111
112   Double_t margin=5;
113   Double_t x0=0; Double_t x1=SectorSizeX(); Double_t x2=SectorSizeX()+DeadZone(); Double_t x3=PcSizeX();
114   Double_t y0=0; Double_t y1=SectorSizeY(); Double_t y2=SectorSizeY()+DeadZone(); 
115   Double_t y3=2*SectorSizeY()+DeadZone(); Double_t y4=PcSizeY()-SectorSizeY();
116   Double_t y5=PcSizeY();
117    
118 //write pad numbers along x  
119   t.SetTextAlign(13); t.DrawText(x0,y0,"1");  
120   t.SetTextAlign(33); t.DrawText(x1,y0,"80");
121   t.SetTextAlign(13); t.DrawText(x2,y0,"81");   
122   t.SetTextAlign(33); t.DrawText(x3,y0,"160");
123 //write pad numbers along y    
124   t.SetTextAlign(31); t.DrawText(x0,y0,"1");  
125   t.SetTextAlign(33); t.DrawText(x0,y1,"48"); 
126   t.SetTextAlign(31); t.DrawText(x0,y2,"49");
127   t.SetTextAlign(33); t.DrawText(x0,y3,"96"); 
128   t.SetTextAlign(31); t.DrawText(x0,y4,"97");
129   t.SetTextAlign(33); t.DrawText(x0,y5,"144");        
130   
131    
132 //positions along x   
133   t.SetTextColor(kGreen);
134   t.SetTextAlign(11);t.DrawText(x0,y0-margin,Form("%5.2f",x0));   
135   t.SetTextAlign(31);t.DrawText(x1,y0-margin,Form("%5.2f",x1));   
136   t.SetTextAlign(11);t.DrawText(x2,y0-margin,Form("%5.2f",x2));   
137   t.SetTextAlign(31);t.DrawText(x3,y0-margin,Form("%5.2f",x3));   
138 //positions along y
139   t.SetTextAlign(31);t.DrawText(x0-margin,y0,Form("%5.2f",y0));   
140   t.SetTextAlign(33);t.DrawText(x0-margin,y1,Form("%5.2f",y1));   
141   t.SetTextAlign(31);t.DrawText(x0-margin,y2,Form("%5.2f",y2));   
142   t.SetTextAlign(33);t.DrawText(x0-margin,y3,Form("%5.2f",y3));   
143   t.SetTextAlign(31);t.DrawText(x0-margin,y4,Form("%5.2f",y4));   
144   t.SetTextAlign(33);t.DrawText(x0-margin,y5,Form("%5.2f",y5));   
145 //coners      
146   t.SetTextColor(kRed);
147   t.SetTextSize(0.01);
148   TVector pad(2);
149 //sector 1  
150   v2=Pad2Loc(Loc2Pad(TVector2(x0,y0)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
151   v2=Pad2Loc(Loc2Pad(TVector2(x0,y1)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
152   v2=Pad2Loc(Loc2Pad(TVector2(x1,y1)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
153   v2=Pad2Loc(Loc2Pad(TVector2(x1,y0)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
154 //secr 3
155   v2=Pad2Loc(Loc2Pad(TVector2(x0,y2)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
156   v2=Pad2Loc(Loc2Pad(TVector2(x0,y3)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
157   v2=Pad2Loc(Loc2Pad(TVector2(x1,y3)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
158   v2=Pad2Loc(Loc2Pad(TVector2(x1,y2)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
159 //secr 5   
160   v2=Pad2Loc(Loc2Pad(TVector2(x0,y4)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
161   v2=Pad2Loc(Loc2Pad(TVector2(x0,y5)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
162   v2=Pad2Loc(Loc2Pad(TVector2(x1,y5)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
163   v2=Pad2Loc(Loc2Pad(TVector2(x1,y4)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
164
165   v2=Pad2Loc(Loc2Pad(TVector2(x2,y4)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
166   v2=Pad2Loc(Loc2Pad(TVector2(x2,y5)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
167   v2=Pad2Loc(Loc2Pad(TVector2(x3,y5)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
168   v2=Pad2Loc(Loc2Pad(TVector2(x3,y4)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
169
170   v2=Pad2Loc(Loc2Pad(TVector2(x2,y2)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
171   v2=Pad2Loc(Loc2Pad(TVector2(x2,y3)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
172   v2=Pad2Loc(Loc2Pad(TVector2(x3,y3)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
173   v2=Pad2Loc(Loc2Pad(TVector2(x3,y2)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
174
175   v2=Pad2Loc(Loc2Pad(TVector2(x2,y0)));t.SetTextAlign(11);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
176   v2=Pad2Loc(Loc2Pad(TVector2(x2,y1)));t.SetTextAlign(13);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
177   v2=Pad2Loc(Loc2Pad(TVector2(x3,y1)));t.SetTextAlign(33);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
178   v2=Pad2Loc(Loc2Pad(TVector2(x3,y0)));t.SetTextAlign(31);t.DrawText(v2.X(),v2.Y(),Form("%5.2f,%5.2f",v2.X(),v2.Y()));
179 }//TestSeg()
180 //__________________________________________________________________________________________________
181 void AliRICHParam::TestResp()
182 {
183 //test the response set of methodes  
184   TCanvas *pC=new TCanvas("c","Amplification test",900,800);
185   pC->Divide(1,2);
186   
187   
188   const Int_t nPoints=8;
189   THStack *pStackPhot=new THStack("StackPhot","photons");
190   THStack *pStackMip =new THStack("StackMip","mips");
191   TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend");    
192   TH1F *apHphot[nPoints];
193   TH1F *apHmip[nPoints];
194   
195   Double_t starty=0;
196   Double_t deltay=AliRICHParam::SectorSizeY()/nPoints;
197   
198   for(int i=0;i<nPoints;i++){
199     apHphot[i]=new TH1F(Form("hphot%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apHphot[i]->SetLineColor(i);pStackPhot->Add(apHphot[i]);                 
200     apHmip[i] =new TH1F(Form("hmip%i",i),"Qdc for Mip;QDC;Counts",4000,0,4000);   apHmip[i]->SetLineColor(i);pStackMip->Add(apHmip[i]);                 
201     
202     pLeg->AddEntry(apHphot[i],Form("@(10,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-SectorSizeY()/2));
203   }
204         
205   
206   TVector2 x2(0,0);  
207   for(Int_t i=0;i<10000;i++){//events loop
208     for(int j=0;j<nPoints;j++){
209       x2.Set(10,starty+j*deltay);
210       apHphot[j]->Fill(TotQdc(x2,0));
211       apHmip[j]->Fill(TotQdc(x2,gRandom->Landau(600,150)*1e-9));
212     }
213   }
214   
215   pC->cd(1);  pStackMip->Draw("nostack");
216   pC->cd(2);  pStackPhot->Draw("nostack"); pLeg->Draw();
217 }//TestResp()
218 //__________________________________________________________________________________________________
219 void AliRICHParam::TestTrans()
220 {
221 //test the set of transformation methods
222   new TCanvas("trasform","Test LRS-MRS transform");
223   TLatex t; t.SetTextSize(0.02);
224   
225   TView *pView=new TView(1);
226   pView->SetRange(-600,-600,-600,600,600,600);
227   DrawAxis();  
228 //Draw PC for all chambers by trasfering Pc plane using Pc2Mrs methode  
229   Int_t iNpointsX=50,iNpointsY=50;  
230   for(Int_t iChamberN=1;iChamberN<=7;iChamberN++){//chamber loop
231     TPolyMarker3D *pChamber=new TPolyMarker3D(iNpointsX*iNpointsY);
232     Int_t i=0;
233     for(Double_t x=0;x<PcSizeX();x+=PcSizeX()/iNpointsX)
234       for(Double_t y=0;y<PcSizeY();y+=PcSizeY()/iNpointsY){//step loop
235         TVector3 v3=C(iChamberN)->Pc2Mrs(TVector2(x,y));//from regular grid of local PC points to MRS presentation
236         pChamber->SetPoint(i++,v3.X(),v3.Y(),v3.Z());//Pc plane poing in MRS
237       }//step loop
238     pChamber->SetMarkerSize(1);
239     pChamber->SetMarkerColor(iChamberN);
240     pChamber->Draw();  
241     t.SetNDC();t.SetTextColor(iChamberN); t.DrawText(0.1,iChamberN*0.1,Form("Chamber %i",iChamberN));    
242   }//chamber loop   
243 //  gPad->GetView()->RotateView(94,45);
244 }//TestTrans()
245 //__________________________________________________________________________________________________
246 void AliRICHParam::DrawAxis()
247 {
248   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};  
249   TPolyLine3D *pXaxis=new TPolyLine3D(2,X);pXaxis->SetLineColor(kRed);   pXaxis->Draw();
250   TPolyLine3D *pYaxis=new TPolyLine3D(2,Y);pYaxis->SetLineColor(kGreen); pYaxis->Draw();
251   TPolyLine3D *pZaxis=new TPolyLine3D(2,Z);pZaxis->SetLineColor(kBlue);  pZaxis->Draw();  
252 }