}
//__________________________________________________________________________
-AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(const Char_t* filename)
+AliMUONTriggerEfficiencyCells::AliMUONTriggerEfficiencyCells(const Char_t* filename, const Char_t* listname)
:
TObject(),
fCountHistoList(0x0),
CheckConstants();
Reset();
InitHistos();
- ReadFile(filename);
+ ReadFile(filename, listname);
}
AliMUONTriggerEfficiencyCells::~AliMUONTriggerEfficiencyCells()
{
/// Destructor.
-
- delete [] fBoardEfficiency;
- delete [] fSlatEfficiency;
Reset();
}
//__________________________________________________________________________
-void AliMUONTriggerEfficiencyCells::ReadFile(const Char_t* filename)
+void AliMUONTriggerEfficiencyCells::ReadFile(const Char_t* filename, const Char_t* listname)
{
/// Reads a file containing the efficiency map.
TString fileName = gSystem->ExpandPathName(filename);
if(fileName.EndsWith(".root")){
- ReadHistoBoards(fileName.Data());
+ ReadHistoBoards(fileName.Data(), listname);
return;
}
//__________________________________________________________________________
-void AliMUONTriggerEfficiencyCells::ReadHistoBoards(const Char_t *filename)
+void AliMUONTriggerEfficiencyCells::ReadHistoBoards(const Char_t *filename, const Char_t* listname)
{
/// Structure of file (.root) containing local board efficency
TFile *file = new TFile(filename, "read");
enum {kAllChEff, kChNonEff, kNumOfHistoTypes};
TString histoTypeName[2] = {"CountInCh", "NonCountInCh"};
- if(!fCountHistoList) fCountHistoList = new TList();
+ if ( ! fCountHistoList ) {
+ fCountHistoList = new TList();
+ fCountHistoList->SetOwner();
+ }
else fCountHistoList->Delete();
- if(!fNoCountHistoList) fNoCountHistoList = new TList();
+ if( ! fNoCountHistoList) {
+ fNoCountHistoList = new TList();
+ fNoCountHistoList->SetOwner();
+ }
else fNoCountHistoList->Delete();
TList *currList[2] = {fCountHistoList, fNoCountHistoList};
TH1F *histo = 0x0;
+
+ TList* listInFile = 0x0;
+ TString listNameString(listname);
+ if ( ! listNameString.IsNull() )
+ listInFile = (TList*)file->Get(listname);
for(Int_t cath=0; cath<fgkNcathodes; cath++){
for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
histoName = Form("%sChamber%s", cathCode[cath].Data(), histoTypeName[hType].Data());
- histo = (TH1F*)file->Get(histoName.Data());
+ histo = ( listInFile ) ? (TH1F*)listInFile->FindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data());
+ histo->SetDirectory(0);
currList[hType]->Add(histo);
}
}
for(Int_t ch=0; ch<fgkNchambers; ch++){
for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
histoName = Form("%sSlat%s%i", cathCode[cath].Data(), histoTypeName[hType].Data(), 11+ch);
- histo = (TH1F*)file->Get(histoName.Data());
+ histo = ( listInFile ) ? (TH1F*)listInFile->FindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data());
+ histo->SetDirectory(0);
currList[hType]->Add(histo);
}
}
for(Int_t ch=0; ch<fgkNchambers; ch++){
for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
histoName = Form("%sBoard%s%i", cathCode[cath].Data(), histoTypeName[hType].Data(), 11+ch);
- histo = (TH1F*)file->Get(histoName.Data());
+ histo = ( listInFile ) ? (TH1F*)listInFile->FindObject(histoName.Data()) : (TH1F*)file->Get(histoName.Data());
+ histo->SetDirectory(0);
currList[hType]->Add(histo);
}
}
}
+ file->Close();
+
FillHistosFromList();
}