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 **************************************************************************/
18 #include "AliMUONTriggerEfficiencyCells.h"
19 #include "AliMpConstants.h"
21 // Classes for display
22 #include "AliMUONTriggerDisplay.h"
23 #include "AliCDBManager.h"
25 #include "AliMpDDLStore.h"
26 #include "AliMpLocalBoard.h"
28 #include "AliMpVSegmentation.h"
29 #include "AliMpSegmentation.h"
34 #include "Riostream.h"
44 #include "TPaveLabel.h"
50 //-----------------------------------------------------------------------------
51 /// \class AliMUONTriggerEfficiencyCells
52 /// A class to store and give access to the trigger chamber efficiency.
54 /// Efficiency is stored per cathode on local boards
56 /// The main method of this class is IsTriggered().
58 /// $ALICE_ROOT/MUON/data/efficiencyCells.dat contains efficiency
59 /// for each chamber (i.e. DetElement).
61 /// In the case of local boards, efficiency is stored from left to right
62 /// per increasing board number (from 1 to 234)
64 /// The file can be edited in order to change efficiency
65 /// in a chosen local board/region of the chamber.
68 /// But please note that this object is also available from the CDB
70 /// \author Diego Stocco; INFN Torino
71 //-----------------------------------------------------------------------------
74 ClassImp(AliMUONTriggerEfficiencyCells)
77 //__________________________________________________________________________
78 AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells()
82 fNoCountHistoList(0x0),
84 fDisplayHistoList(0x0),
86 fFiredFitHistoList(0x0),
87 fFiredDisplayHistoList(0x0)
89 /// Default constructor.
95 //__________________________________________________________________________
96 AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(const Char_t* filename, const Char_t* listname)
100 fNoCountHistoList(0x0),
102 fDisplayHistoList(0x0),
103 fBoardLabelList(0x0),
104 fFiredFitHistoList(0x0),
105 fFiredDisplayHistoList(0x0)
107 /// Constructor using an ASCII file.
111 ReadFile(filename, listname);
115 //__________________________________________________________________________
116 AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(TList *countHistoList,
117 TList *noCountHistoList)
120 fCountHistoList(countHistoList),
121 fNoCountHistoList(noCountHistoList),
123 fDisplayHistoList(0x0),
124 fBoardLabelList(0x0),
125 fFiredFitHistoList(0x0),
126 fFiredDisplayHistoList(0x0)
128 /// Constructor using a list of histograms with counts.
132 FillHistosFromList();
135 //_____________________________________________________________________________
136 AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(const AliMUONTriggerEfficiencyCells& other)
139 fCountHistoList(other.fCountHistoList),
140 fNoCountHistoList(other.fNoCountHistoList),
141 fFiredStrips(other.fFiredStrips),
142 fDisplayHistoList(other.fDisplayHistoList),
143 fBoardLabelList(other.fBoardLabelList),
144 fFiredFitHistoList(other.fFiredFitHistoList),
145 fFiredDisplayHistoList(other.fFiredDisplayHistoList)
149 for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
150 fBoardEfficiency[chCath] = other.fBoardEfficiency[chCath];
151 fSlatEfficiency[chCath] = other.fSlatEfficiency[chCath];
155 //_____________________________________________________________________________
156 AliMUONTriggerEfficiencyCells& AliMUONTriggerEfficiencyCells::operator=(const AliMUONTriggerEfficiencyCells& other)
158 /// Asignment operator
159 // check assignement to self
163 for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
164 fBoardEfficiency[chCath] = other.fBoardEfficiency[chCath];
165 fSlatEfficiency[chCath] = other.fSlatEfficiency[chCath];
168 fCountHistoList = other.fCountHistoList;
169 fNoCountHistoList = other.fNoCountHistoList;
170 fFiredStrips = other.fFiredStrips;
172 fDisplayHistoList = other.fDisplayHistoList;
173 fBoardLabelList = other.fBoardLabelList;
174 fFiredFitHistoList = other.fFiredFitHistoList;
175 fFiredDisplayHistoList = other.fFiredDisplayHistoList;
180 //__________________________________________________________________________
181 AliMUONTriggerEfficiencyCells::~AliMUONTriggerEfficiencyCells()
188 //__________________________________________________________________________
189 void AliMUONTriggerEfficiencyCells::GetCellEfficiency(Int_t detElemId, Int_t localBoard, Float_t &eff1, Float_t &eff2) const
191 /// Get the efficiencies of the 2 cathodes at a given local board
193 Int_t chamber = FindChamberIndex(detElemId);
194 Int_t bin = fBoardEfficiency[chamber]->FindBin(localBoard);
195 eff1 = fBoardEfficiency[chamber]->GetBinContent(bin);
196 eff2 = fBoardEfficiency[fgkNchambers+chamber]->GetBinContent(bin);
200 //__________________________________________________________________________
202 AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Int_t localBoard, Bool_t &trig1, Bool_t &trig2) const
204 /// Whether or not a given local board has a chance to trig, on each cathode.
208 GetCellEfficiency(detElemId, localBoard, eff1, eff2);
211 if(gRandom->Rndm()>eff1)trig1 = kFALSE;
212 if(gRandom->Rndm()>eff2)trig2 = kFALSE;
216 //__________________________________________________________________________
217 void AliMUONTriggerEfficiencyCells::ReadFile(const Char_t* filename, const Char_t* listname)
219 /// Reads a file containing the efficiency map.
221 TString fileName = gSystem->ExpandPathName(filename);
222 if(fileName.EndsWith(".root")){
223 ReadHistoBoards(fileName.Data(), listname);
227 ifstream file(fileName.Data());
231 if(!strcmp(dat,"localBoards"))ReadFileBoards(file);
232 else AliWarning("File .dat in wrong format");
235 AliError(Form("Can't read file %s",fileName.Data()));
240 //__________________________________________________________________________
241 void AliMUONTriggerEfficiencyCells::ReadFileBoards(ifstream &file)
243 /// Structure of file (.dat) containing local board efficency
244 Int_t datInt=0, detEl=0, chamber=0, chCath=0, bin=0;
245 Float_t datFloat=0.0;
248 while (file >> dat) {
250 chamber = FindChamberIndex(detEl);
251 for(Int_t cath=0; cath<fgkNcathodes; cath++){
252 chCath = GetPlane(chamber, cath);
255 for(Int_t board=1; board<=AliMpConstants::NofLocalBoards(); board++){
257 bin = fBoardEfficiency[chCath]->FindBin(board);
258 fBoardEfficiency[chCath]->SetBinContent(bin, datFloat);
265 //__________________________________________________________________________
266 void AliMUONTriggerEfficiencyCells::ReadHistoBoards(const Char_t *filename, const Char_t* listname)
268 /// Structure of file (.root) containing local board efficency
269 TFile *file = new TFile(filename, "read");
270 if(!file || !file->IsOpen()) {
271 AliError(Form("Can't read file %s",filename));
276 TString cathCode[fgkNcathodes] = {"bendPlane", "nonBendPlane"};
277 enum {kAllChEff, kChNonEff, kNumOfHistoTypes};
278 TString histoTypeName[2] = {"CountInCh", "NonCountInCh"};
280 if ( ! fCountHistoList ) {
281 fCountHistoList = new TList();
282 fCountHistoList->SetOwner();
284 else fCountHistoList->Delete();
285 if( ! fNoCountHistoList) {
286 fNoCountHistoList = new TList();
287 fNoCountHistoList->SetOwner();
289 else fNoCountHistoList->Delete();
291 TList *currList[2] = {fCountHistoList, fNoCountHistoList};
295 TList* listInFile = 0x0;
296 TString listNameString(listname);
297 if ( ! listNameString.IsNull() )
298 listInFile = (TList*)file->Get(listname);
300 for(Int_t cath=0; cath<fgkNcathodes; cath++){
301 for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
302 histoName = Form("%sChamber%s", cathCode[cath].Data(), histoTypeName[hType].Data());
303 histo = ( listInFile ) ? (TH1F*)listInFile->FindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data());
304 histo->SetDirectory(0);
305 currList[hType]->Add(histo);
309 for(Int_t cath=0; cath<fgkNcathodes; cath++){
310 for(Int_t ch=0; ch<fgkNchambers; ch++){
311 for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
312 histoName = Form("%sSlat%s%i", cathCode[cath].Data(), histoTypeName[hType].Data(), 11+ch);
313 histo = ( listInFile ) ? (TH1F*)listInFile->FindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data());
314 histo->SetDirectory(0);
315 currList[hType]->Add(histo);
320 for(Int_t cath=0; cath<fgkNcathodes; cath++){
321 for(Int_t ch=0; ch<fgkNchambers; ch++){
322 for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
323 histoName = Form("%sBoard%s%i", cathCode[cath].Data(), histoTypeName[hType].Data(), 11+ch);
324 histo = ( listInFile ) ? (TH1F*)listInFile->FindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data());
325 histo->SetDirectory(0);
326 currList[hType]->Add(histo);
333 FillHistosFromList();
337 //_____________________________________________________________________________
338 void AliMUONTriggerEfficiencyCells::CheckConstants() const
340 /// Check consistence of redefined constants
342 assert(fgkNcathodes == AliMpConstants::NofCathodes());
343 assert(fgkNchambers == AliMpConstants::NofTriggerChambers());
344 assert(fgkNplanes == AliMpConstants::NofTriggerChambers() * fgkNcathodes);
348 //__________________________________________________________________________
349 Int_t AliMUONTriggerEfficiencyCells::FindChamberIndex(Int_t detElemId) const
351 /// From detElemId to chamber number
353 // Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
354 Int_t iChamber = detElemId/100 - 1;
355 Int_t chamber = iChamber-AliMpConstants::NofTrackingChambers();
360 //__________________________________________________________________________
362 AliMUONTriggerEfficiencyCells::Reset(Bool_t resetAll)
364 /// Sets our internal array contents to zero.
367 for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
368 if ( fBoardEfficiency[chCath] ) {
369 fBoardEfficiency[chCath] = 0x0;
371 if ( fSlatEfficiency[chCath] ) {
372 fSlatEfficiency[chCath] = 0x0;
376 if ( fCountHistoList )
377 delete fCountHistoList;
378 if ( fNoCountHistoList )
379 delete fNoCountHistoList;
384 if ( fDisplayHistoList )
385 delete fDisplayHistoList;
386 if ( fBoardLabelList )
387 delete fBoardLabelList;
388 if ( fFiredFitHistoList )
389 delete fFiredFitHistoList;
390 if ( fFiredDisplayHistoList )
391 delete fFiredDisplayHistoList;
395 //__________________________________________________________________________
397 AliMUONTriggerEfficiencyCells::InitHistos()
399 /// Sets our internal array contents to zero.
401 const Int_t kNumOfBoards = AliMpConstants::NofLocalBoards();
402 const Int_t kNslats = 18;
406 TString cathCode[fgkNcathodes] = {"bendPlane", "nonBendPlane"};
408 for(Int_t ch=0; ch<fgkNchambers; ch++){
409 for(Int_t cath=0; cath<fgkNcathodes; cath++){
410 chCath = GetPlane(ch, cath);
411 histoName = Form("%sBoardEffChamber%i", cathCode[cath].Data(), 11+ch);
412 fBoardEfficiency[chCath] = new TH1F(histoName.Data(), histoName.Data(), kNumOfBoards, 1-0.5, kNumOfBoards+1.-0.5);
413 histoName = Form("%sSlatEffChamber%i", cathCode[cath].Data(), 11+ch);
414 fSlatEfficiency[chCath] = new TH1F(histoName.Data(), histoName.Data(), kNslats, 0-0.5, kNslats-0.5);
420 //__________________________________________________________________________
422 AliMUONTriggerEfficiencyCells::FillHistosFromList(Bool_t useMeanValues)
424 /// Fills internal histos from list.
427 TH1F *histoNum = 0x0, *histoDen=0x0, *currHisto = 0x0;
428 TString slatName = "SLAT", boardName = "BOARD", histoName;
429 Float_t efficiency, efficiencyError;
432 Int_t nentries = fCountHistoList->GetEntries();
435 AliInfo("Boards filled with the average efficiency of the RPC");
437 for(Int_t iEntry=0; iEntry<nentries; iEntry++){
438 histoNum = (TH1F*)fCountHistoList->At(iEntry);
439 histoDen = (TH1F*)fNoCountHistoList->At(iEntry);
442 AliWarning("Histogram not found in fCountHistoList. Skip to next");
446 AliWarning("Histogram not found in fNoCountHistoList. Skip to next");
450 histoName = histoNum->GetName();
452 nHistoBins = histoNum->GetNbinsX();
456 for(Int_t ich = 11; ich<=14; ich++){
457 chName = Form("%i", ich);
458 if ( histoName.Contains(chName.Data())){
463 Int_t currCath = ( histoName.Contains("NONBEND") ) ? 1 : 0;
465 Int_t chCath = GetPlane(currCh, currCath);
467 if(histoName.Contains(boardName)){
468 if ( useMeanValues ) continue;
469 currHisto = fBoardEfficiency[chCath];
471 else if(histoName.Contains(slatName)){
472 currHisto = fSlatEfficiency[chCath];
477 for(Int_t iBin=1; iBin<=nHistoBins; iBin++){
478 CalculateEfficiency((Int_t)histoNum->GetBinContent(iBin), (Int_t)histoNum->GetBinContent(iBin) + (Int_t)histoDen->GetBinContent(iBin), efficiency, efficiencyError, kFALSE);
480 currHisto->SetBinContent(iBin, efficiency);
481 currHisto->SetBinError(iBin, efficiencyError);
484 if ( useMeanValues ){
485 currHisto = fBoardEfficiency[chCath];
486 Int_t nBinsBoards = currHisto->GetNbinsX();
487 Int_t currChamber = currCh + AliMpConstants::NofTrackingChambers();
488 for ( Int_t iBinBoard = 1; iBinBoard<= nBinsBoards; iBinBoard++){
489 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(iBinBoard, currChamber);
490 Int_t iBin = histoNum->FindBin(detElemId%100);
492 CalculateEfficiency((Int_t)histoNum->GetBinContent(iBin), (Int_t)histoNum->GetBinContent(iBin) + (Int_t)histoDen->GetBinContent(iBin), efficiency, efficiencyError, kFALSE);
494 currHisto->SetBinContent(iBinBoard, efficiency);
495 currHisto->SetBinError(iBinBoard, efficiencyError);
502 //_____________________________________________________________________________
503 void AliMUONTriggerEfficiencyCells::CalculateEfficiency(Int_t trigger44, Int_t trigger34,
504 Float_t &efficiency, Float_t &error,
505 Bool_t failuresAsInput)
508 /// Returns the efficiency.
514 efficiency=(Double_t)trigger44/((Double_t)trigger34);
515 if(failuresAsInput)efficiency=1.-(Double_t)trigger44/((Double_t)trigger34);
517 Double_t q = TMath::Abs(1-efficiency);
518 if(efficiency<0)error=0.0;
519 else error = TMath::Sqrt(efficiency*q/((Double_t)trigger34));
523 //_____________________________________________________________________________
524 void AliMUONTriggerEfficiencyCells::CheckFiredStrips()
527 /// Check for fired strips participating to efficiency
528 /// calculation (when available).
529 /// Strips inside a local board should be quite homogeneously hit
530 /// If not, this could be a problem of electronics (i.e. ADULT board off).
534 AliWarning("List of fired pads not present. Check not performable.");
542 // Check fired pads (when available)
543 if(fFiredFitHistoList){
546 TCanvas *histoFiredCan[20];
547 Int_t nEntries = fFiredFitHistoList->GetEntries();
548 for(Int_t iEntry=0; iEntry<nEntries; iEntry++){
549 histo1D = (TH1F*)fFiredFitHistoList->At(iEntry);
550 printf("Problems found in %s\n", histo1D->GetTitle());
552 Int_t nPrintCan = nEntries;
554 AliWarning("Too many boards with problems: only 20 will be shown");
557 for(Int_t iCan=0; iCan<nPrintCan; iCan++){
558 histo1D = (TH1F*)fFiredFitHistoList->At(iCan);
559 histoName = histo1D->GetName();
560 histoName.Append("Can");
561 histoFiredCan[iCan] = new TCanvas(histoName.Data(), histoName.Data(), 100+10*iCan, 10*iCan, 700, 700);
562 histoFiredCan[iCan]->SetRightMargin(0.14);
563 histoFiredCan[iCan]->SetLeftMargin(0.12);
565 fitFunc = histo1D->GetFunction("pol0");
566 fitFunc->SetLineColor(2);
567 fitFunc->Draw("same");
570 printf("\nAll local boards seem ok!!\n\n");
576 //_____________________________________________________________________________
577 void AliMUONTriggerEfficiencyCells::DisplayEfficiency(Bool_t perSlat)
580 /// Display calculated efficiency.
583 Bool_t isInitSlat = kFALSE, isInitBoard = kFALSE;
584 for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
585 if(fBoardEfficiency[chCath]->GetEntries()>0) isInitBoard = kTRUE;
586 if(fSlatEfficiency[chCath]->GetEntries()>0) isInitSlat = kTRUE;
590 AliWarning("Trigger efficiency not initialized per board.\nDisplay not yet implemented.");
593 if(!isInitSlat && perSlat){
594 AliWarning("Trigger efficiency not initialized for slat.\nPlease try option kFALSE.");
597 if ( !AliCDBManager::Instance()->GetDefaultStorage() ){
598 AliWarning("Please set default CDB storage (needed for mapping).");
601 if ( AliCDBManager::Instance()->GetRun() < 0 ){
602 AliWarning("Please set CDB run number (needed for mapping).");
608 //const Int_t kNumOfBoards = AliMpConstants::NofLocalBoards();
611 TString histoName, histoTitle;
613 // Plot fired strips (when available)
614 if(fFiredDisplayHistoList){
615 TCanvas *displayFiredCan[fgkNplanes];
616 for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
617 histo = (TH2F*)fFiredDisplayHistoList->At(chCath);
618 histoName = Form("%sCan", histo->GetName());
619 histoTitle = Form("%s", histo->GetTitle());
620 displayFiredCan[chCath] = new TCanvas(histoName.Data(), histoTitle.Data(), 100+10*chCath, 10*chCath, 700, 700);
621 displayFiredCan[chCath]->SetRightMargin(0.14);
622 displayFiredCan[chCath]->SetLeftMargin(0.12);
623 histo->GetYaxis()->SetTitleOffset(1.4);
624 histo->SetStats(kFALSE);
630 if(fDisplayHistoList){
631 TCanvas *can[fgkNplanes];
632 for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
633 Int_t currChCath = chCath;
634 if(perSlat==kTRUE) currChCath += fgkNplanes;
635 histo = (TH2F*)fDisplayHistoList->At(currChCath);
636 histoName = Form("%sCan", histo->GetName());
637 histoTitle = Form("%s", histo->GetTitle());
638 can[chCath] = new TCanvas(histoName.Data(), histoTitle.Data(), 100+10*chCath, 10*chCath, 700, 700);
639 can[chCath]->SetRightMargin(0.14);
640 can[chCath]->SetLeftMargin(0.12);
641 histo->GetZaxis()->SetRangeUser(0.,1.);
642 histo->GetYaxis()->SetTitleOffset(1.4);
643 histo->SetStats(kFALSE);
645 if(perSlat==kTRUE) continue;
646 histo = (TH2F*)fBoardLabelList->At(currChCath);
647 histo->Draw("textsame");
653 //__________________________________________________________________________
654 Bool_t AliMUONTriggerEfficiencyCells::GetListsForCheck()
657 /// Getting histograms for efficiency,
658 /// map of fired strips entering efficiency calculations,
659 /// fits for checking switched-off elements in chambers.
661 const Float_t kChi2RedMax = 1.5;
662 const Float_t kDummyFired = 1e-5;
666 fDisplayHistoList = new TList();
667 fDisplayHistoList->SetOwner();
668 fBoardLabelList = new TList();
669 fBoardLabelList->SetOwner();
671 fFiredFitHistoList = new TList();
672 fFiredFitHistoList->SetOwner();
673 fFiredDisplayHistoList = new TList();
674 fFiredDisplayHistoList->SetOwner();
677 TH3F* padFired = 0x0;
678 TH2F* displayHisto = 0x0;
679 TH1F* histoFired[fgkNplanes][234];
681 Bool_t isStripOffInBoard[fgkNplanes][234];
683 TString histoName, histoTitle;
684 TString cathName[fgkNcathodes] = {"bendPlane", "nonBendPlane"};
686 AliMUONTriggerDisplay triggerDisplay;
688 for(Int_t iCath=0; iCath<fgkNcathodes; iCath++){
689 if(fFiredStrips) padFired = (TH3F*)fFiredStrips->At(iCath);
690 for(Int_t iCh=0; iCh<fgkNchambers; iCh++){
691 Int_t chCath = GetPlane(iCh, iCath);
692 Int_t currCh = 11 + iCh;
693 histoName = Form("%sChamber%i", cathName[iCath].Data(), currCh);
694 histoTitle = Form("Chamber %i: efficiency %s", currCh, cathName[iCath].Data());
696 (TH2F*)triggerDisplay.GetDisplayHistogram(fBoardEfficiency[chCath], histoName,
697 AliMUONTriggerDisplay::kDisplayBoards,
698 iCath,currCh,histoTitle,
699 AliMUONTriggerDisplay::kShowZeroes);
700 fDisplayHistoList->Add(displayHisto);
702 histoName = Form("labels%sChamber%i", cathName[iCath].Data(), currCh);
704 (TH2F*)triggerDisplay.GetBoardNumberHisto(histoName,currCh);
705 fBoardLabelList->Add(displayHisto);
707 if(!fFiredStrips) continue;
708 histoName = Form("firedPads%sChamber%i", cathName[iCath].Data(), currCh);
709 histoTitle = Form("Chamber %i: Fired pads %s", currCh, cathName[iCath].Data());
710 bin = padFired->GetXaxis()->FindBin(currCh);
711 padFired->GetXaxis()->SetRange(bin,bin);
713 (TH2F*)triggerDisplay.GetDisplayHistogram(padFired->Project3D("zy"),histoName,
714 AliMUONTriggerDisplay::kDisplayStrips,
715 iCath,currCh,histoTitle);
716 fFiredDisplayHistoList->Add(displayHisto);
718 for(Int_t ib=0; ib<AliMpConstants::NofLocalBoards(); ib++){
719 histoName = Form("%sChamber%iBoard%i", cathName[iCath].Data(), currCh, ib+1);
720 histoTitle = Form("Chamber %i: fired pads %s board = %i", currCh, cathName[iCath].Data(), ib+1);
721 histoFired[chCath][ib] = new TH1F(histoName.Data(), histoTitle.Data(), 16, -0.5, 15.5);
722 histoFired[chCath][ib]->SetXTitle("board");
723 isStripOffInBoard[chCath][ib] = kFALSE;
728 for(Int_t iCath=0; iCath<fgkNcathodes; iCath++){
729 for(Int_t iCh=0; iCh<fgkNchambers; iCh++){
730 Int_t chCath = GetPlane(iCh, iCath);
731 Int_t currCh = 11+iCh;
732 histoName = Form("%sChamber%iSlatEff", cathName[iCath].Data(), currCh);
733 histoTitle = Form("Chamber %i: efficiency %s per slat", currCh, cathName[iCath].Data());
735 (TH2F*)triggerDisplay.GetDisplayHistogram(fSlatEfficiency[chCath], histoName,
736 AliMUONTriggerDisplay::kDisplaySlats,
737 iCath,currCh,histoTitle);
738 fDisplayHistoList->Add(displayHisto);
742 if(!fFiredStrips) return kTRUE;
744 AliMpCDB::LoadDDLStore();
746 // Check fired pads (when available)
747 for(Int_t iLoc = 0; iLoc < AliMpConstants::NofLocalBoards(); iLoc++) {
748 Int_t iBoard = iLoc+1;
749 for(Int_t iCh=0; iCh<AliMpConstants::NofChambers(); iCh++){
750 Int_t iChamber = iCh + AliMpConstants::NofTrackingChambers();
752 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(iBoard, iChamber);
754 if (!detElemId) continue;
756 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(iBoard, kFALSE);
759 if( !localBoard->IsNotified())
762 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
763 Int_t chCath = GetPlane(iCh, iCath);
765 const AliMpVSegmentation* seg =
766 AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(iCath));
768 for (Int_t iStrip = 0; iStrip < 16; ++iStrip) {
769 AliMpPad pad = seg->PadByLocation(iBoard,iStrip,kFALSE);
770 if (!pad.IsValid()) continue;
772 padFired = (TH3F*)fFiredStrips->At(iCath);
773 Float_t nFired = padFired->GetBinContent(11+iCh, iBoard, iStrip);
774 if(nFired==0.) nFired = kDummyFired;
775 histoFired[chCath][iLoc]->Fill(iStrip, nFired);
778 histoFired[chCath][iLoc]->Fit("pol0","Q0R","",0., (Float_t)nStrips-1.);
779 fitFunc = histoFired[chCath][iLoc]->GetFunction("pol0");
780 Float_t chi2 = fitFunc->GetChisquare();
781 Float_t ndf = (Float_t)fitFunc->GetNDF();
782 Float_t reducedChi2 = chi2/ndf;
783 if(reducedChi2>kChi2RedMax) {
784 isStripOffInBoard[chCath][iLoc] = kTRUE;
785 fFiredFitHistoList->Add(histoFired[chCath][iLoc]);
787 } // loop on cathodes
788 } // loop on chambers
789 } // loop on local boards
794 //__________________________________________________________________________
795 Bool_t AliMUONTriggerEfficiencyCells::SumRunEfficiency(const AliMUONTriggerEfficiencyCells &other)
797 /// Sums results from different runs and gives the efficiency
798 if(!fCountHistoList || !fNoCountHistoList) {
799 AliWarning("Histograms for efficiency calculations not implemented in object");
802 if(!other.fCountHistoList || !other.fNoCountHistoList) {
803 AliWarning("Histograms for efficiency calculations not implemented in object passed as argument");
807 Int_t nentries = fCountHistoList->GetEntries();
808 TH1F *currNum = 0x0, *currDen = 0x0, *otherNum = 0x0, *otherDen = 0x0;
810 for(Int_t iEntry=0; iEntry<nentries; iEntry++){
811 currNum = (TH1F*)fCountHistoList->At(iEntry);
812 currDen = (TH1F*)fNoCountHistoList->At(iEntry);
813 otherNum = (TH1F*)other.fCountHistoList->At(iEntry);
814 otherDen = (TH1F*)other.fNoCountHistoList->At(iEntry);
815 currNum->Add(otherNum);
816 currDen->Add(otherDen);
819 FillHistosFromList();
822 AliWarning("Histograms for fired region check not implemented in object");
825 if(!other.fFiredStrips) {
826 AliWarning("Histograms for fired region check not implemented in object passed as argument");
830 TH3F *currFired = 0x0, *otherFired = 0x0;
831 nentries = fFiredStrips->GetEntries();
832 for(Int_t iEntry=0; iEntry<nentries; iEntry++){
833 currFired = (TH3F*)fFiredStrips->At(iEntry);
834 otherFired = (TH3F*)fFiredStrips->At(iEntry);
835 currFired->Add(otherFired);
842 //__________________________________________________________________________
843 Bool_t AliMUONTriggerEfficiencyCells::LowStatisticsSettings(Bool_t useMeanValues)
846 /// In case of low statistics, fill the local board efficiency with
847 /// the average value of the RPC
850 if ( ! fCountHistoList ){
851 AliWarning("Cannot find histograms for RPC efficiency calculation. Nothing done!");
854 if ( !AliCDBManager::Instance()->GetDefaultStorage() ){
855 AliWarning("Please set default CDB storage (needed for mapping).");
858 if ( AliCDBManager::Instance()->GetRun() < 0 ){
859 AliWarning("Please set CDB run number (needed for mapping).");
863 AliMpCDB::LoadDDLStore();
865 for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
866 fBoardEfficiency[chCath]->Reset();
867 fSlatEfficiency[chCath]->Reset();
870 FillHistosFromList(useMeanValues);