introducing QA
[u/mrichter/AliRoot.git] / VZERO / AliVZEROQADataMakerRec.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
17 /*
18   Produces the data needed to calculate the quality assurance. 
19   All data must be mergeable objects.
20 */
21
22 // --- ROOT system ---
23 #include <TClonesArray.h>
24 #include <TFile.h> 
25 #include <TH1F.h> 
26 #include <TH1I.h> 
27 #include <TH2F.h> 
28
29 // --- Standard library ---
30
31 // --- AliRoot header files ---
32 #include "AliESDEvent.h"
33 #include "AliLog.h"
34 #include "AliVZEROQADataMakerRec.h"
35 #include "AliQAChecker.h"
36 #include "AliVZERORawStream.h"
37 #include "AliVZEROReconstructor.h"
38
39
40 ClassImp(AliVZEROQADataMakerRec)
41            
42 //____________________________________________________________________________ 
43   AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() : 
44   AliQADataMakerRec(AliQA::GetDetName(AliQA::kVZERO), "VZERO Quality Assurance Data Maker")
45 {
46   // constructor
47 }
48
49 //____________________________________________________________________________ 
50 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
51   AliQADataMakerRec()
52 {
53   //copy constructor 
54   SetName((const char*)qadm.GetName()) ; 
55   SetTitle((const char*)qadm.GetTitle()); 
56 }
57
58 //__________________________________________________________________
59 AliVZEROQADataMakerRec& AliVZEROQADataMakerRec::operator = (const AliVZEROQADataMakerRec& qadm )
60 {
61   // Equal operator
62   this->~AliVZEROQADataMakerRec();
63   new(this) AliVZEROQADataMakerRec(qadm);
64   return *this;
65 }
66  
67 //____________________________________________________________________________ 
68 void AliVZEROQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
69 {
70   //Detector specific actions at end of cycle
71   // do the QA checking
72   AliQAChecker::Instance()->Run(AliQA::kVZERO, task, list) ;  
73 }
74
75 //____________________________________________________________________________ 
76 void AliVZEROQADataMakerRec::InitESDs()
77 {
78   //Create histograms to controll ESD
79  
80   TH1I * h1 = new TH1I("hVZERONbPMA", "Number of PMs fired in V0A", 100, 0, 99); 
81   h1->Sumw2() ;
82   Add2ESDsList(h1, 0)  ;                                                                                                        
83   TH1I * h2 = new TH1I("hVZERONbPMC", "Number of PMs fired in V0C", 100, 0, 99); 
84   h2->Sumw2() ;
85   Add2ESDsList(h2, 1) ;
86  
87   TH1I * h3 = new TH1I("hVZEROMultA", "Multiplicity in V0A", 50, 0, 49) ; 
88   h3->Sumw2() ;
89   Add2ESDsList(h3, 2) ;
90  
91   TH1I * h4 = new TH1I("hVZEROMultC", "Multiplicity in V0A", 50, 0, 49) ; 
92   h4->Sumw2() ;
93   Add2ESDsList(h4, 3) ;
94         
95 }
96
97
98 //____________________________________________________________________________ 
99 // void AliVZEROQADataMakerRec::InitRaws()
100 // {
101 //   // create Raws histograms in Raws subdir
102 //   TH2I * h0 = new TH2I("hHighVZEROxyMod1","High Gain Rows x Columns for VZERO module 1", 64, 0, 64, 56, 0, 56) ;
103 //   Add2RawsList(h0,kHGmod1) ;
104 //   TH2I * h1 = new TH2I("hHighVZEROxyMod2","High Gain Rows x Columns for VZERO module 2", 64, 0, 64, 56, 0, 56) ;
105 //   Add2RawsList(h1,kHGmod2) ;
106 //   TH2I * h2 = new TH2I("hHighVZEROxyMod3","High Gain Rows x Columns for VZERO module 3", 64, 0, 64, 56, 0, 56) ;
107 //   Add2RawsList(h2,kHGmod3) ;
108 //   TH2I * h3 = new TH2I("hHighVZEROxyMod4","High Gain Rows x Columns for VZERO module 4", 64, 0, 64, 56, 0, 56) ;
109 //   Add2RawsList(h3,kHGmod4) ;
110 //   TH2I * h4 = new TH2I("hHighVZEROxyMod5","High Gain Rows x Columns for VZERO module 5", 64, 0, 64, 56, 0, 56) ;
111 //   Add2RawsList(h4,kHGmod5) ;
112 //   TH2I * h5 = new TH2I("hLowVZEROxyMod1","Low Gain Rows x Columns for VZERO module 1", 64, 0, 64, 56, 0, 56) ;
113 //   Add2RawsList(h5,kLGmod1) ;
114 //   TH2I * h6 = new TH2I("hLowVZEROxyMod2","Low Gain Rows x Columns for VZERO module 2", 64, 0, 64, 56, 0, 56) ;
115 //   Add2RawsList(h6,kLGmod2) ;
116 //   TH2I * h7 = new TH2I("hLowVZEROxyMod3","Low Gain Rows x Columns for VZERO module 3", 64, 0, 64, 56, 0, 56) ;
117 //   Add2RawsList(h7,kLGmod3) ;
118 //   TH2I * h8 = new TH2I("hLowVZEROxyMod4","Low Gain Rows x Columns for VZERO module 4", 64, 0, 64, 56, 0, 56) ;
119 //   Add2RawsList(h8,kLGmod4) ;                                                                                                               
120 //   TH2I * h9 = new TH2I("hLowVZEROxyMod5","Low Gain Rows x Columns for VZERO module 5", 64, 0, 64, 56, 0, 56) ;                               
121 //   Add2RawsList(h9,kLGmod5) ;                                                                                                               
122 //                                                                                                                                            
123 //                                                                                                                                            
124 //   TH1I * h10 = new TH1I("hLowVZEROModules",    "Low Gain Hits in EMCA VZERO modules",       6, 0, 6) ;                                       
125 //   h10->Sumw2() ;                                                                                                                           
126 //   Add2RawsList(h10, kNmodLG) ;                                                                                                             
127 //   TH1I * h11 = new TH1I("hHighVZEROModules",   "High Gain Hits in EMCA VZERO modules",       6, 0, 6) ;                                      
128 //   h11->Sumw2() ;                                                                                                                           
129 //   Add2RawsList(h11, kNmodHG) ;                                                                                                             
130 //                                                                                                                                            
131 //   TH1F * h12 = new TH1F("hLowVZERORawtime", "Low Gain Time of raw hits in VZERO", 500, -50., 200.) ;                                            
132 //   h12->Sumw2() ;                                                                                                                           
133 //   Add2RawsList(h12, kLGtime) ;                                                                                                             
134 //   TH1F * h13 = new TH1F("hHighVZERORawtime", "High Gain Time of raw hits in VZERO", 500, -50., 200.) ;                                          
135 //   h13->Sumw2() ;                                                                                                                           
136 //   Add2RawsList(h13, kHGtime) ;                                                                                                             
137 //                                                                                                                                            
138 //   TH1F * h14 = new TH1F("hLowVZERORawEnergy", "Low Gain Energy of raw hits in VZERO", 500, 0., 1000.) ;                                      
139 //   h14->Sumw2() ;                                                                                                                           
140 //   Add2RawsList(h14, kSpecLG) ;                                                                                                             
141 //   TH1F * h15 = new TH1F("hHighVZERORawEnergy", "High Gain Energy of raw hits in VZERO",500,0., 1000.) ;                                      
142 //   h15->Sumw2() ;                                                                                                                           
143 //   Add2RawsList(h15, kSpecHG) ;                                                                                                             
144 //                                                                                                                                            
145 //   TH1F * h16 = new TH1F("hLowNtot", "Low Gain Total Number of raw hits in VZERO", 500, 0., 5000.) ;                                         
146 //   h16->Sumw2() ;                                                                                                                           
147 //   Add2RawsList(h16, kNtotLG) ;                                                                                                             
148 //   TH1F * h17 = new TH1F("hHighNtot", "High Gain Total Number of raw hits in VZERO",500,0., 5000.) ;                                         
149 //   h17->Sumw2() ;                                                                                                                           
150 //   Add2RawsList(h17, kNtotHG) ;                                                                                                             
151 //                                                                                                                                            
152 //   TH1F * h18 = new TH1F("hLowEtot", "Low Gain Total Energy of raw hits in VZERO", 500, 0., 5000.) ;                                       
153 //   h18->Sumw2() ;                                                                                                                           
154 //   Add2RawsList(h18, kEtotLG) ;                                                                                                             
155 //   TH1F * h19 = new TH1F("hHighEtot", "High Gain Total Energy of raw hits in VZERO",500,0., 100000.) ;                                       
156 //   h19->Sumw2() ;                                                                                                                           
157 //   Add2RawsList(h19, kEtotHG) ;                                                                                                             
158 //   
159 // }
160
161 //____________________________________________________________________________
162 void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
163 {
164   // make QA data from ESDs
165
166
167   AliESDVZERO *esdVZERO=esd->GetVZEROData();
168    
169   if (esdVZERO) { 
170     GetESDsData(0)->Fill(esdVZERO->GetNbPMV0A());
171     GetESDsData(1)->Fill(esdVZERO->GetNbPMV0C());  
172     GetESDsData(2)->Fill(esdVZERO->GetMTotV0A());
173     GetESDsData(3)->Fill(esdVZERO->GetMTotV0C());  
174   }
175
176 }
177
178 //____________________________________________________________________________
179 // void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
180 // {
181 //   //Fill prepared histograms with Raw digit properties
182 //   rawReader->Reset() ;
183 //   AliVZERORawDecoder * decoder ;
184 //   if(strcmp(AliVZEROReconstructor::GetRecoParamEmc()->DecoderVersion(),"v1")==0)
185 //     decoder=new AliVZERORawDecoderv1(rawReader);
186 //   else
187 //     if(strcmp(AliVZEROReconstructor::GetRecoParamEmc()->DecoderVersion(),"v2")==0)
188 //       decoder=new AliVZERORawDecoderv2(rawReader);
189 //     else
190 //       decoder=new AliVZERORawDecoder(rawReader);
191 //   decoder->SetOldRCUFormat  (AliVZEROReconstructor::GetRecoParamEmc()->IsOldRCUFormat());
192 //   decoder->SubtractPedestals(AliVZEROReconstructor::GetRecoParamEmc()->SubtractPedestals());
193 //   Double_t lgEtot=0. ;
194 //   Double_t hgEtot=0. ;
195 //   Int_t lgNtot=0 ;
196 //   Int_t hgNtot=0 ;
197 // 
198 //   while (decoder->NextDigit()) {
199 //    Int_t module  = decoder->GetModule() ;
200 //    Int_t row     = decoder->GetRow() ;
201 //    Int_t col     = decoder->GetColumn() ;
202 //    Double_t time = decoder->GetTime() ;
203 //    Double_t energy  = decoder->GetEnergy() ;
204 //    Bool_t lowGain = decoder->IsLowGain();
205 //    if (lowGain) {
206 //      if(energy<2.)
207 //        continue ;
208 //      switch(module){
209 //         case 1: GetRawsData(kLGmod1)->Fill(row-0.5,col-0.5) ; break ;
210 //         case 2: GetRawsData(kLGmod2)->Fill(row-0.5,col-0.5) ; break ;
211 //         case 3: GetRawsData(kLGmod3)->Fill(row-0.5,col-0.5) ; break ;
212 //         case 4: GetRawsData(kLGmod4)->Fill(row-0.5,col-0.5) ; break ;
213 //         case 5: GetRawsData(kLGmod5)->Fill(row-0.5,col-0.5) ; break ;
214 //      }                                  
215 //      GetRawsData(kNmodLG)->Fill(module) ;
216 //      GetRawsData(kLGtime)->Fill(time) ; 
217 //      GetRawsData(kSpecLG)->Fill(energy) ;    
218 //      lgEtot+=energy ;
219 //      lgNtot++ ;   
220 //    } else {        
221 //      if(energy<8.)
222 //        continue ;
223 //      switch (module){
224 //          case 1: GetRawsData(kHGmod1)->Fill(row-0.5,col-0.5) ; break ;
225 //          case 2: GetRawsData(kHGmod2)->Fill(row-0.5,col-0.5) ; break ;
226 //          case 3: GetRawsData(kHGmod3)->Fill(row-0.5,col-0.5) ; break ;
227 //          case 4: GetRawsData(kHGmod4)->Fill(row-0.5,col-0.5) ; break ;
228 //          case 5: GetRawsData(kHGmod5)->Fill(row-0.5,col-0.5) ; break ;
229 //      }              
230 //      GetRawsData(kNmodHG)->Fill(module) ; 
231 //      GetRawsData(kHGtime)->Fill(time) ;  
232 //      GetRawsData(kSpecHG)->Fill(energy) ;
233 //      hgEtot+=energy ; 
234 //      hgNtot++ ;  
235 //    }                 
236 //   }                    
237 //   GetRawsData(kEtotLG)->Fill(lgEtot) ; 
238 //   GetRawsData(kEtotHG)->Fill(hgEtot) ;  
239 //   GetRawsData(kNtotLG)->Fill(lgNtot) ;
240 //   GetRawsData(kNtotHG)->Fill(hgNtot) ;
241 // }
242
243 //____________________________________________________________________________ 
244 void AliVZEROQADataMakerRec::StartOfDetectorCycle()
245 {
246   // Detector specific actions at start of cycle
247   
248 }