]>
Commit | Line | Data |
---|---|---|
c84dbedf | 1 | //DEFINITION OF A FEW CONSTANTS |
2 | //---------------------------------------------------- | |
3 | ||
4 | /* $Id$ */ | |
5 | ||
53454b81 | 6 | AliAnalysisTaskDStarCorrelations *AddTaskDStarCorrelations(Bool_t runOnPbPb,Bool_t theMCon, Bool_t mixing, Bool_t UseReco = kTRUE, Int_t trackselect =1, Int_t usedispl =0, TString DCutObjNamePrefix = "_corr", TString TrackCutObjNamePrefix = "") |
c84dbedf | 7 | { |
8 | ||
9 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
10 | if (!mgr) { | |
11 | ::Error(" AliAnalysisTaskDStarCorrelations", "No analysis manager to connect to."); | |
12 | return NULL; | |
13 | } | |
14 | ||
53454b81 | 15 | |
16 | TString DCutObjPath = "~/CorrelationAnalysis/CutObjects/DStar/"; | |
17 | ||
18 | ||
19 | ||
20 | TString DCutObjName = "DStartoKpipiCuts"; | |
21 | DCutObjName += DCutObjNamePrefix; | |
22 | DCutObjName += ".root"; | |
23 | ||
24 | DCutObjName.Prepend(DCutObjPath.Data()); | |
25 | ||
26 | cout << "D* cut object is " << DCutObjName << endl; | |
c84dbedf | 27 | TFile* filecuts=new TFile(DCutObjName.Data()); |
28 | if(!filecuts->IsOpen()){ | |
53454b81 | 29 | cout<<"DStar cut object file not found: exit"<<endl; |
c84dbedf | 30 | return; |
31 | } | |
32 | ||
53454b81 | 33 | TString TrackCutObjPath = "~/CorrelationAnalysis/CutObjects/AssocTracks/"; |
34 | ||
c84dbedf | 35 | TString TrackCutObjName = "AssocPartCuts"; |
36 | TrackCutObjName += TrackCutObjNamePrefix; | |
37 | TrackCutObjName += ".root"; | |
38 | ||
53454b81 | 39 | TrackCutObjName.Prepend(TrackCutObjPath.Data()); |
40 | ||
41 | cout << "tracks cut object is " << TrackCutObjName << endl; | |
c84dbedf | 42 | TFile* filecuts2=new TFile(TrackCutObjName.Data()); |
43 | if(!filecuts2->IsOpen()){ | |
53454b81 | 44 | cout<<"Track cut object file not found: exit"<<endl; |
c84dbedf | 45 | return; |
46 | } | |
47 | ||
48 | AliRDHFCutsDStartoKpipi* RDHFDStartoKpipi=new AliRDHFCutsDStartoKpipi(); | |
49 | RDHFDStartoKpipi = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts"); | |
50 | RDHFDStartoKpipi->SetName("DStartoKpipiCuts"); | |
51 | ||
52 | ||
53 | AliHFAssociatedTrackCuts* corrCuts=new AliHFAssociatedTrackCuts(); | |
54 | corrCuts = (AliHFAssociatedTrackCuts*)filecuts2->Get("AssociatedCuts"); | |
55 | corrCuts->SetName("AssociatedCuts"); | |
56 | corrCuts->PrintAll(); | |
53454b81 | 57 | |
58 | // mm let's see if everything is ok | |
59 | if(!RDHFDStartoKpipi){ | |
60 | cout<<"Specific AliRDHFCuts not found"<<endl; | |
61 | return; | |
62 | } | |
63 | ||
64 | if(!corrCuts){ | |
65 | cout<<"Specific associated track cuts not found"<<endl; | |
66 | return; | |
67 | } | |
68 | ||
69 | TString selectMCproc = ""; | |
70 | ||
71 | Int_t NMCevents = corrCuts->GetNofMCEventType(); | |
72 | for(Int_t k=0; k<NMCevents; k++){ | |
73 | Int_t * MCEventType = corrCuts->GetMCEventType(); | |
74 | selectMCproc += Form("%d",MCEventType[k]); | |
75 | } | |
76 | ||
77 | cout << "Select process string = " << selectMCproc << endl; | |
78 | ||
c84dbedf | 79 | |
c84dbedf | 80 | |
81 | //CREATE THE TASK | |
82 | printf("CREATE TASK \n"); | |
83 | // create the task | |
53454b81 | 84 | AliAnalysisTaskDStarCorrelations *task = new AliAnalysisTaskDStarCorrelations("AliAnalysisTaskDStarCorrelations",RDHFDStartoKpipi,corrCuts); |
c84dbedf | 85 | |
86 | // Setters | |
87 | ||
53454b81 | 88 | if(!theMCon) { |
89 | printf("Analysis on Data - reconstruction only!"); | |
90 | UseReco = kTRUE; | |
91 | } | |
92 | ||
c84dbedf | 93 | task->SetMonteCarlo(theMCon); |
94 | task->SetUseMixing(mixing); | |
95 | task->SetCorrelator(trackselect) ; | |
96 | task->SetUseDisplacement(usedispl); | |
97 | task->SetRunPbPb(runOnPbPb); | |
53454b81 | 98 | task->SetLevelOfDebug(2); |
99 | task->SetUseReconstruction(UseReco); // set kTRUE for Using Reconstruction, kFALSe for MC Truth | |
c84dbedf | 100 | |
101 | ||
102 | if(trackselect == 1) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with charged hadrons \n"); | |
103 | else if(trackselect == 2) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with charged kaons \n"); | |
104 | else if(trackselect == 3) Info(" AliAnalysisTaskDStarCorrelations","Correlating D* with reconstructed K0s \n"); | |
105 | else Fatal(" AliAnalysisTaskDStarCorrelations","Nothing to correlate with!"); | |
106 | if(mixing) Info (" AliAnalysisTaskDStarCorrelations","Event Mixing Analysis\n"); | |
107 | if(!mixing) Info (" AliAnalysisTaskDStarCorrelations","Single Event Analysis \n"); | |
108 | ||
109 | // Create and connect containers for input/output | |
110 | //TString dcavalue = " "; | |
111 | if(!theMCon) TString contname = "Data"; | |
112 | if(theMCon) TString contname = "MonteCarlo"; | |
53454b81 | 113 | TString contname2 = "MC"; |
c84dbedf | 114 | if(trackselect ==1) TString particle = "Hadron"; |
115 | if(trackselect ==2) TString particle = "Kaon"; | |
116 | if(trackselect ==3) TString particle = "KZero"; | |
117 | ||
118 | TString cutname = "cuts" ; | |
119 | TString cutname2 = "hadroncuts" ; | |
53454b81 | 120 | TString outputfile = AliAnalysisManager::GetCommonFileName(); |
121 | TString outputfileMC = AliAnalysisManager::GetCommonFileName(); | |
c84dbedf | 122 | TString counter = "NormCounter"; |
53454b81 | 123 | outputfile += ":PWGHF_D2H_"; |
124 | outputfileMC += ":PWGHF_D2H_"; | |
125 | ||
c84dbedf | 126 | if(!mixing) { |
127 | outputfile += "SE"; | |
53454b81 | 128 | outputfileMC += "SE"; |
c84dbedf | 129 | contname += "SE"; |
53454b81 | 130 | contname2 += "SE"; |
c84dbedf | 131 | cutname += "SE"; |
132 | cutname2 += "SE"; | |
133 | counter+= "SE"; | |
134 | } | |
135 | if(mixing){ | |
136 | outputfile += "ME"; | |
53454b81 | 137 | outputfileMC += "ME"; |
c84dbedf | 138 | contname += "ME"; |
53454b81 | 139 | contname2 += "ME"; |
c84dbedf | 140 | cutname += "ME"; |
141 | cutname2 += "ME"; | |
142 | counter+= "ME"; | |
143 | } | |
144 | outputfile += "Dphi_DStar"; | |
53454b81 | 145 | outputfileMC += "Dphi_DStar"; |
c84dbedf | 146 | outputfile += particle; |
53454b81 | 147 | outputfileMC += particle; |
c84dbedf | 148 | cutname += particle; |
149 | cutname2 += particle; | |
150 | contname += particle; | |
53454b81 | 151 | contname2 += particle; |
c84dbedf | 152 | counter+= particle; |
153 | ||
53454b81 | 154 | |
155 | ||
156 | outputfile += DCutObjNamePrefix; | |
157 | outputfileMC += DCutObjNamePrefix; | |
158 | cutname += DCutObjNamePrefix; | |
159 | cutname2 += DCutObjNamePrefix; | |
160 | contname += DCutObjNamePrefix; | |
161 | contname2 += DCutObjNamePrefix; | |
162 | counter+= DCutObjNamePrefix; | |
163 | ||
c84dbedf | 164 | outputfile += TrackCutObjNamePrefix; |
53454b81 | 165 | outputfileMC += TrackCutObjNamePrefix; |
c84dbedf | 166 | cutname += TrackCutObjNamePrefix; |
167 | cutname2 += TrackCutObjNamePrefix; | |
168 | contname += TrackCutObjNamePrefix; | |
53454b81 | 169 | contname2 += TrackCutObjNamePrefix; |
c84dbedf | 170 | counter+= TrackCutObjNamePrefix; |
171 | ||
53454b81 | 172 | outputfile += selectMCproc; |
173 | outputfileMC += selectMCproc; | |
174 | cutname += selectMCproc; | |
175 | cutname2 += selectMCproc; | |
176 | contname += selectMCproc; | |
177 | contname2 += selectMCproc; | |
178 | counter+= selectMCproc; | |
179 | ||
180 | TString reco = ""; | |
181 | ||
182 | if(UseReco) reco = "_reco"; | |
183 | if(!UseReco) reco = "_MCTruth"; | |
184 | ||
185 | outputfile += reco; | |
186 | outputfileMC += reco; | |
187 | cutname += reco; | |
188 | cutname2 += reco; | |
189 | contname += reco; | |
190 | contname2 += reco; | |
191 | counter+= reco; | |
192 | ||
193 | ||
194 | cout << contname << endl; | |
195 | cout << contname2 << endl; | |
196 | cout << cutname << endl; | |
197 | cout << cutname2 << endl; | |
198 | cout << counter << endl; | |
199 | cout << outputfile << endl; | |
200 | //return; | |
c84dbedf | 201 | |
c84dbedf | 202 | mgr->AddTask(task); |
203 | // ------ input data ------ | |
204 | AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer(); | |
205 | ||
206 | // ----- output data ----- | |
207 | ||
208 | // output TH1I for event counting | |
53454b81 | 209 | |
210 | //TLists | |
c84dbedf | 211 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); |
53454b81 | 212 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(contname2, TList::Class(),AliAnalysisManager::kOutputContainer,outputfileMC.Data()); |
213 | // Cut Objects | |
214 | AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(cutname,AliRDHFCutsDStartoKpipi::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts D | |
215 | AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(cutname2,AliHFAssociatedTrackCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //cuts tracks | |
216 | // Normalization Counter | |
217 | AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(counter,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); | |
c84dbedf | 218 | |
53454b81 | 219 | |
c84dbedf | 220 | mgr->ConnectInput(task,0,mgr->GetCommonInputContainer()); |
221 | mgr->ConnectOutput(task,1,coutput1); | |
222 | mgr->ConnectOutput(task,2,coutput2); | |
53454b81 | 223 | mgr->ConnectOutput(task,3,coutput3); |
c84dbedf | 224 | mgr->ConnectOutput(task,4,coutput4); |
53454b81 | 225 | mgr->ConnectOutput(task,5,coutput5); |
c84dbedf | 226 | |
227 | return task ; | |
228 | ||
229 | } | |
230 |