AliPhysics  ced2227 (ced2227)
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  if(!cutObjFile.IsNull()){
30  TFile *f=TFile::Open(cutObjFile.Data(),"READ");
31  if(f){
32  analysiscuts=(AliRDHFCuts*)f->Get(cutObjNam.Data());
33  AliESDtrackCuts *esdc=analysiscuts->GetTrackCuts();
34  pid=analysiscuts->GetPidHF();
35  }
36  }
37  else {
38  if(meson==0) analysiscuts=new AliRDHFCutsD0toKpi();
39  else if(meson==1) analysiscuts=new AliRDHFCutsDplustoKpipi();
40  else if(meson==3) analysiscuts=new AliRDHFCutsDstoKKpi();
41  analysiscuts->SetStandardCutsPP2010();
42  pid=new AliAODPidHF();
43  pid->SetMatch(5);
44  pid->SetTPCnSigmaRangeForPions(-3.,3.);
45  pid->SetTPCnSigmaRangeForKaons(-2.,3.);
46  pid->SetTPCnSigmaRangeForProtons(-3.,3.);
47  pid->SetTOFnSigmaRangeForPions(-3.,3.);
48  pid->SetTOFnSigmaRangeForKaons(-2.,2.);
49  pid->SetTOFnSigmaRangeForProtons(-3.,3.);
50 
51  }
52  if(!analysiscuts){
53  Printf("Wrong file or cut object name set");
54  return 0x0;
55  }
56 
57  AliAnalysisTaskCombinHF *dTask = new AliAnalysisTaskCombinHF(meson,analysiscuts);
58  if(!cutObjFile.IsNull()){
59  dTask->SetKaonTrackCuts(esdc);
60  dTask->SetPionTrackCuts(esdc);
61  dTask->SetTrackCuts(esdc);
62  }
63  dTask->SetReadMC(readMC);
64  dTask->SetDebugLevel(0);
65 
66  dTask->SetFilterMask(filterMask);
67  dTask->SetPtAccCut(ptcut);
68  dTask->SetEtaAccCut(etacut);
69 
70  // mass and pt range for histograms
71  dTask->SetMassWindow(minMass, maxMass);
72  dTask->SetMaxPt(maxPt);
73  dTask->SetPtBinWidth(ptBinWidth);
74 
75  // PID settings
76  dTask->SetPIDHF(pid);
77  dTask->SetPIDstrategy(pidStrategy);
78  dTask->SetPIDselCaseZero(casePID);
79  dTask->SetBayesThres(bayesThresKaon, bayesThresPion);
80 
81 
82  mgr->AddTask(dTask);
83 
84 
85  // Create containers for input/output
86 
87  TString mesname="Dzero";
88  if(meson==1) mesname="Dplus";
89  else if(meson==3) mesname="Ds";
90  TString inname = Form("cinput%s%s",mesname.Data(),containerStr.Data());
91  TString outname = Form("coutput%s%s",mesname.Data(),containerStr.Data());
92  TString normname = Form("coutput%sNorm%s",mesname.Data(),containerStr.Data());
93 
94  AliAnalysisDataContainer *cinput = mgr->CreateContainer(inname,TChain::Class(),
95  AliAnalysisManager::kInputContainer);
96  TString outputfile = AliAnalysisManager::GetCommonFileName();
97  outputfile += Form(":PWG3_D2H_InvMass%sLowPt%s",mesname.Data(),containerStr.Data());
98 
99 
100  AliAnalysisDataContainer *coutput = mgr->CreateContainer(outname,TList::Class(),
101  AliAnalysisManager::kOutputContainer,
102  outputfile.Data());
103  AliAnalysisDataContainer *coutputNorm = mgr->CreateContainer(normname,AliNormalizationCounter::Class(),
104  AliAnalysisManager::kOutputContainer,
105  outputfile.Data());
106 
107  mgr->ConnectInput(dTask,0,mgr->GetCommonInputContainer());
108 
109  mgr->ConnectOutput(dTask,1,coutput);
110 
111  mgr->ConnectOutput(dTask,2,coutputNorm);
112 
113  return dTask;
114 }
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:246
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:261
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:46
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