Added possibility to redirec the output to special file (to avoid merging on CAF)
authorshahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Sep 2012 12:59:05 +0000 (12:59 +0000)
committershahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Sep 2012 12:59:05 +0000 (12:59 +0000)
ANALYSIS/AliPhysicsSelectionTask.cxx
ANALYSIS/AliPhysicsSelectionTask.h
ANALYSIS/macros/AddTaskPhysicsSelection.C

index ef6826a..def2598 100644 (file)
@@ -22,6 +22,7 @@ AliPhysicsSelectionTask::AliPhysicsSelectionTask() :
   AliAnalysisTaskSE("AliPhysicsSelectionTask"),
   fOutput(0),
   fOption(""),
+  fUseSpecialOutput(kFALSE),
   fPhysicsSelection(0)
 {
   //
@@ -33,6 +34,7 @@ AliPhysicsSelectionTask::AliPhysicsSelectionTask(const char* opt) :
   AliAnalysisTaskSE("AliPhysicsSelectionTask"),
   fOutput(0),
   fOption(opt),
+  fUseSpecialOutput(kFALSE),
   fPhysicsSelection(new AliPhysicsSelection())
 {
   //
@@ -45,6 +47,11 @@ AliPhysicsSelectionTask::AliPhysicsSelectionTask(const char* opt) :
   } else {
     AliError("No input event handler connected to analysis manager. No Physics Event Selection.");
   }
+  //
+  TString opts = opt;
+  opts.ToLower();
+  if (opts.Contains("specialoutput")) fUseSpecialOutput = kTRUE;
+
   // Define input and output slots here
   DefineOutput(1, TList::Class());
   fBranchNames = "ESD:AliESDRun.,AliESDHeader.,AliMultiplicity.,AliESDVZERO.,"
@@ -74,6 +81,8 @@ void AliPhysicsSelectionTask::UserCreateOutputObjects()
 
   Printf("AliPhysicsSelectionTask::CreateOutputObjects");
 
+  if (fUseSpecialOutput) OpenFile(1);
+
   fOutput = new TList;
   fOutput->SetOwner();
   
index 0860f5b..702c911 100644 (file)
@@ -27,11 +27,13 @@ class AliPhysicsSelectionTask : public AliAnalysisTaskSE {
     
     void SetPhysicsSelection(AliPhysicsSelection* physicsSelection) { fPhysicsSelection = physicsSelection; }
     AliPhysicsSelection* GetPhysicsSelection() const { return fPhysicsSelection; }
+    void   SetUseSpecialOutput(Bool_t v=kTRUE)         {fUseSpecialOutput = v;}
+    Bool_t GetUseSpecialOutput()               const { return fUseSpecialOutput; }
 
  protected:
     TList* fOutput;                  //! list send on output slot 1
     TString fOption;                 // option string  
-    
+    Bool_t  fUseSpecialOutput;       // do we use special output instead of merging?
     AliPhysicsSelection* fPhysicsSelection; // event selection class
 
  private:
index 7cefe9b..0bc42dd 100644 (file)
@@ -1,4 +1,4 @@
-AliPhysicsSelectionTask* AddTaskPhysicsSelection(Bool_t mCAnalysisFlag = kFALSE, Bool_t deprecatedFlag = kTRUE, UInt_t computeBG = 0) 
+AliPhysicsSelectionTask* AddTaskPhysicsSelection(Bool_t mCAnalysisFlag = kFALSE, Bool_t deprecatedFlag = kTRUE, UInt_t computeBG = 0, Bool_t useSpecialOutput=kFALSE) 
 {
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
@@ -19,8 +19,8 @@ AliPhysicsSelectionTask* AddTaskPhysicsSelection(Bool_t mCAnalysisFlag = kFALSE,
 
   // Configure analysis
   //===========================================================================
-  AliPhysicsSelectionTask *task = new AliPhysicsSelectionTask("");
-
+  AliPhysicsSelectionTask *task = new AliPhysicsSelectionTask();
+  task->SetUseSpecialOutput(useSpecialOutput); // RS: optionally use special output
   // this makes physics selection to work using AliMultiInputEventHandler
   if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
     AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
@@ -49,7 +49,9 @@ AliPhysicsSelectionTask* AddTaskPhysicsSelection(Bool_t mCAnalysisFlag = kFALSE,
                 TList::Class(),
                 AliAnalysisManager::kOutputContainer,
                 "EventStat_temp.root");
-               
+  //           
+  if (useSpecialOutput) coutput1->SetSpecialOutput(); // RS: optionally use special output
+  //
   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput(task,1,coutput1);