]>
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), | |
50 | fhnMassResponse(0) | |
51 | { | |
52 | // Default constructor. | |
53 | ||
54 | SetMakeGeneralHistograms(kTRUE); | |
55 | } | |
56 | ||
57 | //________________________________________________________________________ | |
58 | AliAnalysisTaskJetMassResponseDet::AliAnalysisTaskJetMassResponseDet(const char *name) : | |
59 | AliAnalysisTaskEmcalJet(name, kTRUE), | |
60 | fContainerPart(0), | |
61 | fContainerDet(0), | |
62 | fJetMassType(kRaw), | |
63 | fh2PtVsMassJetPartAll(0), | |
64 | fh2PtVsMassJetPartMatch(0), | |
65 | fh2PtVsMassJetPartTagged(0), | |
66 | fh2PtVsMassJetPartTaggedMatch(0), | |
67 | fh2PtVsMassJetDetAll(0), | |
68 | fh2PtVsMassJetDetTagged(0), | |
69 | fhnMassResponse(0) | |
70 | { | |
71 | // Standard constructor. | |
72 | ||
73 | SetMakeGeneralHistograms(kTRUE); | |
74 | } | |
75 | ||
76 | //________________________________________________________________________ | |
77 | AliAnalysisTaskJetMassResponseDet::~AliAnalysisTaskJetMassResponseDet() | |
78 | { | |
79 | // Destructor. | |
80 | } | |
81 | ||
82 | //________________________________________________________________________ | |
83 | void AliAnalysisTaskJetMassResponseDet::UserCreateOutputObjects() | |
84 | { | |
85 | // Create user output. | |
86 | ||
87 | AliAnalysisTaskEmcalJet::UserCreateOutputObjects(); | |
88 | ||
89 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
90 | TH1::AddDirectory(kFALSE); | |
91 | ||
92 | const Int_t nBinsPt = 200; | |
93 | const Double_t minPt = 0.; | |
94 | const Double_t maxPt = 200.; | |
95 | ||
96 | const Int_t nBinsM = 100; | |
97 | const Double_t minM = 0.; | |
98 | const Double_t maxM = 50.; | |
99 | ||
100 | const Int_t nBinsMT = 50; | |
101 | const Double_t minMT = 0.; | |
102 | const Double_t maxMT = 50.; | |
103 | ||
104 | //Binning for THnSparse | |
105 | const Int_t nBinsSparse0 = 5; | |
106 | const Int_t nBins0[nBinsSparse0] = {nBinsM,nBinsM,nBinsPt,nBinsPt,nBinsMT}; | |
107 | const Double_t xmin0[nBinsSparse0] = { minM, minM, minPt, minPt, minMT}; | |
108 | const Double_t xmax0[nBinsSparse0] = { maxM, maxM, maxPt, maxPt, maxMT}; | |
109 | ||
110 | //Create histograms | |
111 | TString histName = ""; | |
112 | TString histTitle = ""; | |
113 | ||
114 | histName = "fh2PtVsMassJetPartAll"; | |
115 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
116 | fh2PtVsMassJetPartAll = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
117 | fOutput->Add(fh2PtVsMassJetPartAll); | |
118 | ||
119 | histName = "fh2PtVsMassJetPartMatch"; | |
120 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
121 | fh2PtVsMassJetPartMatch = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
122 | fOutput->Add(fh2PtVsMassJetPartMatch); | |
123 | ||
124 | histName = "fh2PtVsMassJetPartTagged"; | |
125 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
126 | fh2PtVsMassJetPartTagged = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
127 | fOutput->Add(fh2PtVsMassJetPartTagged); | |
128 | ||
129 | histName = "fh2PtVsMassJetPartTaggedMatch"; | |
130 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
131 | fh2PtVsMassJetPartTaggedMatch = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
132 | fOutput->Add(fh2PtVsMassJetPartTaggedMatch); | |
133 | ||
134 | histName = "fh2PtVsMassJetDetAll"; | |
135 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
136 | fh2PtVsMassJetDetAll = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
137 | fOutput->Add(fh2PtVsMassJetDetAll); | |
138 | ||
139 | histName = "fh2PtVsMassJetDetTagged"; | |
140 | histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}",histName.Data()); | |
141 | fh2PtVsMassJetDetTagged = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM); | |
142 | fOutput->Add(fh2PtVsMassJetDetTagged); | |
143 | ||
144 | histName = "fhnMassResponse"; | |
145 | histTitle = Form("%s;#it{M}_{det};#it{M}_{part};#it{p}_{T,det};#it{p}_{T,part};#it{M}_{det}^{tagged}",histName.Data()); | |
146 | fhnMassResponse = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse0,nBins0,xmin0,xmax0); | |
147 | fOutput->Add(fhnMassResponse); | |
148 | ||
149 | ||
150 | // =========== Switch on Sumw2 for all histos =========== | |
151 | for (Int_t i=0; i<fOutput->GetEntries(); ++i) { | |
152 | TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i)); | |
153 | if (h1){ | |
154 | h1->Sumw2(); | |
155 | continue; | |
156 | } | |
157 | THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i)); | |
158 | if(hn)hn->Sumw2(); | |
159 | } | |
160 | ||
161 | TH1::AddDirectory(oldStatus); | |
162 | ||
163 | PostData(1, fOutput); // Post data for ALL output slots > 0 here. | |
164 | } | |
165 | ||
166 | //________________________________________________________________________ | |
167 | Bool_t AliAnalysisTaskJetMassResponseDet::Run() | |
168 | { | |
169 | // Run analysis code here, if needed. It will be executed before FillHistograms(). | |
170 | ||
171 | return kTRUE; | |
172 | } | |
173 | ||
174 | //________________________________________________________________________ | |
175 | Bool_t AliAnalysisTaskJetMassResponseDet::FillHistograms() | |
176 | { | |
177 | // Fill histograms. | |
178 | ||
179 | AliJetContainer *jetPart = GetJetContainer(fContainerPart); | |
180 | AliJetContainer *jetDet = GetJetContainer(fContainerDet); | |
181 | AliEmcalJet* jPart = NULL; | |
182 | AliEmcalJet* jDet = NULL; | |
183 | ||
184 | //loop on particle level jets | |
185 | if(jetPart) { | |
186 | jetPart->ResetCurrentID(); | |
187 | while((jPart = jetPart->GetNextAcceptJet())) { | |
188 | fh2PtVsMassJetPartAll->Fill(jPart->Pt(),jPart->M()); | |
189 | jDet = jPart->ClosestJet(); | |
190 | if(jDet) fh2PtVsMassJetPartMatch->Fill(jPart->Pt(),jPart->M()); | |
191 | if(jPart->GetTagStatus()<1 || !jPart->GetTaggedJet()) | |
192 | continue; | |
193 | fh2PtVsMassJetPartTagged->Fill(jPart->Pt(),jPart->M()); | |
194 | if(jDet) fh2PtVsMassJetPartTaggedMatch->Fill(jPart->Pt(),jPart->M()); | |
195 | } | |
196 | } | |
197 | ||
198 | //loop on detector level jets | |
199 | if(jetDet) { | |
200 | jetDet->ResetCurrentID(); | |
201 | while((jDet = jetDet->GetNextAcceptJet())) { | |
202 | Double_t mjet = GetJetMass(jDet); | |
203 | fh2PtVsMassJetDetAll->Fill(jDet->Pt(),mjet); | |
204 | if(jDet->GetTagStatus()>=1 && jDet->GetTaggedJet()) | |
205 | fh2PtVsMassJetDetTagged->Fill(jDet->Pt(),mjet); | |
206 | ||
207 | //fill detector response | |
208 | jPart = jDet->ClosestJet(); | |
209 | if(jPart) { | |
210 | AliEmcalJet *jDetT = jDet->GetTaggedJet(); | |
211 | Double_t mdetT = 0.; | |
212 | if(jDetT) mdetT = jDetT->M(); | |
213 | Double_t var[5] = {GetJetMass(jDet),jPart->M(),jDet->Pt(),jPart->Pt(),mdetT}; | |
214 | fhnMassResponse->Fill(var); | |
215 | } | |
216 | } | |
217 | } | |
218 | return kTRUE; | |
219 | } | |
220 | ||
221 | //________________________________________________________________________ | |
222 | Double_t AliAnalysisTaskJetMassResponseDet::GetJetMass(AliEmcalJet *jet) { | |
223 | //calc subtracted jet mass | |
224 | if(fJetMassType==kRaw) | |
225 | return jet->M(); | |
226 | else if(fJetMassType==kDeriv) | |
227 | return jet->GetSecondOrderSubtracted(); | |
228 | ||
229 | return 0; | |
230 | } | |
231 | ||
232 | //________________________________________________________________________ | |
233 | Bool_t AliAnalysisTaskJetMassResponseDet::RetrieveEventObjects() { | |
234 | // | |
235 | // retrieve event objects | |
236 | if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects()) | |
237 | return kFALSE; | |
238 | ||
239 | return kTRUE; | |
240 | } | |
241 | ||
242 | //_______________________________________________________________________ | |
243 | void AliAnalysisTaskJetMassResponseDet::Terminate(Option_t *) | |
244 | { | |
245 | // Called once at the end of the analysis. | |
246 | } | |
247 |