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;ADC counts;Counts",1024,0,1024);
126 Add2DigitsList(hADCCounts, 0, !expert, image);
130 //_____________________________________________________________________
131 void AliFMDQADataMakerRec::InitRecPoints()
133 // create Reconstructed Points histograms in RecPoints subdir
134 const Bool_t expert = kTRUE ;
135 const Bool_t image = kTRUE ;
137 TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints",
138 "Energy Distribution",100,0,3);
139 hEnergyOfRecpoints->SetXTitle("Edep/Emip");
140 hEnergyOfRecpoints->SetYTitle("Counts");
141 Add2RecPointsList(hEnergyOfRecpoints,0, !expert, image);
144 //_____________________________________________________________________
145 void AliFMDQADataMakerRec::InitRaws()
147 // create Raws histograms in Raws subdir
148 const Bool_t expert = kTRUE ;
149 const Bool_t saveCorr = kTRUE ;
150 const Bool_t image = kTRUE ;
153 for(Int_t det = 1; det<=3; det++) {
154 Int_t firstring = (det==1 ? 1 : 0);
155 for(Int_t iring = firstring;iring<=1;iring++) {
156 Char_t ring = (iring == 1 ? 'I' : 'O');
157 hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c",
158 det, ring), "ADC counts;Amplitude [ADC counts];Counts",
161 Int_t index1 = GetHalfringIndex(det, ring, 0,1);
162 Add2RawsList(hADCCounts, index1, expert, !image, !saveCorr);
164 for(Int_t b = 0; b<=1;b++) {
166 //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11;
167 UInt_t board = (iring == 1 ? 0 : 1);
168 board = board + b*16;
171 hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c_board%d",
172 det, ring, board), "ADC counts;Amplitude [ADC counts];Counts",
174 hADCCounts->SetXTitle("ADC counts");
175 hADCCounts->SetYTitle("");
176 Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
177 Add2RawsList(hADCCounts, index2, !expert, image, !saveCorr);
184 //_____________________________________________________________________
185 void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
188 AliError("FMD ESD object not found!!") ;
191 AliESDFMD* fmd = esd->GetFMDData();
194 // Check id histograms already created for this Event Specie
195 if ( ! GetESDsData(0) )
198 for(UShort_t det=1;det<=3;det++) {
199 for (UShort_t ir = 0; ir < 2; ir++) {
200 Char_t ring = (ir == 0 ? 'I' : 'O');
201 UShort_t nsec = (ir == 0 ? 20 : 40);
202 UShort_t nstr = (ir == 0 ? 512 : 256);
203 for(UShort_t sec =0; sec < nsec; sec++) {
204 for(UShort_t strip = 0; strip < nstr; strip++) {
205 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
206 if(mult == AliESDFMD::kInvalidMult) continue;
208 GetESDsData(0)->Fill(mult);
216 //_____________________________________________________________________
217 void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits)
219 // makes data from Digits
221 AliError("FMD Digit object not found!!") ;
225 // Check id histograms already created for this Event Specie
226 if ( ! GetDigitsData(0) )
229 for(Int_t i=0;i<digits->GetEntriesFast();i++) {
231 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i));
232 GetDigitsData(0)->Fill(digit->Counts());
236 //_____________________________________________________________________
237 void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
240 fDigitsArray.Clear();
241 TBranch* branch = digitTree->GetBranch("FMD");
243 AliWarning("FMD branch in Digit Tree not found") ;
246 TClonesArray* digitsAddress = &fDigitsArray;
247 branch->SetAddress(&digitsAddress);
249 MakeDigits(digitsAddress);
252 //_____________________________________________________________________
253 void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
256 // Check id histograms already created for this Event Specie
257 if ( ! GetRawsData(0) )
260 AliFMDRawReader fmdReader(rawReader,0);
261 TClonesArray* digitsAddress = &fDigitsArray;
265 digitsAddress->Clear();
266 fmdReader.ReadAdcs(digitsAddress);
267 for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) {
269 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i));
270 UShort_t det = digit->Detector();
271 Char_t ring = digit->Ring();
272 UShort_t sec = digit->Sector();
273 // UShort_t strip = digit->Strip();
274 AliFMDParameters* pars = AliFMDParameters::Instance();
275 Short_t board = pars->GetAltroMap()->Sector2Board(ring, sec);
277 Int_t index1 = GetHalfringIndex(det, ring, 0, 1);
278 GetRawsData(index1)->Fill(digit->Counts());
279 Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
280 GetRawsData(index2)->Fill(digit->Counts());
285 //_____________________________________________________________________
286 void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
288 // makes data from RecPoints
290 // Check id histograms already created for this Event Specie
291 if ( ! GetRecPointsData(0) )
294 AliFMDParameters* pars = AliFMDParameters::Instance();
295 fRecPointsArray.Clear();
296 TBranch *fmdbranch = clustersTree->GetBranch("FMD");
298 AliError("can't get the branch with the FMD recpoints !");
302 TClonesArray* RecPointsAddress = &fRecPointsArray;
304 fmdbranch->SetAddress(&RecPointsAddress);
305 fmdbranch->GetEntry(0);
306 TIter next(RecPointsAddress) ;
307 AliFMDRecPoint * rp ;
308 while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
310 GetRecPointsData(0)->Fill(rp->Edep()/pars->GetEdepMip()) ;
316 //_____________________________________________________________________
317 void AliFMDQADataMakerRec::StartOfDetectorCycle()
323 //_____________________________________________________________________
324 Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det,
329 UShort_t iring = (ring == 'I' ? 1 : 0);
331 Int_t index = ( ((det-1) << 3) | (iring << 2) | (board << 1) | (monitor << 0));
337 //_____________________________________________________________________