]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/RICHpadtest.C
Testing TreeS, removing of output.
[u/mrichter/AliRoot.git] / RICH / RICHpadtest.C
CommitLineData
5bd23319 1void RICHpadtest (Int_t diaglevel,Int_t evNumber1=0,Int_t evNumber2=0)
2{
d2269328 3
6b1de171 4// Diaglevel
5// 1-> Single Ring Hits
6// 2-> Single Ring Spectra
7// 3-> Single Ring Statistics
8// 4-> Single Ring Reconstruction
9// 5-> Full Event Hits
d2269328 10
ddae0931 11/////////////////////////////////////////////////////////////////////////
12// This macro is a small example of a ROOT macro
13// illustrating how to read the output of GALICE
14// and do some analysis.
15//
16/////////////////////////////////////////////////////////////////////////
17
d2269328 18 gClassTable->GetID("AliRun");
ddae0931 19
20
21// Dynamically link some shared libs
22
23 if (gClassTable->GetID("AliRun") < 0) {
d2269328 24 gROOT->LoadMacro("loadlibs.C");
25 loadlibs();
b73bd8af 26 }else {
27 delete gAlice;
d2269328 28 gAlice = 0;
b73bd8af 29 }
ddae0931 30
d2269328 31 gAlice=0;
32
33// Connect the Root Galice file containing Geometry, Kine and Hits
34
35 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
6b1de171 36 if (!file) file = new TFile("galice.root","UPDATE");
d2269328 37
ddae0931 38// Get AliRun object from file or create it if not on file
d2269328 39
40 if (!gAlice) {
ddae0931 41 gAlice = (AliRun*)file->Get("gAlice");
42 if (gAlice) printf("AliRun object found on file\n");
43 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
d2269328 44 }
45 else {
46 delete gAlice;
47 gAlice = (AliRun*)file->Get("gAlice");
48 if (gAlice) printf("AliRun object found on file\n");
49 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
50 }
ddae0931 51
52// Create some histograms
53
b73bd8af 54 AliRICH *RICH = (AliRICH*)gAlice->GetDetector("RICH");
55 AliRICHSegmentationV0* segmentation;
56 AliRICHChamber* chamber;
57
58 chamber = &(RICH->Chamber(0));
59 segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel(0);
60
61 Int_t NpadX = segmentation->Npx(); // number of pads on X
62 Int_t NpadY = segmentation->Npy(); // number of pads on Y
63
64 Int_t Pad[144][160];
65 /*for (Int_t i=0;i<NpadX;i++) {
66 for (Int_t j=0;j<NpadY;j++) {
67 Pad[i][j]=0;
68 }
69 } */
70
71
d2269328 72 Int_t xmin= -NpadX/2;
73 Int_t xmax= NpadX/2;
74 Int_t ymin= -NpadY/2;
75 Int_t ymax= NpadY/2;
ddae0931 76
b73bd8af 77 TH2F *hc0 = new TH2F("hc0","Zoom on center of central chamber",150,-30,30,150,-50,10);
6b1de171 78
79 if (diaglevel == 1)
80
81 {
82 printf("Single Ring Hits\n");
b73bd8af 83 TH2F *feedback = new TH2F("feedback","Feedback hit distribution",150,-30,30,150,-50,10);
84 TH2F *mip = new TH2F("mip","Mip hit distribution",150,-30,30,150,-50,10);
85 TH2F *cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-30,30,150,-50,10);
86 TH2F *h = new TH2F("h","Detector hit distribution",150,-30,30,150,-50,10);
6b1de171 87 TH1F *hitsX = new TH1F("hitsX","Distribution of hits along x-axis",150,-30,30);
b73bd8af 88 TH1F *hitsY = new TH1F("hitsY","Distribution of hits along z-axis",150,-50,10);
6b1de171 89 }
90 else
91 {
92 printf("Full Event Hits\n");
93
94 TH2F *feedback = new TH2F("feedback","Feedback hit distribution",150,-300,300,150,-300,300);
95 TH2F *mip = new TH2F("mip","Mip hit distribution",150,-300,300,150,-300,300);
96 TH2F *cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-300,300,150,-300,300);
97 TH2F *h = new TH2F("h","Detector hit distribution",150,-300,300,150,-300,300);
98 TH1F *hitsX = new TH1F("digitsX","Distribution of hits along x-axis",200,-300,300);
99 TH1F *hitsY = new TH1F("digitsY","Distribution of hits along z-axis",200,-300,300);
6b1de171 100 }
be7c94f7 101
102
6b1de171 103
d2269328 104 TH2F *hc1 = new TH2F("hc1","Chamber 1 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
105 TH2F *hc2 = new TH2F("hc2","Chamber 2 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
106 TH2F *hc3 = new TH2F("hc3","Chamber 3 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
107 TH2F *hc4 = new TH2F("hc4","Chamber 4 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
108 TH2F *hc5 = new TH2F("hc5","Chamber 5 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
109 TH2F *hc6 = new TH2F("hc6","Chamber 6 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
110 TH2F *hc7 = new TH2F("hc7","Chamber 7 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
6b1de171 111
d2269328 112 TH1F *Clcharge = new TH1F("Clcharge","Cluster Charge Distribution",500,0.,500.);
d2269328 113 TH1F *ckovangle = new TH1F("ckovangle","Cerenkov angle per photon",200,.5,1);
114 TH1F *hckphi = new TH1F("hckphi","Cerenkov phi angle per photon",620,-3.1,3.1);
d2269328 115 TH1F *mother = new TH1F("mother","Cerenkovs per Mip",75,0.,75.);
116 TH1F *radius = new TH1F("radius","Mean distance to Mip",100,0.,20.);
6b1de171 117 TH1F *phspectra1 = new TH1F("phspectra1","Detected Photon Spectra",200,5.,10.);
118 TH1F *phspectra2 = new TH1F("phspectra2","Produced Photon Spectra",200,5.,10.);
119 TH1F *totalphotonstrack = new TH1F("totalphotonstrack","Produced Photons per Mip",100,200,700.);
120 TH1F *totalphotonsevent = new TH1F("totalphotonsevent","Produced Photons per Mip",100,200,700.);
d2269328 121 TH1F *feedbacks = new TH1F("feedbacks","Produced Feedbacks per Mip",50,0.5,50.);
122 TH1F *padnumber = new TH1F("padnumber","Number of pads per cluster",50,-0.5,50.);
6b1de171 123 TH1F *padsev = new TH1F("padsev","Number of pads hit per MIP",50,0.5,100.);
124 TH1F *clusev = new TH1F("clusev","Number of clusters per MIP",50,0.5,50.);
125 TH1F *photev = new TH1F("photev","Number of detected photons per MIP",50,0.5,50.);
126 TH1F *feedev = new TH1F("feedev","Number of feedbacks per MIP",50,0.5,50.);
d2269328 127 TH1F *padsmip = new TH1F("padsmip","Number of pads per event inside MIP region",50,0.5,50.);
128 TH1F *padscl = new TH1F("padscl","Number of pads per event from cluster count",50,0.5,100.);
129 TH1F *pionspectra = new TH1F("pionspectra","Pion Spectra",200,.5,10.);
130 TH1F *protonspectra = new TH1F("protonspectra","Proton Spectra",200,.5,10.);
131 TH1F *kaonspectra = new TH1F("kaonspectra","Kaon Spectra",100,.5,10.);
132 TH1F *kaonspectra = new TH1F("kaonspectra","Kaon Spectra",100,.5,10.);
133 TH1F *chargedspectra = new TH1F("chargedspectra","Charged particles above 1 GeV Spectra",100,.5,10.);
d2269328 134 TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
135 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence",100,0,15);
b3462c7e 136 TH1F *Omega1D = new TH1F("omega","Reconstructed Cerenkov angle per track",200,.5,1);
d2269328 137 TH1F *Theta = new TH1F("theta","Reconstructed theta incidence angle per track",200,0,15);
138 TH1F *Phi = new TH1F("phi","Reconstructed phi incidence per track",200,-180,180);
b3462c7e 139 TH1F *Omega3D = new TH1F("omega","Reconstructed Cerenkov angle per track",200,.5,1);
6b1de171 140 TH1F *PhotonCer = new TH1F("photoncer","Reconstructed Cerenkov angle per photon",200,.5,1);
141 TH2F *PadsUsed = new TH2F("padsused","Pads Used for Reconstruction",100,-30,30,100,-30,30);
ddae0931 142
143// Start loop over events
144
145 Int_t Nh=0;
d2269328 146 Int_t pads=0;
ddae0931 147 Int_t Nh1=0;
d2269328 148 Int_t mothers[80000];
149 Int_t mothers2[80000];
150 Float_t mom[3];
151 Int_t nraw=0;
152 Int_t phot=0;
153 Int_t feed=0;
154 Int_t padmip=0;
155 for (Int_t i=0;i<100;i++) mothers[i]=0;
ddae0931 156 for (int nev=0; nev<= evNumber2; nev++) {
d2269328 157 Int_t nparticles = gAlice->GetEvent(nev);
158
159
160 //cout<<"nev "<<nev<<endl;
a4622d0f 161 printf ("\n**********************************\nProcessing Event: %d\n",nev);
d2269328 162 //cout<<"nparticles "<<nparticles<<endl;
a4622d0f 163 printf ("Particles : %d\n\n",nparticles);
d2269328 164 if (nev < evNumber1) continue;
165 if (nparticles <= 0) return;
166
ddae0931 167// Get pointers to RICH detector and Hits containers
d2269328 168
d2269328 169 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
170 gAlice->TreeR()->GetEvent(nent-1);
171 TClonesArray *Rawclusters = RICH->RawClustAddress(2); // Raw clusters branch
172 //printf ("Rawclusters:%p",Rawclusters);
173 Int_t nrawclusters = Rawclusters->GetEntriesFast();
174 //printf (" nrawclusters:%d\n",nrawclusters);
175 gAlice->TreeR()->GetEvent(nent-1);
a4622d0f 176 TClonesArray *RecHits1D = RICH->RecHitsAddress1D(2);
177 Int_t nrechits1D = RecHits1D->GetEntriesFast();
d2269328 178 //printf (" nrechits:%d\n",nrechits);
b3462c7e 179 TClonesArray *RecHits3D = RICH->RecHitsAddress3D(2);
180 Int_t nrechits3D = RecHits3D->GetEntriesFast();
181 //printf (" nrechits:%d\n",nrechits);
d2269328 182 TTree *TH = gAlice->TreeH();
183 Int_t ntracks = TH->GetEntries();
ddae0931 184
b73bd8af 185 gAlice->ResetDigits();
d2269328 186 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
77e0774c 187 gAlice->TreeD()->GetEvent(1);
b73bd8af 188
189
190
191 // Start loop on tracks in the hits containers
d2269328 192 Int_t Nc=0;
193 for (Int_t track=0; track<ntracks;track++) {
a4622d0f 194 printf ("\nProcessing Track: %d\n",track);
d2269328 195 gAlice->ResetHits();
196 Int_t nbytes += TH->GetEvent(track);
197 if (RICH) {
198 //RICH->ResetRawClusters();
199 TClonesArray *PadHits = RICH->PadHits(); // Cluster branch
200 TClonesArray *Hits = RICH->Hits(); // Hits branch
201 TClonesArray *Cerenkovs = RICH->Cerenkovs(); // Cerenkovs branch
202 }
203 //see hits distribution
204
ddae0931 205
d2269328 206 Int_t nhits = Hits->GetEntriesFast();
207 if (nhits) Nh+=nhits;
185048a3 208 printf("Hits : %d\n",nhits);
d2269328 209 for (Int_t hit=0;hit<nhits;hit++) {
210 mHit = (AliRICHHit*) Hits->UncheckedAt(hit);
ddae0931 211 Int_t nch = mHit->fChamber; // chamber number
185048a3 212 Float_t x = mHit->X(); // x-pos of hit
213 Float_t y = mHit->Z(); // y-pos
d2269328 214 Float_t phi = mHit->fPhi; //Phi angle of incidence
215 Float_t theta = mHit->fTheta; //Theta angle of incidence
185048a3 216 Int_t index = mHit->Track();
d2269328 217 Int_t particle = mHit->fParticle;
218 Int_t freon = mHit->fLoss;
219
185048a3 220 hitsX->Fill(x,(float) 1);
221 hitsY->Fill(y,(float) 1);
d2269328 222
b73bd8af 223 //printf("Particle:%9d\n",particle);
d2269328 224
b73bd8af 225 TParticle *current = (TParticle*)gAlice->Particle(index);
226 //printf("Particle type: %d\n",sizeoff(Particles));
6b1de171 227
228 hitsTheta->Fill(theta,(float) 1);
229 if (RICH->GetDebugLevel() == -1)
b73bd8af 230 //printf("Theta:%f, Phi:%f\n",theta,phi);
6b1de171 231
232 //printf("Debug Level:%d\n",RICH->GetDebugLevel());
233
be7c94f7 234 if (TMath::Abs(particle) < 10000000)
d2269328 235 {
236 mip->Fill(x,y,(float) 1);
be7c94f7 237 //printf("adding mip\n");
d2269328 238 if (current->Energy() - current->GetCalcMass()>1 && freon==1)
239 {
240 hitsPhi->Fill(phi,(float) 1);
6b1de171 241 //hitsTheta->Fill(theta,(float) 1);
d2269328 242 //printf("Theta:%f, Phi:%f\n",theta,phi);
243 }
be7c94f7 244 }
d2269328 245
246 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
247 {
248 pionspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
249 }
250 if (TMath::Abs(particle)==2212)
251 {
252 protonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
253 }
254 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
255 || TMath::Abs(particle)==311)
256 {
257 kaonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
258 }
259 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
260 {
261 if (current->Energy() - current->GetCalcMass()>1)
262 chargedspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
263 }
264 //printf("Hits:%d\n",hit);
265 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
ddae0931 266 // Fill the histograms
d2269328 267 Nh1+=nhits;
268 h->Fill(x,y,(float) 1);
269 //}
270 //}
ddae0931 271 }
d2269328 272
273 Int_t ncerenkovs = Cerenkovs->GetEntriesFast();
6dcad8f7 274 //if (current->GetPdgCode() < 50000051 && current->GetPdgCode() > 50000040)
275 //totalphotonsevent->Fill(ncerenkovs,(float) 1);
d2269328 276
185048a3 277 if (ncerenkovs) {
278 printf("Cerenkovs : %d\n",ncerenkovs);
6dcad8f7 279 totalphotonsevent->Fill(ncerenkovs,(float) 1);
280 for (Int_t hit=0;hit<ncerenkovs;hit++) {
d2269328 281 cHit = (AliRICHCerenkov*) Cerenkovs->UncheckedAt(hit);
282 Int_t nchamber = cHit->fChamber; // chamber number
185048a3 283 Int_t index = cHit->Track();
d2269328 284 Int_t pindex = cHit->fIndex;
185048a3 285 Float_t cx = cHit->X(); // x-position
286 Float_t cy = cHit->Z(); // y-position
d2269328 287 Int_t cmother = cHit->fCMother; // Index of mother particle
288 Int_t closs = cHit->fLoss; // How did the particle get lost?
289 //printf ("Cerenkov hit, X:%d, Y:%d\n",cx,cy);
290
b73bd8af 291 //printf("Particle:%9d\n",index);
6dcad8f7 292
b73bd8af 293 TParticle *current = (TParticle*)gAlice->Particle(index);
6b1de171 294 Float_t energyckov = current->Energy();
d2269328 295
296 if (current->GetPdgCode() == 50000051)
6dcad8f7 297 {
d2269328 298 if (closs==4)
6dcad8f7 299 {
d2269328 300 feedback->Fill(cx,cy,(float) 1);
301 feed++;
6dcad8f7 302 }
303 }
d2269328 304 if (current->GetPdgCode() == 50000050)
6dcad8f7 305 {
306
307 if (closs !=4)
308 {
309 phspectra2->Fill(energyckov*1e9,(float) 1);
310 }
311
312 if (closs==4)
313 {
314 cerenkov->Fill(cx,cy,(float) 1);
315
316
b73bd8af 317 TParticle *MIP = (TParticle*)gAlice->Particle(cmother);
d2269328 318 mipHit = (AliRICHHit*) Hits->UncheckedAt(0);
319 mom[0] = current->Px();
320 mom[1] = current->Py();
321 mom[2] = current->Pz();
185048a3 322 //mom[0] = cHit->fMomX;
323 // mom[1] = cHit->fMomZ;
324 //mom[2] = cHit->fMomY;
d2269328 325 Float_t energymip = MIP->Energy();
b73bd8af 326 Float_t Mip_px = mipHit->fMomFreoX;
327 Float_t Mip_py = mipHit->fMomFreoY;
328 Float_t Mip_pz = mipHit->fMomFreoZ;
185048a3 329 //Float_t Mip_px = MIP->Px();
330 //Float_t Mip_py = MIP->Py();
331 //Float_t Mip_pz = MIP->Pz();
d2269328 332
333
334
335 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
336 Float_t rt = TMath::Sqrt(r);
337 Float_t Mip_r = Mip_px*Mip_px + Mip_py*Mip_py + Mip_pz*Mip_pz;
338 Float_t Mip_rt = TMath::Sqrt(Mip_r);
b73bd8af 339 Float_t coscerenkov = (mom[0]*Mip_px + mom[1]*Mip_py + mom[2]*Mip_pz)/(rt*Mip_rt+0.0000001);
d2269328 340 Float_t cherenkov = TMath::ACos(coscerenkov);
341 ckovangle->Fill(cherenkov,(float) 1); //Cerenkov angle calculus
342 //printf("Cherenkov: %f\n",cherenkov);
343 Float_t ckphi=TMath::ATan2(mom[0], mom[2]);
344 hckphi->Fill(ckphi,(float) 1);
345
346
347 Float_t mix = MIP->Vx();
348 Float_t miy = MIP->Vy();
185048a3 349 Float_t mx = mipHit->X();
350 Float_t my = mipHit->Z();
d2269328 351 //printf("FX %e, FY %e, VX %e, VY %e\n",cx,cy,mx,my);
352 Float_t dx = cx - mx;
353 Float_t dy = cy - my;
354 //printf("Dx:%f, Dy:%f\n",dx,dy);
355 Float_t final_radius = TMath::Sqrt(dx*dx+dy*dy);
356 //printf("Final radius:%f\n",final_radius);
357 radius->Fill(final_radius,(float) 1);
358
359 phspectra1->Fill(energyckov*1e9,(float) 1);
360 phot++;
361 }
d2269328 362 for (Int_t nmothers=0;nmothers<=ntracks;nmothers++){
363 if (cmother == nmothers){
364 if (closs == 4)
365 mothers2[cmother]++;
366 mothers[cmother]++;
367 }
368 }
369 }
370 }
371 }
372
373 if (nrawclusters) {
185048a3 374 printf("Raw Clusters : %d\n",nrawclusters);
d2269328 375 for (Int_t hit=0;hit<nrawclusters;hit++) {
376 rcHit = (AliRICHRawCluster*) Rawclusters->UncheckedAt(hit);
377 //Int_t nchamber = rcHit->fChamber; // chamber number
378 //Int_t nhit = cHit->fHitNumber; // hit number
379 Int_t qtot = rcHit->fQ; // charge
380 Int_t fx = rcHit->fX; // x-position
381 Int_t fy = rcHit->fY; // y-position
382 Int_t type = rcHit->fCtype; // cluster type ?
383 Int_t mult = rcHit->fMultiplicity; // How many pads form the cluster
384 pads += mult;
385 if (qtot > 0) {
6dcad8f7 386 //printf ("fx: %d, fy: %d\n",fx,fy);
b73bd8af 387 if (fx>(x-4) && fx<(x+4) && fy>(y-4) && fy<(y+4)) {
6dcad8f7 388 //printf("There %d \n",mult);
389 padmip+=mult;
390 } else {
391 padnumber->Fill(mult,(float) 1);
392 nraw++;
393 if (mult<4) Clcharge->Fill(qtot,(float) 1);
394 }
be7c94f7 395
d2269328 396 }
397 }
398 }
399
a4622d0f 400 if(nrechits1D)
d2269328 401 {
a4622d0f 402 for (Int_t hit=0;hit<nrechits1D;hit++) {
403 recHit1D = (AliRICHRecHit1D*) RecHits1D->UncheckedAt(hit);
404 Float_t r_omega = recHit1D->fOmega; // Cerenkov angle
a4622d0f 405 Float_t *cer_pho = recHit1D->fCerPerPhoton; // Cerenkov angle per photon
406 Int_t *padsx = recHit1D->fPadsUsedX; // Pads Used fo reconstruction (x)
407 Int_t *padsy = recHit1D->fPadsUsedY; // Pads Used fo reconstruction (y)
408 Int_t goodPhotons = recHit1D->fGoodPhotons; // Number of pads used for reconstruction
d2269328 409
b3462c7e 410 Omega1D->Fill(r_omega,(float) 1);
411
6b1de171 412 for (Int_t i=0; i<goodPhotons; i++)
413 {
414 PhotonCer->Fill(cer_pho[i],(float) 1);
415 PadsUsed->Fill(padsx[i],padsy[i],1);
416 //printf("Angle:%f, pad: %d %d\n",cer_pho[i],padsx[i],padsy[i]);
417 }
d2269328 418
419 //printf("Omega: %f, Theta: %f, Phi: %f\n",r_omega,r_theta,r_phi);
420 }
421 }
b3462c7e 422
423 if(nrechits3D)
424 {
425 for (Int_t hit=0;hit<nrechits3D;hit++) {
426 recHit3D = (AliRICHRecHit3D*) RecHits3D->UncheckedAt(hit);
427 Float_t r_omega = recHit3D->fOmega; // Cerenkov angle
428 Float_t r_theta = recHit3D->fTheta; // Theta angle of incidence
429 Float_t r_phi = recHit3D->fPhi; // Phi angle if incidence
430
431
432 Omega3D->Fill(r_omega,(float) 1);
433 Theta->Fill(r_theta*180/TMath::Pi(),(float) 1);
434 Phi->Fill(r_phi*180/TMath::Pi(),(float) 1);
435
436 }
437 }
ddae0931 438 }
d2269328 439
440 for (Int_t nmothers=0;nmothers<ntracks;nmothers++){
6b1de171 441 totalphotonstrack->Fill(mothers[nmothers],(float) 1);
d2269328 442 mother->Fill(mothers2[nmothers],(float) 1);
443 //printf ("Entries in %d : %d\n",nmothers, mothers[nmothers]);
444 }
445
446 clusev->Fill(nraw,(float) 1);
447 photev->Fill(phot,(float) 1);
448 feedev->Fill(feed,(float) 1);
449 padsmip->Fill(padmip,(float) 1);
450 padscl->Fill(pads,(float) 1);
451 //printf("Photons:%d\n",phot);
452 phot = 0;
453 feed = 0;
454 pads = 0;
455 nraw=0;
456 padmip=0;
ddae0931 457
6dcad8f7 458 if (diaglevel < 4)
6b1de171 459 {
6dcad8f7 460
b73bd8af 461
462 TClonesArray *Digits = RICH->DigitsAddress(2);
6b1de171 463 Int_t ndigits = Digits->GetEntriesFast();
be7c94f7 464 printf("Digits : %d\n",ndigits);
6dcad8f7 465 padsev->Fill(ndigits,(float) 1);
466 for (Int_t hit=0;hit<ndigits;hit++) {
467 dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
468 Int_t qtot = dHit->fSignal; // charge
469 Int_t ipx = dHit->fPadX; // pad number on X
470 Int_t ipy = dHit->fPadY; // pad number on Y
471 //printf("%d, %d\n",ipx,ipy);
472 if( ipx<=100 && ipy <=100) hc0->Fill(ipx,ipy,(float) qtot);
6b1de171 473 }
474 }
b73bd8af 475
6dcad8f7 476 if (diaglevel == 5)
477 {
478 for (Int_t ich=0;ich<7;ich++)
479 {
480 TClonesArray *Digits = RICH->DigitsAddress(ich); // Raw clusters branch
481 Int_t ndigits = Digits->GetEntriesFast();
482 //printf("Digits:%d\n",ndigits);
483 padsev->Fill(ndigits,(float) 1);
484 if (ndigits) {
485 for (Int_t hit=0;hit<ndigits;hit++) {
486 dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
be7c94f7 487 //Int_t nchamber = dHit->fChamber; // chamber number
6dcad8f7 488 //Int_t nhit = dHit->fHitNumber; // hit number
489 Int_t qtot = dHit->fSignal; // charge
490 Int_t ipx = dHit->fPadX; // pad number on X
491 Int_t ipy = dHit->fPadY; // pad number on Y
492 //Int_t iqpad = dHit->fQpad; // charge per pad
493 //Int_t rpad = dHit->fRSec; // R-position of pad
494 //printf ("Pad hit, PadX:%d, PadY:%d\n",ipx,ipy);
495 if( ipx<=100 && ipy <=100 && ich==2) hc0->Fill(ipx,ipy,(float) qtot);
496 if( ipx<=162 && ipy <=162 && ich==0) hc1->Fill(ipx,ipy,(float) qtot);
497 if( ipx<=162 && ipy <=162 && ich==1) hc2->Fill(ipx,ipy,(float) qtot);
498 if( ipx<=162 && ipy <=162 && ich==2) hc3->Fill(ipx,ipy,(float) qtot);
499 if( ipx<=162 && ipy <=162 && ich==3) hc4->Fill(ipx,ipy,(float) qtot);
500 if( ipx<=162 && ipy <=162 && ich==4) hc5->Fill(ipx,ipy,(float) qtot);
501 if( ipx<=162 && ipy <=162 && ich==5) hc6->Fill(ipx,ipy,(float) qtot);
502 if( ipx<=162 && ipy <=162 && ich==6) hc7->Fill(ipx,ipy,(float) qtot);
503 }
504 }
505 }
506 }
d2269328 507 }
6b1de171 508
ddae0931 509
d2269328 510 //Create canvases, set the view range, show histograms
ddae0931 511
b73bd8af 512 switch(diaglevel)
d2269328 513 {
514 case 1:
6b1de171 515
516 TCanvas *c1 = new TCanvas("c1","Alice RICH digits",50,50,300,350);
517 hc0->SetXTitle("ix (npads)");
518 hc0->Draw("box");
519
d2269328 520//
6b1de171 521 TCanvas *c4 = new TCanvas("c4","Hits per type",100,100,600,700);
d2269328 522 c4->Divide(2,2);
b73bd8af 523 //c4->SetFillColor(42);
524
d2269328 525 c4->cd(1);
6b1de171 526 feedback->SetXTitle("x (cm)");
527 feedback->SetYTitle("y (cm)");
d2269328 528 feedback->Draw();
529
530 c4->cd(2);
b73bd8af 531 //mip->SetFillColor(5);
6b1de171 532 mip->SetXTitle("x (cm)");
533 mip->SetYTitle("y (cm)");
d2269328 534 mip->Draw();
535
536 c4->cd(3);
b73bd8af 537 //cerenkov->SetFillColor(5);
6b1de171 538 cerenkov->SetXTitle("x (cm)");
539 cerenkov->SetYTitle("y (cm)");
d2269328 540 cerenkov->Draw();
541
542 c4->cd(4);
b73bd8af 543 //h->SetFillColor(5);
d2269328 544 h->SetXTitle("x (cm)");
545 h->SetYTitle("y (cm)");
546 h->Draw();
547
6b1de171 548 TCanvas *c10 = new TCanvas("c10","Hits distribution",150,150,600,350);
d2269328 549 c10->Divide(2,1);
b73bd8af 550 //c10->SetFillColor(42);
d2269328 551
552 c10->cd(1);
b73bd8af 553 hitsX->SetFillColor(5);
5bd23319 554 hitsX->SetXTitle("(cm)");
d2269328 555 hitsX->Draw();
556
557 c10->cd(2);
b73bd8af 558 hitsY->SetFillColor(5);
5bd23319 559 hitsY->SetXTitle("(cm)");
d2269328 560 hitsY->Draw();
561
562
563 break;
564//
565 case 2:
566
6b1de171 567 TCanvas *c6 = new TCanvas("c6","Photon Spectra",50,50,600,350);
d2269328 568 c6->Divide(2,1);
b73bd8af 569 //c6->SetFillColor(42);
d2269328 570
571 c6->cd(1);
b73bd8af 572 phspectra2->SetFillColor(5);
d2269328 573 phspectra2->SetXTitle("energy (eV)");
574 phspectra2->Draw();
575 c6->cd(2);
b73bd8af 576 phspectra1->SetFillColor(5);
d2269328 577 phspectra1->SetXTitle("energy (eV)");
578 phspectra1->Draw();
579
6b1de171 580 TCanvas *c9 = new TCanvas("c9","Particles Spectra",100,100,600,700);
d2269328 581 c9->Divide(2,2);
b73bd8af 582 //c9->SetFillColor(42);
d2269328 583
584 c9->cd(1);
b73bd8af 585 pionspectra->SetFillColor(5);
d2269328 586 pionspectra->SetXTitle("(GeV)");
587 pionspectra->Draw();
588
589 c9->cd(2);
b73bd8af 590 protonspectra->SetFillColor(5);
d2269328 591 protonspectra->SetXTitle("(GeV)");
592 protonspectra->Draw();
593
594 c9->cd(3);
b73bd8af 595 kaonspectra->SetFillColor(5);
d2269328 596 kaonspectra->SetXTitle("(GeV)");
597 kaonspectra->Draw();
598
599 c9->cd(4);
b73bd8af 600 chargedspectra->SetFillColor(5);
d2269328 601 chargedspectra->SetXTitle("(GeV)");
602 chargedspectra->Draw();
ddae0931 603
d2269328 604 break;
605
606 case 3:
607
608 if (nrawclusters) {
6b1de171 609 TCanvas *c3=new TCanvas("c3","Clusters Statistics",50,50,600,700);
d2269328 610 c3->Divide(2,2);
b73bd8af 611 //c3->SetFillColor(42);
d2269328 612
613 c3->cd(1);
be7c94f7 614 c3_1->SetLogy();
b73bd8af 615 Clcharge->SetFillColor(5);
be7c94f7 616 Clcharge->SetXTitle("ADC counts");
617 Clcharge->Fit("expo");
618 expo->SetLineColor(2);
619 expo->SetLineWidth(3);
d2269328 620 Clcharge->Draw();
621
622 c3->cd(2);
b73bd8af 623 padnumber->SetFillColor(5);
d2269328 624 padnumber->SetXTitle("(counts)");
625 padnumber->Draw();
626
627 c3->cd(3);
b73bd8af 628 clusev->SetFillColor(5);
d2269328 629 clusev->SetXTitle("(counts)");
be7c94f7 630 clusev->Fit("gaus");
631 gaus->SetLineColor(2);
632 gaus->SetLineWidth(3);
d2269328 633 clusev->Draw();
ddae0931 634
d2269328 635 c3->cd(4);
b73bd8af 636 padsmip->SetFillColor(5);
d2269328 637 padsmip->SetXTitle("(counts)");
638 padsmip->Draw();
639 }
be7c94f7 640
d2269328 641 if (nev<1)
642 {
643 TCanvas *c11 = new TCanvas("c11","Cherenkov per Mip",400,10,600,700);
b73bd8af 644 mother->SetFillColor(5);
d2269328 645 mother->SetXTitle("counts");
646 mother->Draw();
647 }
6b1de171 648
649 TCanvas *c7 = new TCanvas("c7","Production Statistics",100,100,600,700);
650 c7->Divide(2,2);
b73bd8af 651 //c7->SetFillColor(42);
6b1de171 652
653 c7->cd(1);
b73bd8af 654 totalphotonsevent->SetFillColor(5);
6b1de171 655 totalphotonsevent->SetXTitle("Photons (counts)");
be7c94f7 656 totalphotonsevent->Fit("gaus");
657 gaus->SetLineColor(2);
658 gaus->SetLineWidth(3);
6b1de171 659 totalphotonsevent->Draw();
d2269328 660
6b1de171 661 c7->cd(2);
b73bd8af 662 photev->SetFillColor(5);
6b1de171 663 photev->SetXTitle("(counts)");
be7c94f7 664 photev->Fit("gaus");
665 gaus->SetLineColor(2);
666 gaus->SetLineWidth(3);
6b1de171 667 photev->Draw();
668
669 c7->cd(3);
b73bd8af 670 feedev->SetFillColor(5);
6b1de171 671 feedev->SetXTitle("(counts)");
be7c94f7 672 feedev->Fit("gaus");
673 gaus->SetLineColor(2);
674 gaus->SetLineWidth(3);
6b1de171 675 feedev->Draw();
676
677 c7->cd(4);
b73bd8af 678 padsev->SetFillColor(5);
6b1de171 679 padsev->SetXTitle("(counts)");
be7c94f7 680 padsev->Fit("gaus");
681 gaus->SetLineColor(2);
682 gaus->SetLineWidth(3);
6b1de171 683 padsev->Draw();
684
685 break;
686
687 case 4:
688
689 TCanvas *c2 = new TCanvas("c2","Angles of incidence",50,50,600,700);
d2269328 690 c2->Divide(2,2);
b73bd8af 691 //c2->SetFillColor(42);
d2269328 692
693 c2->cd(1);
b73bd8af 694 hitsPhi->SetFillColor(5);
d2269328 695 hitsPhi->Draw();
696 c2->cd(2);
b73bd8af 697 hitsTheta->SetFillColor(5);
d2269328 698 hitsTheta->Draw();
699 c2->cd(3);
b73bd8af 700 Phi->SetFillColor(5);
d2269328 701 Phi->Draw();
702 c2->cd(4);
b73bd8af 703 Theta->SetFillColor(5);
d2269328 704 Theta->Draw();
705
706
6b1de171 707 TCanvas *c5 = new TCanvas("c5","Ring Reconstruction",100,100,900,700);
b3462c7e 708 c5->Divide(3,3);
b73bd8af 709 //c5->SetFillColor(42);
d2269328 710
711 c5->cd(1);
b73bd8af 712 ckovangle->SetFillColor(5);
d2269328 713 ckovangle->SetXTitle("angle (radians)");
714 ckovangle->Draw();
715
716 c5->cd(2);
b73bd8af 717 radius->SetFillColor(5);
d2269328 718 radius->SetXTitle("radius (cm)");
719 radius->Draw();
6b1de171 720
d2269328 721 c5->cd(3);
6b1de171 722 hc0->SetXTitle("pads");
723 hc0->Draw("box");
724
725 c5->cd(5);
b73bd8af 726 Omega1D->SetFillColor(5);
b3462c7e 727 Omega1D->SetXTitle("angle (radians)");
728 Omega1D->Draw();
d2269328 729
6b1de171 730 c5->cd(4);
b73bd8af 731 PhotonCer->SetFillColor(5);
6b1de171 732 PhotonCer->SetXTitle("angle (radians)");
733 PhotonCer->Draw();
734
735 c5->cd(6);
736 PadsUsed->SetXTitle("pads");
737 PadsUsed->Draw("box");
d2269328 738
b3462c7e 739 c5->cd(7);
b73bd8af 740 Omega3D->SetFillColor(5);
b3462c7e 741 Omega3D->SetXTitle("angle (radians)");
742 Omega3D->Draw();
743
6b1de171 744 break;
745
746 case 5:
d2269328 747
be7c94f7 748 printf("Drawing histograms.../n");
749
52c3c553 750 //if (ndigits)
751 //{
b73bd8af 752 TCanvas *c1 = new TCanvas("c1","Alice RICH digits",50,50,1200,700);
753 c1->Divide(4,2);
754 //c1->SetFillColor(42);
755
756 c1->cd(1);
757 hc1->SetXTitle("ix (npads)");
758 hc1->Draw("box");
759 c1->cd(2);
760 hc2->SetXTitle("ix (npads)");
761 hc2->Draw("box");
762 c1->cd(3);
763 hc3->SetXTitle("ix (npads)");
764 hc3->Draw("box");
765 c1->cd(4);
766 hc4->SetXTitle("ix (npads)");
767 hc4->Draw("box");
768 c1->cd(5);
769 hc5->SetXTitle("ix (npads)");
770 hc5->Draw("box");
771 c1->cd(6);
772 hc6->SetXTitle("ix (npads)");
773 hc6->Draw("box");
774 c1->cd(7);
775 hc7->SetXTitle("ix (npads)");
776 hc7->Draw("box");
777 c1->cd(8);
778 hc0->SetXTitle("ix (npads)");
779 hc0->Draw("box");
52c3c553 780 //}
6b1de171 781//
782 TCanvas *c4 = new TCanvas("c4","Hits per type",100,100,600,700);
783 c4->Divide(2,2);
b73bd8af 784 //c4->SetFillColor(42);
d2269328 785
6b1de171 786 c4->cd(1);
787 feedback->SetXTitle("x (cm)");
788 feedback->SetYTitle("y (cm)");
789 feedback->Draw();
790
791 c4->cd(2);
b73bd8af 792 //mip->SetFillColor(5);
6b1de171 793 mip->SetXTitle("x (cm)");
794 mip->SetYTitle("y (cm)");
795 mip->Draw();
796
797 c4->cd(3);
b73bd8af 798 //cerenkov->SetFillColor(5);
6b1de171 799 cerenkov->SetXTitle("x (cm)");
800 cerenkov->SetYTitle("y (cm)");
801 cerenkov->Draw();
802
803 c4->cd(4);
b73bd8af 804 //h->SetFillColor(5);
6b1de171 805 h->SetXTitle("x (cm)");
806 h->SetYTitle("y (cm)");
807 h->Draw();
d2269328 808
6b1de171 809 TCanvas *c10 = new TCanvas("c10","Hits distribution",150,150,600,350);
810 c10->Divide(2,1);
b73bd8af 811 //c10->SetFillColor(42);
6b1de171 812
813 c10->cd(1);
b73bd8af 814 hitsX->SetFillColor(5);
6b1de171 815 hitsX->SetXTitle("(cm)");
816 hitsX->Draw();
817
818 c10->cd(2);
b73bd8af 819 hitsY->SetFillColor(5);
6b1de171 820 hitsY->SetXTitle("(cm)");
821 hitsY->Draw();
822
d2269328 823 break;
824
825 }
826
827
828 // calculate the number of pads which give a signal
829
830
831 Int_t Np=0;
b73bd8af 832 /*for (Int_t i=0;i< NpadX;i++) {
d2269328 833 for (Int_t j=0;j< NpadY;j++) {
834 if (Pad[i][j]>=6){
835 Np+=1;
836 }
837 }
b73bd8af 838 }*/
d2269328 839 //printf("The total number of pads which give a signal: %d %d\n",Nh,Nh1);
185048a3 840 printf("\nEnd of macro\n");
841 printf("**********************************\n");
ddae0931 842}
d2269328 843
844