-
-//_____________________________________________________________________________
-void AliMUONTriggerEfficiencyCells::DisplayEfficiency(Bool_t perSlat)
-{
- //
- /// Display calculated efficiency.
- //
-
- Bool_t isInitSlat = kFALSE, isInitBoard = kFALSE;
- for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
- if(fBoardEfficiency[chCath]->GetEntries()>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; chCath<fgkNplanes; chCath++){
- histo = (TH2F*)fFiredDisplayHistoList->At(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; chCath<fgkNplanes; chCath++){
- Int_t currChCath = chCath;
- if(perSlat==kTRUE) currChCath += fgkNplanes;
- histo = (TH2F*)fDisplayHistoList->At(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; iCath<fgkNcathodes; iCath++){
- if(fFiredStrips) padFired = (TH3F*)fFiredStrips->At(iCath);
- for(Int_t iCh=0; iCh<fgkNchambers; iCh++){
- Int_t chCath = GetPlane(iCh, iCath);
- Int_t currCh = 11 + iCh;
- histoName = Form("%sChamber%i", cathName[iCath].Data(), currCh);
- histoTitle = Form("Chamber %i: efficiency %s", currCh, cathName[iCath].Data());
- displayHisto =
- (TH2F*)triggerDisplay.GetDisplayHistogram(fBoardEfficiency[chCath], histoName,
- AliMUONTriggerDisplay::kDisplayBoards,
- iCath,currCh,histoTitle,
- AliMUONTriggerDisplay::kShowZeroes);
- fDisplayHistoList->Add(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; ib<AliMpConstants::NofLocalBoards(); ib++){
- histoName = Form("%sChamber%iBoard%i", cathName[iCath].Data(), currCh, ib+1);
- histoTitle = Form("Chamber %i: fired pads %s board = %i", currCh, cathName[iCath].Data(), ib+1);
- histoFired[chCath][ib] = new TH1F(histoName.Data(), histoTitle.Data(), 16, -0.5, 15.5);
- histoFired[chCath][ib]->SetXTitle("board");
- isStripOffInBoard[chCath][ib] = kFALSE;
- } // loop on board
- } // loop on chamber
- } // loop on cathode
-
- for(Int_t iCath=0; iCath<fgkNcathodes; iCath++){
- for(Int_t iCh=0; iCh<fgkNchambers; iCh++){
- Int_t chCath = GetPlane(iCh, iCath);
- Int_t currCh = 11+iCh;
- histoName = Form("%sChamber%iSlatEff", cathName[iCath].Data(), currCh);
- histoTitle = Form("Chamber %i: efficiency %s per slat", currCh, cathName[iCath].Data());
- displayHisto =
- (TH2F*)triggerDisplay.GetDisplayHistogram(fSlatEfficiency[chCath], histoName,
- AliMUONTriggerDisplay::kDisplaySlats,
- iCath,currCh,histoTitle);
- fDisplayHistoList->Add(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; iCh<AliMpConstants::NofChambers(); iCh++){
- Int_t iChamber = iCh + AliMpConstants::NofTrackingChambers();
-
- Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(iBoard, iChamber);
-
- if (!detElemId) continue;
-
- AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(iBoard, kFALSE);
-
- // skip copy cards
- if( !localBoard->IsNotified())
- continue;
-
- for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
- Int_t chCath = GetPlane(iCh, iCath);
- // loop over strips
- const AliMpVSegmentation* seg =
- AliMpSegmentation::Instance()->GetMpSegmentation(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; iEntry<nentries; iEntry++){
- currNum = (TH1F*)fCountHistoList->At(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; iEntry<nentries; iEntry++){
- currFired = (TH3F*)fFiredStrips->At(iEntry);
- otherFired = (TH3F*)fFiredStrips->At(iEntry);
- currFired->Add(otherFired);
- }
-
- return kTRUE;
-}
-
-