]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
add task macro
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 May 2012 19:03:41 +0000 (19:03 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 May 2012 19:03:41 +0000 (19:03 +0000)
PWGGA/EMCALJetTasks/macros/AddTaskJetEmbedding.C [new file with mode: 0644]

diff --git a/PWGGA/EMCALJetTasks/macros/AddTaskJetEmbedding.C b/PWGGA/EMCALJetTasks/macros/AddTaskJetEmbedding.C
new file mode 100644 (file)
index 0000000..a528bce
--- /dev/null
@@ -0,0 +1,58 @@
+// $Id$
+
+AliJetEmbedding* AddTaskJetEmbedding(
+  const char     *tracksName   = "Tracks",
+  const char     *clusName     = "CaloClustersCorr",
+  const Float_t   minPt        = 50,
+  const Float_t   maxPt        = 60,
+  const Float_t   minEta       = -1,
+  const Float_t   maxEta       = 1,
+  const Float_t   minPhi       = 0,
+  const Float_t   maxPhi       = TMath::Pi() * 2,
+  const Int_t     nTracks      = 1,
+  const Int_t     nClus        = 0,
+  const Bool_t    copyArray    = kFALSE
+)
+{  
+  // Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr)
+  {
+    ::Error("AddTaskJetEmbedding", "No analysis manager to connect to.");
+    return NULL;
+  }  
+  
+  // Check the analysis type using the event handlers connected to the analysis manager.
+  //==============================================================================
+  if (!mgr->GetInputEventHandler())
+  {
+    ::Error("AddTaskJetEmbedding", "This task requires an input event handler");
+    return NULL;
+  }
+  
+  //-------------------------------------------------------
+  // Init the task and do settings
+  //-------------------------------------------------------
+
+  AliJetEmbedding *jetEmb = new AliJetEmbedding("AliJetEmbedding");
+  jetEmb->SetTracksName(tracksName);
+  jetEmb->SetClusName(clusName);
+  jetEmb->SetEtaRange(minEta, maxEta);
+  jetEmb->SetPhiRange(minPhi, maxPhi);
+  jetEmb->SetPtRange(minPt, maxPt);
+  jetEmb->SetCopyArray(copyArray);
+  jetEmb->SetNClusters(nClus);
+  jetEmb->SetNTracks(nTracks);
+
+  //-------------------------------------------------------
+  // Final settings, pass to manager and set the containers
+  //-------------------------------------------------------
+
+  mgr->AddTask(jetEmb);
+    
+  // Create containers for input/output
+  mgr->ConnectInput (jetEmb, 0, mgr->GetCommonInputContainer() );
+
+  return jetEmb;
+}