Fixed AliCDBId version/subversion entries to match filenames
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskD0Mass.C
CommitLineData
6b3e3c78 1AliAnalysisTaskSED0Mass *AddTaskD0Mass(TString finname="D0toKpiCutsNew.root",Int_t flag=0/*0 = D0,1 = LS*/,Bool_t readMC=kFALSE,Bool_t cutOnDistr=kFALSE)
95e5b6b5 2{
3 //
4 // AddTask for the AliAnalysisTaskSE for D0 candidates
5 // invariant mass histogram and association with MC truth
6 // (using MC info in AOD) and cut variables distributions
7 // C.Bianchin chiara.bianchin@pd.infn.it
8 //
9
10
11 // Get the pointer to the existing analysis manager via the static access method.
12 //==============================================================================
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14 if (!mgr) {
15 ::Error("AddTaskD0Distr", "No analysis manager to connect to.");
16 return NULL;
17 }
18
19 TString filename="",out1name="",out2name="",out3name="",out4name="",out5name="",inname="";
20 filename = AliAnalysisManager::GetCommonFileName();
21 filename += ":PWG3_D2H_";
22 if(flag==0){
23 filename+="D0InvMass";
24 if(cutOnDistr) filename+="C";
25 //list mass
6b3e3c78 26 out1name="coutputmassD0MassN";
95e5b6b5 27 if(cutOnDistr) out1name+="C";
28 //list distr
6b3e3c78 29 out2name="coutputmassD0distrN";
95e5b6b5 30 if(cutOnDistr) out2name+="C";
31 //hist entries
6b3e3c78 32 out3name="nEntriesD0N";
95e5b6b5 33 if(cutOnDistr) out3name+="C";
34 //list checks
6b3e3c78 35 out4name="checksD0N";
95e5b6b5 36 if(cutOnDistr) out4name+="C";
37 //cuts object
6b3e3c78 38 out5name="cutsD0N";
95e5b6b5 39 if(cutOnDistr) out5name+="C";
40
6b3e3c78 41 inname="cinputmassD0_0N";
95e5b6b5 42 if(cutOnDistr) inname+="C";
43
44 } else {
45 filename+="D0InvMassLikeSign";
46 if(cutOnDistr) filename+="C";
47 //list mass
6b3e3c78 48 out1name="coutputmassLSMassN";
95e5b6b5 49 if(cutOnDistr) out1name+="C";
50 //list distr
6b3e3c78 51 out2name="coutputmassLSdistrN";
95e5b6b5 52 if(cutOnDistr) out2name+="C";
53 //hist entries
6b3e3c78 54 out3name="nEntriesLSN";
95e5b6b5 55 if(cutOnDistr) out3name+="C";
56 //list checks
6b3e3c78 57 out4name="checksLSN";
95e5b6b5 58 if(cutOnDistr) out4name+="C";
59 //cuts object
6b3e3c78 60 out5name="cutsLSN";
95e5b6b5 61 if(cutOnDistr) out5name+="C";
62
6b3e3c78 63 inname="cinputmassD0_1N";
95e5b6b5 64 if(cutOnDistr) inname+="C";
65 }
95e5b6b5 66
4e61a020 67 //setting my cut values
95e5b6b5 68
4e61a020 69 //cuts order
70 // printf(" |M-MD0| [GeV] < %f\n",fD0toKpiCuts[0]);
71 // printf(" dca [cm] < %f\n",fD0toKpiCuts[1]);
72 // printf(" cosThetaStar < %f\n",fD0toKpiCuts[2]);
73 // printf(" pTK [GeV/c] > %f\n",fD0toKpiCuts[3]);
74 // printf(" pTpi [GeV/c] > %f\n",fD0toKpiCuts[4]);
75 // printf(" |d0K| [cm] < %f\n",fD0toKpiCuts[5]);
76 // printf(" |d0pi| [cm] < %f\n",fD0toKpiCuts[6]);
77 // printf(" d0d0 [cm^2] < %f\n",fD0toKpiCuts[7]);
78 // printf(" cosThetaPoint > %f\n",fD0toKpiCuts[8]);
79
80
81 TFile* filecuts=new TFile(finname.Data());
82 if(!filecuts->IsOpen()){
83 cout<<"Input file not found: exit"<<endl;
84 return;
95e5b6b5 85 }
95e5b6b5 86
4e61a020 87 AliRDHFCutsD0toKpi* RDHFD0toKpi=new AliRDHFCutsD0toKpi();
88 RDHFD0toKpi = (AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiCuts");
89 RDHFD0toKpi->SetName(Form("D0toKpiCuts%d",flag));
90
91 if(!RDHFD0toKpi){
92 cout<<"Specific AliRDHFCuts not found"<<endl;
93 return;
94 }
95e5b6b5 95
96 // Aanalysis task
97 TString taskname="MassAndDistrAnalysis";
98 if (flag==0)taskname.Prepend("D0");
99 else taskname.Prepend("LS");
100 AliAnalysisTaskSED0Mass *massD0Task = new AliAnalysisTaskSED0Mass(taskname.Data(),RDHFD0toKpi);
4e61a020 101 massD0Task->SetDebugLevel(2);
95e5b6b5 102 massD0Task->SetArray(flag);
103 massD0Task->SetReadMC(readMC);
104 massD0Task->SetCutOnDistr(cutOnDistr);
6b3e3c78 105 massD0Task->SetUsePid4Distr(kFALSE);
95e5b6b5 106 mgr->AddTask(massD0Task);
107
108 //
109 // Create containers for input/output
110 AliAnalysisDataContainer *cinputmassD0 = mgr->CreateContainer(inname,TChain::Class(),
111 AliAnalysisManager::kInputContainer);
112
113 AliAnalysisDataContainer *coutputmassD01 = mgr->CreateContainer(out1name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //mass
114 AliAnalysisDataContainer *coutputmassD02 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //distr
115 AliAnalysisDataContainer *coutputmassD03 = mgr->CreateContainer(out3name,TH1F::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //nev
116 AliAnalysisDataContainer *coutputmassD04 = mgr->CreateContainer(out4name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //check
4e61a020 117 AliAnalysisDataContainer *coutputmassD05 = mgr->CreateContainer(out5name,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
118
95e5b6b5 119 mgr->ConnectInput(massD0Task,0,mgr->GetCommonInputContainer());
120
121 mgr->ConnectOutput(massD0Task,1,coutputmassD01);
122 mgr->ConnectOutput(massD0Task,2,coutputmassD02);
123 mgr->ConnectOutput(massD0Task,3,coutputmassD03);
124 mgr->ConnectOutput(massD0Task,4,coutputmassD04);
125 mgr->ConnectOutput(massD0Task,5,coutputmassD05);
126
127
128 return massD0Task;
129}