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"
34 //_____________________________________________________________________
35 // This is the class that collects the QA data for the FMD during
38 // The following data types are picked up:
42 // Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch
43 //_____________________________________________________________________
45 ClassImp(AliFMDQADataMakerRec)
47 ; // For Emacs - do not delete!
50 //_____________________________________________________________________
51 AliFMDQADataMakerRec::AliFMDQADataMakerRec() :
52 AliQADataMakerRec(AliQA::GetDetName(AliQA::kFMD),
53 "FMD Quality Assurance Data Maker"),
54 fDigitsArray("AliFMDDigit", 0),
55 fRecPointsArray("AliFMDRecPoint", 1000)
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)
70 // qadm Object to copy from
73 //_____________________________________________________________________
74 AliFMDQADataMakerRec& AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm )
76 fDigitsArray = qadm.fDigitsArray;
77 fRecPointsArray = qadm.fRecPointsArray;
81 //_____________________________________________________________________
82 AliFMDQADataMakerRec::~AliFMDQADataMakerRec()
88 //_____________________________________________________________________
91 AliFMDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task,
94 // Detector specific actions at end of cycle
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);
103 //_____________________________________________________________________
104 void AliFMDQADataMakerRec::InitESDs()
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);
114 //_____________________________________________________________________
115 /*void AliFMDQADataMakerRec::InitDigits()
117 // create Digits histograms in Digits subdir
118 TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts",
120 hADCCounts->SetXTitle("ADC counts");
121 hADCCounts->SetYTitle("");
122 Add2DigitsList(hADCCounts, 0);
126 //_____________________________________________________________________
127 void AliFMDQADataMakerRec::InitRecPoints()
129 TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
130 "Energy Distribution",100,0,3);
131 hEnergyOfRecpoints->SetXTitle("Edep/Emip");
132 hEnergyOfRecpoints->SetYTitle("");
133 Add2RecPointsList(hEnergyOfRecpoints,0);
136 //_____________________________________________________________________
137 void AliFMDQADataMakerRec::InitRaws()
141 for(Int_t det = 1; det<=3; det++) {
142 Int_t firstring = (det==1 ? 1 : 0);
143 for(Int_t iring = firstring;iring<=1;iring++) {
144 for(Int_t b = 0; b<=1;b++) {
146 //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x10;
147 UInt_t board = (iring == 1 ? 0 : 1);
148 board = board + b*16;
149 Char_t ring = (iring == 1 ? 'I' : 'O');
151 hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c_board%d",
152 det, ring, board), "ADC counts",
154 hADCCounts->SetXTitle("ADC counts");
155 hADCCounts->SetYTitle("");
156 Int_t index = GetHalfringIndex(det, ring, board/16);
157 Add2RawsList(hADCCounts, index);
164 //_____________________________________________________________________
165 void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
168 AliError("FMD ESD object not found!!") ;
171 AliESDFMD* fmd = esd->GetFMDData();
174 for(UShort_t det=1;det<=3;det++) {
175 for (UShort_t ir = 0; ir < 2; ir++) {
176 Char_t ring = (ir == 0 ? 'I' : 'O');
177 UShort_t nsec = (ir == 0 ? 20 : 40);
178 UShort_t nstr = (ir == 0 ? 512 : 256);
179 for(UShort_t sec =0; sec < nsec; sec++) {
180 for(UShort_t strip = 0; strip < nstr; strip++) {
181 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
182 if(mult == AliESDFMD::kInvalidMult) continue;
184 GetESDsData(0)->Fill(mult);
192 //_____________________________________________________________________
193 void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
195 // makes data from Digits
197 AliError("FMD Digit object not found!!") ;
200 for(Int_t i=0;i<digits->GetEntriesFast();i++) {
202 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
203 GetDigitsData(0)->Fill(digit->Counts());
207 //_____________________________________________________________________
208 void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
211 fDigitsArray.Clear();
212 TBranch* branch = digitTree->GetBranch("FMD");
214 AliWarning("FMD branch in Digit Tree not found") ;
217 TClonesArray* digitsAddress = &fDigitsArray;
218 branch->SetAddress(&digitsAddress);
220 MakeDigits(digitsAddress);
223 //_____________________________________________________________________
224 void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
227 AliFMDRawReader fmdReader(rawReader,0);
228 TClonesArray* digitsAddress = &fDigitsArray;
232 digitsAddress->Clear();
233 fmdReader.ReadAdcs(digitsAddress);
234 for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) {
236 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i));
237 UShort_t det = digit->Detector();
238 Char_t ring = digit->Ring();
239 UShort_t sec = digit->Sector();
240 UShort_t strip = digit->Strip();
241 UInt_t ddl, board, chip, channel;
242 AliFMDParameters* pars = AliFMDParameters::Instance();
243 pars->Detector2Hardware(det,ring,sec,strip,ddl,board,chip,channel);
244 Int_t index = GetHalfringIndex(det, ring, board/16);
246 GetRawsData(index)->Fill(digit->Counts());
251 //_____________________________________________________________________
252 void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
254 // makes data from RecPoints
255 AliFMDParameters* pars = AliFMDParameters::Instance();
256 fRecPointsArray.Clear();
257 TBranch *fmdbranch = clustersTree->GetBranch("FMD");
259 AliError("can't get the branch with the FMD recpoints !");
263 TClonesArray* RecPointsAddress = &fRecPointsArray;
265 fmdbranch->SetAddress(&RecPointsAddress);
266 fmdbranch->GetEntry(0);
267 TIter next(RecPointsAddress) ;
268 AliFMDRecPoint * rp ;
269 while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
271 GetRecPointsData(0)->Fill(rp->Edep()/pars->GetEdepMip()) ;
277 //_____________________________________________________________________
278 void AliFMDQADataMakerRec::StartOfDetectorCycle()
284 //_____________________________________________________________________
285 Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det,
289 UShort_t iring = (ring == 'I' ? 1 : 0);
291 Int_t index = (((det-1) << 2) | (iring << 1) | (board << 0));
297 //_____________________________________________________________________