FMD module
[u/mrichter/AliRoot.git] / FMD / FMDrec / AliFMDQADataMakerRec.cxx
CommitLineData
c9dd1c4d 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>
05e5e0c1 21#include <TH2I.h>
1306ba55 22#include <TGeoManager.h>
c9dd1c4d 23
24// --- AliRoot header files ---
25#include "AliESDEvent.h"
26#include "AliLog.h"
1306ba55 27#include "AliGeomManager.h"
c9dd1c4d 28#include "AliFMDQADataMakerRec.h"
29#include "AliFMDDigit.h"
30#include "AliFMDRecPoint.h"
31#include "AliQAChecker.h"
32#include "AliESDFMD.h"
33#include "AliFMDParameters.h"
86c6cec8 34#include "AliFMDRawReader.h"
1306ba55 35#include "AliFMDReconstructor.h"
3ceaa9ad 36#include "AliRawReader.h"
b995fc28 37#include "AliFMDAltroMapping.h"
f4b5062e 38#include "AliFMDDebug.h"
c9dd1c4d 39
05e5e0c1 40namespace {
41 Int_t colors[3] = {kRed,kGreen,kBlue};
42}
c9dd1c4d 43//_____________________________________________________________________
44// This is the class that collects the QA data for the FMD during
45// reconstruction.
46//
47// The following data types are picked up:
c9dd1c4d 48// - rec points
49// - esd data
c9dd1c4d 50// - raws
51// Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch
52//_____________________________________________________________________
53
54ClassImp(AliFMDQADataMakerRec)
55#if 0
56; // For Emacs - do not delete!
57#endif
58
59//_____________________________________________________________________
1306ba55 60AliFMDQADataMakerRec::AliFMDQADataMakerRec()
61 : AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD),
62 "FMD Quality Assurance Data Maker"),
63 fRecPointsArray("AliFMDRecPoint", 1000),
64 fReconstructor(0),
65 fUseReconstructor(true)
c9dd1c4d 66{
67 // ctor
56236ce9 68
c9dd1c4d 69}
70
71//_____________________________________________________________________
a7e41e8d 72AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm)
4e25ac79 73 : AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD),
a7e41e8d 74 "FMD Quality Assurance Data Maker"),
1306ba55 75 fRecPointsArray(qadm.fRecPointsArray),
76 fReconstructor(qadm.fReconstructor),
77 fUseReconstructor(qadm.fUseReconstructor)
c9dd1c4d 78{
ffa78f64 79 // copy ctor
c9dd1c4d 80 // Parameters:
81 // qadm Object to copy from
82
83}
9bd2ccc2 84//_____________________________________________________________________
63720979 85AliFMDQADataMakerRec&
86AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm )
a7e41e8d 87{
09b6c804 88 //
89 // Assignment operator
90 //
91 // Parameters:
92 // qadm What to assign from
93 //
94 // Return:
95 // Reference to this
96 //
550157b2 97 if (&qadm == this) return *this;
1306ba55 98 fRecPointsArray = qadm.fRecPointsArray;
99 fReconstructor = qadm.fReconstructor;
100 fUseReconstructor = qadm.fUseReconstructor;
a7e41e8d 101 return *this;
102}
103//_____________________________________________________________________
9bd2ccc2 104AliFMDQADataMakerRec::~AliFMDQADataMakerRec()
105{
09b6c804 106 //
107 // Destrcutor
108 //
9bd2ccc2 109}
c9dd1c4d 110
111
112//_____________________________________________________________________
113
114void
4e25ac79 115AliFMDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task,
57acd2d2 116 TObjArray ** list)
c9dd1c4d 117{
118 // Detector specific actions at end of cycle
119 // do the QA checking
92664bc8 120 ResetEventTrigClasses(); // reset triggers list to select all histos
ffa78f64 121 AliLog::Message(5,"FMD: end of detector cycle",
122 "AliFMDQADataMakerRec","AliFMDQADataMakerRec",
123 "AliFMDQADataMakerRec::EndOfDetectorCycle",
124 "AliFMDQADataMakerRec.cxx",95);
4e25ac79 125 AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list);
c9dd1c4d 126}
127
128//_____________________________________________________________________
05e5e0c1 129TH1* AliFMDQADataMakerRec::MakeADCHist(UShort_t d, Char_t r, Short_t b)
130{
131 TString name("adc");
132 TString title("ADC counts");
133 Int_t color = kRed+1;
134 if (d > 0) {
135 name.Append(Form("FMD%d%c", d, r));
136 title.Append(Form(" in FMD%d%c", d, r));
137 color = colors[d-1]+3+(r == 'I' || r == 'i' ? 0 : 1);
138 if (b >= 0) {
139 name.Append(Form("_0x%02x", b));
140 title.Append(Form("[0x%02x]", b));
141 }
142 }
143 TH1* hist = new TH1F(name, title,1024,0,1024);
144 hist->SetXTitle("Amplitude [ADC counts]");
145 hist->SetYTitle("Events [log]");
146 hist->SetFillStyle(3001);
147 hist->SetFillColor(color);
148 hist->SetLineColor(color);
149 hist->SetMarkerColor(color);
150 hist->GetXaxis()->SetNdivisions(408,false);
dacd22c9 151 hist->SetDirectory(0);
05e5e0c1 152 // hist->SetStats(0);
153
154 return hist;
155}
156//_____________________________________________________________________
157TH1* AliFMDQADataMakerRec::MakeELossHist(UShort_t d, Char_t r, Short_t b)
158{
159 TString name("eloss");
160 TString title("Energy loss");
161 Int_t color = kBlue+1;
162 if (d > 0) {
163 name.Append(Form("FMD%d%c", d, r));
164 title.Append(Form(" in FMD%d%c", d, r));
165 color = colors[d-1]+3+(r == 'I' || r == 'i' ? 0 : 1);
166 if (b >= 0) {
167 name.Append(Form("_0x%02x", b));
168 title.Append(Form("[0x%02x]", b));
169 }
170 }
1306ba55 171 TH1* hist = new TH1F(name, title,600,0, 15);
172 hist->SetXTitle("#Delta/#Delta_{mip}");
05e5e0c1 173 hist->SetYTitle("Events [log]");
174 hist->SetFillStyle(3001);
175 hist->SetFillColor(color);
176 hist->SetLineColor(color);
177 hist->SetMarkerColor(color);
1306ba55 178 hist->Sumw2();
dacd22c9 179 hist->SetDirectory(0);
05e5e0c1 180 // hist->SetStats(0);
181
182 return hist;
183}
184
185
186//_____________________________________________________________________
c9dd1c4d 187void AliFMDQADataMakerRec::InitESDs()
188{
189 // create Digits histograms in Digits subdir
1306ba55 190 Info("InitESDs", "Initializing ESDs");
7d297381 191 const Bool_t expert = kTRUE ;
192 const Bool_t image = kTRUE ;
193
05e5e0c1 194 TH1* hist = MakeELossHist();
195 Add2ESDsList(hist, 0, !expert, image);
92664bc8 196 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
c9dd1c4d 197}
198
44ed7a66 199//_____________________________________________________________________
200void AliFMDQADataMakerRec::InitDigits()
201{
202 // create Digits histograms in Digits subdir
1306ba55 203 Info("InitDigits", "Initializing Digits");
44ed7a66 204 const Bool_t expert = kTRUE ;
205 const Bool_t image = kTRUE ;
206
05e5e0c1 207 TH1* hist = MakeADCHist();
208 Add2DigitsList(hist, 0, !expert, image);
92664bc8 209 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
44ed7a66 210}
211
c9dd1c4d 212//_____________________________________________________________________
c9dd1c4d 213void AliFMDQADataMakerRec::InitRecPoints()
214{
7d297381 215 // create Reconstructed Points histograms in RecPoints subdir
1306ba55 216 Info("InitRecPoints", "Initializing RecPoints");
7d297381 217 const Bool_t expert = kTRUE ;
218 const Bool_t image = kTRUE ;
219
05e5e0c1 220 TH1* hist = MakeELossHist();
221 Add2RecPointsList(hist,0, !expert, image);
92664bc8 222 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last linea
c9dd1c4d 223}
224
225//_____________________________________________________________________
226void AliFMDQADataMakerRec::InitRaws()
227{
7d297381 228 // create Raws histograms in Raws subdir
1306ba55 229 Info("InitRaws", "Initializing Raws");
550157b2 230 const Bool_t expert = kTRUE ; // Flag - not the setting
231 const Bool_t saveCorr = kTRUE ; // Flag - not setting
232 const Bool_t image = kTRUE ; // Flag - not the setting
05e5e0c1 233 TH2I* hErrors = new TH2I("readoutErrors", "Read out errors", 3, .5, 3.5,
0f666f27 234 160, -.5, 159.5);
05e5e0c1 235 hErrors->GetXaxis()->SetBinLabel(1, "FMD1");
236 hErrors->GetXaxis()->SetBinLabel(2, "FMD2");
237 hErrors->GetXaxis()->SetBinLabel(3, "FMD3");
e0c60e77 238 hErrors->SetYTitle("# errors [log]");
05e5e0c1 239 hErrors->SetZTitle("Events [log]");
dacd22c9 240 hErrors->SetDirectory(0);
05e5e0c1 241 Add2RawsList(hErrors, 1, !expert, image, !saveCorr);
242 //AliInfo(Form("Adding %30s to raw list @ %2d", hErrors->GetName(), 1));
243
1306ba55 244 if (fUseReconstructor && !fReconstructor) {
245 // Int_t oldDbg = AliLog::GetDebugLevel("FMD","");
246 // AliLog::SetModuleDebugLevel("FMD", 5);
247
248 if (!gGeoManager) {
249 Info("InitRaws", "Loading the geometry");
250 AliGeomManager::LoadGeometry();
251 }
252
253 fReconstructor = new AliFMDReconstructor();
254 fReconstructor->SetDiagnose(false);
255 fReconstructor->Init();
256 // AliLog::SetModuleDebugLevel("FMD", oldDbg);
257 }
258
550157b2 259 TH2* status = new TH2D("status", "Fit status per cycle",
a3e1fdcc 260 5, .5, 5.5, 4, -.5, 3.5);
261 status->SetDirectory(0);
550157b2 262 // status->SetXTitle("Detector");
263 // status->SetYTitle("Status");
a3e1fdcc 264 status->SetZTitle("N_{cycles} [LOG]");
265 status->GetXaxis()->SetBinLabel(1, "FMD1i");
266 status->GetXaxis()->SetBinLabel(2, "FMD2i");
267 status->GetXaxis()->SetBinLabel(3, "FMD2o");
268 status->GetXaxis()->SetBinLabel(4, "FMD3i");
269 status->GetXaxis()->SetBinLabel(5, "FMD3o");
270 status->GetYaxis()->SetBinLabel(1, "OK");
271 status->GetYaxis()->SetBinLabel(2, "Problem");
272 status->GetYaxis()->SetBinLabel(3, "Bad");
273 status->GetYaxis()->SetBinLabel(4, "What the ...?");
550157b2 274 status->GetXaxis()->SetLabelSize(0.16);
275 status->GetYaxis()->SetLabelSize(0.16);
a3e1fdcc 276 status->SetStats(0);
277 Add2RawsList(status, GetHalfringIndex(4, 'i', 0, 0),
278 !expert, image, !saveCorr);
279
05e5e0c1 280 TH1* hist;
281 Int_t idx = 0;
282 for(UShort_t d = 1; d<=3; d++) {
283 UShort_t nR = (d == 1 ? 1 : 2);
284 for(UShort_t q = 0; q < nR; q++) {
285 Char_t r = (q == 1 ? 'O' : 'I');
1306ba55 286 hist = (fUseReconstructor ?
287 MakeELossHist(d, r, -1) :
288 MakeADCHist(d, r, -1));
05e5e0c1 289
290 Int_t index1 = GetHalfringIndex(d, r, 0, 1);
291 idx = TMath::Max(index1, idx);
292 Add2RawsList(hist, index1, !expert, image, !saveCorr);
293 //AliInfo(Form("Adding %30s to raw list @ %2d", hist->GetName(), index1));
c18fe410 294
1306ba55 295 // If we're using the reconstructor, do not make expert histograms
296 if (fUseReconstructor) continue;
297
05e5e0c1 298 for(UShort_t b = 0; b <= 1; b++) {
c18fe410 299 //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11;
05e5e0c1 300 UShort_t board = (q == 1 ? 0 : 1) + b*16;
c18fe410 301
05e5e0c1 302 hist = MakeADCHist(d, r, board);
303 Int_t index2 = GetHalfringIndex(d, r, board/16,0);
304 idx = TMath::Max(index2, idx);
305 Add2RawsList(hist, index2, expert, !image, !saveCorr);
306 //AliInfo(Form("Adding %30s to raw list @ %2d",hist->GetName(),index2));
b4da452d 307 }
308 }
309 }
92664bc8 310 //
311 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
c9dd1c4d 312}
313
408bf2b4 314#if 0
315struct FillESDHist : public AliESDFMD::ForOne
316{
317 FillESDHist(AliFMDQADataMakerRec* m) : fM(m) {}
318 FillESDHist(const FillESDHist& o) : fM(o.fM) {}
319 FillESDHist& operator=(const FillESDHist& o) { fM = o.fM; return *this; }
320 Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Float_t m, Float_t)
321 {
322 // Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
323 if(m == AliESDFMD::kInvalidMult) return true;
324
92664bc8 325 fM->FillESDsData(0,m);
408bf2b4 326 return true;
327 }
328 AliFMDQADataMakerRec* fM;
329};
330#endif
331
c9dd1c4d 332//_____________________________________________________________________
333void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
334{
09b6c804 335 //
336 // Analyse ESD event
337 //
338 // Parameters:
339 // esd ESD event
340 //
c9dd1c4d 341 if(!esd) {
342 AliError("FMD ESD object not found!!") ;
343 return;
344 }
f4b5062e 345 AliFMDDebug(2, ("Will loop over ESD data and fill histogram"));
346
c9dd1c4d 347 AliESDFMD* fmd = esd->GetFMDData();
348 if (!fmd) return;
f4b5062e 349
408bf2b4 350#if 0
351 FillESDHist f(this);
352 fmd->ForEach(f);
353#else
354
355
356
f4b5062e 357 // FIXME - we should use AliESDFMD::ForOne subclass to do this!
c9dd1c4d 358 for(UShort_t det=1;det<=3;det++) {
f4b5062e 359 UShort_t nrng = (det == 1 ? 1 : 2);
360 for (UShort_t ir = 0; ir < nrng; ir++) {
c9dd1c4d 361 Char_t ring = (ir == 0 ? 'I' : 'O');
362 UShort_t nsec = (ir == 0 ? 20 : 40);
363 UShort_t nstr = (ir == 0 ? 512 : 256);
364 for(UShort_t sec =0; sec < nsec; sec++) {
365 for(UShort_t strip = 0; strip < nstr; strip++) {
366 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
367 if(mult == AliESDFMD::kInvalidMult) continue;
368
92664bc8 369 FillESDsData(0,mult);
c9dd1c4d 370 }
371 }
372 }
373 }
408bf2b4 374#endif
92664bc8 375 IncEvCountCycleESDs();
376 IncEvCountTotalESDs();
c9dd1c4d 377}
378
44ed7a66 379
c9dd1c4d 380//_____________________________________________________________________
6252ceeb 381void AliFMDQADataMakerRec::MakeDigits()
c9dd1c4d 382{
383 // makes data from Digits
6252ceeb 384 if(!fDigitsArray) {
ffa78f64 385 AliError("FMD Digit object not found!!") ;
386 return;
c9dd1c4d 387 }
eca4fa66 388
6252ceeb 389 for(Int_t i=0;i<fDigitsArray->GetEntriesFast();i++) {
c9dd1c4d 390 //Raw ADC counts
6252ceeb 391 AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i));
92664bc8 392 FillDigitsData(0,digit->Counts());
c9dd1c4d 393 }
394}
395
396//_____________________________________________________________________
397void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree)
398{
09b6c804 399 //
400 // Analyse digits
401 //
402 // Parameters:
403 // digitTree Tree of digits
404 //
6252ceeb 405 if (fDigitsArray)
406 fDigitsArray->Clear();
407 else
408 fDigitsArray = new TClonesArray("AliFMDDigit", 1000);
409
ffa78f64 410 TBranch* branch = digitTree->GetBranch("FMD");
411 if (!branch) {
c9dd1c4d 412 AliWarning("FMD branch in Digit Tree not found") ;
413 return;
414 }
6252ceeb 415 branch->SetAddress(&fDigitsArray);
ffa78f64 416 branch->GetEntry(0);
6252ceeb 417 MakeDigits();
92664bc8 418 //
419 IncEvCountCycleDigits();
420 IncEvCountTotalDigits();
c9dd1c4d 421}
44ed7a66 422
c9dd1c4d 423//_____________________________________________________________________
86c6cec8 424void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
c9dd1c4d 425{
09b6c804 426 //
427 // Analyse raw
428 //
429 // Parameters:
430 // rawReader Raw reader
431 //
09b6c804 432 AliFMDRawReader fmdReader(rawReader,0);
1306ba55 433 if (fDigitsArray) fDigitsArray->Clear();
434 else fDigitsArray = new TClonesArray("AliFMDDigit", 1000);
435
6252ceeb 436 TClonesArray* digitsAddress = fDigitsArray;
1306ba55 437
3ceaa9ad 438 rawReader->Reset();
1306ba55 439
c18fe410 440 digitsAddress->Clear();
441 fmdReader.ReadAdcs(digitsAddress);
92664bc8 442 //
443 FillRawsData(1,1, fmdReader.GetNErrors(0));
444 FillRawsData(1,2, fmdReader.GetNErrors(1));
445 FillRawsData(1,3, fmdReader.GetNErrors(2));
1306ba55 446
447 if (fUseReconstructor) {
448 AliESDFMD* fmd = fReconstructor->GetESDObject();
449 fmd->Clear();
450
451 // AliLog::SetModuleDebugLevel("FMD", 15);
452 fReconstructor->ProcessDigits(digitsAddress, fmdReader);
453
454 if (!fmd) AliFatal("No ESD object from reconstructor");
455
456 for(UShort_t det=1;det<=3;det++) {
457 UShort_t nrng = (det == 1 ? 1 : 2);
458 for (UShort_t ir = 0; ir < nrng; ir++) {
459 Char_t ring = (ir == 0 ? 'I' : 'O');
460 UShort_t nsec = (ir == 0 ? 20 : 40);
461 UShort_t nstr = (ir == 0 ? 512 : 256);
462 for(UShort_t sec =0; sec < nsec; sec++) {
463 for(UShort_t strip = 0; strip < nstr; strip++) {
464 Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
465 if(mult == AliESDFMD::kInvalidMult) continue;
466
467 Int_t index1 = GetHalfringIndex(det, ring, 0, 1);
468 FillRawsData(index1,mult);
469 }
470 }
471 }
472 }
473 }
474 else {
475 for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) {
476 //Raw ADC counts
477 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i));
478 UShort_t det = digit->Detector();
479 Char_t ring = digit->Ring();
480 UShort_t sec = digit->Sector();
481 // UShort_t strip = digit->Strip();
482 AliFMDParameters* pars = AliFMDParameters::Instance();
483 Short_t board = pars->GetAltroMap()->Sector2Board(ring, sec);
484
485 Int_t index1 = GetHalfringIndex(det, ring, 0, 1);
486 FillRawsData(index1,digit->Counts());
487 Int_t index2 = GetHalfringIndex(det, ring, board/16,0);
488 FillRawsData(index2,digit->Counts());
489 }
490 }
92664bc8 491 //
492 IncEvCountCycleRaws();
493 IncEvCountTotalRaws();
c9dd1c4d 494}
495
496//_____________________________________________________________________
497void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree)
498{
499 // makes data from RecPoints
eca4fa66 500
6252ceeb 501 AliFMDParameters* pars = AliFMDParameters::Instance();
56236ce9 502 fRecPointsArray.Clear();
c9dd1c4d 503 TBranch *fmdbranch = clustersTree->GetBranch("FMD");
504 if (!fmdbranch) {
505 AliError("can't get the branch with the FMD recpoints !");
506 return;
507 }
508
56236ce9 509 TClonesArray* RecPointsAddress = &fRecPointsArray;
9bd2ccc2 510
56236ce9 511 fmdbranch->SetAddress(&RecPointsAddress);
c9dd1c4d 512 fmdbranch->GetEntry(0);
56236ce9 513 TIter next(RecPointsAddress) ;
c9dd1c4d 514 AliFMDRecPoint * rp ;
515 while ((rp = static_cast<AliFMDRecPoint*>(next()))) {
92664bc8 516 FillRecPointsData(0,rp->Edep()/pars->GetEdepMip());
c9dd1c4d 517 }
92664bc8 518 IncEvCountCycleRecPoints();
519 IncEvCountTotalRecPoints();
520 //
c9dd1c4d 521}
522
523//_____________________________________________________________________
524void AliFMDQADataMakerRec::StartOfDetectorCycle()
525{
55e99fdc 526 // Do an init on the reconstructor. If we have the
527 // same run nothing happens, but if we have a new run, we update our
528 // parameters.
529 if (fUseReconstructor && fReconstructor) fReconstructor->Init();
e0c60e77 530 if (fRawsQAList) {
531 for (Int_t index = 0 ; index < AliRecoParam::kNSpecies ; index++) {
532 if (!fRawsQAList[index]) continue;
533 AliRecoParam::EventSpecie_t specie = AliRecoParam::ConvertIndex(index);
534 if (specie == AliRecoParam::kCalib || specie == AliRecoParam::kCosmic)
535 continue;
536
537 TIter nextObject(fRawsQAList[index]);
538 TObject* object = 0;
539 while ((object = nextObject())) {
540 if (!object->InheritsFrom(TH1::Class())) continue;
541 TH1* hist = static_cast<TH1*>(object);
550157b2 542 if (!hist->TestBit(kResetBit)) continue;
e0c60e77 543
544 AliInfoF("Resetting histogram %s", hist->GetName());
545 hist->Reset("M");
550157b2 546 hist->SetBit(kResetBit, false);
e0c60e77 547 }
548 }
549 }
c9dd1c4d 550}
551//_____________________________________________________________________
b4da452d 552Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det,
553 Char_t ring,
c18fe410 554 UShort_t board,
a3e1fdcc 555 UShort_t monitor)
09b6c804 556{
557 //
558 // Get the half-ring index
559 //
560 // Parameters:
561 // det Detector
562 // ring Ring
563 // board Board number
564 // monitor Monitor
565 //
566 // Return:
567 // Half ring index
568 //
05e5e0c1 569 UShort_t iring = (ring == 'I' || ring == 'i' ? 1 : 0);
570 Int_t index = ((((det-1) & 0x3) << 3) |
571 ((iring & 0x1) << 2) |
572 ((board & 0x1) << 1) |
573 ((monitor & 0x1) << 0));
574#if 0
575 AliInfo(Form("d=%d, r=%c, b=%d, m=%d -> (%d<<3)|(%d<<2)|(%d<<1)|(%d<<0)=%2d",
576 det, ring, board, monitor, (det-1) & 0x3, iring & 0x1,
577 board & 0x1, monitor & 0x1, index));
578#endif
b4da452d 579 return index-2;
b4da452d 580}
a3e1fdcc 581//_____________________________________________________________________
582void AliFMDQADataMakerRec::GetHalfringFromIndex(Int_t idx,
583 UShort_t& det,
584 Char_t& ring,
585 UShort_t& board,
586 UShort_t& monitor)
587{
588 det = ((idx >> 3) & 0x3) + 1;
589 ring = ((idx >> 2) & 0x1) == 1 ? 'I' : 'O';
590 board = ((idx >> 1) & 0x1);
591 monitor = ((idx >> 0) & 0x1);
592}
593
b4da452d 594
595//_____________________________________________________________________
596
597
c9dd1c4d 598//
599// EOF
600//