X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONTriggerQADataMakerRec.cxx;h=ae4bd54b6b2184a67f9bdddf0e89eb29a6ec7160;hb=caf422117783b5268fdfbf3771328c114e5837a8;hp=a0ebefacdc5d7e30dd0060f3eeefd59265db4917;hpb=ece56eb9d38b9746b84b76e9eaf5c4507f2961e4;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONTriggerQADataMakerRec.cxx b/MUON/AliMUONTriggerQADataMakerRec.cxx index a0ebefacdc5..ae4bd54b6b2 100644 --- a/MUON/AliMUONTriggerQADataMakerRec.cxx +++ b/MUON/AliMUONTriggerQADataMakerRec.cxx @@ -23,7 +23,7 @@ /// /// MUON class for quality assurance data (histo) maker /// -/// \author C. Finck, D. Stocco, L. Aphecetche +/// \author C. Finck, D. Stocco, L. Aphecetche, A. Blanc /// \cond CLASSIMP ClassImp(AliMUONTriggerQADataMakerRec) @@ -34,6 +34,7 @@ ClassImp(AliMUONTriggerQADataMakerRec) #include "AliMpConstants.h" #include "AliMUONTriggerDisplay.h" #include "TH2.h" +#include "TH1F.h" #include "TString.h" #include "AliRecoParam.h" #include "AliMUONDigitStoreV2R.h" @@ -57,15 +58,32 @@ ClassImp(AliMUONTriggerQADataMakerRec) #include "AliCDBManager.h" #include "TTree.h" #include "AliMUONGlobalTriggerBoard.h" +#include "AliMUONGlobalTrigger.h" #include "AliMUONGlobalCrateConfig.h" +#include "AliMUONQAIndices.h" +#include "AliMpPad.h" +#include "AliMpVSegmentation.h" +#include "AliMpSegmentation.h" +#include "AliMUONTriggerUtilities.h" +namespace +{ + Double_t ProtectedSqrt(Double_t x) + { + return ( x > 0.0 ? TMath::Sqrt(x) : 0.0 ); + } +} //____________________________________________________________________________ AliMUONTriggerQADataMakerRec::AliMUONTriggerQADataMakerRec(AliQADataMakerRec* master) : AliMUONVQADataMakerRec(master), fDigitMaker(new AliMUONDigitMaker(kFALSE)), -fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun())), -fTriggerProcessor(new AliMUONTriggerElectronics(fCalibrationData)), -fDigitStore(0x0) +fCalibrationData(0x0), +fTriggerProcessor(0x0), +fDigitStore(0x0), +fDigitStoreFromRaw(0x0), +fTriggerStoreFromRaw(0x0), +fTriggerStoreReprocessRaw(0x0), +fTriggerUtils(0x0) { /// ctor } @@ -76,9 +94,13 @@ AliMUONTriggerQADataMakerRec::~AliMUONTriggerQADataMakerRec() { /// dtor delete fDigitMaker; - delete fDigitStore; delete fTriggerProcessor; delete fCalibrationData; + delete fDigitStore; + delete fDigitStoreFromRaw; + delete fTriggerStoreFromRaw; + delete fTriggerStoreReprocessRaw; + delete fTriggerUtils; } //____________________________________________________________________________ @@ -91,7 +113,6 @@ void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleESDs(Int_t /*specie*/, TObj void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t /*specie*/, TObjArray** /*list*/) { /// Normalize RecPoints histograms - } @@ -99,32 +120,97 @@ void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t /*specie*/, void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRaws(Int_t /*specie*/, TObjArray** /*list*/) { /// create Raws histograms in Raws subdir - - // Normalize RawData histos - Float_t nbevent = GetRawsData(kRawNAnalyzedEvents)->GetBinContent(1); + Int_t histoRawsIndex[] = { - kTriggerError, - kTriggerCalibSummary, - kTriggerReadOutErrors, - kTriggerGlobalOutput + AliMUONQAIndices::kTriggerErrorSummary, + AliMUONQAIndices::kTriggerCalibSummary, + AliMUONQAIndices::kTriggerReadOutErrors, + AliMUONQAIndices::kTriggerGlobalOutput }; + Int_t histoRawsScaledIndex[] = { + AliMUONQAIndices::kTriggerErrorSummaryNorm, + AliMUONQAIndices::kTriggerCalibSummaryNorm, + AliMUONQAIndices::kTriggerReadOutErrorsNorm, + AliMUONQAIndices::kTriggerGlobalOutputNorm + }; + const Int_t kNrawsHistos = sizeof(histoRawsIndex)/sizeof(histoRawsIndex[0]); Float_t scaleFactor[kNrawsHistos] = {100., 100., 100., 1.}; - for(Int_t ihisto=0; ihisto 0 ){ - currHisto->Scale(scaleFactor[ihisto]/nbevent); + + for ( Int_t itc=-1; itcGetBinContent(1) : histo1D->GetBinContent(2); + TH1* inputHisto = GetRawsData(histoRawsIndex[ihisto],itc); + TH1* scaledHisto = GetRawsData(histoRawsScaledIndex[ihisto],itc); + // Check here for both since we do not clone Calib-only histograms + if ( scaledHisto && inputHisto && nbevent > 0 ) { + scaledHisto->Reset(); + scaledHisto->Add(inputHisto); + scaledHisto->Scale(scaleFactor[ihisto]/nbevent); + } + } // loop on histos + + + // The following histograms are surely there + // if the histogram with analyzed events is there: + // test on the existence of each histogram is not necessary + TH1* hYCopy = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy,itc); //number of YCopy error per board + TH1* hYCopyTests = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest,itc); //contains the number of YCopy test per board + TH1* hYCopyNorm = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyNorm,itc); + hYCopyNorm->Reset(); + hYCopyNorm->Divide(hYCopy, hYCopyTests, 100., 1.); + + Float_t mean = hYCopyNorm->Integral(); + + TH1* hSummary = GetRawsData(AliMUONQAIndices::kTriggerErrorSummaryNorm,itc); + hSummary->SetBinContent(AliMUONQAIndices::kAlgoLocalYCopy+1,mean/192.); //put the mean of the % of YCopy error in the kTriggerError's corresponding bin + + TH1F* hTriggerRatio = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434,itc); + if ( hTriggerRatio ){ + hTriggerRatio->Divide(((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,itc)),((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,itc))); + + FillRatio4434Histos(1,itc,kTRUE); + + //reset bins temporary used to store informations + ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetBinContent(0,0); + Int_t nbins = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->GetNbinsX(); + ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetBinContent(nbins+1,0); + + ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434,itc))->SetMaximum(1.1); + ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetMaximum(1.1); + ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc))->SetMaximum(1.1); } - } + + if ( GetRawsData(AliMUONQAIndices::kTriggerGlobalScalersNorm,itc) ) { + TH1* inputHisto = GetRawsData(AliMUONQAIndices::kTriggerGlobalScalers,itc); + TH1* scaledHisto = GetRawsData(AliMUONQAIndices::kTriggerGlobalScalersNorm,itc); + scaledHisto->Reset(); + scaledHisto->Add(inputHisto); + Float_t scaleValue = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime,itc))->GetBinContent(1); + if ( scaleValue > 0. ) scaledHisto->Scale(1./scaleValue); + } + } // loop on trigger classes } //____________________________________________________________________________ void AliMUONTriggerQADataMakerRec::InitRaws() { /// create Raws histograms in Raws subdir - - AliCodeTimerAuto("",0); + // RS: Since there is no sense in cloning trigger scalers per trigger, I am (for the moment) forbidding their cloning + + AliCodeTimerAuto("",0); + const Bool_t expert = kTRUE ; const Bool_t saveCorr = kTRUE ; const Bool_t image = kTRUE ; @@ -139,7 +225,13 @@ void AliMUONTriggerQADataMakerRec::InitRaws() AliMUONTriggerDisplay triggerDisplay; TString histoName, histoTitle; - if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) { + if ( CurrentEventSpecie() == AliRecoParam::kCalib ) { + histo1D = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5); + histo1D->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event."); + histo1D->GetYaxis()->SetTitle("Cumulated scaler time (s)"); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerScalersTime, expert, !image, !saveCorr); + ForbidCloning(histo1D); // RS + for(Int_t iCath=0; iCathGetXaxis()->SetTitle(boardName.Data()); histo2D->GetYaxis()->SetTitle("Strip"); histo2D->SetOption("COLZ"); - Add2RawsList(histo2D, kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr); + Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr); + ForbidCloning(histo2D); // RS } // loop on chambers } // loop on cathodes @@ -163,152 +256,248 @@ void AliMUONTriggerQADataMakerRec::InitRaws() histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, histoTitle); histo2D->SetOption("COLZ"); - Add2RawsList(histo2D, kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr); + Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr); + ForbidCloning(histo2D); // RS } // loop on chambers - } // loop on cathodes - - histo1D = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5); - histo1D->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event."); - histo1D->GetYaxis()->SetTitle("Cumulated scaler time (s)"); - Add2RawsList(histo1D, kTriggerScalersTime, expert, !image, !saveCorr); + } // loop on cathodes - TString axisLabel[kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", "#splitline{Noisy}{Strips}"}; + //TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", "#splitline{Noisy}{Strips}"}; + TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", ""}; // Change for nosiy strips - histo1D = new TH1F("hTriggerCalibSummary", "MTR calibration sumamry", kNtrigCalibSummaryBins, -0.5, (Float_t)kNtrigCalibSummaryBins - 0.5); - for (Int_t ibin=1; ibin<=kNtrigCalibSummaryBins; ibin++){ - histo1D->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].Data()); + TH1F* histoCalib = new TH1F("hTriggerCalibSummaryAll", "MTR calibration summary counts", AliMUONQAIndices::kNtrigCalibSummaryBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigCalibSummaryBins - 0.5); + for (Int_t ibin=1; ibin<=AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){ + histoCalib->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].Data()); } - histo1D->GetYaxis()->SetTitle("Percentage per event (%)"); - histo1D->SetOption("bar2"); - histo1D->SetStats(kFALSE); - histo1D->SetFillColor(kRed); - Add2RawsList(histo1D, kTriggerCalibSummary, !expert, image, !saveCorr); - } // Calibration reco param + histoCalib->SetFillColor(kBlue); + histoCalib->GetYaxis()->SetTitle("Counts"); + // Copy of previous histo for scaling purposes + TH1F* histoCalibNorm = (TH1F*)histoCalib->Clone("hTriggerCalibSummary"); + histoCalibNorm->SetTitle("MTR calibration summary"); + histoCalibNorm->SetOption("bartext0"); + histoCalibNorm->GetYaxis()->SetTitle("Percentage per event (%)"); + // Adding both histos after cloning to avoid problems with the expert bit + Add2RawsList(histoCalib, AliMUONQAIndices::kTriggerCalibSummary, expert, !image, !saveCorr); + ForbidCloning(histoCalib); // RS + + Add2RawsList(histoCalibNorm, AliMUONQAIndices::kTriggerCalibSummaryNorm, !expert, image, !saveCorr); + ForbidCloning(histoCalibNorm); // RS - histo1D = new TH1F("hTriggeredBoards", "Triggered boards", nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5); - Add2RawsList(histo1D, kTriggeredBoards, expert, !image, !saveCorr); - - histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards, - 0, 0, "Local board triggers / event"); - histo2D->SetOption("COLZ"); - Add2RawsList(histo2D, kTriggerBoardsDisplay, expert, !image, !saveCorr); + } // Calibration reco param - Char_t *globalXaxisName[6] = {"US HPt", "US LPt", "LS HPt", "LS LPt", "SGL HPt", "SGL LPt"}; - Char_t *allLevelXaxisName[kNtrigAlgoErrorBins] = {"Local algo X", "Local algo Y", "Local LUT","Local Y Copy" , "Local2Regional", "Regional", "Regional2Global", "GlobalFromInGlobal", "GlobalFromInLocal", "GlobalFromOutLocal"}; - Char_t *readoutErrNames[kNtrigStructErrorBins]={"Local","Regional","Global","DARC"}; + const char *globalXaxisName[6] = {"US HPt", "US LPt", "LS HPt", "LS LPt", "SGL HPt", "SGL LPt"}; + const char *allLevelXaxisName[AliMUONQAIndices::kNtrigAlgoErrorBins] = {"Local algo X", "Local algo Y", "Local LUT","Local Y Copy" , "Local2Regional", "Regional", "Regional2Global", "GlobalFromInGlobal", "GlobalFromInLocal", "GlobalFromOutLocal"}; + const char *readoutErrNames[AliMUONQAIndices::kNtrigStructErrorBins]={"Local","Regional","Global","DARC"}; TString errorAxisTitle = "Number of errors"; - TH1F* h11 = new TH1F("ErrorLocalXPos", "ErrorLocalXPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h11->GetXaxis()->SetTitle(boardName.Data()); - h11->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h11, kTriggerErrorLocalXPos, expert, !image, !saveCorr); - - TH1F* h12 = new TH1F("ErrorLocalYPos", "ErrorLocalYPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h12->GetXaxis()->SetTitle(boardName.Data()); - h12->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h12, kTriggerErrorLocalYPos, expert, !image, !saveCorr); - - TH1F* h13 = new TH1F("ErrorLocalDev", "ErrorLocalDev",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h13->GetXaxis()->SetTitle(boardName.Data()); - h13->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h13, kTriggerErrorLocalDev, expert, !image, !saveCorr); - - TH1F* h14 = new TH1F("ErrorLocalTriggerDec", "ErrorLocalTriggerDec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h14->GetXaxis()->SetTitle(boardName.Data()); - h14->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h14, kTriggerErrorLocalTriggerDec, expert, !image, !saveCorr); - - TH1F* h15 = new TH1F("ErrorLocalLPtLSB", "ErrorLocalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h15->GetXaxis()->SetTitle(boardName.Data()); - h15->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h15, kTriggerErrorLocalLPtLSB, expert, !image, !saveCorr); - - TH1F* h16 = new TH1F("ErrorLocalLPtMSB", "ErrorLocalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h16->GetXaxis()->SetTitle(boardName.Data()); - h16->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h16, kTriggerErrorLocalLPtMSB, expert, !image, !saveCorr); - - TH1F* h17 = new TH1F("ErrorLocalHPtLSB", "ErrorLocalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h17->GetXaxis()->SetTitle(boardName.Data()); - h17->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h17, kTriggerErrorLocalHPtLSB, expert, !image, !saveCorr); - - TH1F* h18 = new TH1F("ErrorLocalHPtMSB", "ErrorLocalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h18->GetXaxis()->SetTitle(boardName.Data()); - h18->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h18, kTriggerErrorLocalHPtMSB, expert, !image, !saveCorr); - - TH1F* h19 = new TH1F("ErrorLocal2RegionalLPtLSB", "ErrorLocal2RegionalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h19->GetXaxis()->SetTitle(boardName.Data()); - h19->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h19, kTriggerErrorLocal2RegionalLPtLSB, expert, !image, !saveCorr); - - TH1F* h20 = new TH1F("ErrorLocal2RegionalLPtMSB", "ErrorLocal2RegionalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h20->GetXaxis()->SetTitle(boardName.Data()); - h20->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h20, kTriggerErrorLocal2RegionalLPtMSB, expert, !image, !saveCorr); - - TH1F* h21 = new TH1F("ErrorLocal2RegionalHPtLSB", "ErrorLocal2RegionalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h21->GetXaxis()->SetTitle(boardName.Data()); - h21->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h21, kTriggerErrorLocal2RegionalHPtLSB, expert, !image, !saveCorr); - - TH1F* h22 = new TH1F("ErrorLocal2RegionalHPtMSB", "ErrorLocal2RegionalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h22->GetXaxis()->SetTitle(boardName.Data()); - h22->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h22, kTriggerErrorLocal2RegionalHPtMSB, expert, !image, !saveCorr); - - TH1F* h23 = new TH1F("ErrorOutGlobalFromInGlobal", "ErrorOutGlobalFromInGlobal",6,-0.5,6-0.5); - h23->GetYaxis()->SetTitle(errorAxisTitle.Data()); - for (int ibin=0;ibin<6;ibin++){ - h23->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]); + histo1D = new TH1F("hTriggerErrorLocalXPos", "ErrorLocalXPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalXPos, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocalYPos", "ErrorLocalYPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalYPos, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocalDev", "ErrorLocalDev",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalDev, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocalTriggerDec", "ErrorLocalTriggerDec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTriggerDec, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocalLPtLSB", "ErrorLocalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtLSB, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocalLPtMSB", "ErrorLocalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtMSB, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocalHPtLSB", "ErrorLocalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtLSB, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocalHPtMSB", "ErrorLocalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtMSB, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocalTrigY", "ErrorLocalTrigY",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTrigY, expert, !image, !saveCorr); + + if ( CurrentEventSpecie() != AliRecoParam::kCalib ) { + histo1D = new TH1F("hTriggerRatio4434Local", "Ratio4434Local",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle("ratio 44/34"); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerLocalRatio4434, expert, !image, !saveCorr); + histo1D = new TH1F("hTriggerRatio4434AllEvents", "Ratio4434AllEvents",1,0,1); + histo1D->GetXaxis()->SetTitle("Event number"); + histo1D->GetYaxis()->SetTitle("ratio 44/34"); + histo1D->SetLineColor(4); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434AllEvents, expert, !image, !saveCorr); + histo1D = new TH1F("hTriggerRatio4434SinceLastUpdate", "Ratio4434SinceLastUpdate",1,0,1); + histo1D->GetXaxis()->SetTitle("Event number"); + histo1D->GetYaxis()->SetTitle("ratio 44/34"); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate, expert, !image, !saveCorr); } - Add2RawsList(h23, kTriggerErrorOutGlobalFromInGlobal, expert, !image, !saveCorr); - TH1F* h24 = new TH1F("hTriggerAlgoErrors", "Trigger Algorithm errors",kNtrigAlgoErrorBins,-0.5,(Float_t)kNtrigAlgoErrorBins-0.5); - h24->GetYaxis()->SetTitle("% of error"); - h24->SetOption("bar2"); - for (int ibin=0;ibinGetXaxis()->SetBinLabel(ibin+1,allLevelXaxisName[ibin]); + histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtLSB", "ErrorLocal2RegionalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtLSB, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtMSB", "ErrorLocal2RegionalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtMSB, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtLSB", "ErrorLocal2RegionalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtLSB, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtMSB", "ErrorLocal2RegionalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtMSB, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorOutGlobalFromInGlobal", "ErrorOutGlobalFromInGlobal",6,-0.5,6-0.5); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + for (int ibin=0;ibin<6;ibin++){ + histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]); } - h24->SetFillColor(2); - Add2RawsList(h24, kTriggerError, !expert, image, !saveCorr); - - TH1F* h25 = new TH1F("ErrorLocalTrigY", "ErrorLocalTrigY",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h25->GetXaxis()->SetTitle(boardName.Data()); - h25->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h25, kTriggerErrorLocalTrigY, expert, !image, !saveCorr); - - TH1F* h26 = new TH1F("ErrorLocalYCopy", "ErrorLocalYCopy",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); - h26->GetXaxis()->SetTitle(boardName.Data()); - h26->GetYaxis()->SetTitle(errorAxisTitle.Data()); - Add2RawsList(h26, kTriggerErrorLocalYCopy, expert, !image, !saveCorr); - - TH1F* h27 = new TH1F("hRawNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5); - Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie()); - h27->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex)); - h27->GetYaxis()->SetTitle("Number of analyzed events"); - Add2RawsList(h27, kRawNAnalyzedEvents, expert, !image, !saveCorr); - - TH1F* h28 = new TH1F("hTriggerReadoutErrors","Trigger Read-Out errors", kNtrigStructErrorBins, -0.5, (Float_t)kNtrigStructErrorBins-0.5); - h28->SetOption("bar2"); - h28->GetYaxis()->SetTitle("% of errors"); - for (int ibin=0;ibinGetXaxis()->SetBinLabel(ibin+1,readoutErrNames[ibin]); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerErrorOutGlobalFromInLocal", "ErrorOutGlobalFromInLocal",6,-0.5,6-0.5); + histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data()); + for (int ibin=0;ibin<6;ibin++){ + histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]); } - h28->SetFillColor(2); - Add2RawsList(h28, kTriggerReadOutErrors, !expert, image, !saveCorr); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal, expert, !image, !saveCorr); - TH1F* h29 = new TH1F("hTriggerGlobalOutMultiplicity","Trigger global outputs multiplicity", 6, -0.5, 6.-0.5); - h29->SetOption("bar2"); - h29->GetYaxis()->SetTitle("Number of triggers per event"); - h29->GetXaxis()->SetTitle("Global output"); + TH1F* histoAlgoErr = new TH1F("hTriggerAlgoNumOfErrors", "Trigger Algorithm total errors",AliMUONQAIndices::kNtrigAlgoErrorBins,-0.5,(Float_t)AliMUONQAIndices::kNtrigAlgoErrorBins-0.5); + histoAlgoErr->GetYaxis()->SetTitle("Number of events with errors"); + for (int ibin=0;ibinGetXaxis()->SetBinLabel(ibin+1,allLevelXaxisName[ibin]); + } + histoAlgoErr->SetFillColor(kBlue); + // Copy of previous histo for scaling purposes + TH1F* histoAlgoErrNorm = (TH1F*)histoAlgoErr->Clone("hTriggerAlgoErrors"); + histoAlgoErrNorm->SetOption("bartext0"); + histoAlgoErrNorm->SetTitle("Trigger algorithm errors"); + histoAlgoErrNorm->GetYaxis()->SetTitle("% of events with errors"); + // Adding both histos after cloning to avoid problems with the expert bit + Add2RawsList(histoAlgoErr, AliMUONQAIndices::kTriggerErrorSummary, expert, !image, !saveCorr); + Add2RawsList(histoAlgoErrNorm, AliMUONQAIndices::kTriggerErrorSummaryNorm, !expert, image, !saveCorr); + + histo1D = new TH1F("hTriggerTriggeredBoards", "Triggered boards", nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggeredBoards, expert, !image, !saveCorr); + + histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hTriggerFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards, + 0, 0, "Local board triggers / event"); + histo2D->SetOption("COLZ"); + Add2RawsList(histo2D, AliMUONQAIndices::kTriggerBoardsDisplay, expert, !image, !saveCorr); + + TH1F* histoYCopyErr = new TH1F("hTriggerErrorLocalYCopy", "Number of YCopy errors",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histoYCopyErr->GetXaxis()->SetTitle(boardName.Data()); + histoYCopyErr->GetYaxis()->SetTitle(errorAxisTitle.Data()); + // Copy of previous histo for scaling purposes + TH1F* histoYCopyErrTest = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyTest"); + histoYCopyErrTest->SetTitle("Number of YCopy tested"); + // Copy of previous histo for scaling purposes + TH1F* histoYCopyErrNorm = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyNorm"); + histoYCopyErrNorm->SetTitle("% of YCopy errors"); + // Adding both histos after cloning to avoid problems with the expert bit + Add2RawsList(histoYCopyErr, AliMUONQAIndices::kTriggerErrorLocalYCopy, expert, !image, !saveCorr); + Add2RawsList(histoYCopyErrTest, AliMUONQAIndices::kTriggerErrorLocalYCopyTest, expert, !image, !saveCorr); + Add2RawsList(histoYCopyErrNorm, AliMUONQAIndices::kTriggerErrorLocalYCopyNorm, expert, !image, !saveCorr); + + TH1F* histoROerr = new TH1F("hTriggerReadoutNumOfErrors","Trigger Read-Out total errors", AliMUONQAIndices::kNtrigStructErrorBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigStructErrorBins-0.5); + histoROerr->GetYaxis()->SetTitle("Fraction of errors"); + histoROerr->SetFillColor(kBlue); + for (int ibin=0;ibinGetXaxis()->SetBinLabel(ibin+1,readoutErrNames[ibin]); + } + // Copy of previous histo for scaling purposes + TH1F* histoROerrNorm = (TH1F*)histoROerr->Clone("hTriggerReadoutErrors"); + histoROerrNorm->SetTitle("Trigger Read-Out errors"); + histoROerrNorm->SetOption("bartext0"); + histoROerrNorm->GetYaxis()->SetTitle("% of errors per event"); + // Adding both histos after cloning to avoid problems with the expert bit + Add2RawsList(histoROerr, AliMUONQAIndices::kTriggerReadOutErrors, expert, !image, !saveCorr); + Add2RawsList(histoROerrNorm, AliMUONQAIndices::kTriggerReadOutErrorsNorm, !expert, image, !saveCorr); + + TH1F* histoGlobalMult = new TH1F("hTriggerGlobalOutMultiplicity","Trigger global outputs multiplicity", 6, -0.5, 6.-0.5); + histoGlobalMult->GetYaxis()->SetTitle("Number of triggers"); + histoGlobalMult->GetXaxis()->SetTitle("Global output"); for (int ibin=0;ibin<6;ibin++){ - h29->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]); + histoGlobalMult->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]); } - h29->SetFillColor(3); - Add2RawsList(h29, kTriggerGlobalOutput, expert, !image, !saveCorr); + histoGlobalMult->SetFillColor(kBlue); + // Copy of previous histo for scaling purposes + TH1F* histoGlobalMultNorm = (TH1F*)histoGlobalMult->Clone("hTriggerGlobalOutMultiplicityPerEvt"); + histoGlobalMultNorm->SetTitle("Trigger global outputs multiplicity per event"); + histoGlobalMultNorm->SetOption("bartext0"); + //histoGlobalMultNorm->SetBarWidth(0.5); + //histoGlobalMultNorm->SetBarOffset(0.25); + histoGlobalMultNorm->GetYaxis()->SetTitle("Triggers per event"); + // Adding both histos after cloning to avoid problems with the expert bit + Add2RawsList(histoGlobalMult, AliMUONQAIndices::kTriggerGlobalOutput, expert, !image, !saveCorr); + Add2RawsList(histoGlobalMultNorm, AliMUONQAIndices::kTriggerGlobalOutputNorm, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerRawNAnalyzedEvents", "Number of analyzed events per specie", 2, 0.5, 2.5); + //histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(CurrentEventSpecie())); + histo1D->GetXaxis()->SetBinLabel(1,"All"); + histo1D->GetXaxis()->SetBinLabel(2,"w/o Readout errors"); + histo1D->GetYaxis()->SetTitle("Number of analyzed events"); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRawNAnalyzedEvents, expert, !image, !saveCorr); + + if ( CurrentEventSpecie() != AliRecoParam::kCalib ) { + histo1D = new TH1F("hTriggerNumberOf34Dec", "Number of 3/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle("Number of 3/4"); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf34Dec, expert, !image, !saveCorr); + + histo1D = new TH1F("hTriggerNumberOf44Dec", "Number of 4/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5); + histo1D->GetXaxis()->SetTitle(boardName.Data()); + histo1D->GetYaxis()->SetTitle("Number of 4/4"); + Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf44Dec, expert, !image, !saveCorr); + } + + histo1D = new TH1F("hTriggerIsThere","trigger is there",1,0,1); + Add2RawsList(histo1D,AliMUONQAIndices::kTriggerIsThere,kTRUE,kFALSE,kFALSE); + + if ( CurrentEventSpecie() == AliRecoParam::kCalib ) { + TH1F* histoGlobalScalers = new TH1F("hTriggerGlobalScalers","Trigger global scalers", 6, -0.5, 6.-0.5); + histoGlobalScalers->GetYaxis()->SetTitle("L0 counts"); + histoGlobalScalers->GetXaxis()->SetTitle("Global output"); + for (int ibin=0;ibin<6;ibin++){ + histoGlobalScalers->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]); + } + // Copy of previous histo for scaling purposes + TH1F* histoGlobalScalersNorm = (TH1F*)histoGlobalScalers->Clone("hTriggerGlobalScalersRate"); + histoGlobalScalersNorm->SetTitle("Trigger global L0 scalers rate"); + histoGlobalScalersNorm->SetOption("etext0"); + histoGlobalScalersNorm->GetYaxis()->SetTitle("L0 scalers rate (Hz)"); + // Adding both histos after cloning to avoid problems with the expert bit + Add2RawsList(histoGlobalScalers, AliMUONQAIndices::kTriggerGlobalScalers, expert, !image, !saveCorr); + ForbidCloning(histoGlobalScalers); // RS + Add2RawsList(histoGlobalScalersNorm, AliMUONQAIndices::kTriggerGlobalScalersNorm, expert, !image, !saveCorr); + ForbidCloning(histoGlobalScalersNorm); // RS + } + // + //ClonePerTrigClass(AliQAv1::kRAWS); // RS: this should be the last line DONE at parent level + // } //__________________________________________________________________ @@ -318,8 +507,12 @@ void AliMUONTriggerQADataMakerRec::InitDigits() const Bool_t expert = kTRUE ; const Bool_t image = kTRUE ; - TH1I* h0 = new TH1I("hDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 400, 1100, 1500); + TH1I* h0 = new TH1I("hTriggerDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 400, 1100, 1500); Add2DigitsList(h0, 0, !expert, image); + ForbidCloning(h0); + // + //ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line DONE at parent level + // } //____________________________________________________________________________ @@ -333,122 +526,69 @@ void AliMUONTriggerQADataMakerRec::InitRecPoints() TH1F* histo1D = 0x0; - histo1D = new TH1F("hNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5); - Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie()); - histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex)); + histo1D = new TH1F("hTriggerNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5); + histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(CurrentEventSpecie())); histo1D->GetYaxis()->SetTitle("Number of analyzed events"); - Add2RecPointsList(histo1D, kNAnalyzedEvents, expert, !image); + Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerNAnalyzedEvents, expert, !image); + ForbidCloning(histo1D); histo1D = new TH1F("hTriggerTrippedChambers", "Trigger RPCs in trip", 418, 1100-0.5, 1417+0.5); histo1D->GetXaxis()->SetTitle("DetElemId"); histo1D->GetYaxis()->SetTitle("# of trips"); histo1D->SetFillColor(kRed); histo1D->SetLineColor(kRed); - Add2RecPointsList(histo1D, kTriggerRPCtrips, !expert, image); - - FillTriggerDCSHistos(); + Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerRPCtrips, !expert, image); + ForbidCloning(histo1D); // RS this histo is not cloned + // + FillTriggerDCSHistos(); + // + //ClonePerTrigClass(AliQAv1::kRECPOINTS); DONE at parent level + // } //____________________________________________________________________________ void AliMUONTriggerQADataMakerRec::InitESDs() { + /// Empty implementation } //____________________________________________________________________________ void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader) { /// make QA for rawdata trigger - - GetRawsData(kRawNAnalyzedEvents)->Fill(1.); + AliCodeTimerAuto("",0); + // Init Local/Regional/Global decision with fake values - - Int_t globaltemp[4]; - for (Int_t bit=0; bit<4; bit++){ - globaltemp[bit]=0; - fgitmp[bit]=0; - } + // - for (Int_t loc=0;loc<235;loc++){ - fTriggerErrorLocalYCopy[loc]=kFALSE; - - fTriggerOutputLocalRecTriggerDec[loc]=0; - fTriggerOutputLocalRecLPtDec[0][loc]=0; - fTriggerOutputLocalRecLPtDec[1][loc]=0; - fTriggerOutputLocalRecHPtDec[0][loc]=0; - fTriggerOutputLocalRecHPtDec[1][loc]=0; - fTriggerOutputLocalRecXPos[loc]=0; - fTriggerOutputLocalRecYPos[loc]=15; - fTriggerOutputLocalRecDev[loc]=0; - fTriggerOutputLocalRecTrigY[loc]=1; - - fTriggerOutputLocalDataTriggerDec[loc]=0; - fTriggerOutputLocalDataLPtDec[0][loc]=0; - fTriggerOutputLocalDataLPtDec[1][loc]=0; - fTriggerOutputLocalDataHPtDec[0][loc]=0; - fTriggerOutputLocalDataHPtDec[1][loc]=0; - fTriggerOutputLocalDataXPos[loc]=0; - fTriggerOutputLocalDataYPos[loc]=15; - fTriggerOutputLocalDataDev[loc]=0; - fTriggerOutputLocalDataTrigY[loc]=1; - fTriggerInputRegionalDataLPt[0][loc]=0; - fTriggerInputRegionalDataLPt[1][loc]=0; - fTriggerInputRegionalDataHPt[0][loc]=0; - fTriggerInputRegionalDataHPt[1][loc]=0; - } - - for (Int_t reg=0;reg<16;reg++){ - fTriggerOutputRegionalData[reg]=0; - for (Int_t bit=0;bit<4;bit++){ - fTriggerInputGlobalDataLPt[reg][bit]=0; - fTriggerInputGlobalDataHPt[reg][bit]=0; - } - } - - for (Int_t bit=0;bit<6;bit++){ - fgotmp[bit]=0; - fTriggerOutputGlobalData[bit]=0; - fTriggerOutputGlobalRecFromGlobalInput[bit]=0; - } - - for (Int_t loc=0;loc<243;loc++){ - for (Int_t bit=0;bit<16;bit++){ - fTriggerPatternX1[loc][bit]=0; - fTriggerPatternX2[loc][bit]=0; - fTriggerPatternX3[loc][bit]=0; - fTriggerPatternX4[loc][bit]=0; - - fTriggerPatternY1[loc][bit]=0; - fTriggerPatternY2[loc][bit]=0; - fTriggerPatternY3[loc][bit]=0; - fTriggerPatternY4[loc][bit]=0; - } + UInt_t globalInput[4]; + for (Int_t bit=0; bit<4; bit++){ + globalInput[bit]=0; } - AliMUONDigitStoreV2R digitStore; - digitStore.Create(); - digitStore.Clear(); - - AliMUONDigitStoreV2R digitStoreAll; - digitStoreAll.Create(); - digitStoreAll.Clear(); - TArrayS xyPatternAll[2]; - for(Int_t icath=0; icathClear(); + else fDigitStoreFromRaw = new AliMUONDigitStoreV2R(); + if ( fTriggerStoreFromRaw ) fTriggerStoreFromRaw->Clear(); + else fTriggerStoreFromRaw = new AliMUONTriggerStoreV1(); + if ( fTriggerStoreReprocessRaw ) fTriggerStoreReprocessRaw->Clear(); + else fTriggerStoreReprocessRaw = new AliMUONTriggerStoreV1(); + AliMUONGlobalTrigger inputGlobalTrigger; - UShort_t maxNcounts = 0xFFFF; + //UShort_t maxNcounts = 0xFFFF; // Uncomment for noisy strips // Get trigger Local, Regional, Global in/outputs and scalers - - Int_t loCircuit=0; + AliMpCDB::LoadDDLStore(); const AliMUONRawStreamTriggerHP::AliHeader* darcHeader = 0x0; @@ -456,50 +596,69 @@ void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader) const AliMUONRawStreamTriggerHP::AliLocalStruct* localStruct = 0x0; Int_t nDeadLocal = 0, nDeadRegional = 0, nDeadGlobal = 0, nNoisyStrips = 0; + Int_t nFiredStrips = 0, nStripsTot = 0; // When a crate is not present, the loop on boards is not performed // This should allow to correctly count the local boards - Int_t countNotifiedBoards = 0, countAllBoards = 0; + Int_t countAllBoards = 0; + Bool_t containTriggerData = kFALSE; + Bool_t hasReadoutErrors = kFALSE; AliMUONRawStreamTriggerHP rawStreamTrig(rawReader); while (rawStreamTrig.NextDDL()) - { - Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1; + { + containTriggerData = kTRUE; + + Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1; + if ( scalerEvent ) AliDebug(1,Form("Scaler event: evtSpecie recoParam %s QA %s\n", + AliRecoParam::GetEventSpecieName(AliRecoParam::Convert(GetRecoParam()->GetEventSpecie())), + AliRecoParam::GetEventSpecieName(CurrentEventSpecie()))); Bool_t fillScalerHistos = ( scalerEvent && - ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) ); + ( CurrentEventSpecie() == AliRecoParam::kCalib ) ); if ( scalerEvent != fillScalerHistos ) { - Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie()); - AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(esindex))); + AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(CurrentEventSpecie()))); } darcHeader = rawStreamTrig.GetHeaders(); if (darcHeader->GetGlobalFlag()){ - if ( fillScalerHistos ) { - UInt_t nOfClocks = darcHeader->GetGlobalClock(); - Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns - ((TH1F*)GetRawsData(kTriggerScalersTime))->Fill(1., nOfSeconds); - } - - //Get Global datas - for (Int_t bit=1; bit<7; bit++){ - fTriggerOutputGlobalData[bit-1]=Int_t(((darcHeader->GetGlobalOutput())>>bit)&1); - if ( fillScalerHistos && !fTriggerOutputGlobalData[bit-1] ) - nDeadGlobal++; - } - for (Int_t Bit=0; Bit<32; Bit++){ - fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1); - fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1); - fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1); - fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1); - } - - globaltemp[0]=darcHeader->GetGlobalInput(0); - globaltemp[1]=darcHeader->GetGlobalInput(1); - globaltemp[2]=darcHeader->GetGlobalInput(2); - globaltemp[3]=darcHeader->GetGlobalInput(3); + if ( fillScalerHistos ) { + UInt_t nOfClocks = darcHeader->GetGlobalClock(); + Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns + FillRawsData(AliMUONQAIndices::kTriggerScalersTime, 1., nOfSeconds); + const UInt_t* globScaler = darcHeader->GetGlobalScaler(); + Int_t bitCorr[6] = {2,0,3,1,4,5}; + for (Int_t bit=0; bit<6; bit++){ + FillRawsData(AliMUONQAIndices::kTriggerGlobalScalers, bitCorr[bit],(double)(*(globScaler+bit))); + } + } + + //Get Global datas + inputGlobalTrigger.SetFromGlobalResponse(darcHeader->GetGlobalOutput()); + Int_t resp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(), + inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(), + inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()}; + for (Int_t bit=0; bit<6; bit++){ + if ( resp[bit] == 0 ){ + if ( fillScalerHistos ) + nDeadGlobal++; + } + else + FillRawsData(AliMUONQAIndices::kTriggerGlobalOutput, bit, resp[bit]); + } // loop on bits + + //for (Int_t Bit=0; Bit<32; Bit++){ + //fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1); + //fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1); + //fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1); + //fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1); + //} + + for (Int_t i=0; i<4; i++){ + globalInput[i]=darcHeader->GetGlobalInput(i); + } } Int_t nReg = rawStreamTrig.GetRegionalHeaderCount(); @@ -507,17 +666,17 @@ void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader) for(Int_t iReg = 0; iReg < nReg ;iReg++) { //reg loop - Int_t regId=rawStreamTrig.GetDDL()*8+iReg; + //Int_t regId=rawStreamTrig.GetDDL()*8+iReg; // crate info AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(rawStreamTrig.GetDDL(), iReg); regHeader = rawStreamTrig.GetRegionalHeader(iReg); - //Get regional outputs -> not checked, hardware read-out doesn't work - fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput()); - // if ( ! fTriggerOutputRegionalData[regId] ) - // nDeadRegional++; + //Get regional outputs -> not checked, hardware read-out doesn't work + //fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput()); + // if ( ! fTriggerOutputRegionalData[regId] ) + // nDeadRegional++; Int_t nBoardsInReg = 0; // Not necessary when regional output will work // loop over local structures @@ -530,225 +689,157 @@ void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader) // if card exist if (!localStruct) continue; - - loCircuit = crate->GetLocalBoardId(localStruct->GetId()); + + Int_t loCircuit = crate->GetLocalBoardId(localStruct->GetId()); if ( !loCircuit ) continue; // empty slot - + AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false); nBoardsInReg++; // Not necessary when regional output will work countAllBoards++; - // skip copy cards - if( !localBoard->IsNotified()) - continue; - - countNotifiedBoards++; + AliMUONLocalTrigger inputLocalTrigger; + inputLocalTrigger.SetLocalStruct(loCircuit, *localStruct); + fTriggerStoreFromRaw->Add(inputLocalTrigger); TArrayS xyPattern[2]; localStruct->GetXPattern(xyPattern[0]); localStruct->GetYPattern(xyPattern[1]); - fDigitMaker->TriggerDigits(loCircuit, xyPattern, digitStore); - if ( fillScalerHistos ) // Compute total number of strips - fDigitMaker->TriggerDigits(loCircuit, xyPatternAll, digitStoreAll); - - Int_t cathode = localStruct->GetComptXY()%2; + fDigitMaker->TriggerDigits(loCircuit, xyPattern, *fDigitStoreFromRaw); //Get electronic Decisions from data //Get regional inputs -> not checked, hardware read-out doesn't work - fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1); - fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1); + //fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1); + //fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1); + + if ( ! localBoard->IsNotified() ) continue; //Get local in/outputs if (Int_t(localStruct->GetDec())!=0){ - fTriggerOutputLocalDataTriggerDec[loCircuit]++; - ((TH1F*)GetRawsData(kTriggeredBoards))->Fill(loCircuit); + FillRawsData(AliMUONQAIndices::kTriggeredBoards,loCircuit); } - else if ( fillScalerHistos ){ - nDeadLocal++; - } - - fTriggerOutputLocalDataLPtDec[0][loCircuit]=((localStruct->GetLpt())&1); - fTriggerOutputLocalDataLPtDec[1][loCircuit]=((localStruct->GetLpt()>>1)&1); - fTriggerOutputLocalDataHPtDec[0][loCircuit]=((localStruct->GetHpt())&1); - fTriggerOutputLocalDataHPtDec[1][loCircuit]=((localStruct->GetHpt()>>1)&1); - fTriggerOutputLocalDataXPos[loCircuit]=Int_t(localStruct->GetXPos()); - fTriggerOutputLocalDataYPos[loCircuit]=Int_t(localStruct->GetYPos()); - fTriggerOutputLocalDataDev[loCircuit]=Int_t((localStruct->GetXDev())*(pow(-1.0,(localStruct->GetSXDev())))); - fTriggerOutputLocalDataTrigY[loCircuit]=Int_t(localStruct->GetTrigY()); - - UShort_t x1 = (Int_t)localStruct->GetX1(); - UShort_t x2 = (Int_t)localStruct->GetX2(); - UShort_t x3 = (Int_t)localStruct->GetX3(); - UShort_t x4 = (Int_t)localStruct->GetX4(); - - UShort_t y1 = (Int_t)localStruct->GetY1(); - UShort_t y2 = (Int_t)localStruct->GetY2(); - UShort_t y3 = (Int_t)localStruct->GetY3(); - UShort_t y4 = (Int_t)localStruct->GetY4(); + else if ( fillScalerHistos && ! TriggerUtilities()->IsMaskedBoard(loCircuit) ) nDeadLocal++; // loop over strips - for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) { - - fTriggerPatternX1[loCircuit][ibitxy]=Int_t((x1>>ibitxy)&1); - fTriggerPatternX2[loCircuit][ibitxy]=Int_t((x2>>ibitxy)&1); - fTriggerPatternX3[loCircuit][ibitxy]=Int_t((x3>>ibitxy)&1); - fTriggerPatternX4[loCircuit][ibitxy]=Int_t((x4>>ibitxy)&1); - - fTriggerPatternY1[loCircuit][ibitxy]=Int_t((y1>>ibitxy)&1); - fTriggerPatternY2[loCircuit][ibitxy]=Int_t((y2>>ibitxy)&1); - fTriggerPatternY3[loCircuit][ibitxy]=Int_t((y3>>ibitxy)&1); - fTriggerPatternY4[loCircuit][ibitxy]=Int_t((y4>>ibitxy)&1); - - if ( fillScalerHistos ) { - if (ibitxy==0){ - AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers"); - } - - UShort_t scalerVal[4] = { - localStruct->GetXY1(ibitxy), - localStruct->GetXY2(ibitxy), - localStruct->GetXY3(ibitxy), - localStruct->GetXY4(ibitxy) - }; - - for(Int_t ich=0; ich 0 ) - ((TH2F*)GetRawsData(kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich)) - ->Fill(loCircuit, ibitxy, 2*(Float_t)scalerVal[ich]); - - if ( scalerVal[ich] >= maxNcounts ) - nNoisyStrips++; - } // loop on chamber - } // scaler event - } // loop on strips + if ( fillScalerHistos ) { + Int_t cathode = localStruct->GetComptXY()%2; + + Int_t offset = 0; + if (cathode && localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB)) offset = -8; + + for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) { + if (ibitxy==0){ + AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers"); + } + + UShort_t scalerVal[4] = { + localStruct->GetXY1(ibitxy), + localStruct->GetXY2(ibitxy), + localStruct->GetXY3(ibitxy), + localStruct->GetXY4(ibitxy) + }; + + + + for(Int_t ich=0; ichGetDEfromLocalBoard(loCircuit, ich); + + const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode)); + + + Int_t istrip = ibitxy + offset; + + AliMpPad pad = seg->PadByLocation(loCircuit,istrip,kFALSE); + if (!pad.IsValid()) continue; + if ( ! TriggerUtilities()->IsMasked(pad, detElemId, cathode)) nStripsTot++; + + // UShort_t pattern = (UShort_t)xyPattern[cathode].At(ich); + // if ((pattern >> ibitxy) & 0x1) nFiredStrips++; + + if ( scalerVal[ich] > 0 ) { + FillRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich, + loCircuit, istrip, 2*(Float_t)scalerVal[ich]); + nFiredStrips++; + } + + //if ( scalerVal[ich] >= maxNcounts ) nNoisyStrips++; // Uncomment for noisy strips + } // loop on chamber + } // loop on strips + } // scaler event } // iLocal - if ( nBoardsInReg == 0 ) - nDeadRegional++; // Not necessary when regional output will work + if ( nBoardsInReg == 0 ) { + // Check masks + Int_t nMaskedInReg = 0; + for ( Int_t iLocal = 0; iLocal < crate->GetNofLocalBoards(); ++iLocal ) { + Int_t loCircuit = crate->GetLocalBoardId(iLocal); + if ( TriggerUtilities()->IsMaskedBoard(loCircuit) ) nMaskedInReg++; + } + if ( nMaskedInReg != crate->GetNofLocalBoards() ) nDeadRegional++; // Not necessary when regional output will work + } } // iReg - Float_t readoutErrors[kNtrigStructErrorBins] = { - ((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards), + Float_t readoutErrors[AliMUONQAIndices::kNtrigStructErrorBins] = { + countAllBoards>0?((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards):0, ((Float_t)rawStreamTrig.GetRegEoWErrors())/16., ((Float_t)rawStreamTrig.GetGlobalEoWErrors())/6., ((Float_t)rawStreamTrig.GetDarcEoWErrors())/2. }; - for (Int_t ibin=0; ibin 0 ) - ((TH1F*)GetRawsData(kTriggerReadOutErrors))->Fill(ibin, readoutErrors[ibin]); + for (Int_t ibin=0; ibin 0 ) { + hasReadoutErrors = kTRUE; + FillRawsData(AliMUONQAIndices::kTriggerReadOutErrors, ibin, readoutErrors[ibin]); + } } } // NextDDL - nDeadLocal += AliMUONConstants::NTriggerCircuit() - countNotifiedBoards; - Int_t nStripsTot = digitStoreAll.GetSize(); + if ( ! containTriggerData ) return; + + FillRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,1.); + + // Do not check algorithm if there are ReadOut errors + if ( hasReadoutErrors ) return; // COMMENT if you want to check events with readout errors as well + FillRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,2.); + if ( nStripsTot > 0 ) { // The value is != 0 only for scaler events - Float_t fraction[kNtrigCalibSummaryBins] = { - ((Float_t)(nStripsTot - digitStore.GetSize())) / ((Float_t)nStripsTot), - //(Float_t)nDeadLocal / ((Float_t)countNotifiedBoards), - (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()), + AliDebug(AliQAv1::GetQADebugLevel(), Form("nStripsFired %i nStripsTot %i", nFiredStrips, nStripsTot)); + Float_t fraction[AliMUONQAIndices::kNtrigCalibSummaryBins] = { + ((Float_t)(nStripsTot - nFiredStrips)) / ((Float_t)nStripsTot), + (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()), (Float_t)nDeadRegional / 16., (Float_t)nDeadGlobal / 6., // Number of bits of global response (Float_t)nNoisyStrips / ((Float_t)nStripsTot), }; - for(Int_t ibin = 0; ibin < kNtrigCalibSummaryBins; ibin++){ + for(Int_t ibin = 0; ibin < AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){ if ( fraction[ibin] > 0. ) - ((TH1F*)GetRawsData(kTriggerCalibSummary))->Fill(ibin, fraction[ibin]); - } - } - - fTriggerProcessor->Digits2Trigger(digitStore,triggerStore); - - TIter next(triggerStore.CreateLocalIterator()); - AliMUONLocalTrigger *localTrigger; - - while ( ( localTrigger = static_cast(next()) ) ) - { - - //... extract information - loCircuit = localTrigger->LoCircuit(); - - AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board objectfor switch value - if (localTrigger->GetLoDecision() != 0){ - fTriggerOutputLocalRecTriggerDec[loCircuit]++; - } - - fTriggerOutputLocalRecLPtDec[0][loCircuit]=Int_t(localTrigger->LoLpt() & 1); - fTriggerOutputLocalRecLPtDec[1][loCircuit]=Int_t((localTrigger->LoLpt()>>1) & 1); - fTriggerOutputLocalRecHPtDec[0][loCircuit]=Int_t(localTrigger->LoHpt() & 1); - fTriggerOutputLocalRecHPtDec[1][loCircuit]=Int_t((localTrigger->LoHpt()>>1) & 1); - fTriggerOutputLocalRecXPos[loCircuit]=localTrigger->LoStripX(); - fTriggerOutputLocalRecYPos[loCircuit]=localTrigger->LoStripY(); - fTriggerOutputLocalRecTrigY[loCircuit]=localTrigger->LoTrigY(); - fTriggerOutputLocalRecDev[loCircuit]=Int_t(localTrigger->LoDev()*(pow(-1.,localTrigger->LoSdev()))); - - Bool_t firstFillYCopy=kTRUE; - - for (int bit=0; bit<16; bit++){ - if (fTriggerPatternY1[loCircuit][bit]!=((localTrigger->GetY1Pattern()>>bit) & 1)) - { - fTriggerErrorLocalYCopy[loCircuit]=kTRUE; - if (firstFillYCopy){ - ((TH1F*)GetRawsData(kTriggerErrorLocalYCopy))->Fill(loCircuit); - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalYCopy, 1./192.); - firstFillYCopy=kFALSE; - } - } - if (fTriggerPatternY2[loCircuit][bit]!=((localTrigger->GetY2Pattern()>>bit) & 1)) - { - fTriggerErrorLocalYCopy[loCircuit]=kTRUE; - if (firstFillYCopy){ - ((TH1F*)GetRawsData(kTriggerErrorLocalYCopy))->Fill(loCircuit); - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalYCopy, 1./192.); - firstFillYCopy=kFALSE; - } - } - if (fTriggerPatternY3[loCircuit][bit]!=((localTrigger->GetY3Pattern()>>bit) & 1)) - { - fTriggerErrorLocalYCopy[loCircuit]=kTRUE; - if (localBoardMp->GetSwitch(4)) fTriggerErrorLocalYCopy[loCircuit-1]=kTRUE; - if (localBoardMp->GetSwitch(3)) fTriggerErrorLocalYCopy[loCircuit+1]=kTRUE; - if (firstFillYCopy){ - ((TH1F*)GetRawsData(kTriggerErrorLocalYCopy))->Fill(loCircuit); - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalYCopy, 1./192.); - firstFillYCopy=kFALSE; - } - } - if (fTriggerPatternY4[loCircuit][bit]!=((localTrigger->GetY4Pattern()>>bit) & 1)) - { - fTriggerErrorLocalYCopy[loCircuit]=kTRUE; - if (localBoardMp->GetSwitch(4)) fTriggerErrorLocalYCopy[loCircuit-1]=kTRUE; - if (localBoardMp->GetSwitch(3)) fTriggerErrorLocalYCopy[loCircuit+1]=kTRUE; - if (firstFillYCopy){ - ((TH1F*)GetRawsData(kTriggerErrorLocalYCopy))->Fill(loCircuit); - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalYCopy, 1./192.); - firstFillYCopy=kFALSE; - } - } + FillRawsData(AliMUONQAIndices::kTriggerCalibSummary,ibin, fraction[ibin]); } - } - - //Reconstruct Global decision from Global inputs - for (Int_t bit=0; bit<4; bit++){ - for (Int_t i=0; i<32; i=i+4){ - fgitmp[bit]+=UInt_t(((globaltemp[bit]>>i)&1)*pow(2.0,i+1)); - fgitmp[bit]+=UInt_t(((globaltemp[bit]>>(i+1))&1)*pow(2.0,i)); - fgitmp[bit]+=UInt_t(((globaltemp[bit]>>(i+2))&1)*pow(2.0,i+2)); - fgitmp[bit]+=UInt_t(((globaltemp[bit]>>(i+3))&1)*pow(2.0,i+3)); - } - } - RawTriggerInGlobal2OutGlobal(); - for (Int_t bit=0; bit<6; bit++){ - fTriggerOutputGlobalRecFromGlobalInput[bit]=fgotmp[bit]; } - // Compare data and reconstructed decisions and fill histos - RawTriggerMatchOutLocal(); - RawTriggerMatchOutLocalInRegional(); // Not tested, hardware read-out doesn't work - RawTriggerMatchOutGlobalFromInGlobal(); + TriggerElectronics()->Digits2Trigger(*fDigitStoreFromRaw,*fTriggerStoreReprocessRaw); + + AliMUONGlobalTrigger* recoGlobalTriggerFromLocal; + recoGlobalTriggerFromLocal = fTriggerStoreReprocessRaw->Global(); + + //Reconstruct Global decision from Global inputs + UChar_t recoResp = RawTriggerInGlobal2OutGlobal(globalInput); + AliMUONGlobalTrigger recoGlobalTriggerFromGlobal; + recoGlobalTriggerFromGlobal.SetFromGlobalResponse(recoResp); + + // Compare data and reconstructed decisions and fill histos + RawTriggerMatchOutLocal(); + //Fill ratio 44/34 histos + for ( Int_t itc=-1; itcGetEventSpecie() == AliRecoParam::kCalib ) return; - + if ( CurrentEventSpecie() == AliRecoParam::kCalib ) return; + if (!fDigitStore) fDigitStore = AliMUONVDigitStore::Create(*digitsTree); - + fDigitStore->Clear(); fDigitStore->Connect(*digitsTree, false); digitsTree->GetEvent(0); @@ -772,28 +863,30 @@ void AliMUONTriggerQADataMakerRec::MakeDigits(TTree* digitsTree) while ( ( dig = static_cast(next()) ) ) { - GetDigitsData(0)->Fill(dig->DetElemId()); - GetDigitsData(1)->Fill(dig->ADC()); + FillDigitsData(0,dig->DetElemId()); } } //____________________________________________________________________________ void AliMUONTriggerQADataMakerRec::MakeRecPoints(TTree* /*clustersTree*/) { + /// Fill histogram with total number of analyzed events for normalization purposes + // Do nothing in case of calibration event - if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return; + if ( CurrentEventSpecie() == AliRecoParam::kCalib ) return; - GetRecPointsData(kNAnalyzedEvents)->Fill(1.); + FillRecPointsData(AliMUONQAIndices::kTriggerNAnalyzedEvents,1.); } //____________________________________________________________________________ void AliMUONTriggerQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/) { + /// Empty implementation } //____________________________________________________________________________ -void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo() +void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo(Int_t itc) { // /// Display trigger information in a user-friendly way: @@ -802,34 +895,34 @@ void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo() AliMUONTriggerDisplay triggerDisplay; - TH2F* histoStrips=0x0; - TH2F* histoDisplayStrips=0x0; - if ( GetRawsData(kTriggerScalers) ) { + TH2* histoStrips=0x0; + TH2* histoDisplayStrips=0x0; + if ( GetRawsData(AliMUONQAIndices::kTriggerScalers, itc) ) { AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kNormalizeToArea; for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++) { for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++) { - histoStrips = (TH2F*)GetRawsData(kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber); + histoStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc); if(histoStrips->GetEntries()==0) continue; // No events found => No need to display - histoDisplayStrips = (TH2F*)GetRawsData(kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber); + histoDisplayStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc); triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips, AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption); - Float_t scaleValue = ((TH1F*)GetRawsData(kTriggerScalersTime))->GetBinContent(1); + Float_t scaleValue = ((TH1*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime, itc))->GetBinContent(1); if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue); } // iChamber } // iCath } - - if ( GetRawsData(kTriggeredBoards) ){ - TH1F* histoBoards = (TH1F*)GetRawsData(kTriggeredBoards); - TH2F* histoDisplayBoards = (TH2F*)GetRawsData(kTriggerBoardsDisplay); + + if ( GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc) ){ + TH1* histoBoards = (TH1*)GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc); + TH2* histoDisplayBoards = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerBoardsDisplay, itc); triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0); - Float_t scaleValue = GetRawsData(kRawNAnalyzedEvents)->GetBinContent(1); + Float_t scaleValue = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents, itc)->GetBinContent(1); if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue); } } @@ -840,10 +933,12 @@ Bool_t AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos() { /// Get HV and currents values for one trigger chamber - + // RS: Note: the histos involved in this routin are forbidden to be cloned, -1 in GetRawsData returns the default histos + int itc = -1; + // AliCodeTimerAuto("",0); - - TMap* triggerDcsMap = fCalibrationData->TriggerDCS(); + + TMap* triggerDcsMap = CalibrationData()->TriggerDCS(); if ( !triggerDcsMap ) { @@ -974,11 +1069,11 @@ AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos() Int_t iChamber = AliMpDEManager::GetChamberId(detElemId); Int_t ich = iChamber - AliMpConstants::NofTrackingChambers(); - histoIndex = kTriggerRPChv + ich; - histoName = Form("hRPCHVChamber%i", 11+ich); + histoIndex = AliMUONQAIndices::kTriggerRPChv + ich; + histoName = Form("hTriggerRPCHVChamber%i", 11+ich); histoTitle = Form("Chamber %i: RPC HV (kV)", 11+ich); - currHisto = (TH2F*)GetRecPointsData(histoIndex); + currHisto = (TH2F*)GetRecPointsData(histoIndex,itc); // RS this histo is not cloned if(!currHisto){ currHisto = new TH2F(histoName.Data(), histoTitle.Data(), @@ -991,6 +1086,7 @@ AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos() currHisto->GetYaxis()->SetTitle("RPC"); currHisto->SetOption("TEXT45COLZ"); Add2RecPointsList(currHisto, histoIndex, expert, !image); + ForbidCloning(currHisto); // RS } Int_t slat = detElemId%100; @@ -1050,7 +1146,7 @@ AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos() previousVal = currVal; } // loop on values currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin)); // Fill last value - if ( isTrip ) ((TH1F*)GetRecPointsData(kTriggerRPCtrips))->Fill(detElemId); + if ( isTrip ) ((TH1*)GetRecPointsData(AliMUONQAIndices::kTriggerRPCtrips,itc))->Fill(detElemId); } // if ( values ) deIt.Next(); } // loop on detElem @@ -1063,23 +1159,27 @@ TObjArray* AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId, TMap* triggerDcsMap, AliMpDCSNamer& triggerDcsNamer) { + // + /// Get values of DCS data points from the map + // + if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger) return 0x0; - TString currAlias = triggerDcsNamer.DCSChannelName(detElemId, 0, iMeas); + TString currAlias = triggerDcsNamer.DCSAliasName(detElemId, 0, iMeas); TPair* triggerDcsPair = static_cast(triggerDcsMap->FindObject(currAlias.Data())); if (!triggerDcsPair) { - printf(Form("Did not find expected alias (%s) for DE %d\n", - currAlias.Data(),detElemId)); + AliError(Form("Did not find expected alias (%s) for DE %d\n", + currAlias.Data(),detElemId)); return 0x0; } TObjArray* values = static_cast(triggerDcsPair->Value()); if (!values) { - printf(Form("Could not get values for alias %s\n",currAlias.Data())); + AliError(Form("Could not get values for alias %s\n",currAlias.Data())); return 0x0; } @@ -1088,13 +1188,15 @@ AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId, //____________________________________________________________________________ -void AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal() +UChar_t AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal(UInt_t globalInput[4]) { // /// Reconstruct Global Trigger decision using Global Inputs // - AliMUONGlobalCrateConfig* globalConfig = fCalibrationData->GlobalTriggerCrateConfig(); + AliCodeTimerAuto("",0); + + AliMUONGlobalCrateConfig* globalConfig = CalibrationData()->GlobalTriggerCrateConfig(); AliMUONGlobalTriggerBoard globalTriggerBoard; globalTriggerBoard.Reset(); @@ -1102,29 +1204,10 @@ void AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal() globalTriggerBoard.Mask(i,globalConfig->GetGlobalMask(i)); } - - UShort_t regional[16]; - - for (Int_t iReg = 0; iReg < 16; iReg++) { - regional[iReg] = 0; - if (iReg < 8) { // right - // Lpt - regional[iReg] |= (fgitmp[0] >> (4*iReg)) & 0xF; - // Hpt - regional[iReg] |= ((fgitmp[2] >> (4*iReg)) & 0xF) << 4; - } else { // left - // Lpt - regional[iReg] |= (fgitmp[1] >> (4*(iReg-8))) & 0xF; - // Hpt - regional[iReg] |= ((fgitmp[3] >> (4*(iReg-8))) & 0xF) << 4; - } - } - globalTriggerBoard.SetRegionalResponse(regional); + globalTriggerBoard.RecomputeRegional(globalInput); globalTriggerBoard.Response(); + return globalTriggerBoard.GetResponse(); - for (Int_t bit=1; bit<7; bit++){ - fgotmp[bit-1]=Int_t((globalTriggerBoard.GetResponse())>>bit&1); - } } //____________________________________________________________________________ @@ -1132,78 +1215,159 @@ void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocal() { // /// Match data and reconstructed Local Trigger decision - // - Bool_t firstFillXPosDev=kTRUE; - Bool_t firstFillYPosTrigY=kTRUE; - Bool_t firstFillLUT=kTRUE; + AliCodeTimerAuto("",0); - for (int localId=1;localId<235;localId++){ - if(fTriggerOutputLocalDataTriggerDec[localId]!=fTriggerOutputLocalRecTriggerDec[localId]){ - ((TH1F*)GetRawsData(kTriggerErrorLocalTriggerDec))->Fill(localId); - } - if(fTriggerOutputLocalDataTrigY[localId]!=fTriggerOutputLocalRecTrigY[localId]){ - if(fTriggerErrorLocalYCopy[localId]) continue; - ((TH1F*)GetRawsData(kTriggerErrorLocalTrigY))->Fill(localId); - if (firstFillYPosTrigY){ - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalY); - firstFillYPosTrigY=kFALSE; - } - } + Bool_t skipBoard[234]; + memset(skipBoard,0,AliMUONConstants::NTriggerCircuit()*sizeof(Bool_t)); - if(fTriggerOutputLocalDataYPos[localId]!=fTriggerOutputLocalRecYPos[localId]){ - if(fTriggerErrorLocalYCopy[localId]) continue; - ((TH1F*)GetRawsData(kTriggerErrorLocalYPos))->Fill(localId); - if (firstFillYPosTrigY){ - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalY); - firstFillYPosTrigY=kFALSE; - } - } - if(fTriggerOutputLocalDataXPos[localId]!=fTriggerOutputLocalRecXPos[localId]){ - ((TH1F*)GetRawsData(kTriggerErrorLocalXPos))->Fill(localId); - if (firstFillXPosDev){ - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalX); - firstFillXPosDev=kFALSE; - } - } - if(fTriggerOutputLocalDataDev[localId]!=fTriggerOutputLocalRecDev[localId]){ - ((TH1F*)GetRawsData(kTriggerErrorLocalDev))->Fill(localId); - if (firstFillXPosDev){ - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalX); - firstFillXPosDev=kFALSE; - } - } - if(fTriggerOutputLocalDataLPtDec[0][localId]!=fTriggerOutputLocalRecLPtDec[0][localId]){ - ((TH1F*)GetRawsData(kTriggerErrorLocalLPtLSB))->Fill(localId); - if (firstFillLUT){ - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalLUT); - firstFillLUT=kFALSE; - } - } - if(fTriggerOutputLocalDataLPtDec[1][localId]!=fTriggerOutputLocalRecLPtDec[1][localId]){ - ((TH1F*)GetRawsData(kTriggerErrorLocalLPtMSB))->Fill(localId); - if (firstFillLUT){ - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalLUT); - firstFillLUT=kFALSE; - } + Bool_t errorInYCopy = kFALSE; + + // First search for YCopy errors. + Int_t loCircuit = -1; + TIter next(fTriggerStoreReprocessRaw->CreateLocalIterator()); + AliMUONLocalTrigger* recoLocalTrigger = 0x0; + while ( ( recoLocalTrigger = static_cast(next()) ) ) + { + loCircuit = recoLocalTrigger->LoCircuit(); + // FIXME: skip copy boards for the moment + if ( loCircuit > AliMUONConstants::NTriggerCircuit() ) continue; + Int_t iboard = loCircuit - 1; + + FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest,loCircuit); + + AliMUONLocalTrigger* inputLocalTrigger = fTriggerStoreFromRaw->FindLocal(loCircuit); + + Int_t recoTrigPattern[4] = {recoLocalTrigger->GetY1Pattern(), recoLocalTrigger->GetY2Pattern(), recoLocalTrigger->GetY3Pattern(), recoLocalTrigger->GetY4Pattern()}; + Int_t inputTrigPattern[4] = {inputLocalTrigger->GetY1Pattern(), inputLocalTrigger->GetY2Pattern(), inputLocalTrigger->GetY3Pattern(), inputLocalTrigger->GetY4Pattern()}; + + AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board object for switch value + + Bool_t errorInCopyBoard = kFALSE; + for(Int_t ich=0; ich<4; ich++){ + if ( recoTrigPattern[ich] != inputTrigPattern[ich] ){ + skipBoard[iboard] = kTRUE; + if ( ich >=2 ){ + if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR0) ) + skipBoard[iboard+1] = kTRUE; + if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR1) ) + skipBoard[iboard-1] = kTRUE; } - if(fTriggerOutputLocalDataHPtDec[0][localId]!=fTriggerOutputLocalRecHPtDec[0][localId]){ - ((TH1F*)GetRawsData(kTriggerErrorLocalHPtLSB))->Fill(localId); - if (firstFillLUT){ - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalLUT); - firstFillLUT=kFALSE; - } + errorInCopyBoard = kTRUE; + errorInYCopy = kTRUE; + } + } // loop on chambers + if ( errorInCopyBoard ) + FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy,loCircuit); + } // loop on local boards + + if (errorInYCopy) + FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalYCopy); + + Bool_t errorInXPosDev = kFALSE; + Bool_t errorInYPosTrigY = kFALSE; + Bool_t errorInLUT = kFALSE; + + next.Reset(); + Bool_t respBendPlane, respNonBendPlane; + while ( ( recoLocalTrigger = static_cast(next()) ) ) + { + loCircuit = recoLocalTrigger->LoCircuit(); + // FIXME: skip copy boards for the moment + if ( loCircuit > AliMUONConstants::NTriggerCircuit() ) continue; + Int_t iboard = loCircuit - 1; + + AliMUONLocalTrigger* inputLocalTrigger = fTriggerStoreFromRaw->FindLocal(loCircuit); + + TString debugString = Form("Local board %i", loCircuit); + + // Fill ratio 44/34 histos (if not scaler event) + if ( CurrentEventSpecie() != AliRecoParam::kCalib ) { + Bool_t is34 = ( recoLocalTrigger->IsTrigX() && recoLocalTrigger->IsTrigY() ); + Bool_t is44 = TriggerElectronics()->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kTRUE); + if ( is34 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,loCircuit); + if ( is44 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,loCircuit); + + if ( is44 && ! is34 ) { + AliWarning(Form("Local board %i satisfies the 4/4 conditions but not the 3/4", loCircuit)); + debugString += Form(" is34 %i is44 %i is34_recalc %i", is34, is44, TriggerElectronics()->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kFALSE)); + debugString += Form(" isTrigX %i %i isTrigY %i %i Lpt %i %i Hpt %i %i", recoLocalTrigger->IsTrigX(), inputLocalTrigger->IsTrigX(), + recoLocalTrigger->IsTrigY(), inputLocalTrigger->IsTrigY(), + recoLocalTrigger->LoLpt(), inputLocalTrigger->LoLpt(), + recoLocalTrigger->LoHpt(), inputLocalTrigger->LoHpt()); + } + } + + if ( recoLocalTrigger->LoStripX() != inputLocalTrigger->LoStripX() ) { + FillRawsData(AliMUONQAIndices::kTriggerErrorLocalXPos,loCircuit); + errorInXPosDev = kTRUE; + debugString += Form(" errXpos (%i, %i)", recoLocalTrigger->LoStripX(), inputLocalTrigger->LoStripX()); + } + + if ( recoLocalTrigger->GetDeviation() != inputLocalTrigger->GetDeviation() ) { + FillRawsData(AliMUONQAIndices::kTriggerErrorLocalDev,loCircuit); + errorInXPosDev = kTRUE; + debugString += Form(" errXdev (%i, %i)", recoLocalTrigger->GetDeviation(), inputLocalTrigger->GetDeviation()); + } + + // Skip following checks in case we previously found YCopy error and YPos or trigY errors + if ( (!skipBoard[iboard]) || ( (recoLocalTrigger->LoStripY() == inputLocalTrigger->LoStripY()) && (recoLocalTrigger->LoTrigY() == inputLocalTrigger->LoTrigY())) ) { + + if ( recoLocalTrigger->GetLoDecision() != inputLocalTrigger->GetLoDecision() ) { + FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTriggerDec,loCircuit); + debugString += Form(" errDecision (%i, %i)", recoLocalTrigger->GetLoDecision(), inputLocalTrigger->GetLoDecision()); } - if(fTriggerOutputLocalDataHPtDec[1][localId]!=fTriggerOutputLocalRecHPtDec[1][localId]){ - ((TH1F*)GetRawsData(kTriggerErrorLocalHPtMSB))->Fill(localId); - if (firstFillLUT){ - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoLocalLUT); - firstFillLUT=kFALSE; - } + + // Test Hpt and LPT + Int_t recoLut[2] = { recoLocalTrigger->LoLpt(), recoLocalTrigger->LoHpt() }; + Int_t inputLut[2] = {inputLocalTrigger->LoLpt(), inputLocalTrigger->LoHpt() }; + Int_t currIndex[2][2] = {{AliMUONQAIndices::kTriggerErrorLocalLPtLSB, AliMUONQAIndices::kTriggerErrorLocalLPtMSB}, + {AliMUONQAIndices::kTriggerErrorLocalHPtMSB, AliMUONQAIndices::kTriggerErrorLocalHPtMSB}}; + for (Int_t ilut=0; ilut<2; ilut++){ + Int_t bitDiff = recoLut[ilut]^inputLut[ilut]; + if ( bitDiff == 0 ) continue; + debugString += Form(" errLUT[%i] (%i, %i)", ilut, recoLut[ilut], inputLut[ilut]); + for (Int_t ibit=0; ibit<2; ibit++){ + Bool_t isBitDifferent = (bitDiff>>ibit)&1; + if ( isBitDifferent ){ + FillRawsData(currIndex[ilut][ibit],loCircuit); + errorInLUT = kTRUE; + } + } } - } // loop over Local Boards -} + } + + + // Skip following checks in case we previously found YCopy errors + if ( ! skipBoard[iboard] ) { + if ( recoLocalTrigger->LoStripY() != inputLocalTrigger->LoStripY() ) { + FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYPos,loCircuit); + errorInYPosTrigY = kTRUE; + debugString += Form(" errYpos (%i, %i)", recoLocalTrigger->LoStripY(), inputLocalTrigger->LoStripY()); + } + + if ( recoLocalTrigger->LoTrigY() != inputLocalTrigger->LoTrigY() ) { + FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTrigY,loCircuit); + errorInYPosTrigY = kTRUE; + debugString += Form(" errYtrig (%i, %i)", recoLocalTrigger->LoTrigY(), inputLocalTrigger->LoTrigY()); + } + } + if ( debugString.Length() > 15 ) AliDebug(1,debugString.Data()); + } // loop on local boards + + + if (errorInXPosDev) + FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalX); + + if (errorInLUT) + FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalLUT); + + if (errorInYPosTrigY) + FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalY); + +} +/* //____________________________________________________________________________ void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional() { @@ -1226,28 +1390,186 @@ void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional() ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtMSB))->Fill(localId); } } - } +*/ + //____________________________________________________________________________ -void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobalFromInGlobal() +void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobal(AliMUONGlobalTrigger& inputGlobalTrigger, + AliMUONGlobalTrigger& recoGlobalTrigger, + Char_t histo) { // - /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs + /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs. + /// histo='G': fill FromGlobalInput histo='L': fill from Local input; // - Bool_t firstFill=kTRUE; + if ( recoGlobalTrigger.GetGlobalResponse() == inputGlobalTrigger.GetGlobalResponse() ) + return; + Int_t histoToFill; + Int_t binToFill; + + if (histo=='G'){ + histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal; + binToFill=AliMUONQAIndices::kAlgoGlobalFromGlobal; + }else{ + if (histo=='L'){ + histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal; + binToFill=AliMUONQAIndices::kAlgoGlobalFromLocal; + }else{ + AliWarning(Form("Global histos not filled, 3rd argument must be 'G' or 'L'")); + return; + } + } + FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,binToFill); + + Int_t inputResp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(), + inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(), + inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()}; + + Int_t recoResp[6] = {recoGlobalTrigger.PairUnlikeHpt(), recoGlobalTrigger.PairUnlikeLpt(), + recoGlobalTrigger.PairLikeHpt(), recoGlobalTrigger.PairLikeLpt(), + recoGlobalTrigger.SingleHpt(), recoGlobalTrigger.SingleLpt()}; + for (int bit=0;bit<6;bit++){ - if(fTriggerOutputGlobalData[bit]!=0){ - ((TH1F*)GetRawsData(kTriggerGlobalOutput))->Fill(5-bit); + if ( recoResp[bit] != inputResp[bit] ) + FillRawsData(histoToFill,bit); + } +} + +//____________________________________________________________________________ +void AliMUONTriggerQADataMakerRec::FillRatio4434Histos(Int_t evtInterval, Int_t itc, Bool_t isEndOfCycle) +{ + /// Fill ratio 44/34 histos + TH1* histoEvents = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc); + if ( ! histoEvents ) return; + Int_t numEvent = Int_t(histoEvents->GetBinContent(2)); + + // Fill every fgkUpdateRatio4434 events + if (numEvent % evtInterval != 0) + return; + + TH1* histo44dec = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerNumberOf44Dec,itc); + TH1* histo34dec = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerNumberOf34Dec,itc); + + if ( ! histo44dec || ! histo34dec ) return; // protection when running on calibration events only + + Float_t totalNumberOf44 = histo44dec->GetSumOfWeights(); + Float_t totalNumberOf34 = histo34dec->GetSumOfWeights(); + + if ( totalNumberOf34 == 0 ) + return; + + TH1* histoAllEvents = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc); + + if ( ! histoAllEvents ) return; + Int_t nbins = histoAllEvents->GetNbinsX(); + Float_t maxBin = histoAllEvents->GetXaxis()->GetBinLowEdge(nbins+1); + + if ( numEvent - maxBin < 1) return; + + // Use the underflow and overflow to store the number of 34 and 44 + // in previous event + Float_t previousNumOf34 = histoAllEvents->GetBinContent(0); + Float_t previousNumOf44 = histoAllEvents->GetBinContent(nbins+1); + + Float_t numOf34Update = totalNumberOf34 - previousNumOf34; + Float_t numOf44Update = totalNumberOf44 - previousNumOf44; + + // Not enough new tracks since last update + //if ( numOf34Update == 0 && numOf44Update == 0 ) + if ( numOf34Update < evtInterval - 1 ) + return; + + Int_t newNbins = ( (Int_t)maxBin % fgkUpdateRatio4434 ) ? nbins : nbins+1; + TString cloneName; + + TH1* histoRatioSinceLastUpdate = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc); + + TH1* histos[2] = {histoAllEvents, histoRatioSinceLastUpdate}; + + for (Int_t ihisto=0; ihisto<2; ihisto++){ + TH1* currHisto = histos[ihisto]; + cloneName = Form("%sClone", currHisto->GetName()); + TArrayD newAxis(newNbins+1); + for (Int_t ibin=0; ibinGetXaxis()->GetBinLowEdge(ibin+1); } - if(fTriggerOutputGlobalData[bit]!=fTriggerOutputGlobalRecFromGlobalInput[bit]){ - ((TH1F*)GetRawsData(kTriggerErrorOutGlobalFromInGlobal))->Fill(5-bit); - if (firstFill){ - ((TH1F*)GetRawsData(kTriggerError))->Fill(kAlgoGlobalFromGlobal); - firstFill=kFALSE; - } + newAxis[newNbins] = numEvent; + TH1F* copyHisto = (TH1F*)currHisto->Clone(cloneName.Data()); + //currHisto->SetBins(newNbins, 0., fgkUpdateRatio4434*newNbins); + currHisto->SetBins(newNbins, newAxis.GetArray()); + for (Int_t ibin=1; ibinSetBinContent(ibin, copyHisto->GetBinContent(ibin)); + currHisto->SetBinError(ibin, copyHisto->GetBinError(ibin)); + } + delete copyHisto; + } + + Float_t ratio4434 = totalNumberOf44/totalNumberOf34; + Float_t errorRatio4434 = ProtectedSqrt(totalNumberOf44*(1-ratio4434))/totalNumberOf34; + + histoAllEvents->SetBinContent(newNbins,ratio4434); + histoAllEvents->SetBinError(newNbins,errorRatio4434); + + Float_t ratio4434Update = 0.; + Float_t errorRatio4434Update = 0.; + + if(numOf34Update!=0){ + ratio4434Update = numOf44Update/numOf34Update; + if ( numOf44Update > numOf34Update ){ + AliWarning(Form("Number of 4/4 (%f) is higher than number of 3/4 (%f)", numOf44Update, numOf34Update)); } + errorRatio4434Update = ProtectedSqrt(numOf44Update*(1-ratio4434Update))/numOf34Update; } + + histoRatioSinceLastUpdate->SetBinContent(newNbins,ratio4434Update); + histoRatioSinceLastUpdate->SetBinError(newNbins,errorRatio4434Update); + + histoAllEvents->SetBinContent(0,totalNumberOf34); + histoAllEvents->SetBinContent(newNbins+1,totalNumberOf44); + +} + + +//____________________________________________________________________________ +AliMUONTriggerElectronics* AliMUONTriggerQADataMakerRec::TriggerElectronics() +{ + /// Return trigger electronics + /// (create it if necessary) + if ( ! fTriggerProcessor ) + fTriggerProcessor = new AliMUONTriggerElectronics(CalibrationData()); + return fTriggerProcessor; +} + + +//____________________________________________________________________________ +AliMUONCalibrationData* AliMUONTriggerQADataMakerRec::CalibrationData() +{ + /// Return calibration data + /// (create it if necessary) + if ( ! fCalibrationData ) fCalibrationData = new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun()); + return fCalibrationData; +} + +//____________________________________________________________________________ +AliMUONTriggerUtilities* AliMUONTriggerQADataMakerRec::TriggerUtilities() +{ + /// Return trigger utilities for masks + /// (create it if necessary) + if ( ! fTriggerUtils ) + fTriggerUtils = new AliMUONTriggerUtilities(CalibrationData()); + return fTriggerUtils; +} + +//____________________________________________________________________________ +void AliMUONTriggerQADataMakerRec::ResetDetectorRaws(TObjArray* list) +{ + /// Reset the calibration data + ResetDetector(list); + delete fTriggerProcessor; + fTriggerProcessor = 0x0; + delete fCalibrationData; + fCalibrationData = 0x0; }