]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muon/AddTaskMuonsHF.C
Transition PWG3 --> PWGHF
[u/mrichter/AliRoot.git] / PWG / muon / AddTaskMuonsHF.C
1 AliAnalysisTaskSEMuonsHF* AddTaskMuonsHF(Int_t mode=0, Bool_t isMC=kFALSE, Bool_t isTree=kFALSE, Bool_t isSel)
2 {
3   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
4   if (!mgr) {
5     ::Error("AddTaskMuonsHF", "No analysis manager to connect to.");
6     return NULL;
7   }
8   TString type = mgr->GetInputEventHandler()->GetDataType();
9   if (!type.Contains("ESD") && !type.Contains("AOD")) {
10     ::Error("AddTaskMuonsHF", "MuonsHF task needs the manager to have an ESD or AOD input handler.");
11     return NULL;
12   }
13   if (isMC && type.Contains("ESD")) {
14     AliMCEventHandler *mcH = mgr->GetMCtruthEventHandler();
15     if (!mcH) {
16       ::Error("AddTaskMuonsHF", "MuonsHF task needs the manager to have an MC evnet handler.");
17       return NULL;
18     }
19   }
20   if (isTree) {
21     AliAODHandler *aodH = (AliAODHandler*)mgr->GetOutputEventHandler();
22     if (!aodH) {
23       ::Error("AddTaskMuonsHF", "MuonsHF task needs the manager to have an AOD output handler.");
24       return NULL;
25     }
26   }
27
28   // set cuts for events or muons selection
29   Double_t cutsEvsH[5] ={-999999.0,   // low limit of Ncontrs
30                           999999.0,   // up limit of |vz|
31                           999999.0,   // up limit of vt
32                          -999999.0,   // centrality min
33                           999999.0};  // centrality max
34   Double_t cutsMuon[16]={-999999.0,   //  0, min of 3-momentum
35                           999999.0,   //  1, max of 3-momnentum
36                          -999999.0,   //  2, PtMin
37                           999999.0,   //  3, PtMax
38                          -999999.0,   //  4, EtaMin
39                           999999.0,   //  5, EtaMax
40                          -999999.0,   //  6, DCAmin
41                           999999.0,   //  7, DCAmax
42                          -999999.0,   //  8, for trigger
43                           999999.0,   //  9, for trigger
44                          -999999.0,   // 10, ThetaAbsEndMin
45                           999999.0,   // 11, ThetaAbsEndMax
46                          -999999.0,   // 12, chi2 tracker Min
47                           999999.0,   // 13, chi2 tracker Max
48                          -999999.0,   // 14, chi2 trigger Min
49                           999999.0};  // 15, chi2 trigger Max
50   Double_t cutsDimu[16]={-999999.0, 999999.0,  // single muon cuts used for dimuon selection
51                          -999999.0, 999999.0,
52                          -999999.0, 999999.0,
53                          -999999.0, 999999.0,
54                          -999999.0, 999999.0,
55                          -999999.0, 999999.0,
56                          -999999.0, 999999.0,
57                          -999999.0, 999999.0};
58   AliAnalysisTaskSEMuonsHF *taskMuonsHF = new AliAnalysisTaskSEMuonsHF("MuonsHF Analysis Task");
59   taskMuonsHF->SetAnaMode(mode);
60   taskMuonsHF->SetUseMC(isMC);
61   taskMuonsHF->SetIsOutputTree(isTree);
62   taskMuonsHF->SetEvsHCuts(cutsEvsH);
63   taskMuonsHF->SetMuonCuts(cutsMuon);
64   taskMuonsHF->SetDimuCuts(cutsDimu);
65   if (isSel) taskMuonsHF->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kMUON);
66   mgr->AddTask(taskMuonsHF);
67
68   mgr->ConnectInput(taskMuonsHF, 0, mgr->GetCommonInputContainer());
69   if (isTree) mgr->ConnectOutput(taskMuonsHF, 0, mgr->GetCommonOutputContainer());
70
71   char *fileName = "muonsHF.root";
72   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histosList",TList::Class(),AliAnalysisManager::kOutputContainer,fileName);
73   mgr->ConnectOutput(taskMuonsHF,1,coutput1);
74
75   return taskMuonsHF;
76 }