Commented unnecessary include AliLog
[u/mrichter/AliRoot.git] / TRD / AliTRDPreprocessorOffline.cxx
index c1f3cb1..c6e0ccc 100644 (file)
@@ -65,7 +65,9 @@
 #include "AliTRDCommonParam.h"
 #include "AliCDBManager.h"
 #include "AliCDBEntry.h"
-#include "AliTRDdEdxUtils.h"
+#include "AliTRDdEdxBaseUtils.h"
+#include "AliTRDdEdxCalibHistArray.h"
+#include "AliTRDdEdxCalibUtils.h"
 
 ClassImp(AliTRDPreprocessorOffline)
 
@@ -126,7 +128,8 @@ ClassImp(AliTRDPreprocessorOffline)
   fOutliersFitChargeLow(0.03),
   fOutliersFitChargeHigh(0.7),
   fBeginFitCharge(3.5),
-  fPHQon(kTRUE)
+  fPHQon(kTRUE),
+  fDebugPHQon(kFALSE)
 {
   //
   // default constructor
@@ -150,8 +153,8 @@ AliTRDPreprocessorOffline::~AliTRDPreprocessorOffline() {
   if(fSparse) delete fSparse;
 
   if(IsPHQon()){
-    AliTRDdEdxUtils::DeleteCalibHist();
-    AliTRDdEdxUtils::DeleteCalibObj();
+    AliTRDdEdxCalibUtils::DeleteHistArray();
+    AliTRDdEdxCalibUtils::DeleteObjArray();
   }
 
   if(fAliTRDCalibraVdriftLinearFit) delete fAliTRDCalibraVdriftLinearFit;
@@ -180,7 +183,7 @@ void AliTRDPreprocessorOffline::Process(const Char_t* file, Int_t startRunNumber
 
   if(IsPHQon()){
     printf("\n                  AliTRDPreprocessorOffline PHQ on!!\n\n");
-    AliTRDdEdxUtils::PrintControl();
+    AliTRDdEdxBaseUtils::PrintControl();
     CalibPHQ(file, startRunNumber, endRunNumber, ocdbStorage);
   }
   else{
@@ -493,7 +496,7 @@ Bool_t AliTRDPreprocessorOffline::ReadPHQGlobal(const Char_t* fileName)
   // read calibration entries from file
   //
 
-  return AliTRDdEdxUtils::ReadCalibHist(fileName, fNameList);
+  return AliTRDdEdxCalibUtils::ReadHistArray(fileName, fNameList);
 }
 
 //___________________________________________________________________________________________________________________
@@ -950,14 +953,35 @@ Bool_t AliTRDPreprocessorOffline::AnalyzePHQ(Int_t startRunNumber)
   //
   //Produce PHQ calibration results
   //
-  for(Int_t iter=0; iter<8; iter++){
-    THnSparseD *hi = (THnSparseD*) AliTRDdEdxUtils::GetHistPHQ()->At(iter);
-    TObjArray *obji = AliTRDdEdxUtils::GetCalibObj(hi, startRunNumber);
+  TList *lout = 0x0;
+  TTreeSRedirector *calibStream = 0x0;
+  if(IsDebugPHQon()){
+    lout = new TList;
+    lout->SetOwner();
+
+    calibStream = new TTreeSRedirector(Form("TRDCalibStream_%010d.root", startRunNumber));
+  }
+
+  for(Int_t iter=0; iter<AliTRDdEdxCalibUtils::GetHistArray()->GetSize(); iter++){
+    THnBase *hi = (THnBase*) AliTRDdEdxCalibUtils::GetHistAt(iter);
+    TObjArray *obji = AliTRDdEdxCalibUtils::HistToObj(hi, startRunNumber, lout, calibStream);
     //printf("test analyze %s\n", obji->GetName());
-    AliTRDdEdxUtils::GetObjPHQ()->AddAt(obji, iter);
+    AliTRDdEdxCalibUtils::GetObjArray()->AddAt(obji, iter);
+  }
+
+  fCalibObjects->AddAt(AliTRDdEdxCalibUtils::GetObjArray(), kPHQ);
+
+  if(lout){
+    TFile *fout=new TFile(Form("TRDCalibList_%010d.root", startRunNumber),"recreate");
+    fout->cd();
+    lout->Write();
+    fout->Save();
+    fout->Close();
+    delete fout;
   }
+  delete calibStream;
+  delete lout;
 
-  fCalibObjects->AddAt(AliTRDdEdxUtils::GetObjPHQ(), kPHQ);
   return kTRUE;
 }