]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDQADataMakerRec.cxx
Introduced a data member TClonesArray to avoid redeclaration per event cf. comment...
[u/mrichter/AliRoot.git] / FMD / AliFMDQADataMakerRec.cxx
1 /**************************************************************************
2  * Copyright(c) 2004, 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 // --- ROOT system ---
16 #include <iostream>
17 #include <TClonesArray.h>
18 #include <TFile.h> 
19 #include <TH1F.h> 
20 #include <TH1I.h> 
21
22 // --- AliRoot header files ---
23 #include "AliESDEvent.h"
24 #include "AliLog.h"
25 #include "AliFMDQADataMakerRec.h"
26 #include "AliFMDDigit.h"
27 #include "AliFMDRecPoint.h"
28 #include "AliQAChecker.h"
29 #include "AliESDFMD.h"
30 #include "AliFMDParameters.h"
31
32 //_____________________________________________________________________
33 // This is the class that collects the QA data for the FMD during
34 // reconstruction.  
35 //
36 // The following data types are picked up:
37 // - digits
38 // - rec points
39 // - esd data
40 // The following data types are not supported (yet):
41 // - raws
42 // Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch
43 //_____________________________________________________________________
44
45 ClassImp(AliFMDQADataMakerRec)
46 #if 0
47 ; // For Emacs - do not delete!
48 #endif
49            
50 //_____________________________________________________________________
51 AliFMDQADataMakerRec::AliFMDQADataMakerRec() : 
52   AliQADataMakerRec(AliQA::GetDetName(AliQA::kFMD), 
53                     "FMD Quality Assurance Data Maker")
54 {
55   // ctor
56   fDigitsArray = new TClonesArray("AliFMDDigit", 1000) ; 
57   fRecPointsArray = new TClonesArray("AliFMDRecPoints", 1000) ; 
58 }
59
60 //_____________________________________________________________________
61 AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& /*qadm*/) 
62   : AliQADataMakerRec()
63 {
64   // copy ctor 
65   // Parameters: 
66   //    qadm    Object to copy from
67   
68 }
69 //_____________________________________________________________________
70 AliFMDQADataMakerRec::~AliFMDQADataMakerRec()
71 {
72   delete fDigitsArray;
73   delete fRecPointsArray;
74 }
75
76
77 //_____________________________________________________________________ 
78
79 void 
80 AliFMDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, 
81                                          TObjArray * list)
82 {
83   // Detector specific actions at end of cycle
84   // do the QA checking
85   AliLog::Message(5,"FMD: end of detector cycle",
86                   "AliFMDQADataMakerRec","AliFMDQADataMakerRec",
87                   "AliFMDQADataMakerRec::EndOfDetectorCycle",
88                   "AliFMDQADataMakerRec.cxx",95);
89   AliQAChecker::Instance()->Run(AliQA::kFMD, task, list);
90 }
91
92 //_____________________________________________________________________ 
93 void AliFMDQADataMakerRec::InitESDs()
94 {
95   // create Digits histograms in Digits subdir
96   TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3);
97   hEnergyOfESD->SetXTitle("Edep/Emip");
98   hEnergyOfESD->SetYTitle("Counts");
99   Add2ESDsList(hEnergyOfESD, 0);
100     
101 }
102
103 //_____________________________________________________________________ 
104 void AliFMDQADataMakerRec::InitDigits()
105 {
106   // create Digits histograms in Digits subdir
107   TH1I* hADCCounts      = new TH1I("hADCCounts","Dist of ADC counts",
108                                    1024,0,1024);
109   hADCCounts->SetXTitle("ADC counts");
110   hADCCounts->SetYTitle("");
111   Add2DigitsList(hADCCounts, 0);
112   
113 }
114
115 //_____________________________________________________________________ 
116 void AliFMDQADataMakerRec::InitRecPoints()
117 {
118   TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
119                                       "Energy Distribution",100,0,3);
120   hEnergyOfRecpoints->SetXTitle("Edep/Emip");
121   hEnergyOfRecpoints->SetYTitle("");
122   Add2RecPointsList(hEnergyOfRecpoints,0);
123 }
124
125 //_____________________________________________________________________ 
126 void AliFMDQADataMakerRec::InitRaws()
127 {
128   
129 }
130
131 //_____________________________________________________________________
132 void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
133 {
134   if(!esd) {
135     AliError("FMD ESD object not found!!") ; 
136     return;
137   }
138   AliESDFMD* fmd = esd->GetFMDData();
139   if (!fmd) return;
140   
141   for(UShort_t det=1;det<=3;det++) {
142     for (UShort_t ir = 0; ir < 2; ir++) {
143       Char_t   ring = (ir == 0 ? 'I' : 'O');
144       UShort_t nsec = (ir == 0 ? 20  : 40);
145       UShort_t nstr = (ir == 0 ? 512 : 256);
146       for(UShort_t sec =0; sec < nsec;  sec++)  {
147         for(UShort_t strip = 0; strip < nstr; strip++) {
148           Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
149           if(mult == AliESDFMD::kInvalidMult) continue;
150           
151           GetESDsData(0)->Fill(mult);
152         }
153       }
154     }
155   }
156 }
157
158 //_____________________________________________________________________
159 void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
160 {
161   // makes data from Digits  
162   if(!digits)  {
163     AliError("FMD Digit object not found!!") ;
164     return;
165   }
166   for(Int_t i=0;i<fDigitsArray->GetEntriesFast();i++) {
167     //Raw ADC counts
168     AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i));
169     GetDigitsData(0)->Fill(digit->Counts());
170   }
171 }
172
173 //_____________________________________________________________________
174 void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
175 {
176   
177   fDigitsArray->Clear();
178   TBranch*      branch = digitTree->GetBranch("FMD");
179   if (!branch) {
180     AliWarning("FMD branch in Digit Tree not found") ; 
181     return;
182   } 
183   
184   branch->SetAddress(&fDigitsArray);
185   branch->GetEntry(0); 
186   MakeDigits(fDigitsArray); 
187 }
188
189 //_____________________________________________________________________
190 void AliFMDQADataMakerRec::MakeRaws(AliRawReader* /*rawReader*/)
191 {
192   
193 }
194
195 //_____________________________________________________________________
196 void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
197 {
198   // makes data from RecPoints
199   fRecPointsArray->Clear();
200   TBranch *fmdbranch = clustersTree->GetBranch("FMD");
201   if (!fmdbranch) { 
202     AliError("can't get the branch with the FMD recpoints !");
203     return;
204   }
205   
206   
207   fmdbranch->SetAddress(&fRecPointsArray);
208   fmdbranch->GetEntry(0);
209     
210   TIter next(fRecPointsArray) ; 
211   AliFMDRecPoint * rp ; 
212   while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
213     GetRecPointsData(0)->Fill(rp->Particles()) ;
214   }
215
216 }
217
218 //_____________________________________________________________________ 
219 void AliFMDQADataMakerRec::StartOfDetectorCycle()
220 {
221   // What 
222   // to 
223   // do?
224 }
225 //_____________________________________________________________________ 
226 //
227 // EOF
228 //