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(AliQA::GetDetName(AliQA::kFMD),
54 "FMD Quality Assurance Data Maker"),
55 fDigitsArray("AliFMDDigit", 0),
56 fRecPointsArray("AliFMDRecPoint", 1000)
62 //_____________________________________________________________________
63 AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm)
64 : AliQADataMakerRec(AliQA::GetDetName(AliQA::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(AliQA::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(AliQA::kFMD, task, list);
104 //_____________________________________________________________________
105 void AliFMDQADataMakerRec::InitESDs()
107 // create Digits histograms in Digits subdir
108 TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3);
109 hEnergyOfESD->SetXTitle("Edep/Emip");
110 hEnergyOfESD->SetYTitle("Counts");
111 Add2ESDsList(hEnergyOfESD, 0);
115 //_____________________________________________________________________
116 /*void AliFMDQADataMakerRec::InitDigits()
118 // create Digits histograms in Digits subdir
119 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts",
121 hADCCounts->SetXTitle("ADC counts");
122 hADCCounts->SetYTitle("");
123 Add2DigitsList(hADCCounts, 0);
127 //_____________________________________________________________________
128 void AliFMDQADataMakerRec::InitRecPoints()
130 TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
131 "Energy Distribution",100,0,3);
132 hEnergyOfRecpoints->SetXTitle("Edep/Emip");
133 hEnergyOfRecpoints->SetYTitle("");
134 Add2RecPointsList(hEnergyOfRecpoints,0);
137 //_____________________________________________________________________
138 void AliFMDQADataMakerRec::InitRaws()
142 for(Int_t det = 1; det<=3; det++) {
143 Int_t firstring = (det==1 ? 1 : 0);
144 for(Int_t iring = firstring;iring<=1;iring++) {
145 Char_t ring = (iring == 1 ? 'I' : 'O');
146 hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c",
147 det, ring), "ADC counts",
150 Int_t index1 = GetHalfringIndex(det, ring, 0,1);
151 Add2RawsList(hADCCounts, index1,kTRUE);
153 for(Int_t b = 0; b<=1;b++) {
155 //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11;
156 UInt_t board = (iring == 1 ? 0 : 1);
157 board = board + b*16;
160 hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c_board%d",
161 det, ring, board), "ADC counts",
163 hADCCounts->SetXTitle("ADC counts");
164 hADCCounts->SetYTitle("");
165 Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
166 Add2RawsList(hADCCounts, index2);
173 //_____________________________________________________________________
174 void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
177 AliError("FMD ESD object not found!!") ;
180 AliESDFMD* fmd = esd->GetFMDData();
183 for(UShort_t det=1;det<=3;det++) {
184 for (UShort_t ir = 0; ir < 2; ir++) {
185 Char_t ring = (ir == 0 ? 'I' : 'O');
186 UShort_t nsec = (ir == 0 ? 20 : 40);
187 UShort_t nstr = (ir == 0 ? 512 : 256);
188 for(UShort_t sec =0; sec < nsec; sec++) {
189 for(UShort_t strip = 0; strip < nstr; strip++) {
190 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
191 if(mult == AliESDFMD::kInvalidMult) continue;
193 GetESDsData(0)->Fill(mult);
201 //_____________________________________________________________________
202 void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
204 // makes data from Digits
206 AliError("FMD Digit object not found!!") ;
209 for(Int_t i=0;i<digits->GetEntriesFast();i++) {
211 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
212 GetDigitsData(0)->Fill(digit->Counts());
216 //_____________________________________________________________________
217 void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
220 fDigitsArray.Clear();
221 TBranch* branch = digitTree->GetBranch("FMD");
223 AliWarning("FMD branch in Digit Tree not found") ;
226 TClonesArray* digitsAddress = &fDigitsArray;
227 branch->SetAddress(&digitsAddress);
229 MakeDigits(digitsAddress);
232 //_____________________________________________________________________
233 void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
236 AliFMDRawReader fmdReader(rawReader,0);
237 TClonesArray* digitsAddress = &fDigitsArray;
241 digitsAddress->Clear();
242 fmdReader.ReadAdcs(digitsAddress);
243 for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) {
245 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i));
246 UShort_t det = digit->Detector();
247 Char_t ring = digit->Ring();
248 UShort_t sec = digit->Sector();
249 // UShort_t strip = digit->Strip();
250 AliFMDParameters* pars = AliFMDParameters::Instance();
251 Short_t board = pars->GetAltroMap()->Sector2Board(ring, sec);
253 Int_t index1 = GetHalfringIndex(det, ring, 0, 1);
254 GetRawsData(index1)->Fill(digit->Counts());
255 Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
256 GetRawsData(index2)->Fill(digit->Counts());
261 //_____________________________________________________________________
262 void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
264 // makes data from RecPoints
265 AliFMDParameters* pars = AliFMDParameters::Instance();
266 fRecPointsArray.Clear();
267 TBranch *fmdbranch = clustersTree->GetBranch("FMD");
269 AliError("can't get the branch with the FMD recpoints !");
273 TClonesArray* RecPointsAddress = &fRecPointsArray;
275 fmdbranch->SetAddress(&RecPointsAddress);
276 fmdbranch->GetEntry(0);
277 TIter next(RecPointsAddress) ;
278 AliFMDRecPoint * rp ;
279 while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
281 GetRecPointsData(0)->Fill(rp->Edep()/pars->GetEdepMip()) ;
287 //_____________________________________________________________________
288 void AliFMDQADataMakerRec::StartOfDetectorCycle()
294 //_____________________________________________________________________
295 Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det,
300 UShort_t iring = (ring == 'I' ? 1 : 0);
302 Int_t index = ( ((det-1) << 3) | (iring << 2) | (board << 1) | (monitor << 0));
308 //_____________________________________________________________________