]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICH.cxx
Re-activate display for new segmentation (Ch. Finck)
[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"
d3eb6079 19#include "AliRICHTracker.h"
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>
c60862bf 29#include <AliMagF.h>
c60862bf 30#include <AliRun.h>
31#include <AliRunDigitizer.h>
53fd478b 32#include <AliMC.h>
e42a7b46 33#include <AliESD.h>
5d12ce38 34#include <TVirtualMC.h>
e42a7b46 35#include <TH1F.h>
36#include <TH2F.h>
d3eb6079 37#include <TBenchmark.h>
998b831f 38#include <AliLog.h>
d3eb6079 39#include <TNtupleD.h>
40#include <AliTracker.h>
41#include <AliRawDataHeader.h>
0fe8fa07 42#include <TLatex.h> //Display()
43#include <TCanvas.h> //Display()
ddae0931 44
c60862bf 45ClassImp(AliRICH)
46//__________________________________________________________________________________________________
15d8311d 47// RICH manager class
c60862bf 48//BEGIN_HTML
15d8311d 49/*
50 <img src="gif/alirich.gif">
51*/
c60862bf 52//END_HTML
53//__________________________________________________________________________________________________
0fe8fa07 54AliRICH::AliRICH():AliDetector(),fParam(0), fSdigits(0),fNsdigits(0),fDigs(0),fClus(0)
53fd478b 55{
56//Default ctor should not contain any new operators
543d5224 57//AliDetector ctor deals with Hits and Digits
0fe8fa07 58 for(int i=0;i<kNchambers;i++) fNdigs[i] =0;
59 for(int i=0;i<kNchambers;i++) fNclus[i]=0;
e42a7b46 60// fCounters.ResizeTo(20); fCounters.Zero();
15d8311d 61}//AliRICH::AliRICH()
c021cb15 62//__________________________________________________________________________________________________
fe4da5cc 63AliRICH::AliRICH(const char *name, const char *title)
0fe8fa07 64 :AliDetector(name,title),fParam(new AliRICHParam),fSdigits(0),fNsdigits(0),fDigs(0),fClus(0)
53fd478b 65{
66//Named ctor
998b831f 67 AliDebug(1,"Start.");
543d5224 68//AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them)
0fe8fa07 69 HitsCreate(); gAlice->GetMCApp()->AddHitList(fHits);
e42a7b46 70 fCounters.ResizeTo(20); fCounters.Zero();
998b831f 71 AliDebug(1,"Stop.");
dfb4e77d 72}//AliRICH::AliRICH(const char *name, const char *title)
c021cb15 73//__________________________________________________________________________________________________
fe4da5cc 74AliRICH::~AliRICH()
53fd478b 75{
76//dtor
998b831f 77 AliDebug(1,"Start.");
237c933d 78
0fe8fa07 79 if(fParam) delete fParam;
c60862bf 80
81 if(fHits) delete fHits;
82 if(fSdigits) delete fSdigits;
83 if(fDigits) delete fDigits;
0fe8fa07 84 if(fDigs) {fDigs->Delete(); delete fDigs;}
85 if(fClus) {fClus->Delete(); delete fClus;}
998b831f 86 AliDebug(1,"Stop.");
dfb4e77d 87}//AliRICH::~AliRICH()
c021cb15 88//__________________________________________________________________________________________________
3ea9cb08 89void AliRICH::Hits2SDigits()
53fd478b 90{
3582c1f9 91// Create a list of sdigits corresponding to list of hits. Every hit generates one or more sdigits.
998b831f 92 AliDebug(1,"Start.");
3582c1f9 93 for(Int_t iEventN=0;iEventN<GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEventN++){//events loop
e42a7b46 94 GetLoader()->GetRunLoader()->GetEvent(iEventN);//get next event
3582c1f9 95
e42a7b46 96 if(!GetLoader()->TreeH()) GetLoader()->LoadHits(); GetLoader()->GetRunLoader()->LoadHeader();
d3eb6079 97 if(!GetLoader()->GetRunLoader()->TreeK()) GetLoader()->GetRunLoader()->LoadKinematics();//from
e42a7b46 98 if(!GetLoader()->TreeS()) GetLoader()->MakeTree("S"); MakeBranch("S");//to
3582c1f9 99
100 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
e42a7b46 101 GetLoader()->TreeH()->GetEntry(iPrimN);
3582c1f9 102 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){//hits loop
0fe8fa07 103 AliRICHHit *pHit=(AliRICHHit*)Hits()->At(iHitN);//get current hit
d3eb6079 104 TVector2 x2 = C(pHit->C())->Mrs2Anod(0.5*(pHit->InX3()+pHit->OutX3()));//hit position in the anod plane
e42a7b46 105 Int_t iTotQdc=P()->TotQdc(x2,pHit->Eloss());//total charge produced by hit, 0 if hit in dead zone
09c52ebc 106 if(iTotQdc==0) continue;
1cb5a97c 107 //
108 //need to quantize the anod....
109 TVector padHit=AliRICHParam::Loc2Pad(x2);
110 TVector2 padHitXY=AliRICHParam::Pad2Loc(padHit);
111 TVector2 anod;
112 if((x2.Y()-padHitXY.Y())>0) anod.Set(x2.X(),padHitXY.Y()+AliRICHParam::PitchAnod()/2);
113 else anod.Set(x2.X(),padHitXY.Y()-AliRICHParam::PitchAnod()/2);
114 //end to quantize anod
115 //
116 TVector area=P()->Loc2Area(anod);//determine affected pads, dead zones analysed inside
117 AliDebug(1,Form("hitanod(%6.2f,%6.2f)->area(%3.0f,%3.0f)-(%3.0f,%3.0f) QDC=%4i",anod.X(),anod.Y(),area[0],area[1],area[2],area[3],iTotQdc));
e42a7b46 118 TVector pad(2);
119 for(pad[1]=area[1];pad[1]<=area[3];pad[1]++)//affected pads loop
120 for(pad[0]=area[0];pad[0]<=area[2];pad[0]++){
1cb5a97c 121 Double_t padQdc=iTotQdc*P()->FracQdc(anod,pad);
998b831f 122 AliDebug(1,Form("current pad(%3.0f,%3.0f) with QDC =%6.2f",pad[0],pad[1],padQdc));
0fe8fa07 123 if(padQdc>0.1) SDigitAdd(pHit->C(),pad,padQdc,GetLoader()->GetRunLoader()->Stack()->Particle(pHit->GetTrack())->GetPdgCode(),pHit->GetTrack());
3582c1f9 124 }//affected pads loop
125 }//hits loop
126 }//prims loop
e42a7b46 127 GetLoader()->TreeS()->Fill();
128 GetLoader()->WriteSDigits("OVERWRITE");
2b8f978a 129 ResetSDigits();
3582c1f9 130 }//events loop
e42a7b46 131 GetLoader()->UnloadHits(); GetLoader()->GetRunLoader()->UnloadHeader(); GetLoader()->GetRunLoader()->UnloadKinematics();
3582c1f9 132 GetLoader()->UnloadSDigits();
998b831f 133 AliDebug(1,"Stop.");
3582c1f9 134}//Hits2SDigits()
c021cb15 135//__________________________________________________________________________________________________
d3eb6079 136void AliRICH::Digits2Raw()
137{
138//Loops over all digits and creates raw data files in DDL format. GetEvent() is done outside (AliSimulation)
0fe8fa07 139//RICH has 2 DDL per chamber, even number for right part(2-4-6) odd number for left part(1-3-5)
140//RICH has no any propriate header just uses the common one
141//Each PC is divided by 8 rows counted from 1 to 8 from top to bottom for left PCs(1-3-5) and from bottom to top for right PCc(2-4-6) (denoted rrrrr 5 bits 32 values)
142//Each raw is composed from 10 DILOGIC chips counted from left to right from 1 to 10 (denoted dddd 4 bits 16 values)
143//Each DILOGIC chip serves 48 channels counted from 0 to 47 (denoted aaaaaa 6 bits 64 values)
144//So RICH info word is 32 bits word with structure: 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq (five 0 five r six a twelve q) with QDC (denoted q...q 12 bits 4096 values)
d3eb6079 145 AliDebug(1,"Start.");
146 GetLoader()->LoadDigits();
147 GetLoader()->TreeD()->GetEntry(0);
148
149 Int_t kRichOffset=0x700; //currently one DDL per 3 sectors
150
151 ofstream file135,file246;//output streams 2 DDL per chamber
152 AliRawDataHeader header;//empty DDL miniheader
153 UInt_t word32=1; //32 bits data word
154
155 for(Int_t iChN=1;iChN<=kNchambers;iChN++){ //2 DDL per chamber open both in parallel
0fe8fa07 156 file135.open(Form("RICH_%4i.ddl",kRichOffset+2*iChN-1)); //left part of chamber; sectors 1-3-5 odd DDL number
157 file246.open(Form("RICH_%4i.ddl",kRichOffset+2*iChN)); //right part of chamber; sectors 2-4-6 even DDL number
d3eb6079 158//common DDL header defined by standart, now dummy as the total number of bytes is not yet known
159 file135.write((char*)&header,sizeof(header)); //dummy header just place holder
160 file246.write((char*)&header,sizeof(header)); //actual will be written later
d3eb6079 161
162 Int_t counter135=0,counter246=0;//counts total number of records per DDL
163
164 for(Int_t iDigN=0;iDigN<Digits(iChN)->GetEntriesFast();iDigN++){//digits loop for a given chamber
0fe8fa07 165 AliRICHDigit *pDig=(AliRICHDigit*)Digits(iChN)->At(iDigN);
166 word32=UInt_t (pDig->Q()+0x400*pDig->X()+0x4000*pDig->Y()); //arbitrary structure
d3eb6079 167 switch(pDig->S()){//readout by vertical sectors: 1,3,5-left DDL 2,4,6-right DDL
168 case 1: case 3: case 5: file135.write((char*)&word32,sizeof(word32)); counter135++; break;
169 case 2: case 4: case 6: file246.write((char*)&word32,sizeof(word32)); counter246++; break;
170 }//switch sector
171 }//digits loop for a given chamber
172//now count total byte number for each DDL file and rewrite actual header
173 header.fSize=sizeof(header)+counter135*sizeof(word32); header.SetAttribute(0); file135.seekp(0); file135.write((char*)&header,sizeof(header));
174 header.fSize=sizeof(header)+counter246*sizeof(word32); header.SetAttribute(0); file246.seekp(0); file246.write((char*)&header,sizeof(header));
175 file135.close(); file246.close();
176 }//chambers loop
177 GetLoader()->UnloadDigits();
178 AliDebug(1,"Stop.");
179}//Digits2Raw()
180//__________________________________________________________________________________________________
dfb4e77d 181void AliRICH::BuildGeometry()
53fd478b 182{
183//Builds a TNode geometry for event display
998b831f 184 AliInfo("Start.");
237c933d 185
3ea9cb08 186 TNode *node, *subnode, *top;
187 top=gAlice->GetGeometry()->GetNode("alice");
53d98323 188
a25b3368 189 Float_t widx =P()->SectorSizeX();
190 Float_t leny =P()->SectorSizeY();
191 Float_t dz =P()->Zfreon()+P()->Zwin()+P()->Pc2Win();
192 Float_t dead =P()->DeadZone();
998b831f 193
194 new TBRIK("RICH","RICH","void",widx+dead/2,leny+leny/2+dead,dz+0.1); //RICH chamber
195 new TBRIK("RPC" ,"RPC" ,"void",widx/2,leny/2,0.01); //RICH sector
196
a25b3368 197 for(int i=1;i<=P()->Nchambers();i++){
237c933d 198 top->cd();
998b831f 199 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 200 node->SetLineColor(kRed);
91975aa2 201 node->cd();
998b831f 202 subnode = new TNode("PHOTO1","PHOTO1","RPC",-widx/2-dead/2,-leny-dead/2,dz,"");
91975aa2 203 subnode->SetLineColor(kGreen);
204 fNodes->Add(subnode);
998b831f 205 subnode = new TNode("PHOTO1","PHOTO1","RPC", widx/2+dead/2,-leny-dead/2,dz,"");
91975aa2 206 subnode->SetLineColor(kGreen);
207 fNodes->Add(subnode);
998b831f 208 subnode = new TNode("PHOTO1","PHOTO1","RPC",-widx/2-dead/2, 0,dz,"");
91975aa2 209 subnode->SetLineColor(kGreen);
210 fNodes->Add(subnode);
998b831f 211 subnode = new TNode("PHOTO1","PHOTO1","RPC", widx/2+dead/2, 0,dz,"");
91975aa2 212 subnode->SetLineColor(kGreen);
213 fNodes->Add(subnode);
998b831f 214 subnode = new TNode("PHOTO1","PHOTO1","RPC",-widx/2-dead/2, leny+dead/2,dz,"");
91975aa2 215 subnode->SetLineColor(kGreen);
216 fNodes->Add(subnode);
998b831f 217 subnode = new TNode("PHOTO1","PHOTO1","RPC", widx/2+dead/2, leny+dead/2,dz,"");
91975aa2 218 subnode->SetLineColor(kGreen);
219 fNodes->Add(subnode);
237c933d 220 fNodes->Add(node);
998b831f 221 }
222
223 AliDebug(1,"Stop.");
dfb4e77d 224}//void AliRICH::BuildGeometry()
a25b3368 225//__________________________________________________________________________________________________
452a64c6 226void AliRICH::CreateMaterials()
227{
e42a7b46 228// Definition of available RICH materials
af3d25a6 229
998b831f 230 Int_t material=0; //tmp material id number
231 Float_t a=0,z=0,den=0,radl=0,absl=0; //tmp material parameters
a25b3368 232
c60862bf 233 Float_t tmaxfd=-10.0, deemax=-0.2, stemax=-0.1,epsil=0.001, stmin=-0.001;
234 Int_t isxfld = gAlice->Field()->Integ();
235 Float_t sxmgmx = gAlice->Field()->Max();
452a64c6 236
a25b3368 237 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 238 AliMixture(++material, "RichAir",aAir,zAir,den=0.00120479,4,wAir); //1 (Air) 0.01% C 75% N 23% O 1% Ar
239 AliMedium(kAir, "RichAir",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
452a64c6 240
a25b3368 241 AliMixture(++material, "RichAerogel",aAir,zAir,den=P()->DenGel(),4,wAir); //Aerogel represented by Air
242 AliMedium(kGel, "RichAerogel",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
243
244 AliMixture(++material, "RichAerogelReflector",aAir,zAir,den=P()->DenGel(),4,wAir); //Aerogel reflector represented by Air
245 AliMedium(kReflector, "RichAerogelReflector",material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
246
998b831f 247 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
248 AliMedium(kRoha, "RichRohacell", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 249
998b831f 250 Float_t aQuartz[2]={28.09,16.0}; Float_t zQuartz[2]={14.00, 8.0}; Float_t wQuartz[2]={1,2};
251 AliMixture(++material, "RichSiO2",aQuartz,zQuartz,den=2.64,-2, wQuartz); //3 Quarz (SiO2) -trasparent rad window
252 AliMedium(kSiO2, "RichSiO2",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 253
a25b3368 254 Float_t aFreon[2]={12,19}; Float_t zFreon[2]={6,9}; Float_t wmatFreon[2]={6,14}; // C12-6 F19-9
998b831f 255 AliMixture(++material, "RichC6F14",aFreon,zFreon,den=1.68,-2,wmatFreon); //4 Freon (C6F14)
256 AliMedium(kC6F14, "RichC6F14",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
257
258 Float_t aMethane[2]={12.01,1}; Float_t zMethane[2]={6,1}; Float_t wMethane[2]={1,4};
259 AliMixture (++material, "RichCH4", aMethane, zMethane, den=7.17e-4,-2, wMethane); //5,9 methane (CH4) normal and for Gap
260 AliMedium(kCH4, "RichCH4" , material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
a25b3368 261 AliMixture (++material, "RichCH4gap", aMethane, zMethane, den=7.17e-4,-2, wMethane); //5,9 methane (CH4) normal and for Gap
262 AliMedium(kGap, "RichCH4gap", material, 1, isxfld, sxmgmx, tmaxfd, 0.1 , -deemax, epsil, -stmin);
998b831f 263
264 AliMaterial(++material, "RichCsI", a=12.01,z=6.0, den=0.1, radl=18.8, absl=0); //6 CsI-radl equivalent
a25b3368 265 AliMedium(kCsI, "RichCsI", material, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 266
a25b3368 267 AliMaterial(++material, "RichGridCu", a=63.54,z=29.0,den=8.96, radl=1.43, absl=0); //7 anode grid (Cu)
268 AliMedium(kGridCu, "RichGridCu", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
269
270 AliMaterial(++material, "RichPcbCu", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //12 Cu
271 AliMedium(kCu, "RichPcbCu", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 272
a25b3368 273 AliMixture (++material, "RichOpSiO2",aQuartz, zQuartz, den=2.64, -2, wQuartz); //8 Quarz (SiO2) - opaque
274 AliMedium(kOpSiO2, "RichOpSiO2",material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 275
a25b3368 276 AliMaterial(++material, "RichAl", a=26.98,z=13.0,den=2.699, radl=8.9, absl=0); //10 aluminium sheet (Al)
277 AliMedium(kAl, "RichAl", material, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 278
998b831f 279 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 280 AliMixture(++material,"RichGlass",aGlass, zGlass, den=1.74, 5, wGlass); //11 Glass 50%-C 10.5%-Si 35.5%-O 3%-B 1%-Na
281 AliMedium(kGlass, "RichGlass", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
998b831f 282
a25b3368 283 AliMaterial(++material, "RichW", a=183.84,z=74.0,den=19.3, radl=0.35, absl=185.0/den); //13 W - anod wires
284 AliMedium(kW, "RichW", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 285
e42a7b46 286
287 if(P()->IsRadioSrc()){
998b831f 288 AliInfo("Special radioactive source materials");
a25b3368 289 AliMaterial(++material, "RichSteel", a=55.845,z=26.0,den=7.87, radl=1.76, absl=131.9/den); //14 Steel (Fe)
290 AliMedium(kSteel, "RichSteel", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
c60862bf 291
a25b3368 292 AliMaterial(++material, "RichPerpex", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //15 Perpex
293 AliMedium(kPerpex, "RichPerpex", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
e42a7b46 294
a25b3368 295 AliMaterial(++material, "RichSr90", a=87.62,z=38.0,den=2.54, radl=4.24, absl=0); //16 Sr90
296 AliMedium(kSr90, "RichSr90", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
297
298 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
299 AliMixture(++material,"RichMylar",aMylar, zMylar, den=1.39, -3, wMylar);
300 AliMedium(kMylar, "RichMylar", material, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
e42a7b46 301 }
c60862bf 302
998b831f 303//Optical properties:
304#include "Opticals.h"
a25b3368 305 gMC->SetCerenkov((*fIdtmed)[kAir] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //1 Air
306 gMC->SetCerenkov((*fIdtmed)[kRoha] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //2 Honeycomb
307 gMC->SetCerenkov((*fIdtmed)[kSiO2] , kNbins, aPckov, aAbsSiO2 , aQeAll, aIdxSiO2); //3 Quartz SiO2
308 gMC->SetCerenkov((*fIdtmed)[kC6F14] , kNbins, aPckov, aAbsC6F14 , aQeAll, aIdxC6F14); //4 Freon C6F14
309 gMC->SetCerenkov((*fIdtmed)[kCH4] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //5 Methane CH4
310 gMC->SetCerenkov((*fIdtmed)[kCsI] , kNbins, aPckov, aAbsCsI , aQeCsI, aIdxCH4); //6 CsI
311 gMC->SetCerenkov((*fIdtmed)[kGridCu] , kNbins, aPckov, aAbsGrid , aQeAll, aIdxMetal); //7 grid Cu
312 gMC->SetCerenkov((*fIdtmed)[kOpSiO2] , kNbins, aPckov, aAbsOpSiO2 , aQeAll, aIdxMetal); //8 Opaque quartz SiO2
313 gMC->SetCerenkov((*fIdtmed)[kGap] , kNbins, aPckov, aAbsCH4 , aQeAll, aIdxCH4); //9 Special methane gap
314 gMC->SetCerenkov((*fIdtmed)[kAl] , kNbins, aPckov, aAbsGrid , aQeAll, aIdxMetal); //10 Aluminium
315 gMC->SetCerenkov((*fIdtmed)[kGlass] , kNbins, aPckov, aAbsOpSiO2 , aQeAll, aIdxMetal); //11 Glass
316 gMC->SetCerenkov((*fIdtmed)[kGel] , kNbins, aPckov, aAbsGel , aQeAll, aIdxGel); //12 Aerogel
317 gMC->SetCerenkov((*fIdtmed)[kReflector], kNbins, aPckov, aAbsRef , aQeAll, aIdxMetal); //13 Aerogel reflector
c60862bf 318}//void AliRICH::CreateMaterials()
c021cb15 319//__________________________________________________________________________________________________
a25b3368 320Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
452a64c6 321{
322
323 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
324
325 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,
326 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,
327 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
452a64c6 328 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
329 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
330 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
331 1.72,1.53};
452a64c6 332 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
333 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
334 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
335 1.714,1.498};
336 Float_t xe=ene;
337 Int_t j=Int_t(xe*10)-49;
338 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
339 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
340
341 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
342 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
343
344 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
345 Float_t tanin=sinin/pdoti;
346
347 Float_t c1=cn*cn-ck*ck-sinin*sinin;
348 Float_t c2=4*cn*cn*ck*ck;
349 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
350 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
351
352 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
353 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
354
355
356 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
357 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
358
359 Float_t sigraf=18.;
360 Float_t lamb=1240/ene;
361 Float_t fresn;
362
363 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
364
365 if(pola)
366 {
367 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
368 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
369 }
370 else
371 fresn=0.5*(rp+rs);
372
373 fresn = fresn*rO;
374 return(fresn);
53fd478b 375}//Fresnel()
c021cb15 376//__________________________________________________________________________________________________
dfb4e77d 377void AliRICH::MakeBranch(Option_t* option)
53fd478b 378{
379//Create Tree branches for the RICH.
998b831f 380 AliDebug(1,Form("Start with option= %s.",option));
dfb4e77d 381
382 const Int_t kBufferSize = 4000;
dfb4e77d 383
dfb4e77d 384 const char *cH = strstr(option,"H");
385 const char *cD = strstr(option,"D");
386 const char *cR = strstr(option,"R");
387 const char *cS = strstr(option,"S");
388
c60862bf 389 if(cH&&TreeH()){//H
0fe8fa07 390 HitsCreate(); //branch will be created in AliDetector::MakeBranch
c60862bf 391 }//H
dfb4e77d 392 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
393
c60862bf 394 if(cS&&fLoader->TreeS()){//S
0fe8fa07 395 SDigitsCreate(); MakeBranchInTree(fLoader->TreeS(),"RICH",&fSdigits,kBufferSize,0) ;
c60862bf 396 }//S
dfb4e77d 397
c60862bf 398 if(cD&&fLoader->TreeD()){//D
0fe8fa07 399 DigitsCreate();
e42a7b46 400 for(Int_t i=0;i<kNchambers;i++){
0fe8fa07 401 MakeBranchInTree(fLoader->TreeD(),Form("%s%d",GetName(),i+1),&((*fDigs)[i]),kBufferSize,0);
543d5224 402 }
c60862bf 403 }//D
404
405 if(cR&&fLoader->TreeR()){//R
0fe8fa07 406 ClustersCreate();
e42a7b46 407 for(Int_t i=0;i<kNchambers;i++)
0fe8fa07 408 MakeBranchInTree(fLoader->TreeR(),Form("%sClusters%d",GetName(),i+1), &((*fClus)[i]), kBufferSize, 0);
cb8189e7 409 }//R
998b831f 410 AliDebug(1,"Stop.");
c021cb15 411}//void AliRICH::MakeBranch(Option_t* option)
c60862bf 412//__________________________________________________________________________________________________
dfb4e77d 413void AliRICH::SetTreeAddress()
53fd478b 414{
415//Set branch address for the Hits and Digits Tree.
998b831f 416 AliDebug(1,"Start.");
c60862bf 417
dfb4e77d 418 TBranch *branch;
dfb4e77d 419
c60862bf 420 if(fLoader->TreeH()){//H
998b831f 421 AliDebug(1,"tree H is requested.");
0fe8fa07 422 HitsCreate();//branch map will be in AliDetector::SetTreeAddress
c60862bf 423 }//H
c021cb15 424 AliDetector::SetTreeAddress();//this is after TreeH because we need to guarantee that fHits array is created
425
c60862bf 426 if(fLoader->TreeS()){//S
998b831f 427 AliDebug(1,"tree S is requested.");
0fe8fa07 428 branch=fLoader->TreeS()->GetBranch(GetName()); if(branch){SDigitsCreate(); branch->SetAddress(&fSdigits);}
c60862bf 429 }//S
dfb4e77d 430
c60862bf 431 if(fLoader->TreeD()){//D
998b831f 432 AliDebug(1,"tree D is requested.");
e42a7b46 433 for(int i=0;i<kNchambers;i++){
c60862bf 434 branch=fLoader->TreeD()->GetBranch(Form("%s%d",GetName(),i+1));
0fe8fa07 435 if(branch){DigitsCreate(); branch->SetAddress(&((*fDigs)[i]));}
aed240d4 436 }
c60862bf 437 }//D
dfb4e77d 438
c60862bf 439 if(fLoader->TreeR()){//R
998b831f 440 AliDebug(1,"tree R is requested.");
e42a7b46 441 for(int i=0;i<kNchambers;i++){
c60862bf 442 branch=fLoader->TreeR()->GetBranch(Form("%sClusters%d" ,GetName(),i+1));
0fe8fa07 443 if(branch){ClustersCreate(); branch->SetAddress(&((*fClus)[i]));}
dfb4e77d 444 }
c60862bf 445 }//R
998b831f 446 AliDebug(1,"Stop.");
dfb4e77d 447}//void AliRICH::SetTreeAddress()
c021cb15 448//__________________________________________________________________________________________________
dfb4e77d 449void AliRICH::Print(Option_t *option)const
450{
53fd478b 451//Debug printout
dfb4e77d 452 TObject::Print(option);
e42a7b46 453 P()->Print();
454 fCounters.Print();
dfb4e77d 455}//void AliRICH::Print(Option_t *option)const
c021cb15 456//__________________________________________________________________________________________________
e42a7b46 457void AliRICH::ControlPlots()
458{
d3eb6079 459//Creates a set of QA hists to control the results of simulation. Hists are in file $HOME/RCP.root
a25b3368 460 TH1F *pElecP=0 ,*pMuonP=0 ,*pPionP=0 ,*pKaonP=0 ,*pProtP=0, //stack particles
d3eb6079 461 *pHxD=0,*pHyD=0,*pHxSd=0,*pHySd=0, //diff hit position - digit sdigit position
462 *pNumClusH1=0,
e42a7b46 463 *pQdcH1=0, *pSizeH1=0,
464 *pPureMipQdcH1=0,*pPureMipSizeH1=0,
465 *pPureCerQdcH1=0,*pPureCerSizeH1=0,
466 *pPureFeeQdcH1=0,*pPureFeeSizeH1=0,
467 *pMipQdcH1=0, *pPhotQdcH1=0;
468 TH2F *pMapH2=0,*pPureMipMapH2=0,*pPureCerMapH2=0,*pPureFeeMapH2=0;
d3eb6079 469 TH1F *pelecRadius=0,*pprotRadius=0,*pprotbarRadius=0;
470//load all information
471 GetLoader()->GetRunLoader()->LoadHeader();
472 GetLoader()->GetRunLoader()->LoadKinematics();
473 GetLoader()->LoadHits();
474 Bool_t isSdig=0;//!GetLoader()->LoadSDigits();
475 Bool_t isDig =0;//!GetLoader()->LoadDigits();
e42a7b46 476 Bool_t isClus=!GetLoader()->LoadRecPoints();
477
d3eb6079 478 gBenchmark->Start("ControlPlots");
c021cb15 479
e42a7b46 480 TFile *pFile = new TFile("$(HOME)/RCP.root","RECREATE");
d3eb6079 481
482 pElecP=new TH1F("Pelec","Electrons made hit in RICH;p [GeV]",1000,-30,30);
483 pMuonP=new TH1F("Pmuon","Muons made hit in RICH;p [GeV]",1000,-30,30);
484 pPionP=new TH1F("Ppion","Pions made hit in RICH;p [GeV]",1000,-30,30);
485 pKaonP=new TH1F("Pkaon","Kaon made hit in RICH;p [GeV]",1000,-30,30);
486 pProtP=new TH1F("Pprot","Protons made hit in RICH;p [GeV]",1000,-30,30);
487 pelecRadius=new TH1F("elecRadius","elec",600,0.,600.);
488 pprotRadius=new TH1F("protRadius","elec",600,0.,600.);
489 pprotbarRadius=new TH1F("protbarRadius","elec",600,0.,600.);
490
491 if(isSdig){
492 AliInfo("SDigits available");
493 pHxSd=new TH1F("DiffHitSDigitX","Hit-SDigit diff X all chambers;diff [cm]",300,-10,10);
494 pHySd=new TH1F("DiffHitSDigitY","Hit-SDigit diff Y all chambers;diff [cm]",300,-10,10);
495 }//isSdig
e42a7b46 496
497 if(isDig){
998b831f 498 AliInfo("Digits available");
d3eb6079 499 pHxD=new TH1F("DiffHitDigitX","Hit-Digit diff X all chambers;diff [cm]",300,-10,10);
500 pHyD=new TH1F("DiffHitDigitY","Hit-Digit diff Y all chambers;diff [cm]",300,-10,10);
e42a7b46 501 }//isDig
502
503 if(isClus){
a25b3368 504 AliInfo("Clusters available");
e42a7b46 505 pNumClusH1=new TH1F("NumClusPerEvent","Number of clusters per event;number",50,0,49);
c021cb15 506
a25b3368 507 pQdcH1 =new TH1F("ClusQdc", "Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 508 pSizeH1 =new TH1F("ClusSize", "Cluster size all chambers;size [number of pads in cluster]",100,0,100);
a25b3368 509 pMapH2 =new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY());
e42a7b46 510
a25b3368 511 pMipQdcH1 =new TH1F("QdcMip" ,"MIP Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
512 pPhotQdcH1 =new TH1F("QdcPhot" ,"Cer+Fee Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 513
a25b3368 514 pPureMipQdcH1 =new TH1F("QdcPureMip" ,"MIP only Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 515 pPureMipSizeH1=new TH1F("SizePureMip" ,"MIP only Cluster size all chambers;size [number of pads in cluster]",100,0,100);
a25b3368 516 pPureMipMapH2 =new TH2F("MapPureMip" ,"MIP only Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY());
e42a7b46 517
a25b3368 518 pPureCerQdcH1 =new TH1F("QdcPureCer" ,"Cerenkov only Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 519 pPureCerSizeH1=new TH1F("SizePureCer" ,"Cernekov only Cluster size all chambers;size [number of pads in cluster]",100,0,100);
a25b3368 520 pPureCerMapH2 =new TH2F("MapPureCer" ,"Cerenkov only Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY());
c021cb15 521
a25b3368 522 pPureFeeQdcH1 =new TH1F("QdcPureFee" ,"Feedback only Cluster Charge all chambers;q [QDC]",P()->MaxQdc(),0,P()->MaxQdc());
e42a7b46 523 pPureFeeSizeH1=new TH1F("SizePureFee" ,"Feedback only Cluster size all chambers;size [number of pads in cluster]",100,0,100);
a25b3368 524 pPureFeeMapH2 =new TH2F("MapPureFee" ,"Feedback only Cluster map;x [cm];y [cm]",1000,0,P()->PcSizeX(),1000,0,P()->PcSizeY());
d3eb6079 525
e42a7b46 526 }//isClus
d3eb6079 527//end of hists booking
e42a7b46 528 for(Int_t iEvtN=0;iEvtN < GetLoader()->GetRunLoader()->GetAliRun()->GetEventsPerRun();iEvtN++){//events loop
d3eb6079 529 GetLoader()->GetRunLoader()->GetEvent(iEvtN); //get current event
c021cb15 530
a25b3368 531 for(Int_t iPrimN=0;iPrimN < GetLoader()->TreeH()->GetEntries();iPrimN++){//hit tree loop
532 GetLoader()->TreeH()->GetEntry(iPrimN);
d3eb6079 533 for(Int_t j=0;j<Hits()->GetEntries();j++){//hits loop
0fe8fa07 534 AliRICHHit *pHit = (AliRICHHit*)Hits()->At(j);
d3eb6079 535 TParticle *pParticle = GetLoader()->GetRunLoader()->Stack()->Particle(pHit->GetTrack());//get particle produced this hit
0fe8fa07 536 Double_t dRadius = TMath::Sqrt(pParticle->Vx()*pParticle->Vx()+pParticle->Vy()*pParticle->Vy()+pParticle->Vz()*pParticle->Vz());
a25b3368 537 switch(pParticle->GetPdgCode()){
0fe8fa07 538 case kPositron : pElecP->Fill( pParticle->P());pelecRadius->Fill(dRadius); break;
539 case kElectron : pElecP->Fill(-pParticle->P());pelecRadius->Fill(dRadius); break;
a25b3368 540
541 case kMuonPlus : pMuonP->Fill( pParticle->P()); break;
542 case kMuonMinus: pMuonP->Fill(-pParticle->P()); break;
543
544 case kPiPlus : pPionP->Fill( pParticle->P()); break;
545 case kPiMinus : pPionP->Fill(-pParticle->P()); break;
546
547 case kKPlus : pKaonP->Fill( pParticle->P()); break;
548 case kKMinus : pKaonP->Fill(-pParticle->P()); break;
549
0fe8fa07 550 case kProton : pProtP->Fill( pParticle->P()); pprotRadius->Fill(dRadius); break;
551 case kProtonBar: pProtP->Fill(-pParticle->P()); pprotbarRadius->Fill(dRadius); break;
a25b3368 552
553 }//switch PdgCode
554
555 }//hits loop
556 }//hit tree loop
c021cb15 557
d3eb6079 558 if(isSdig){
559 GetLoader()->TreeS()->GetEntry(0);
560 for(Int_t iSdigN=0;iSdigN<SDigits()->GetEntries();iSdigN++){//sdigits loop
0fe8fa07 561 AliRICHDigit *pSdig=(AliRICHDigit*)SDigits()->At(iSdigN); //get current sdigit pointer
562 AliRICHHit *pHit=Hit(pSdig->GetTrack(0)); //get hit of this sdigit (always one)
d3eb6079 563 TVector2 hit2 =C(pHit->C())->Mrs2Pc(pHit->OutX3()); //this hit position in local system
564 TVector2 sdig2=P()->Pad2Loc(pSdig->Pad()); //center of pad for this sdigit
565 pHxSd->Fill(hit2.X()-sdig2.X());
566 pHySd->Fill(hit2.Y()-sdig2.Y());
567 }//sdigits loop
568 }//if(isSdig)
569
e42a7b46 570 if(isDig) GetLoader()->TreeD()->GetEntry(0);
d3eb6079 571 if(isClus) GetLoader()->TreeR()->GetEntry(0);
c021cb15 572
e42a7b46 573 for(Int_t iChamN=1;iChamN<=7;iChamN++){//chambers loop
d3eb6079 574 if(isDig){
575 for(Int_t iDigN=0;iDigN<Digits(iChamN)->GetEntries();iDigN++){//digits loop
0fe8fa07 576 AliRICHDigit *pDig=(AliRICHDigit*)Digits(iChamN)->At(iDigN);
577 AliRICHHit *pHit=Hit(pDig->GetTrack(0)); //get first hit of this digit
d3eb6079 578 TVector2 hitV2=C(iChamN)->Mrs2Pc(pHit->OutX3());
579 TVector2 digV2=P()->Pad2Loc(pDig->Pad()); //center of pad for this digit
580 pHxD->Fill(hitV2.X()-digV2.X()); pHyD->Fill(hitV2.Y()-digV2.Y());
581 }//digits loop
582 }//isDig
e42a7b46 583 if(isClus){
584 Int_t iNclusCham=Clusters(iChamN)->GetEntries(); if(iNclusCham) pNumClusH1->Fill(iNclusCham);//number of clusters per event
585 for(Int_t iClusN=0;iClusN<iNclusCham;iClusN++){//clusters loop
0fe8fa07 586 AliRICHCluster *pClus=(AliRICHCluster*)Clusters(iChamN)->At(iClusN);
e42a7b46 587 pQdcH1 ->Fill(pClus->Q());
588 pSizeH1 ->Fill(pClus->Size());
589 pMapH2 ->Fill(pClus->X(),pClus->Y()); //common
590
591 if(pClus->IsSingleMip()) {pPureMipQdcH1 ->Fill(pClus->Q());
592 pPureMipSizeH1->Fill(pClus->Size());
593 pPureMipMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Mips
594
595 if(pClus->IsSingleCerenkov()){pPureCerQdcH1 ->Fill(pClus->Q());
596 pPureCerSizeH1->Fill(pClus->Size());
597 pPureCerMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Cerenkovs
598
599 if(pClus->IsSingleFeedback()){pPureFeeQdcH1 ->Fill(pClus->Q());
600 pPureFeeSizeH1->Fill(pClus->Size());
601 pPureFeeMapH2 ->Fill(pClus->X(),pClus->Y());}//Pure Feedbacks
602
603 if(pClus->IsMip()) {pMipQdcH1 ->Fill(pClus->Q());} //MIP+ other contributions
604 if(!pClus->IsPureMip()) pPhotQdcH1->Fill(pClus->Q()); //not MIP
605 }//clusters loop
606 }//isClus
e42a7b46 607 }//chambers loop
608 Info("ControlPlots","Event %i processed.",iEvtN);
609 }//events loop
d3eb6079 610 GetLoader()->UnloadHits();
611 if(isSdig) GetLoader()->UnloadSDigits();
e42a7b46 612 if(isDig) GetLoader()->UnloadDigits();
613 if(isClus) GetLoader()->UnloadRecPoints();
614
a25b3368 615 GetLoader()->GetRunLoader()->UnloadHeader();
616 GetLoader()->GetRunLoader()->UnloadKinematics();
617
e42a7b46 618 pFile->Write(); delete pFile;
d3eb6079 619
620 gBenchmark->Show("ControlPlots");
e42a7b46 621}//ControlPlots()
622//__________________________________________________________________________________________________
0fe8fa07 623AliRICHHit* AliRICH::Hit(Int_t tid)const
e42a7b46 624{
625//defines which hit provided by given tid for the currently loaded event
a25b3368 626 GetLoader()->LoadHits();
627 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
628 GetLoader()->TreeH()->GetEntry(iPrimN);
629 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){
0fe8fa07 630 AliRICHHit *pHit=(AliRICHHit*)Hits()->At(iHitN);
a25b3368 631 if(tid==pHit->Track()) {GetLoader()->UnloadHits();return pHit;}
e42a7b46 632 }//hits
633 }//prims loop
a25b3368 634 GetLoader()->UnloadHits();
e42a7b46 635 return 0;
636}
637//__________________________________________________________________________________________________
0fe8fa07 638void AliRICH::HitsPrint(Int_t iEvtN)const
e42a7b46 639{
640//Prints a list of RICH hits for a given event. Default is event number 0.
d3eb6079 641 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
998b831f 642 AliInfo(Form("List of RICH hits for event %i",iEvtN));
a25b3368 643 if(GetLoader()->LoadHits()) return;
e42a7b46 644
645 Int_t iTotalHits=0;
a25b3368 646 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
647 GetLoader()->TreeH()->GetEntry(iPrimN);
648 Hits()->Print();
649 iTotalHits+=Hits()->GetEntries();
e42a7b46 650 }
a25b3368 651 GetLoader()->UnloadHits();
998b831f 652 AliInfo(Form("totally %i hits",iTotalHits));
e42a7b46 653}
654//__________________________________________________________________________________________________
0fe8fa07 655void AliRICH::SDigitsPrint(Int_t iEvtN)const
e42a7b46 656{
657//prints a list of RICH sdigits for a given event
d3eb6079 658 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
e42a7b46 659 Info("PrintSDigits","List of RICH sdigits for event %i",iEvtN);
a25b3368 660 if(GetLoader()->LoadSDigits()) return;
e42a7b46 661
a25b3368 662 GetLoader()->TreeS()->GetEntry(0);
663 SDigits()->Print();
664 GetLoader()->UnloadSDigits();
665 Info("PrintSDigits","totally %i sdigits",SDigits()->GetEntries());
e42a7b46 666}
667//__________________________________________________________________________________________________
0fe8fa07 668void AliRICH::DigitsPrint(Int_t iEvtN)const
e42a7b46 669{
670//prints a list of RICH digits for a given event
d3eb6079 671 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
e42a7b46 672 Info("PrintDigits","List of RICH digits for event %i",iEvtN);
a25b3368 673 if(GetLoader()->LoadDigits()) return;
e42a7b46 674
675 Int_t iTotalDigits=0;
a25b3368 676 GetLoader()->TreeD()->GetEntry(0);
e42a7b46 677 for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){
a25b3368 678 Digits(iChamber)->Print();
679 iTotalDigits+=Digits(iChamber)->GetEntries();
e42a7b46 680 }
a25b3368 681 GetLoader()->UnloadDigits();
e42a7b46 682 Info("PrintDigits","totally %i Digits",iTotalDigits);
683}
684//__________________________________________________________________________________________________
0fe8fa07 685void AliRICH::ClustersPrint(Int_t iEvtN)const
e42a7b46 686{
687//prints a list of RICH clusters for a given event
d3eb6079 688 AliInfo(Form("List of RICH clusters for event %i",iEvtN));
a25b3368 689 GetLoader()->GetRunLoader()->GetEvent(iEvtN);
690 if(GetLoader()->LoadRecPoints()) return;
e42a7b46 691
692 Int_t iTotalClusters=0;
a25b3368 693 GetLoader()->TreeR()->GetEntry(0);
e42a7b46 694 for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){
a25b3368 695 Clusters(iChamber)->Print();
696 iTotalClusters+=Clusters(iChamber)->GetEntries();
e42a7b46 697 }
a25b3368 698 GetLoader()->UnloadRecPoints();
d3eb6079 699 AliInfo(Form("totally %i clusters for event %i",iTotalClusters,iEvtN));
e42a7b46 700}
701//__________________________________________________________________________________________________
998b831f 702void AliRICH::PrintTracks(Int_t iEvtN)
e42a7b46 703{
a25b3368 704//prints a list of tracks (including secondary) for a given event
705 AliInfo(Form("List of all tracks for event %i",iEvtN));
706 GetLoader()->GetRunLoader()->GetEvent(iEvtN);
707 if(GetLoader()->GetRunLoader()->LoadHeader()) return;
708 if(GetLoader()->GetRunLoader()->LoadKinematics()) return;
709 AliStack *pStack=GetLoader()->GetRunLoader()->Stack();
710
d3eb6079 711 for(Int_t i=0;i<pStack->GetNtrack();i++) pStack->Particle(i)->Print();
a25b3368 712
d3eb6079 713 AliInfo(Form("totally %i tracks including %i primaries for event %i",pStack->GetNtrack(),pStack->GetNprimary(),iEvtN));
a25b3368 714 GetLoader()->GetRunLoader()->UnloadHeader();
715 GetLoader()->GetRunLoader()->UnloadKinematics();
e42a7b46 716}
a25b3368 717//__________________________________________________________________________________________________
d3eb6079 718void AliRICH::GeomPadPanelFrame()const
a25b3368 719{
720//Pad Panel frame 6 sectors
721 Double_t cm=1,mm=0.1*cm;//default is cm
722 Float_t par[3];
723
724 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
725 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
726 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
727 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)
728
729 gMC->Gspos("RPPF",1,"RICH", -335*mm, -433*mm, 8*cm+20*mm, 0,"ONLY");//F1 2040P1 z p.84 TDR
730 gMC->Gspos("RPPF",2,"RICH", +335*mm, -433*mm, 8*cm+20*mm, 0,"ONLY");
731 gMC->Gspos("RPPF",3,"RICH", -335*mm, 0*mm, 8*cm+20*mm, 0,"ONLY");
732 gMC->Gspos("RPPF",4,"RICH", +335*mm, 0*mm, 8*cm+20*mm, 0,"ONLY");
733 gMC->Gspos("RPPF",5,"RICH", -335*mm, +433*mm, 8*cm+20*mm, 0,"ONLY");
734 gMC->Gspos("RPPF",6,"RICH", +335*mm, +433*mm, 8*cm+20*mm, 0,"ONLY");
735 gMC->Gspos("RPC ",1,"RPPF", 0*mm, 0*mm, -19.15*mm, 0,"ONLY");//PPF 2001P2
736 gMC->Gspos("PPFL",1,"RPPF", -224.5*mm, -151.875*mm, 0.85*mm, 0,"ONLY");
737 gMC->Gspos("PPFL",2,"RPPF", -224.5*mm, - 50.625*mm, 0.85*mm, 0,"ONLY");
738 gMC->Gspos("PPFL",3,"RPPF", -224.5*mm, + 50.625*mm, 0.85*mm, 0,"ONLY");
739 gMC->Gspos("PPFL",4,"RPPF", -224.5*mm, +151.875*mm, 0.85*mm, 0,"ONLY");
740 gMC->Gspos("PPFS",1,"RPPF", - 65.0*mm, -151.875*mm, 0.85*mm, 0,"ONLY");
741 gMC->Gspos("PPFS",2,"RPPF", - 65.0*mm, - 50.625*mm, 0.85*mm, 0,"ONLY");
742 gMC->Gspos("PPFS",3,"RPPF", - 65.0*mm, + 50.625*mm, 0.85*mm, 0,"ONLY");
743 gMC->Gspos("PPFS",4,"RPPF", - 65.0*mm, +151.875*mm, 0.85*mm, 0,"ONLY");
744 gMC->Gspos("PPFS",5,"RPPF", + 65.0*mm, -151.875*mm, 0.85*mm, 0,"ONLY");
745 gMC->Gspos("PPFS",6,"RPPF", + 65.0*mm, - 50.625*mm, 0.85*mm, 0,"ONLY");
746 gMC->Gspos("PPFS",7,"RPPF", + 65.0*mm, + 50.625*mm, 0.85*mm, 0,"ONLY");
747 gMC->Gspos("PPFS",8,"RPPF", + 65.0*mm, +151.875*mm, 0.85*mm, 0,"ONLY");
748 gMC->Gspos("PPFL",5,"RPPF", +224.5*mm, -151.875*mm, 0.85*mm, 0,"ONLY");
749 gMC->Gspos("PPFL",6,"RPPF", +224.5*mm, - 50.625*mm, 0.85*mm, 0,"ONLY");
750 gMC->Gspos("PPFL",7,"RPPF", +224.5*mm, + 50.625*mm, 0.85*mm, 0,"ONLY");
751 gMC->Gspos("PPFL",8,"RPPF", +224.5*mm, +151.875*mm, 0.85*mm, 0,"ONLY");
752}//GeomPadPanelFrame()
753//__________________________________________________________________________________________________
d3eb6079 754void AliRICH::GeomAmpGap()const
a25b3368 755{
756//Gap - anod wires 6 copies to RICH
757 Double_t cm=1,mm=0.1*cm,mkm=0.001*mm;//default is cm
758 Int_t matrixIdReturn=0; //matrix id returned by AliMatrix
759 Float_t par[3];
760
761 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
762 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
763 AliMatrix(matrixIdReturn,180,0, 90,90, 90,0); //wires along x
764
765 gMC->Gspos("RGAP",1,"RICH", -335*mm, -433*mm,8*cm-2.225*mm, 0,"ONLY"); //F1 2040P1 z WP 2099P1
766 gMC->Gspos("RGAP",2,"RICH", +335*mm, -433*mm,8*cm-2.225*mm, 0,"ONLY");
767 gMC->Gspos("RGAP",3,"RICH", -335*mm, 0*mm,8*cm-2.225*mm, 0,"ONLY");
768 gMC->Gspos("RGAP",4,"RICH", +335*mm, 0*mm,8*cm-2.225*mm, 0,"ONLY");
769 gMC->Gspos("RGAP",5,"RICH", -335*mm, +433*mm,8*cm-2.225*mm, 0,"ONLY");
770 gMC->Gspos("RGAP",6,"RICH", +335*mm, +433*mm,8*cm-2.225*mm, 0,"ONLY");
771 for(int i=1;i<=96;i++)
772 gMC->Gspos("RANO",i,"RGAP", 0*mm, -411/2*mm+i*4*mm, 0.185*mm, matrixIdReturn,"ONLY"); //WP 2099P1
773}//GeomAmpGap()
774//__________________________________________________________________________________________________
d3eb6079 775void AliRICH::GeomRadiators()const
a25b3368 776{
777//Defines radiators geometry
778 Double_t mm=0.1;//default is cm
779 Float_t par[3];
780 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
781 par[0]=1330*mm/2 ;par[1]= 413*mm/2 ;par[2]= 4*mm/2; gMC->Gsvolu("RRFR","BOX ",(*fIdtmed)[kRoha] ,par,3); //front
782 par[0]=1330*mm/2 ;par[1]= 413*mm/2 ;par[2]= 5*mm/2; gMC->Gsvolu("RRWI","BOX ",(*fIdtmed)[kSiO2] ,par,3); //window
783 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
784 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
785 par[0]= 0 ;par[1]= 10*mm/2 ;par[2]= 15*mm/2; gMC->Gsvolu("RRSP","TUBE",(*fIdtmed)[kSiO2] ,par,3); //spacer
786
787 gMC->Gspos("RRAD",1,"RICH", 0*mm,-434*mm, -12*mm, 0,"ONLY"); //3 radiators to RICH
788 gMC->Gspos("RRAD",2,"RICH", 0*mm, 0*mm, -12*mm, 0,"ONLY");
789 gMC->Gspos("RRAD",3,"RICH", 0*mm,+434*mm, -12*mm, 0,"ONLY");
790 gMC->Gspos("RRFR",1,"RRAD", 0*mm, 0*mm, -10.0*mm, 0,"ONLY"); //front cover
791 gMC->Gspos("RRWI",1,"RRAD", 0*mm, 0*mm, 9.5*mm, 0,"ONLY"); //quartz window (back cover)
792 gMC->Gspos("RRLO",1,"RRAD", 0*mm,-204*mm, -0.5*mm, 0,"ONLY"); //long side
793 gMC->Gspos("RRLO",2,"RRAD", 0*mm,+204*mm, -0.5*mm, 0,"ONLY"); //long side
794 gMC->Gspos("RRSH",1,"RRAD",-660*mm, 0*mm, -0.5*mm, 0,"ONLY"); //short side
795 gMC->Gspos("RRSH",2,"RRAD",+660*mm, 0*mm, -0.5*mm, 0,"ONLY"); //short side
796 for(int i=0;i<3;i++)
797 for(int j=0;j<10;j++)
798 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
799}//GeomRadiators()
800//__________________________________________________________________________________________________
d3eb6079 801void AliRICH::GeomSandBox()const
a25b3368 802{
803//Defines SandBox geometry
804 Double_t mm=0.1;//default is cm
805 Float_t par[3];
806 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
807 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
808 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
809
810 gMC->Gspos("RSNB",1,"RICH", 0*mm, 0*mm, -73.75*mm, 0,"ONLY"); //p.84 TDR sandbox to rich
811 gMC->Gspos("RSHO",1,"RSNB", 0*mm, 0*mm, 0*mm, 0,"ONLY"); //2072P1 honeycomv to sandbox
812 gMC->Gspos("RSCO",1,"RSNB", 0*mm, 0*mm, +25*mm, 0,"ONLY"); //cover to sandbox
813 gMC->Gspos("RSCO",2,"RSNB", 0*mm, 0*mm, -25*mm, 0,"ONLY"); //cover to sandbox
814}//GeomSandBox()
815//__________________________________________________________________________________________________
d3eb6079 816void AliRICH::GeomRadioSrc()const
a25b3368 817{
818// Defines geometry for radioactive source
819 Double_t cm=1,mm=0.1*cm,mkm=0.001*cm;
820 Float_t par[3];
821
822 par[0]=0 ;par[1]= 70*mm/2 ;par[2]= 30*mm/2; gMC->Gsvolu("RSRC","TUBE",(*fIdtmed)[kCH4] ,par,3); //top src container
823 par[0]=0 ;par[1]= 38*mm/2 ;par[2]= 21.8*mm/2; gMC->Gsvolu("RSAG","TUBE",(*fIdtmed)[kAl] ,par,3); //Al glass
824 par[0]=0 ;par[1]= 34*mm/2 ;par[2]= 20*mm/2; gMC->Gsvolu("RSPP","TUBE",(*fIdtmed)[kPerpex] ,par,3); //perpex plug
825 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
826 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
827 par[0]=0 ;par[1]= 1*mm/2 ;par[2]= 1*mm/2; gMC->Gsvolu("RSSR","TUBE",(*fIdtmed)[kSr90] ,par,3); //Sr90 source
828 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
829 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
830 par[0]=0 ;par[1]= 30*mm/2 ;par[2]= 50*mkm/2; gMC->Gsvolu("RSMF","TUBE",(*fIdtmed)[kMylar] ,par,3); //Mylar foil
831
832 gMC->Gspos("RSRC",1,"RICH", 30*cm, 0, 1*cm, 0,"ONLY"); //source to RICH
833 gMC->Gspos("RSMF",1,"RSRC", 0, 0,21.8*mm/2+50*mkm/2, 0,"ONLY");//mylar foil to top src volume
834 gMC->Gspos("RSAG",1,"RSRC", 0, 0, 0, 0,"ONLY");//Al glass to fake Src volume
835 gMC->Gspos("RSWA",1,"RSAG", 6*mm, 0, -10*mm, 0,"ONLY");//air whole in al glass bottom
836 gMC->Gspos("RSPP",1,"RSAG", 0, 0, 0.9*mm, 0,"ONLY");//perpex plug to Al glass
837 gMC->Gspos("RSWP",1,"RSPP", 6*mm, 0, -5*mm, 0,"ONLY");//air whole in perpex plug
838 gMC->Gspos("RSSC",1,"RSPP", 0, 0, 2.5*mm, 0,"ONLY");//steel screw in center of perpex plug
839 gMC->Gspos("RSSS",1,"RSPP", 6*mm, 0, 5*mm, 0,"ONLY");//steel screw to support Sr90 in perpex plug
840 gMC->Gspos("RSSR",1,"RSSS", 0, 0, -4.5*mm, 0,"ONLY");//Sr90 in support steel screw
841}//GeomSr90()
842//__________________________________________________________________________________________________
d3eb6079 843void AliRICH::GeomAerogel()const
a25b3368 844{
845//Creates detailed geometry for aerogel study.
846 AliDebug(1,"Start.");
847 Double_t cm=1;
848 Float_t par[3]; //tmp array for volume dimentions
849
850 par[0]=10.1*cm/2;par[1]=10.1*cm/2;par[2]=10.1*cm/2;
851 gMC->Gsvolu("RREF","BOX ",(*fIdtmed)[kReflector],par,3);//reflector box
852 gMC->Gspos("RREF",1,"RICH",0,0,0,0, "ONLY"); //put it to RICH volume
853
854 par[0]=10*cm/2;par[1]=10*cm/2;par[2]=10*cm/2;
855 gMC->Gsvolu("RGEL","BOX ",(*fIdtmed)[kGel],par,3);//10x10x10 cm^3 cubic of aerogel
856 gMC->Gspos("RGEL",1,"RREF",0,0,0,0,"ONLY");//put gel cell to reflector
857 AliDebug(1,"Stop.");
858}//GeomAerogel()
859//__________________________________________________________________________________________________
860void AliRICH::CreateGeometry()
861{
862//Creates detailed geometry simulation (currently GEANT volumes tree)
863 AliDebug(1,"Start main.");
864 Double_t mm=0.1;//default is cm
865 Float_t par[3];
866 Int_t matrixIdReturn=0; //matrix id returned by AliMatrix
867
868//place chambers into mother volume ALIC
869 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;
870 gMC->Gsvolu("RICH","BOX ",(*fIdtmed)[kCH4],par,3);//2033P1 z p84 TDR
871 for(int i=1;i<=P()->Nchambers();i++){ //test configuration with single chamber is taken into account automaticaly in AliRICHParam
872 AliMatrix(matrixIdReturn,
873 C(i)->ThetaXd(),C(i)->PhiXd(),
874 C(i)->ThetaYd(),C(i)->PhiYd(),
875 C(i)->ThetaZd(),C(i)->PhiZd());
876 gMC->Gspos("RICH",i,"ALIC",C(i)->Center().X(),
877 C(i)->Center().Y(),
878 C(i)->Center().Z(),matrixIdReturn, "ONLY");
879 }
880
881 if(P()->IsAerogel())
882 GeomAerogel();
883 else{
884 GeomPadPanelFrame();
885 GeomAmpGap();
886 if(P()->IsRadioSrc()) GeomRadioSrc(); else GeomRadiators();
887 GeomSandBox();
888 }
889 AliDebug(1,"Stop main.");
890}//CreateGeometry()
891//__________________________________________________________________________________________________
d3eb6079 892void AliRICH::CheckPR()const
893{
894//Pattern recognition with stack particles
895 TFile *pFile = new TFile("$(HOME)/RPR.root","RECREATE","RICH Pattern Recognition");
896 TNtupleD *hn = new TNtupleD("hn","ntuple","Pmod:Charge:TrackTheta:TrackPhi:TrackX:TrackY:MinX:MinY:ChargeMIP:ThetaCerenkov:NPhotons:MipIndex:Chamber:Particle");
ef210ba6 897// printf("\n\n");
898// printf("Pattern Recognition done for event %5i",0);
d3eb6079 899 AliMagF * magf = gAlice->Field();
900 AliTracker::SetFieldMap(magf);
901 for(Int_t iEvtN=0;iEvtN<GetLoader()->GetRunLoader()->GetNumberOfEvents();iEvtN++) {
902 GetLoader()->GetRunLoader()->GetEvent(iEvtN);
903 AliRICHTracker *tr = new AliRICHTracker();
904 tr->RecWithStack(hn);
ef210ba6 905 Info("CheckPR","Pattern Recognition done for event %i \b",iEvtN);
906// printf("\b\b\b\b\b%5i",iEvtN+1);
d3eb6079 907 }
908 printf("\n\n");
909 pFile->Write();pFile->Close();
910}
0fe8fa07 911//__________________________________________________________________________________________________
912void AliRICH::DisplayEvent(Int_t iEvtNmin,Int_t iEvtNmax)const
913{
914 TH2F *pDigitsH2[8];
915
916 Bool_t isDigits =!GetLoader()->LoadDigits();
917 if(!isDigits){Error("ShoEvent","No digits. Nothing to display.");return;}
918
919 TCanvas *canvas = new TCanvas("RICHDisplay","RICH Display",0,0,1226,900); canvas->Divide(3,3);
920// gStyle->SetPalette(1);
921
922
923 for(Int_t iChamber=1;iChamber<=7;iChamber++) {
924 pDigitsH2[iChamber] = new TH2F(Form("pDigitsH2_%i",iChamber),Form("Chamber %i",iChamber),165,0,P()->PcSizeX(),144,0,P()->PcSizeY());
925 pDigitsH2[iChamber]->SetMarkerColor(kGreen);
926 pDigitsH2[iChamber]->SetMarkerStyle(29);
927 pDigitsH2[iChamber]->SetMarkerSize(0.4);
928 pDigitsH2[iChamber]->SetStats(kFALSE);
929 }
930
931 if(iEvtNmax>gAlice->GetEventsPerRun()) iEvtNmax=gAlice->GetEventsPerRun();
932
933 TLatex t; t.SetTextSize(0.10);
934 t.DrawText(0.1,0.6,"RICH Display");
935 for(Int_t iEventN=iEvtNmin;iEventN<=iEvtNmax;iEventN++) {//events loop
936 canvas->cd(1);
937 t.DrawText(0.2,0.4,Form("Event Number %i",iEventN));
938
939 GetLoader()->GetRunLoader()->GetEvent(iEventN); //get event
940 GetLoader()->TreeD()->GetEntry(0); //get list of digits
941 for(Int_t iChamber=1;iChamber<=7;iChamber++) {//chambers loop
942 pDigitsH2[iChamber]->Reset();
943 for(Int_t j=0;j<Digits(iChamber)->GetEntries();j++) {//digits loop
944 AliRICHDigit *pDig = (AliRICHDigit*)Digits(iChamber)->At(j);
945 TVector2 x2=AliRICHParam::Pad2Loc(pDig->Pad());
946 pDigitsH2[iChamber]->Fill(x2.X(),x2.Y());
947 }//digits loop
948 if(iChamber==1) canvas->cd(7);
949 if(iChamber==2) canvas->cd(8);
950 if(iChamber==3) canvas->cd(4);
951 if(iChamber==4) canvas->cd(5);
952 if(iChamber==5) canvas->cd(6);
953 if(iChamber==6) canvas->cd(2);
954 if(iChamber==7) canvas->cd(3);
955 pDigitsH2[iChamber]->Draw();
956 }//chambers loop
957 canvas->Update();
958 canvas->Modified();
959
960 if(iEvtNmin<iEvtNmax) gPad->WaitPrimitive();
961 }//events loop
962}//ShowEvent()
963//__________________________________________________________________________________________________
964void AliRICH::Display()const
965{
966//Provides fast event display
967//For RICH only, full display is .x Display.C
968 Bool_t isHits =!GetLoader()->LoadHits();
969 Bool_t isDigits =!GetLoader()->LoadDigits();
970 Bool_t isClusters=!GetLoader()->LoadRecPoints();
971
972 if(!isHits && !isDigits && !isClusters){Error("Exec","No hits digits and clusters. Nothing to display.");return;}
973
974 TCanvas *pCanvas = new TCanvas("Display","RICH Display",0,0,600,600);
975
976 TH2F *pHitsH2=0,*pDigitsH2=0,*pClustersH2=0;
977
978 if(isHits) pHitsH2 = new TH2F("pHitsH2" , "Event Display;x,cm;y,cm",165,0,AliRICHParam::PcSizeX(),
979 144,0,AliRICHParam::PcSizeY());
980 if(pHitsH2) pHitsH2->SetStats(kFALSE);
981
982 if(isDigits) pDigitsH2 = new TH2F("pDigitsH2" ,"Event Display",165,0,AliRICHParam::PcSizeX(),
983 144,0,AliRICHParam::PcSizeY());
984 if(isClusters) pClustersH2 = new TH2F("pClustersH2","Event Display",165,0,AliRICHParam::PcSizeX(),
985 144,0,AliRICHParam::PcSizeY());
986
987 for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events Loop
988 GetLoader()->GetRunLoader()->GetEvent(iEventN);
989//display all the staff on chamber by chamber basis
990 for(Int_t iChamber=1;iChamber<=7;iChamber++){//chambers loop
991 if(isHits) pHitsH2 ->Reset();
992 if(isDigits) pDigitsH2 ->Reset();
993 if(isClusters) pClustersH2->Reset();
994//deals with hits
995 for(Int_t i=0;i<GetLoader()->TreeH()->GetEntries();i++){//TreeH loop
996 GetLoader()->TreeH()->GetEntry(i);
997 for(Int_t j=0;j<Hits()->GetEntries();j++){//hits loop
998 AliRICHHit *pHit = (AliRICHHit*)Hits()->At(j);
999 if(pHit->C()==iChamber){
1000 TVector3 hitGlobX3= pHit->OutX3();
1001 TVector2 hitLocX2 = C(iChamber)->Mrs2Pc(hitGlobX3);
1002 pHitsH2->Fill(hitLocX2.X(),hitLocX2.Y(),200);
1003 }//if
1004 }//hits loop
1005 }//TreeH loop
1006 pHitsH2->SetTitle(Form("event %i chamber %2i",iEventN,iChamber));
1007 pHitsH2->SetMarkerColor(kRed); pHitsH2->SetMarkerStyle(29); pHitsH2->SetMarkerSize(0.4);
1008 pHitsH2->Draw();
1009 AliRICHParam::DrawSectors();
1010 TLatex l; l.SetNDC(); l.SetTextSize(0.02);
1011 if(!isHits) {l.SetTextColor(kRed) ;l.DrawLatex(0.1,0.01,"No Hits" );}
1012 if(!isDigits) {l.SetTextColor(kGreen);l.DrawLatex(0.4,0.01,"No DIGITS" );}
1013 if(!isClusters) {l.SetTextColor(kBlue) ;l.DrawLatex(0.8,0.01,"No CLUSTERS");}
1014 pCanvas->Update(); pCanvas->Modified(); gPad->WaitPrimitive();
1015//deals with digits
1016 if(isDigits){
1017 GetLoader()->TreeD()->GetEntry(0);
1018 for(Int_t j=0;j<Digits(iChamber)->GetEntries();j++){//digits loop
1019 AliRICHDigit *pDig = (AliRICHDigit*)Digits(iChamber)->At(j);
1020 TVector2 x2=AliRICHParam::Pad2Loc(pDig->Pad());
1021 pDigitsH2->Fill(x2.X(),x2.Y(),100);
1022 }//digits loop
1023 pDigitsH2->SetMarkerColor(kGreen); pDigitsH2->SetMarkerStyle(29); pDigitsH2->SetMarkerSize(0.4);
1024 pDigitsH2->Draw("same");
1025 pCanvas->Update(); pCanvas->Modified(); gPad->WaitPrimitive();
1026 }//if(isDigits)
1027//deals with clusters
1028 if(isClusters){
1029 GetLoader()->TreeR()->GetEntry(0);
1030 for(Int_t j=0;j<Clusters(iChamber)->GetEntries();j++){//clusters loop
1031 AliRICHCluster *pClus = (AliRICHCluster*)Clusters(iChamber)->At(j);
1032 pClustersH2->Fill(pClus->X(),pClus->Y(),50);
1033 }//clusters loop
1034 pClustersH2->SetMarkerColor(kBlue); pClustersH2->SetMarkerStyle(29); pClustersH2->SetMarkerSize(0.4);
1035 pClustersH2->Draw("same");
1036 pCanvas->Update(); pCanvas->Modified(); gPad->WaitPrimitive();
1037 }//if(isClusters)
1038 }//chambers loop
1039 }//events Loop
1040
1041 delete pCanvas;
1042 GetLoader()->UnloadHits();
1043 if(isDigits) GetLoader()->UnloadDigits();
1044 if(isClusters) GetLoader()->UnloadRecPoints();
1045}//Display()
1046//__________________________________________________________________________________________________
1047Int_t AliRICH::Nparticles(Int_t iPartID,Int_t iEvtN,AliRunLoader *pRL)
1048{
1049//counts total number of particles of given type (including secondary) for a given event
1050 pRL->GetEvent(iEvtN);
1051 if(pRL->LoadHeader()) return 0;
1052 if(pRL->LoadKinematics()) return 0;
1053 AliStack *pStack=pRL->Stack();
1054
1055 Int_t iCounter=0;
1056 for(Int_t i=0;i<pStack->GetNtrack();i++){
1057 if(pStack->Particle(i)->GetPdgCode()==iPartID) iCounter++;
1058 }
1059
1060 pRL->UnloadHeader();
1061 pRL->UnloadKinematics();
1062 return iCounter;
1063}
1064//__________________________________________________________________________________________________
1065