X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONTriggerEfficiencyCells.cxx;h=bac6f88a0e550a5a3c31ec5941278a3e2f95cdf5;hb=18ec51a0159f3bc29b519c60a0187318ae10f793;hp=ecfb08fc5c60f22c01345fb96df82c2b901aa423;hpb=081d3361e968f8c807435b4b6a753b14ed794b92;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONTriggerEfficiencyCells.cxx b/MUON/AliMUONTriggerEfficiencyCells.cxx index ecfb08fc5c6..bac6f88a0e5 100755 --- a/MUON/AliMUONTriggerEfficiencyCells.cxx +++ b/MUON/AliMUONTriggerEfficiencyCells.cxx @@ -13,56 +13,62 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -#include -#include -#include "Riostream.h" -#include "TSystem.h" +// $Id$ #include "AliMUONTriggerEfficiencyCells.h" -#include "AliMUONConstants.h" +#include "AliMpConstants.h" + +// Classes for display +#include "AliMUONTriggerDisplay.h" +#include "AliCDBManager.h" +#include "AliMpCDB.h" +#include "AliMpDDLStore.h" +#include "AliMpLocalBoard.h" +#include "AliMpPad.h" +#include "AliMpVSegmentation.h" +#include "AliMpSegmentation.h" + #include "AliLog.h" +#include "TRandom.h" +#include "Riostream.h" +#include "TSystem.h" +#include "TFile.h" +#include "TH1F.h" +#include "TMath.h" + +#include "TH2F.h" +#include "TH3F.h" +#include "TF1.h" +#include "TStyle.h" +#include "TPaveLabel.h" +#include "TCanvas.h" + +#include +#include + +//----------------------------------------------------------------------------- /// \class AliMUONTriggerEfficiencyCells /// A class to store and give access to the trigger chamber efficiency. /// -/// Efficiency is stored per cathode on local boards, or, alternatively, -/// on "cells" of a given size. +/// Efficiency is stored per cathode on local boards /// /// The main method of this class is IsTriggered(). /// -/// $ALICE_ROOT/MUON/data/TriggerChamberefficiencyCells.dat contains efficiency +/// $ALICE_ROOT/MUON/data/efficiencyCells.dat contains efficiency /// for each chamber (i.e. DetElement). /// /// In the case of local boards, efficiency is stored from left to right /// per increasing board number (from 1 to 234) /// -/// Otherwise, he efficiency cells goes from right to left and -/// from bottom to top of the chamber, namely, the efficiencies tabulated in the -/// file refers to the following reference frame: -/// -///
-/// x
-/// <----------------------------------|
-///                                    |
-///    ---------------------------     |
-///   | 0.97 | 0.97 | 0.97 | 0.97 |    |
-///    ---------------------------     |
-///   | 0.97 | 0.97 | 0.97 | 0.97 |    |
-///    ---------------------------     |
-///   | 0.97 | 0.97 | 0.97 | 0.97 |    |
-///    ---------------------------     |
-///                                    |
-///                                   \/ y
-/// 
-/// -/// In both cases, the file can be edited in order to change efficiency -/// in a chosen local board/region of the chamber. +/// The file can be edited in order to change efficiency +/// in a chosen local board/region of the chamber. /// /// /// But please note that this object is also available from the CDB -/// (generated using the MUONCDB.C macro) /// /// \author Diego Stocco; INFN Torino +//----------------------------------------------------------------------------- /// \cond CLASSIMP ClassImp(AliMUONTriggerEfficiencyCells) @@ -71,78 +77,129 @@ ClassImp(AliMUONTriggerEfficiencyCells) //__________________________________________________________________________ AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells() : -TObject() +TObject(), +fCountHistoList(0x0), +fNoCountHistoList(0x0), +fFiredStrips(0x0), +fDisplayHistoList(0x0), +fBoardLabelList(0x0), +fFiredFitHistoList(0x0), +fFiredDisplayHistoList(0x0) { /// Default constructor. + CheckConstants(); Reset(); + InitHistos(); } //__________________________________________________________________________ -AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(const char* filename) +AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(const Char_t* filename, const Char_t* listname) : -TObject() +TObject(), +fCountHistoList(0x0), +fNoCountHistoList(0x0), +fFiredStrips(0x0), +fDisplayHistoList(0x0), +fBoardLabelList(0x0), +fFiredFitHistoList(0x0), +fFiredDisplayHistoList(0x0) { /// Constructor using an ASCII file. + CheckConstants(); Reset(); - ReadFile(filename); + InitHistos(); + ReadFile(filename, listname); } //__________________________________________________________________________ -AliMUONTriggerEfficiencyCells::~AliMUONTriggerEfficiencyCells() +AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(TList *countHistoList, + TList *noCountHistoList) +: +TObject(), +fCountHistoList(countHistoList), +fNoCountHistoList(noCountHistoList), +fFiredStrips(0x0), +fDisplayHistoList(0x0), +fBoardLabelList(0x0), +fFiredFitHistoList(0x0), +fFiredDisplayHistoList(0x0) { -/// Destructor. Does nothing ;-) +/// Constructor using a list of histograms with counts. + CheckConstants(); + Reset(); + InitHistos(); + FillHistosFromList(); } - -//__________________________________________________________________________ -void AliMUONTriggerEfficiencyCells::GetCellEfficiency(Int_t detElemId, Float_t x, Float_t y, Float_t &eff1, Float_t &eff2) +//_____________________________________________________________________________ +AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(const AliMUONTriggerEfficiencyCells& other) +: +TObject(other), +fCountHistoList(other.fCountHistoList), +fNoCountHistoList(other.fNoCountHistoList), +fFiredStrips(other.fFiredStrips), +fDisplayHistoList(other.fDisplayHistoList), +fBoardLabelList(other.fBoardLabelList), +fFiredFitHistoList(other.fFiredFitHistoList), +fFiredDisplayHistoList(other.fFiredDisplayHistoList) { -/// Get the efficiencies of the 2 cathodes at a given location (x,y) +/// Copy constructor - Int_t chamber = FindChamberIndex(detElemId); - Int_t slat = FindSlatIndex(detElemId); - TArrayI cell = CellByCoord(detElemId,x,y); - eff1 = 0.0; - eff2 = 0.0; - if(cell.At(0)>=0 && cell.At(1)>=0) - { - eff1 = fCellContent[chamber][slat][0][cell.At(0)][cell.At(1)]; - eff2 = fCellContent[chamber][slat][1][cell.At(0)][cell.At(1)]; + for(Int_t chCath=0; chCathRndm()>eff1)trig1 = kFALSE; - if(gRandom->Rndm()>eff2)trig2 = kFALSE; + Int_t chamber = FindChamberIndex(detElemId); + Int_t bin = fBoardEfficiency[chamber]->FindBin(localBoard); + eff1 = fBoardEfficiency[chamber]->GetBinContent(bin); + eff2 = fBoardEfficiency[fgkNchambers+chamber]->GetBinContent(bin); } //__________________________________________________________________________ void -AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Int_t localBoard, Bool_t &trig1, Bool_t &trig2) +AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Int_t localBoard, Bool_t &trig1, Bool_t &trig2) const { /// Whether or not a given local board has a chance to trig, on each cathode. @@ -155,165 +212,662 @@ AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Int_t localBoard, Bo if(gRandom->Rndm()>eff2)trig2 = kFALSE; } -//__________________________________________________________________________ -TArrayI AliMUONTriggerEfficiencyCells::CellByCoord(Int_t detElemId, Float_t x, Float_t y) -{ -/// Get the efficiencies at a given location. - - Int_t chamber = FindChamberIndex(detElemId); - Int_t slat = FindSlatIndex(detElemId); - Int_t cell[2]={-1,-1}; - Float_t maxX = fCellSize[chamber][slat][0]*((Float_t)fCellNumber[chamber][slat][0]); - Float_t maxY = fCellSize[chamber][slat][1]*((Float_t)fCellNumber[chamber][slat][1]); - if(x>=0 & x=0 & yExpandPathName(filename); + if(fileName.EndsWith(".root")){ + ReadHistoBoards(fileName.Data(), listname); + return; + } + ifstream file(fileName.Data()); - char dat[50]; + Char_t dat[50]; if (file.good()){ file >> dat; if(!strcmp(dat,"localBoards"))ReadFileBoards(file); - else ReadFileXY(file); - file.close(); + else AliWarning("File .dat in wrong format"); + file.close(); } else { - AliWarning(Form("Can't read file %s",fileName.Data())); + AliError(Form("Can't read file %s",fileName.Data())); } } //__________________________________________________________________________ -void AliMUONTriggerEfficiencyCells::ReadFileXY(ifstream &file) +void AliMUONTriggerEfficiencyCells::ReadFileBoards(ifstream &file) { -/// Structure of file containing geometrical efficency - Int_t datInt=0, detEl=0, chamber=0, rpc=0; +/// Structure of file (.dat) containing local board efficency + Int_t datInt=0, detEl=0, chamber=0, chCath=0, bin=0; Float_t datFloat=0.0; - char dat[50]; + Char_t dat[50]; while (file >> dat) { file >> detEl; chamber = FindChamberIndex(detEl); - rpc = FindSlatIndex(detEl); - file >> dat; - for(Int_t i=0; i<2; i++){ - file >> datInt; - fCellNumber[chamber][rpc][i] = datInt; - file >> dat; - } - for(Int_t i=0; i<2; i++){ - file >> datFloat; - fCellSize[chamber][rpc][i] = datFloat; - if(i==0)file >> dat; - } - for(Int_t cath=0; cath<2; cath++){ - file >> dat; - file >> datInt; - for(Int_t iy=0; iy> datFloat; - fCellContent[chamber][rpc][cath][ix][iy] = datFloat; - } - } + for(Int_t cath=0; cath> dat; + file >> datInt; + for(Int_t board=1; board<=AliMpConstants::NofLocalBoards(); board++){ + file >> datFloat; + bin = fBoardEfficiency[chCath]->FindBin(board); + fBoardEfficiency[chCath]->SetBinContent(bin, datFloat); + } } } } + //__________________________________________________________________________ -void AliMUONTriggerEfficiencyCells::ReadFileBoards(ifstream &file) +void AliMUONTriggerEfficiencyCells::ReadHistoBoards(const Char_t *filename, const Char_t* listname) { -/// Structure of file containing local board efficency - Int_t datInt=0, detEl=0, chamber=0; - Float_t datFloat=0.0; - char dat[50]; +/// Structure of file (.root) containing local board efficency + TFile *file = new TFile(filename, "read"); + if(!file || !file->IsOpen()) { + AliError(Form("Can't read file %s",filename)); + return; + } - while (file >> dat) { - file >> detEl; - chamber = FindChamberIndex(detEl); - //rpc = FindSlatIndex(detEl); - for(Int_t cath=0; cath<2; cath++){ - file >> dat; - file >> datInt; - for(Int_t board=0; board> datFloat; - fBoardContent[chamber][cath][board] = datFloat; - } - } + TString histoName; + TString cathCode[fgkNcathodes] = {"bendPlane", "nonBendPlane"}; + enum {kAllChEff, kChNonEff, kNumOfHistoTypes}; + TString histoTypeName[2] = {"CountInCh", "NonCountInCh"}; + + if ( ! fCountHistoList ) { + fCountHistoList = new TList(); + fCountHistoList->SetOwner(); + } + else fCountHistoList->Delete(); + if( ! fNoCountHistoList) { + fNoCountHistoList = new TList(); + fNoCountHistoList->SetOwner(); + } + else fNoCountHistoList->Delete(); + + TList *currList[2] = {fCountHistoList, fNoCountHistoList}; + + TH1F *histo = 0x0; + + TList* listInFile = 0x0; + TString listNameString(listname); + if ( ! listNameString.IsNull() ) + listInFile = (TList*)file->Get(listname); + + for(Int_t cath=0; cathFindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data()); + histo->SetDirectory(0); + currList[hType]->Add(histo); + } + } + + for(Int_t cath=0; cathFindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data()); + histo->SetDirectory(0); + currList[hType]->Add(histo); + } + } } + + for(Int_t cath=0; cathFindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data()); + histo->SetDirectory(0); + currList[hType]->Add(histo); + } + } + } + + file->Close(); + + FillHistosFromList(); +} + + +//_____________________________________________________________________________ +void AliMUONTriggerEfficiencyCells::CheckConstants() const +{ +/// Check consistence of redefined constants + + assert(fgkNcathodes == AliMpConstants::NofCathodes()); + assert(fgkNchambers == AliMpConstants::NofTriggerChambers()); + assert(fgkNplanes == AliMpConstants::NofTriggerChambers() * fgkNcathodes); } + //__________________________________________________________________________ -Int_t AliMUONTriggerEfficiencyCells::FindChamberIndex(Int_t detElemId) +Int_t AliMUONTriggerEfficiencyCells::FindChamberIndex(Int_t detElemId) const { /// From detElemId to chamber number - Int_t offset = 100*(AliMUONConstants::NTrackingCh()+1); - Int_t chamber = (detElemId-offset)/100; + // Int_t iChamber = AliMpDEManager::GetChamberId(detElemId); + Int_t iChamber = detElemId/100 - 1; + Int_t chamber = iChamber-AliMpConstants::NofTrackingChambers(); return chamber; } //__________________________________________________________________________ -Int_t AliMUONTriggerEfficiencyCells::FindSlatIndex(Int_t detElemId) +void +AliMUONTriggerEfficiencyCells::Reset(Bool_t resetAll) { -/// From detElemId to slat index. +/// Sets our internal array contents to zero. - Int_t offset = 100*(AliMUONConstants::NTrackingCh()+1); - Int_t chamber = FindChamberIndex(detElemId); - Int_t slat = detElemId-offset-(chamber*100); - return slat; + if ( resetAll ){ + for(Int_t chCath=0; chCathGetEntries(); + + if ( useMeanValues ) + AliInfo("Boards filled with the average efficiency of the RPC"); + + for(Int_t iEntry=0; iEntryAt(iEntry); + histoDen = (TH1F*)fNoCountHistoList->At(iEntry); + + if(!histoNum) { + AliWarning("Histogram not found in fCountHistoList. Skip to next"); + continue; + } + if(!histoDen) { + AliWarning("Histogram not found in fNoCountHistoList. Skip to next"); + continue; + } + + histoName = histoNum->GetName(); + histoName.ToUpper(); + nHistoBins = histoNum->GetNbinsX(); + - for(Int_t chamber=0; chamber<4; chamber++) - { - for(Int_t slat=0; slat<18; slat++) - { - for(Int_t cath=0; cath<2; cath++) - { - fCellSize[chamber][slat][cath]=0.0; - fCellNumber[chamber][slat][cath]=0; - for(Int_t ix=0; ixGetBinContent(iBin), (Int_t)histoNum->GetBinContent(iBin) + (Int_t)histoDen->GetBinContent(iBin), efficiency, efficiencyError, kFALSE); + + currHisto->SetBinContent(iBin, efficiency); + currHisto->SetBinError(iBin, efficiencyError); + } + + if ( useMeanValues ){ + currHisto = fBoardEfficiency[chCath]; + Int_t nBinsBoards = currHisto->GetNbinsX(); + Int_t currChamber = currCh + AliMpConstants::NofTrackingChambers(); + for ( Int_t iBinBoard = 1; iBinBoard<= nBinsBoards; iBinBoard++){ + Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(iBinBoard, currChamber); + Int_t iBin = histoNum->FindBin(detElemId%100); + + CalculateEfficiency((Int_t)histoNum->GetBinContent(iBin), (Int_t)histoNum->GetBinContent(iBin) + (Int_t)histoDen->GetBinContent(iBin), efficiency, efficiencyError, kFALSE); + + currHisto->SetBinContent(iBinBoard, efficiency); + currHisto->SetBinError(iBinBoard, efficiencyError); + } } } } + +//_____________________________________________________________________________ +void AliMUONTriggerEfficiencyCells::CalculateEfficiency(Int_t trigger44, Int_t trigger34, + Float_t &efficiency, Float_t &error, + Bool_t failuresAsInput) +{ + // + /// Returns the efficiency. + // + + efficiency=-9.; + error=0.; + if(trigger34>0){ + efficiency=(Double_t)trigger44/((Double_t)trigger34); + if(failuresAsInput)efficiency=1.-(Double_t)trigger44/((Double_t)trigger34); + } + Double_t q = TMath::Abs(1-efficiency); + if(efficiency<0)error=0.0; + else error = TMath::Sqrt(efficiency*q/((Double_t)trigger34)); +} + + +//_____________________________________________________________________________ +void AliMUONTriggerEfficiencyCells::CheckFiredStrips() +{ + // + /// Check for fired strips participating to efficiency + /// calculation (when available). + /// Strips inside a local board should be quite homogeneously hit + /// If not, this could be a problem of electronics (i.e. ADULT board off). + // + + if(!fFiredStrips) { + AliWarning("List of fired pads not present. Check not performable."); + return; + } + + GetListsForCheck(); + + TString histoName; + + // Check fired pads (when available) + if(fFiredFitHistoList){ + TH1F *histo1D = 0x0; + TF1 *fitFunc = 0x0; + TCanvas *histoFiredCan[20]; + Int_t nEntries = fFiredFitHistoList->GetEntries(); + for(Int_t iEntry=0; iEntryAt(iEntry); + printf("Problems found in %s\n", histo1D->GetTitle()); + } + Int_t nPrintCan = nEntries; + if(nPrintCan>20) { + AliWarning("Too many boards with problems: only 20 will be shown"); + nPrintCan = 20; + } + for(Int_t iCan=0; iCanAt(iCan); + histoName = histo1D->GetName(); + histoName.Append("Can"); + histoFiredCan[iCan] = new TCanvas(histoName.Data(), histoName.Data(), 100+10*iCan, 10*iCan, 700, 700); + histoFiredCan[iCan]->SetRightMargin(0.14); + histoFiredCan[iCan]->SetLeftMargin(0.12); + histo1D->Draw("E"); + fitFunc = histo1D->GetFunction("pol0"); + fitFunc->SetLineColor(2); + fitFunc->Draw("same"); + } + if(nEntries==0){ + printf("\nAll local boards seem ok!!\n\n"); + } + } +} + + +//_____________________________________________________________________________ +void AliMUONTriggerEfficiencyCells::DisplayEfficiency(Bool_t perSlat) +{ + // + /// Display calculated efficiency. + // + + Bool_t isInitSlat = kFALSE, isInitBoard = kFALSE; + for(Int_t chCath=0; chCathGetEntries()>0) isInitBoard = kTRUE; + if(fSlatEfficiency[chCath]->GetEntries()>0) isInitSlat = kTRUE; + } + + if(!isInitBoard){ + AliWarning("Trigger efficiency not initialized per board.\nDisplay not yet implemented."); + return; + } + if(!isInitSlat && perSlat){ + AliWarning("Trigger efficiency not initialized for slat.\nPlease try option kFALSE."); + return; + } + if ( !AliCDBManager::Instance()->GetDefaultStorage() ){ + AliWarning("Please set default CDB storage (needed for mapping)."); + return; + } + if ( AliCDBManager::Instance()->GetRun() < 0 ){ + AliWarning("Please set CDB run number (needed for mapping)."); + return; + } + + GetListsForCheck(); + + //const Int_t kNumOfBoards = AliMpConstants::NofLocalBoards(); + + TH2F *histo = 0x0; + TString histoName, histoTitle; + + // Plot fired strips (when available) + if(fFiredDisplayHistoList){ + TCanvas *displayFiredCan[fgkNplanes]; + for(Int_t chCath=0; chCathAt(chCath); + histoName = Form("%sCan", histo->GetName()); + histoTitle = Form("%s", histo->GetTitle()); + displayFiredCan[chCath] = new TCanvas(histoName.Data(), histoTitle.Data(), 100+10*chCath, 10*chCath, 700, 700); + displayFiredCan[chCath]->SetRightMargin(0.14); + displayFiredCan[chCath]->SetLeftMargin(0.12); + histo->GetYaxis()->SetTitleOffset(1.4); + histo->SetStats(kFALSE); + histo->Draw("COLZ"); + } + } + + // Plot efficiency + if(fDisplayHistoList){ + TCanvas *can[fgkNplanes]; + for(Int_t chCath=0; chCathAt(currChCath); + histoName = Form("%sCan", histo->GetName()); + histoTitle = Form("%s", histo->GetTitle()); + can[chCath] = new TCanvas(histoName.Data(), histoTitle.Data(), 100+10*chCath, 10*chCath, 700, 700); + can[chCath]->SetRightMargin(0.14); + can[chCath]->SetLeftMargin(0.12); + histo->GetZaxis()->SetRangeUser(0.,1.); + histo->GetYaxis()->SetTitleOffset(1.4); + histo->SetStats(kFALSE); + histo->Draw("COLZ"); + if(perSlat==kTRUE) continue; + histo = (TH2F*)fBoardLabelList->At(currChCath); + histo->Draw("textsame"); + } + } +} + + +//__________________________________________________________________________ +Bool_t AliMUONTriggerEfficiencyCells::GetListsForCheck() +{ + // + /// Getting histograms for efficiency, + /// map of fired strips entering efficiency calculations, + /// fits for checking switched-off elements in chambers. + // + const Float_t kChi2RedMax = 1.5; + const Float_t kDummyFired = 1e-5; + + Reset(kFALSE); + + fDisplayHistoList = new TList(); + fDisplayHistoList->SetOwner(); + fBoardLabelList = new TList(); + fBoardLabelList->SetOwner(); + if ( fFiredStrips ){ + fFiredFitHistoList = new TList(); + fFiredFitHistoList->SetOwner(); + fFiredDisplayHistoList = new TList(); + fFiredDisplayHistoList->SetOwner(); + } + + TH3F* padFired = 0x0; + TH2F* displayHisto = 0x0; + TH1F* histoFired[fgkNplanes][234]; + TF1* fitFunc = 0x0; + Bool_t isStripOffInBoard[fgkNplanes][234]; + Int_t bin=0; + TString histoName, histoTitle; + TString cathName[fgkNcathodes] = {"bendPlane", "nonBendPlane"}; + + AliMUONTriggerDisplay triggerDisplay; + // Book histos + for(Int_t iCath=0; iCathAt(iCath); + for(Int_t iCh=0; iChAdd(displayHisto); + + histoName = Form("labels%sChamber%i", cathName[iCath].Data(), currCh); + displayHisto = + (TH2F*)triggerDisplay.GetBoardNumberHisto(histoName,currCh); + fBoardLabelList->Add(displayHisto); + + if(!fFiredStrips) continue; + histoName = Form("firedPads%sChamber%i", cathName[iCath].Data(), currCh); + histoTitle = Form("Chamber %i: Fired pads %s", currCh, cathName[iCath].Data()); + bin = padFired->GetXaxis()->FindBin(currCh); + padFired->GetXaxis()->SetRange(bin,bin); + displayHisto = + (TH2F*)triggerDisplay.GetDisplayHistogram(padFired->Project3D("zy"),histoName, + AliMUONTriggerDisplay::kDisplayStrips, + iCath,currCh,histoTitle); + fFiredDisplayHistoList->Add(displayHisto); + + for(Int_t ib=0; ibSetXTitle("board"); + isStripOffInBoard[chCath][ib] = kFALSE; + } // loop on board + } // loop on chamber + } // loop on cathode + + for(Int_t iCath=0; iCathAdd(displayHisto); + } + } + + if(!fFiredStrips) return kTRUE; + + AliMpCDB::LoadDDLStore(); + + // Check fired pads (when available) + for(Int_t iLoc = 0; iLoc < AliMpConstants::NofLocalBoards(); iLoc++) { + Int_t iBoard = iLoc+1; + for(Int_t iCh=0; iChGetDEfromLocalBoard(iBoard, iChamber); + + if (!detElemId) continue; + + AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(iBoard, kFALSE); + + // skip copy cards + if( !localBoard->IsNotified()) + continue; + + for(Int_t iCath=0; iCathGetMpSegmentation(detElemId, AliMp::GetCathodType(iCath)); + Int_t nStrips=0; + for (Int_t iStrip = 0; iStrip < 16; ++iStrip) { + AliMpPad pad = seg->PadByLocation(iBoard,iStrip,kFALSE); + if (!pad.IsValid()) continue; + nStrips++; + padFired = (TH3F*)fFiredStrips->At(iCath); + Float_t nFired = padFired->GetBinContent(11+iCh, iBoard, iStrip); + if(nFired==0.) nFired = kDummyFired; + histoFired[chCath][iLoc]->Fill(iStrip, nFired); + } + + histoFired[chCath][iLoc]->Fit("pol0","Q0R","",0., (Float_t)nStrips-1.); + fitFunc = histoFired[chCath][iLoc]->GetFunction("pol0"); + Float_t chi2 = fitFunc->GetChisquare(); + Float_t ndf = (Float_t)fitFunc->GetNDF(); + Float_t reducedChi2 = chi2/ndf; + if(reducedChi2>kChi2RedMax) { + isStripOffInBoard[chCath][iLoc] = kTRUE; + fFiredFitHistoList->Add(histoFired[chCath][iLoc]); + } + } // loop on cathodes + } // loop on chambers + } // loop on local boards + + return kTRUE; +} + +//__________________________________________________________________________ +Bool_t AliMUONTriggerEfficiencyCells::SumRunEfficiency(const AliMUONTriggerEfficiencyCells &other) +{ +/// Sums results from different runs and gives the efficiency + if(!fCountHistoList || !fNoCountHistoList) { + AliWarning("Histograms for efficiency calculations not implemented in object"); + return kFALSE; + } + if(!other.fCountHistoList || !other.fNoCountHistoList) { + AliWarning("Histograms for efficiency calculations not implemented in object passed as argument"); + return kFALSE; + } + + Int_t nentries = fCountHistoList->GetEntries(); + TH1F *currNum = 0x0, *currDen = 0x0, *otherNum = 0x0, *otherDen = 0x0; + + for(Int_t iEntry=0; iEntryAt(iEntry); + currDen = (TH1F*)fNoCountHistoList->At(iEntry); + otherNum = (TH1F*)other.fCountHistoList->At(iEntry); + otherDen = (TH1F*)other.fNoCountHistoList->At(iEntry); + currNum->Add(otherNum); + currDen->Add(otherDen); + } + + FillHistosFromList(); + + if(!fFiredStrips) { + AliWarning("Histograms for fired region check not implemented in object"); + return kFALSE; + } + if(!other.fFiredStrips) { + AliWarning("Histograms for fired region check not implemented in object passed as argument"); + return kFALSE; + } + + TH3F *currFired = 0x0, *otherFired = 0x0; + nentries = fFiredStrips->GetEntries(); + for(Int_t iEntry=0; iEntryAt(iEntry); + otherFired = (TH3F*)fFiredStrips->At(iEntry); + currFired->Add(otherFired); + } + + return kTRUE; +} + + +//__________________________________________________________________________ +Bool_t AliMUONTriggerEfficiencyCells::LowStatisticsSettings(Bool_t useMeanValues) +{ + // + /// In case of low statistics, fill the local board efficiency with + /// the average value of the RPC + // + + if ( ! fCountHistoList ){ + AliWarning("Cannot find histograms for RPC efficiency calculation. Nothing done!"); + return kFALSE; + } + if ( !AliCDBManager::Instance()->GetDefaultStorage() ){ + AliWarning("Please set default CDB storage (needed for mapping)."); + return kFALSE; + } + if ( AliCDBManager::Instance()->GetRun() < 0 ){ + AliWarning("Please set CDB run number (needed for mapping)."); + return kFALSE; + } + + AliMpCDB::LoadDDLStore(); + + for(Int_t chCath=0; chCathReset(); + fSlatEfficiency[chCath]->Reset(); + } + + FillHistosFromList(useMeanValues); + + return kTRUE; +}