]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/macros/AddTaskJetTriggerSelection.C
new task to find jet trigger candidates (loop over EMCal L1 patches over threshold...
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskJetTriggerSelection.C
1 // $Id$
2
3 AliJetTriggerSelectionTask* AddTaskJetTriggerSelection(
4   const char *nclusters          = "CaloClusters",
5   TF1        *eth                = 0,
6   Double_t    maxdistance        = 0.15,
7   UInt_t      triggerbits        = AliVEvent::kEMCEJE,
8   const char *taskname           = "AliJetTriggerSelectionTask"
9 )
10 {  
11   // Get the pointer to the existing analysis manager via the static access method.
12   //==============================================================================
13   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14   if (!mgr)
15   {
16     ::Error("AddTaskJetTriggerSelection", "No analysis manager to connect to.");
17     return NULL;
18   }  
19   
20   // Check the analysis type using the event handlers connected to the analysis manager.
21   //==============================================================================
22   if (!mgr->GetInputEventHandler())
23   {
24     ::Error("AddTaskJetTriggerSelection", "This task requires an input event handler");
25     return NULL;
26   }
27   
28   //-------------------------------------------------------
29   // Init the task and do settings
30   //-------------------------------------------------------
31
32   TString name(Form("%s_%s",taskname, nclusters));
33
34   AliJetTriggerSelectionTask* jetTask = new AliJetTriggerSelectionTask(name);
35   jetTask->AddClusterContainer(nclusters);
36   jetTask->SetEnergyThreshold(eth);  
37   jetTask->SetMaxDistance(maxdistance);
38   jetTask->SetTriggerBits(triggerbits);
39
40   //-------------------------------------------------------
41   // Final settings, pass to manager and set the containers
42   //-------------------------------------------------------
43   
44   mgr->AddTask(jetTask);
45   
46   // Create containers for input/output
47   AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer()  ;
48   mgr->ConnectInput  (jetTask, 0,  cinput1 );
49   
50   return jetTask;
51 }