Added possibility to run without reading the MC (Andrea)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AddTaskCharmFraction.C
1 AliAnalysisTaskSECharmFraction* AddTaskCharmFraction(const char* fileout="d0D0.root",Int_t switchMC[5])
2 {  
3   //
4   // Configuration macro for the task to analyze the fraction of prompt charm
5   // using the D0 impact parameter
6   // andrea.rossi@ts.infn.it
7   //
8   //==========================================================================
9
10   //######## !!! THE SWITCH FOR MC ANALYSIS IS NOT IMPLEMENTED YET!!! ##########à
11   switchMC[0]=1;
12   switchMC[1]=1;
13   switchMC[2]=1;
14   switchMC[3]=1;
15   switchMC[4]=1;
16   Int_t last=0;
17
18   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
19   if (!mgr) {
20     ::Error("AddTaskCharmFraction", "No analysis manager to connect to.");
21     return NULL;
22   }   
23
24   TString str=fileout,containername;
25   str.ReplaceAll(".root","");
26   str.Prepend("_");
27
28   AliAnalysisTaskSECharmFraction *hfTask;
29  
30   hfTask = new AliAnalysisTaskSECharmFraction("AliAnalysisTaskSECharmFraction");
31   hfTask->SetReadMC(kTRUE);    
32
33   /*  ############### HERE THE POSSIBILITY TO SWITCH ON/OFF THE TLISTS AND MC SELECTION WILL BE SET #########à
34
35   hfTask->SetUseCuts(setD0usecuts);
36   hfTask->SetCheckMC(setcheckMC);
37   hfTask->SetCheckMC_D0(setcheckMC_D0);
38   hfTask->SetCheckMC_2prongs(setcheckMC_2prongs);
39   hfTask->SetCheckMC_prompt(setcheckMC_prompt);
40   hfTask->SetCheckMC_fromB(setcheckMC_fromB);
41   hfTask->SetCheckMC_fromDstar(setSkipD0star);
42   hfTask->SetStudyPureBackground(setStudyPureBack);*/
43   //  hfTask->SetSideBands(0);
44   //  hfTask->SetDebugLevel(2);
45   mgr->AddTask(hfTask);
46  
47  
48   
49   // Create containers for input/output
50   AliAnalysisDataContainer *cinput =   mgr->GetCommonInputContainer();
51   //mgr->CreateContainer("cinput",TChain::Class(),AliAnalysisManager::kInputContainer);
52   mgr->ConnectInput(hfTask,0,cinput);
53   
54
55   //Now container for general properties histograms
56   containername="coutputNentries";
57   containername.Append(str.Data());
58   AliAnalysisDataContainer *coutputNentries = mgr->CreateContainer(containername.Data(),TH1F::Class(),
59                                                            AliAnalysisManager::kOutputContainer, 
60                                                            fileout);
61   
62   mgr->ConnectOutput(hfTask,1,coutputNentries);
63
64   containername="coutputSignalType";
65   containername.Append(str.Data());
66   AliAnalysisDataContainer *coutputSignalType = mgr->CreateContainer(containername.Data(),TH1F::Class(),
67                                                            AliAnalysisManager::kOutputContainer, 
68                                                            fileout);
69   
70   mgr->ConnectOutput(hfTask,2,coutputSignalType);
71
72
73   containername="coutputSignalType_LsCuts";
74   containername.Append(str.Data());
75   AliAnalysisDataContainer *coutputSignalType_LsCuts = mgr->CreateContainer(containername.Data(),TH1F::Class(),
76                                                            AliAnalysisManager::kOutputContainer, 
77                                                            fileout);
78   
79   mgr->ConnectOutput(hfTask,3,coutputSignalType_LsCuts);
80
81
82  containername="coutputSignalType_TghCuts";
83   containername.Append(str.Data());
84   AliAnalysisDataContainer *coutputSignalType_TghCuts = mgr->CreateContainer(containername.Data(),TH1F::Class(),
85                                                            AliAnalysisManager::kOutputContainer, 
86                                                            fileout);
87   
88   mgr->ConnectOutput(hfTask,4,coutputSignalType_TghCuts);
89
90   // Now container for TLists 
91   last=5;
92   //##########  NO CUTS TLISTS CONTAINER ##############à
93   containername="clistNCsign";
94   containername.Append(str.Data());
95   AliAnalysisDataContainer *clistNCsign = mgr->CreateContainer(containername.Data(),TList::Class(),
96                                                            AliAnalysisManager::kOutputContainer, 
97                                                            fileout);
98   mgr->ConnectOutput(hfTask,last,clistNCsign);
99   last++;
100
101
102   containername="clistNCback";
103   containername.Append(str.Data());
104   AliAnalysisDataContainer *clistNCback = mgr->CreateContainer(containername.Data(),TList::Class(),
105                                                            AliAnalysisManager::kOutputContainer, 
106                                                            fileout);
107   mgr->ConnectOutput(hfTask,last,clistNCback);
108   last++;
109
110   containername="clistNCfromB";
111   containername.Append(str.Data());
112   AliAnalysisDataContainer *clistNCfromB = mgr->CreateContainer(containername.Data(),TList::Class(),
113                                                            AliAnalysisManager::kOutputContainer, 
114                                                            fileout);
115   mgr->ConnectOutput(hfTask,last,clistNCfromB);
116   last++;
117
118
119   containername="clistNCfromDstar";
120   containername.Append(str.Data());
121   AliAnalysisDataContainer *clistNCfromDstar = mgr->CreateContainer(containername.Data(),TList::Class(),
122                                                            AliAnalysisManager::kOutputContainer, 
123                                                            fileout);
124   mgr->ConnectOutput(hfTask,last,clistNCfromDstar);
125   last++;
126
127
128   containername="clistNCother";
129   containername.Append(str.Data());
130   AliAnalysisDataContainer *clistNCother = mgr->CreateContainer(containername.Data(),TList::Class(),
131                                                            AliAnalysisManager::kOutputContainer, 
132                                                            fileout);
133   mgr->ConnectOutput(hfTask,last,clistNCother);
134   last++;
135
136
137   //######### LOOSE CUTS TLISTS CONTAINER #############
138   containername="clistLSCsign";
139   containername.Append(str.Data());
140   AliAnalysisDataContainer *clistLSCsign = mgr->CreateContainer(containername.Data(),TList::Class(),
141                                                            AliAnalysisManager::kOutputContainer, 
142                                                            fileout);
143   mgr->ConnectOutput(hfTask,last,clistLSCsign);
144   last++;
145
146
147   containername="clistLSCback";
148   containername.Append(str.Data());
149   AliAnalysisDataContainer *clistLSCback = mgr->CreateContainer(containername.Data(),TList::Class(),
150                                                            AliAnalysisManager::kOutputContainer, 
151                                                            fileout);
152   mgr->ConnectOutput(hfTask,last,clistLSCback);
153   last++;
154
155   containername="clistLSCfromB";
156   containername.Append(str.Data());
157   AliAnalysisDataContainer *clistLSCfromB = mgr->CreateContainer(containername.Data(),TList::Class(),
158                                                            AliAnalysisManager::kOutputContainer, 
159                                                            fileout);
160   mgr->ConnectOutput(hfTask,last,clistLSCfromB);
161   last++;
162
163
164   containername="clistLSCfromDstar";
165   containername.Append(str.Data());
166   AliAnalysisDataContainer *clistLSCfromDstar = mgr->CreateContainer(containername.Data(),TList::Class(),
167                                                            AliAnalysisManager::kOutputContainer, 
168                                                            fileout);
169   mgr->ConnectOutput(hfTask,last,clistLSCfromDstar);
170   last++;
171
172
173   containername="clistLSCother";
174   containername.Append(str.Data());
175   AliAnalysisDataContainer *clistLSCother = mgr->CreateContainer(containername.Data(),TList::Class(),
176                                                            AliAnalysisManager::kOutputContainer, 
177                                                            fileout);
178   mgr->ConnectOutput(hfTask,last,clistLSCother);
179   last++;
180
181
182
183   //######### TIGHT CUTS TLISTS CONTAINER #############
184     containername="clistTGHCsign";
185   containername.Append(str.Data());
186   AliAnalysisDataContainer *clistTGHCsign = mgr->CreateContainer(containername.Data(),TList::Class(),
187                                                            AliAnalysisManager::kOutputContainer, 
188                                                            fileout);
189   mgr->ConnectOutput(hfTask,last,clistTGHCsign);
190   last++;
191
192
193   containername="clistTGHCback";
194   containername.Append(str.Data());
195   AliAnalysisDataContainer *clistTGHCback = mgr->CreateContainer(containername.Data(),TList::Class(),
196                                                            AliAnalysisManager::kOutputContainer, 
197                                                            fileout);
198   mgr->ConnectOutput(hfTask,last,clistTGHCback);
199   last++;
200
201   containername="clistTGHCfromB";
202   containername.Append(str.Data());
203   AliAnalysisDataContainer *clistTGHCfromB = mgr->CreateContainer(containername.Data(),TList::Class(),
204                                                            AliAnalysisManager::kOutputContainer, 
205                                                            fileout);
206   mgr->ConnectOutput(hfTask,last,clistTGHCfromB);
207   last++;
208
209
210   containername="clistTGHCfromDstar";
211   containername.Append(str.Data());
212   AliAnalysisDataContainer *clistTGHCfromDstar = mgr->CreateContainer(containername.Data(),TList::Class(),
213                                                            AliAnalysisManager::kOutputContainer, 
214                                                            fileout);
215   mgr->ConnectOutput(hfTask,last,clistTGHCfromDstar);
216   last++;
217
218
219   containername="clistTGHCother";
220   containername.Append(str.Data());
221   AliAnalysisDataContainer *clistTGHCother = mgr->CreateContainer(containername.Data(),TList::Class(),
222                                                            AliAnalysisManager::kOutputContainer, 
223                                                            fileout);
224   mgr->ConnectOutput(hfTask,last,clistTGHCother);
225   
226
227
228   return hfTask;
229 }