]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ESDCheck/AliVZEROQATask.cxx
Temporary disable the raw version, it will be taken from FEE
[u/mrichter/AliRoot.git] / ESDCheck / AliVZEROQATask.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17 //
18 // An analysis task to check the ESD VZERO data in simulated data
19 //
20 //////////////////////////////////////////////////////////////////////////////
21
22  
23 #include <TROOT.h>
24 #include <TChain.h>
25 #include <TH1.h>
26 #include <TH1F.h>
27 #include <TH1I.h>
28 #include <TCanvas.h>
29 #include <TLegend.h> 
30 #include <TVector3.h> 
31 #include <TFile.h> 
32 #include <TString.h> 
33
34 #include "AliVZEROQATask.h" 
35 #include "AliESD.h" 
36 #include "AliESDVZERO.h"
37 #include "AliLog.h"
38
39 //______________________________________________________________________________
40 AliVZEROQATask::AliVZEROQATask(const char *name) : 
41   AliAnalysisTask(name,""),  
42   fChain(0),
43   fESD(0),
44   fOutputContainer(0), 
45   fhVZERONbPMA(0),
46   fhVZERONbPMC(0),
47   fhVZEROMultA(0),
48   fhVZEROMultC(0)
49      
50 {
51   // Constructor.
52   // Input slot #0 works with an Ntuple
53   DefineInput(0, TChain::Class());
54   // Output slot #0 writes into a TH1 container
55   DefineOutput(0,  TObjArray::Class()) ; 
56 }
57
58 //______________________________________________________________________________
59 AliVZEROQATask::~AliVZEROQATask()
60 {
61   // dtor
62   
63   fOutputContainer->Clear(); 
64   delete fOutputContainer; 
65   
66   delete fhVZERONbPMA;
67   delete fhVZERONbPMC; 
68   delete fhVZEROMultA;
69   delete fhVZEROMultC;
70 }
71
72 //______________________________________________________________________________
73 void AliVZEROQATask::ConnectInputData(const Option_t*)
74 {
75   // Initialises branch container and histograms 
76     
77   AliInfo(Form("*** Initialization of %s", GetName())) ; 
78   
79   // Gets input data
80   fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
81   if (!fChain) {
82     AliError(Form("Input 0 for %s not found\n", GetName()));
83     return ;
84   }
85   
86   // One should first check if the branch address was taken by some other task
87   char ** address = (char **)GetBranchAddress(0, "ESD");
88   if (address) {
89     fESD = (AliESD*)(*address);
90   } else {
91     fESD = new AliESD();
92     SetBranchAddress(0, "ESD", &fESD);
93   }
94 }
95
96 //________________________________________________________________________
97 void AliVZEROQATask::CreateOutputObjects()
98 {  
99   // Creates histograms 
100      
101   OpenFile(0) ; 
102
103   fhVZERONbPMA  = new TH1I("Nb of fired PMs in V0A", "VZERONbPMA" ,100 ,0 ,99);
104   fhVZERONbPMC  = new TH1I("Nb of fired PMs in V0C", "VZERONbPMC" ,100 ,0 ,99);
105   fhVZEROMultA  = new TH1I("Multiplicity in V0A", "VZEROMultA" ,50 ,0 ,49);
106   fhVZEROMultC  = new TH1I("Multiplicity in V0C", "VZEROMultC" ,50 ,0 ,49);
107   
108   // Creates output container
109   
110   fOutputContainer = new TObjArray(4); 
111   fOutputContainer->SetName(GetName()) ; 
112   fOutputContainer->AddAt(fhVZERONbPMA, 0); 
113   fOutputContainer->AddAt(fhVZERONbPMC, 1); 
114   fOutputContainer->AddAt(fhVZEROMultA, 2); 
115   fOutputContainer->AddAt(fhVZEROMultC, 3); 
116    
117 }
118
119 //______________________________________________________________________________
120 void AliVZEROQATask::Exec(Option_t *) 
121 {
122   // Processing of one event
123   Long64_t entry = fChain->GetReadEntry() ;
124
125   if (!fESD) {
126     AliError("fESD is not connected to the input!") ; 
127     return ; 
128   }
129   
130   if ( !((entry-1)%100) ) 
131     AliInfo(Form("%s ----> Processing event # %lld",  (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ; 
132  
133   AliESDVZERO *esdVZERO=fESD->GetVZEROData();
134    
135   if (esdVZERO) { 
136     fhVZERONbPMA->Fill(esdVZERO->GetNbPMV0A());
137     fhVZERONbPMC->Fill(esdVZERO->GetNbPMV0C());  
138     fhVZEROMultA->Fill(esdVZERO->GetMTotV0A());
139     fhVZEROMultC->Fill(esdVZERO->GetMTotV0C());  
140   }
141   PostData(0, fOutputContainer);
142   
143 }
144
145 //______________________________________________________________________________
146 void AliVZEROQATask::Terminate(Option_t *)
147 {
148   // Processed when the event loop is ended
149   
150   fOutputContainer = (TObjArray*)GetOutputData(0);
151   fhVZERONbPMA     = (TH1I*)fOutputContainer->At(0);
152   fhVZERONbPMC     = (TH1I*)fOutputContainer->At(1);
153   fhVZEROMultA     = (TH1I*)fOutputContainer->At(2);
154   fhVZEROMultC     = (TH1I*)fOutputContainer->At(3);
155   
156   Bool_t problem = kFALSE ; 
157   AliInfo(Form(" *** %s Report:", GetName())) ; 
158   printf("        V0A Multiplicity Mean : %5.3f , RMS : %5.3f \n",fhVZEROMultA->GetMean(),fhVZEROMultA->GetRMS());
159   printf("        V0C Multiplicity Mean : %5.3f , RMS : %5.3f \n",fhVZEROMultC->GetMean(),fhVZEROMultC->GetRMS());
160
161   TCanvas  * c1 = new TCanvas("Number of PMs fired in V0A", "Number of PMs fired in V0A", 1);
162   fhVZERONbPMA->SetAxisRange(0, 99);
163   fhVZERONbPMA->SetLineColor(2);
164   fhVZERONbPMA->Draw("SAME");
165   c1->Update();
166  
167   TCanvas  * c2 = new TCanvas("Number of PMs fired in V0C", "Number of PMs fired in V0C", 1);
168   fhVZERONbPMC->SetAxisRange(0,99);
169   fhVZERONbPMC->SetLineColor(2);
170   fhVZERONbPMC->Draw("SAME");
171   c2->Update();
172
173   TCanvas  * c3 = new TCanvas("Multiplicity in V0A", "Multiplicity in V0A", 1);
174   fhVZEROMultA->SetAxisRange(0, 49);
175   fhVZEROMultA->SetLineColor(2);
176   fhVZEROMultA->Draw("SAME");
177   c3->Update();
178  
179   TCanvas  * c4 = new TCanvas("Multiplicity in V0C", "Multiplicity in V0C", 1);
180   fhVZEROMultC->SetAxisRange(0,49);
181   fhVZEROMultC->SetLineColor(2);
182   fhVZEROMultC->Draw("SAME");
183   c4->Update();
184
185   c1->Print("V0AMultiplicity.eps");
186   c2->Print("V0CMultiplicity.eps");
187   c3->Print("NumberV0APMs.eps");
188   c4->Print("NumberV0CPMs.eps");
189   
190   char line[1024] ; 
191   sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; 
192   gROOT->ProcessLine(line);
193   sprintf(line, ".!rm -fR *.eps"); 
194   gROOT->ProcessLine(line);
195  
196   AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! ", GetName())) ;
197   
198   TString report ; 
199   if(problem)
200     report="Problems found, please check!!!";  
201   else 
202     report="OK";
203   
204   AliInfo(Form("*** %s Summary Report: %s\n",GetName(), report.Data())) ; 
205   
206 }