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