Improve handling of sharp tracker pt cut matching with trigger pt level: alling Apply...
[u/mrichter/AliRoot.git] / PWGPP / macros / AddTaskMTRchamberEfficiency.C
CommitLineData
eae6a777 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include "TString.h"
3#include "TObjArray.h"
4
5#include "AliLog.h"
6#include "AliVEventHandler.h"
7
8#include "AliAnalysisManager.h"
9#include "AliAnalysisDataContainer.h"
10
11#include "AliMuonTrackCuts.h"
12#include "AliAnalysisTaskTrigChEff.h"
13#endif
14
15AliAnalysisTaskTrigChEff* AddTaskMTRchamberEfficiency(Bool_t useGhosts = kFALSE, Bool_t isMC = kFALSE)
29f50363 16{
17 //
18 // Task for the determination of the MUON trigger chamber efficiency
19 //
20 // stocco@subatech.in2p3.fr
21 //
22
29f50363 23 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
24 if (!mgr) {
1925ef8f 25 ::Error("AddTaskMTRchamberEfficiency", "No analysis manager to connect to.");
29f50363 26 return NULL;
eae6a777 27 }
29f50363 28
eae6a777 29 TString type = mgr->GetInputEventHandler()->GetDataType();
30 if (!type.Contains("ESD") && !type.Contains("AOD")) {
31 ::Error("AddTaskMTRchamberEfficiency", "AliAnalysisTaskTrigChEff task needs the manager to have an ESD or AOD input handler.");
1925ef8f 32 return NULL;
33 }
34
eae6a777 35 // Create cuts
36 AliMuonTrackCuts* muonTrackCuts = new AliMuonTrackCuts("StdMuonTrackCuts", "StdMuonTrackCuts", type.Contains("ESD"));
22379e65 37 muonTrackCuts->SetIsMC(isMC);
10809b21 38 muonTrackCuts->ApplySharpPtCutInMatching(kTRUE);
eae6a777 39
40 // Create task
41 AliAnalysisTaskTrigChEff* taskTrigChEff = new AliAnalysisTaskTrigChEff("TriggerChamberEfficiency", *muonTrackCuts);
29f50363 42 taskTrigChEff->SetUseGhostTracks(useGhosts);
eae6a777 43 if ( isMC ) taskTrigChEff->SetTrigClassPatterns("ANY");
44 else taskTrigChEff->SetTrigClassPatterns("ANY CINT CMU !CMUP CMBAC CPBI !-ACE- !-AC- !-E- !WU !EGA !EJE");
29f50363 45 mgr->AddTask(taskTrigChEff);
46
eae6a777 47 // Create container
48 TString currName = "";
49 TString outputfile = mgr->GetCommonFileName();
50 if ( ! outputfile.IsNull() ) outputfile += ":MTR_ChamberEffMap";
51 else outputfile = "TestTrigChEffAnalysis.root";
52
53 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("testMTRChamberEff",TObjArray::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
54 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("triggerChamberEff", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile.Data());
55
56 // Connect containers
57 mgr->ConnectInput (taskTrigChEff, 0, mgr->GetCommonInputContainer());
58 mgr->ConnectOutput (taskTrigChEff, 1, coutput1);
59 mgr->ConnectOutput (taskTrigChEff, 2, coutput2);
60
61 return taskTrigChEff;
29f50363 62}