New class for normalization studies (Giacomo)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskD0Mass.C
CommitLineData
a96083b9 1AliAnalysisTaskSED0Mass *AddTaskD0Mass(TString finname="D0toKpiCuts.root",Int_t flag=0/*0 = D0,1 = LS*/,Bool_t readMC=kFALSE,Bool_t cutOnDistr=kFALSE,Int_t flagD0D0bar=0)
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
a96083b9 19 TString filename="",out1name="",out2name="",out3name="",out4name="",out5name="",out6name="",inname="";
95e5b6b5 20 filename = AliAnalysisManager::GetCommonFileName();
21 filename += ":PWG3_D2H_";
22 if(flag==0){
23 filename+="D0InvMass";
24 if(cutOnDistr) filename+="C";
449b1302 25 if(flagD0D0bar==1)filename+="D0";
26 if(flagD0D0bar==2)filename+="D0bar";
95e5b6b5 27 //list mass
449b1302 28 out1name="coutputmassD0Mass";
95e5b6b5 29 if(cutOnDistr) out1name+="C";
449b1302 30 if(flagD0D0bar==1)out1name+="D0";
31 if(flagD0D0bar==2)out1name+="D0bar";
95e5b6b5 32 //list distr
449b1302 33 out2name="coutputmassD0distr";
95e5b6b5 34 if(cutOnDistr) out2name+="C";
449b1302 35 if(flagD0D0bar==1)out2name+="D0";
36 if(flagD0D0bar==2)out2name+="D0bar";
37 //hist entries
38 out3name="nEntriesD0";
95e5b6b5 39 if(cutOnDistr) out3name+="C";
449b1302 40 if(flagD0D0bar==1)out3name+="D0";
41 if(flagD0D0bar==2)out3name+="D0bar";
95e5b6b5 42 //list checks
449b1302 43 out4name="checksD0";
95e5b6b5 44 if(cutOnDistr) out4name+="C";
449b1302 45 if(flagD0D0bar==1)out4name+="D0";
46 if(flagD0D0bar==2)out4name+="D0bar";
47 //cuts object
48 out5name="cutsD0";
95e5b6b5 49 if(cutOnDistr) out5name+="C";
449b1302 50 if(flagD0D0bar==1)out5name+="D0";
51 if(flagD0D0bar==2)out5name+="D0bar";
95e5b6b5 52
a96083b9 53 //AliNormalizationCounter
54 out6name="normalizationCounter";
55 if(cutOnDistr) out6name+="C";
56 if(flagD0D0bar==1)out6name+="D0";
57 if(flagD0D0bar==2)out6name+="D0bar";
58
449b1302 59 inname="cinputmassD0_0";
95e5b6b5 60 if(cutOnDistr) inname+="C";
449b1302 61 if(flagD0D0bar==1)inname+="D0";
62 if(flagD0D0bar==2)inname+="D0bar";
95e5b6b5 63
64 } else {
65 filename+="D0InvMassLikeSign";
66 if(cutOnDistr) filename+="C";
449b1302 67 if(flagD0D0bar==1)filename+="D0";
68 if(flagD0D0bar==2)filename+="D0bar";
95e5b6b5 69 //list mass
449b1302 70 out1name="coutputmassLSMass";
95e5b6b5 71 if(cutOnDistr) out1name+="C";
449b1302 72 if(flagD0D0bar==1)out1name+="D0";
73 if(flagD0D0bar==2)out1name+="D0bar";
95e5b6b5 74 //list distr
449b1302 75 out2name="coutputmassLSdistr";
95e5b6b5 76 if(cutOnDistr) out2name+="C";
449b1302 77 if(flagD0D0bar==1)out2name+="D0";
78 if(flagD0D0bar==2)out2name+="D0bar";
79 //hist entries
80 out3name="nEntriesLS";
95e5b6b5 81 if(cutOnDistr) out3name+="C";
449b1302 82 if(flagD0D0bar==1)out3name+="D0";
83 if(flagD0D0bar==2)out3name+="D0bar";
95e5b6b5 84 //list checks
449b1302 85 out4name="checksLS";
95e5b6b5 86 if(cutOnDistr) out4name+="C";
449b1302 87 if(flagD0D0bar==1)out4name+="D0";
88 if(flagD0D0bar==2)out4name+="D0bar";
89 //cuts object
90 out5name="cutsLS";
95e5b6b5 91 if(cutOnDistr) out5name+="C";
449b1302 92 if(flagD0D0bar==1)out5name+="D0";
93 if(flagD0D0bar==2)out5name+="D0bar";
95e5b6b5 94
449b1302 95 inname="cinputmassD0_1";
95e5b6b5 96 if(cutOnDistr) inname+="C";
449b1302 97 if(flagD0D0bar==1)inname+="D0";
98 if(flagD0D0bar==2)inname+="D0bar";
95e5b6b5 99 }
95e5b6b5 100
4e61a020 101 //setting my cut values
95e5b6b5 102
4e61a020 103 //cuts order
104 // printf(" |M-MD0| [GeV] < %f\n",fD0toKpiCuts[0]);
105 // printf(" dca [cm] < %f\n",fD0toKpiCuts[1]);
106 // printf(" cosThetaStar < %f\n",fD0toKpiCuts[2]);
107 // printf(" pTK [GeV/c] > %f\n",fD0toKpiCuts[3]);
108 // printf(" pTpi [GeV/c] > %f\n",fD0toKpiCuts[4]);
109 // printf(" |d0K| [cm] < %f\n",fD0toKpiCuts[5]);
110 // printf(" |d0pi| [cm] < %f\n",fD0toKpiCuts[6]);
111 // printf(" d0d0 [cm^2] < %f\n",fD0toKpiCuts[7]);
112 // printf(" cosThetaPoint > %f\n",fD0toKpiCuts[8]);
113
114
115 TFile* filecuts=new TFile(finname.Data());
116 if(!filecuts->IsOpen()){
117 cout<<"Input file not found: exit"<<endl;
118 return;
95e5b6b5 119 }
95e5b6b5 120
4e61a020 121 AliRDHFCutsD0toKpi* RDHFD0toKpi=new AliRDHFCutsD0toKpi();
122 RDHFD0toKpi = (AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiCuts");
123 RDHFD0toKpi->SetName(Form("D0toKpiCuts%d",flag));
124
125 if(!RDHFD0toKpi){
126 cout<<"Specific AliRDHFCuts not found"<<endl;
127 return;
128 }
95e5b6b5 129
130 // Aanalysis task
131 TString taskname="MassAndDistrAnalysis";
132 if (flag==0)taskname.Prepend("D0");
133 else taskname.Prepend("LS");
134 AliAnalysisTaskSED0Mass *massD0Task = new AliAnalysisTaskSED0Mass(taskname.Data(),RDHFD0toKpi);
4e61a020 135 massD0Task->SetDebugLevel(2);
95e5b6b5 136 massD0Task->SetArray(flag);
137 massD0Task->SetReadMC(readMC);
138 massD0Task->SetCutOnDistr(cutOnDistr);
6b3e3c78 139 massD0Task->SetUsePid4Distr(kFALSE);
449b1302 140 massD0Task->SetFillOnlyD0D0bar(flagD0D0bar);
141
95e5b6b5 142 mgr->AddTask(massD0Task);
143
144 //
145 // Create containers for input/output
146 AliAnalysisDataContainer *cinputmassD0 = mgr->CreateContainer(inname,TChain::Class(),
147 AliAnalysisManager::kInputContainer);
148
149 AliAnalysisDataContainer *coutputmassD01 = mgr->CreateContainer(out1name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //mass
150 AliAnalysisDataContainer *coutputmassD02 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //distr
151 AliAnalysisDataContainer *coutputmassD03 = mgr->CreateContainer(out3name,TH1F::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //nev
152 AliAnalysisDataContainer *coutputmassD04 = mgr->CreateContainer(out4name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //check
4e61a020 153 AliAnalysisDataContainer *coutputmassD05 = mgr->CreateContainer(out5name,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
a96083b9 154 AliAnalysisDataContainer *coutputmassD06 = mgr->CreateContainer(out6name,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
4e61a020 155
95e5b6b5 156 mgr->ConnectInput(massD0Task,0,mgr->GetCommonInputContainer());
157
158 mgr->ConnectOutput(massD0Task,1,coutputmassD01);
159 mgr->ConnectOutput(massD0Task,2,coutputmassD02);
160 mgr->ConnectOutput(massD0Task,3,coutputmassD03);
161 mgr->ConnectOutput(massD0Task,4,coutputmassD04);
162 mgr->ConnectOutput(massD0Task,5,coutputmassD05);
a96083b9 163 mgr->ConnectOutput(massD0Task,6,coutputmassD06);
95e5b6b5 164
165
166 return massD0Task;
167}