AliPhysics  v5-07-15-01 (b3d7633)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskLambdacTMVA.C
Go to the documentation of this file.
1 AliAnalysisTaskSE *AddTaskLambdacTMVA(TString finname,Int_t storeNtuple,Bool_t readMC,Bool_t MCPid,Bool_t realPid,Bool_t resPid,Bool_t keepLcNoQuark,Bool_t isHijing,
2 Int_t syst=0, Int_t bit=0, TString postname="")
3 {
4  //==============================================================================
5  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
6  if (!mgr) {
7  ::Error("AddTaskLambdac", "No analysis manager to connect to.");
8  return NULL;
9  }
10 
11 
12  Bool_t stdcuts=kFALSE;
13  TFile* filecuts;
14  if( finname.EqualTo("") ) {
15  stdcuts=kTRUE;
16  } else {
17  filecuts=TFile::Open(finname.Data());
18  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
19  AliFatal("Input file not found : check your cut object");
20  }
21  }
22  AliRDHFCutsLctopKpi *analysiscuts = new AliRDHFCutsLctopKpi();
23  // syst = 0 : pp, syst = 1: PbPb, syst = 2 : pPb
24  if(stdcuts) {
25  if(syst==0) analysiscuts->SetStandardCutsPP2010();
26  if(syst==1) analysiscuts->SetStandardCutsPbPb2011();
27  if(syst==2) analysiscuts->SetStandardCutsPPb2013();
28  }
29  else analysiscuts = (AliRDHFCutsLctopKpi*)filecuts->Get("LctopKpiAnalysisCuts");
30  analysiscuts->SetName("LctopKpiAnalysisCuts");
31  analysiscuts->SetMinPtCandidate(-1.);
32  analysiscuts->SetMaxPtCandidate(10000.);
33 
34  // Analysis task
35  AliAnalysisTaskSELambdacTMVA *lambdacTask = new AliAnalysisTaskSELambdacTMVA("LambdacAnalysis",storeNtuple,analysiscuts);
36  //if(storeNtuple<0 || storeNtuple>2) {AliFatal("Invalid storeNtuple argument - check value");}
37  lambdacTask->SetReadMC(readMC);
38  lambdacTask->SetKeepLcNotFromQuark(keepLcNoQuark);
39  lambdacTask->SetCollisionSystem(syst);
40  if(MCPid) lambdacTask->SetMCPid();
41  if(resPid) lambdacTask->SetResonantPid();
42  if(realPid) lambdacTask->SetRealPid();
43  if(isHijing) lambdacTask->SetIsHijing();
44  lambdacTask->SetAnalysis(kTRUE);
45 
46  //bit:0 nocut, 1:LcCut, 2:LcPID, 3: Both
47  lambdacTask->SetUseFilterBitCut(bit==1||bit==3?1:0);
48  lambdacTask->SetUseFilterBitPID(bit>1?1:0);
49 
50  lambdacTask->SetDebugLevel(0);
51  mgr->AddTask(lambdacTask);
52 
53  //
54  // Create containers for input/output
55  TString outputfile = AliAnalysisManager::GetCommonFileName();
56  outputfile += ":PWG3_D2H_InvMassLambdac";
57 
58  TString finDirname="pp";
59  TString inname = "cinputLc";
60  TString outname = "coutputLc";
61  TString cutsname = "coutputLcCuts";
62  TString normname = "coutputLcNorm";
63  TString normnament = "coutputLcNormNt";
64  TString ntuplename = "fNtupleLambdac";
65  TString nev2 = "coutputNev";
66  TString outname2 = "coutputLambdacMC";
67  TString aPrioriname = "coutputAPriori";
68  TString multiplicityname = "coutputMultiplicity";
69  inname += finDirname.Data();
70  outname += finDirname.Data();
71  cutsname += finDirname.Data();
72  normname += finDirname.Data();
73  normnament += finDirname.Data();
74  nev2 += finDirname.Data();
75  outname2 += finDirname.Data();
76  aPrioriname += finDirname.Data();
77  multiplicityname += finDirname.Data();
78 
79  inname += postname.Data();
80  outname += postname.Data();
81  cutsname += postname.Data();
82  normname += postname.Data();
83  normnament += postname.Data();
84  ntuplename += postname.Data();
85  nev2 += postname.Data();
86  outname2 += postname.Data();
87 
88 
89  //input container
90  AliAnalysisDataContainer *cinputLambdac = mgr->CreateContainer(inname,TChain::Class(),
91  AliAnalysisManager::kInputContainer);
92  mgr->ConnectInput(lambdacTask,0,mgr->GetCommonInputContainer());
93 
94 
95  AliAnalysisDataContainer *coutputLambdacCuts = mgr->CreateContainer(cutsname,TList::Class(),
96  AliAnalysisManager::kOutputContainer,outputfile.Data());
97  mgr->ConnectOutput(lambdacTask,2,coutputLambdacCuts);
98 
99  AliAnalysisDataContainer *coutputLambdac = mgr->CreateContainer(outname,TList::Class(),
100  AliAnalysisManager::kOutputContainer,outputfile.Data());
101  mgr->ConnectOutput(lambdacTask,1,coutputLambdac);
102 
103  AliAnalysisDataContainer *coutputLambdacNev = mgr->CreateContainer(nev2,TH1F::Class(),
104  AliAnalysisManager::kOutputContainer,outputfile.Data());
105  mgr->ConnectOutput(lambdacTask,3,coutputLambdacNev);
106 
107 
108  AliAnalysisDataContainer *coutputLambdacNorm = mgr->CreateContainer(normname,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
109 
110  mgr->ConnectOutput(lambdacTask,4,coutputLambdacNorm);
111 
112  if (storeNtuple) {
113  TString foutname = Form("InvMassLambdac_nt1.root",postname.Data());
114  AliAnalysisDataContainer *coutputLambdac2 = mgr->CreateContainer(ntuplename,TNtuple::Class(),
115  AliAnalysisManager::kOutputContainer,foutname);
116  coutputLambdac2->SetSpecialOutput();
117  mgr->ConnectOutput(lambdacTask,5,coutputLambdac2);
118  coutputLambdacNorm = mgr->CreateContainer(normnament,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer,foutname);
119  mgr->ConnectOutput(lambdacTask,4,coutputLambdacNorm);
120  }
121 
122  return lambdacTask;
123 }
virtual void SetStandardCutsPbPb2011()
AliAnalysisTaskSE * AddTaskLambdacTMVA(TString finname, Int_t storeNtuple, Bool_t readMC, Bool_t MCPid, Bool_t realPid, Bool_t resPid, Bool_t keepLcNoQuark, Bool_t isHijing, Int_t syst=0, Int_t bit=0, TString postname="")
virtual void SetStandardCutsPPb2013()
virtual void SetStandardCutsPP2010()
void SetMaxPtCandidate(Double_t ptCand=1000.)
Definition: AliRDHFCuts.h:216
void SetIsHijing(Bool_t isHijing=kTRUE)
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:215
void SetKeepLcNotFromQuark(Bool_t keep=kTRUE)
void SetAnalysis(Bool_t analysis=kTRUE)