// default constructor
}
+//____________________________________________________________________
AliCorrectionMatrix::AliCorrectionMatrix(const Char_t* name, const Char_t* title) : TNamed(name, title),
fhMeas(0),
fhGene(0),
}
//____________________________________________________________________
-AliCorrectionMatrix::AliCorrectionMatrix(const AliCorrectionMatrix& c)
- : TNamed(c)
+AliCorrectionMatrix::AliCorrectionMatrix(const AliCorrectionMatrix& c) : TNamed(c),
+ fhMeas(0),
+ fhGene(0),
+ fhCorr(0)
{
// copy constructor
((AliCorrectionMatrix &)c).Copy(*this);
{
// assigment operator
- if (this != &c)
+ if (this != &c)
((AliCorrectionMatrix &) c).Copy(*this);
return *this;
//________________________________________________________________________
void AliCorrectionMatrix::SetAxisTitles(const Char_t* titleX, const Char_t* titleY, const Char_t* titleZ)
-{
+{
//
// method for setting the axis titles of the histograms
//
fhCorr->Divide(fhGene, fhMeas, 1, 1, "B");
+ Int_t emptyBins = 0;
+ for (Int_t x=1; x<=fhCorr->GetNbinsX(); ++x)
+ for (Int_t y=1; y<=fhCorr->GetNbinsY(); ++y)
+ for (Int_t z=1; z<=fhCorr->GetNbinsZ(); ++z)
+ if (fhCorr->GetBinContent(x, y, z) == 0)
+ ++emptyBins;
+
+ if (emptyBins > 0)
+ printf("INFO: In %s we have %d empty bins (of %d) in the correction map\n", GetName(), emptyBins, fhCorr->GetNbinsX() * fhCorr->GetNbinsY() * fhCorr->GetNbinsZ());
}
//____________________________________________________________________
-Bool_t AliCorrectionMatrix::LoadHistograms(Char_t* fileName, Char_t* dir)
+Bool_t AliCorrectionMatrix::LoadHistograms(const Char_t* fileName, const Char_t* dir)
{
//
// loads the histograms from a file
//
-
- TFile* fin = TFile::Open(fileName);
-
+
+ TFile* fin = TFile::Open(fileName);
+
if(!fin) {
//Info("LoadHistograms",Form(" %s file does not exist",fileName));
return kFALSE;
if(fhCorr) {delete fhCorr; fhCorr=0;}
if(fhMeas) {delete fhMeas; fhMeas=0;}
- fhMeas = (TH2F*)fin->Get(Form("%s/meas_%s", dir,GetName()));
- if(!fhMeas) Info("LoadHistograms","No meas hist available");
-
- fhGene = (TH2F*)fin->Get(Form("%s/gene_%s",dir, GetName()));
- if(!fhGene) Info("LoadHistograms","No gene hist available");
-
- fhCorr = (TH2F*)fin->Get(Form("%s/corr_%s",dir, GetName()));
- if(!fhCorr)
- {
- Info("LoadHistograms","No corr hist available");
+ fhMeas = dynamic_cast<TH1*> (fin->Get(Form("%s/meas_%s", dir,GetName())));
+ if(!fhMeas) Info("LoadHistograms","No meas. (%s) hist available",Form("%s/meas_%s", dir,GetName()));
+
+ fhGene = dynamic_cast<TH1*> (fin->Get(Form("%s/gene_%s",dir, GetName())));
+ if(!fhGene) Info("LoadHistograms","No gene. (%s) hist available",Form("%s/gene_%s",dir, GetName()));
+
+ fhCorr = dynamic_cast<TH1*> (fin->Get(Form("%s/corr_%s",dir, GetName())));
+ if(!fhCorr) {
+ Info("LoadHistograms","No corr.(%s) hist available",Form("%s/corr_%s",dir, GetName()));
return kFALSE;
}
// saves the histograms
//
- fhMeas ->Write();
- fhGene ->Write();
+ if (fhMeas)
+ fhMeas ->Write();
+
+ if (fhGene)
+ fhGene ->Write();
if (fhCorr)
fhCorr->Write();
// add: draw here the stat. errors of the correction histogram
}
+
+//____________________________________________________________________
+void AliCorrectionMatrix::ReduceInformation()
+{
+ // this function deletes the measured and generated histograms to reduce the amount of data
+ // in memory
+
+ if (fhMeas)
+ {
+ delete fhMeas;
+ fhMeas = 0;
+ }
+
+ if (fhGene)
+ {
+ delete fhGene;
+ fhGene = 0;
+ }
+}
+
+//____________________________________________________________________
+void AliCorrectionMatrix::Reset(Option_t* option)
+{
+ // resets the histograms
+
+ if (fhGene)
+ fhGene->Reset(option);
+
+ if (fhMeas)
+ fhMeas->Reset(option);
+
+ if (fhCorr)
+ fhCorr->Reset(option);
+}