Update of the Xiaoming code for pp900 first muon analysis. Fixing wanirngs and violti...
[u/mrichter/AliRoot.git] / PWG3 / muon / AddTaskMuonsHF.C
CommitLineData
4292b3b6 1AliAnalysisTaskSEMuonsHF* AddTaskMuonsHF(Int_t mode=0, Bool_t isMC=kFALSE, Bool_t isTree=kFALSE)
2{
3 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
4 if (!mgr) {
5 ::Error("AddTaskMuonsHF", "No analysis manager to connect to.");
6 return NULL;
7 }
8
9 TString type = mgr->GetInputEventHandler()->GetDataType();
10 if (!type.Contains("ESD") && !type.Contains("AOD")) {
11 ::Error("AddTaskMuonsHF", "MuonsHF task needs the manager to have an ESD or AOD input handler.");
12 return NULL;
13 }
14
15 /*if (isMC) {
16 AliMCEventHandler *mcH = mgr->GetMCtruthEventHandler();
17 if (!mcH) {
18 ::Error("AddTaskMuonsHF", "MuonsHF task needs the manager to have an MC evnet handler.");
19 return NULL;
20 }
21 }*/
22
23 if (isTree) {
24 AliAODHandler *aodH = (AliAODHandler*)mgr->GetOutputEventHandler();
25 if (!aodH) {
26 ::Error("AddTaskMuonsHF", "MuonsHF task needs the manager to have an AOD output handler.");
27 return NULL;
28 }
29 }
30
fd1d0cb9 31 // set cuts for events or muons selection
32 Double_t cutsEvsH[3] ={-999999.0, // low limit of Ncontrs
33 999999.0, // up limit of |vz|
34 999999.0}; // up limit of vt
35 Double_t cutsMuon[10]={-999999.0, // 0, min of 3-momentum
36 999999.0, // 1, max of 3-momnentum
37 -999999.0, // 2, PtMin
38 999999.0, // 3, PtMax
39 -999999.0, // 4, EtaMin
40 999999.0, // 5, EtaMax
41 -999999.0, // 6, DCAmin
42 999999.0, // 7, DCAmax
43 -999999.0, // 8, for trigger
44 999999.0}; // 9, for trigger
45 Double_t cutsDimu[10]={-999999.0, 999999.0, // single muon cuts used for dimuon selection
46 -999999.0, 999999.0,
47 -999999.0, 999999.0,
48 -999999.0, 999999.0,
49 -999999.0, 999999.0};
4292b3b6 50 AliAnalysisTaskSEMuonsHF *taskMuonsHF = new AliAnalysisTaskSEMuonsHF("MuonsHF Analysis Task");
51 taskMuonsHF->SetAnaMode(mode);
52 taskMuonsHF->SetIsUseMC(isMC);
53 taskMuonsHF->SetIsOutputTree(isTree);
fd1d0cb9 54 taskMuonsHF->SetEvsHCuts(cutsEvsH);
55 taskMuonsHF->SetMuonCuts(cutsMuon);
56 taskMuonsHF->SetDimuCuts(cutsDimu);
4292b3b6 57 mgr->AddTask(taskMuonsHF);
4292b3b6 58
59 mgr->ConnectInput(taskMuonsHF,0,mgr->GetCommonInputContainer());
60 if (isTree) mgr->ConnectOutput(taskMuonsHF,0,mgr->GetCommonOutputContainer());
4292b3b6 61
62 return taskMuonsHF;
63}