AliPhysics  9b6b435 (9b6b435)
AddTaskCombinHF.C
Go to the documentation of this file.
2  Bool_t readMC = kTRUE,
3  TString containerStr = "",
4  TString cutObjFile = "",
5  TString cutObjNam = "",
6  Int_t filterMask = 1,
7  Double_t ptcut = 0.1,
8  Double_t etacut = 0.9,
9  Int_t pidStrategy = 0,
10  Int_t casePID = 0,
11  Double_t bayesThresKaon = 0.4,
12  Double_t bayesThresPion = 0.4,
13  Double_t minMass = 1.6,
14  Double_t maxMass = 2.15,
15  Double_t maxPt = 20.,
16  Double_t ptBinWidth = 0.5)
17 {
18 
19  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
20  if (!mgr) {
21  ::Error("AddTaskCombinHF", "No analysis manager to connect to.");
22  }
23 
24  //Analysis Task
25 
26 
27  AliRDHFCuts* analysiscuts=0x0;
28  AliAODPidHF* pid=0x0;
29  AliESDtrackCuts* esdc = 0x0;
30  if(!cutObjFile.IsNull()){
31  TFile *f=TFile::Open(cutObjFile.Data(),"READ");
32  if(f){
33  analysiscuts=(AliRDHFCuts*)f->Get(cutObjNam.Data());
34  esdc=analysiscuts->GetTrackCuts();
35  pid=analysiscuts->GetPidHF();
36  }
37  }
38  else {
39  if(meson==0) analysiscuts=new AliRDHFCutsD0toKpi();
40  else if(meson==1) analysiscuts=new AliRDHFCutsDplustoKpipi();
41  else if(meson==3) analysiscuts=new AliRDHFCutsDstoKKpi();
42  analysiscuts->SetStandardCutsPP2010();
43  pid=new AliAODPidHF();
44  pid->SetMatch(5);
45  pid->SetTPCnSigmaRangeForPions(-3.,3.);
46  pid->SetTPCnSigmaRangeForKaons(-2.,3.);
47  pid->SetTPCnSigmaRangeForProtons(-3.,3.);
48  pid->SetTOFnSigmaRangeForPions(-3.,3.);
49  pid->SetTOFnSigmaRangeForKaons(-2.,2.);
50  pid->SetTOFnSigmaRangeForProtons(-3.,3.);
51 
52  }
53  if(!analysiscuts){
54  Printf("Wrong file or cut object name set");
55  return 0x0;
56  }
57 
58  AliAnalysisTaskCombinHF *dTask = new AliAnalysisTaskCombinHF(meson,analysiscuts);
59  if(!cutObjFile.IsNull()){
60  dTask->SetKaonTrackCuts(esdc);
61  dTask->SetPionTrackCuts(esdc);
62  dTask->SetTrackCuts(esdc);
63  }
64  dTask->SetReadMC(readMC);
65  dTask->SetDebugLevel(0);
66 
67  dTask->SetFilterMask(filterMask);
68  dTask->SetPtAccCut(ptcut);
69  dTask->SetEtaAccCut(etacut);
70 
71  // mass and pt range for histograms
72  dTask->SetMassWindow(minMass, maxMass);
73  dTask->SetMaxPt(maxPt);
74  dTask->SetPtBinWidth(ptBinWidth);
75 
76  // PID settings
77  dTask->SetPIDHF(pid);
78  dTask->SetPIDstrategy(pidStrategy);
79  dTask->SetPIDselCaseZero(casePID);
80  dTask->SetBayesThres(bayesThresKaon, bayesThresPion);
81 
82 
83  mgr->AddTask(dTask);
84 
85 
86  // Create containers for input/output
87 
88  TString mesname="Dzero";
89  if(meson==1) mesname="Dplus";
90  else if(meson==3) mesname="Ds";
91  TString inname = Form("cinput%s%s",mesname.Data(),containerStr.Data());
92  TString outname = Form("coutput%s%s",mesname.Data(),containerStr.Data());
93  TString normname = Form("coutput%sNorm%s",mesname.Data(),containerStr.Data());
94 
95  AliAnalysisDataContainer *cinput = mgr->CreateContainer(inname,TChain::Class(),
96  AliAnalysisManager::kInputContainer);
97  TString outputfile = AliAnalysisManager::GetCommonFileName();
98  outputfile += Form(":PWG3_D2H_InvMass%sLowPt%s",mesname.Data(),containerStr.Data());
99 
100 
101  AliAnalysisDataContainer *coutput = mgr->CreateContainer(outname,TList::Class(),
102  AliAnalysisManager::kOutputContainer,
103  outputfile.Data());
104  AliAnalysisDataContainer *coutputNorm = mgr->CreateContainer(normname,AliNormalizationCounter::Class(),
105  AliAnalysisManager::kOutputContainer,
106  outputfile.Data());
107 
108  mgr->ConnectInput(dTask,0,mgr->GetCommonInputContainer());
109 
110  mgr->ConnectOutput(dTask,1,coutput);
111 
112  mgr->ConnectOutput(dTask,2,coutputNorm);
113 
114  return dTask;
115 }
void SetTPCnSigmaRangeForKaons(Float_t smin, Float_t smax)
Definition: AliAODPidHF.h:68
void SetTOFnSigmaRangeForKaons(Float_t smin, Float_t smax)
Definition: AliAODPidHF.h:72
double Double_t
Definition: External.C:58
void SetPionTrackCuts(AliESDtrackCuts *cuts)
void SetTrackCuts(AliESDtrackCuts *cuts)
void SetTPCnSigmaRangeForProtons(Float_t smin, Float_t smax)
Definition: AliAODPidHF.h:76
void SetKaonTrackCuts(AliESDtrackCuts *cuts)
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:248
void SetTPCnSigmaRangeForPions(Float_t smin, Float_t smax)
Definition: AliAODPidHF.h:60
void SetMassWindow(Double_t minMass, Double_t maxMass)
void SetBayesThres(Double_t thresKaon, Double_t thresPion)
Class for cuts on AOD reconstructed D+->Kpipi.
void SetTOFnSigmaRangeForProtons(Float_t smin, Float_t smax)
Definition: AliAODPidHF.h:80
void SetPtBinWidth(Double_t binw)
int Int_t
Definition: External.C:63
void SetPIDHF(AliAODPidHF *pid)
void SetMaxPt(Double_t maxPt)
AliESDtrackCuts * GetTrackCuts() const
Definition: AliRDHFCuts.h:263
void SetPtAccCut(Double_t ptcut)
void SetEtaAccCut(Double_t etacut)
AliAnalysisTaskCombinHF * AddTaskCombinHF(Int_t meson=0, Bool_t readMC=kTRUE, TString containerStr="", TString cutObjFile="", TString cutObjNam="", Int_t filterMask=1, Double_t ptcut=0.1, Double_t etacut=0.9, Int_t pidStrategy=0, Int_t casePID=0, Double_t bayesThresKaon=0.4, Double_t bayesThresPion=0.4, Double_t minMass=1.6, Double_t maxMass=2.15, Double_t maxPt=20., Double_t ptBinWidth=0.5)
Double_t minMass
virtual void SetStandardCutsPP2010()
Definition: AliRDHFCuts.h:47
void SetFilterMask(UInt_t mask=16)
void SetMatch(Int_t match)
Definition: AliAODPidHF.h:98
Double_t maxMass
bool Bool_t
Definition: External.C:53
TString meson
void SetTOFnSigmaRangeForPions(Float_t smin, Float_t smax)
Definition: AliAODPidHF.h:64