1 /**************************************************************************
2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 ---
17 #include <TClonesArray.h>
22 // --- AliRoot header files ---
23 #include "AliESDEvent.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 #include "AliFMDAltroMapping.h"
35 //_____________________________________________________________________
36 // This is the class that collects the QA data for the FMD during
39 // The following data types are picked up:
43 // Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch
44 //_____________________________________________________________________
46 ClassImp(AliFMDQADataMakerRec)
48 ; // For Emacs - do not delete!
51 //_____________________________________________________________________
52 AliFMDQADataMakerRec::AliFMDQADataMakerRec() :
53 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD),
54 "FMD Quality Assurance Data Maker"),
55 fDigitsArray("AliFMDDigit", 0),
56 fRecPointsArray("AliFMDRecPoint", 1000)
62 //_____________________________________________________________________
63 AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm)
64 : AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD),
65 "FMD Quality Assurance Data Maker"),
66 fDigitsArray(qadm.fDigitsArray),
67 fRecPointsArray(qadm.fRecPointsArray)
71 // qadm Object to copy from
74 //_____________________________________________________________________
75 AliFMDQADataMakerRec& AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm )
77 fDigitsArray = qadm.fDigitsArray;
78 fRecPointsArray = qadm.fRecPointsArray;
82 //_____________________________________________________________________
83 AliFMDQADataMakerRec::~AliFMDQADataMakerRec()
89 //_____________________________________________________________________
92 AliFMDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task,
95 // Detector specific actions at end of cycle
97 AliLog::Message(5,"FMD: end of detector cycle",
98 "AliFMDQADataMakerRec","AliFMDQADataMakerRec",
99 "AliFMDQADataMakerRec::EndOfDetectorCycle",
100 "AliFMDQADataMakerRec.cxx",95);
101 AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list);
104 //_____________________________________________________________________
105 void AliFMDQADataMakerRec::InitESDs()
107 // create Digits histograms in Digits subdir
108 const Bool_t expert = kTRUE ;
109 const Bool_t image = kTRUE ;
111 TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3);
112 hEnergyOfESD->SetXTitle("Edep/Emip");
113 hEnergyOfESD->SetYTitle("Counts");
114 Add2ESDsList(hEnergyOfESD, 0, !expert, image);
118 //_____________________________________________________________________
119 void AliFMDQADataMakerRec::InitDigits()
121 // create Digits histograms in Digits subdir
122 const Bool_t expert = kTRUE ;
123 const Bool_t image = kTRUE ;
125 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts",1024,0,1024);
126 hADCCounts->SetXTitle("ADC counts");
127 Add2DigitsList(hADCCounts, 0, !expert, image);
131 //_____________________________________________________________________
132 void AliFMDQADataMakerRec::InitRecPoints()
134 // create Reconstructed Points histograms in RecPoints subdir
135 const Bool_t expert = kTRUE ;
136 const Bool_t image = kTRUE ;
138 TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
139 "Energy Distribution",100,0,3);
140 hEnergyOfRecpoints->SetXTitle("Edep/Emip");
141 hEnergyOfRecpoints->SetYTitle("");
142 Add2RecPointsList(hEnergyOfRecpoints,0, !expert, image);
145 //_____________________________________________________________________
146 void AliFMDQADataMakerRec::InitRaws()
148 // create Raws histograms in Raws subdir
149 const Bool_t expert = kTRUE ;
150 const Bool_t saveCorr = kTRUE ;
151 const Bool_t image = kTRUE ;
154 for(Int_t det = 1; det<=3; det++) {
155 Int_t firstring = (det==1 ? 1 : 0);
156 for(Int_t iring = firstring;iring<=1;iring++) {
157 Char_t ring = (iring == 1 ? 'I' : 'O');
158 hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c",
159 det, ring), "ADC counts",
162 Int_t index1 = GetHalfringIndex(det, ring, 0,1);
163 Add2RawsList(hADCCounts, index1, expert, !image, !saveCorr);
165 for(Int_t b = 0; b<=1;b++) {
167 //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11;
168 UInt_t board = (iring == 1 ? 0 : 1);
169 board = board + b*16;
172 hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c_board%d",
173 det, ring, board), "ADC counts",
175 hADCCounts->SetXTitle("ADC counts");
176 hADCCounts->SetYTitle("");
177 Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
178 Add2RawsList(hADCCounts, index2, !expert, image, !saveCorr);
185 //_____________________________________________________________________
186 void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
189 AliError("FMD ESD object not found!!") ;
192 AliESDFMD* fmd = esd->GetFMDData();
195 for(UShort_t det=1;det<=3;det++) {
196 for (UShort_t ir = 0; ir < 2; ir++) {
197 Char_t ring = (ir == 0 ? 'I' : 'O');
198 UShort_t nsec = (ir == 0 ? 20 : 40);
199 UShort_t nstr = (ir == 0 ? 512 : 256);
200 for(UShort_t sec =0; sec < nsec; sec++) {
201 for(UShort_t strip = 0; strip < nstr; strip++) {
202 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
203 if(mult == AliESDFMD::kInvalidMult) continue;
205 GetESDsData(0)->Fill(mult);
213 //_____________________________________________________________________
214 void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
216 // makes data from Digits
218 AliError("FMD Digit object not found!!") ;
221 for(Int_t i=0;i<digits->GetEntriesFast();i++) {
223 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
224 GetDigitsData(0)->Fill(digit->Counts());
228 //_____________________________________________________________________
229 void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
232 fDigitsArray.Clear();
233 TBranch* branch = digitTree->GetBranch("FMD");
235 AliWarning("FMD branch in Digit Tree not found") ;
238 TClonesArray* digitsAddress = &fDigitsArray;
239 branch->SetAddress(&digitsAddress);
241 MakeDigits(digitsAddress);
244 //_____________________________________________________________________
245 void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
248 AliFMDRawReader fmdReader(rawReader,0);
249 TClonesArray* digitsAddress = &fDigitsArray;
253 digitsAddress->Clear();
254 fmdReader.ReadAdcs(digitsAddress);
255 for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) {
257 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i));
258 UShort_t det = digit->Detector();
259 Char_t ring = digit->Ring();
260 UShort_t sec = digit->Sector();
261 // UShort_t strip = digit->Strip();
262 AliFMDParameters* pars = AliFMDParameters::Instance();
263 Short_t board = pars->GetAltroMap()->Sector2Board(ring, sec);
265 Int_t index1 = GetHalfringIndex(det, ring, 0, 1);
266 GetRawsData(index1)->Fill(digit->Counts());
267 Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
268 GetRawsData(index2)->Fill(digit->Counts());
273 //_____________________________________________________________________
274 void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
276 // makes data from RecPoints
277 AliFMDParameters* pars = AliFMDParameters::Instance();
278 fRecPointsArray.Clear();
279 TBranch *fmdbranch = clustersTree->GetBranch("FMD");
281 AliError("can't get the branch with the FMD recpoints !");
285 TClonesArray* RecPointsAddress = &fRecPointsArray;
287 fmdbranch->SetAddress(&RecPointsAddress);
288 fmdbranch->GetEntry(0);
289 TIter next(RecPointsAddress) ;
290 AliFMDRecPoint * rp ;
291 while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
293 GetRecPointsData(0)->Fill(rp->Edep()/pars->GetEdepMip()) ;
299 //_____________________________________________________________________
300 void AliFMDQADataMakerRec::StartOfDetectorCycle()
306 //_____________________________________________________________________
307 Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det,
312 UShort_t iring = (ring == 'I' ? 1 : 0);
314 Int_t index = ( ((det-1) << 3) | (iring << 2) | (board << 1) | (monitor << 0));
320 //_____________________________________________________________________