]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/muon/AddTaskMuonsHF.C
Coverity fix (an obsolete constructor removed)
[u/mrichter/AliRoot.git] / PWG3 / muon / AddTaskMuonsHF.C
CommitLineData
9bcac085 1AliAnalysisTaskSEMuonsHF* AddTaskMuonsHF(Int_t mode=0, Bool_t isMC=kFALSE, Bool_t isTree=kFALSE, Bool_t isSel)
4292b3b6 2{
3 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
4 if (!mgr) {
5 ::Error("AddTaskMuonsHF", "No analysis manager to connect to.");
6 return NULL;
7 }
4292b3b6 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 }
1195bb6f 13 if (isMC && type.Contains("ESD")) {
4292b3b6 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 }
1195bb6f 19 }
4292b3b6 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
fd1d0cb9 28 // set cuts for events or muons selection
9bcac085 29 Double_t cutsEvsH[5] ={-999999.0, // low limit of Ncontrs
fd1d0cb9 30 999999.0, // up limit of |vz|
9bcac085 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};
4292b3b6 58 AliAnalysisTaskSEMuonsHF *taskMuonsHF = new AliAnalysisTaskSEMuonsHF("MuonsHF Analysis Task");
59 taskMuonsHF->SetAnaMode(mode);
1195bb6f 60 taskMuonsHF->SetUseMC(isMC);
4292b3b6 61 taskMuonsHF->SetIsOutputTree(isTree);
fd1d0cb9 62 taskMuonsHF->SetEvsHCuts(cutsEvsH);
63 taskMuonsHF->SetMuonCuts(cutsMuon);
9bcac085 64 taskMuonsHF->SetDimuCuts(cutsDimu);
65 if (isSel) taskMuonsHF->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kMUON);
4292b3b6 66 mgr->AddTask(taskMuonsHF);
4292b3b6 67
1195bb6f 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);
4292b3b6 74
75 return taskMuonsHF;
76}