Change to fix par files compilation (ChiaraB)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskD0Mass.C
CommitLineData
449b1302 1AliAnalysisTaskSED0Mass *AddTaskD0Mass(TString finname="D0toKpiCutsNew.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
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";
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
449b1302 53 inname="cinputmassD0_0";
95e5b6b5 54 if(cutOnDistr) inname+="C";
449b1302 55 if(flagD0D0bar==1)inname+="D0";
56 if(flagD0D0bar==2)inname+="D0bar";
95e5b6b5 57
58 } else {
59 filename+="D0InvMassLikeSign";
60 if(cutOnDistr) filename+="C";
449b1302 61 if(flagD0D0bar==1)filename+="D0";
62 if(flagD0D0bar==2)filename+="D0bar";
95e5b6b5 63 //list mass
449b1302 64 out1name="coutputmassLSMass";
95e5b6b5 65 if(cutOnDistr) out1name+="C";
449b1302 66 if(flagD0D0bar==1)out1name+="D0";
67 if(flagD0D0bar==2)out1name+="D0bar";
95e5b6b5 68 //list distr
449b1302 69 out2name="coutputmassLSdistr";
95e5b6b5 70 if(cutOnDistr) out2name+="C";
449b1302 71 if(flagD0D0bar==1)out2name+="D0";
72 if(flagD0D0bar==2)out2name+="D0bar";
73 //hist entries
74 out3name="nEntriesLS";
95e5b6b5 75 if(cutOnDistr) out3name+="C";
449b1302 76 if(flagD0D0bar==1)out3name+="D0";
77 if(flagD0D0bar==2)out3name+="D0bar";
95e5b6b5 78 //list checks
449b1302 79 out4name="checksLS";
95e5b6b5 80 if(cutOnDistr) out4name+="C";
449b1302 81 if(flagD0D0bar==1)out4name+="D0";
82 if(flagD0D0bar==2)out4name+="D0bar";
83 //cuts object
84 out5name="cutsLS";
95e5b6b5 85 if(cutOnDistr) out5name+="C";
449b1302 86 if(flagD0D0bar==1)out5name+="D0";
87 if(flagD0D0bar==2)out5name+="D0bar";
95e5b6b5 88
449b1302 89 inname="cinputmassD0_1";
95e5b6b5 90 if(cutOnDistr) inname+="C";
449b1302 91 if(flagD0D0bar==1)inname+="D0";
92 if(flagD0D0bar==2)inname+="D0bar";
95e5b6b5 93 }
95e5b6b5 94
4e61a020 95 //setting my cut values
95e5b6b5 96
4e61a020 97 //cuts order
98 // printf(" |M-MD0| [GeV] < %f\n",fD0toKpiCuts[0]);
99 // printf(" dca [cm] < %f\n",fD0toKpiCuts[1]);
100 // printf(" cosThetaStar < %f\n",fD0toKpiCuts[2]);
101 // printf(" pTK [GeV/c] > %f\n",fD0toKpiCuts[3]);
102 // printf(" pTpi [GeV/c] > %f\n",fD0toKpiCuts[4]);
103 // printf(" |d0K| [cm] < %f\n",fD0toKpiCuts[5]);
104 // printf(" |d0pi| [cm] < %f\n",fD0toKpiCuts[6]);
105 // printf(" d0d0 [cm^2] < %f\n",fD0toKpiCuts[7]);
106 // printf(" cosThetaPoint > %f\n",fD0toKpiCuts[8]);
107
108
109 TFile* filecuts=new TFile(finname.Data());
110 if(!filecuts->IsOpen()){
111 cout<<"Input file not found: exit"<<endl;
112 return;
95e5b6b5 113 }
95e5b6b5 114
4e61a020 115 AliRDHFCutsD0toKpi* RDHFD0toKpi=new AliRDHFCutsD0toKpi();
116 RDHFD0toKpi = (AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiCuts");
117 RDHFD0toKpi->SetName(Form("D0toKpiCuts%d",flag));
118
119 if(!RDHFD0toKpi){
120 cout<<"Specific AliRDHFCuts not found"<<endl;
121 return;
122 }
95e5b6b5 123
124 // Aanalysis task
125 TString taskname="MassAndDistrAnalysis";
126 if (flag==0)taskname.Prepend("D0");
127 else taskname.Prepend("LS");
128 AliAnalysisTaskSED0Mass *massD0Task = new AliAnalysisTaskSED0Mass(taskname.Data(),RDHFD0toKpi);
4e61a020 129 massD0Task->SetDebugLevel(2);
95e5b6b5 130 massD0Task->SetArray(flag);
131 massD0Task->SetReadMC(readMC);
132 massD0Task->SetCutOnDistr(cutOnDistr);
6b3e3c78 133 massD0Task->SetUsePid4Distr(kFALSE);
449b1302 134 massD0Task->SetFillOnlyD0D0bar(flagD0D0bar);
135
95e5b6b5 136 mgr->AddTask(massD0Task);
137
138 //
139 // Create containers for input/output
140 AliAnalysisDataContainer *cinputmassD0 = mgr->CreateContainer(inname,TChain::Class(),
141 AliAnalysisManager::kInputContainer);
142
143 AliAnalysisDataContainer *coutputmassD01 = mgr->CreateContainer(out1name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //mass
144 AliAnalysisDataContainer *coutputmassD02 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //distr
145 AliAnalysisDataContainer *coutputmassD03 = mgr->CreateContainer(out3name,TH1F::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //nev
146 AliAnalysisDataContainer *coutputmassD04 = mgr->CreateContainer(out4name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //check
4e61a020 147 AliAnalysisDataContainer *coutputmassD05 = mgr->CreateContainer(out5name,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
148
95e5b6b5 149 mgr->ConnectInput(massD0Task,0,mgr->GetCommonInputContainer());
150
151 mgr->ConnectOutput(massD0Task,1,coutputmassD01);
152 mgr->ConnectOutput(massD0Task,2,coutputmassD02);
153 mgr->ConnectOutput(massD0Task,3,coutputmassD03);
154 mgr->ConnectOutput(massD0Task,4,coutputmassD04);
155 mgr->ConnectOutput(massD0Task,5,coutputmassD05);
156
157
158 return massD0Task;
159}