restructure the output container for the TPC calib
authormkrzewic <mkrzewic@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Dec 2012 11:01:55 +0000 (11:01 +0000)
committermkrzewic <mkrzewic@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Dec 2012 11:01:55 +0000 (11:01 +0000)
  use TDirectory now instead of TObjArray to
  avoid loading the full TPC calibration in memory
  during merging - [Ali|T]FileMerger will load and merge
  every component separately.

PWGPP/CalibMacros/CPass0/AddTaskTPCCalib.C
PWGPP/CalibMacros/CPass1/AddTaskTPCCalib.C
TPC/AliTPCAnalysisTaskcalib.cxx
TPC/AliTPCPreprocessorOffline.cxx

index 2fd228d..92a790b 100644 (file)
@@ -38,40 +38,61 @@ AliAnalysisTask  *AddTaskTPCCalib(Int_t runNumber)
   // set TPC OCDB parameters
   ConfigOCDB(runNumber);
 
-  // setup task
+  // setup task TPCCalib
+  TString outputFileName=mgr->GetCommonFileName();
   AliTPCAnalysisTaskcalib *task1=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1");
   SetupCalibTaskTrain1(task1);
   mgr->AddTask(task1);
-  //
-
   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
   if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
                                       AliAnalysisManager::kInputContainer);
-  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("TPCCalib",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
-
+  for (Int_t i=0; i<task1->GetJobs()->GetEntries(); i++) {
+    if (task1->GetJobs()->At(i)) {
+      AliAnalysisDataContainer* coutput = mgr->CreateContainer(task1->GetJobs()->At(i)->GetName(),
+                                                               AliTPCcalibBase::Class(), 
+                                                               AliAnalysisManager::kOutputContainer, 
+                                                               "AliESDfriends_v1.root:TPCCalib"); 
+      mgr->ConnectOutput(task1,i,coutput);
+    }
+  }
   mgr->ConnectInput(task1,0,cinput1);
-  mgr->ConnectOutput(task1,0,coutput1);
-  //
-  //
   //
+  // setup task TPCAlign
   AliTPCAnalysisTaskcalib *taskAlign=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1");
   SetupCalibTaskTrainAlign(taskAlign);
   mgr->AddTask(taskAlign);
-  AliAnalysisDataContainer *cinputAlign = mgr->GetCommonInputContainer();
-  if (!cinputAlign) cinputAlign = mgr->CreateContainer("cchain",TChain::Class(), 
+  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+  if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
                                       AliAnalysisManager::kInputContainer);
-  AliAnalysisDataContainer *coutputAlign = mgr->CreateContainer("TPCAlign",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
-  mgr->ConnectInput(taskAlign,0,cinputAlign);
-  mgr->ConnectOutput(taskAlign,0,coutputAlign);
+  for (Int_t i=0; i<taskAlign->GetJobs()->GetEntries(); i++) {
+    if (taskAlign->GetJobs()->At(i)) {
+      AliAnalysisDataContainer* coutput = mgr->CreateContainer(taskAlign->GetJobs()->At(i)->GetName(),
+                                                               AliTPCcalibBase::Class(), 
+                                                               AliAnalysisManager::kOutputContainer, 
+                                                               "AliESDfriends_v1.root:TPCAlign"); 
+      mgr->ConnectOutput(taskAlign,i,coutput);
+    }
+  }
+  mgr->ConnectInput(taskAlign,0,cinput1);
   //
+  // setup task TPCCluster
   AliTPCAnalysisTaskcalib *taskCluster=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1");
   SetupCalibTaskTrainCluster(taskCluster);
   mgr->AddTask(taskCluster);
-  AliAnalysisDataContainer *coutputAlign = mgr->CreateContainer("TPCCluster",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
+  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+  if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
+                                      AliAnalysisManager::kInputContainer);
+  for (Int_t i=0; i<taskCluster->GetJobs()->GetEntries(); i++) {
+    if (taskCluster->GetJobs()->At(i)) {
+      AliAnalysisDataContainer* coutput = mgr->CreateContainer(taskCluster->GetJobs()->At(i)->GetName(),
+                                                               AliTPCcalibBase::Class(), 
+                                                               AliAnalysisManager::kOutputContainer, 
+                                                               "AliESDfriends_v1.root:TPCCluster"); 
+      mgr->ConnectOutput(taskCluster,i,coutput);
+    }
+  }
   mgr->ConnectInput(taskCluster,0,cinput1);
-  mgr->ConnectOutput(taskCluster,0,coutputAlign);
-
-
+  //
 
   return task1;
 }
index 2764188..6d664c0 100644 (file)
@@ -38,37 +38,61 @@ AliAnalysisTask  *AddTaskTPCCalib(Int_t runNumber)
   // set TPC OCDB parameters
   ConfigOCDB(runNumber);
 
-  // setup task
+  // setup task TPCCalib
+  TString outputFileName=mgr->GetCommonFileName();
   AliTPCAnalysisTaskcalib *task1=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1");
   SetupCalibTaskTrain1(task1);
   mgr->AddTask(task1);
-
   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
   if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
                                       AliAnalysisManager::kInputContainer);
-  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("TPCCalib",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
-
+  for (Int_t i=0; i<task1->GetJobs()->GetEntries(); i++) {
+    if (task1->GetJobs()->At(i)) {
+      AliAnalysisDataContainer* coutput = mgr->CreateContainer(task1->GetJobs()->At(i)->GetName(),
+                                                               AliTPCcalibBase::Class(), 
+                                                               AliAnalysisManager::kOutputContainer, 
+                                                               "AliESDfriends_v1.root:TPCCalib"); 
+      mgr->ConnectOutput(task1,i,coutput);
+    }
+  }
   mgr->ConnectInput(task1,0,cinput1);
-  mgr->ConnectOutput(task1,0,coutput1);
-
+  //
+  // setup task TPCAlign
   AliTPCAnalysisTaskcalib *taskAlign=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1");
   SetupCalibTaskTrainAlign(taskAlign);
   mgr->AddTask(taskAlign);
-
-  AliAnalysisDataContainer *cinputAlign = mgr->GetCommonInputContainer();
-  if (!cinputAlign) cinputAlign = mgr->CreateContainer("cchain",TChain::Class(), 
+  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+  if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
                                       AliAnalysisManager::kInputContainer);
-  AliAnalysisDataContainer *coutputAlign = mgr->CreateContainer("TPCAlign",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
-
-  mgr->ConnectInput(taskAlign,0,cinputAlign);
-  mgr->ConnectOutput(taskAlign,0,coutputAlign);
-
+  for (Int_t i=0; i<taskAlign->GetJobs()->GetEntries(); i++) {
+    if (taskAlign->GetJobs()->At(i)) {
+      AliAnalysisDataContainer* coutput = mgr->CreateContainer(taskAlign->GetJobs()->At(i)->GetName(),
+                                                               AliTPCcalibBase::Class(), 
+                                                               AliAnalysisManager::kOutputContainer, 
+                                                               "AliESDfriends_v1.root:TPCAlign"); 
+      mgr->ConnectOutput(taskAlign,i,coutput);
+    }
+  }
+  mgr->ConnectInput(taskAlign,0,cinput1);
+  //
+  // setup task TPCCluster
   AliTPCAnalysisTaskcalib *taskCluster=new AliTPCAnalysisTaskcalib("CalibObjectsTrain1");
   SetupCalibTaskTrainCluster(taskCluster);
   mgr->AddTask(taskCluster);
-  AliAnalysisDataContainer *coutputAlign = mgr->CreateContainer("TPCCluster",TObjArray::Class(), AliAnalysisManager::kOutputContainer, "AliESDfriends_v1.root");  
+  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+  if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
+                                      AliAnalysisManager::kInputContainer);
+  for (Int_t i=0; i<taskCluster->GetJobs()->GetEntries(); i++) {
+    if (taskCluster->GetJobs()->At(i)) {
+      AliAnalysisDataContainer* coutput = mgr->CreateContainer(taskCluster->GetJobs()->At(i)->GetName(),
+                                                               AliTPCcalibBase::Class(), 
+                                                               AliAnalysisManager::kOutputContainer, 
+                                                               "AliESDfriends_v1.root:TPCCluster"); 
+      mgr->ConnectOutput(taskCluster,i,coutput);
+    }
+  }
   mgr->ConnectInput(taskCluster,0,cinput1);
-  mgr->ConnectOutput(taskCluster,0,coutputAlign);
+  //
 
   return task1;
 }
index 2c87b09..28b74cd 100644 (file)
@@ -62,7 +62,12 @@ AliTPCAnalysisTaskcalib::AliTPCAnalysisTaskcalib(const char *name)
   // Constructor
   //
   DefineInput(0, TChain::Class());
-  DefineOutput(0, TObjArray::Class());
+  DefineOutput(0, AliTPCcalibBase::Class());
+  DefineOutput(1, AliTPCcalibBase::Class());
+  DefineOutput(2, AliTPCcalibBase::Class());
+  DefineOutput(3, AliTPCcalibBase::Class());
+  DefineOutput(4, AliTPCcalibBase::Class());
+  DefineOutput(5, AliTPCcalibBase::Class());
   fCalibJobs = new TObjArray(0);
   fCalibJobs->SetOwner(kTRUE);
 }
@@ -106,7 +111,6 @@ void AliTPCAnalysisTaskcalib::Exec(Option_t *) {
     if (seed)
       Process(seed);
   }
-  PostData(0,fCalibJobs);
 }
 
 void AliTPCAnalysisTaskcalib::ConnectInputData(Option_t *) {
@@ -135,7 +139,11 @@ void AliTPCAnalysisTaskcalib::CreateOutputObjects() {
   //
   //OpenFile(0, "RECREATE");
 
-  PostData(0,fCalibJobs);
+  for (Int_t i=0; i<fCalibJobs->GetEntries(); i++)
+  {
+    if (fCalibJobs->At(i))
+      PostData(i,(AliTPCcalibBase*)fCalibJobs->At(i));
+  }
 }
 
 void AliTPCAnalysisTaskcalib::Terminate(Option_t */*option*/) {
index 54a595c..eebaccc 100644 (file)
@@ -51,6 +51,7 @@
 #include "TGraphErrors.h"
 #include "AliExternalTrackParam.h"
 #include "TFile.h"
+#include "TDirectory.h"
 #include "TGraph.h"
 #include "TMultiGraph.h"
 #include "TCanvas.h"
@@ -192,8 +193,13 @@ void AliTPCPreprocessorOffline::CalibTimeVdrift(const Char_t* file, Int_t ustart
   //
   // 1. Initialization and run range setting
   TFile fcalib(file);
-  TObjArray * array = (TObjArray*)fcalib.Get("TPCCalib");
-  if (array){
+  TObject* obj = dynamic_cast<TObject*>(fcalib.Get("TPCCalib"));
+  TObjArray* array = dynamic_cast<TObjArray*>(obj);
+  TDirectory* dir = dynamic_cast<TDirectory*>(obj);
+  if (dir) {
+    fTimeDrift = dynamic_cast<AliTPCcalibTime*>(dir->Get("calibTime"));
+  }
+  else if (array){
     fTimeDrift = (AliTPCcalibTime *)array->FindObject("calibTime");
   } else {
     fTimeDrift = (AliTPCcalibTime*)fcalib.Get("calibTime");
@@ -918,8 +924,15 @@ void AliTPCPreprocessorOffline::ReadGainGlobal(const Char_t* fileName){
   // read calibration entries from file
   // 
   TFile fcalib(fileName);
-  TObjArray * array = (TObjArray*)fcalib.Get("TPCCalib");
-  if (array){
+  TObject* obj = dynamic_cast<TObject*>(fcalib.Get("TPCCalib"));
+  TObjArray * array = dynamic_cast<TObjArray*>(obj);
+  TDirectory * dir = dynamic_cast<TDirectory*>(obj);
+  if (dir) {
+    fGainMIP    = dynamic_cast<AliTPCcalibTimeGain *>(dir->Get("calibTimeGain"));
+    fGainCosmic = dynamic_cast<AliTPCcalibTimeGain *>(dir->Get("calibTimeGainCosmic"));
+    fGainMult   = dynamic_cast<AliTPCcalibGainMult *>(dir->Get("calibGainMult"));
+  }
+  else if (array){
     fGainMIP    = ( AliTPCcalibTimeGain *)array->FindObject("calibTimeGain");
     fGainCosmic = ( AliTPCcalibTimeGain *)array->FindObject("calibTimeGainCosmic");
     fGainMult   = ( AliTPCcalibGainMult *)array->FindObject("calibGainMult");
@@ -1362,8 +1375,13 @@ void AliTPCPreprocessorOffline::MakeChainTime(){
   const char * hname[5]={"dy","dz","dsnp","dtheta","d1pt"};
   Int_t run=0;
   AliTPCcalibTime  *calibTime = 0;
-  TObjArray * array = (TObjArray*)f.Get("TPCCalib");
-  if (array){
+  TObject* obj = dynamic_cast<TObject*>(f.Get("TPCCalib"));
+  TObjArray * array = dynamic_cast<TObjArray*>(obj);
+  TDirectory * dir = dynamic_cast<TDirectory*>(obj);
+  if (dir) {
+    calibTime = dynamic_cast<AliTPCcalibTime*>(dir->Get("calibTime"));
+  }
+  else if (array){
     calibTime = (AliTPCcalibTime *)array->FindObject("calibTime");
   } else {
     calibTime = (AliTPCcalibTime*)f.Get("calibTime");