Small corrections to the TENDER code, which will support AliTenderInputHander(current...
authormvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Feb 2011 10:55:54 +0000 (10:55 +0000)
committermvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Feb 2011 10:55:54 +0000 (10:55 +0000)
ANALYSIS/Tender/AliTender.cxx
ANALYSIS/Tender/AliTender.h
ANALYSIS/TenderSupplies/AliTPCTenderSupply.cxx
ANALYSIS/TenderSupplies/AliTRDTenderSupply.cxx

index c985362..092e7c5 100644 (file)
@@ -90,8 +90,12 @@ void AliTender::ConnectInputData(Option_t* option)
 {
 // Connect the input data, create CDB manager.
   if (fDebug > 1) Printf("AliTender::ConnectInputData()\n");
-  AliAnalysisTaskSE::ConnectInputData(option);
-  fESDhandler = dynamic_cast<AliESDInputHandler *>(fInputHandler);
+  
+  if (!fESDhandler) { 
+    AliAnalysisTaskSE::ConnectInputData(option);
+    fESDhandler = dynamic_cast<AliESDInputHandler *>(fInputHandler);
+  }
+  
   if (fESDhandler) {
      fESD = fESDhandler->GetEvent();
   } else {
@@ -126,7 +130,7 @@ void AliTender::UserCreateOutputObjects()
 }
 
 //______________________________________________________________________________
-void AliTender::UserExec(Option_t* /*option*/)
+void AliTender::UserExec(Option_t* option)
 {
 //
 // Execute all supplied analysis of one event. Notify run change via RunChanged().
@@ -154,7 +158,9 @@ void AliTender::UserExec(Option_t* /*option*/)
 
   // Lock CDB
   fCDBkey = fCDB->SetLock(kTRUE, fCDBkey);
-  PostData(1, fESD);
+  
+  TString opt = option;
+  if (!opt.Contains("NoPost")) PostData(1, fESD);
 }
 
 //______________________________________________________________________________
index a485004..171c487 100644 (file)
@@ -17,6 +17,9 @@
 #include "AliAnalysisTaskSE.h"
 #endif
 
+// #ifndef ALIESDINPUTHANDLER_H
+// #include "AliESDInputHandler.h"
+// #endif
 class AliCDBManager;
 class AliESDEvent;
 class AliESDInputHandler;
@@ -58,6 +61,7 @@ public:
   Bool_t                    RunChanged() const {return fRunChanged;}
   // Configuration
   void                      SetDefaultCDBStorage(const char *dbString="local://$ALICE_ROOT/OCDB");
+  void SetESDhandler(AliESDInputHandler*esdH) {fESDhandler = esdH;}
 
   // Run control
   virtual void              ConnectInputData(Option_t *option = "");
index c838be2..7865473 100644 (file)
@@ -209,7 +209,10 @@ void AliTPCTenderSupply::SetSplines()
   //
   //find previous entry from the UserInfo
   //
-  TTree *tree=((TChain*)fTender->GetInputData(0))->GetTree();
+//   TTree *tree=((TChain*)fTender->GetInputData(0))->GetTree();
+  AliAnalysisManager*mgr = AliAnalysisManager::GetAnalysisManager();
+  AliAnalysisTaskSE *task = (AliAnalysisTaskSE*)mgr->GetTasks()->First();
+  TTree *tree=((TChain*)task->GetInputData(0))->GetTree();
   if (!tree) {
     AliError("Tree not found in ESDhandler");
     return;
@@ -340,7 +343,10 @@ void AliTPCTenderSupply::SetParametrisation()
   }
 
   //Get the current file to check the reconstruction pass (UGLY, but not stored in ESD... )
-  TFile *file=((TChain*)fTender->GetInputData(0))->GetCurrentFile();
+  AliESDInputHandler *esdIH = dynamic_cast<AliESDInputHandler*> (fTender->GetESDhandler());
+  if (!esdIH) return;
+  TTree *tree= (TTree*)esdIH->GetTree();
+  TFile *file= (TFile*) tree->GetCurrentFile();
   if (!file) {
     AliError("File not found, not changing parametrisation");
     return;
index a2ed327..404fdf1 100644 (file)
@@ -168,7 +168,10 @@ void AliTRDTenderSupply::SetChamberGain(){
   //
   
   //find previous entry from the UserInfo
-  TTree *tree=((TChain*)fTender->GetInputData(0))->GetTree();
+  //   TTree *tree=((TChain*)fTender->GetInputData(0))->GetTree();
+  AliAnalysisManager*mgr = AliAnalysisManager::GetAnalysisManager();
+  AliAnalysisTaskSE *task = (AliAnalysisTaskSE*)mgr->GetTasks()->First();
+  TTree *tree=((TChain*)task->GetInputData(0))->GetTree();
   if (!tree) {
   AliError("Tree not found in ESDhandler");
     return;