]>
Commit | Line | Data |
---|---|---|
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 | // ************************************************************************** | |
db910db9 | 15 | #include "AliRICHParam.h" //class header |
101624cd | 16 | #include "AliESD.h" |
db910db9 | 17 | #include <TCanvas.h> //TestXXX() |
a25b3368 | 18 | #include <TLatex.h> |
19 | #include <THStack.h> | |
20 | #include <TLegend.h> | |
21 | #include <TView.h> | |
22 | #include <TPolyMarker3D.h> | |
23 | #include <TPolyLine3D.h> | |
d3eb6079 | 24 | #include <TPolyLine.h> |
101624cd | 25 | #include <TSystem.h> |
d0831219 | 26 | #include <TVector2.h> |
27 | #include <TVector3.h> | |
28 | #include <TRotation.h> | |
db910db9 | 29 | #include <AliCDBManager.h> //CdbRead() |
30 | #include <AliCDBStorage.h> //CdbRead() | |
31 | #include <AliCDBEntry.h> //CdbRead() | |
32 | #include <AliRunLoader.h> //Stack() | |
33 | #include <AliStack.h> //Stack() | |
34 | #include <TParticle.h> //Stack() | |
35 | #include "AliRICHHelix.h" //TestTrans() | |
db3aa6a3 | 36 | #include <TLine.h> |
37 | ||
38 | ||
56148d0e | 39 | |
ed3ceb24 | 40 | ClassImp(AliRICHParam) |
db910db9 | 41 | AliRICHParam * AliRICHParam::fgInstance =0x0; //singleton pointer |
db910db9 | 42 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
43 | AliRICHParam::AliRICHParam():TNamed("RichParam","default version") | |
e42a7b46 | 44 | { |
db910db9 | 45 | // Here all the intitializition is taken place when AliRICHParam::Instance() is invoked for the first time. |
46 | // In particulare, matrices to be used for LORS<->MARS trasnformations are initialized from TGeo structure. | |
47 | // Note that TGeoManager should be already initialized from geometry.root file | |
48 | for(Int_t iCh=0;iCh<kNchambers;iCh++) fMatrix[iCh]=(TGeoHMatrix*)gGeoManager->GetVolume("ALIC")->GetNode(Form("RICH_%i",iCh+1))->GetMatrix(); | |
49 | CdbRead(0,0); | |
50 | fgInstance=this; | |
51 | }//ctor | |
52 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
a25b3368 | 53 | Float_t AliRICHParam::AbsCH4(Float_t eV) |
54 | { | |
db910db9 | 55 | // Evaluate the absorbtion lenght of CH4 for a photon of energy eV in electron-volts |
a25b3368 | 56 | const Float_t kLoschmidt=2.686763e19; // LOSCHMIDT NUMBER IN CM-3 |
57 | const Float_t kPressure=750.0; //mm of Hg | |
58 | const Float_t kTemperature=283.0; //K (10 grad C) | |
59 | const Float_t kPn=kPressure/760.; | |
60 | const Float_t kTn=kTemperature/273.16; | |
61 | const Float_t kC0=-1.655279e-1; | |
62 | const Float_t kC1= 6.307392e-2; | |
63 | const Float_t kC2=-8.011441e-3; | |
64 | const Float_t kC3= 3.392126e-4; | |
65 | ||
66 | Float_t crossSection=0; | |
67 | if (eV<7.75) | |
68 | crossSection=0.06e-22; | |
69 | else //------ METHANE CROSS SECTION cm-2 ASTROPH. J. 214, L47 (1978) | |
70 | crossSection=(kC0+kC1*eV+kC2*eV*eV+kC3*eV*eV*eV)*1.e-18; | |
71 | ||
72 | Float_t density=kLoschmidt*kPn/kTn; //CH4 molecular concentration (cm^-3) | |
73 | return 1.0/(density*crossSection); | |
74 | }//AbsoCH4() | |
db910db9 | 75 | //__________________________________________________________________________________________________sss |
76 | void AliRICHParam::CdbRead(Int_t run,Int_t version) | |
77 | { | |
78 | // This methode read all the calibration information and initialise corresponding fields for requested run number | |
79 | // Arguments: run - run number for which to retrieve calibration | |
80 | // version- version number | |
81 | // Returns: none | |
82 | ||
83 | AliCDBEntry *pEntry=AliCDBManager::Instance()->Get("RICH/RICHConfig/RefIdxC6F14",run,0,version); //try to get from common local storage | |
84 | if(pEntry){ | |
e4ee08d2 | 85 | fIdxC6F14=(TF2*)pEntry->GetObject(); |
86 | if(!(AliCDBManager::Instance()->GetCacheFlag())) delete pEntry; | |
db910db9 | 87 | }else{ |
88 | AliWarning("No valid calibarion, the hardcoded will be used!"); | |
89 | fIdxC6F14=new TF2("RidxC4F14","sqrt(1+0.554*(1239.84e-9/x)^2/((1239.84e-9/x)^2-5796)-0.0005*(y-20))",5.5e-9,8.5e-9,0,50); //DiMauro mail | |
90 | fIdxC6F14->SetUniqueID(20);//T=20 deg C | |
91 | } | |
92 | }//CdbRead() | |
93 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
94 | void AliRICHParam::Print(Option_t* opt) const | |
95 | { | |
96 | // print some usefull (hopefully) info on some internal guts of RICH parametrisation | |
97 | Printf("Pads in chamber (%3i,%3i) in sector (%2i,%2i) pad size (%4.2f,%4.2f)",NpadsX(),NpadsY(),NpadsXsec(),NpadsYsec(),PadSizeX(),PadSizeY()); | |
db910db9 | 98 | |
99 | for(Int_t i=0;i<kNchambers;i++) fMatrix[i]->Print(opt); | |
100 | }//Print() | |
101 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
a25b3368 | 102 | void AliRICHParam::TestSeg() |
ae754cdf | 103 | { |
db910db9 | 104 | // Provides a set of pictures to test segementation currently in use. |
105 | // Arguments: none | |
106 | // Returns: none | |
db3aa6a3 | 107 | new TCanvas("pads","View from electronics side, IP is behind the picture."); |
108 | gPad->Range(-5,-5,PcSizeX()+5,PcSizeY()+5); | |
d3eb6079 | 109 | // list of corners: |
db3aa6a3 | 110 | DrawSectors(kTRUE); |
d3eb6079 | 111 | TLatex t; |
db3aa6a3 | 112 | t.SetTextSize(0.02); |
113 | t.SetTextColor(kRed) ;t.SetTextAlign(11); t.DrawLatex(0 ,PcSizeY(),Form("Pad size %.2fx%.2fcm dead zone %.2fcm",PadSizeX(),PadSizeY(),DeadZone())); | |
114 | t.SetTextColor(kBlue) ;t.SetTextAlign(21); t.DrawLatex(SecSizeX(),PcSizeY(),Form("Pc size %.2fx%.2fcm %ix%i pads" ,PcSizeX() ,PcSizeY() ,NpadsX() ,NpadsY())); | |
115 | t.SetTextColor(kMagenta);t.SetTextAlign(31); t.DrawLatex(PcSizeX() ,PcSizeY(),Form("Sec size %.2fx%.2fcm %ix%i pads" ,SecSizeX(),SecSizeY(),NpadsXsec() ,NpadsYsec())); | |
116 | ||
117 | ||
118 | // TVector p(2); TVector2 c; TVector2 b; //current: pad, pad center, pad boundary | |
119 | // Double_t x0=0,x1=SecSizeX(),x2=SecSizeX()+DeadZone() ,x3=PcSizeX(); | |
120 | // Double_t y0=0,y1=SecSizeY(),y2=SecSizeY()+DeadZone(),y3=2*SecSizeY()+DeadZone(),y4=PcSizeY()-SecSizeY(),y5=PcSizeY(); | |
d3eb6079 | 121 | t.SetTextSize(0.015); t.SetTextColor(kBlue); |
122 | ||
db3aa6a3 | 123 | // 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())); |
124 | // 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())); | |
125 | // 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())); | |
126 | // 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())); | |
127 | // 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())); | |
128 | // 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())); | |
129 | // | |
130 | // 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())); | |
131 | // 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())); | |
132 | // 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())); | |
133 | // 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())); | |
134 | // 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())); | |
135 | // 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())); | |
136 | // | |
137 | // 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())); | |
138 | // 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())); | |
139 | // 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())); | |
140 | // 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())); | |
141 | // 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())); | |
142 | // 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())); | |
143 | // | |
144 | // 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())); | |
145 | // 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())); | |
146 | // 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())); | |
147 | // 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())); | |
148 | // 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())); | |
149 | // 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())); | |
150 | ||
151 | //Now all chambers view | |
152 | TCanvas *pC=new TCanvas("cc","Chambers view from electronics side - IP is behind the picture"); pC->Divide(3,3); | |
153 | t.SetTextSize(0.05); | |
154 | for(Int_t i=1;i<=7;i++){ | |
155 | if(i==1) pC->cd(9); if(i==2) pC->cd(8); if(i==3) pC->cd(6); if(i==4) pC->cd(5); if(i==5) pC->cd(4); if(i==6) pC->cd(2); if(i==7) pC->cd(1); | |
156 | gPad->Range(-5,-5,PcSizeX()+5,PcSizeY()+10); | |
157 | DrawSectors(kTRUE); | |
158 | t.SetTextColor(kBlack); t.SetTextAlign(21); t.DrawText(SecSizeX(),PcSizeY(),Form("Cham %i",i)); | |
159 | t.SetTextColor(41); t.SetTextAlign(11); t.DrawText(0 ,PcSizeY(),Form("DDL ID %i",1536+2*i-2)); //left half of chamber | |
160 | t.SetTextColor(29); t.SetTextAlign(31); t.DrawText(PcSizeX() ,PcSizeY(),Form("DDL ID %i",1536+2*i-1)); //right half of chamber | |
161 | } | |
a25b3368 | 162 | }//TestSeg() |
163 | //__________________________________________________________________________________________________ | |
164 | void AliRICHParam::TestResp() | |
165 | { | |
db910db9 | 166 | // Provides a set of plot to check the response parametrisation currently in use. |
167 | // Arguments: none | |
168 | // Returns: none | |
a25b3368 | 169 | TCanvas *pC=new TCanvas("c","Amplification test",900,800); |
170 | pC->Divide(1,2); | |
171 | ||
172 | ||
ae754cdf | 173 | const Int_t kNpoints=8; |
a25b3368 | 174 | THStack *pStackPhot=new THStack("StackPhot","photons"); |
175 | THStack *pStackMip =new THStack("StackMip","mips"); | |
176 | TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend"); | |
ae754cdf | 177 | TH1F *apHphot[kNpoints]; |
178 | TH1F *apHmip[kNpoints]; | |
a25b3368 | 179 | |
180 | Double_t starty=0; | |
db910db9 | 181 | Double_t deltay=AliRICHParam::SecSizeY()/kNpoints; |
a25b3368 | 182 | |
ae754cdf | 183 | for(int i=0;i<kNpoints;i++){ |
a25b3368 | 184 | apHphot[i]=new TH1F(Form("hphot%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apHphot[i]->SetLineColor(i);pStackPhot->Add(apHphot[i]); |
185 | apHmip[i] =new TH1F(Form("hmip%i",i),"Qdc for Mip;QDC;Counts",4000,0,4000); apHmip[i]->SetLineColor(i);pStackMip->Add(apHmip[i]); | |
186 | ||
db910db9 | 187 | pLeg->AddEntry(apHphot[i],Form("@(10,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-SecSizeY()/2)); |
a25b3368 | 188 | } |
189 | ||
190 | ||
191 | TVector2 x2(0,0); | |
192 | for(Int_t i=0;i<10000;i++){//events loop | |
ae754cdf | 193 | for(int j=0;j<kNpoints;j++){ |
a25b3368 | 194 | x2.Set(10,starty+j*deltay); |
195 | apHphot[j]->Fill(TotQdc(x2,0)); | |
196 | apHmip[j]->Fill(TotQdc(x2,gRandom->Landau(600,150)*1e-9)); | |
197 | } | |
198 | } | |
199 | ||
200 | pC->cd(1); pStackMip->Draw("nostack"); | |
201 | pC->cd(2); pStackPhot->Draw("nostack"); pLeg->Draw(); | |
202 | }//TestResp() | |
203 | //__________________________________________________________________________________________________ | |
204 | void AliRICHParam::TestTrans() | |
205 | { | |
db910db9 | 206 | // Tests transformation methods |
207 | // Arguments: none | |
208 | // Returns: none | |
a25b3368 | 209 | |
db910db9 | 210 | AliRICHParam *pParam=AliRICHParam::Instance(); |
a25b3368 | 211 | Int_t iNpointsX=50,iNpointsY=50; |
db910db9 | 212 | new TCanvas("trasform","Test LORS-MARS transform"); TLatex t; t.SetTextSize(0.02); |
213 | ||
214 | TView *pView=new TView(1); pView->SetRange(-400,-400,-400,400,400,400); | |
215 | DrawAxis(); | |
216 | for(Int_t iCham=1;iCham<=7;iCham++){//chamber loop | |
217 | AliRICHHelix helix(2.5,Norm(iCham).Theta()*TMath::RadToDeg(),Norm(iCham).Phi()*TMath::RadToDeg()); | |
218 | helix.RichIntersect(AliRICHParam::Instance()); | |
a25b3368 | 219 | TPolyMarker3D *pChamber=new TPolyMarker3D(iNpointsX*iNpointsY); |
220 | Int_t i=0; | |
221 | for(Double_t x=0;x<PcSizeX();x+=PcSizeX()/iNpointsX) | |
222 | for(Double_t y=0;y<PcSizeY();y+=PcSizeY()/iNpointsY){//step loop | |
db910db9 | 223 | TVector3 v3=pParam->Lors2Mars(iCham,x,y,kPc); TVector2 v2=pParam->Mars2Lors(iCham,v3,kPc);//LORS->MARS->LORS |
224 | Double_t dx=v2.X()-x , dy=v2.Y()-y; | |
225 | if(dx>0.000001 || dy>0.000001) Printf("Problem in MARS<->LORS transformations dx=%f dy=%f!!!",dx,dy); | |
226 | pChamber->SetPoint(i++,v3.X(),v3.Y(),v3.Z());//Pc plane point in MARS | |
a25b3368 | 227 | }//step loop |
228 | pChamber->SetMarkerSize(1); | |
db910db9 | 229 | pChamber->SetMarkerColor(iCham); |
a25b3368 | 230 | pChamber->Draw(); |
db910db9 | 231 | helix.Draw(); |
232 | t.SetNDC();t.SetTextColor(iCham); t.DrawText(0.1,iCham*0.1,Form("Chamber %i",iCham)); | |
233 | }//chambers loop | |
a25b3368 | 234 | }//TestTrans() |
235 | //__________________________________________________________________________________________________ | |
236 | void AliRICHParam::DrawAxis() | |
237 | { | |
db910db9 | 238 | // This utility methode draws axis on geometry scene |
239 | // Arguments: none | |
240 | // Returns: none | |
ae754cdf | 241 | 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}; |
242 | TPolyLine3D *pXaxis=new TPolyLine3D(2,x);pXaxis->SetLineColor(kRed); pXaxis->Draw(); | |
243 | TPolyLine3D *pYaxis=new TPolyLine3D(2,y);pYaxis->SetLineColor(kGreen); pYaxis->Draw(); | |
244 | TPolyLine3D *pZaxis=new TPolyLine3D(2,z);pZaxis->SetLineColor(kBlue); pZaxis->Draw(); | |
a25b3368 | 245 | } |
d3eb6079 | 246 | //__________________________________________________________________________________________________ |
db3aa6a3 | 247 | void AliRICHParam::DrawSectors(Bool_t isInfo) |
d3eb6079 | 248 | { |
db910db9 | 249 | // Utility methode draws RICH chamber sectors on event display. |
250 | // Arguments: none | |
251 | // Returns: none | |
252 | Double_t xLeft[5] = {0,0,SecSizeX(),SecSizeX(),0}; | |
253 | Double_t xRight[5] = {SecSizeX()+DeadZone(),SecSizeX()+DeadZone(),PcSizeX(),PcSizeX(),SecSizeX()+DeadZone()}; | |
d3eb6079 | 254 | |
db910db9 | 255 | Double_t yDown[5] = {0,SecSizeY(),SecSizeY(),0,0}; |
256 | Double_t yCenter[5] = { SecSizeY()+DeadZone(),2*SecSizeY()+DeadZone(),2*SecSizeY()+DeadZone(), | |
257 | SecSizeY()+DeadZone(),SecSizeY()+DeadZone()}; | |
258 | Double_t yUp[5] = {2*SecSizeY()+2*DeadZone(),PcSizeY(),PcSizeY(),2*SecSizeY()+2*DeadZone(),2*SecSizeY()+2*DeadZone()}; | |
d3eb6079 | 259 | |
db3aa6a3 | 260 | Int_t iColorLeft=29,iColorRight=41; |
261 | TPolyLine *sec[6]; | |
262 | ||
263 | sec[0]= new TPolyLine(5,xLeft ,yDown); | |
264 | sec[1]= new TPolyLine(5,xRight,yDown); | |
265 | sec[2]= new TPolyLine(5,xLeft ,yCenter); | |
266 | sec[3]= new TPolyLine(5,xRight,yCenter); | |
267 | sec[4]= new TPolyLine(5,xLeft, yUp); | |
268 | sec[5]= new TPolyLine(5,xRight,yUp); | |
269 | ||
270 | for(Int_t iSec=0;iSec<6;iSec++){ | |
271 | if(isInfo){ | |
272 | (iSec%2)? sec[iSec]->SetFillColor(iColorLeft): sec[iSec]->SetFillColor(iColorRight); | |
273 | sec[iSec]->Draw("f"); | |
274 | }else | |
275 | sec[iSec]->Draw(); | |
276 | } | |
277 | ||
278 | if(!isInfo) return; | |
279 | ||
280 | TText t; t.SetTextSize(0.02); | |
281 | t.DrawText(32,20,"Sec 1"); | |
282 | t.DrawText(98,20,"Sec 2"); | |
283 | t.DrawText(32,65,"Sec 3"); | |
284 | t.DrawText(98,65,"Sec 4"); | |
285 | t.DrawText(32,106,"Sec 5"); | |
286 | t.DrawText(98,106,"Sec 6"); | |
287 | ||
288 | Double_t x246=SecSizeX()+DeadZone(); | |
289 | Double_t y34=SecSizeY()+DeadZone(); | |
290 | Double_t y56=2*y34; | |
291 | ||
292 | for(Int_t iRow=1;iRow<=8;iRow++){//dilogic chip serves 8x6 pads | |
293 | Double_t y=(iRow-1)*6*PadSizeY(); | |
294 | TLine *pL1=new TLine(0 ,y ,SecSizeX(),y ); pL1->Draw(); t.SetTextAlign(31); t.DrawText(0 ,y ,Form("r%i",iRow) );//sec1 | |
295 | TLine *pL2=new TLine(x246,y ,PcSizeX() ,y ); pL2->Draw(); t.SetTextAlign(11); t.DrawText(PcSizeX(),y ,Form("r%i",25-iRow));//sec2 | |
296 | ||
297 | TLine *pL3=new TLine(0 ,y+y34,SecSizeX(),y+y34); pL3->Draw(); t.SetTextAlign(31); t.DrawText(0 ,y+y34,Form("r%i",iRow+8) );//sec3 | |
298 | TLine *pL4=new TLine(x246,y+y34,PcSizeX() ,y+y34); pL4->Draw(); t.SetTextAlign(11); t.DrawText(PcSizeX(),y+y34,Form("r%i",17-iRow));//sec4 | |
299 | ||
300 | TLine *pL5=new TLine(0 ,y+y56,SecSizeX(),y+y56); pL5->Draw(); t.SetTextAlign(31); t.DrawText(0 ,y+y56,Form("r%i",iRow+16));//sec5 | |
301 | TLine *pL6=new TLine(x246,y+y56,PcSizeX() ,y+y56); pL6->Draw(); t.SetTextAlign(11); t.DrawText(PcSizeX(),y+y56,Form("r%i",9-iRow) );//sec4 | |
302 | } | |
303 | ||
304 | for(Int_t iDilogic=1;iDilogic<=10;iDilogic++){ | |
305 | Double_t x=(iDilogic-1)*8*PadSizeX(); | |
306 | TLine *pL1=new TLine(x ,0,x ,SecSizeY()); pL1->Draw(); t.DrawText(x ,0,Form("d%i",11-iDilogic)); | |
307 | TLine *pL2=new TLine(x+x246,0,x+x246,SecSizeY()); pL2->Draw(); t.DrawText(x+x246,0,Form("d%i",11-iDilogic)); | |
308 | ||
309 | TLine *pL3=new TLine(x ,y34,x ,y34+SecSizeY()); pL3->Draw(); t.DrawText(x ,y34,Form("d%i",11-iDilogic)); | |
310 | TLine *pL4=new TLine(x+x246,y34,x+x246,y34+SecSizeY()); pL4->Draw(); t.DrawText(x+x246,y34,Form("d%i",11-iDilogic)); | |
311 | ||
312 | TLine *pL5=new TLine(x ,y56,x ,y56+SecSizeY()); pL5->Draw(); t.DrawText(x ,y56,Form("d%i",11-iDilogic)); | |
313 | TLine *pL6=new TLine(x+x246,y56,x+x246,y56+SecSizeY()); pL6->Draw(); t.DrawText(x+x246,y56,Form("d%i",11-iDilogic)); | |
314 | } | |
315 | ||
316 | t.SetTextAlign(13); t.DrawText(0 ,0,"pad1"); t.DrawText(x246 ,0,"pad81"); | |
317 | t.SetTextAlign(33); t.DrawText(SecSizeX(),0,"pad80"); t.DrawText(PcSizeX(),0,"pad160"); | |
d3eb6079 | 318 | }//DrawSectors() |
101624cd | 319 | //__________________________________________________________________________________________________ |
56030c8d | 320 | TVector3 AliRICHParam::ForwardTracing(TVector3 entranceTrackPoint, TVector3 vectorTrack, Double_t thetaC, Double_t phiC) |
d0831219 | 321 | { |
db910db9 | 322 | // Trace a single Ckov photon from a given emission point up to photocathode taking into account ref indexes of materials it travereses |
f770edb5 | 323 | TVector3 vBad(-999,-999,-999); |
d0831219 | 324 | TVector3 nPlane(0,0,1); |
db910db9 | 325 | Double_t planeZposition = 0.5*RadThick(); |
326 | TVector3 planePoint(0,0,0.5*RadThick()); //this is plane parallel to window which contains emission point | |
d0831219 | 327 | TVector3 emissionPoint = PlaneIntersect(vectorTrack,entranceTrackPoint,nPlane,planePoint); |
d0831219 | 328 | Double_t thetaout,phiout; |
329 | AnglesInDRS(vectorTrack.Theta(),vectorTrack.Phi(),thetaC,phiC,thetaout,phiout); | |
d0831219 | 330 | TVector3 vectorPhotonInC6F14; |
331 | vectorPhotonInC6F14.SetMagThetaPhi(1,thetaout,phiout); | |
db910db9 | 332 | planeZposition=RadThick(); |
d0831219 | 333 | planePoint.SetXYZ(0,0,planeZposition); |
334 | TVector3 entranceToSiO2Point = PlaneIntersect(vectorPhotonInC6F14,emissionPoint,nPlane,planePoint); | |
d0831219 | 335 | |
db910db9 | 336 | Double_t photonEn = EckovMean(); |
337 | Double_t angleInSiO2 = SnellAngle(IdxC6F14(EckovMean()),IdxSiO2(EckovMean()),vectorPhotonInC6F14.Theta());if(angleInSiO2<0) return vBad; | |
d0831219 | 338 | TVector3 vectorPhotonInSiO2; |
56030c8d | 339 | vectorPhotonInSiO2.SetMagThetaPhi(1,angleInSiO2,phiout); |
d0831219 | 340 | // planeZposition+=AliRICHParam::SiO2Thickness(); |
db910db9 | 341 | planeZposition+=WinThick(); |
d0831219 | 342 | planePoint.SetXYZ(0,0,planeZposition); |
343 | TVector3 entranceToCH4 = PlaneIntersect(vectorPhotonInSiO2,entranceToSiO2Point,nPlane,planePoint); | |
56030c8d | 344 | // entranceToCH4.Dump(); |
d0831219 | 345 | |
346 | // Double_t angleInCH4 = SnellAngle(AliRICHParam::IndOfRefSiO2(6.755),AliRICHParam::IndOfRefCH4,angleInSiO2); | |
db910db9 | 347 | Double_t angleInCH4 = SnellAngle(IdxSiO2(photonEn),IdxCH4(photonEn),vectorPhotonInSiO2.Theta());if(angleInCH4<0) return vBad; |
d0831219 | 348 | TVector3 vectorPhotonInCH4; |
56030c8d | 349 | vectorPhotonInCH4.SetMagThetaPhi(1,angleInCH4,phiout); |
d0831219 | 350 | // planeZposition+=AliRICHParam::GapProx(); |
351 | planeZposition+=Pc2Win(); | |
352 | planePoint.SetXYZ(0,0,planeZposition); | |
353 | TVector3 impactToPC = PlaneIntersect(vectorPhotonInCH4,entranceToCH4,nPlane,planePoint); | |
56030c8d | 354 | // impactToPC.Dump(); |
355 | return impactToPC; | |
d0831219 | 356 | }//FowardTracing |
357 | //__________________________________________________________________________________________________ | |
db910db9 | 358 | TVector3 AliRICHParam::PlaneIntersect(const TVector3 &lineDir,const TVector3 &linePoint,const TVector3 &planeNorm,const TVector3 &planePoint) |
d0831219 | 359 | { |
db910db9 | 360 | // Finds an intersection point between a line and plane. |
361 | // Arguments: lineDir,linePoint - vector along the line and any point of the line | |
362 | // planeNorm,planePoint - vector normal to the plane and any point of the plane | |
363 | // Returns: point of intersection if any | |
364 | if(planeNorm*lineDir==0) return TVector3(-999,-999,-999); | |
365 | TVector3 diff=planePoint-linePoint; | |
366 | Double_t sint=(planeNorm*diff)/(planeNorm*lineDir); | |
367 | return linePoint+sint*lineDir; | |
d0831219 | 368 | }//PlaneIntersect |
369 | //__________________________________________________________________________________________________ | |
370 | Double_t AliRICHParam::SnellAngle(Float_t n1, Float_t n2, Float_t theta1) | |
371 | { | |
db910db9 | 372 | // Compute the angle of refraction out of Snell law |
373 | // Arguments: n1 - ref idx of first substance | |
374 | // n2 - ref idx of second substance | |
375 | // n1 - photon impact angle in the first substance i.e. angle between the photon direction and vector normal to the surface (radians) | |
376 | // Returns: photon refraction angle, i.e. angle in the second substance (radians) | |
377 | Double_t sinref=(n1/n2)*TMath::Sin(theta1); | |
378 | if(sinref>1.) return -999; | |
379 | else return TMath::ASin(sinref); | |
d0831219 | 380 | }//SnellAngle |
381 | //__________________________________________________________________________________________________ | |
382 | void AliRICHParam::AnglesInDRS(Double_t trackTheta,Double_t trackPhi,Double_t thetaCerenkov,Double_t phiCerenkov,Double_t &tout,Double_t &pout) | |
383 | { | |
384 | // Setup the rotation matrix of the track... | |
385 | ||
386 | TRotation mtheta; | |
387 | TRotation mphi; | |
388 | TRotation minv; | |
389 | TRotation mrot; | |
390 | ||
391 | mtheta.RotateY(trackTheta); | |
392 | mphi.RotateZ(trackPhi); | |
393 | ||
394 | mrot = mphi * mtheta; | |
395 | // minv = mrot.Inverse(); | |
396 | ||
397 | TVector3 photonInRadiator(1,1,1); | |
398 | ||
399 | photonInRadiator.SetTheta(thetaCerenkov); | |
400 | photonInRadiator.SetPhi(phiCerenkov); | |
401 | photonInRadiator = mrot * photonInRadiator; | |
402 | tout=photonInRadiator.Theta(); | |
403 | pout=photonInRadiator.Phi(); | |
404 | }//AnglesInDRS | |
9a221675 | 405 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
db910db9 | 406 | void AliRICHParam::TestHit2SDigs(Double_t x,Double_t y,Double_t e,Bool_t isNew) |
407 | { | |
408 | //Test hit->sdigits procedures | |
409 | //Arguments: isNew - if true use new (abs pad) procedure else use old one (TVector) | |
410 | // Returns: none | |
411 | TClonesArray *pSDigLst=new TClonesArray("AliRICHDigit"); | |
412 | Int_t iQtot=-1; | |
413 | if(isNew){ | |
414 | iQtot=Hit2SDigs(10101,e,pSDigLst); //new technique | |
415 | }else{ | |
416 | iQtot=Hit2SDigs(TVector2(x,y),e,pSDigLst);//old technique | |
417 | } | |
418 | pSDigLst->Print(); | |
419 | Double_t dQsum=0; | |
420 | for(Int_t i=0;i<pSDigLst->GetEntriesFast();i++) | |
421 | dQsum+=((AliRICHDigit*)pSDigLst->At(i))->Qdc(); | |
422 | Printf("Qtot=%i Qsum=%.2f ",iQtot,dQsum); | |
423 | } | |
424 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
425 | Int_t AliRICHParam::Stack(Int_t evt,Int_t tid) | |
426 | { | |
427 | // Prints some usefull info from stack | |
428 | // Arguments: evt - event number. if not -1 print info only for that event | |
429 | // tid - track id. if not -1 then print it and all it's mothers if any | |
430 | // Returns: mother tid of the given tid if any | |
431 | AliRunLoader *pAL=AliRunLoader::Open(); | |
432 | if(pAL->LoadHeader()) return -1; | |
433 | if(pAL->LoadKinematics()) return -1; | |
434 | ||
435 | Int_t mtid=-1; | |
436 | Int_t iNevt=pAL->GetNumberOfEvents(); Printf("This session contains %i event(s)",iNevt); | |
437 | ||
438 | for(Int_t iEvt=0;iEvt<iNevt;iEvt++){//events loop | |
439 | if(evt!=-1 && evt!=iEvt) continue; //in case one needs to print the requested event, ignore all others | |
440 | pAL->GetEvent(iEvt); | |
441 | AliStack *pStack=pAL->Stack(); | |
442 | if(tid==-1){ //print all tids for this event | |
443 | for(Int_t i=0;i<pStack->GetNtrack();i++) pStack->Particle(i)->Print(); | |
444 | Printf("totally %i tracks including %i primaries for event %i out of %i event(s)",pStack->GetNtrack(),pStack->GetNprimary(),iEvt,iNevt); | |
445 | }else{ //print only this tid and it;s mothers | |
446 | if(tid<0 || tid>pStack->GetNtrack()) {Printf("Wrong tid, valid tid range for event %i is 0-%i",iEvt,pStack->GetNtrack());break;} | |
447 | TParticle *pTrack=pStack->Particle(tid); mtid=pTrack->GetFirstMother(); | |
448 | TString str=pTrack->GetName(); | |
449 | while((tid=pTrack->GetFirstMother()) >= 0){ | |
450 | pTrack=pStack->Particle(tid); | |
451 | str+=" from ";str+=pTrack->GetName(); | |
452 | } | |
453 | Printf("%s",str.Data()); | |
454 | }//if(tid==-1) | |
455 | }//events loop | |
456 | pAL->UnloadHeader(); pAL->UnloadKinematics(); | |
457 | return mtid; | |
458 | } | |
459 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
460 | Int_t AliRICHParam::StackCount(Int_t pid,Int_t evt) | |
461 | { | |
462 | // Counts total number of particles of given sort (including secondary) for a given event | |
463 | AliRunLoader *pAL=AliRunLoader::Open(); | |
464 | pAL->GetEvent(evt); | |
465 | if(pAL->LoadHeader()) return 0; | |
466 | if(pAL->LoadKinematics()) return 0; | |
467 | AliStack *pStack=pAL->Stack(); | |
468 | ||
469 | Int_t iCnt=0; | |
470 | for(Int_t i=0;i<pStack->GetNtrack();i++) if(pStack->Particle(i)->GetPdgCode()==pid) iCnt++; | |
471 | ||
472 | pAL->UnloadHeader(); pAL->UnloadKinematics(); | |
473 | return iCnt; | |
474 | } | |
475 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |