1 void RICHgainvar (Int_t evNumber1=0,Int_t evNumber2=0)
4 gClassTable->GetID("AliRun");
7 // Dynamically link some shared libs
9 if (gClassTable->GetID("AliRun") < 0) {
10 gROOT->LoadMacro("loadlibs.C");
19 // Connect the Root Galice file containing Geometry, Kine and Hits
21 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
22 if (!file) file = new TFile("galice.root","UPDATE");
24 // Get AliRun object from file or create it if not on file
27 gAlice = (AliRun*)file->Get("gAlice");
28 if (gAlice) printf("AliRun object found on file\n");
29 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
33 gAlice = (AliRun*)file->Get("gAlice");
34 if (gAlice) printf("AliRun object found on file\n");
35 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
38 AliRICH *RICH = (AliRICH*)gAlice->GetDetector("RICH");
40 TH1F *gainX = new TH1F("gainX","Gain along the wires",40,0,40);
41 TH1F *gainIn = new TH1F("gainIn","Gain near the center of photocathode",300,0,300);
42 TH1F *gainOut = new TH1F("gainOut","Gain near the edge of photocathode",300,0,300);
43 TH1F *gainPhi1 = new TH1F("gainPhi1","Gain variation along wires, 0-30 degrees",300,0,300);
44 TH1F *gainPhi2 = new TH1F("gainPhi2","Gain variation along wires, 30-60 degrees",300,0,300);
45 TH1F *gainPhi3 = new TH1F("gainPhi3","Gain variation along wires, 60-90 degrees",300,0,300);
46 TH1F *gainPhi4 = new TH1F("gainPhi4","Gain variation along wires, 90-120 degrees",300,0,300);
47 TH1F *gainPhi5 = new TH1F("gainPhi5","Gain variation along wires, 120-150 degrees",300,0,300);
48 TH1F *gainPhi6 = new TH1F("gainPhi6","Gain variation along wires, 150-180 degrees",300,0,300);
49 TH1F *gainPhi7 = new TH1F("gainPhi7","Gain variation along wires, 180-210 degrees",300,0,300);
50 TH1F *gainPhi8 = new TH1F("gainPhi8","Gain variation along wires, 210-240 degrees",300,0,300);
51 TH1F *gainPhi9 = new TH1F("gainPhi9","Gain variation along wires, 240-270 degrees",300,0,300);
52 TH1F *gainPhi10 = new TH1F("gainPhi10","Gain variation along wires, 270-300 degrees",300,0,300);
53 TH1F *gainPhi11 = new TH1F("gainPhi11","Gain variation along wires, 300-330 degrees",300,0,300);
54 TH1F *gainPhi12 = new TH1F("gainPhi12","Gain variation along wires, 330-360 degrees",300,0,300);
55 TH1F *gainPhi = new TH1F("gainPhi","Gain variation along phi",36,0,360);
57 // Start loop over events
59 for (int nev=0; nev<= evNumber2; nev++) {
60 Int_t nparticles = gAlice->GetEvent(nev);
63 printf ("\n**********************************\nProcessing Event: %d\n",nev);
64 printf ("Particles : %d\n\n",nparticles);
65 if (nev < evNumber1) continue;
66 if (nparticles <= 0) return;
68 // Get pointers to RICH detector and Hits containers
71 TTree *TH = gAlice->TreeH();
72 Int_t ntracks = TH->GetEntries();
73 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
74 gAlice->TreeR()->GetEvent(nent-1);
75 TClonesArray *Rawclusters = RICH->RawClustAddress(2); // Raw clusters branch
76 //printf ("Rawclusters:%p",Rawclusters);
77 Int_t nrawclusters = Rawclusters->GetEntriesFast();
78 //printf (" nrawclusters:%d\n",nrawclusters);
81 // Start loop on tracks in the hits containers
83 for (Int_t track=0; track<ntracks;track++) {
84 printf ("\nProcessing Track: %d\n",track);
86 Int_t nbytes += TH->GetEvent(track);
88 TClonesArray *Hits = RICH->Hits(); // Hits branch
89 //see hits distribution
91 Int_t nhits = Hits->GetEntriesFast();
92 printf("Hits : %d\n",nhits);
93 for (Int_t hit=0;hit<nhits;hit++) {
94 mHit = (AliRICHHit*) Hits->UncheckedAt(hit);
95 Float_t mx = mHit->X(); // x-pos of hit
96 Float_t my = mHit->Z(); // y-pos
101 printf("Raw Clusters : %d\n",nrawclusters);
102 for (Int_t hit=0;hit<nrawclusters;hit++) {
103 rcHit = (AliRICHRawCluster*) Rawclusters->UncheckedAt(hit);
104 //Int_t nchamber = rcHit->fChamber; // chamber number
105 //Int_t nhit = cHit->fHitNumber; // hit number
106 Int_t qtot = rcHit->fQ; // charge
107 Int_t fx = rcHit->fX; // x-position
108 Int_t fy = rcHit->fY; // y-position
109 Int_t mult = rcHit->fMultiplicity; // How many pads form the cluster
111 Float_t radfid = TMath::Sqrt((TMath::Power(fx-mx,2)+(TMath::Power(fy-my,2))));
112 //printf("Radius:%f\n", radfid);
115 if(qtot<200 && radfid>=9 && radfid<=15)
118 gainX->Fill(fy-40,(float) qtot);
120 gainX->Fill(fy+40,(float) qtot);
123 gainOut->Fill(qtot,(float) 1);
124 if(fy<=-11 && fy>=-15)
125 gainIn->Fill(qtot,(float) 1);
127 Float_t phi = TMath::ATan2(fx-mx, fy-my);
128 Float_t phi_deg = phi/TMath::Pi()*180;
132 phi_deg = 360+phi_deg;
133 //printf("X:%f, Y:%f, Phi:%f\n",-fy+my,fx-mx,phi_deg);
137 //printf("X:%f, Y:%f, Phi:%f\n",-fy+my,fx-mx,phi_deg);
141 if (phi_deg>=0 && phi_deg<30)
142 gainPhi1->Fill(qtot,(float) 1);
143 if (phi_deg>=30 && phi_deg<60)
144 gainPhi2->Fill(qtot,(float) 1);
145 if (phi_deg>=60 && phi_deg<90)
146 gainPhi3->Fill(qtot,(float) 1);
147 if (phi_deg>=90 && phi_deg<120)
148 gainPhi4->Fill(qtot,(float) 1);
149 if (phi_deg>=120 && phi_deg<150)
150 gainPhi5->Fill(qtot,(float) 1);
151 if (phi_deg>=150 && phi_deg<180)
152 gainPhi6->Fill(qtot,(float) 1);
153 if (phi_deg>=180 && phi_deg<210)
154 gainPhi7->Fill(qtot,(float) 1);
155 if (phi_deg>=210 && phi_deg<240)
156 gainPhi8->Fill(qtot,(float) 1);
157 if (phi_deg>=240 && phi_deg<270)
158 gainPhi9->Fill(qtot,(float) 1);
159 if (phi_deg>=270 && phi_deg<300)
160 gainPhi10->Fill(qtot,(float) 1);
161 if (phi_deg>=300 && phi_deg<330)
162 gainPhi11->Fill(qtot,(float) 1);
163 if (phi_deg>=330 && phi_deg<360)
164 gainPhi12->Fill(qtot,(float) 1);
168 //printf("Y:%d, Q:%d %d in %d\n",fy, qtot,hit,nrawclusters);
175 TCanvas *c16 = new TCanvas("c16","Gain Variation over Phi",50,50,1200,700);
177 //c16->SetFillColor(42);
181 gainPhi1->SetFillColor(5);
182 gainPhi1->SetXTitle("ADC counts");
183 gainPhi1->Fit("expo","M");
184 expo->SetLineColor(2);
185 expo->SetLineWidth(3);
186 Float_t inv_slope1 = -1/expo->GetParameter(1);
187 gainPhi->Fill(15, (float) inv_slope1);
192 gainPhi2->SetFillColor(5);
193 gainPhi2->SetXTitle("ADC counts");
194 gainPhi2->Fit("expo","M");
195 expo->SetLineColor(2);
196 expo->SetLineWidth(3);
197 Float_t inv_slope2 = -1/expo->GetParameter(1);
198 gainPhi->Fill(45, (float) inv_slope2);
203 gainPhi3->SetFillColor(5);
204 gainPhi3->SetXTitle("ADC counts");
205 gainPhi3->Fit("expo","M");
206 expo->SetLineColor(2);
207 expo->SetLineWidth(3);
208 Float_t inv_slope3 = -1/expo->GetParameter(1);
209 gainPhi->Fill(75, (float) inv_slope3);
214 gainPhi4->SetFillColor(5);
215 gainPhi4->SetXTitle("ADC counts");
216 gainPhi4->Fit("expo","M");
217 expo->SetLineColor(2);
218 expo->SetLineWidth(3);
219 Float_t inv_slope4 = -1/expo->GetParameter(1);
220 gainPhi->Fill(105, (float) inv_slope4);
225 gainPhi5->SetFillColor(5);
226 gainPhi5->SetXTitle("ADC counts");
227 gainPhi5->Fit("expo","M");
228 expo->SetLineColor(2);
229 expo->SetLineWidth(3);
230 Float_t inv_slope5 = -1/expo->GetParameter(1);
231 gainPhi->Fill(135, (float) inv_slope5);
236 gainPhi6->SetFillColor(5);
237 gainPhi6->SetXTitle("ADC counts");
238 gainPhi6->Fit("expo","M");
239 expo->SetLineColor(2);
240 expo->SetLineWidth(3);
241 Float_t inv_slope6 = -1/expo->GetParameter(1);
242 gainPhi->Fill(165, (float) inv_slope6);
247 gainPhi7->SetFillColor(5);
248 gainPhi7->SetXTitle("ADC counts");
249 gainPhi7->Fit("expo","M");
250 expo->SetLineColor(2);
251 expo->SetLineWidth(3);
252 Float_t inv_slope7 = -1/expo->GetParameter(1);
253 gainPhi->Fill(195, (float) inv_slope7);
258 gainPhi8->SetFillColor(5);
259 gainPhi8->SetXTitle("ADC counts");
260 gainPhi8->Fit("expo","M");
261 expo->SetLineColor(2);
262 expo->SetLineWidth(3);
263 Float_t inv_slope8 = -1/expo->GetParameter(1);
264 gainPhi->Fill(225, (float) inv_slope8);
269 gainPhi9->SetFillColor(5);
270 gainPhi9->SetXTitle("ADC counts");
271 gainPhi9->Fit("expo","M");
272 expo->SetLineColor(2);
273 expo->SetLineWidth(3);
274 Float_t inv_slope9 = -1/expo->GetParameter(1);
275 gainPhi->Fill(255, (float) inv_slope9);
282 gainPhi10->SetFillColor(5);
283 gainPhi10->SetXTitle("ADC counts");
284 gainPhi10->Fit("expo","M");
285 expo->SetLineColor(2);
286 expo->SetLineWidth(3);
287 Float_t inv_slope10 = -1/expo->GetParameter(1);
288 gainPhi->Fill(285, (float) inv_slope10);
293 gainPhi11->SetFillColor(5);
294 gainPhi11->SetXTitle("ADC counts");
295 gainPhi11->Fit("expo","M");
296 expo->SetLineColor(2);
297 expo->SetLineWidth(3);
298 Float_t inv_slope11 = -1/expo->GetParameter(1);
299 gainPhi->Fill(315, (float) inv_slope11);
304 gainPhi12->SetFillColor(5);
305 gainPhi12->SetXTitle("ADC counts");
306 gainPhi12->Fit("expo","M");
307 expo->SetLineColor(2);
308 expo->SetLineWidth(3);
309 Float_t inv_slope12 = -1/expo->GetParameter(1);
310 gainPhi->Fill(335, (float) inv_slope12);
313 TCanvas *c17 = new TCanvas("c17","Gain Variation",50,50,600,700);
316 //c11->SetFillColor(42);
320 gainIn->SetFillColor(5);
321 gainIn->SetXTitle("ADC counts");
322 gainIn->Fit("expo","M");
323 expo->SetLineColor(2);
324 expo->SetLineWidth(3);
329 gainOut->SetFillColor(5);
330 gainOut->SetXTitle("ADC counts");
331 gainOut->Fit("expo","M");
332 expo->SetLineColor(2);
333 expo->SetLineWidth(3);
337 gainX->SetFillColor(5);
338 gainX->SetYTitle("Total ADC counts");
339 gainX->SetXTitle("(pads)");
343 gainPhi->SetFillColor(5);
344 gainPhi->SetYTitle("Gain (ADC)");
345 gainPhi->SetXTitle("phi (degrees)");
348 printf("\nEnd of macro\n");
349 printf("**********************************\n");