]>
Commit | Line | Data |
---|---|---|
252cb00e | 1 | // |
2 | // Detector response jet mass analysis task. | |
3 | // | |
4 | // Author: M.Verweij | |
5 | ||
6 | #include <TClonesArray.h> | |
7 | #include <TH1F.h> | |
8 | #include <TH2F.h> | |
9 | #include <TH3F.h> | |
10 | #include <THnSparse.h> | |
11 | #include <TList.h> | |
12 | #include <TLorentzVector.h> | |
13 | #include <TProfile.h> | |
14 | #include <TChain.h> | |
15 | #include <TSystem.h> | |
16 | #include <TFile.h> | |
17 | #include <TKey.h> | |
18 | ||
19 | #include "AliVCluster.h" | |
20 | #include "AliVTrack.h" | |
21 | #include "AliEmcalJet.h" | |
22 | #include "AliRhoParameter.h" | |
23 | #include "AliLog.h" | |
24 | #include "AliEmcalParticle.h" | |
25 | #include "AliMCEvent.h" | |
26 | #include "AliGenPythiaEventHeader.h" | |
27 | #include "AliAODMCHeader.h" | |
28 | #include "AliMCEvent.h" | |
29 | #include "AliAnalysisManager.h" | |
30 | #include "AliJetContainer.h" | |
31 | ||
32 | #include "AliAODEvent.h" | |
33 | ||
34 | #include "AliAnalysisTaskJetMassResponseDet.h" | |
35 | ||
36 | ClassImp(AliAnalysisTaskJetMassResponseDet) | |
37 | ||
38 | //________________________________________________________________________ | |
39 | AliAnalysisTaskJetMassResponseDet::AliAnalysisTaskJetMassResponseDet() : | |
40 | AliAnalysisTaskEmcalJet("AliAnalysisTaskJetMassResponseDet", kTRUE), | |
41 | fContainerPart(0), | |
42 | fContainerDet(0), | |
43 | fJetMassType(kRaw), | |
44 | fh2PtVsMassJetPartAll(0), | |
45 | fh2PtVsMassJetPartMatch(0), | |
46 | fh2PtVsMassJetPartTagged(0), | |
47 | fh2PtVsMassJetPartTaggedMatch(0), | |
48 | fh2PtVsMassJetDetAll(0), | |
49 | fh2PtVsMassJetDetTagged(0), | |
b3821b05 | 50 | fh2EtaPhiMatchedDet(0), |
51 | fh2EtaPhiMatchedPart(0), | |
252cb00e | 52 | fhnMassResponse(0) |
53 | { | |
54 | // Default constructor. | |
55 | ||
56 | SetMakeGeneralHistograms(kTRUE); | |
57 | } | |
58 | ||
59 | //________________________________________________________________________ | |
60 | AliAnalysisTaskJetMassResponseDet::AliAnalysisTaskJetMassResponseDet(const char *name) : | |
61 | AliAnalysisTaskEmcalJet(name, kTRUE), | |
62 | fContainerPart(0), | |
63 | fContainerDet(0), | |
64 | fJetMassType(kRaw), | |
65 | fh2PtVsMassJetPartAll(0), | |
66 | fh2PtVsMassJetPartMatch(0), | |
67 | fh2PtVsMassJetPartTagged(0), | |
68 | fh2PtVsMassJetPartTaggedMatch(0), | |
69 | fh2PtVsMassJetDetAll(0), | |
70 | fh2PtVsMassJetDetTagged(0), | |
b3821b05 | 71 | fh2EtaPhiMatchedDet(0), |
72 | fh2EtaPhiMatchedPart(0), | |
252cb00e | 73 | fhnMassResponse(0) |
74 | { | |
75 | // Standard constructor. | |
76 | ||
77 | SetMakeGeneralHistograms(kTRUE); | |
78 | } | |
79 | ||
80 | //________________________________________________________________________ | |
81 | AliAnalysisTaskJetMassResponseDet::~AliAnalysisTaskJetMassResponseDet() | |
82 | { | |
83 | // Destructor. | |
84 | } | |
85 | ||
86 | //________________________________________________________________________ | |
87 | void AliAnalysisTaskJetMassResponseDet::UserCreateOutputObjects() | |
88 | { | |
89 | // Create user output. | |
90 | ||
91 | AliAnalysisTaskEmcalJet::UserCreateOutputObjects(); | |
92 | ||
93 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
94 | TH1::AddDirectory(kFALSE); | |
95 | ||
96 | const Int_t nBinsPt = 200; | |
97 | const Double_t minPt = 0.; | |
98 | const Double_t maxPt = 200.; | |
99 | ||
100 | const Int_t nBinsM = 100; | |
101 | const Double_t minM = 0.; | |
102 | const Double_t maxM = 50.; | |
103 | ||
b3821b05 | 104 | const Int_t nBinsConstEff = 24; |
105 | const Double_t minConstEff = 0.; | |
106 | const Double_t maxConstEff = 1.2; | |
252cb00e | 107 | |
b3821b05 | 108 | // const Int_t nBinsConst = 26; |
109 | // const Double_t minConst = -5.5; | |
110 | // const Double_t maxConst = 20.5; | |
1c0626ce | 111 | |
252cb00e | 112 | //Binning for THnSparse |
113 | const Int_t nBinsSparse0 = 5; | |
b3821b05 | 114 | const Int_t nBins0[nBinsSparse0] = {nBinsM,nBinsM,nBinsPt,nBinsPt,nBinsConstEff}; |
115 | const Double_t xmin0[nBinsSparse0] = { minM, minM, minPt, minPt, minConstEff}; | |
116 | const Double_t xmax0[nBinsSparse0] = { maxM, maxM, maxPt, maxPt, maxConstEff}; | |
252cb00e | 117 | |
118 | //Create histograms | |
119 | TString histName = ""; | |
120 | TString histTitle = ""; | |
121 | ||
122 | histName = "fh2PtVsMassJetPartAll"; | |
123 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
124 | fh2PtVsMassJetPartAll = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
125 | fOutput->Add(fh2PtVsMassJetPartAll); | |
126 | ||
127 | histName = "fh2PtVsMassJetPartMatch"; | |
128 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
129 | fh2PtVsMassJetPartMatch = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
130 | fOutput->Add(fh2PtVsMassJetPartMatch); | |
131 | ||
132 | histName = "fh2PtVsMassJetPartTagged"; | |
133 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
134 | fh2PtVsMassJetPartTagged = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
135 | fOutput->Add(fh2PtVsMassJetPartTagged); | |
136 | ||
137 | histName = "fh2PtVsMassJetPartTaggedMatch"; | |
138 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
139 | fh2PtVsMassJetPartTaggedMatch = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
140 | fOutput->Add(fh2PtVsMassJetPartTaggedMatch); | |
141 | ||
142 | histName = "fh2PtVsMassJetDetAll"; | |
143 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
144 | fh2PtVsMassJetDetAll = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
145 | fOutput->Add(fh2PtVsMassJetDetAll); | |
146 | ||
147 | histName = "fh2PtVsMassJetDetTagged"; | |
148 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
149 | fh2PtVsMassJetDetTagged = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
150 | fOutput->Add(fh2PtVsMassJetDetTagged); | |
151 | ||
b3821b05 | 152 | histName = "fh2EtaPhiMatchedDet"; |
153 | histTitle = TString::Format("%s;#eta;#varphi",histName.Data()); | |
154 | fh2EtaPhiMatchedDet = new TH2F(histName.Data(),histTitle.Data(),100,-1.,1.,72,0.,TMath::TwoPi()); | |
155 | fOutput->Add(fh2EtaPhiMatchedDet); | |
156 | ||
157 | histName = "fh2EtaPhiMatchedPart"; | |
158 | histTitle = TString::Format("%s;#eta;#varphi",histName.Data()); | |
159 | fh2EtaPhiMatchedPart = new TH2F(histName.Data(),histTitle.Data(),100,-1.,1.,72,0.,TMath::TwoPi()); | |
160 | fOutput->Add(fh2EtaPhiMatchedPart); | |
161 | ||
252cb00e | 162 | histName = "fhnMassResponse"; |
163 | histTitle = Form("%s;#it{M}_{det};#it{M}_{part};#it{p}_{T,det};#it{p}_{T,part};#it{M}_{det}^{tagged}",histName.Data()); | |
164 | fhnMassResponse = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse0,nBins0,xmin0,xmax0); | |
165 | fOutput->Add(fhnMassResponse); | |
166 | ||
167 | ||
168 | // =========== Switch on Sumw2 for all histos =========== | |
169 | for (Int_t i=0; i<fOutput->GetEntries(); ++i) { | |
170 | TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i)); | |
171 | if (h1){ | |
172 | h1->Sumw2(); | |
173 | continue; | |
174 | } | |
175 | THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i)); | |
176 | if(hn)hn->Sumw2(); | |
177 | } | |
178 | ||
179 | TH1::AddDirectory(oldStatus); | |
180 | ||
181 | PostData(1, fOutput); // Post data for ALL output slots > 0 here. | |
182 | } | |
183 | ||
184 | //________________________________________________________________________ | |
185 | Bool_t AliAnalysisTaskJetMassResponseDet::Run() | |
186 | { | |
187 | // Run analysis code here, if needed. It will be executed before FillHistograms(). | |
252cb00e | 188 | return kTRUE; |
189 | } | |
190 | ||
191 | //________________________________________________________________________ | |
192 | Bool_t AliAnalysisTaskJetMassResponseDet::FillHistograms() | |
193 | { | |
194 | // Fill histograms. | |
195 | ||
1c0626ce | 196 | AliJetContainer *cPart = GetJetContainer(fContainerPart); |
197 | AliJetContainer *cDet = GetJetContainer(fContainerDet); | |
252cb00e | 198 | AliEmcalJet* jPart = NULL; |
199 | AliEmcalJet* jDet = NULL; | |
200 | ||
201 | //loop on particle level jets | |
1c0626ce | 202 | if(cPart) { |
203 | cPart->ResetCurrentID(); | |
204 | while((jPart = cPart->GetNextAcceptJet())) { | |
252cb00e | 205 | fh2PtVsMassJetPartAll->Fill(jPart->Pt(),jPart->M()); |
206 | jDet = jPart->ClosestJet(); | |
207 | if(jDet) fh2PtVsMassJetPartMatch->Fill(jPart->Pt(),jPart->M()); | |
208 | if(jPart->GetTagStatus()<1 || !jPart->GetTaggedJet()) | |
209 | continue; | |
210 | fh2PtVsMassJetPartTagged->Fill(jPart->Pt(),jPart->M()); | |
211 | if(jDet) fh2PtVsMassJetPartTaggedMatch->Fill(jPart->Pt(),jPart->M()); | |
212 | } | |
213 | } | |
214 | ||
215 | //loop on detector level jets | |
1c0626ce | 216 | if(cDet) { |
217 | cDet->ResetCurrentID(); | |
218 | while((jDet = cDet->GetNextAcceptJet())) { | |
252cb00e | 219 | Double_t mjet = GetJetMass(jDet); |
220 | fh2PtVsMassJetDetAll->Fill(jDet->Pt(),mjet); | |
221 | if(jDet->GetTagStatus()>=1 && jDet->GetTaggedJet()) | |
222 | fh2PtVsMassJetDetTagged->Fill(jDet->Pt(),mjet); | |
223 | ||
224 | //fill detector response | |
225 | jPart = jDet->ClosestJet(); | |
226 | if(jPart) { | |
b3821b05 | 227 | |
228 | fh2EtaPhiMatchedDet->Fill(jDet->Eta(),jDet->Phi()); | |
229 | fh2EtaPhiMatchedPart->Fill(jPart->Eta(),jPart->Phi()); | |
230 | ||
231 | Int_t nConstPart = jPart->GetNumberOfConstituents(); | |
232 | Int_t nConstDet = jDet->GetNumberOfConstituents(); | |
233 | Int_t diff = nConstPart-nConstDet; | |
234 | Double_t eff = -1.; | |
235 | if(nConstPart>0) eff = (Double_t)nConstDet/((Double_t)nConstPart); | |
236 | Double_t var[5] = {GetJetMass(jDet),jPart->M(),jDet->Pt(),jPart->Pt(),eff}; | |
252cb00e | 237 | fhnMassResponse->Fill(var); |
1c0626ce | 238 | |
239 | if(jPart->Pt()>40. && jPart->Pt()<50.) { | |
240 | if(jDet->Pt()>50.) Printf("feed-out high"); | |
241 | else if(jDet->Pt()<40.) Printf("feed-out low"); | |
242 | else Printf("correct"); | |
243 | Printf("pT Part: %f Det: %f",jPart->Pt(),jDet->Pt()); | |
244 | Printf("mass Part: %f Det: %f",jPart->M(),jDet->M()); | |
b3821b05 | 245 | |
1c0626ce | 246 | Printf("nConst Part: %d Det: %d diff: %d",nConstPart,nConstDet,diff); |
247 | } | |
252cb00e | 248 | } |
249 | } | |
250 | } | |
251 | return kTRUE; | |
252 | } | |
253 | ||
254 | //________________________________________________________________________ | |
255 | Double_t AliAnalysisTaskJetMassResponseDet::GetJetMass(AliEmcalJet *jet) { | |
256 | //calc subtracted jet mass | |
257 | if(fJetMassType==kRaw) | |
258 | return jet->M(); | |
259 | else if(fJetMassType==kDeriv) | |
260 | return jet->GetSecondOrderSubtracted(); | |
261 | ||
262 | return 0; | |
263 | } | |
264 | ||
265 | //________________________________________________________________________ | |
266 | Bool_t AliAnalysisTaskJetMassResponseDet::RetrieveEventObjects() { | |
267 | // | |
268 | // retrieve event objects | |
269 | if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects()) | |
270 | return kFALSE; | |
271 | ||
272 | return kTRUE; | |
273 | } | |
274 | ||
275 | //_______________________________________________________________________ | |
276 | void AliAnalysisTaskJetMassResponseDet::Terminate(Option_t *) | |
277 | { | |
278 | // Called once at the end of the analysis. | |
279 | } | |
280 |