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