]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDQADataMakerRec.cxx
New default values for baselines (F.Prino)
[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 #include "AliFMDRawReader.h"
32 #include "AliRawReader.h"
33
34 //_____________________________________________________________________
35 // This is the class that collects the QA data for the FMD during
36 // reconstruction.  
37 //
38 // The following data types are picked up:
39 // - rec points
40 // - esd data
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   fDigitsArray("AliFMDDigit", 0),
55   fRecPointsArray("AliFMDRecPoint", 1000)
56 {
57   // ctor
58  
59 }
60
61 //_____________________________________________________________________
62 AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm) 
63   : AliQADataMakerRec(AliQA::GetDetName(AliQA::kFMD), 
64                       "FMD Quality Assurance Data Maker"),
65     fDigitsArray(qadm.fDigitsArray),
66     fRecPointsArray(qadm.fRecPointsArray)
67 {
68   // copy ctor 
69   // Parameters: 
70   //    qadm    Object to copy from
71   
72 }
73 //_____________________________________________________________________
74 AliFMDQADataMakerRec& AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm ) 
75 {
76   fDigitsArray = qadm.fDigitsArray;
77   fRecPointsArray = qadm.fRecPointsArray;
78   
79   return *this;
80 }
81 //_____________________________________________________________________
82 AliFMDQADataMakerRec::~AliFMDQADataMakerRec()
83 {
84  
85 }
86
87
88 //_____________________________________________________________________ 
89
90 void 
91 AliFMDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, 
92                                          TObjArray * list)
93 {
94   // Detector specific actions at end of cycle
95   // do the QA checking
96   AliLog::Message(5,"FMD: end of detector cycle",
97                   "AliFMDQADataMakerRec","AliFMDQADataMakerRec",
98                   "AliFMDQADataMakerRec::EndOfDetectorCycle",
99                   "AliFMDQADataMakerRec.cxx",95);
100   AliQAChecker::Instance()->Run(AliQA::kFMD, task, list);
101 }
102
103 //_____________________________________________________________________ 
104 void AliFMDQADataMakerRec::InitESDs()
105 {
106   // create Digits histograms in Digits subdir
107   TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3);
108   hEnergyOfESD->SetXTitle("Edep/Emip");
109   hEnergyOfESD->SetYTitle("Counts");
110   Add2ESDsList(hEnergyOfESD, 0);
111     
112 }
113
114 //_____________________________________________________________________ 
115 /*void AliFMDQADataMakerRec::InitDigits()
116 {
117   // create Digits histograms in Digits subdir
118   TH1I* hADCCounts      = new TH1I("hADCCounts","Dist of ADC counts",
119                                    1024,0,1024);
120   hADCCounts->SetXTitle("ADC counts");
121   hADCCounts->SetYTitle("");
122   Add2DigitsList(hADCCounts, 0);
123   
124 }
125 */
126 //_____________________________________________________________________ 
127 void AliFMDQADataMakerRec::InitRecPoints()
128 {
129   TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
130                                       "Energy Distribution",100,0,3);
131   hEnergyOfRecpoints->SetXTitle("Edep/Emip");
132   hEnergyOfRecpoints->SetYTitle("");
133   Add2RecPointsList(hEnergyOfRecpoints,0);
134 }
135
136 //_____________________________________________________________________ 
137 void AliFMDQADataMakerRec::InitRaws()
138 {
139   TH1I* hADCCounts      = new TH1I("hADCCounts","Dist of ADC counts",
140                                    1024,0,1023);
141   hADCCounts->SetXTitle("ADC counts");
142   hADCCounts->SetYTitle("");
143   Add2RawsList(hADCCounts, 0);
144
145 }
146
147 //_____________________________________________________________________
148 void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
149 {
150   if(!esd) {
151     AliError("FMD ESD object not found!!") ; 
152     return;
153   }
154   AliESDFMD* fmd = esd->GetFMDData();
155   if (!fmd) return;
156   
157   for(UShort_t det=1;det<=3;det++) {
158     for (UShort_t ir = 0; ir < 2; ir++) {
159       Char_t   ring = (ir == 0 ? 'I' : 'O');
160       UShort_t nsec = (ir == 0 ? 20  : 40);
161       UShort_t nstr = (ir == 0 ? 512 : 256);
162       for(UShort_t sec =0; sec < nsec;  sec++)  {
163         for(UShort_t strip = 0; strip < nstr; strip++) {
164           Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
165           if(mult == AliESDFMD::kInvalidMult) continue;
166           
167           GetESDsData(0)->Fill(mult);
168         }
169       }
170     }
171   }
172 }
173
174 /*
175 //_____________________________________________________________________
176 void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
177 {
178   // makes data from Digits  
179   if(!digits)  {
180     AliError("FMD Digit object not found!!") ;
181     return;
182   }
183   for(Int_t i=0;i<digits->GetEntriesFast();i++) {
184     //Raw ADC counts
185     AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
186     GetDigitsData(0)->Fill(digit->Counts());
187   }
188 }
189
190 //_____________________________________________________________________
191 void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
192 {
193   
194   fDigitsArray.Clear();
195   TBranch*      branch = digitTree->GetBranch("FMD");
196   if (!branch) {
197     AliWarning("FMD branch in Digit Tree not found") ; 
198     return;
199   } 
200   TClonesArray* digitsAddress = &fDigitsArray;
201   branch->SetAddress(&digitsAddress);
202   branch->GetEntry(0); 
203   MakeDigits(digitsAddress);
204 }
205 */
206 //_____________________________________________________________________
207 void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
208 {
209  
210   AliFMDRawReader fmdReader(rawReader,0);
211   TClonesArray* digitsAddress = &fDigitsArray;
212   
213   rawReader->Reset();
214                 
215         digitsAddress->Clear();
216         fmdReader.ReadAdcs(digitsAddress);
217         for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) {
218                 //Raw ADC counts
219                 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i));
220                 GetRawsData(0)->Fill(digit->Counts());
221         }
222 }
223
224 //_____________________________________________________________________
225 void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
226 {
227   // makes data from RecPoints
228   AliFMDParameters* pars = AliFMDParameters::Instance();
229   fRecPointsArray.Clear();
230   TBranch *fmdbranch = clustersTree->GetBranch("FMD");
231   if (!fmdbranch) { 
232     AliError("can't get the branch with the FMD recpoints !");
233     return;
234   }
235   
236   TClonesArray* RecPointsAddress = &fRecPointsArray;
237   
238   fmdbranch->SetAddress(&RecPointsAddress);
239   fmdbranch->GetEntry(0);
240   TIter next(RecPointsAddress) ; 
241   AliFMDRecPoint * rp ; 
242   while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
243     
244     GetRecPointsData(0)->Fill(rp->Edep()/pars->GetEdepMip()) ;
245   
246   }
247
248 }
249
250 //_____________________________________________________________________ 
251 void AliFMDQADataMakerRec::StartOfDetectorCycle()
252 {
253   // What 
254   // to 
255   // do?
256 }
257 //_____________________________________________________________________ 
258 //
259 // EOF
260 //