AliPhysics  master (3d17d9d)
AddTaskCheckEvSel.C
Go to the documentation of this file.
2  Int_t system=1,
3  Bool_t readMC=kFALSE,
4  TString filecutName="",
5  TString cutObjname="",
6  ULong64_t trigMask=AliVEvent::kMB |AliVEvent::kINT7,
7  Double_t minCent=0,
8  Double_t maxCent=100,
9  Int_t cutOnZVertexSPD=0,
11  Int_t minContPileup=3,
12  Double_t minDzPileup=0.6,
13  Bool_t multDepPileup=kFALSE,
14  Int_t optForOOBPileupInPbPb=0,
15  Bool_t useCentrCorrelCuts=kFALSE,
16  Bool_t doEvPrNtuple=kFALSE,
17  Bool_t doVtxNtuple=kFALSE)
18 {
19 
20  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
21  if (!mgr) {
22  ::Error("AddTaskCombinHF", "No analysis manager to connect to.");
23  }
24 
25  //Analysis Task
26  AliRDHFCutsD0toKpi* evselCuts = 0x0;
27 
28  if(filecutName.EqualTo("")){
29  evselCuts=new AliRDHFCutsD0toKpi("EvSelCuts");
30  evselCuts->SetTriggerClass("");
31  evselCuts->SetTriggerMask(trigMask);
32  if(minCent>=0 && minCent<=110 && maxCent>=0 && maxCent<=110){
33  evselCuts->SetUseCentrality(1);
34  evselCuts->SetMinCentrality(minCent);
35  evselCuts->SetMaxCentrality(maxCent);
36  }
37  evselCuts->SetOptPileup(optPileup);
38  if(optPileup==AliRDHFCuts::kRejectPileupEvent){
39  evselCuts->ConfigureSPDPileupCuts(minContPileup,minDzPileup);
40  evselCuts->SetUseMultDepPileupCut(multDepPileup);
41  }
42  else if(optPileup==AliRDHFCuts::kRejectMVPileupEvent){
43  evselCuts->SetMinContribPileupMV(minContPileup);
44  }
45  evselCuts->SetCutOnzVertexSPD(cutOnZVertexSPD);
46  evselCuts->SetUseCentralityCorrelationCuts(useCentrCorrelCuts);
47  evselCuts->SetUsePbPbOutOfBunchPileupCut(optForOOBPileupInPbPb);
48  }else{
49  TFile* filecuts=TFile::Open(filecutName.Data());
50  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
51  ::Fatal("AddTaskCheckEvSel","Input file with cuts not found");
52  }
53  evselCuts = (AliRDHFCutsD0toKpi*)filecuts->Get(cutObjname.Data());
54  if(!evselCuts){
55  ::Fatal("AddTaskCheckEvSel","Cut object not found");
56  }
57  }
58 
59  AliAnalysisTaskCheckEvSel *dTask = new AliAnalysisTaskCheckEvSel(readMC,system,evselCuts);
60  dTask->SetCutOnzVertexSPD(cutOnZVertexSPD);
61  dTask->SetEnableVertexNtuple(doVtxNtuple);
62  dTask->SetEnableEvPropNtuple(doEvPrNtuple);
63  mgr->AddTask(dTask);
64 
65 
66  // Create containers for input/output
67 
68  TString inname = "cinpEvSelCheck";
69  TString outname = "coutEvSelCheck";
70  TString normname = "coutNorm";
71  TString nt1name = "coutEvPropNtuple";
72  TString nt2name = "coutZvertNtuple";
73 
74  inname += suffix.Data();
75  outname += suffix.Data();
76  normname += suffix.Data();
77  nt1name += suffix.Data();
78  nt2name += suffix.Data();
79 
80  AliAnalysisDataContainer *cinput = mgr->CreateContainer(inname,TChain::Class(),
81  AliAnalysisManager::kInputContainer);
82  TString outputfile = AliAnalysisManager::GetCommonFileName();
83  outputfile += ":D2H_CheckEvSel";
84  outputfile += suffix.Data();
85 
86 
87  AliAnalysisDataContainer *coutput = mgr->CreateContainer(outname,TList::Class(),
88  AliAnalysisManager::kOutputContainer,
89  outputfile.Data());
90 
91  AliAnalysisDataContainer *coutputNorm = mgr->CreateContainer(normname,AliNormalizationCounter::Class(),
92  AliAnalysisManager::kOutputContainer,
93  outputfile.Data());
94  AliAnalysisDataContainer *coutputNt1 = mgr->CreateContainer(nt1name,TNtuple::Class(),
95  AliAnalysisManager::kOutputContainer,
96  outputfile.Data());
97  coutputNt1->SetSpecialOutput();
98 
99  AliAnalysisDataContainer *coutputNt2 = mgr->CreateContainer(nt2name,TNtuple::Class(),
100  AliAnalysisManager::kOutputContainer,
101  outputfile.Data());
102  coutputNt2->SetSpecialOutput();
103 
104  mgr->ConnectInput(dTask,0,mgr->GetCommonInputContainer());
105 
106  mgr->ConnectOutput(dTask,1,coutput);
107  mgr->ConnectOutput(dTask,2,coutputNorm);
108  mgr->ConnectOutput(dTask,3,coutputNt1);
109  mgr->ConnectOutput(dTask,4,coutputNt2);
110 
111  return dTask;
112 }
double Double_t
Definition: External.C:58
void SetEnableEvPropNtuple(Bool_t dontuple)
void SetUseMultDepPileupCut(Bool_t opt=kTRUE)
Definition: AliRDHFCuts.h:253
void SetUseCentrality(Int_t flag=1)
void SetCutOnzVertexSPD(Int_t opt)
Definition: AliRDHFCuts.h:197
void SetMinContribPileupMV(Int_t contr=5)
Definition: AliRDHFCuts.h:66
int Int_t
Definition: External.C:63
void SetMinCentrality(Float_t minCentrality=0.)
Definition: AliRDHFCuts.h:54
AliAnalysisTaskCheckEvSel * AddTaskCheckEvSel(TString suffix="", Int_t system=1, Bool_t readMC=kFALSE, TString filecutName="", TString cutObjname="", ULong64_t trigMask=AliVEvent::kMB|AliVEvent::kINT7, Double_t minCent=0, Double_t maxCent=100, Int_t cutOnZVertexSPD=0, Int_t optPileup=AliRDHFCuts::kRejectPileupEvent, Int_t minContPileup=3, Double_t minDzPileup=0.6, Bool_t multDepPileup=kFALSE, Int_t optForOOBPileupInPbPb=0, Bool_t useCentrCorrelCuts=kFALSE, Bool_t doEvPrNtuple=kFALSE, Bool_t doVtxNtuple=kFALSE)
void SetMaxCentrality(Float_t maxCentrality=100.)
Definition: AliRDHFCuts.h:55
void SetUsePbPbOutOfBunchPileupCut(Int_t opt)
Definition: AliRDHFCuts.h:203
void SetEnableVertexNtuple(Bool_t dontuple)
void SetUseCentralityCorrelationCuts(Bool_t opt)
Definition: AliRDHFCuts.h:202
bool Bool_t
Definition: External.C:53
void SetTriggerClass(TString trclass0, TString trclass1="")
Definition: AliRDHFCuts.h:208
void SetOptPileup(Int_t opt=0)
Definition: AliRDHFCuts.h:235
void ConfigureSPDPileupCuts(Int_t minContrib=3, Float_t minDz=0.6)
Definition: AliRDHFCuts.h:249
void SetTriggerMask(ULong64_t mask=0)
Definition: AliRDHFCuts.h:71