add task macro
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 May 2012 08:58:43 +0000 (08:58 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 May 2012 08:58:43 +0000 (08:58 +0000)
PWGGA/EMCALJetTasks/macros/AddTaskJetResponseMaker.C [new file with mode: 0644]

diff --git a/PWGGA/EMCALJetTasks/macros/AddTaskJetResponseMaker.C b/PWGGA/EMCALJetTasks/macros/AddTaskJetResponseMaker.C
new file mode 100644 (file)
index 0000000..e04ec9f
--- /dev/null
@@ -0,0 +1,71 @@
+// $Id$
+
+AliJetResponseMaker* AddTaskJetResponseMaker(
+  const char *taskname           = "AliJetResponseMaker",
+  const char *ntracks            = "Tracks",
+  const char *nclusters          = "CaloClusters",
+  const char *njets              = "Jets",
+  const char *nmcjets            = "MCJets",
+  const char *nmctracks          = "MCParticles",
+  Double_t    jetradius          = 0.4,
+  Double_t    jetptcut           = 1,
+  Double_t    jetareacut         = 0.2,
+  Double_t    ptcut              = 0.15,
+  Double_t    jetBiasTrack       = 10,
+  Double_t    jetBiasClus        = 10,
+  UInt_t      type               = AliAnalysisTaskEmcal::kTPC
+)
+{  
+  // Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr)
+  {
+    ::Error("AddTaskJetResponseMaker", "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("AddTaskJetResponseMaker", "This task requires an input event handler");
+    return NULL;
+  }
+  
+  //-------------------------------------------------------
+  // Init the task and do settings
+  //-------------------------------------------------------
+
+  AliJetResponseMaker* jetTask = new AliJetResponseMaker(taskname);
+  jetTask->SetAnaType(type);
+  jetTask->SetTracksName(ntracks);
+  jetTask->SetClusName(nclusters);
+  jetTask->SetJetsName(njets);
+  jetTask->SetMCJetsName(nmcjets);
+  jetTask->SetMCTracksName(nmctracks);
+  jetTask->SetPtCut(ptcut);
+  jetTask->SetJetRadius(jetradius);
+  jetTask->SetJetPtCut(jetptcut);
+  jetTask->SetJetAreaCut(jetareacut);
+  jetTask->SetPtBiasJetTrack(jetBiasTrack);
+  jetTask->SetPtBiasJetClus(jetBiasClus);
+  
+  //-------------------------------------------------------
+  // Final settings, pass to manager and set the containers
+  //-------------------------------------------------------
+  
+  mgr->AddTask(jetTask);
+  
+  // Create containers for input/output
+  AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer()  ;
+  TString contname(taskname);
+  contname += "_histos";
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), 
+                                                           TList::Class(),AliAnalysisManager::kOutputContainer,
+                                                           Form("%s", AliAnalysisManager::GetCommonFileName()));
+  mgr->ConnectInput  (jetTask, 0,  cinput1 );
+  mgr->ConnectOutput (jetTask, 1, coutput1 );
+  
+  return jetTask;
+}