]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ESDCheck/AliPMDQATask.cxx
91a4c93b8bfdfe53eb57eaed79770fe532ffca25
[u/mrichter/AliRoot.git] / ESDCheck / AliPMDQATask.cxx
1
2 /**************************************************************************
3  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  *                                                                        *
5  * Author: The ALICE Off-line Project.                                    *
6  * Contributors are mentioned in the code where appropriate.              *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /* $Id$ */
18
19 //_________________________________________________________________________
20 // An analysis task to check the PMD data in simulated data
21 //
22 //*-- Yves Schutz 
23 //////////////////////////////////////////////////////////////////////////////
24
25 #include <TCanvas.h>
26 #include <TChain.h>
27 #include <TFile.h> 
28 #include <TH1F.h>
29 #include <TH2F.h>
30 #include <TLine.h> 
31 #include <TROOT.h>
32 #include <TStyle.h> 
33
34 #include "AliPMDQATask.h" 
35 #include "AliPMDUtility.h" 
36 #include "AliESD.h" 
37 #include "AliLog.h"
38
39 //______________________________________________________________________________
40 AliPMDQATask::AliPMDQATask(const char *name) : 
41   AliAnalysisTask(name,""),  
42   fChain(0),
43   fESD(0), 
44   fhPMDP1(0),
45   fhPMDC2(0),
46   fhPMDP2(0),
47   fhPMDC3(0),
48   fhPMDP3(0),
49   fhPMDP4(0),
50   fhPMDC5(0),
51   fhPMDP5(0),
52   fhPMDCP0(0),
53   fhPMDCP1(0),
54   fhPMDCP2(0),
55   fhPMDCP3(0),
56   fhPMDCP4(0),
57   fhPMDSM1(0),
58   fhPMDSM2(0),
59   fhPMDSM3(0),
60   fhPMDSM4(0),
61   fhPMDSM5(0),
62   fhPMDSM6(0),
63   fhPMDSM7(0),
64   fhPMDSM8(0),
65   fhPMDSM9(0),
66   fhPMDSM10(0),
67   fhPMDSM11(0),
68   fhPMDSM12(0),
69   fhPMDSM13(0),
70   fhPMDSM14(0),
71   fhPMDSM15(0),
72   fhPMDSM16(0),
73   fhPMDSM17(0),
74   fhPMDSM18(0),
75   fhPMDSM19(0),
76   fhPMDSM20(0),
77   fhPMDSM21(0),
78   fhPMDSM22(0),
79   fhPMDSM23(0),
80   fhPMDSM24(0),
81   fhPMDSM (0)
82 {
83   // Constructor.
84   // Input slot #0 works with an Ntuple
85   DefineInput(0, TChain::Class());
86   // Output slot #0 writes into a TH1 container
87   DefineOutput(0,  TObjArray::Class()) ; 
88 }
89
90 //______________________________________________________________________________
91 AliPMDQATask::~AliPMDQATask()
92 {
93   // dtor
94   fOutputContainer->Clear() ; 
95   delete fOutputContainer ;
96   
97   delete fhPMDP1  ;
98   delete fhPMDC2  ;
99   delete fhPMDP2  ;
100   delete fhPMDC3  ;
101   delete fhPMDP3  ;
102   delete fhPMDP4  ;
103   delete fhPMDC5  ;
104   delete fhPMDP5  ;
105   delete fhPMDCP0 ;
106   delete fhPMDCP1 ;
107   delete fhPMDCP2 ;
108   delete fhPMDCP3 ;
109   delete fhPMDCP4 ;
110   delete fhPMDSM1  ;
111   delete fhPMDSM2  ;
112   delete fhPMDSM3  ;
113   delete fhPMDSM4  ;
114   delete fhPMDSM5  ;
115   delete fhPMDSM6  ;
116   delete fhPMDSM7  ;
117   delete fhPMDSM8  ;
118   delete fhPMDSM9  ;
119   delete fhPMDSM10 ;
120   delete fhPMDSM11 ;
121   delete fhPMDSM12 ;
122   delete fhPMDSM13 ;
123   delete fhPMDSM14 ;
124   delete fhPMDSM15 ;
125   delete fhPMDSM16 ;
126   delete fhPMDSM17 ;
127   delete fhPMDSM18 ;
128   delete fhPMDSM19 ;
129   delete fhPMDSM20 ;
130   delete fhPMDSM21 ;
131   delete fhPMDSM22 ;
132   delete fhPMDSM23 ;
133   delete fhPMDSM24 ;
134   delete fhPMDSM   ;
135   
136 }
137
138 //______________________________________________________________________________
139 void AliPMDQATask::ConnectInputData(const Option_t*)
140 {
141   // Initialisation of branch container and histograms 
142     
143   AliInfo(Form("*** Initialization of %s", GetName())) ; 
144     
145   // Get input data
146   fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
147   if (!fChain) {
148     AliError(Form("Input 0 for %s not found\n", GetName()));
149     return ;
150   }
151   
152   // One should first check if the branch address was taken by some other task
153   char ** address = (char **)GetBranchAddress(0, "ESD");
154   if (address) {
155     fESD = (AliESD*)(*address);
156   } else {
157     fESD = new AliESD();
158     SetBranchAddress(0, "ESD", &fESD);
159   }
160 }
161
162 //________________________________________________________________________
163 void AliPMDQATask::CreateOutputObjects()
164 {  
165   // create histograms 
166   
167   fhPMDP1   = new TH2F("fhPMDP1","XY of Clusters",100,-100.,100.,100,-100.,100.);
168   fhPMDC2   = new TH1F("fhPMDC2","CPV  PHI",200,-1,9);
169   fhPMDP2   = new TH1F("fhPMDP2","PRE  PHI",200,-1,9);
170   fhPMDC3   = new TH1F("fhPMDC3","CPV  Clus",30,0.,500.);
171   fhPMDP3   = new TH1F("fhPMDP3","PRE  N-gammalike",20,0.,500.);
172   fhPMDP4   = new TH1F("fhPMDP4","PRE  EDEP",30,0.,1000.);
173   fhPMDC5   = new TH1F("fhPMDC5","CPV  n-cell",20,0.,100.);
174   fhPMDP5   = new TH1F("fhPMDP5","PMD  n-cell",20,0.,100.);
175   fhPMDCP0  = new TH2F("fhPMDCP0","PRE CLUS Quad.1 vs 2",150,0.,300.,150,0.,300.);
176   fhPMDCP1  = new TH2F("fhPMDCP1","PRE CLUS Quad.3 vs 4",150,0.,300.,150,0.,300.);
177   fhPMDCP2  = new TH2F("fhPMDCP2","PRE EDEP Quad.3 vs 4",50,0.,300.,50,0.,300.);
178   fhPMDCP3  = new TH2F("fhPMDCP3","PRE EDEP vs Tot Clus ",10,0.,1000.,10,0.,300.);
179   fhPMDCP4  = new TH2F("fhPMDCP4","PRE Clus vs CPV Clus ",150,0.,200.,150,0.,200.);
180
181   fhPMDSM1  = new TH2F("fhPMDSM1","PRE Cluster XY",200,-100,100,200,-100,100);
182   fhPMDSM2  = new TH2F("fhPMDSM2","",999,-100.0,100.0,999,-100.0,100.0);
183   fhPMDSM3  = new TH2F("fhPMDSM3","",999,-100.0,100.0,999,-100.0,100.0);
184   fhPMDSM4  = new TH2F("fhPMDSM4","",999,-100.0,100.0,999,-100.0,100.0);
185   fhPMDSM5  = new TH2F("fhPMDSM5","",999,-100.0,100.0,999,-100.0,100.0);
186   fhPMDSM6  = new TH2F("fhPMDSM6","",999,-100.0,100.0,999,-100.0,100.0);
187   fhPMDSM7  = new TH2F("fhPMDSM7","",999,-100.0,100.0,999,-100.0,100.0);
188   fhPMDSM8  = new TH2F("fhPMDSM8","",999,-100.0,100.0,999,-100.0,100.0);
189   fhPMDSM9  = new TH2F("fhPMDSM9","",999,-100.0,100.0,999,-100.0,100.0);
190   fhPMDSM10 = new TH2F("fhPMDSM10","",999,-100.0,100.0,999,-100.0,100.0);
191   fhPMDSM11 = new TH2F("fhPMDSM11","",999,-100.0,100.0,999,-100.0,100.0);
192   fhPMDSM12 = new TH2F("fhPMDSM12","",999,-100.0,100.0,999,-100.0,100.0);
193   fhPMDSM13 = new TH2F("fhPMDSM13","",999,-100.0,100.0,999,-100.0,100.0);
194   fhPMDSM14 = new TH2F("fhPMDSM14","",999,-100.0,100.0,999,-100.0,100.0);
195   fhPMDSM15 = new TH2F("fhPMDSM15","",999,-100.0,100.0,999,-100.0,100.0);
196   fhPMDSM16 = new TH2F("fhPMDSM16","",999,-100.0,100.0,999,-100.0,100.0);
197   fhPMDSM17 = new TH2F("fhPMDSM17","",999,-100.0,100.0,999,-100.0,100.0);
198   fhPMDSM18 = new TH2F("fhPMDSM18","",999,-100.0,100.0,999,-100.0,100.0);
199   fhPMDSM19 = new TH2F("fhPMDSM19","",999,-100.0,100.0,999,-100.0,100.0);
200   fhPMDSM20 = new TH2F("fhPMDSM20","",999,-100.0,100.0,999,-100.0,100.0);
201   fhPMDSM21 = new TH2F("fhPMDSM21","",999,-100.0,100.0,999,-100.0,100.0);
202   fhPMDSM22 = new TH2F("fhPMDSM22","",999,-100.0,100.0,999,-100.0,100.0);
203   fhPMDSM23 = new TH2F("fhPMDSM23","",999,-100.0,100.0,999,-100.0,100.0);
204   fhPMDSM24 = new TH2F("fhPMDSM24","",999,-100.0,100.0,999,-100.0,100.0);
205   fhPMDSM   = new TH1F("fhPMDSM","Plot of all 24 Super Modules",24,0,24);
206   
207   // create output container
208   
209   fOutputContainer = new TObjArray(38) ; 
210   fOutputContainer->SetName("PMD") ; 
211
212   fOutputContainer->AddAt(fhPMDP1,    0 );
213   fOutputContainer->AddAt(fhPMDC2,    1 );
214   fOutputContainer->AddAt(fhPMDP2,    2 );
215   fOutputContainer->AddAt(fhPMDC3,    3 );
216   fOutputContainer->AddAt(fhPMDP3,    4 );
217   fOutputContainer->AddAt(fhPMDP4,    5 );
218   fOutputContainer->AddAt(fhPMDC5,    6 );
219   fOutputContainer->AddAt(fhPMDP5,    7 );
220   fOutputContainer->AddAt(fhPMDCP0,   8 );
221   fOutputContainer->AddAt(fhPMDCP1,   9);
222   fOutputContainer->AddAt(fhPMDCP2,  10 );
223   fOutputContainer->AddAt(fhPMDCP3,  11 );
224   fOutputContainer->AddAt(fhPMDCP4,  12 );
225   
226   fOutputContainer->AddAt(fhPMDSM1,  13 );
227   fOutputContainer->AddAt(fhPMDSM2,  14 );
228   fOutputContainer->AddAt(fhPMDSM3,  15 );
229   fOutputContainer->AddAt(fhPMDSM4,  16 );
230   fOutputContainer->AddAt(fhPMDSM5,  17 );
231   fOutputContainer->AddAt(fhPMDSM6,  18 );
232   fOutputContainer->AddAt(fhPMDSM7,  19 );
233   fOutputContainer->AddAt(fhPMDSM8,  20 );
234   fOutputContainer->AddAt(fhPMDSM9,  21 );
235   fOutputContainer->AddAt(fhPMDSM10, 22 );
236   fOutputContainer->AddAt(fhPMDSM11, 23 );
237   fOutputContainer->AddAt(fhPMDSM12, 24 );
238   fOutputContainer->AddAt(fhPMDSM13, 25 );
239   fOutputContainer->AddAt(fhPMDSM14, 26 );
240   fOutputContainer->AddAt(fhPMDSM15, 27 );
241   fOutputContainer->AddAt(fhPMDSM16, 28 );
242   fOutputContainer->AddAt(fhPMDSM17, 29 );
243   fOutputContainer->AddAt(fhPMDSM18, 30 );
244   fOutputContainer->AddAt(fhPMDSM19, 31 );
245   fOutputContainer->AddAt(fhPMDSM20, 32 );
246   fOutputContainer->AddAt(fhPMDSM21, 33 );
247   fOutputContainer->AddAt(fhPMDSM22, 34 );
248   fOutputContainer->AddAt(fhPMDSM23, 35 );
249   fOutputContainer->AddAt(fhPMDSM24, 36 );
250   fOutputContainer->AddAt(fhPMDSM,   37 );
251 }
252
253 //______________________________________________________________________________
254 void AliPMDQATask::Exec(Option_t *) 
255 {
256   // Processing of one event
257   
258   Long64_t entry = fChain->GetReadEntry() ;
259   
260   if (!fESD) {
261     AliError("fESD is not connected to the input!") ; 
262     return ; 
263   }
264   
265   if ( !((entry-1)%100) ) 
266     AliInfo(Form("%s ----> Processing event # %lld",  (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ; 
267   
268   // ************************ PMD
269
270   AliPMDUtility *cc = new AliPMDUtility(); 
271   
272   Int_t smn;
273   Int_t n=0;
274   Float_t totCPVClus     ;
275   Float_t totPREClus     ;
276   Float_t totPREEdep  ;
277   Float_t totCPVCell     ;
278   Float_t totPRECell     ;
279   Float_t preCluQUAD[4]  ;
280   Float_t cpvCluQUAD[4]  ;
281   Float_t preADCQUAD[4]  ;
282   Float_t cpvADCQUAD[4]  ;
283   Float_t preCelQUAD[4]  ;
284   Float_t cpvCelQUAD[4]  ;
285
286   Int_t npmdCl = fESD->GetNumberOfPmdTracks();
287   
288   // ****** The loop over PMD clusters
289
290   for (Int_t kk = 0; kk < 4 ; kk++) {
291     cpvCluQUAD[kk] = 0.0 ;
292     preCluQUAD[kk] = 0.0 ;
293     cpvCelQUAD[kk] = 0.0 ;
294     preCelQUAD[kk] = 0.0 ;
295     preADCQUAD[kk] = 0.0 ;
296   } 
297  
298   while (npmdCl--) {
299     
300     AliESDPmdTrack * pmdtr = fESD->GetPmdTrack(npmdCl);
301     Int_t   det   = pmdtr->GetDetector();
302     Float_t clsX  = pmdtr->GetClusterX();
303     Float_t clsY  = pmdtr->GetClusterY();
304     Float_t clsZ  = pmdtr->GetClusterZ();
305     Float_t ncell = pmdtr->GetClusterCells();
306     Float_t adc   = pmdtr->GetClusterADC();
307     
308     cc->SetXYZ(clsX,clsY,clsZ);
309     cc->CalculateEta();
310     cc->CalculatePhi();
311     Float_t eta = cc->GetEta();
312     Float_t phi = cc->GetPhi();
313     
314    // Calculating S.Module Number from Cluster .
315     
316     CalculateSMN(clsX, clsY, smn);
317     if( det == 1)
318       {
319         if(smn >= 0 && smn <= 5) {
320           ++cpvCluQUAD[0] ;
321           cpvADCQUAD[0] =+ adc  ;
322           cpvCelQUAD[0] =+ ncell ;
323         }
324         if(smn >= 6 && smn <=11) {
325           ++cpvCluQUAD[1] ;
326           cpvADCQUAD[1] =+ adc  ;
327           cpvCelQUAD[1] =+ ncell ;
328         }
329         if(smn >=12 && smn <=17) {
330           ++cpvCluQUAD[2] ;
331           cpvADCQUAD[2] =+ adc  ;
332           cpvCelQUAD[2] =+ ncell ;
333         }
334         if(smn >=18 && smn <=23) {
335           ++cpvCluQUAD[3] ;
336           cpvADCQUAD[3] =+ adc  ;
337           cpvCelQUAD[3] =+ ncell ;
338         }
339         
340         if(eta >= 2.3 && eta <= 3.5)
341           {
342             fhPMDC2->Fill(phi);
343           }
344       }
345     if( det == 0)
346       {
347         if(smn >= 0 && smn <= 5) { 
348           ++preCluQUAD[0] ;
349           preADCQUAD[0] =+ adc  ;    
350           preCelQUAD[0] =+ ncell ;    
351         }    
352         if(smn >= 6 && smn <=11) { 
353           ++preCluQUAD[1] ;
354           preADCQUAD[1] =+ adc  ;    
355           preCelQUAD[1] =+ ncell ;    
356         }    
357         if(smn >=12 && smn <=17) { 
358           ++preCluQUAD[2] ;
359           preADCQUAD[2] =+ adc  ;    
360           preCelQUAD[2] =+ ncell ;    
361         }    
362         if(smn >=18 && smn <=23) { 
363           ++preCluQUAD[3] ;
364           preADCQUAD[3] =+ adc  ;    
365           preCelQUAD[3] =+ ncell ;    
366         }    
367         if ( n <= 100 ) { 
368           fhPMDSM->Fill(smn);
369           if(smn == 0) fhPMDSM1->Fill(-clsX,clsY);
370           if(smn == 0) fhPMDSM1->Fill(-clsX,clsY);
371           if(smn == 1) fhPMDSM2->Fill(-clsX,clsY);
372           if(smn == 2) fhPMDSM3->Fill(-clsX,clsY);
373           if(smn == 3) fhPMDSM4->Fill(-clsX,clsY);
374           if(smn == 4) fhPMDSM5->Fill(-clsX,clsY);
375           if(smn == 5) fhPMDSM6->Fill(-clsX,clsY);
376           if(smn == 6) fhPMDSM7->Fill(-clsX,clsY);
377           if(smn == 7) fhPMDSM8->Fill(-clsX,clsY);
378           if(smn == 8) fhPMDSM9->Fill(-clsX,clsY);
379           if(smn == 9) fhPMDSM10->Fill(-clsX,clsY);
380           if(smn ==10) fhPMDSM11->Fill(-clsX,clsY);
381           if(smn ==11) fhPMDSM12->Fill(-clsX,clsY);
382           if(smn ==12) fhPMDSM13->Fill(-clsX,clsY);
383           if(smn ==13) fhPMDSM14->Fill(-clsX,clsY);
384           if(smn ==14) fhPMDSM15->Fill(-clsX,clsY);
385           if(smn ==15) fhPMDSM16->Fill(-clsX,clsY);
386           if(smn ==16) fhPMDSM17->Fill(-clsX,clsY);
387           if(smn ==17) fhPMDSM18->Fill(-clsX,clsY);
388           if(smn ==18) fhPMDSM19->Fill(-clsX,clsY);
389           if(smn ==19) fhPMDSM20->Fill(-clsX,clsY);
390           if(smn ==20) fhPMDSM21->Fill(-clsX,clsY);
391           if(smn ==21) fhPMDSM22->Fill(-clsX,clsY);
392           if(smn ==22) fhPMDSM23->Fill(-clsX,clsY);
393           if(smn ==23) fhPMDSM24->Fill(-clsX,clsY);
394         }     
395         if(eta >= 2.3 && eta <= 3.5)
396           {
397             fhPMDP2->Fill(phi);
398           }
399         fhPMDP1->Fill(clsX,clsY);
400       }
401   } 
402   for (Int_t k = 0 ; k < 4 ; k++) {
403     totCPVClus =+ cpvCluQUAD [k] ;
404     totPREClus =+ preCluQUAD [k] ;
405     totCPVCell =+ cpvCelQUAD [k] ;
406     totPRECell =+ preCelQUAD [k] ;
407     totPREEdep =+ preADCQUAD [k] ;     
408     }
409   Float_t totCPVpreClus = totPREClus + totCPVClus ;
410
411   //  if(eta >= 2.3 && eta <= 3.5) {
412   fhPMDC3->Fill(totCPVClus);
413   fhPMDP3->Fill(totPREClus);
414   fhPMDP4->Fill(totPREEdep);
415   fhPMDP5->Fill(totPRECell);
416   fhPMDCP0->Fill(preCluQUAD[0],preCluQUAD[1]);
417   fhPMDCP1->Fill(preCluQUAD[2],preCluQUAD[3]);
418   fhPMDCP2->Fill(preADCQUAD[2],preADCQUAD[3]);
419   fhPMDCP3->Fill(totPREEdep,totCPVpreClus);
420   fhPMDCP4->Fill(totPREClus,totCPVClus);
421   //    }
422   totCPVClus = 0.0; 
423   totPREClus = 0.0; 
424   totCPVCell = 0.0; 
425   totPRECell = 0.0; 
426   totPREEdep = 0.0; 
427
428   PostData(0, fOutputContainer);
429
430
431 //______________________________________________________________________________
432 void AliPMDQATask::Terminate(Option_t *)
433 {
434   // Processing when the event loop is ended
435   fOutputContainer = (TObjArray*)GetOutputData(0);
436   
437   fhPMDP1   = (TH2F*)fOutputContainer->At(0);
438   fhPMDC2   = (TH1F*)fOutputContainer->At(1);
439   fhPMDP2   = (TH1F*)fOutputContainer->At(2);
440   fhPMDC3   = (TH1F*)fOutputContainer->At(3);
441   fhPMDP3   = (TH1F*)fOutputContainer->At(4);
442   fhPMDP4   = (TH1F*)fOutputContainer->At(5);
443   fhPMDC5   = (TH1F*)fOutputContainer->At(6);
444   fhPMDP5   = (TH1F*)fOutputContainer->At(7);
445   fhPMDCP0  = (TH2F*)fOutputContainer->At(8);
446   fhPMDCP1  = (TH2F*)fOutputContainer->At(9);
447   fhPMDCP2  = (TH2F*)fOutputContainer->At(10);
448   fhPMDCP3  = (TH2F*)fOutputContainer->At(11);
449   fhPMDCP4  = (TH2F*)fOutputContainer->At(12);
450
451   fhPMDSM1  = (TH2F*)fOutputContainer->At(13);
452   fhPMDSM2  = (TH2F*)fOutputContainer->At(14);
453   fhPMDSM3  = (TH2F*)fOutputContainer->At(15);
454   fhPMDSM4  = (TH2F*)fOutputContainer->At(16);
455   fhPMDSM5  = (TH2F*)fOutputContainer->At(17);
456   fhPMDSM6  = (TH2F*)fOutputContainer->At(18);
457   fhPMDSM7  = (TH2F*)fOutputContainer->At(19);
458   fhPMDSM8  = (TH2F*)fOutputContainer->At(20);
459   fhPMDSM9  = (TH2F*)fOutputContainer->At(21);
460   fhPMDSM10 = (TH2F*)fOutputContainer->At(22);
461   fhPMDSM11 = (TH2F*)fOutputContainer->At(23);
462   fhPMDSM12 = (TH2F*)fOutputContainer->At(24);
463   fhPMDSM13 = (TH2F*)fOutputContainer->At(25);
464   fhPMDSM14 = (TH2F*)fOutputContainer->At(26);
465   fhPMDSM15 = (TH2F*)fOutputContainer->At(27);
466   fhPMDSM16 = (TH2F*)fOutputContainer->At(28);
467   fhPMDSM17 = (TH2F*)fOutputContainer->At(29);
468   fhPMDSM18 = (TH2F*)fOutputContainer->At(30);
469   fhPMDSM19 = (TH2F*)fOutputContainer->At(31);
470   fhPMDSM20 = (TH2F*)fOutputContainer->At(32);
471   fhPMDSM21 = (TH2F*)fOutputContainer->At(33);
472   fhPMDSM22 = (TH2F*)fOutputContainer->At(34);
473   fhPMDSM23 = (TH2F*)fOutputContainer->At(35);
474   fhPMDSM24 = (TH2F*)fOutputContainer->At(36);
475   fhPMDSM   = (TH1F*)fOutputContainer->At(37);
476
477   AliInfo(Form(" *** %s Report:", GetName())) ; 
478
479   gStyle->SetOptStat(110000);
480   gStyle->SetOptFit(1);
481
482   TCanvas *cPMD0 = new TCanvas("cPMD0","PMD ESD Test #1", 10,10, 600, 600);
483   cPMD0->Range(-100, -100,100 ,100 );
484   fhPMDSM1->SetMarkerColor(2);
485   fhPMDSM1->Draw();
486   fhPMDSM1->GetXaxis()->SetTitle("Cluster X");
487   fhPMDSM1->GetYaxis()->SetTitle("Cluster Y");
488   fhPMDSM2->SetMarkerColor(2);
489   fhPMDSM2->Draw("same");
490   fhPMDSM3->SetMarkerColor(2);
491   fhPMDSM3->Draw("same");
492   fhPMDSM4->SetMarkerColor(2);
493   fhPMDSM4->Draw("same");
494   fhPMDSM5->SetMarkerColor(2);
495   fhPMDSM5->Draw("same");
496   fhPMDSM6->SetMarkerColor(2);
497   fhPMDSM6->Draw("same");
498   fhPMDSM7->SetMarkerColor(4);
499   fhPMDSM7->Draw("same");
500   fhPMDSM8->SetMarkerColor(4);
501   fhPMDSM8->Draw("same");
502   fhPMDSM9->SetMarkerColor(4);
503   fhPMDSM9->Draw("same");
504   fhPMDSM10->SetMarkerColor(4);
505   fhPMDSM10->Draw("same");
506   fhPMDSM11->SetMarkerColor(4);
507   fhPMDSM11->Draw("same");
508   fhPMDSM12->SetMarkerColor(4);
509   fhPMDSM12->Draw("same");
510   fhPMDSM13->SetMarkerColor(6);
511   fhPMDSM13->Draw("same");
512   fhPMDSM14->SetMarkerColor(6);
513   fhPMDSM14->Draw("same");
514   fhPMDSM15->SetMarkerColor(6);
515   fhPMDSM15->Draw("same");
516   fhPMDSM16->SetMarkerColor(6);
517   fhPMDSM16->Draw("same");
518   fhPMDSM17->SetMarkerColor(6);
519   fhPMDSM17->Draw("same");
520   fhPMDSM18->SetMarkerColor(6);
521   fhPMDSM18->Draw("same");
522   fhPMDSM19->SetMarkerColor(8);
523   fhPMDSM19->Draw("same");
524   fhPMDSM20->SetMarkerColor(8);
525   fhPMDSM20->Draw("same");
526   fhPMDSM21->SetMarkerColor(8);
527   fhPMDSM21->Draw("same");
528   fhPMDSM22->SetMarkerColor(8);
529   fhPMDSM22->Draw("same");
530   fhPMDSM23->SetMarkerColor(8);
531   fhPMDSM23->Draw("same");
532   fhPMDSM24->SetMarkerColor(8);
533   fhPMDSM24->Draw("same");
534
535   DrawPMDBoundary();
536   DrawPMDBoundarySM1();
537   DrawPMDBoundarySM2();
538   DrawPMDBoundarySM3();
539   DrawPMDBoundarySM4();
540   cPMD0->Print("ClusterXY.eps");
541   
542   TCanvas *cPMD1 = new TCanvas("cPMD1"," PMD ESD Test #2",10, 10, 600,600);
543   cPMD1->Divide(1,2);
544   cPMD1->cd(1);
545   cPMD1->SetFillColor(0);
546   fhPMDC2->SetLineColor(4);
547   fhPMDC2->Draw();
548   cPMD1->cd(2);
549   fhPMDP2->SetLineColor(2);
550   fhPMDP2->Draw();
551   cPMD1->Print("CPVPREphi.eps");
552
553   TCanvas *cPMD2 = new TCanvas("cPMD2","PMD ESD test #3",10, 10, 600, 600);
554   cPMD2->cd();
555   fhPMDSM->SetFillColor(2);
556   fhPMDSM->Draw();
557   cPMD2->Print("AllSMN.eps");
558
559   TCanvas *cPMD3 = new TCanvas("cPMD3", "PMD ESD test #4",10, 10, 600, 600);
560   cPMD3->Divide(2,2);
561   cPMD3->cd(1);
562   fhPMDCP0->SetMarkerColor(9);
563   fhPMDCP0->Draw();
564   cPMD3->cd(2);
565   fhPMDCP1->SetMarkerColor(6);
566   fhPMDCP1->Draw();
567   cPMD3->cd(3);
568   fhPMDP3->SetLineColor(2);
569   fhPMDP3->Draw();
570   cPMD3->cd(4);
571   fhPMDCP4->SetMarkerColor(3);
572   fhPMDCP4->Draw();
573   cPMD3->Print("CPVPREClus.eps");
574
575   TCanvas *cPMD4 = new TCanvas("cPMD4","PMD ESD test #5", 10, 10, 600, 600);
576   cPMD4->Divide(1,2);
577   cPMD4->cd(1);
578   fhPMDC3->SetLineColor(4);
579   fhPMDC3->Draw();
580   cPMD4->cd(2);
581   fhPMDP4->SetLineColor(2);
582   fhPMDP4->Draw();
583   cPMD4->Print("CPVPREAdc.eps");
584
585   char line[1024] ; 
586   sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; 
587   gROOT->ProcessLine(line);
588   
589   AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;
590   
591 }
592
593 //______________________________________________________________________________
594 void AliPMDQATask::CalculateSMN( Float_t clsX, Float_t clsY, Int_t & smn)
595 {
596   Double_t xcon[96] = {75.133, 54.204, 53.254, 32.326, 31.376,10.447,
597                        75.133, 54.204, 53.254, 32.326, 31.376,10.447,
598                        75.133, 54.204, 53.254, 32.326, 31.376,10.447,
599                        75.133, 54.204, 53.254, 32.326, 31.376,10.447,
600                        -75.133, -54.204, -53.254, -32.326, -31.376,-10.447,
601                        -75.133, -54.204, -53.254, -32.326, -31.376,-10.447,
602                        -75.133, -54.204, -53.254, -32.326, -31.376,-10.447,
603                        -75.133, -54.204, -53.254, -32.326, -31.376,-10.447,
604                        9.167, -32.543, -33.493, -75.133,
605                        9.167, -32.543, -33.493, -75.133,
606                        9.167, -32.543, -33.493, -75.133,
607                        9.167, -32.543, -33.493, -75.133,
608                        9.167, -32.543, -33.493, -75.133,
609                        9.167, -32.543, -33.493, -75.133,
610                        -9.167, 32.543, 33.493, 75.133,
611                        -9.167, 32.543, 33.493, 75.133,
612                        -9.167, 32.543, 33.493, 75.133,
613                        -9.167, 32.543, 33.493, 75.133,
614                        -9.167, 32.543, 33.493, 75.133,
615                        -9.167, 32.543, 33.493, 75.133};
616   
617   Double_t ycon[96] =  {86.475,  86.475,  86.475, 86.475,  86.475,  86.475,
618                         38.225,  38.225,  38.225, 38.225,  38.225,  38.225,
619                         37.325,  37.325,  37.325, 37.325,  37.325,  37.325,
620                         -10.925, -10.925, -10.925, -10.925, -10.925, -10.925,
621                         -86.475, -86.475, -86.475, -86.475, -86.475, -86.475,
622                         -38.225,  -38.225,  -38.225, -38.225, -38.225, -38.225,
623                         -37.325,  -37.325,  -37.325, -37.325,  -37.325,  -37.325,
624                         10.925, 10.925, 10.925, 10.925, 10.925, 10.925,
625                         86.475,  86.475, 86.475,  86.475,
626                         62.225,  62.225, 62.225,  62.225,
627                         61.325,  61.325, 61.325,  61.325,
628                         37.075, 37.075, 37.075, 37.075,
629                         36.175,  36.175, 36.175,  36.175,
630                         11.925, 11.925, 11.925 , 11.925,
631                         -86.475,  -86.475, -86.475,  -86.475,
632                         -62.225,  -62.225, -62.225,  -62.225,
633                         -61.325,  -61.325, -61.325,  -61.325,
634                         -37.075,  -37.075, -37.075,  -37.075,
635                         -36.175,  -36.175, -36.175,  -36.175,
636                         -11.925, -11.925,  -11.925 , -11.925 };
637   
638   if((clsX <= xcon[0]) && (clsX >= xcon[1]) &&
639      (clsY <= ycon[0]) && (clsY >= ycon[6])) smn = 0 ;
640   
641   else if((clsX <=xcon[2]) && (clsX >= xcon[3]) &&
642           (clsY <= ycon[1]) && (clsY >= ycon[7]))smn = 1 ;
643   
644   else if((clsX <=xcon[4]) && (clsX >= xcon[5]) &&
645           (clsY <= ycon[3]) && (clsY >= ycon[8]))smn = 2 ;
646   
647   else if((clsX <= xcon[0]) && (clsX >= xcon[1]) &&
648           (clsY <= ycon[12]) && (clsY >= ycon[18])) smn = 3 ;
649   
650   else if((clsX <=xcon[2]) && (clsX >= xcon[3]) &&
651           (clsY <= ycon[12]) && (clsY >= ycon[18]))smn = 4 ;
652   
653   else if((clsX <=xcon[4]) && (clsX >= xcon[5]) &&
654           (clsY <= ycon[12]) && (clsY >= ycon[18]))smn = 5 ;
655   //------------------------------------------------------------------
656   else if((clsX >= xcon[24]) && (clsX <= xcon[25]) &&
657           (clsY >= ycon[24]) && (clsY <= ycon[30])) smn = 6 ;
658   
659   else if((clsX >=xcon[26]) && (clsX <= xcon[27]) &&
660           (clsY >= ycon[25]) && (clsY <= ycon[31]))smn = 7 ;
661   
662   else if((clsX >=xcon[28]) && (clsX <= xcon[29]) &&
663           (clsY >= ycon[26]) && (clsY <= ycon[32]))smn = 8 ;
664   
665   else if((clsX >= xcon[24]) && (clsX <= xcon[25]) &&
666           (clsY >= ycon[36]) && (clsY <= ycon[42])) smn = 9 ;
667   
668   else if((clsX >=xcon[26]) && (clsX <= xcon[27]) &&
669           (clsY >= ycon[36]) && (clsY <= ycon[42]))smn = 10;
670   
671   else if((clsX >=xcon[28]) && (clsX <= xcon[29]) &&
672           (clsY >= ycon[36]) && (clsY <= ycon[42]))smn = 11;
673   //------------------------------------------------------------------
674   else if((clsX <= xcon[48]) && (clsX >= xcon[49]) &&
675           (clsY <= ycon[48]) && (clsY >= ycon[52])) smn = 12 ;
676   
677   else if((clsX <=xcon[50]) && (clsX >= xcon[51]) &&
678           (clsY <= ycon[48]) && (clsY >= ycon[52]))smn = 13 ;
679   
680   else if((clsX <=xcon[48]) && (clsX >= xcon[49]) &&
681           (clsY <= ycon[56]) && (clsY >= ycon[60]))smn = 14 ;
682   
683   else if((clsX <=xcon[50]) && (clsX >= xcon[51]) &&
684           (clsY <= ycon[56]) && (clsY >= ycon[60]))smn = 15 ;
685   
686   else if((clsX <=xcon[48]) && (clsX >= xcon[49]) &&
687           (clsY <= ycon[64]) && (clsY >= ycon[68]))smn = 16 ;
688   
689   else if((clsX <=xcon[50]) && (clsX >= xcon[51]) &&
690           (clsY <= ycon[64]) && (clsY >= ycon[68]))smn = 17 ;
691   //--------------------------------------------------------------
692   else if((clsX >= xcon[72]) && (clsX <= xcon[73]) &&
693           (clsY >= ycon[72]) && (clsY <= ycon[76])) smn = 18 ;
694   
695   else if((clsX >=xcon[74]) && (clsX <= xcon[75]) &&
696           (clsY >= ycon[72]) && (clsY <= ycon[76]))smn = 19 ;
697   
698   else if((clsX >=xcon[72]) && (clsX <= xcon[73]) &&
699           (clsY >= ycon[80]) && (clsY <= ycon[84]))smn = 20 ;
700   
701   else if((clsX >=xcon[74]) && (clsX <= xcon[75]) &&
702           (clsY >= ycon[80]) && (clsY <= ycon[84]))smn = 21;
703   
704   else if((clsX >= xcon[72]) && (clsX <= xcon[73]) &&
705           (clsY >= ycon[88]) && (clsY <= ycon[92])) smn = 22 ;
706   
707   else if((clsX >=xcon[74]) && (clsX <= xcon[75]) &&
708           (clsY >= ycon[88]) && (clsY <= ycon[92]))smn = 23 ;
709   else smn = 111;
710  }
711
712 //______________________________________________________________________________
713 void AliPMDQATask::DrawPMDBoundary()
714 {
715   // Draw PMD boundaries 
716   
717   gStyle->SetLineWidth(2);
718   gStyle->SetLineColor(2);
719   TLine * l;
720   l = new TLine(75.1333, 86.475, -75.1333, 86.475); l->Draw("same");
721   l = new TLine(-75.1333, 86.470,-75.1333, -86.475); l->Draw("same");
722   l = new TLine(-75.1333, -86.475,75.1333, -86.475); l->Draw("same");
723   l = new TLine(75.1333, -86.475,75.1333, 86.475); l->Draw("same");
724 }
725
726 //______________________________________________________________________________
727 void AliPMDQATask::DrawPMDBoundarySM1()
728 {
729   // Draw boundaries of Super Module 1 
730
731   gStyle->SetLineWidth(1);
732   gStyle->SetLineColor(4);
733   TLine * l;
734   l = new TLine(-75.1333, 86.475, -10.447,  86.475); l->Draw("same");
735   l = new TLine(-10.447, 86.475, -10.446, -10.925); l->Draw("same");
736   l = new TLine(-10.446, -10.925, -75.1333,-10.925); l->Draw("same");
737   l = new TLine(-75.1333,-10.925, -75.1333, 86.475); l->Draw("same");
738 }
739
740 //______________________________________________________________________________
741 void AliPMDQATask::DrawPMDBoundarySM2()
742 {
743   // Draw boundaries of Super Module 2 
744
745   gStyle->SetLineWidth(1);
746   gStyle->SetLineColor(4);
747   TLine * l;
748   l = new TLine(75.1333, -86.475, 10.446,  -86.475); l->Draw("same");
749   l = new TLine(10.446,  -86.475, 10.446,  10.925); l->Draw("same");
750   l = new TLine(10.446,   10.925, 75.1333, 10.925); l->Draw("same");
751   l = new TLine(75.1333,  10.925, 75.1333, -86.475); l->Draw("same");
752 }
753
754
755 //______________________________________________________________________________
756 void AliPMDQATask::DrawPMDBoundarySM3()
757 {
758   // Draw boundaries of Super Module 3 
759
760   gStyle->SetLineWidth(1);
761   gStyle->SetLineColor(1);
762   TLine * l;
763   l = new TLine(  -9.167, 86.475, 75.1333, 86.475); l->Draw("same");
764   l = new TLine(75.1333,86.475, 75.1333, 11.925); l->Draw("same");
765   l = new TLine(75.1333,11.925,   -9.167,  11.925); l->Draw("same");
766   l = new TLine(  -9.167, 11.925,   -9.167,  86.475); l->Draw("same");
767 }
768
769 //______________________________________________________________________________
770 void AliPMDQATask::DrawPMDBoundarySM4()
771 {
772   // Draw boundaries of Super Module 4 
773
774   gStyle->SetLineWidth(1);
775   gStyle->SetLineColor(1);
776   TLine * l;
777   l = new TLine(9.167, -86.475, -75.1333,-86.475); l->Draw("same");
778   l = new TLine(-75.1333,-86.475, -75.1333,-11.925); l->Draw("same");
779   l = new TLine(-75.1333,-11.925, 9.167, -11.925); l->Draw("same");
780   l = new TLine(9.167, -11.925, 9.167, -86.475); l->Draw("same");
781 }