1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
16 // --- MUON header files ---
17 #include "AliMUONQADataMakerRec.h"
19 #include "AliMUONCluster.h"
20 #include "AliMUONRawStreamTracker.h"
21 #include "AliMUONRawStreamTrigger.h"
22 #include "AliMUONConstants.h"
23 #include "AliMUONVClusterStore.h"
24 #include "AliMUONVCluster.h"
26 #include "AliMUONDigitMaker.h"
27 #include "AliMUONVDigitStore.h"
28 #include "AliMUONVTriggerStore.h"
29 #include "AliMUONVDigit.h"
30 #include "AliMUONLocalTrigger.h"
32 #include "AliMUONDDLTrigger.h"
33 #include "AliMUONRegHeader.h"
34 #include "AliMUONDarcHeader.h"
35 #include "AliMUONLocalStruct.h"
37 #include "AliMUONGeometryTransformer.h"
39 #include "AliMpDDLStore.h"
40 #include "AliMpVSegmentation.h"
41 #include "AliMpSegmentation.h"
42 #include "AliMpConstants.h"
44 #include "AliMpBusPatch.h"
45 #include "AliMpTriggerCrate.h"
46 #include "AliMpLocalBoard.h"
49 // --- AliRoot header files ---
50 #include "AliESDEvent.h"
51 #include "AliESDMuonTrack.h"
52 #include "AliESDMuonCluster.h"
54 #include "AliRawReader.h"
55 #include "AliQAChecker.h"
57 // --- ROOT system ---
58 #include <TClonesArray.h>
64 #include <TLorentzVector.h>
65 #include <Riostream.h>
67 //-----------------------------------------------------------------------------
68 /// \class AliMUONQADataMakerRec
70 /// MUON base class for quality assurance data (histo) maker
75 ClassImp(AliMUONQADataMakerRec)
78 //____________________________________________________________________________
79 AliMUONQADataMakerRec::AliMUONQADataMakerRec() :
80 AliQADataMakerRec(AliQA::GetDetName(AliQA::kMUON), "MUON Quality Assurance Data Maker"),
82 fIsInitRecPoints(kFALSE),
89 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
90 fDigitMaker = new AliMUONDigitMaker(kTRUE,kFALSE);
93 //____________________________________________________________________________
94 AliMUONQADataMakerRec::AliMUONQADataMakerRec(const AliMUONQADataMakerRec& qadm) :
95 AliQADataMakerRec(qadm),
97 fIsInitRecPoints(kFALSE),
104 SetName((const char*)qadm.GetName()) ;
105 SetTitle((const char*)qadm.GetTitle());
107 // Do not copy the digit store and digit maker, but create its own ones
108 fDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV1");
109 fDigitMaker = new AliMUONDigitMaker(kTRUE,kFALSE);
112 //__________________________________________________________________
113 AliMUONQADataMakerRec& AliMUONQADataMakerRec::operator = (const AliMUONQADataMakerRec& qadm )
115 /// Assignment operator
117 // check assignment to self
118 if (this == &qadm) return *this;
120 this->~AliMUONQADataMakerRec();
121 new(this) AliMUONQADataMakerRec(qadm);
125 //__________________________________________________________________
126 AliMUONQADataMakerRec::~AliMUONQADataMakerRec()
130 delete fTriggerStore;
134 //____________________________________________________________________________
135 void AliMUONQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray* list)
137 ///Detector specific actions at end of cycle
139 // Display trigger histos in a more user friendly way
140 DisplayTriggerInfo(task);
142 // do the QA checking
143 AliQAChecker::Instance()->Run(AliQA::kMUON, task, list) ;
146 //____________________________________________________________________________
147 void AliMUONQADataMakerRec::InitRaws()
149 /// create Raws histograms in Raws subdir
150 TH1I* h0 = new TH1I("hRawBusPatch", "buspatch distribution", 1932, 1, 1932);
151 Add2RawsList(h0, kRawBusPatch);
153 TH1I* h1 = new TH1I("hRawCharge", "Charge distribution in rawdata", 4096, 0, 4095);
154 Add2RawsList(h1, kRawCharge);
156 for (Int_t iDDL = 0; iDDL < 20; ++iDDL)
158 TH1F* h2 = new TH1F(Form("%s%d", "hRawBusPatchDDL", iDDL), Form("%s %d","RAW Buspatch distribution for DDL", iDDL), 50, 0, 49);
159 Add2RawsList(h2, kRawBuspatchDDL+iDDL);
162 TH3F* h3 = new TH3F("hTriggerScalersBendPlane", "Trigger scalers in bending plane",
166 h3->GetXaxis()->SetTitle("Chamber");
167 h3->GetYaxis()->SetTitle("Board");
168 h3->GetZaxis()->SetTitle("Strip");
169 Add2RawsList(h3, kTriggerScalersBP);
171 TH3F* h4 = new TH3F("hTriggerScalersNonBendPlane", "Trigger scalers in non-bending plane",
175 h4->GetXaxis()->SetTitle("Chamber");
176 h4->GetYaxis()->SetTitle("Board");
177 h4->GetZaxis()->SetTitle("Strip");
178 Add2RawsList(h4, kTriggerScalersNBP);
180 fIsInitRaws = InitDisplayHistos(AliQA::kRAWS);
183 //____________________________________________________________________________
184 void AliMUONQADataMakerRec::InitRecPoints()
186 /// create Reconstructed Points histograms in RecPoints subdir
187 TH3F* h0 = new TH3F("hTriggerDigitsBendPlane", "Trigger digits in bending plane",
191 h0->GetXaxis()->SetTitle("Chamber");
192 h0->GetYaxis()->SetTitle("Board");
193 h0->GetZaxis()->SetTitle("Strip");
194 Add2RecPointsList(h0, kTriggerDigitsBendPlane);
196 TH3F* h1 = new TH3F("hTriggerDigitsNonBendPlane", "Trigger digits in non-bending plane",
200 h1->GetXaxis()->SetTitle("Chamber");
201 h1->GetYaxis()->SetTitle("Board");
202 h1->GetZaxis()->SetTitle("Strip");
203 Add2RecPointsList(h1, kTriggerDigitsNonBendPlane);
205 TH1F* h2 = new TH1F("hTriggeredBoards", "Triggered boards", 234, 0.5, 234.5);
206 Add2RecPointsList(h2, kTriggeredBoards);
208 fIsInitRecPoints = InitDisplayHistos(AliQA::kRECPOINTS);
212 //____________________________________________________________________________
213 void AliMUONQADataMakerRec::InitESDs()
215 ///create ESDs histograms in ESDs subdir
216 TH1F* h0 = new TH1F("hESDnTracks", "ESDs track number distribution", 30, 0., 30.);
217 Add2ESDsList(h0, kESDnTracks);
219 TH1F* h1 = new TH1F("hESDMomentum", "ESDs P distribution", 300, 0., 300) ;
220 Add2ESDsList(h1, kESDMomentum);
222 TH1F* h2 = new TH1F("hESDPt", "ESDs Pt distribution", 200, 0., 50) ;
223 Add2ESDsList(h2, kESDPt);
225 TH1F* h3 = new TH1F("hESDRapidity", "ESDs rapidity distribution", 200, -4.5,-2.) ;
226 Add2ESDsList(h3, kESDRapidity);
228 for (Int_t i = 0; i < AliMUONConstants::NTrackingCh(); ++i)
230 TH2F* h4 = new TH2F(Form("%s%d", "hESDClusterHitMap", i),
231 Form("%s %d", "ESD Clusters hit distribution for chamber", i),
232 100, -1*AliMUONConstants::Rmax(i/2), AliMUONConstants::Rmax(i/2),
233 100, -1*AliMUONConstants::Rmax(i/2), AliMUONConstants::Rmax(i/2));
234 Add2ESDsList(h4, kESDClusterHitMap+i);
240 //____________________________________________________________________________
241 void AliMUONQADataMakerRec::MakeRaws(AliRawReader* rawReader)
243 /// make QA for rawdata
245 if ( ! fIsInitRaws ) {
247 << "Skipping function due to a failure in Init" << endl;
257 AliMUONRawStreamTracker rawStreamTrack(rawReader);
258 rawStreamTrack.First();
259 while( rawStreamTrack.Next(busPatchId, manuId, channelId, charge) ) {
261 GetRawsData(kRawBusPatch)->Fill(busPatchId);
262 GetRawsData(kRawCharge)->Fill(charge);
263 Int_t iDDL = rawStreamTrack.GetCurentDDL();
264 GetRawsData(kRawBuspatchDDL + iDDL)->Fill(AliMpBusPatch::GetLocalBusID(busPatchId, iDDL));
270 // Get trigger scalers
273 AliMpCDB::LoadDDLStore();
275 AliMUONRawStreamTrigger rawStreamTrig(rawReader);
276 while (rawStreamTrig.NextDDL())
278 // If not a scaler event, do nothing
279 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
280 if(!scalerEvent) break;
282 AliMUONDDLTrigger* ddlTrigger = rawStreamTrig.GetDDLTrigger();
283 AliMUONDarcHeader* darcHeader = ddlTrigger->GetDarcHeader();
285 Int_t nReg = darcHeader->GetRegHeaderEntries();
287 for(Int_t iReg = 0; iReg < nReg ;iReg++)
291 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->
292 GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
294 AliMUONRegHeader* regHeader = darcHeader->GetRegHeaderEntry(iReg);
296 // loop over local structures
297 Int_t nLocal = regHeader->GetLocalEntries();
298 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
300 AliMUONLocalStruct* localStruct = regHeader->GetLocalEntry(iLocal);
303 if (!localStruct) continue;
305 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
307 if ( !loCircuit ) continue; // empty slot
309 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
312 if( !localBoard->IsNotified())
315 Int_t cathode = localStruct->GetComptXY()%2;
317 ERaw hindex = (cathode==0) ? kTriggerScalersBP : kTriggerScalersNBP;
320 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
321 if(localStruct->GetXY1(ibitxy) > 0)
322 ((TH3F*)GetRawsData(hindex))->Fill(11+0, loCircuit, ibitxy, 2*localStruct->GetXY1(ibitxy));
323 if(localStruct->GetXY2(ibitxy) > 0)
324 ((TH3F*)GetRawsData(hindex))->Fill(11+1, loCircuit, ibitxy, 2*localStruct->GetXY2(ibitxy));
325 if(localStruct->GetXY3(ibitxy) > 0)
326 ((TH3F*)GetRawsData(hindex))->Fill(11+2, loCircuit, ibitxy, 2*localStruct->GetXY3(ibitxy));
327 if(localStruct->GetXY4(ibitxy) > 0)
328 ((TH3F*)GetRawsData(hindex))->Fill(11+3, loCircuit, ibitxy, 2*localStruct->GetXY4(ibitxy));
335 //____________________________________________________________________________
336 void AliMUONQADataMakerRec::MakeRecPoints(TTree* clustersTree)
339 /// makes data from trigger response
341 if ( ! fIsInitRecPoints ) {
343 << "Skipping function due to a failure in Init" << endl;
348 fDigitStore->Clear();
350 if (!fTriggerStore) fTriggerStore = AliMUONVTriggerStore::Create(*clustersTree);
351 fTriggerStore->Clear();
352 fTriggerStore->Connect(*clustersTree, false);
353 clustersTree->GetEvent(0);
355 AliMUONLocalTrigger* locTrg;
356 TIter nextLoc(fTriggerStore->CreateLocalIterator());
358 while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(nextLoc()) ) )
360 if (locTrg->IsNull()) continue;
362 TArrayS xyPattern[2];
363 locTrg->GetXPattern(xyPattern[0]);
364 locTrg->GetYPattern(xyPattern[1]);
366 Int_t nBoard = locTrg->LoCircuit();
368 Bool_t xTrig=locTrg->IsTrigX();
369 Bool_t yTrig=locTrg->IsTrigY();
372 ((TH1F*)GetRecPointsData(kTriggeredBoards))->Fill(nBoard);
374 fDigitMaker->TriggerDigits(nBoard, xyPattern, *fDigitStore);
377 TIter nextDigit(fDigitStore->CreateIterator());
378 AliMUONVDigit* mDigit;
379 while ( ( mDigit = static_cast<AliMUONVDigit*>(nextDigit()) ) )
381 Int_t detElemId = mDigit->DetElemId();
382 Int_t ch = detElemId/100;
383 Int_t localBoard = mDigit->ManuId();
384 Int_t channel = mDigit->ManuChannel();
385 Int_t cathode = mDigit->Cathode();
387 = ( cathode == 0 ) ? kTriggerDigitsBendPlane : kTriggerDigitsNonBendPlane;
389 ((TH3F*)GetRecPointsData(hindex))->Fill(ch, localBoard, channel);
393 //____________________________________________________________________________
394 void AliMUONQADataMakerRec::MakeESDs(AliESDEvent* esd)
396 /// make QA data from ESDs
398 if ( ! fIsInitESDs ) {
400 << "Skipping function due to a failure in Init" << endl;
406 Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ;
407 GetESDsData(0)->Fill(nTracks);
409 for (Int_t iTrack = 0; iTrack < nTracks; ++iTrack) {
411 AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack);
412 muonTrack->LorentzP(v1);
414 GetESDsData(1)->Fill(v1.P());
415 GetESDsData(2)->Fill(v1.Pt());
416 GetESDsData(3)->Fill(v1.Rapidity());
418 TClonesArray clusters = muonTrack->GetClusters();
420 for (Int_t iCluster = 0; iCluster <clusters.GetEntriesFast(); ++iCluster) {
421 AliESDMuonCluster* cluster = (AliESDMuonCluster*)clusters.At(iCluster);
422 GetESDsData(kESDClusterHitMap+cluster->GetChamberId())
423 ->Fill(cluster->GetX(), cluster->GetY());
428 //____________________________________________________________________________
429 void AliMUONQADataMakerRec::StartOfDetectorCycle()
431 /// Detector specific actions at start of cycle
435 //____________________________________________________________________________
436 void AliMUONQADataMakerRec::DisplayTriggerInfo(AliQA::TASKINDEX_t task)
439 /// Display trigger information in a user-friendly way:
440 /// from local board and strip numbers to their position on chambers
442 if(task!=AliQA::kRECPOINTS && task!=AliQA::kRAWS) return;
444 AliMpCDB::LoadDDLStore();
447 Float_t xg1, yg1, zg1, xg2, yg2, zg2, binContent;
448 Float_t xLocal1=0., yLocal1=0., xLocal2=0., yLocal2=0., xWidth=0., yWidth=0.;
449 Float_t x1Label, y1Label, x2Label, y2Label;
450 Int_t x1Int, x2Int, y1Int, y2Int;
451 Int_t binCh, binBoard, binStrip;
453 AliMUONGeometryTransformer transform;
454 transform.LoadGeometryData();
456 TH3F* histoStrips=0x0;
457 TH2F* histoDisplayStrips=0x0;
458 TH2F* histoDisplayBoards=0x0;
459 TH1F* histoBoards=0x0;
461 const Float_t kShift = 0.15;
463 for (Int_t iCath = 0; iCath < 2; ++iCath)
466 if(task==AliQA::kRECPOINTS){
468 = ( iCath == 0 ) ? kTriggerDigitsBendPlane : kTriggerDigitsNonBendPlane;
469 histoStrips = (TH3F*)GetRecPointsData(hindex);
470 histoBoards = (TH1F*)GetRecPointsData(kTriggeredBoards);
472 else if(task==AliQA::kRAWS){
474 = ( iCath == 0 ) ? kTriggerScalersBP : kTriggerScalersNBP;
475 histoStrips = (TH3F*)GetRawsData(hindex);
476 if(histoStrips->GetEntries()==0) return; // No scalers found
480 if ( ! AliMpSegmentation::Instance(kFALSE) ) {
482 if ( ! AliMpCDB::LoadDDLStore() ) {
483 AliError("Could not access mapping from OCDB !");
488 for (Int_t iChamber = 0; iChamber < 4; ++iChamber)
490 Int_t iCh = iChamber + AliMpConstants::NofTrackingChambers();
492 if(task==AliQA::kRECPOINTS){
493 histoDisplayStrips = (TH2F*)GetRecPointsData(kTriggerDigitsDisplay + 4*iCath + iChamber);
494 histoDisplayBoards = (TH2F*)GetRecPointsData(kTriggerBoardsDisplay);
496 else if(task==AliQA::kRAWS){
497 histoDisplayStrips = (TH2F*)GetRawsData(kTriggerScalersDisplay + 4*iCath + iChamber);
500 for(Int_t iBoard=1; iBoard<=234; iBoard++){
502 detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(iBoard, iCh);
504 if (!detElemId) continue;
506 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(iBoard, false);
509 if( !localBoard->IsNotified())
512 const AliMpVSegmentation* seg
513 = AliMpSegmentation::Instance()
514 ->GetMpSegmentation(detElemId, AliMp::GetCathodType(iCath));
517 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy)
519 AliMpPad pad = seg->PadByLocation(AliMpIntPair(iBoard,ibitxy),kFALSE);
524 if(iCath==0){ // Geometry info from bending plane only
526 xLocal1 = pad.Position().X();
527 yLocal1 = pad.Position().Y();
528 xWidth = pad.Dimensions().X();
529 yWidth = pad.Dimensions().Y();
531 xLocal2 = pad.Position().X();
532 yLocal2 = pad.Position().Y();
535 Float_t dimX = pad.Dimensions().X();
536 Float_t dimY = pad.Dimensions().Y();
538 Float_t stripX = pad.Position().X();
539 Float_t stripY = pad.Position().Y();
541 transform.Local2Global(detElemId, stripX, stripY, 0, xg1, yg1, zg1);
543 x1Int = histoDisplayStrips->GetXaxis()->FindBin(xg1 - dimX + kShift);
544 y1Int = histoDisplayStrips->GetYaxis()->FindBin(yg1 - dimY + kShift);
545 x2Int = histoDisplayStrips->GetXaxis()->FindBin(xg1 + dimX - kShift);
546 y2Int = histoDisplayStrips->GetYaxis()->FindBin(yg1 + dimY - kShift);
548 binCh = histoStrips->GetXaxis()->FindBin(iCh+1);
549 binBoard = histoStrips->GetYaxis()->FindBin(iBoard);
550 binStrip = histoStrips->GetZaxis()->FindBin(ibitxy);
551 binContent = histoStrips->GetBinContent(binCh, binBoard, binStrip);
553 if(binContent==0) continue;
555 for(Int_t binX=x1Int; binX<=x2Int; binX++){
556 for(Int_t binY=y1Int; binY<=y2Int; binY++){
557 histoDisplayStrips->SetBinContent(binX, binY, binContent);
562 if(task != AliQA::kRECPOINTS) continue;
563 if(iCath>0 || iChamber>0) continue; // Geometry info from bending plane only
564 transform.Local2Global(detElemId, xLocal1, yLocal1, 0, xg1, yg1, zg1);
565 transform.Local2Global(detElemId, xLocal2, yLocal2, 0, xg2, yg2, zg2);
568 x1Label = TMath::Min(xg1,xg2) - xWidth + kShift;
569 y1Label = TMath::Min(yg1,yg2) - yWidth + kShift;
570 x2Label = TMath::Max(xg1,xg2) + xWidth - kShift;
571 y2Label = TMath::Max(yg1,yg2) + yWidth - kShift;
573 x1Int = histoDisplayBoards->GetXaxis()->FindBin(x1Label);
574 y1Int = histoDisplayBoards->GetYaxis()->FindBin(y1Label);
575 x2Int = histoDisplayBoards->GetXaxis()->FindBin(x2Label);
576 y2Int = histoDisplayBoards->GetYaxis()->FindBin(y2Label);
578 binBoard = histoBoards->GetXaxis()->FindBin(iBoard);
579 binContent = histoBoards->GetBinContent(binBoard);
581 if(binContent==0) continue;
583 for(Int_t binX=x1Int; binX<=x2Int; binX++){
584 for(Int_t binY=y1Int; binY<=y2Int; binY++){
585 histoDisplayBoards->SetBinContent(binX, binY, binContent);
594 //____________________________________________________________________________
595 Bool_t AliMUONQADataMakerRec::InitDisplayHistos(AliQA::TASKINDEX_t task)
598 /// Initialize trigger information display histograms,
599 /// using mapping and geometry
601 AliMpCDB::LoadDDLStore();
603 const Int_t kNumOfBoards = AliMpConstants::NofLocalBoards();
605 AliMUONGeometryTransformer transform;
606 transform.LoadGeometryData();
608 TString cathCode[2] = {"BendPlane", "NonBendPlane"};
610 TArrayF xLocal1[4], yLocal1[4], xLocal2[4], yLocal2[4], xWidth[4], yWidth[4];
612 TArrayF xAxisStrip[8];
613 TArrayF yAxisStrip[8];
614 TArrayF xAxisBoard[8];
615 TArrayF yAxisBoard[8];
617 TH2F* histoStrips=0x0;
618 TH2F* histoBoards=0x0;
620 const Float_t kResetValue=1234567.;
622 for(Int_t ch=0; ch<4; ch++){
623 xLocal1[ch].Set(kNumOfBoards);
624 yLocal1[ch].Set(kNumOfBoards);
625 xLocal2[ch].Set(kNumOfBoards);
626 yLocal2[ch].Set(kNumOfBoards);
627 xWidth[ch].Set(kNumOfBoards);
628 yWidth[ch].Set(kNumOfBoards);
631 for(Int_t cath=0; cath<2; cath++){
632 for(Int_t ch=0; ch<4; ch++){
633 Int_t chCath = 4*cath + ch;
634 xAxisBoard[chCath].Set(60);
635 xAxisBoard[chCath].Reset(kResetValue);
636 yAxisBoard[chCath].Set(60);
637 yAxisBoard[chCath].Reset(kResetValue);
639 xAxisStrip[chCath].Set(700);
640 xAxisStrip[chCath].Reset(kResetValue);
641 yAxisStrip[chCath].Set(700);
642 yAxisStrip[chCath].Reset(kResetValue);
646 Float_t xg1, yg1, zg1, xg2, yg2, zg2;
648 TString histoName, histoTitle;
650 const Float_t kShift = 0.;
653 if ( ! AliMpSegmentation::Instance(kFALSE) ) {
655 if ( ! AliMpCDB::LoadDDLStore() ) {
656 AliError("Could not access mapping from OCDB !");
661 for(Int_t iCath=0; iCath<2; iCath++){
662 for (Int_t iChamber = 0; iChamber < 4; ++iChamber) {
663 Int_t iCh = iChamber + AliMpConstants::NofTrackingChambers();
664 for(Int_t iLoc = 0; iLoc < 234; iLoc++) {
665 Int_t iBoard = iLoc+1;
666 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(iBoard, iCh);
668 if (!detElemId) continue;
670 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(iBoard, kFALSE);
673 if( !localBoard->IsNotified())
677 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()
678 ->GetMpSegmentation(detElemId,
679 AliMp::GetCathodType(iCath));
681 Int_t chCath = 4*iCath + iChamber;
683 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
684 // get pad from electronics
685 AliMpPad pad = seg->PadByLocation(AliMpIntPair(iBoard,ibitxy),kFALSE);
687 if (!pad.IsValid()) continue;
691 xLocal1[iChamber][iLoc] = pad.Position().X();
692 yLocal1[iChamber][iLoc] = pad.Position().Y();
693 xWidth[iChamber][iLoc] = pad.Dimensions().X();
694 yWidth[iChamber][iLoc] = pad.Dimensions().Y();
696 xLocal2[iChamber][iLoc] = pad.Position().X();
697 yLocal2[iChamber][iLoc] = pad.Position().Y();
701 Float_t dimX = pad.Dimensions().X();
702 Float_t dimY = pad.Dimensions().Y();
704 Float_t stripX = pad.Position().X();
705 Float_t stripY = pad.Position().Y();
707 transform.Local2Global(detElemId, stripX, stripY, 0, xg1, yg1, zg1);
709 AddSortedPoint(xg1 - dimX + kShift, xAxisStrip[chCath], kResetValue);
710 AddSortedPoint(xg1 + dimX - kShift, xAxisStrip[chCath], kResetValue);
712 AddSortedPoint(yg1 - dimY + kShift, yAxisStrip[chCath], kResetValue);
713 AddSortedPoint(yg1 + dimY - kShift, yAxisStrip[chCath], kResetValue);
716 transform.Local2Global(detElemId, xLocal1[iChamber][iLoc], yLocal1[iChamber][iLoc], 0, xg1, yg1, zg1);
717 transform.Local2Global(detElemId, xLocal2[iChamber][iLoc], yLocal2[iChamber][iLoc], 0, xg2, yg2, zg2);
720 AddSortedPoint(TMath::Min(xg1,xg2) - xWidth[iChamber][iLoc] + kShift, xAxisBoard[chCath], kResetValue);
721 AddSortedPoint(TMath::Max(xg1,xg2) + xWidth[iChamber][iLoc] - kShift, xAxisBoard[chCath], kResetValue);
723 AddSortedPoint(TMath::Min(yg1,yg2) - yWidth[iChamber][iLoc] + kShift, yAxisBoard[chCath], kResetValue);
724 AddSortedPoint(TMath::Max(yg1,yg2) + yWidth[iChamber][iLoc] - kShift, yAxisBoard[chCath], kResetValue);
725 } // loop on local boards
726 } // loop on chambers
727 } // loop on cathodes
729 const Float_t kMinDiff = 0.1;
732 for(Int_t iCath=0; iCath<2; iCath++){
733 for(Int_t iChamber=0; iChamber<4; iChamber++){
734 Int_t chCath = 4*iCath + iChamber;
736 while(TMath::Abs(xAxisStrip[chCath][ipoint]-kResetValue)>kMinDiff) { ipoint++; }
737 xAxisStrip[chCath].Set(ipoint);
740 while(TMath::Abs(yAxisStrip[chCath][ipoint]-kResetValue)>kMinDiff) { ipoint++; }
741 yAxisStrip[chCath].Set(ipoint);
744 while(TMath::Abs(xAxisBoard[chCath][ipoint]-kResetValue)>kMinDiff) { ipoint++; }
745 xAxisBoard[chCath].Set(ipoint);
748 while(TMath::Abs(yAxisBoard[chCath][ipoint]-kResetValue)>kMinDiff) { ipoint++; }
749 yAxisBoard[chCath].Set(ipoint);
751 if(task==AliQA::kRECPOINTS){
752 histoName = Form("hTriggerDigits%sChamber%i", cathCode[iCath].Data(), 11+iChamber);
753 histoTitle = Form("Chamber %i: Fired pads %s", 11+iChamber, cathCode[iCath].Data());
755 else if(task==AliQA::kRAWS){
756 histoName = Form("hScalers%sChamber%i", cathCode[iCath].Data(), 11+iChamber);
757 histoTitle = Form("Chamber %i: Scalers %s", 11+iChamber, cathCode[iCath].Data());
759 histoStrips = new TH2F(histoName.Data(), histoTitle.Data(),
760 xAxisStrip[chCath].GetSize()-1, xAxisStrip[chCath].GetArray(),
761 yAxisStrip[chCath].GetSize()-1, yAxisStrip[chCath].GetArray());
762 histoStrips->SetXTitle("X (cm)");
763 histoStrips->SetYTitle("Y (cm)");
765 if(task==AliQA::kRECPOINTS){
766 Add2RecPointsList(histoStrips, kTriggerDigitsDisplay + 4*iCath + iChamber);
768 else if(task==AliQA::kRAWS){
769 Add2RawsList(histoStrips, kTriggerScalersDisplay + 4*iCath + iChamber);
772 if(task != AliQA::kRECPOINTS) continue;
773 if(iCath>0 || iChamber>0) continue;
775 histoName = "hFiredBoardsDisplay";
776 histoTitle = "Fired boards";
777 histoBoards = new TH2F(histoName.Data(), histoTitle.Data(),
778 xAxisBoard[chCath].GetSize()-1, xAxisBoard[chCath].GetArray(),
779 yAxisBoard[chCath].GetSize()-1, yAxisBoard[chCath].GetArray());
780 histoBoards->SetXTitle("X (cm)");
781 histoBoards->SetYTitle("Y (cm)");
783 Add2RecPointsList(histoBoards, kTriggerBoardsDisplay + 4*iCath + iChamber);
791 //____________________________________________________________________________
792 Bool_t AliMUONQADataMakerRec::AddSortedPoint(Float_t currVal, TArrayF& position, const Float_t kResetValue)
795 /// Add sorted point in array according to an increasing order.
796 /// Used to build display histograms axis.
798 Int_t nEntries = position.GetSize();
800 const Float_t kMinDiff = 0.1;
801 for(Int_t i=0; i<nEntries; i++){
802 if(TMath::Abs(position[i]-currVal)<kMinDiff) return kFALSE;
803 if(TMath::Abs(position[i]-kResetValue)<kMinDiff) {
804 position[i] = currVal;
807 if(currVal>position[i]) continue;
809 position[i] = currVal;
810 for(Int_t j=i+1; j<nEntries; j++){
814 if(tmp1==kResetValue) break;