message: PWG/Cocktail: fix to ensure backwards compatibility for reading mt scaling factors
diff: @@ -1308,17 +1308,7 @@ void AliGenEMlibV2::SetMtScalingFactors(TString fileName, TString dirName) {
  TFile* fMtFactorFile = TFile::Open(fileName.Data());
  TDirectory* fMtFactorDir = (TDirectory*)fMtFactorFile->Get(dirName.Data());
  - // check for mt scaling factor histo
  - TH1D* fMtFactorHistoTemp = NULL;
  - if (fMtFactorDir) fMtFactorHistoTemp = (TH1D*)fMtFactorDir->Get("histoMtScaleFactor");
  - if (fMtFactorHistoTemp && fMtFactorHistoTemp->GetNbinsX()==26) {
  - fMtFactorHisto = new TH1D(*fMtFactorHistoTemp);
  - for (Int_t i=1; i<27; i++) {
  - if (fMtFactorHisto->GetBinContent(i) < 0) {
  - fMtFactorHisto->SetBinContent(i, fgkMtFactor[selectedCol][i-1]);
  - }
  - }
  - } else {
  + // set bin labels
  fMtFactorHisto = new TH1D("histoMtScaleFactor", "", 26, 0.5, 26.5);
  fMtFactorHisto->GetYaxis()->SetTitle("mt scaling factor");
  fMtFactorHisto->GetXaxis()->SetBinLabel(1,"111");
  @@ -1347,11 +1337,32 @@ void AliGenEMlibV2::SetMtScalingFactors(TString fileName, TString dirName) {
  fMtFactorHisto->GetXaxis()->SetBinLabel(24,"3312");
  fMtFactorHisto->GetXaxis()->SetBinLabel(25,"3224");
  fMtFactorHisto->GetXaxis()->SetBinLabel(26,"3114");
  + fMtFactorHisto->SetDirectory(0);
  + // check for mt scaling factor histo
  + TH1D* fMtFactorHistoTemp = NULL;
  + if (fMtFactorDir) fMtFactorHistoTemp = (TH1D*)fMtFactorDir->Get("histoMtScaleFactor");
  + if (fMtFactorHistoTemp) {
  + AliGenEMlibV2 lib;
  + TRandom* rndm;
  + for (Int_t i=0; i<26; i++) {
  + Int_t ip = (Int_t)(lib.GetIp(i, ""))(rndm);
  + Double_t factor = 0.;
  + for (Int_t j=1; j<fMtFactorHistoTemp->GetNbinsX()+1; j++) {
  + factor = 0.;
  + TString tempLabel = Form("%s", fMtFactorHistoTemp->GetXaxis()->GetBinLabel(j));
  + if (tempLabel.Atoi()==ip) {
  + factor = fMtFactorHistoTemp->GetBinContent(j);
  + break;
  + }
  + }
  + if (factor>0) fMtFactorHisto->SetBinContent(i+1, factor);
  + else fMtFactorHisto->SetBinContent(i+1, fgkMtFactor[selectedCol][i]);
  + }
  + } else {
  for (Int_t i=1; i<27; i++)
  fMtFactorHisto->SetBinContent(i, fgkMtFactor[selectedCol][i-1]);
  }
  - fMtFactorHisto->SetDirectory(0);
  fMtFactorFile->Close();
  delete fMtFactorFile;
  