]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALQADataMakerRec.cxx
Added support for strip range calib objects
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALQADataMakerRec.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 Based on the QA code for PHOS written by Yves Schutz July 2007
17
18 Authors:  J.Klay (Cal Poly) May 2008
19           S. Salur LBL April 2008
20
21 */
22
23 // --- ROOT system ---
24 #include <TClonesArray.h>
25 #include <TFile.h> 
26 #include <TH1F.h> 
27 #include <TH1I.h> 
28 #include <TH2F.h> 
29
30 // --- Standard library ---
31
32 // --- AliRoot header files ---
33 #include "AliESDCaloCluster.h"
34 #include "AliESDEvent.h"
35 #include "AliLog.h"
36 #include "AliEMCALQADataMakerRec.h"
37 #include "AliQAChecker.h"
38 #include "AliEMCALRecPoint.h" 
39 #include "AliEMCALRawUtils.h"
40 #include "AliEMCALReconstructor.h"
41 #include "AliEMCALRecParam.h"
42
43 ClassImp(AliEMCALQADataMakerRec)
44            
45 //____________________________________________________________________________ 
46   AliEMCALQADataMakerRec::AliEMCALQADataMakerRec() : 
47   AliQADataMakerRec(AliQA::GetDetName(AliQA::kEMCAL), "EMCAL Quality Assurance Data Maker")
48 {
49   // ctor
50 }
51
52 //____________________________________________________________________________ 
53 AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(const AliEMCALQADataMakerRec& qadm) :
54   AliQADataMakerRec()
55 {
56   //copy ctor 
57   SetName((const char*)qadm.GetName()) ; 
58   SetTitle((const char*)qadm.GetTitle()); 
59 }
60
61 //__________________________________________________________________
62 AliEMCALQADataMakerRec& AliEMCALQADataMakerRec::operator = (const AliEMCALQADataMakerRec& qadm )
63 {
64   // Equal operator.
65   this->~AliEMCALQADataMakerRec();
66   new(this) AliEMCALQADataMakerRec(qadm);
67   return *this;
68 }
69  
70 //____________________________________________________________________________ 
71 void AliEMCALQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
72 {
73   //Detector specific actions at end of cycle
74   // do the QA checking
75   AliQAChecker::Instance()->Run(AliQA::kEMCAL, task, list) ;  
76 }
77
78 //____________________________________________________________________________ 
79 void AliEMCALQADataMakerRec::InitESDs()
80 {
81   //Create histograms to controll ESD
82  
83   TH1F * h1 = new TH1F("hESDEmcalSpectrum",  "ESDs spectrum in EMCAL",    200, 0., 20.) ; 
84   h1->Sumw2() ;
85   Add2ESDsList(h1, kESDSpec)  ;                                                                                                        
86   TH1I * h2 = new TH1I("hESDEmcalMul", "ESDs multiplicity distribution in EMCAL", 100, 0,  100) ; 
87   h2->Sumw2() ;
88   Add2ESDsList(h2, kESDNtot) ;
89  
90   TH1I * h3 = new TH1I("hESDEmcalEtot", "ESDs Etot in EMCAL", 100, 0,  1000.) ; 
91   h3->Sumw2() ;
92   Add2ESDsList(h3, kESDEtot) ;
93  
94   TH1F * h4 = new TH1F("hESDEmcalPid",    "ESDs PID distribution in EMCAL",       100, 0., 1.) ;
95   h4->Sumw2() ;
96   Add2ESDsList(h4, kESDpid) ;
97         
98 }
99
100 //____________________________________________________________________________ 
101 void AliEMCALQADataMakerRec::InitRecPoints()
102 {
103   // create Reconstructed Points histograms in RecPoints subdir
104   TH2I * h0 = new TH2I("hRpEMCALxySMod1","RecPoints Rows x Columns for EMCAL supermodule 1", 64, -72., 72., 56, -63., 63.) ;
105   Add2RecPointsList(h0,kRPsmod1) ;
106   TH2I * h1 = new TH2I("hRpEMCALxySMod2","RecPoints Rows x Columns for EMCAL supermodule 2", 64, -72., 72., 56, -63., 63.) ;
107   Add2RecPointsList(h1,kRPsmod2) ;
108   TH2I * h2 = new TH2I("hRpEMCALxySMod3","RecPoints Rows x Columns for EMCAL supermodule 3", 64, -72., 72., 56, -63., 63.) ;
109   Add2RecPointsList(h2,kRPsmod3) ;
110   TH2I * h3 = new TH2I("hRpEMCALxySMod4","RecPoints Rows x Columns for EMCAL supermodule 4", 64, -72., 72., 56, -63., 63.) ;
111   Add2RecPointsList(h3,kRPsmod4) ;
112   TH2I * h4 = new TH2I("hRpEMCALxySMod5","RecPoints Rows x Columns for EMCAL supermodule 5", 64, -72., 72., 56, -63., 63.) ;
113   Add2RecPointsList(h4,kRPsmod5) ;
114   TH2I * h5 = new TH2I("hRpEMCALxySMod6","RecPoints Rows x Columns for EMCAL supermodule 6", 64, -72., 72., 56, -63., 63.) ;
115   Add2RecPointsList(h5,kRPsmod6) ;
116   TH2I * h6 = new TH2I("hRpEMCALxySMod7","RecPoints Rows x Columns for EMCAL supermodule 7", 64, -72., 72., 56, -63., 63.) ;
117   Add2RecPointsList(h6,kRPsmod7) ;
118   TH2I * h7 = new TH2I("hRpEMCALxySMod8","RecPoints Rows x Columns for EMCAL supermodule 8", 64, -72., 72., 56, -63., 63.) ;
119   Add2RecPointsList(h7,kRPsmod8) ;
120   TH2I * h8 = new TH2I("hRpEMCALxySMod9","RecPoints Rows x Columns for EMCAL supermodule 9", 64, -72., 72., 56, -63., 63.) ;
121   Add2RecPointsList(h8,kRPsmod9) ;
122   TH2I * h9 = new TH2I("hRpEMCALxySMod10","RecPoints Rows x Columns for EMCAL supermodule 10", 64, -72., 72., 56, -63., 63.) ;
123   Add2RecPointsList(h9,kRPsmod10) ;
124   TH2I * h10 = new TH2I("hRpEMCALxySMod11","RecPoints Rows x Columns for EMCAL supermodule 11", 64, -72., 72., 56, -63., 63.) ;
125   Add2RecPointsList(h10,kRPsmod11) ;
126   TH2I * h11 = new TH2I("hRpEMCALxySMod12","RecPoints Rows x Columns for EMCAL supermodule 12", 64, -72., 72., 56, -63., 63.) ;
127   Add2RecPointsList(h11,kRPsmod12) ;
128  
129   TH1F * h12 = new TH1F("hEmcalRecPointsSpectrum",  "RecPoints spectrum in EMCAL",   2000, 0., 20.) ; 
130   h12->Sumw2() ;
131   Add2RecPointsList(h12, kRPSpec)  ;
132
133   TH1I * h13 = new TH1I("hEmcalRecPointsMul", "RecPoints multiplicity distribution in EMCAL", 100, 0,  100) ; 
134   h13->Sumw2() ;
135   Add2RecPointsList(h13, kRPNtot) ;
136
137   TH1I * h14 = new TH1I("hEmcalRecPointsEtot", "RecPoints Etot in EMCAL", 200, 0,  200.) ; 
138   h14->Sumw2() ;
139   Add2RecPointsList(h14, kRPEtot) ;
140
141 }
142
143 //____________________________________________________________________________ 
144 void AliEMCALQADataMakerRec::InitRaws()
145 {
146   // create Raws histograms in Raws subdir
147   TH2I * h0 = new TH2I("hHighEMCALxySMod1","High Gain Rows x Columns for EMCAL supermodule 1", 64, 0, 64, 56, 0, 56) ;
148   Add2RawsList(h0,kHGsmod1) ;
149   TH2I * h1 = new TH2I("hHighEMCALxySMod2","High Gain Rows x Columns for EMCAL supermodule 2", 64, 0, 64, 56, 0, 56) ;
150   Add2RawsList(h1,kHGsmod2) ;
151   TH2I * h2 = new TH2I("hHighEMCALxySMod3","High Gain Rows x Columns for EMCAL supermodule 3", 64, 0, 64, 56, 0, 56) ;
152   Add2RawsList(h2,kHGsmod3) ;
153   TH2I * h3 = new TH2I("hHighEMCALxySMod4","High Gain Rows x Columns for EMCAL supermodule 4", 64, 0, 64, 56, 0, 56) ;
154   Add2RawsList(h3,kHGsmod4) ;
155   TH2I * h4 = new TH2I("hHighEMCALxySMod5","High Gain Rows x Columns for EMCAL supermodule 5", 64, 0, 64, 56, 0, 56) ;
156   Add2RawsList(h4,kHGsmod5) ;
157   TH2I * h5 = new TH2I("hHighEMCALxySMod6","High Gain Rows x Columns for EMCAL supermodule 6", 64, 0, 64, 56, 0, 56) ;
158   Add2RawsList(h5,kHGsmod6) ;
159   TH2I * h6 = new TH2I("hHighEMCALxySMod7","High Gain Rows x Columns for EMCAL supermodule 7", 64, 0, 64, 56, 0, 56) ;
160   Add2RawsList(h6,kHGsmod7) ;
161   TH2I * h7 = new TH2I("hHighEMCALxySMod8","High Gain Rows x Columns for EMCAL supermodule 8", 64, 0, 64, 56, 0, 56) ;
162   Add2RawsList(h7,kHGsmod8) ;
163   TH2I * h8 = new TH2I("hHighEMCALxySMod9","High Gain Rows x Columns for EMCAL supermodule 9", 64, 0, 64, 56, 0, 56) ;
164   Add2RawsList(h8,kHGsmod9) ;
165   TH2I * h9 = new TH2I("hHighEMCALxySMod10","High Gain Rows x Columns for EMCAL supermodule 10", 64, 0, 64, 56, 0, 56) ;
166   Add2RawsList(h9,kHGsmod10) ;
167   TH2I * h10 = new TH2I("hHighEMCALxySMod11","High Gain Rows x Columns for EMCAL supermodule 11", 64, 0, 64, 56, 0, 56) ;
168   Add2RawsList(h10,kHGsmod11) ;
169   TH2I * h11 = new TH2I("hHighEMCALxySMod12","High Gain Rows x Columns for EMCAL supermodule 12", 64, 0, 64, 56, 0, 56) ;
170   Add2RawsList(h11,kHGsmod12) ;
171
172
173   TH2I * h12 = new TH2I("hLowEMCALxySMod1","Low Gain Rows x Columns for EMCAL supermodule 1", 64, 0, 64, 56, 0, 56) ;
174   Add2RawsList(h12,kLGsmod1) ;
175   TH2I * h13 = new TH2I("hLowEMCALxySMod2","Low Gain Rows x Columns for EMCAL supermodule 2", 64, 0, 64, 56, 0, 56) ;
176   Add2RawsList(h13,kLGsmod2) ;
177   TH2I * h14 = new TH2I("hLowEMCALxySMod3","Low Gain Rows x Columns for EMCAL supermodule 3", 64, 0, 64, 56, 0, 56) ;
178   Add2RawsList(h14,kLGsmod3) ;
179   TH2I * h15 = new TH2I("hLowEMCALxySMod4","Low Gain Rows x Columns for EMCAL supermodule 4", 64, 0, 64, 56, 0, 56) ;
180   Add2RawsList(h15,kLGsmod4) ;    
181   TH2I * h16 = new TH2I("hLowEMCALxySMod5","Low Gain Rows x Columns for EMCAL supermodule 5", 64, 0, 64, 56, 0, 56) ;
182   Add2RawsList(h16,kLGsmod5) ;
183   TH2I * h17 = new TH2I("hLowEMCALxySMod6","Low Gain Rows x Columns for EMCAL supermodule 6", 64, 0, 64, 56, 0, 56) ;
184   Add2RawsList(h17,kLGsmod6) ;
185   TH2I * h18 = new TH2I("hLowEMCALxySMod7","Low Gain Rows x Columns for EMCAL supermodule 7", 64, 0, 64, 56, 0, 56) ;
186   Add2RawsList(h18,kLGsmod7) ;
187   TH2I * h19 = new TH2I("hLowEMCALxySMod8","Low Gain Rows x Columns for EMCAL supermodule 8", 64, 0, 64, 56, 0, 56) ;
188   Add2RawsList(h19,kLGsmod8) ;
189   TH2I * h20 = new TH2I("hLowEMCALxySMod9","Low Gain Rows x Columns for EMCAL supermodule 9", 64, 0, 64, 56, 0, 56) ;
190   Add2RawsList(h20,kLGsmod9) ;    
191   TH2I * h21 = new TH2I("hLowEMCALxySMod10","Low Gain Rows x Columns for EMCAL supermodule 10", 64, 0, 64, 56, 0, 56) ;
192   Add2RawsList(h21,kLGsmod10) ;
193   TH2I * h22 = new TH2I("hLowEMCALxySMod11","Low Gain Rows x Columns for EMCAL supermodule 11", 64, 0, 64, 56, 0, 56) ;
194   Add2RawsList(h22,kLGsmod11) ;
195   TH2I * h23 = new TH2I("hLowEMCALxySMod12","Low Gain Rows x Columns for EMCAL supermodule 12", 64, 0, 64, 56, 0, 56) ;
196   Add2RawsList(h23,kLGsmod12) ;
197
198
199   TH1I * h24 = new TH1I("hLowEmcalSupermodules",    "Low Gain Hits in EMCAL supermodules",       12, 0, 12) ;
200   h24->Sumw2() ;
201   Add2RawsList(h24, kNsmodLG) ;
202   TH1I * h25 = new TH1I("hHighEmcalSupermodules",   "High Gain Hits in EMCAL supermodules",       12, 0, 12) ;
203   h25->Sumw2() ;
204   Add2RawsList(h25, kNsmodHG) ;
205
206   TH1F * h26 = new TH1F("hLowEmcalRawtime", "Low Gain Time of raw hits in EMCAL", 500, -50., 200.) ;
207   h26->Sumw2() ;
208   Add2RawsList(h26, kLGtime) ;
209   TH1F * h27 = new TH1F("hHighEmcalRawtime", "High Gain Time of raw hits in EMCAL", 500, -50., 200.) ;
210   h27->Sumw2() ;
211   Add2RawsList(h27, kHGtime) ;
212
213   TH1F * h28 = new TH1F("hLowEmcalRawEnergy", "Low Gain Energy of raw hits in EMCAL", 500, 0., 1000.) ;
214   h28->Sumw2() ;
215   Add2RawsList(h28, kSpecLG) ;
216   TH1F * h29 = new TH1F("hHighEmcalRawEnergy", "High Gain Energy of raw hits in EMCAL",500,0., 1000.) ;
217   h29->Sumw2() ;
218   Add2RawsList(h29, kSpecHG) ;
219
220   TH1F * h30 = new TH1F("hLowNtot", "Low Gain Total Number of raw hits in EMCAL", 500, 0., 5000.) ;
221   h30->Sumw2() ;
222   Add2RawsList(h30, kNtotLG) ;
223   TH1F * h31 = new TH1F("hHighNtot", "High Gain Total Number of raw hits in EMCAL",500,0., 5000.) ;
224   h31->Sumw2() ;
225   Add2RawsList(h31, kNtotHG) ;
226
227   TH1F * h32 = new TH1F("hLowEtot", "Low Gain Total Energy of raw hits in EMCAL", 500, 0., 5000.) ;
228   h32->Sumw2() ;
229   Add2RawsList(h32, kEtotLG) ;
230   TH1F * h33 = new TH1F("hHighEtot", "High Gain Total Energy of raw hits in EMCAL",500,0., 100000.) ;
231   h33->Sumw2() ;
232   Add2RawsList(h33, kEtotHG) ;
233   
234 }
235
236 //____________________________________________________________________________
237 void AliEMCALQADataMakerRec::MakeESDs(AliESDEvent * esd)
238 {
239   // make QA data from ESDs
240
241   Int_t nTot = 0 ; 
242   Double_t eTot = 0 ; 
243   for ( Int_t index = 0; index < esd->GetNumberOfCaloClusters() ; index++ ) {
244     AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
245     if( clu->IsEMCAL() ) {
246       GetESDsData(kESDSpec)->Fill(clu->E()) ;
247       Double_t *pid=clu->GetPid() ;
248       GetESDsData(kESDpid)->Fill(pid[AliPID::kPhoton]) ;
249       eTot+=clu->E() ;
250       nTot++ ;
251     } 
252   }
253   GetESDsData(kESDNtot)->Fill(nTot) ;
254   GetESDsData(kESDEtot)->Fill(eTot) ;
255 }
256
257 //____________________________________________________________________________
258 void AliEMCALQADataMakerRec::MakeRaws(AliRawReader* /* rawReader */)
259 {
260   //Fill prepared histograms with Raw digit properties
261
262   //Raw histogram filling not yet implemented
263
264 }
265
266 //____________________________________________________________________________
267 void AliEMCALQADataMakerRec::MakeRecPoints(TTree * clustersTree)
268 {
269   // makes data from RecPoints
270   TBranch *emcbranch = clustersTree->GetBranch("EMCALECARP");
271   if (!emcbranch) { 
272     AliError("can't get the branch with the EMCAL clusters !");
273     return;
274   }
275   TObjArray * emcrecpoints = new TObjArray(100) ;
276   emcbranch->SetAddress(&emcrecpoints);
277   emcbranch->GetEntry(0);
278   
279   GetRecPointsData(kRPNtot)->Fill(emcrecpoints->GetEntriesFast()) ; 
280   TIter next(emcrecpoints) ; 
281   AliEMCALRecPoint * rp ; 
282   Double_t eTot = 0. ; 
283   while ( (rp = dynamic_cast<AliEMCALRecPoint *>(next())) ) {
284     GetRecPointsData(kRPSpec)->Fill( rp->GetEnergy()) ;
285     Int_t smod = rp->GetSuperModuleNumber() ;
286     TVector3 pos ;
287     rp->GetLocalPosition(pos) ;
288     switch(smod){
289       case 0: GetRecPointsData(kRPsmod1)->Fill(pos.X(),pos.Z()) ; break ;
290       case 1: GetRecPointsData(kRPsmod2)->Fill(pos.X(),pos.Z()) ; break ;
291       case 2: GetRecPointsData(kRPsmod3)->Fill(pos.X(),pos.Z()) ; break ;
292       case 3: GetRecPointsData(kRPsmod4)->Fill(pos.X(),pos.Z()) ; break ;
293       case 4: GetRecPointsData(kRPsmod5)->Fill(pos.X(),pos.Z()) ; break ;
294       case 5: GetRecPointsData(kRPsmod6)->Fill(pos.X(),pos.Z()) ; break ;
295       case 6: GetRecPointsData(kRPsmod7)->Fill(pos.X(),pos.Z()) ; break ;
296       case 7: GetRecPointsData(kRPsmod8)->Fill(pos.X(),pos.Z()) ; break ;
297       case 8: GetRecPointsData(kRPsmod9)->Fill(pos.X(),pos.Z()) ; break ;
298       case 9: GetRecPointsData(kRPsmod10)->Fill(pos.X(),pos.Z()) ; break ;
299       case 10: GetRecPointsData(kRPsmod11)->Fill(pos.X(),pos.Z()) ; break ;
300       case 11: GetRecPointsData(kRPsmod12)->Fill(pos.X(),pos.Z()) ; break ;
301     }
302     
303     eTot+= rp->GetEnergy() ;
304   }
305   GetRecPointsData(kRPEtot)->Fill(eTot) ;
306   emcrecpoints->Delete();
307   delete emcrecpoints;
308   
309 }
310
311 //____________________________________________________________________________ 
312 void AliEMCALQADataMakerRec::StartOfDetectorCycle()
313 {
314   //Detector specific actions at start of cycle
315   
316 }