update version number
[u/mrichter/AliRoot.git] / RICH / AliRICH.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// **************************************************************************
4c039060 15
53fd478b 16#include "AliRICH.h"
17#include "AliRICHParam.h"
18#include "AliRICHChamber.h"
56030c8d 19#include "AliRICHHelix.h"
d3eb6079 20//#include <TArrayF.h>
543d5224 21#include <TGeometry.h>
116cbefd 22#include <TBRIK.h>
543d5224 23#include <TTUBE.h>
237c933d 24#include <TFile.h>
116cbefd 25#include <TNode.h>
26#include <TObjArray.h>
3582c1f9 27#include <TParticle.h>
28#include <AliStack.h>
e53ffca5 29#include <AliHeader.h>
30#include <AliGenEventHeader.h>
31#include <AliGenHijingEventHeader.h>
c60862bf 32#include <AliMagF.h>
c60862bf 33#include <AliRun.h>
34#include <AliRunDigitizer.h>
53fd478b 35#include <AliMC.h>
e42a7b46 36#include <AliESD.h>
5d12ce38 37#include <TVirtualMC.h>
e42a7b46 38#include <TH1F.h>
39#include <TH2F.h>
d3eb6079 40#include <TBenchmark.h>
998b831f 41#include <AliLog.h>
d3eb6079 42#include <TNtupleD.h>
43#include <AliTracker.h>
0422a446 44#include <TLatex.h> //Display()
45#include <TCanvas.h> //Display()
46#include <TGraph.h> //Display()
47#include <TStyle.h> //Display()
48#include <TMarker.h> //Display()
ddae0931 49
c60862bf 50ClassImp(AliRICH)
51//__________________________________________________________________________________________________
15d8311d 52// RICH manager class
c60862bf 53//BEGIN_HTML
15d8311d 54/*
55 <img src="gif/alirich.gif">
56*/
c60862bf 57//END_HTML
58//__________________________________________________________________________________________________
0fe8fa07 59AliRICH::AliRICH():AliDetector(),fParam(0), fSdigits(0),fNsdigits(0),fDigs(0),fClus(0)
53fd478b 60{
61//Default ctor should not contain any new operators
543d5224 62//AliDetector ctor deals with Hits and Digits
0fe8fa07 63 for(int i=0;i<kNchambers;i++) fNdigs[i] =0;
64 for(int i=0;i<kNchambers;i++) fNclus[i]=0;
e42a7b46 65// fCounters.ResizeTo(20); fCounters.Zero();
15d8311d 66}//AliRICH::AliRICH()
c021cb15 67//__________________________________________________________________________________________________
fe4da5cc 68AliRICH::AliRICH(const char *name, const char *title)
0fe8fa07 69 :AliDetector(name,title),fParam(new AliRICHParam),fSdigits(0),fNsdigits(0),fDigs(0),fClus(0)
53fd478b 70{
71//Named ctor
998b831f 72 AliDebug(1,"Start.");
543d5224 73//AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them)
0fe8fa07 74 HitsCreate(); gAlice->GetMCApp()->AddHitList(fHits);
e42a7b46 75 fCounters.ResizeTo(20); fCounters.Zero();
998b831f 76 AliDebug(1,"Stop.");
dfb4e77d 77}//AliRICH::AliRICH(const char *name, const char *title)
c021cb15 78//__________________________________________________________________________________________________
fe4da5cc 79AliRICH::~AliRICH()
53fd478b 80{
81//dtor
998b831f 82 AliDebug(1,"Start.");
237c933d 83
0fe8fa07 84 if(fParam) delete fParam;
c60862bf 85
86 if(fHits) delete fHits;
87 if(fSdigits) delete fSdigits;
88 if(fDigits) delete fDigits;
0fe8fa07 89 if(fDigs) {fDigs->Delete(); delete fDigs;}
90 if(fClus) {fClus->Delete(); delete fClus;}
998b831f 91 AliDebug(1,"Stop.");
dfb4e77d 92}//AliRICH::~AliRICH()
c021cb15 93//__________________________________________________________________________________________________
dfb4e77d 94void AliRICH::BuildGeometry()
53fd478b 95{
96//Builds a TNode geometry for event display
998b831f 97 AliInfo("Start.");
237c933d 98
3ea9cb08 99 TNode *node, *subnode, *top;
100 top=gAlice->GetGeometry()->GetNode("alice");
53d98323 101
a25b3368 102 Float_t widx =P()->SectorSizeX();
103 Float_t leny =P()->SectorSizeY();
104 Float_t dz =P()->Zfreon()+P()->Zwin()+P()->Pc2Win();
105 Float_t dead =P()->DeadZone();
998b831f 106
107 new TBRIK("RICH","RICH","void",widx+dead/2,leny+leny/2+dead,dz+0.1); //RICH chamber
108 new TBRIK("RPC" ,"RPC" ,"void",widx/2,leny/2,0.01); //RICH sector
109
a25b3368 110 for(int i=1;i<=P()->Nchambers();i++){
237c933d 111 top->cd();
998b831f 112 node = new TNode(Form("RICH%i",i),Form("RICH%i",i),"RICH",C(i)->Center().X(),C(i)->Center().Y(),C(i)->Center().Z(),C(i)->RotMatrixName());
3ea9cb08 113 node->SetLineColor(kRed);
91975aa2 114 node->cd();
998b831f 115 subnode = new TNode("PHOTO1","PHOTO1","RPC",-widx/2-dead/2,-leny-dead/2,dz,"");
91975aa2 116 subnode->SetLineColor(kGreen);
117 fNodes->Add(subnode);
998b831f 118 subnode = new TNode("PHOTO1","PHOTO1","RPC", widx/2+dead/2,-leny-dead/2,dz,"");
91975aa2 119 subnode->SetLineColor(kGreen);
120 fNodes->Add(subnode);
998b831f 121 subnode = new TNode("PHOTO1","PHOTO1","RPC",-widx/2-dead/2, 0,dz,"");
91975aa2 122 subnode->SetLineColor(kGreen);
123 fNodes->Add(subnode);
998b831f 124 subnode = new TNode("PHOTO1","PHOTO1","RPC", widx/2+dead/2, 0,dz,"");
91975aa2 125 subnode->SetLineColor(kGreen);
126 fNodes->Add(subnode);
998b831f 127 subnode = new TNode("PHOTO1","PHOTO1","RPC",-widx/2-dead/2, leny+dead/2,dz,"");
91975aa2 128 subnode->SetLineColor(kGreen);
129 fNodes->Add(subnode);
998b831f 130 subnode = new TNode("PHOTO1","PHOTO1","RPC", widx/2+dead/2, leny+dead/2,dz,"");
91975aa2 131 subnode->SetLineColor(kGreen);
132 fNodes->Add(subnode);
237c933d 133 fNodes->Add(node);
998b831f 134 }
135
136 AliDebug(1,"Stop.");
dfb4e77d 137}//void AliRICH::BuildGeometry()
a25b3368 138//__________________________________________________________________________________________________
452a64c6 139void AliRICH::CreateMaterials()
140{
e42a7b46 141// Definition of available RICH materials
af3d25a6 142
998b831f 143 Int_t material=0; //tmp material id number
144 Float_t a=0,z=0,den=0,radl=0,absl=0; //tmp material parameters
a25b3368 145
c60862bf 146 Float_t tmaxfd=-10.0, deemax=-0.2, stemax=-0.1,epsil=0.001, stmin=-0.001;
147 Int_t isxfld = gAlice->Field()->Integ();
148 Float_t sxmgmx = gAlice->Field()->Max();
452a64c6 149
a25b3368 150 Float_t aAir[4]={12,14,16,36}; Float_t zAir[4]={6,7,8,18}; Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};//total 0.9999999
998b831f 151 AliMixture(++material, "RichAir",aAir,zAir,den=0.00120479,4,wAir); //1 (Air) 0.01% C 75% N 23% O 1% Ar
152 AliMedium(kAir, "RichAir",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
452a64c6 153
a25b3368 154 AliMixture(++material, "RichAerogel",aAir,zAir,den=P()->DenGel(),4,wAir); //Aerogel represented by Air
155 AliMedium(kGel, "RichAerogel",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
156
157 AliMixture(++material, "RichAerogelReflector",aAir,zAir,den=P()->DenGel(),4,wAir); //Aerogel reflector represented by Air
158 AliMedium(kReflector, "RichAerogelReflector",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
159
998b831f 160 AliMaterial(++material, "RichRohacell", a=12.01,z=6.0, den=0.1, radl=18.8, absl=0); //2 Rohacell 51 C-equiv radl rad cover
161 AliMedium(kRoha, "RichRohacell", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 162
998b831f 163 Float_t aQuartz[2]={28.09,16.0}; Float_t zQuartz[2]={14.00, 8.0}; Float_t wQuartz[2]={1,2};
164 AliMixture(++material, "RichSiO2",aQuartz,zQuartz,den=2.64,-2, wQuartz); //3 Quarz (SiO2) -trasparent rad window
165 AliMedium(kSiO2, "RichSiO2",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 166
a25b3368 167 Float_t aFreon[2]={12,19}; Float_t zFreon[2]={6,9}; Float_t wmatFreon[2]={6,14}; // C12-6 F19-9
998b831f 168 AliMixture(++material, "RichC6F14",aFreon,zFreon,den=1.68,-2,wmatFreon); //4 Freon (C6F14)
169 AliMedium(kC6F14, "RichC6F14",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
170
171 Float_t aMethane[2]={12.01,1}; Float_t zMethane[2]={6,1}; Float_t wMethane[2]={1,4};
172 AliMixture (++material, "RichCH4", aMethane, zMethane, den=7.17e-4,-2, wMethane); //5,9 methane (CH4) normal and for Gap
173 AliMedium(kCH4, "RichCH4" , material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
a25b3368 174 AliMixture (++material, "RichCH4gap", aMethane, zMethane, den=7.17e-4,-2, wMethane); //5,9 methane (CH4) normal and for Gap
175 AliMedium(kGap, "RichCH4gap", material, 1, isxfld, sxmgmx, tmaxfd, 0.1 , -deemax, epsil, -stmin);
998b831f 176
177 AliMaterial(++material, "RichCsI", a=12.01,z=6.0, den=0.1, radl=18.8, absl=0); //6 CsI-radl equivalent
a25b3368 178 AliMedium(kCsI, "RichCsI", material, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 179
a25b3368 180 AliMaterial(++material, "RichGridCu", a=63.54,z=29.0,den=8.96, radl=1.43, absl=0); //7 anode grid (Cu)
181 AliMedium(kGridCu, "RichGridCu", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
182
183 AliMaterial(++material, "RichPcbCu", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //12 Cu
184 AliMedium(kCu, "RichPcbCu", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 185
a25b3368 186 AliMixture (++material, "RichOpSiO2",aQuartz, zQuartz, den=2.64, -2, wQuartz); //8 Quarz (SiO2) - opaque
187 AliMedium(kOpSiO2, "RichOpSiO2",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 188
a25b3368 189 AliMaterial(++material, "RichAl", a=26.98,z=13.0,den=2.699, radl=8.9, absl=0); //10 aluminium sheet (Al)
190 AliMedium(kAl, "RichAl", material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 191
998b831f 192 Float_t aGlass[5]={12.01,28.09,16,10.8,23}; Float_t zGlass[5]={6,14,8,5,11}; Float_t wGlass[5]={0.5,0.105,0.355,0.03,0.01};
a25b3368 193 AliMixture(++material,"RichGlass",aGlass, zGlass, den=1.74, 5, wGlass); //11 Glass 50%-C 10.5%-Si 35.5%-O 3%-B 1%-Na
194 AliMedium(kGlass, "RichGlass", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
b442c7dd 195
196 den=19.3;
197 AliMaterial(++material, "RichW", a=183.84,z=74.0,den, radl=0.35, absl=185.0/den); //13 W - anod wires
a25b3368 198 AliMedium(kW, "RichW", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 199
e42a7b46 200
201 if(P()->IsRadioSrc()){
998b831f 202 AliInfo("Special radioactive source materials");
b442c7dd 203 den=7.87;
204 AliMaterial(++material, "RichSteel", a=55.845,z=26.0,den, radl=1.76, absl=131.9/den); //14 Steel (Fe)
a25b3368 205 AliMedium(kSteel, "RichSteel", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 206
a25b3368 207 AliMaterial(++material, "RichPerpex", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //15 Perpex
208 AliMedium(kPerpex, "RichPerpex", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
e42a7b46 209
a25b3368 210 AliMaterial(++material, "RichSr90", a=87.62,z=38.0,den=2.54, radl=4.24, absl=0); //16 Sr90
211 AliMedium(kSr90, "RichSr90", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
212
213 Float_t aMylar[5]={12.01,1,16}; Float_t zMylar[5]={6,1,8}; Float_t wMylar[5]={5,4,5}; //17 Mylar C5H4O5
214 AliMixture(++material,"RichMylar",aMylar, zMylar, den=1.39, -3, wMylar);
215 AliMedium(kMylar, "RichMylar", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
e42a7b46 216 }
c60862bf 217
998b831f 218//Optical properties:
219#include "Opticals.h"
a25b3368 220 gMC->SetCerenkov((*fIdtmed)[kAir] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //1 Air
221 gMC->SetCerenkov((*fIdtmed)[kRoha] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //2 Honeycomb
222 gMC->SetCerenkov((*fIdtmed)[kSiO2] , kNbins, aPckov, aAbsSiO2 , aQeAll, aIdxSiO2); //3 Quartz SiO2
223 gMC->SetCerenkov((*fIdtmed)[kC6F14] , kNbins, aPckov, aAbsC6F14 , aQeAll, aIdxC6F14); //4 Freon C6F14
224 gMC->SetCerenkov((*fIdtmed)[kCH4] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //5 Methane CH4
225 gMC->SetCerenkov((*fIdtmed)[kCsI] , kNbins, aPckov, aAbsCsI , aQeCsI, aIdxCH4); //6 CsI
226 gMC->SetCerenkov((*fIdtmed)[kGridCu] , kNbins, aPckov, aAbsGrid , aQeAll, aIdxMetal); //7 grid Cu
227 gMC->SetCerenkov((*fIdtmed)[kOpSiO2] , kNbins, aPckov, aAbsOpSiO2 , aQeAll, aIdxMetal); //8 Opaque quartz SiO2
228 gMC->SetCerenkov((*fIdtmed)[kGap] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //9 Special methane gap
229 gMC->SetCerenkov((*fIdtmed)[kAl] , kNbins, aPckov, aAbsGrid , aQeAll, aIdxMetal); //10 Aluminium
230 gMC->SetCerenkov((*fIdtmed)[kGlass] , kNbins, aPckov, aAbsOpSiO2 , aQeAll, aIdxMetal); //11 Glass
231 gMC->SetCerenkov((*fIdtmed)[kGel] , kNbins, aPckov, aAbsGel , aQeAll, aIdxGel); //12 Aerogel
232 gMC->SetCerenkov((*fIdtmed)[kReflector], kNbins, aPckov, aAbsRef , aQeAll, aIdxMetal); //13 Aerogel reflector
c60862bf 233}//void AliRICH::CreateMaterials()
c021cb15 234//__________________________________________________________________________________________________
a25b3368 235Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
452a64c6 236{
237
238 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
239
240 Float_t en[36] = {5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9,6.0,6.1,6.2,
241 6.3,6.4,6.5,6.6,6.7,6.8,6.9,7.0,7.1,7.2,7.3,7.4,7.5,7.6,7.7,
242 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
452a64c6 243 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
244 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
245 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
246 1.72,1.53};
452a64c6 247 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
248 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
249 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
250 1.714,1.498};
251 Float_t xe=ene;
252 Int_t j=Int_t(xe*10)-49;
253 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
254 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
255
256 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
257 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
258
259 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
260 Float_t tanin=sinin/pdoti;
261
262 Float_t c1=cn*cn-ck*ck-sinin*sinin;
263 Float_t c2=4*cn*cn*ck*ck;
264 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
265 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
266
267 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
268 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
269
270
271 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
272 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
273
274 Float_t sigraf=18.;
275 Float_t lamb=1240/ene;
276 Float_t fresn;
277
278 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
279
280 if(pola)
281 {
282 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
283 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
284 }
285 else
286 fresn=0.5*(rp+rs);
287
288 fresn = fresn*rO;
289 return(fresn);
53fd478b 290}//Fresnel()
c021cb15 291//__________________________________________________________________________________________________
dfb4e77d 292void AliRICH::MakeBranch(Option_t* option)
53fd478b 293{
294//Create Tree branches for the RICH.
998b831f 295 AliDebug(1,Form("Start with option= %s.",option));
dfb4e77d 296
297 const Int_t kBufferSize = 4000;
dfb4e77d 298
dfb4e77d 299 const char *cH = strstr(option,"H");
300 const char *cD = strstr(option,"D");
301 const char *cR = strstr(option,"R");
302 const char *cS = strstr(option,"S");
303
c60862bf 304 if(cH&&TreeH()){//H
0fe8fa07 305 HitsCreate(); //branch will be created in AliDetector::MakeBranch
c60862bf 306 }//H
dfb4e77d 307 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
308
c60862bf 309 if(cS&&fLoader->TreeS()){//S
0fe8fa07 310 SDigitsCreate(); MakeBranchInTree(fLoader->TreeS(),"RICH",&fSdigits,kBufferSize,0) ;
c60862bf 311 }//S
dfb4e77d 312
c60862bf 313 if(cD&&fLoader->TreeD()){//D
0fe8fa07 314 DigitsCreate();
e42a7b46 315 for(Int_t i=0;i<kNchambers;i++){
0fe8fa07 316 MakeBranchInTree(fLoader->TreeD(),Form("%s%d",GetName(),i+1),&((*fDigs)[i]),kBufferSize,0);
543d5224 317 }
c60862bf 318 }//D
319
320 if(cR&&fLoader->TreeR()){//R
0fe8fa07 321 ClustersCreate();
e42a7b46 322 for(Int_t i=0;i<kNchambers;i++)
0fe8fa07 323 MakeBranchInTree(fLoader->TreeR(),Form("%sClusters%d",GetName(),i+1), &((*fClus)[i]), kBufferSize, 0);
cb8189e7 324 }//R
998b831f 325 AliDebug(1,"Stop.");
c021cb15 326}//void AliRICH::MakeBranch(Option_t* option)
c60862bf 327//__________________________________________________________________________________________________
dfb4e77d 328void AliRICH::SetTreeAddress()
53fd478b 329{
330//Set branch address for the Hits and Digits Tree.
998b831f 331 AliDebug(1,"Start.");
c60862bf 332
dfb4e77d 333 TBranch *branch;
dfb4e77d 334
c60862bf 335 if(fLoader->TreeH()){//H
998b831f 336 AliDebug(1,"tree H is requested.");
0fe8fa07 337 HitsCreate();//branch map will be in AliDetector::SetTreeAddress
c60862bf 338 }//H
c021cb15 339 AliDetector::SetTreeAddress();//this is after TreeH because we need to guarantee that fHits array is created
340
c60862bf 341 if(fLoader->TreeS()){//S
998b831f 342 AliDebug(1,"tree S is requested.");
0fe8fa07 343 branch=fLoader->TreeS()->GetBranch(GetName()); if(branch){SDigitsCreate(); branch->SetAddress(&fSdigits);}
c60862bf 344 }//S
dfb4e77d 345
c60862bf 346 if(fLoader->TreeD()){//D
998b831f 347 AliDebug(1,"tree D is requested.");
e42a7b46 348 for(int i=0;i<kNchambers;i++){
c60862bf 349 branch=fLoader->TreeD()->GetBranch(Form("%s%d",GetName(),i+1));
0fe8fa07 350 if(branch){DigitsCreate(); branch->SetAddress(&((*fDigs)[i]));}
aed240d4 351 }
c60862bf 352 }//D
dfb4e77d 353
c60862bf 354 if(fLoader->TreeR()){//R
998b831f 355 AliDebug(1,"tree R is requested.");
e42a7b46 356 for(int i=0;i<kNchambers;i++){
c60862bf 357 branch=fLoader->TreeR()->GetBranch(Form("%sClusters%d" ,GetName(),i+1));
0fe8fa07 358 if(branch){ClustersCreate(); branch->SetAddress(&((*fClus)[i]));}
dfb4e77d 359 }
c60862bf 360 }//R
998b831f 361 AliDebug(1,"Stop.");
dfb4e77d 362}//void AliRICH::SetTreeAddress()
c021cb15 363//__________________________________________________________________________________________________
dfb4e77d 364void AliRICH::Print(Option_t *option)const
365{
53fd478b 366//Debug printout
dfb4e77d 367 TObject::Print(option);
e42a7b46 368 P()->Print();
369 fCounters.Print();
dfb4e77d 370}//void AliRICH::Print(Option_t *option)const
c021cb15 371//__________________________________________________________________________________________________
e42a7b46 372void AliRICH::ControlPlots()
373{
d3eb6079 374//Creates a set of QA hists to control the results of simulation. Hists are in file $HOME/RCP.root
a25b3368 375 TH1F *pElecP=0 ,*pMuonP=0 ,*pPionP=0 ,*pKaonP=0 ,*pProtP=0, //stack particles
d3eb6079 376 *pHxD=0,*pHyD=0,*pHxSd=0,*pHySd=0, //diff hit position - digit sdigit position
377 *pNumClusH1=0,
e42a7b46 378 *pQdcH1=0, *pSizeH1=0,
379 *pPureMipQdcH1=0,*pPureMipSizeH1=0,
380 *pPureCerQdcH1=0,*pPureCerSizeH1=0,
381 *pPureFeeQdcH1=0,*pPureFeeSizeH1=0,
382 *pMipQdcH1=0, *pPhotQdcH1=0;
383 TH2F *pMapH2=0,*pPureMipMapH2=0,*pPureCerMapH2=0,*pPureFeeMapH2=0;
d3eb6079 384 TH1F *pelecRadius=0,*pprotRadius=0,*pprotbarRadius=0;
385//load all information
386 GetLoader()->GetRunLoader()->LoadHeader();
387 GetLoader()->GetRunLoader()->LoadKinematics();
388 GetLoader()->LoadHits();
389 Bool_t isSdig=0;//!GetLoader()->LoadSDigits();
390 Bool_t isDig =0;//!GetLoader()->LoadDigits();
e42a7b46 391 Bool_t isClus=!GetLoader()->LoadRecPoints();
392
d3eb6079 393 gBenchmark->Start("ControlPlots");
c021cb15 394
e42a7b46 395 TFile *pFile = new TFile("$(HOME)/RCP.root","RECREATE");
d3eb6079 396
397 pElecP=new TH1F("Pelec","Electrons made hit in RICH;p [GeV]",1000,-30,30);
398 pMuonP=new TH1F("Pmuon","Muons made hit in RICH;p [GeV]",1000,-30,30);
399 pPionP=new TH1F("Ppion","Pions made hit in RICH;p [GeV]",1000,-30,30);
400 pKaonP=new TH1F("Pkaon","Kaon made hit in RICH;p [GeV]",1000,-30,30);
401 pProtP=new TH1F("Pprot","Protons made hit in RICH;p [GeV]",1000,-30,30);
402 pelecRadius=new TH1F("elecRadius","elec",600,0.,600.);
403 pprotRadius=new TH1F("protRadius","elec",600,0.,600.);
404 pprotbarRadius=new TH1F("protbarRadius","elec",600,0.,600.);
405
406 if(isSdig){
407 AliInfo("SDigits available");
408 pHxSd=new TH1F("DiffHitSDigitX","Hit-SDigit diff X all chambers;diff [cm]",300,-10,10);
409 pHySd=new TH1F("DiffHitSDigitY","Hit-SDigit diff Y all chambers;diff [cm]",300,-10,10);
410 }//isSdig
e42a7b46 411
412 if(isDig){
998b831f 413 AliInfo("Digits available");
d3eb6079 414 pHxD=new TH1F("DiffHitDigitX","Hit-Digit diff X all chambers;diff [cm]",300,-10,10);
415 pHyD=new TH1F("DiffHitDigitY","Hit-Digit diff Y all chambers;diff [cm]",300,-10,10);
e42a7b46 416 }//isDig
417
418 if(isClus){
a25b3368 419 AliInfo("Clusters available");
e42a7b46 420 pNumClusH1=new TH1F("NumClusPerEvent","Number of clusters per event;number",50,0,49);
c021cb15 421
a25b3368 422 pQdcH1 =new TH1F("ClusQdc", "Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 423 pSizeH1 =new TH1F("ClusSize", "Cluster size all chambers;size [number of pads in cluster]",100,0,100);
a25b3368 424 pMapH2 =new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY());
e42a7b46 425
a25b3368 426 pMipQdcH1 =new TH1F("QdcMip" ,"MIP Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
427 pPhotQdcH1 =new TH1F("QdcPhot" ,"Cer+Fee Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 428
a25b3368 429 pPureMipQdcH1 =new TH1F("QdcPureMip" ,"MIP only Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 430 pPureMipSizeH1=new TH1F("SizePureMip" ,"MIP only Cluster size all chambers;size [number of pads in cluster]",100,0,100);
a25b3368 431 pPureMipMapH2 =new TH2F("MapPureMip" ,"MIP only Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY());
e42a7b46 432
a25b3368 433 pPureCerQdcH1 =new TH1F("QdcPureCer" ,"Cerenkov only Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 434 pPureCerSizeH1=new TH1F("SizePureCer" ,"Cernekov only Cluster size all chambers;size [number of pads in cluster]",100,0,100);
a25b3368 435 pPureCerMapH2 =new TH2F("MapPureCer" ,"Cerenkov only Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY());
c021cb15 436
a25b3368 437 pPureFeeQdcH1 =new TH1F("QdcPureFee" ,"Feedback only Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 438 pPureFeeSizeH1=new TH1F("SizePureFee" ,"Feedback only Cluster size all chambers;size [number of pads in cluster]",100,0,100);
a25b3368 439 pPureFeeMapH2 =new TH2F("MapPureFee" ,"Feedback only Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY());
d3eb6079 440
e42a7b46 441 }//isClus
d3eb6079 442//end of hists booking
e42a7b46 443 for(Int_t iEvtN=0;iEvtN < GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEvtN++){//events loop
d3eb6079 444 GetLoader()->GetRunLoader()->GetEvent(iEvtN); //get current event
c021cb15 445
a25b3368 446 for(Int_t iPrimN=0;iPrimN < GetLoader()->TreeH()->GetEntries();iPrimN++){//hit tree loop
447 GetLoader()->TreeH()->GetEntry(iPrimN);
d3eb6079 448 for(Int_t j=0;j<Hits()->GetEntries();j++){//hits loop
0fe8fa07 449 AliRICHHit *pHit = (AliRICHHit*)Hits()->At(j);
d3eb6079 450 TParticle *pParticle = GetLoader()->GetRunLoader()->Stack()->Particle(pHit->GetTrack());//get particle produced this hit
0fe8fa07 451 Double_t dRadius = TMath::Sqrt(pParticle->Vx()*pParticle->Vx()+pParticle->Vy()*pParticle->Vy()+pParticle->Vz()*pParticle->Vz());
a25b3368 452 switch(pParticle->GetPdgCode()){
0fe8fa07 453 case kPositron : pElecP->Fill( pParticle->P());pelecRadius->Fill(dRadius); break;
454 case kElectron : pElecP->Fill(-pParticle->P());pelecRadius->Fill(dRadius); break;
a25b3368 455
456 case kMuonPlus : pMuonP->Fill( pParticle->P()); break;
457 case kMuonMinus: pMuonP->Fill(-pParticle->P()); break;
458
459 case kPiPlus : pPionP->Fill( pParticle->P()); break;
460 case kPiMinus : pPionP->Fill(-pParticle->P()); break;
461
462 case kKPlus : pKaonP->Fill( pParticle->P()); break;
463 case kKMinus : pKaonP->Fill(-pParticle->P()); break;
464
0fe8fa07 465 case kProton : pProtP->Fill( pParticle->P()); pprotRadius->Fill(dRadius); break;
466 case kProtonBar: pProtP->Fill(-pParticle->P()); pprotbarRadius->Fill(dRadius); break;
a25b3368 467
468 }//switch PdgCode
469
470 }//hits loop
471 }//hit tree loop
c021cb15 472
d3eb6079 473 if(isSdig){
474 GetLoader()->TreeS()->GetEntry(0);
475 for(Int_t iSdigN=0;iSdigN<SDigits()->GetEntries();iSdigN++){//sdigits loop
0fe8fa07 476 AliRICHDigit *pSdig=(AliRICHDigit*)SDigits()->At(iSdigN); //get current sdigit pointer
477 AliRICHHit *pHit=Hit(pSdig->GetTrack(0)); //get hit of this sdigit (always one)
d3eb6079 478 TVector2 hit2 =C(pHit->C())->Mrs2Pc(pHit->OutX3()); //this hit position in local system
479 TVector2 sdig2=P()->Pad2Loc(pSdig->Pad()); //center of pad for this sdigit
480 pHxSd->Fill(hit2.X()-sdig2.X());
481 pHySd->Fill(hit2.Y()-sdig2.Y());
482 }//sdigits loop
483 }//if(isSdig)
484
e42a7b46 485 if(isDig) GetLoader()->TreeD()->GetEntry(0);
d3eb6079 486 if(isClus) GetLoader()->TreeR()->GetEntry(0);
c021cb15 487
e42a7b46 488 for(Int_t iChamN=1;iChamN<=7;iChamN++){//chambers loop
d3eb6079 489 if(isDig){
490 for(Int_t iDigN=0;iDigN<Digits(iChamN)->GetEntries();iDigN++){//digits loop
0fe8fa07 491 AliRICHDigit *pDig=(AliRICHDigit*)Digits(iChamN)->At(iDigN);
492 AliRICHHit *pHit=Hit(pDig->GetTrack(0)); //get first hit of this digit
d3eb6079 493 TVector2 hitV2=C(iChamN)->Mrs2Pc(pHit->OutX3());
494 TVector2 digV2=P()->Pad2Loc(pDig->Pad()); //center of pad for this digit
495 pHxD->Fill(hitV2.X()-digV2.X()); pHyD->Fill(hitV2.Y()-digV2.Y());
496 }//digits loop
497 }//isDig
e42a7b46 498 if(isClus){
499 Int_t iNclusCham=Clusters(iChamN)->GetEntries(); if(iNclusCham) pNumClusH1->Fill(iNclusCham);//number of clusters per event
500 for(Int_t iClusN=0;iClusN<iNclusCham;iClusN++){//clusters loop
0fe8fa07 501 AliRICHCluster *pClus=(AliRICHCluster*)Clusters(iChamN)->At(iClusN);
e42a7b46 502 pQdcH1 ->Fill(pClus->Q());
503 pSizeH1 ->Fill(pClus->Size());
504 pMapH2 ->Fill(pClus->X(),pClus->Y()); //common
505
506 if(pClus->IsSingleMip()) {pPureMipQdcH1 ->Fill(pClus->Q());
507 pPureMipSizeH1->Fill(pClus->Size());
508 pPureMipMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Mips
509
510 if(pClus->IsSingleCerenkov()){pPureCerQdcH1 ->Fill(pClus->Q());
511 pPureCerSizeH1->Fill(pClus->Size());
512 pPureCerMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Cerenkovs
513
514 if(pClus->IsSingleFeedback()){pPureFeeQdcH1 ->Fill(pClus->Q());
515 pPureFeeSizeH1->Fill(pClus->Size());
516 pPureFeeMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Feedbacks
517
518 if(pClus->IsMip()) {pMipQdcH1 ->Fill(pClus->Q());} //MIP+ other contributions
519 if(!pClus->IsPureMip()) pPhotQdcH1->Fill(pClus->Q()); //not MIP
520 }//clusters loop
521 }//isClus
e42a7b46 522 }//chambers loop
523 Info("ControlPlots","Event %i processed.",iEvtN);
524 }//events loop
d3eb6079 525 GetLoader()->UnloadHits();
526 if(isSdig) GetLoader()->UnloadSDigits();
e42a7b46 527 if(isDig) GetLoader()->UnloadDigits();
528 if(isClus) GetLoader()->UnloadRecPoints();
529
a25b3368 530 GetLoader()->GetRunLoader()->UnloadHeader();
531 GetLoader()->GetRunLoader()->UnloadKinematics();
532
e42a7b46 533 pFile->Write(); delete pFile;
d3eb6079 534
535 gBenchmark->Show("ControlPlots");
e42a7b46 536}//ControlPlots()
537//__________________________________________________________________________________________________
0fe8fa07 538AliRICHHit* AliRICH::Hit(Int_t tid)const
e42a7b46 539{
540//defines which hit provided by given tid for the currently loaded event
a25b3368 541 GetLoader()->LoadHits();
542 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
543 GetLoader()->TreeH()->GetEntry(iPrimN);
544 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){
0fe8fa07 545 AliRICHHit *pHit=(AliRICHHit*)Hits()->At(iHitN);
a25b3368 546 if(tid==pHit->Track()) {GetLoader()->UnloadHits();return pHit;}
e42a7b46 547 }//hits
548 }//prims loop
a25b3368 549 GetLoader()->UnloadHits();
e42a7b46 550 return 0;
551}
552//__________________________________________________________________________________________________
0fe8fa07 553void AliRICH::HitsPrint(Int_t iEvtN)const
e42a7b46 554{
555//Prints a list of RICH hits for a given event. Default is event number 0.
d3eb6079 556 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
998b831f 557 AliInfo(Form("List of RICH hits for event %i",iEvtN));
a25b3368 558 if(GetLoader()->LoadHits()) return;
e42a7b46 559
560 Int_t iTotalHits=0;
a25b3368 561 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
562 GetLoader()->TreeH()->GetEntry(iPrimN);
563 Hits()->Print();
564 iTotalHits+=Hits()->GetEntries();
e42a7b46 565 }
a25b3368 566 GetLoader()->UnloadHits();
998b831f 567 AliInfo(Form("totally %i hits",iTotalHits));
e42a7b46 568}
569//__________________________________________________________________________________________________
0fe8fa07 570void AliRICH::SDigitsPrint(Int_t iEvtN)const
e42a7b46 571{
572//prints a list of RICH sdigits for a given event
d3eb6079 573 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
e42a7b46 574 Info("PrintSDigits","List of RICH sdigits for event %i",iEvtN);
a25b3368 575 if(GetLoader()->LoadSDigits()) return;
e42a7b46 576
a25b3368 577 GetLoader()->TreeS()->GetEntry(0);
578 SDigits()->Print();
579 GetLoader()->UnloadSDigits();
580 Info("PrintSDigits","totally %i sdigits",SDigits()->GetEntries());
e42a7b46 581}
582//__________________________________________________________________________________________________
0fe8fa07 583void AliRICH::DigitsPrint(Int_t iEvtN)const
e42a7b46 584{
585//prints a list of RICH digits for a given event
d3eb6079 586 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
e42a7b46 587 Info("PrintDigits","List of RICH digits for event %i",iEvtN);
a25b3368 588 if(GetLoader()->LoadDigits()) return;
e42a7b46 589
590 Int_t iTotalDigits=0;
a25b3368 591 GetLoader()->TreeD()->GetEntry(0);
e42a7b46 592 for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){
a25b3368 593 Digits(iChamber)->Print();
594 iTotalDigits+=Digits(iChamber)->GetEntries();
e42a7b46 595 }
a25b3368 596 GetLoader()->UnloadDigits();
e42a7b46 597 Info("PrintDigits","totally %i Digits",iTotalDigits);
598}
599//__________________________________________________________________________________________________
e53ffca5 600void AliRICH::OccupancyPrint(Int_t iEvtNreq)const
c23b3bc0 601{
602//prints occupancy for each chamber in a given event
e53ffca5 603 Int_t iEvtNmin,iEvtNmax;
604 if(iEvtNreq==-1){
605 iEvtNmin=0;
606 iEvtNmax=gAlice->GetEventsPerRun();
607 } else {
608 iEvtNmin=iEvtNreq;iEvtNmax=iEvtNreq+1;
609 }
610
611 if(GetLoader()->GetRunLoader()->LoadHeader()) return;
612 if(GetLoader()->GetRunLoader()->LoadKinematics()) return;
613
614// Info("Occupancy","for event %i",iEvtN);
615 if(GetLoader()->LoadHits()) return;
c23b3bc0 616 if(GetLoader()->LoadDigits()) return;
617
618 Int_t totPadsPerChamber = AliRICHParam::NpadsX()*AliRICHParam::NpadsY();
e53ffca5 619
e53ffca5 620
910735ae 621 for(Int_t iEvtN=iEvtNmin;iEvtN<iEvtNmax;iEvtN++){
622 Int_t nDigCh[kNchambers]={0,0,0,0,0,0,0};
623 Int_t iChHits[kNchambers]={0,0,0,0,0,0,0};
624 Int_t nPrim[kNchambers]={0,0,0,0,0,0,0};
625 Int_t nSec[kNchambers]={0,0,0,0,0,0,0};
626 AliInfo(Form("events processed %i",iEvtN));
e53ffca5 627 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
628 AliStack *pStack = GetLoader()->GetRunLoader()->Stack();
629 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
630 GetLoader()->TreeH()->GetEntry(iPrimN);
631 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){
632 AliRICHHit *pHit = (AliRICHHit *)Hits()->At(iHitN);
633 if(pHit->Eloss()>0){
634 iChHits[pHit->C()-1]++;
635 if(pStack->Particle(pHit->GetTrack())->Rho()<0.01) nPrim[pHit->C()-1]++;else nSec[pHit->C()-1]++;
636 }
637 }
638 }
639 GetLoader()->TreeD()->GetEntry(0);
910735ae 640 for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++) {
641 nDigCh[iChamber-1]= Digits(iChamber)->GetEntries();
642 Double_t occupancy = (Double_t)nDigCh[iChamber-1]/(Double_t)totPadsPerChamber;
643 Info("Occupancy","for chamber %i = %4.2f %% and charged prim tracks %i and sec. tracks %i with total %i",
e53ffca5 644 iChamber,occupancy*100.,nPrim[iChamber-1],nSec[iChamber-1],iChHits[iChamber-1]);
910735ae 645 }
646 }
e53ffca5 647 GetLoader()->UnloadHits();
c23b3bc0 648 GetLoader()->UnloadDigits();
e53ffca5 649 GetLoader()->GetRunLoader()->UnloadHeader();
650 GetLoader()->GetRunLoader()->UnloadKinematics();
c23b3bc0 651}
652//__________________________________________________________________________________________________
0fe8fa07 653void AliRICH::ClustersPrint(Int_t iEvtN)const
e42a7b46 654{
655//prints a list of RICH clusters for a given event
d3eb6079 656 AliInfo(Form("List of RICH clusters for event %i",iEvtN));
a25b3368 657 GetLoader()->GetRunLoader()->GetEvent(iEvtN);
658 if(GetLoader()->LoadRecPoints()) return;
e42a7b46 659
660 Int_t iTotalClusters=0;
a25b3368 661 GetLoader()->TreeR()->GetEntry(0);
e42a7b46 662 for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){
a25b3368 663 Clusters(iChamber)->Print();
664 iTotalClusters+=Clusters(iChamber)->GetEntries();
e42a7b46 665 }
a25b3368 666 GetLoader()->UnloadRecPoints();
d3eb6079 667 AliInfo(Form("totally %i clusters for event %i",iTotalClusters,iEvtN));
e42a7b46 668}
669//__________________________________________________________________________________________________
998b831f 670void AliRICH::PrintTracks(Int_t iEvtN)
e42a7b46 671{
a25b3368 672//prints a list of tracks (including secondary) for a given event
673 AliInfo(Form("List of all tracks for event %i",iEvtN));
674 GetLoader()->GetRunLoader()->GetEvent(iEvtN);
675 if(GetLoader()->GetRunLoader()->LoadHeader()) return;
676 if(GetLoader()->GetRunLoader()->LoadKinematics()) return;
677 AliStack *pStack=GetLoader()->GetRunLoader()->Stack();
678
d3eb6079 679 for(Int_t i=0;i<pStack->GetNtrack();i++) pStack->Particle(i)->Print();
a25b3368 680
d3eb6079 681 AliInfo(Form("totally %i tracks including %i primaries for event %i",pStack->GetNtrack(),pStack->GetNprimary(),iEvtN));
a25b3368 682 GetLoader()->GetRunLoader()->UnloadHeader();
683 GetLoader()->GetRunLoader()->UnloadKinematics();
e42a7b46 684}
a25b3368 685//__________________________________________________________________________________________________
d3eb6079 686void AliRICH::GeomPadPanelFrame()const
a25b3368 687{
688//Pad Panel frame 6 sectors
689 Double_t cm=1,mm=0.1*cm;//default is cm
690 Float_t par[3];
691
692 par[0]=648*mm/2;par[1]= 411*mm/2;par[2]=40 *mm/2;gMC->Gsvolu("RPPF","BOX ",(*fIdtmed)[kAl] ,par,3);//PPF 2001P2 inner size of the slab by 1mm more
693 par[0]=181*mm/2;par[1]=89.25*mm/2;par[2]=38.3*mm/2;gMC->Gsvolu("PPFL","BOX ",(*fIdtmed)[kAir] ,par,3);//large whole
694 par[0]=114*mm/2;par[1]=89.25*mm/2;par[2]=38.3*mm/2;gMC->Gsvolu("PPFS","BOX ",(*fIdtmed)[kAir] ,par,3);//small whole
695 par[0]=644*mm/2;par[1]= 407*mm/2;par[2]= 1.7*mm/2;gMC->Gsvolu("RPC ","BOX ",(*fIdtmed)[kCsI] ,par,3);//by 0.2 mm more then actual size (PCB 2006P1)
696
697 gMC->Gspos("RPPF",1,"RICH", -335*mm, -433*mm, 8*cm+20*mm, 0,"ONLY");//F1 2040P1 z p.84 TDR
698 gMC->Gspos("RPPF",2,"RICH", +335*mm, -433*mm, 8*cm+20*mm, 0,"ONLY");
699 gMC->Gspos("RPPF",3,"RICH", -335*mm, 0*mm, 8*cm+20*mm, 0,"ONLY");
700 gMC->Gspos("RPPF",4,"RICH", +335*mm, 0*mm, 8*cm+20*mm, 0,"ONLY");
701 gMC->Gspos("RPPF",5,"RICH", -335*mm, +433*mm, 8*cm+20*mm, 0,"ONLY");
702 gMC->Gspos("RPPF",6,"RICH", +335*mm, +433*mm, 8*cm+20*mm, 0,"ONLY");
703 gMC->Gspos("RPC ",1,"RPPF", 0*mm, 0*mm, -19.15*mm, 0,"ONLY");//PPF 2001P2
704 gMC->Gspos("PPFL",1,"RPPF", -224.5*mm, -151.875*mm, 0.85*mm, 0,"ONLY");
705 gMC->Gspos("PPFL",2,"RPPF", -224.5*mm, - 50.625*mm, 0.85*mm, 0,"ONLY");
706 gMC->Gspos("PPFL",3,"RPPF", -224.5*mm, + 50.625*mm, 0.85*mm, 0,"ONLY");
707 gMC->Gspos("PPFL",4,"RPPF", -224.5*mm, +151.875*mm, 0.85*mm, 0,"ONLY");
708 gMC->Gspos("PPFS",1,"RPPF", - 65.0*mm, -151.875*mm, 0.85*mm, 0,"ONLY");
709 gMC->Gspos("PPFS",2,"RPPF", - 65.0*mm, - 50.625*mm, 0.85*mm, 0,"ONLY");
710 gMC->Gspos("PPFS",3,"RPPF", - 65.0*mm, + 50.625*mm, 0.85*mm, 0,"ONLY");
711 gMC->Gspos("PPFS",4,"RPPF", - 65.0*mm, +151.875*mm, 0.85*mm, 0,"ONLY");
712 gMC->Gspos("PPFS",5,"RPPF", + 65.0*mm, -151.875*mm, 0.85*mm, 0,"ONLY");
713 gMC->Gspos("PPFS",6,"RPPF", + 65.0*mm, - 50.625*mm, 0.85*mm, 0,"ONLY");
714 gMC->Gspos("PPFS",7,"RPPF", + 65.0*mm, + 50.625*mm, 0.85*mm, 0,"ONLY");
715 gMC->Gspos("PPFS",8,"RPPF", + 65.0*mm, +151.875*mm, 0.85*mm, 0,"ONLY");
716 gMC->Gspos("PPFL",5,"RPPF", +224.5*mm, -151.875*mm, 0.85*mm, 0,"ONLY");
717 gMC->Gspos("PPFL",6,"RPPF", +224.5*mm, - 50.625*mm, 0.85*mm, 0,"ONLY");
718 gMC->Gspos("PPFL",7,"RPPF", +224.5*mm, + 50.625*mm, 0.85*mm, 0,"ONLY");
719 gMC->Gspos("PPFL",8,"RPPF", +224.5*mm, +151.875*mm, 0.85*mm, 0,"ONLY");
720}//GeomPadPanelFrame()
721//__________________________________________________________________________________________________
d3eb6079 722void AliRICH::GeomAmpGap()const
a25b3368 723{
724//Gap - anod wires 6 copies to RICH
725 Double_t cm=1,mm=0.1*cm,mkm=0.001*mm;//default is cm
726 Int_t matrixIdReturn=0; //matrix id returned by AliMatrix
727 Float_t par[3];
b442c7dd 728
729
730 par[0]=648*mm/2;par[1]= 411*mm/2 ;par[2]=4.45*mm/2;gMC->Gsvolu("RGAP","BOX ",(*fIdtmed)[kCH4] ,par,3);//xy as PPF 2001P2 z WP 2099P1
a25b3368 731 par[0]= 0*mm ;par[1]= 20*mkm/2 ;par[2]= 648*mm/2;gMC->Gsvolu("RANO","TUBE",(*fIdtmed)[kW] ,par,3);//WP 2099P1 z = gap x PPF 2001P2
732 AliMatrix(matrixIdReturn,180,0, 90,90, 90,0); //wires along x
733
734 gMC->Gspos("RGAP",1,"RICH", -335*mm, -433*mm,8*cm-2.225*mm, 0,"ONLY"); //F1 2040P1 z WP 2099P1
735 gMC->Gspos("RGAP",2,"RICH", +335*mm, -433*mm,8*cm-2.225*mm, 0,"ONLY");
736 gMC->Gspos("RGAP",3,"RICH", -335*mm, 0*mm,8*cm-2.225*mm, 0,"ONLY");
737 gMC->Gspos("RGAP",4,"RICH", +335*mm, 0*mm,8*cm-2.225*mm, 0,"ONLY");
738 gMC->Gspos("RGAP",5,"RICH", -335*mm, +433*mm,8*cm-2.225*mm, 0,"ONLY");
739 gMC->Gspos("RGAP",6,"RICH", +335*mm, +433*mm,8*cm-2.225*mm, 0,"ONLY");
740 for(int i=1;i<=96;i++)
741 gMC->Gspos("RANO",i,"RGAP", 0*mm, -411/2*mm+i*4*mm, 0.185*mm, matrixIdReturn,"ONLY"); //WP 2099P1
742}//GeomAmpGap()
743//__________________________________________________________________________________________________
d3eb6079 744void AliRICH::GeomRadiators()const
a25b3368 745{
746//Defines radiators geometry
747 Double_t mm=0.1;//default is cm
748 Float_t par[3];
749 par[0]=1330*mm/2 ;par[1]= 413*mm/2 ;par[2]= 24*mm/2; gMC->Gsvolu("RRAD","BOX ",(*fIdtmed)[kC6F14] ,par,3); // Rad 2011P1
750 par[0]=1330*mm/2 ;par[1]= 413*mm/2 ;par[2]= 4*mm/2; gMC->Gsvolu("RRFR","BOX ",(*fIdtmed)[kRoha] ,par,3); //front
751 par[0]=1330*mm/2 ;par[1]= 413*mm/2 ;par[2]= 5*mm/2; gMC->Gsvolu("RRWI","BOX ",(*fIdtmed)[kSiO2] ,par,3); //window
752 par[0]=1330*mm/2 ;par[1]= 5*mm/2 ;par[2]= 15*mm/2; gMC->Gsvolu("RRLO","BOX ",(*fIdtmed)[kRoha] ,par,3); //long side
753 par[0]= 10*mm/2 ;par[1]= 403*mm/2 ;par[2]= 15*mm/2; gMC->Gsvolu("RRSH","BOX ",(*fIdtmed)[kRoha] ,par,3); //short side
754 par[0]= 0 ;par[1]= 10*mm/2 ;par[2]= 15*mm/2; gMC->Gsvolu("RRSP","TUBE",(*fIdtmed)[kSiO2] ,par,3); //spacer
755
756 gMC->Gspos("RRAD",1,"RICH", 0*mm,-434*mm, -12*mm, 0,"ONLY"); //3 radiators to RICH
757 gMC->Gspos("RRAD",2,"RICH", 0*mm, 0*mm, -12*mm, 0,"ONLY");
758 gMC->Gspos("RRAD",3,"RICH", 0*mm,+434*mm, -12*mm, 0,"ONLY");
759 gMC->Gspos("RRFR",1,"RRAD", 0*mm, 0*mm, -10.0*mm, 0,"ONLY"); //front cover
760 gMC->Gspos("RRWI",1,"RRAD", 0*mm, 0*mm, 9.5*mm, 0,"ONLY"); //quartz window (back cover)
761 gMC->Gspos("RRLO",1,"RRAD", 0*mm,-204*mm, -0.5*mm, 0,"ONLY"); //long side
762 gMC->Gspos("RRLO",2,"RRAD", 0*mm,+204*mm, -0.5*mm, 0,"ONLY"); //long side
763 gMC->Gspos("RRSH",1,"RRAD",-660*mm, 0*mm, -0.5*mm, 0,"ONLY"); //short side
764 gMC->Gspos("RRSH",2,"RRAD",+660*mm, 0*mm, -0.5*mm, 0,"ONLY"); //short side
765 for(int i=0;i<3;i++)
766 for(int j=0;j<10;j++)
767 gMC->Gspos("RRSP",10*i+j,"RRAD",-1330*mm/2+116*mm+j*122*mm,(i-1)*105*mm,-0.5*mm,0,"ONLY");//spacers
768}//GeomRadiators()
769//__________________________________________________________________________________________________
d3eb6079 770void AliRICH::GeomSandBox()const
a25b3368 771{
772//Defines SandBox geometry
773 Double_t mm=0.1;//default is cm
774 Float_t par[3];
775 par[0]=1419*mm/2 ;par[1]=1378*mm/2;par[2]=50.5*mm/2; gMC->Gsvolu("RSNB","BOX ",(*fIdtmed)[kAir] ,par,3); //2072P1
776 par[0]=1419*mm/2 ;par[1]=1378*mm/2;par[2]= 0.5*mm/2; gMC->Gsvolu("RSCO","BOX ",(*fIdtmed)[kAl] ,par,3); //cover
777 par[0]=1359*mm/2 ;par[1]=1318*mm/2;par[2]=49.5*mm/2; gMC->Gsvolu("RSHO","BOX ",(*fIdtmed)[kRoha] ,par,3); //honeycomb structure
778
779 gMC->Gspos("RSNB",1,"RICH", 0*mm, 0*mm, -73.75*mm, 0,"ONLY"); //p.84 TDR sandbox to rich
780 gMC->Gspos("RSHO",1,"RSNB", 0*mm, 0*mm, 0*mm, 0,"ONLY"); //2072P1 honeycomv to sandbox
781 gMC->Gspos("RSCO",1,"RSNB", 0*mm, 0*mm, +25*mm, 0,"ONLY"); //cover to sandbox
782 gMC->Gspos("RSCO",2,"RSNB", 0*mm, 0*mm, -25*mm, 0,"ONLY"); //cover to sandbox
783}//GeomSandBox()
784//__________________________________________________________________________________________________
d3eb6079 785void AliRICH::GeomRadioSrc()const
a25b3368 786{
787// Defines geometry for radioactive source
788 Double_t cm=1,mm=0.1*cm,mkm=0.001*cm;
789 Float_t par[3];
790
791 par[0]=0 ;par[1]= 70*mm/2 ;par[2]= 30*mm/2; gMC->Gsvolu("RSRC","TUBE",(*fIdtmed)[kCH4] ,par,3); //top src container
792 par[0]=0 ;par[1]= 38*mm/2 ;par[2]= 21.8*mm/2; gMC->Gsvolu("RSAG","TUBE",(*fIdtmed)[kAl] ,par,3); //Al glass
793 par[0]=0 ;par[1]= 34*mm/2 ;par[2]= 20*mm/2; gMC->Gsvolu("RSPP","TUBE",(*fIdtmed)[kPerpex] ,par,3); //perpex plug
794 par[0]=0 ;par[1]= 5*mm/2 ;par[2]= 15*mm/2; gMC->Gsvolu("RSSC","TUBE",(*fIdtmed)[kSteel] ,par,3); //steel screw in center of perpex
795 par[0]=0 ;par[1]= 2*mm/2 ;par[2]= 10*mm/2; gMC->Gsvolu("RSSS","TUBE",(*fIdtmed)[kSteel] ,par,3); //Steel screw to support Sr90
796 par[0]=0 ;par[1]= 1*mm/2 ;par[2]= 1*mm/2; gMC->Gsvolu("RSSR","TUBE",(*fIdtmed)[kSr90] ,par,3); //Sr90 source
797 par[0]=0 ;par[1]= 4*mm/2 ;par[2]= 10*mm/2; gMC->Gsvolu("RSWP","TUBE",(*fIdtmed)[kAir] ,par,3); //Air hole in perpex plug
798 par[0]=0 ;par[1]= 5*mm/2 ;par[2]= 1.8*mm/2; gMC->Gsvolu("RSWA","TUBE",(*fIdtmed)[kAir] ,par,3); //Air hole in Al glass bottom
799 par[0]=0 ;par[1]= 30*mm/2 ;par[2]= 50*mkm/2; gMC->Gsvolu("RSMF","TUBE",(*fIdtmed)[kMylar] ,par,3); //Mylar foil
800
801 gMC->Gspos("RSRC",1,"RICH", 30*cm, 0, 1*cm, 0,"ONLY"); //source to RICH
802 gMC->Gspos("RSMF",1,"RSRC", 0, 0,21.8*mm/2+50*mkm/2, 0,"ONLY");//mylar foil to top src volume
803 gMC->Gspos("RSAG",1,"RSRC", 0, 0, 0, 0,"ONLY");//Al glass to fake Src volume
804 gMC->Gspos("RSWA",1,"RSAG", 6*mm, 0, -10*mm, 0,"ONLY");//air whole in al glass bottom
805 gMC->Gspos("RSPP",1,"RSAG", 0, 0, 0.9*mm, 0,"ONLY");//perpex plug to Al glass
806 gMC->Gspos("RSWP",1,"RSPP", 6*mm, 0, -5*mm, 0,"ONLY");//air whole in perpex plug
807 gMC->Gspos("RSSC",1,"RSPP", 0, 0, 2.5*mm, 0,"ONLY");//steel screw in center of perpex plug
808 gMC->Gspos("RSSS",1,"RSPP", 6*mm, 0, 5*mm, 0,"ONLY");//steel screw to support Sr90 in perpex plug
809 gMC->Gspos("RSSR",1,"RSSS", 0, 0, -4.5*mm, 0,"ONLY");//Sr90 in support steel screw
810}//GeomSr90()
811//__________________________________________________________________________________________________
d3eb6079 812void AliRICH::GeomAerogel()const
a25b3368 813{
814//Creates detailed geometry for aerogel study.
815 AliDebug(1,"Start.");
816 Double_t cm=1;
817 Float_t par[3]; //tmp array for volume dimentions
818
819 par[0]=10.1*cm/2;par[1]=10.1*cm/2;par[2]=10.1*cm/2;
820 gMC->Gsvolu("RREF","BOX ",(*fIdtmed)[kReflector],par,3);//reflector box
821 gMC->Gspos("RREF",1,"RICH",0,0,0,0, "ONLY"); //put it to RICH volume
822
823 par[0]=10*cm/2;par[1]=10*cm/2;par[2]=10*cm/2;
824 gMC->Gsvolu("RGEL","BOX ",(*fIdtmed)[kGel],par,3);//10x10x10 cm^3 cubic of aerogel
825 gMC->Gspos("RGEL",1,"RREF",0,0,0,0,"ONLY");//put gel cell to reflector
826 AliDebug(1,"Stop.");
827}//GeomAerogel()
828//__________________________________________________________________________________________________
829void AliRICH::CreateGeometry()
830{
831//Creates detailed geometry simulation (currently GEANT volumes tree)
832 AliDebug(1,"Start main.");
833 Double_t mm=0.1;//default is cm
834 Float_t par[3];
835 Int_t matrixIdReturn=0; //matrix id returned by AliMatrix
836
837//place chambers into mother volume ALIC
838 par[0]=(6*mm+1681*mm+6*mm)/2;par[1]=(6*mm+1466*mm+6*mm)/2;par[2]=(80*mm+40*mm)*2/2;
839 gMC->Gsvolu("RICH","BOX ",(*fIdtmed)[kCH4],par,3);//2033P1 z p84 TDR
840 for(int i=1;i<=P()->Nchambers();i++){ //test configuration with single chamber is taken into account automaticaly in AliRICHParam
841 AliMatrix(matrixIdReturn,
842 C(i)->ThetaXd(),C(i)->PhiXd(),
843 C(i)->ThetaYd(),C(i)->PhiYd(),
844 C(i)->ThetaZd(),C(i)->PhiZd());
845 gMC->Gspos("RICH",i,"ALIC",C(i)->Center().X(),
846 C(i)->Center().Y(),
847 C(i)->Center().Z(),matrixIdReturn, "ONLY");
848 }
849
850 if(P()->IsAerogel())
851 GeomAerogel();
852 else{
853 GeomPadPanelFrame();
854 GeomAmpGap();
855 if(P()->IsRadioSrc()) GeomRadioSrc(); else GeomRadiators();
856 GeomSandBox();
857 }
858 AliDebug(1,"Stop main.");
859}//CreateGeometry()
860//__________________________________________________________________________________________________
0fe8fa07 861void AliRICH::DisplayEvent(Int_t iEvtNmin,Int_t iEvtNmax)const
862{
863 TH2F *pDigitsH2[8];
864
865 Bool_t isDigits =!GetLoader()->LoadDigits();
866 if(!isDigits){Error("ShoEvent","No digits. Nothing to display.");return;}
867
f770edb5 868 TCanvas *canvas = new TCanvas("RICHDisplay","RICH Display",0,0,1226,900);
869 gStyle->SetPalette(1);
0fe8fa07 870
871
872 for(Int_t iChamber=1;iChamber<=7;iChamber++) {
873 pDigitsH2[iChamber] = new TH2F(Form("pDigitsH2_%i",iChamber),Form("Chamber %i",iChamber),165,0,P()->PcSizeX(),144,0,P()->PcSizeY());
874 pDigitsH2[iChamber]->SetMarkerColor(kGreen);
875 pDigitsH2[iChamber]->SetMarkerStyle(29);
876 pDigitsH2[iChamber]->SetMarkerSize(0.4);
877 pDigitsH2[iChamber]->SetStats(kFALSE);
f770edb5 878 pDigitsH2[iChamber]->SetMaximum(300);
0fe8fa07 879 }
880
f770edb5 881 if(iEvtNmax>gAlice->GetEventsPerRun()||iEvtNmax==0) iEvtNmax=gAlice->GetEventsPerRun()-1;
0fe8fa07 882
d0831219 883 TLatex t; t.SetTextSize(0.1);
0fe8fa07 884 for(Int_t iEventN=iEvtNmin;iEventN<=iEvtNmax;iEventN++) {//events loop
f770edb5 885 canvas->Divide(3,3);
0fe8fa07 886 canvas->cd(1);
887 t.DrawText(0.2,0.4,Form("Event Number %i",iEventN));
888
889 GetLoader()->GetRunLoader()->GetEvent(iEventN); //get event
890 GetLoader()->TreeD()->GetEntry(0); //get list of digits
891 for(Int_t iChamber=1;iChamber<=7;iChamber++) {//chambers loop
892 pDigitsH2[iChamber]->Reset();
893 for(Int_t j=0;j<Digits(iChamber)->GetEntries();j++) {//digits loop
894 AliRICHDigit *pDig = (AliRICHDigit*)Digits(iChamber)->At(j);
895 TVector2 x2=AliRICHParam::Pad2Loc(pDig->Pad());
0422a446 896 pDigitsH2[iChamber]->Fill(x2.X(),x2.Y(),pDig->Qdc());
0fe8fa07 897 }//digits loop
898 if(iChamber==1) canvas->cd(7);
899 if(iChamber==2) canvas->cd(8);
900 if(iChamber==3) canvas->cd(4);
901 if(iChamber==4) canvas->cd(5);
902 if(iChamber==5) canvas->cd(6);
903 if(iChamber==6) canvas->cd(2);
904 if(iChamber==7) canvas->cd(3);
f770edb5 905 pDigitsH2[iChamber]->Draw("col");
906 ReadESD(iEventN,iChamber);
907 AliRICHParam::DrawSectors();
0fe8fa07 908 }//chambers loop
909 canvas->Update();
910 canvas->Modified();
f770edb5 911
912 if(iEventN<iEvtNmax) {gPad->WaitPrimitive();canvas->Clear();}
0fe8fa07 913 }//events loop
914}//ShowEvent()
915//__________________________________________________________________________________________________
916void AliRICH::Display()const
917{
918//Provides fast event display
919//For RICH only, full display is .x Display.C
920 Bool_t isHits =!GetLoader()->LoadHits();
921 Bool_t isDigits =!GetLoader()->LoadDigits();
922 Bool_t isClusters=!GetLoader()->LoadRecPoints();
923
924 if(!isHits && !isDigits && !isClusters){Error("Exec","No hits digits and clusters. Nothing to display.");return;}
925
926 TCanvas *pCanvas = new TCanvas("Display","RICH Display",0,0,600,600);
927
928 TH2F *pHitsH2=0,*pDigitsH2=0,*pClustersH2=0;
929
930 if(isHits) pHitsH2 = new TH2F("pHitsH2" , "Event Display;x,cm;y,cm",165,0,AliRICHParam::PcSizeX(),
931 144,0,AliRICHParam::PcSizeY());
932 if(pHitsH2) pHitsH2->SetStats(kFALSE);
933
934 if(isDigits) pDigitsH2 = new TH2F("pDigitsH2" ,"Event Display",165,0,AliRICHParam::PcSizeX(),
935 144,0,AliRICHParam::PcSizeY());
936 if(isClusters) pClustersH2 = new TH2F("pClustersH2","Event Display",165,0,AliRICHParam::PcSizeX(),
937 144,0,AliRICHParam::PcSizeY());
938
939 for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events Loop
940 GetLoader()->GetRunLoader()->GetEvent(iEventN);
941//display all the staff on chamber by chamber basis
942 for(Int_t iChamber=1;iChamber<=7;iChamber++){//chambers loop
943 if(isHits) pHitsH2 ->Reset();
944 if(isDigits) pDigitsH2 ->Reset();
945 if(isClusters) pClustersH2->Reset();
946//deals with hits
947 for(Int_t i=0;i<GetLoader()->TreeH()->GetEntries();i++){//TreeH loop
948 GetLoader()->TreeH()->GetEntry(i);
949 for(Int_t j=0;j<Hits()->GetEntries();j++){//hits loop
950 AliRICHHit *pHit = (AliRICHHit*)Hits()->At(j);
951 if(pHit->C()==iChamber){
952 TVector3 hitGlobX3= pHit->OutX3();
953 TVector2 hitLocX2 = C(iChamber)->Mrs2Pc(hitGlobX3);
954 pHitsH2->Fill(hitLocX2.X(),hitLocX2.Y(),200);
955 }//if
956 }//hits loop
957 }//TreeH loop
958 pHitsH2->SetTitle(Form("event %i chamber %2i",iEventN,iChamber));
959 pHitsH2->SetMarkerColor(kRed); pHitsH2->SetMarkerStyle(29); pHitsH2->SetMarkerSize(0.4);
f770edb5 960 ReadESD(iEventN,iChamber);
0fe8fa07 961 pHitsH2->Draw();
910735ae 962// ReadESD(iEventN,iChamber);
0fe8fa07 963 AliRICHParam::DrawSectors();
964 TLatex l; l.SetNDC(); l.SetTextSize(0.02);
965 if(!isHits) {l.SetTextColor(kRed) ;l.DrawLatex(0.1,0.01,"No Hits" );}
966 if(!isDigits) {l.SetTextColor(kGreen);l.DrawLatex(0.4,0.01,"No DIGITS" );}
967 if(!isClusters) {l.SetTextColor(kBlue) ;l.DrawLatex(0.8,0.01,"No CLUSTERS");}
968 pCanvas->Update(); pCanvas->Modified(); gPad->WaitPrimitive();
969//deals with digits
970 if(isDigits){
971 GetLoader()->TreeD()->GetEntry(0);
972 for(Int_t j=0;j<Digits(iChamber)->GetEntries();j++){//digits loop
973 AliRICHDigit *pDig = (AliRICHDigit*)Digits(iChamber)->At(j);
974 TVector2 x2=AliRICHParam::Pad2Loc(pDig->Pad());
975 pDigitsH2->Fill(x2.X(),x2.Y(),100);
976 }//digits loop
977 pDigitsH2->SetMarkerColor(kGreen); pDigitsH2->SetMarkerStyle(29); pDigitsH2->SetMarkerSize(0.4);
978 pDigitsH2->Draw("same");
979 pCanvas->Update(); pCanvas->Modified(); gPad->WaitPrimitive();
980 }//if(isDigits)
981//deals with clusters
982 if(isClusters){
983 GetLoader()->TreeR()->GetEntry(0);
984 for(Int_t j=0;j<Clusters(iChamber)->GetEntries();j++){//clusters loop
985 AliRICHCluster *pClus = (AliRICHCluster*)Clusters(iChamber)->At(j);
986 pClustersH2->Fill(pClus->X(),pClus->Y(),50);
987 }//clusters loop
988 pClustersH2->SetMarkerColor(kBlue); pClustersH2->SetMarkerStyle(29); pClustersH2->SetMarkerSize(0.4);
989 pClustersH2->Draw("same");
990 pCanvas->Update(); pCanvas->Modified(); gPad->WaitPrimitive();
991 }//if(isClusters)
992 }//chambers loop
993 }//events Loop
994
995 delete pCanvas;
996 GetLoader()->UnloadHits();
997 if(isDigits) GetLoader()->UnloadDigits();
998 if(isClusters) GetLoader()->UnloadRecPoints();
999}//Display()
1000//__________________________________________________________________________________________________
1001Int_t AliRICH::Nparticles(Int_t iPartID,Int_t iEvtN,AliRunLoader *pRL)
1002{
1003//counts total number of particles of given type (including secondary) for a given event
1004 pRL->GetEvent(iEvtN);
1005 if(pRL->LoadHeader()) return 0;
1006 if(pRL->LoadKinematics()) return 0;
1007 AliStack *pStack=pRL->Stack();
1008
1009 Int_t iCounter=0;
1010 for(Int_t i=0;i<pStack->GetNtrack();i++){
1011 if(pStack->Particle(i)->GetPdgCode()==iPartID) iCounter++;
1012 }
1013
1014 pRL->UnloadHeader();
1015 pRL->UnloadKinematics();
1016 return iCounter;
1017}
56030c8d 1018//__________________________________________________________________________________________________
1019void AliRICH::ReadESD(Int_t iEventN, Int_t iChamber)const
1020{
1021//
f770edb5 1022 AliInfo("Start.");
56030c8d 1023 TFile *pFile=TFile::Open("AliESDs.root","read");
1024 if(!pFile || !pFile->IsOpen()) {AliInfo("ESD file not open.");return;} //open AliESDs.root
1025 TTree *pTree = (TTree*) pFile->Get("esdTree");
1026 if(!pTree){AliInfo("ESD not found.");return;} //get ESD tree
1027
f770edb5 1028 AliInfo("ESD found. Try to draw ring");
56030c8d 1029
1030 AliESD *pESD=new AliESD; pTree->SetBranchAddress("ESD", &pESD);
1031
1032 pTree->GetEvent(iEventN);
1033
1034 Double_t b = pESD->GetMagneticField()/10.;
1035
1036 Int_t iNtracks=pESD->GetNumberOfTracks();
1037
1038 for(Int_t iTrackN=0;iTrackN<iNtracks;iTrackN++){//ESD tracks loop
1039 AliESDtrack *pTrack = pESD->GetTrack(iTrackN);// get next reconstructed track
cc764ba7 1040 Int_t charge = (Int_t)(-TMath::Sign(1.,pTrack->GetSign()*b));
1041 AliRICHHelix helix(pTrack->X3(),pTrack->P3(),charge,b);
1042 Int_t iChamberOnRICH=helix.RichIntersect(P());
1043 if(iChamberOnRICH==iChamber) {
1044//
f770edb5 1045 TMarker *trackImpact = new TMarker(helix.PosPc().X(),helix.PosPc().Y(),kStar);
1046 trackImpact->SetMarkerColor(kRed);
1047 trackImpact->Draw();
cc764ba7 1048//
1049 Int_t iChamberRecon = pTrack->GetRICHcluster()/100000;
1050 if(iChamberRecon==iChamber) {
1051 Double_t thetaCer = pTrack->GetRICHsignal();
1052 if(thetaCer<0) continue;
1053 TVector3 entrance(helix.PosRad().X(),helix.PosRad().Y(),0);
1054 Double_t thetaTrack,phiTrack;
1055 pTrack->GetRICHthetaPhi(thetaTrack,phiTrack);
1056 TVector3 vectorTrack;
1057 vectorTrack.SetMagThetaPhi(pTrack->GetP(),thetaTrack,phiTrack);
1058 AliInfo(Form("Draw ring started for track %i on chamber %i",iTrackN,iChamber));
1059 AliInfo(Form("ThetaCer %f TrackTheta %f TrackPhi %f Momentum %f",thetaCer,thetaTrack,phiTrack,pTrack->GetP()));
1060 Double_t dx,dy;
1061 pTrack->GetRICHdxdy(dx,dy);
1062 AliInfo(Form("dx %f dy %f ",dx,dy));
1063 DrawRing(entrance,vectorTrack,thetaCer);
1064 }
56030c8d 1065 }
1066 }
1067 delete pESD; pFile->Close();//close AliESDs.root
f770edb5 1068 AliInfo("Stop.");
56030c8d 1069}
1070//__________________________________________________________________________________________________
1071void AliRICH::DrawRing(TVector3 entrance,TVector3 vectorTrack,Double_t thetaCer)const
1072{
1073 Double_t xGraph[100],yGraph[100];
1074 Int_t nPointsToDraw = 0;
1075 for(Int_t i=0;i<100;i++) {
1076 Double_t phiCer = 2*TMath::Pi()*i/100;
1077 TVector3 pos = AliRICHParam::ForwardTracing(entrance,vectorTrack,thetaCer,phiCer);
f770edb5 1078 if(pos.X()==-999) continue;
56030c8d 1079 xGraph[nPointsToDraw] = pos.X();yGraph[nPointsToDraw] = pos.Y();nPointsToDraw++;
1080 }
cc764ba7 1081// AliInfo(Form("Npoints per ring %i",nPointsToDraw));
56030c8d 1082 TGraph *gra = new TGraph(nPointsToDraw,xGraph,yGraph);
f770edb5 1083 gra->Draw("C");
56030c8d 1084}
e53ffca5 1085//__________________________________________________________________________________________________
1086void AliRICH::SummaryOfEvent(Int_t iEvtN) const
1087{
1088//prints a summary for a given event
1089 AliInfo(Form("Summary of event %i",iEvtN));
1090 GetLoader()->GetRunLoader()->GetEvent(iEvtN);
1091 if(GetLoader()->GetRunLoader()->LoadHeader()) return;
1092 if(GetLoader()->GetRunLoader()->LoadKinematics()) return;
1093 AliStack *pStack=GetLoader()->GetRunLoader()->Stack();
1094
1095 AliGenEventHeader* pGenHeader = gAlice->GetHeader()->GenEventHeader();
1096 if(pGenHeader->InheritsFrom("AliGenHijingEventHeader")) {
1097 AliInfo(Form(" Hijing event with impact parameter b = %.2f (fm)",((AliGenHijingEventHeader*) pGenHeader)->ImpactParameter()));
1098 }
1099 Int_t nChargedPrimaries=0;
1100 for(Int_t i=0;i<pStack->GetNtrack();i++) {
1101 TParticle *pParticle = pStack->Particle(i);
1102 if(pParticle->IsPrimary()&&pParticle->GetPDG()->Charge()!=0) nChargedPrimaries++;
1103 }
1104 AliInfo(Form("Total number of primaries %i",pStack->GetNprimary()));
1105 AliInfo(Form("Total number of charged primaries %i",nChargedPrimaries));
1106 AliInfo(Form("Total n. of tracks in stack(+sec) %i",pStack->GetNtrack()));
1107 GetLoader()->GetRunLoader()->UnloadHeader();
1108 GetLoader()->GetRunLoader()->UnloadKinematics();
1109}
1110//__________________________________________________________________________________________________
1111void AliRICH::HitsQA(Double_t cut,Double_t cutele,Double_t cutR)
1112{
1113// Provides a set of control plots intended primarily for charged particle flux analisys
1114// Arguments: cut (GeV) - cut on momentum of any charged particles but electrons,
1115// cetele (GeV) - the same for electrons-positrons
1116// cutR (cm) - cut on production vertex radius (cylindrical system)
1117 gBenchmark->Start("HitsAna");
1118
1119 Double_t cutPantiproton =cut;
1120 Double_t cutPkaonminus =cut;
1121 Double_t cutPpionminus =cut;
1122 Double_t cutPmuonminus =cut;
1123 Double_t cutPpositron =cutele;
1124
1125 Double_t cutPelectron =cutele;
1126 Double_t cutPmuonplus =cut;
1127 Double_t cutPpionplus =cut;
1128 Double_t cutPkaonplus =cut;
1129 Double_t cutPproton =cut;
1130
1131
1132 TH2F *pEleHitRZ =new TH2F("EleHitRZ" ,Form("e^{+} e^{-} hit %s;z[cm];R[cm]" ,GetName()) , 400,-300,300 ,400,-500,500); //R-z plot 0cm<R<550cm -300cm<z<300cm
1133 TH2F *pEleHitRP =new TH2F("EleHitRP" ,Form("e^{+} e^{-} hit %s;p[GeV];R[cm]",GetName()) ,1000,-1 ,1 ,400, 0,550); //R-p plot 0cm<R<550cm -1GeV<p<1GeV
1134 TH1F *pEleAllP =new TH1F("EleAllP" , "e^{+} e^{-} all;p[GeV]" ,1000,-1 ,1 );
1135 TH1F *pEleHitP =new TH1F("EleHitP" ,Form("e^{+} e^{-} hit %s;p[GeV]" ,GetName()) ,1000,-1 ,1 );
1136 TH1F *pMuoHitP =new TH1F("MuoHitP" ,Form("#mu^{-} #mu^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 );
1137 TH1F *pPioHitP =new TH1F("PioHitP" ,Form("#pi^{-} #pi^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 );
1138 TH1F *pKaoHitP =new TH1F("KaoHitP" ,Form("K^{-} K^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 );
1139 TH1F *pProHitP =new TH1F("ProHitP" ,Form("p^{-} p^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 );
1140 TH2F *pFlux =new TH2F("flux" ,Form("%s flux with Rvertex<%.1fcm" ,GetName(),cutR),10 ,-5 ,5 , 10,0 ,10); //special text hist
8da90624 1141 TH2F *pVertex =new TH2F("vertex" ,Form("%s 2D vertex of RICH hit;x;y" ,GetName()) ,120 ,0 ,600 ,120,0 ,600); //special text hist
1142 TH1F *pRho =new TH1F("rho" ,Form("%s r of RICH hit" ,GetName()) ,600 ,0 ,600); //special text hist
e53ffca5 1143 pFlux->SetStats(0);
1144 pFlux->GetXaxis()->SetBinLabel(1 ,Form("p^{-}>%.3fGeV/c" ,cutPantiproton));
1145 pFlux->GetXaxis()->SetBinLabel(2 ,Form("K^{-}>%.3fGeV/c" ,cutPkaonminus ));
1146 pFlux->GetXaxis()->SetBinLabel(3 ,Form("#pi^{-}>%.3fGeV/c" ,cutPpionminus ));
1147 pFlux->GetXaxis()->SetBinLabel(4 ,Form("#mu^{-}>%.3fGeV/c" ,cutPmuonminus ));
1148 pFlux->GetXaxis()->SetBinLabel(5 ,Form("e^{+}>%.3fGeV/c" ,cutPpositron ));
1149
1150 pFlux->GetXaxis()->SetBinLabel(6 ,Form("e^{-}>%.3fGeV/c" ,cutPelectron ));
1151 pFlux->GetXaxis()->SetBinLabel(7 ,Form("#mu^{+}>%.3fGeV/c" ,cutPmuonplus ));
1152 pFlux->GetXaxis()->SetBinLabel(8 ,Form("#pi^{+}>%.3fGeV/c" ,cutPpionplus ));
1153 pFlux->GetXaxis()->SetBinLabel(9 ,Form("K^{+}>%.3fGeV/c" ,cutPkaonplus ));
1154 pFlux->GetXaxis()->SetBinLabel(10,Form("p^{+}>%.3fGeV/c" ,cutPproton ));
1155
1156 pFlux->GetYaxis()->SetBinLabel(1,"sum");
1157 pFlux->GetYaxis()->SetBinLabel(2,"ch1");
1158 pFlux->GetYaxis()->SetBinLabel(3,"ch2");
1159 pFlux->GetYaxis()->SetBinLabel(4,"ch3");
1160 pFlux->GetYaxis()->SetBinLabel(5,"ch4");
1161 pFlux->GetYaxis()->SetBinLabel(6,"ch5");
1162 pFlux->GetYaxis()->SetBinLabel(7,"ch6");
1163 pFlux->GetYaxis()->SetBinLabel(8,"ch7");
1164 pFlux->GetYaxis()->SetBinLabel(9,"prim");
1165 pFlux->GetYaxis()->SetBinLabel(10,"tot");
1166
1167//end of hists definition
1168
1169 Int_t iNevents=fLoader->GetRunLoader()->GetAliRun()->GetEventsPerRun(),iCntPrimParts=0,iCntTotParts=0;
1170//load all needed trees
1171 fLoader->LoadHits();
1172 fLoader->GetRunLoader()->LoadHeader();
1173 fLoader->GetRunLoader()->LoadKinematics();
1174
1175 for(Int_t iEvtN=0;iEvtN < iNevents;iEvtN++){//events loop
1176 fLoader->GetRunLoader()->GetEvent(iEvtN);
1177 AliInfo(Form(" %i event processes",fLoader->GetRunLoader()->GetEventNumber()));
1178 AliStack *pStack= fLoader->GetRunLoader()->Stack();
1179
1180 for(Int_t iParticleN=0;iParticleN<pStack->GetNtrack();iParticleN++){//stack loop
1181 TParticle *pPart=pStack->Particle(iParticleN);
1182
1183 if(iParticleN%10000==0) AliInfo(Form(" %i particles read",iParticleN));
1184
1185 switch(pPart->GetPdgCode()){
1186 case kProtonBar: pFlux->Fill(-4.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-4.5,8); break;
1187 case kKMinus: pFlux->Fill(-3.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-3.5,8); break;
1188 case kPiMinus: pFlux->Fill(-2.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-2.5,8); break;
1189 case kMuonMinus: pFlux->Fill(-1.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-1.5,8); break;
1190 case kPositron: pFlux->Fill(-0.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-0.5,8); pEleAllP->Fill(-pPart->P()); break;
1191
1192 case kElectron: pFlux->Fill( 0.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 0.5,8); pEleAllP->Fill( pPart->P()); break;
1193 case kMuonPlus: pFlux->Fill( 1.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 1.5,8); break;
1194 case kPiPlus: pFlux->Fill( 2.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 2.5,8); break;
1195 case kKPlus: pFlux->Fill( 3.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 3.5,8); break;
1196 case kProton: pFlux->Fill( 4.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 4.5,8); break;
1197 }//switch
1198 }//stack loop
1199//now hits analiser
1200 for(Int_t iEntryN=0;iEntryN < fLoader->TreeH()->GetEntries();iEntryN++){//TreeH loop
1201 fLoader->TreeH()->GetEntry(iEntryN); //get current entry (prim)
1202 for(Int_t iHitN=0;iHitN < Hits()->GetEntries();iHitN++){//hits loop
1203 AliRICHHit *pHit = (AliRICHHit*)Hits()->At(iHitN); //get current hit
1204 TParticle *pPart=pStack->Particle(pHit->GetTrack()); //get stack particle which produced the current hit
8da90624 1205
1206 if(pPart->GetPDG()->Charge()!=0&&pPart->Rho()>0.1) pVertex->Fill(pPart->Vx(),pPart->Vy()); //safe margin for sec.
1207 if(pPart->GetPDG()->Charge()!=0) pRho->Fill(pPart->Rho()); //safe margin for sec.
e53ffca5 1208 if(pPart->R()>cutR) continue; //cut on production radius (cylindrical system)
1209
1210 switch(pPart->GetPdgCode()){
1211 case kProtonBar: if(pPart->P()>cutPantiproton) {pProHitP->Fill(-pPart->P()); pFlux->Fill(-4.5,pHit->C());}break;
1212 case kKMinus : if(pPart->P()>cutPkaonminus) {pKaoHitP->Fill(-pPart->P()); pFlux->Fill(-3.5,pHit->C());}break;
1213 case kPiMinus : if(pPart->P()>cutPpionminus) {pPioHitP->Fill(-pPart->P()); pFlux->Fill(-2.5,pHit->C());}break;
1214 case kMuonMinus: if(pPart->P()>cutPmuonminus) {pMuoHitP->Fill(-pPart->P()); pFlux->Fill(-1.5,pHit->C());}break;
1215 case kPositron : if(pPart->P()>cutPpositron) {pEleHitP->Fill(-pPart->P()); pFlux->Fill(-0.5,pHit->C());
1216 pEleHitRP->Fill(-pPart->P(),pPart->R()); pEleHitRZ->Fill(pPart->Vz(),pPart->R()); }break;
1217
1218 case kElectron : if(pPart->P()>cutPelectron) {pEleHitP->Fill( pPart->P()); pFlux->Fill( 0.5,pHit->C());
1219 pEleHitRP->Fill( pPart->P(),pPart->R()); pEleHitRZ->Fill(pPart->Vz(),pPart->R()); }break;
1220 case kMuonPlus : if(pPart->P()>cutPmuonplus) {pMuoHitP->Fill( pPart->P()); pFlux->Fill( 1.5,pHit->C());}break;
1221 case kPiPlus : if(pPart->P()>cutPpionplus) {pPioHitP->Fill( pPart->P()); pFlux->Fill( 2.5,pHit->C());}break;
1222 case kKPlus : if(pPart->P()>cutPkaonplus) {pKaoHitP->Fill( pPart->P()); pFlux->Fill( 3.5,pHit->C());}break;
1223 case kProton : if(pPart->P()>cutPproton) {pProHitP->Fill( pPart->P()); pFlux->Fill( 4.5,pHit->C());}break;
1224 }
1225 }//hits loop
1226 }//TreeH loop
1227 iCntPrimParts +=pStack->GetNprimary();
1228 iCntTotParts +=pStack->GetNtrack();
1229 }//events loop
1230//unload all loaded staff
1231 fLoader->UnloadHits();
1232 fLoader->GetRunLoader()->UnloadHeader();
1233 fLoader->GetRunLoader()->UnloadKinematics();
1234//Calculater some sums
1235 Stat_t sum=0;
1236//sum row, sum over rows
1237 for(Int_t i=1;i<=pFlux->GetNbinsX();i++){
1238 sum=0; for(Int_t j=2;j<=8;j++) sum+=pFlux->GetBinContent(i,j);
1239 pFlux->SetBinContent(i,1,sum);
1240 }
1241
1242//display everything
1243 new TCanvas("canvas1",Form("Events %i Nprims=%i Nparticles=%i",iNevents,iCntPrimParts,iCntTotParts),1000,900); pFlux->Draw("text"); gPad->SetGrid();
1244//total prims and particles
1245 TLatex latex; latex.SetTextSize(0.02);
1246 sum=0; for(Int_t i=1;i<=pFlux->GetNbinsX();i++) sum+=pFlux->GetBinContent(i,10); latex.DrawLatex(5.1,9.5,Form("%.0f",sum));
1247 sum=0; for(Int_t i=1;i<=pFlux->GetNbinsX();i++) sum+=pFlux->GetBinContent(i,9); latex.DrawLatex(5.1,8.5,Form("%.0f",sum));
1248 for(Int_t iChN=1;iChN<=kNchambers;iChN++) {
1249 sum=0; for(Int_t i=1;i<=pFlux->GetNbinsX();i++) sum+=pFlux->GetBinContent(i,iChN+1);latex.DrawLatex(5.1,iChN+0.5,Form("%.0f",sum));
1250 }
1251 sum=0; for(Int_t i=1;i<=pFlux->GetNbinsX();i++) sum+=pFlux->GetBinContent(i,1); latex.DrawLatex(5.1,0.5,Form("%.0f",sum));
1252
1253 new TCanvas("cEleAllP" ,"e" ,200,100); pEleAllP->Draw();
1254 new TCanvas("cEleHitRP" ,"e" ,200,100); pEleHitRP->Draw();
1255 new TCanvas("cEleHitRZ" ,"e" ,200,100); pEleHitRZ->Draw();
1256 new TCanvas("cEleHitP" ,"e" ,200,100); pEleHitP->Draw();
1257 new TCanvas("cMuoHitP" ,"mu",200,100); pMuoHitP->Draw();
1258 new TCanvas("cPioHitP" ,"pi",200,100); pPioHitP->Draw();
1259 new TCanvas("cKaoHitP" ,"K" ,200,100); pKaoHitP->Draw();
1260 new TCanvas("cProHitP" ,"p" ,200,100); pProHitP->Draw();
8da90624 1261 new TCanvas("cVertex" ,"2d vertex" ,200,100); pVertex->Draw();
1262 new TCanvas("cRho" ,"Rho of sec" ,200,100); pRho->Draw();
e53ffca5 1263
1264 gBenchmark->Show("HitsPlots");
1265}//HitsPlots()