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