]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONTriggerChamberEfficiency.cxx
Adding code to patch St1 HV mapping
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerChamberEfficiency.cxx
index c0796d0ce6432651d2d849b311ea3a83e0ec1bf8..676b8e73b3fe84b69bf245b473bf5b5377d5c813 100755 (executable)
@@ -17,7 +17,6 @@
 
 #include "AliMUONTriggerEfficiencyCells.h"
 #include "AliMpConstants.h"
-#include "AliMUONConstants.h"
 
 // Classes for display
 #include "AliMUONTriggerDisplay.h"
@@ -138,6 +137,32 @@ Float_t AliMUONTriggerChamberEfficiency::GetCellEfficiency(Int_t detElemId, Int_
 }
 
 
+//__________________________________________________________________________
+Float_t AliMUONTriggerChamberEfficiency::GetCellEfficiencyError(Int_t detElemId, Int_t localBoard, Int_t hType, Int_t errType) const
+{
+  /// Get the efficiencie errors of the 2 cathodes at a given local board
+  /// errype 0 -> low error
+  /// errype 1 -> high error
+  
+  Int_t chamber = FindChamberIndex(detElemId);
+  Int_t index = GetIndex(kHboardEff, hType, chamber);
+  TGraphAsymmErrors* effGraph = ((TGraphAsymmErrors*)fEfficiencyObjects->At(index));
+  
+  // Some graphs are not available in the old implementation
+  if ( ! effGraph ) return -1.;
+
+  Float_t err = -1.;
+  if ( errType == 0 ) { // low error
+    err = effGraph->GetErrorYlow(localBoard-1);
+  }
+  else if ( errType == 1 ) { // up error
+    err = effGraph->GetErrorYhigh(localBoard-1);
+  }
+  
+  return err;
+}
+
+
 //__________________________________________________________________________
 void 
 AliMUONTriggerChamberEfficiency::IsTriggered(Int_t detElemId, Int_t localBoard, Bool_t &trigBend, Bool_t &trigNonBend) const
@@ -190,7 +215,7 @@ AliMUONTriggerChamberEfficiency::FillFromList(Bool_t useMeanValues)
     delete fEfficiencyObjects;
 
   const Int_t kNeffHistos = 
-    2 * ( AliMUONTriggerEfficiencyCells::kNcounts - 1 ) * AliMUONConstants::NTriggerCh();
+    2 * ( AliMUONTriggerEfficiencyCells::kNcounts - 1 ) * AliMpConstants::NofTriggerChambers();
 
   fEfficiencyObjects = new TObjArray(kNeffHistos);
   fEfficiencyObjects->SetOwner();
@@ -210,7 +235,7 @@ AliMUONTriggerChamberEfficiency::FillFromList(Bool_t useMeanValues)
     if ( useMeanValues && currDe == AliMUONTriggerEfficiencyCells::kHboardCount ) 
       continue;
 
-    for(Int_t ich=0; ich<AliMUONConstants::NTriggerCh(); ich++){
+    for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
       histoName = fEfficiencyMap->GetHistoName(currDe, AliMUONTriggerEfficiencyCells::kAllTracks, ich);
       if ( fEfficiencyMap->GetHistoList() ) {
        histoDen = (TH1F*)fEfficiencyMap->GetHistoList()->FindObject(histoName.Data());
@@ -239,12 +264,14 @@ AliMUONTriggerChamberEfficiency::FillFromList(Bool_t useMeanValues)
 
        index = GetIndex(deTypeEff[ide], hType, ich);
        TGraphAsymmErrors* effGraph = GetEfficiencyGraph(histoNum,histoDen);
-       histoName.ReplaceAll("Count","Eff");
-       effGraph->SetName(histoName.Data());
        fEfficiencyObjects->AddAt(effGraph, index);
-       AliDebug(5,Form("Adding object %s (%s/%s) at index %i",effGraph->GetName(),histoNum->GetName(),histoDen->GetName(),index));
 
-       if ( useMeanValues ){
+       TString debugString = Form("Adding object %s",effGraph->GetName());
+       if ( histoDen ) debugString += Form(" (%s/%s)",histoNum->GetName(),histoDen->GetName());
+       debugString += Form(" index %i",index);
+       AliDebug(5,debugString.Data());
+
+       if ( useMeanValues && rebuildEfficiency ){
          Int_t currChamber = ich + AliMpConstants::NofTrackingChambers();
          histoName = fEfficiencyMap->GetHistoName(AliMUONTriggerEfficiencyCells::kHboardCount, hType, ich);
          TH1F* auxHistoNum = (TH1F*)fEfficiencyMap->GetHistoList()->FindObject(histoName.Data())->Clone("tempHistoNum");
@@ -258,8 +285,6 @@ AliMUONTriggerChamberEfficiency::FillFromList(Bool_t useMeanValues)
          }
          index = GetIndex(kHboardEff, hType, ich);
          effGraph = GetEfficiencyGraph(auxHistoNum,auxHistoDen);
-         histoName.ReplaceAll("Count","Eff");
-         effGraph->SetName(histoName.Data());
          fEfficiencyObjects->AddAt(effGraph, index);
          AliDebug(5,Form("Adding object %s (%s/%s) at index %i",effGraph->GetName(),histoNum->GetName(),histoDen->GetName(),index));
          delete auxHistoNum;
@@ -315,7 +340,7 @@ void AliMUONTriggerChamberEfficiency::DisplayEfficiency(Bool_t perSlat, Bool_t s
   TGraph* graph = 0x0;
 
   // Book histos
-  for(Int_t ich=0; ich<AliMUONConstants::NTriggerCh(); ich++){
+  for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
     Int_t currCh = 11 + ich;
     for(Int_t hType=0; hType<AliMUONTriggerEfficiencyCells::kNcounts - 1; hType++){
       index = GetIndex(deType, hType, ich);
@@ -324,7 +349,7 @@ void AliMUONTriggerChamberEfficiency::DisplayEfficiency(Bool_t perSlat, Bool_t s
       histoName = graph->GetName();
       histoName += baseCanName;
       Int_t shift = 10*(index%((AliMUONTriggerEfficiencyCells::kNcounts - 1)*
-                              AliMUONConstants::NTriggerCh()));
+                              AliMpConstants::NofTriggerChambers()));
       can = new TCanvas(histoName.Data(), histoName.Data(), 100+shift, shift, 700, 700);
       can->SetRightMargin(0.14);
       can->SetLeftMargin(0.12);
@@ -394,7 +419,7 @@ AliMUONTriggerChamberEfficiency::GetIndex(Int_t histoType, Int_t countType,
   //
 
   const Int_t kNtypes = AliMUONTriggerEfficiencyCells::kNcounts - 1;
-  const Int_t kNchambers = AliMUONConstants::NTriggerCh();
+  const Int_t kNchambers = AliMpConstants::NofTriggerChambers();
   return 
     histoType * kNtypes * kNchambers + 
     chamber * kNtypes +
@@ -403,6 +428,19 @@ AliMUONTriggerChamberEfficiency::GetIndex(Int_t histoType, Int_t countType,
   //chamber;
 }
 
+
+//_____________________________________________________________________________
+TObject* AliMUONTriggerChamberEfficiency::GetEffObject(Int_t histoType, Int_t countType, 
+                                                                 Int_t chamber)
+{
+  //
+  /// Get efficiency object
+  //
+  Int_t index = GetIndex(histoType, countType, chamber);
+  return fEfficiencyObjects->At(index);
+}
+
+
 //_____________________________________________________________________________
 TGraphAsymmErrors* AliMUONTriggerChamberEfficiency::GetEfficiencyGraph(TH1* histoNum, TH1* histoDen)
 {
@@ -413,11 +451,15 @@ TGraphAsymmErrors* AliMUONTriggerChamberEfficiency::GetEfficiencyGraph(TH1* hist
   //
 
   TGraphAsymmErrors* auxGraph = 0x0;
-  if ( histoDen ) auxGraph = new TGraphAsymmErrors(histoNum,histoDen);
+  if ( histoDen ) auxGraph = new TGraphAsymmErrors(histoNum,histoDen,"cp");
   else auxGraph = new TGraphAsymmErrors(histoNum);
 
   Int_t npoints = histoNum->GetNbinsX();
   TGraphAsymmErrors* effGraph = new TGraphAsymmErrors(npoints);
+  TString histoName = histoNum->GetName();
+  histoName.ReplaceAll("Count","Eff");
+  effGraph->SetName(histoName.Data());
+  effGraph->SetTitle(histoName.Data());
   Double_t oldX, oldY;
   for ( Int_t ibin=0; ibin<npoints; ibin++ ) {
     Int_t foundPoint = -1;