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