]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/muon/AddTaskMuonsHF.C
remove dependency to aliroot libraries, access of ESDEvent object through abstract...
[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 }
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
b46f66fc 29 Double_t cutsEvsH[3] ={ 0.5, // low limit of Ncontrs
fd1d0cb9 30 999999.0, // up limit of |vz|
31 999999.0}; // up limit of vt
1195bb6f 32 Double_t cutsMuon[12]={-999999.0, // 0, min of 3-momentum
33 999999.0, // 1, max of 3-momnentum
34 -999999.0, // 2, PtMin
35 999999.0, // 3, PtMax
b46f66fc 36 -4.0, // 4, EtaMin
37 -2.5, // 5, EtaMax
1195bb6f 38 -999999.0, // 6, DCAmin
39 999999.0, // 7, DCAmax
b46f66fc 40 1.5, // 8, for trigger
41 3.5, // 9, for trigger
42 171.0, // 10, ThetaAbsEndMin
43 178.0 }; // 11, ThetaAbsEndMax
4292b3b6 44 AliAnalysisTaskSEMuonsHF *taskMuonsHF = new AliAnalysisTaskSEMuonsHF("MuonsHF Analysis Task");
45 taskMuonsHF->SetAnaMode(mode);
1195bb6f 46 taskMuonsHF->SetUseMC(isMC);
4292b3b6 47 taskMuonsHF->SetIsOutputTree(isTree);
fd1d0cb9 48 taskMuonsHF->SetEvsHCuts(cutsEvsH);
49 taskMuonsHF->SetMuonCuts(cutsMuon);
b46f66fc 50 taskMuonsHF->SetDimuCuts(cutsMuon);
1195bb6f 51 taskMuonsHF->SelectCollisionCandidates();
4292b3b6 52 mgr->AddTask(taskMuonsHF);
4292b3b6 53
1195bb6f 54 mgr->ConnectInput(taskMuonsHF, 0, mgr->GetCommonInputContainer());
55 if (isTree) mgr->ConnectOutput(taskMuonsHF, 0, mgr->GetCommonOutputContainer());
56
57 char *fileName = "muonsHF.root";
58 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histosList",TList::Class(),AliAnalysisManager::kOutputContainer,fileName);
59 mgr->ConnectOutput(taskMuonsHF,1,coutput1);
4292b3b6 60
61 return taskMuonsHF;
62}