7990134afd0bb28995597d52ea4903690c30f026
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskPtEMCalTrigger.C
1 #if !defined (__CINT__) || defined (__MAKECINT__)
2 #include "AliAnalysisManager.h"
3 #include "AliAnalysisTaskPtEMCalTrigger.h"
4 #include "AliESDtrackCuts.h"
5 #include <TList.h>
6 #include <TString.h>
7 #endif
8
9 AliAnalysisTask* AddTaskPtEMCalTrigger(bool isMC, const char *period ="LHC13d"){
10                 //AliLog::SetClassDebugLevel("EMCalTriggerPtAnalysis::AliAnalysisTaskPtEMCalTrigger", 2);
11         AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
12          
13         if (!mgr) {
14              ::Error("AddTaskPtEMCalTrigger", "No analysis manager to connect to.");
15              return NULL;
16         }
17          
18         if (!mgr->GetInputEventHandler()) {
19              ::Error("AddTaskPtEMCalTrigger", "This task requires an input event handler");
20              return NULL;
21         }
22         
23         EMCalTriggerPtAnalysis::AliAnalysisTaskPtEMCalTrigger *pttriggertask = new EMCalTriggerPtAnalysis::AliAnalysisTaskPtEMCalTrigger("ptemcaltriggertask");
24         //pttriggertask->SelectCollisionCandidates(AliVEvent::kINT7 | AliVEvent::kEMC7);                          // Select both INT7 or EMC7 triggered events
25         pttriggertask->SelectCollisionCandidates(AliVEvent::kAny);
26         if(!TString(period).CompareTo("LHC13f")) pttriggertask->SetSwapEta();
27         mgr->AddTask(pttriggertask);
28         pttriggertask->SetPtRange(2., 100.);
29         if(isMC){
30                 pttriggertask->SetIsPythia(kTRUE);
31         }
32         std::cout << EMCalTriggerPtAnalysis::AliAnalysisTaskPtEMCalTrigger::Class_Name() << std::endl;
33
34         // Create charged hadrons pPb standard track cuts
35         AliESDtrackCuts *standardTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(true, 1);
36         standardTrackCuts->SetName("Standard Track cuts");
37         standardTrackCuts->SetMinNCrossedRowsTPC(120);
38         standardTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
39         pttriggertask->AddESDTrackCuts(standardTrackCuts);
40
41         // Create hybrid track cuts as used in the jet analysis
42         AliESDtrackCuts* hybridTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
43         hybridTrackCuts->SetName("Global Hybrid tracks, loose DCA");
44         hybridTrackCuts->SetMaxDCAToVertexXY(2.4);
45         hybridTrackCuts->SetMaxDCAToVertexZ(3.2);
46         hybridTrackCuts->SetDCAToVertex2D(kTRUE);
47         hybridTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
48         hybridTrackCuts->SetMaxFractionSharedTPCClusters(0.4);
49         pttriggertask->AddESDTrackCuts(hybridTrackCuts);
50
51         TString containerName = mgr->GetCommonFileName();
52         containerName += ":PtEMCalTriggerTask";
53         printf("container name: %s\n", containerName.Data());
54
55         AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
56         AliAnalysisDataContainer *coutput = mgr->CreateContainer("results", TList::Class(),    AliAnalysisManager::kOutputContainer, containerName.Data());
57    
58         //Connect input/output
59         mgr->ConnectInput(pttriggertask, 0, cinput);
60         mgr->ConnectOutput(pttriggertask, 1, coutput);
61            
62         return pttriggertask;
63 }