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