]>
Commit | Line | Data |
---|---|---|
d31dce33 | 1 | #include "AliFMDAnalysisTaskGenerateCorrection.h" |
2 | #include "AliESDEvent.h" | |
3 | #include "iostream" | |
4 | #include "AliESDFMD.h" | |
5 | #include "TH2F.h" | |
6 | #include "AliTrackReference.h" | |
7 | #include "AliStack.h" | |
8 | #include "AliFMDAnaParameters.h" | |
9 | #include "AliFMDStripIndex.h" | |
10 | #include "AliStack.h" | |
11 | #include "AliMCParticle.h" | |
12 | #include "AliMCEvent.h" | |
13 | //#include "AliFMDGeometry.h" | |
14 | #include "TArray.h" | |
15 | #include "AliGenEventHeader.h" | |
04f1ff3d | 16 | #include "AliMultiplicity.h" |
d31dce33 | 17 | #include "AliHeader.h" |
18 | #include "AliFMDAnaCalibBackgroundCorrection.h" | |
19 | #include "AliFMDAnaCalibEventSelectionEfficiency.h" | |
059c7c6b | 20 | #include "AliGenPythiaEventHeader.h" |
d31dce33 | 21 | //#include "AliCDBManager.h" |
22 | //#include "AliCDBId.h" | |
23 | //#include "AliCDBMetaData.h" | |
24 | #include "TSystem.h" | |
25 | #include "TROOT.h" | |
26 | #include "TAxis.h" | |
507687cd | 27 | #include "AliGenDPMjetEventHeader.h" |
3d4a1473 | 28 | #include <TFile.h> |
507687cd | 29 | |
d31dce33 | 30 | ClassImp(AliFMDAnalysisTaskGenerateCorrection) |
1b418b63 | 31 | #if 0 |
32 | ; // This is for emacs - do not delete | |
33 | #endif | |
d31dce33 | 34 | |
35 | //_____________________________________________________________________ | |
36 | AliFMDAnalysisTaskGenerateCorrection::AliFMDAnalysisTaskGenerateCorrection(): | |
37 | AliAnalysisTaskSE(), | |
38 | fListOfHits(), | |
39 | fListOfPrimaries(), | |
40 | fListOfCorrection(), | |
41 | fVertexBins(), | |
42 | fLastTrackByStrip(0), | |
43 | fHitsByStrip(0), | |
44 | fZvtxCut(10), | |
45 | fNvtxBins(10), | |
4b818035 | 46 | fNbinsEta(240), |
9f55be54 | 47 | fBackground(0), |
4b818035 | 48 | fEventSelectionEff(0), |
49 | fEtaLow(-6), | |
50 | fEtaHigh(6) | |
d31dce33 | 51 | { |
52 | // Default constructor | |
53 | } | |
54 | //_____________________________________________________________________ | |
55 | AliFMDAnalysisTaskGenerateCorrection::AliFMDAnalysisTaskGenerateCorrection(const char* name): | |
56 | AliAnalysisTaskSE(name), | |
57 | fListOfHits(), | |
58 | fListOfPrimaries(), | |
59 | fListOfCorrection(), | |
60 | fVertexBins(), | |
61 | fLastTrackByStrip(0), | |
62 | fHitsByStrip(0), | |
63 | fZvtxCut(10), | |
64 | fNvtxBins(10), | |
4b818035 | 65 | fNbinsEta(240), |
9f55be54 | 66 | fBackground(0), |
4b818035 | 67 | fEventSelectionEff(0), |
68 | fEtaLow(-6), | |
69 | fEtaHigh(6) | |
d31dce33 | 70 | { |
71 | ||
72 | DefineOutput(1, TList::Class()); | |
73 | DefineOutput(2, TList::Class()); | |
74 | DefineOutput(3, TH1F::Class()); | |
75 | DefineOutput(4, TList::Class()); | |
76 | } | |
77 | //_____________________________________________________________________ | |
78 | void AliFMDAnalysisTaskGenerateCorrection::UserCreateOutputObjects() | |
79 | { | |
80 | // Create the output containers | |
81 | // | |
82 | ||
83 | std::cout<<"Creating output objects"<<std::endl; | |
507687cd | 84 | |
df2a9c32 | 85 | // SelectCollisionCandidates(AliVEvent::kAny); |
507687cd | 86 | |
04f1ff3d | 87 | for(Int_t v=0; v<fNvtxBins;v++) { |
88 | ||
89 | TH2F* hSPDhits = new TH2F(Form("hSPDhits_vtx%d",v), | |
90 | Form("hSPDhits_vtx%d",v), | |
4b818035 | 91 | fNbinsEta, fEtaLow,fEtaHigh, 20, 0,2*TMath::Pi()); |
04f1ff3d | 92 | hSPDhits->Sumw2(); |
93 | fListOfHits.Add(hSPDhits); | |
94 | ||
f7356393 | 95 | TH1F* hReadChannels = new TH1F(Form("hFMDReadChannels_vtx%d",v), |
96 | Form("hFMDReadChannels_vtx%d",v), | |
4b818035 | 97 | fNbinsEta,fEtaLow,fEtaHigh); |
f7356393 | 98 | hReadChannels->Sumw2(); |
99 | fListOfHits.Add(hReadChannels); | |
100 | TH1F* hAllChannels = new TH1F(Form("hFMDAllChannels_vtx%d",v), | |
101 | Form("hFMDAllChannels_vtx%d",v), | |
4b818035 | 102 | fNbinsEta,fEtaLow,fEtaHigh); |
f7356393 | 103 | hAllChannels->Sumw2(); |
104 | fListOfHits.Add(hAllChannels); | |
105 | ||
106 | ||
107 | ||
04f1ff3d | 108 | for(Int_t iring = 0; iring<2;iring++) { |
109 | Char_t ringChar = (iring == 0 ? 'I' : 'O'); | |
110 | Int_t nSec = (iring == 1 ? 40 : 20); | |
111 | ||
d31dce33 | 112 | TH2F* hPrimary = new TH2F(Form("hPrimary_FMD_%c_vtx%d",ringChar,v), |
113 | Form("hPrimary_FMD_%c_vtx%d",ringChar,v), | |
4b818035 | 114 | fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi()); |
d31dce33 | 115 | hPrimary->Sumw2(); |
116 | fListOfPrimaries.Add(hPrimary); | |
507687cd | 117 | TH2F* hPrimaryNSD = new TH2F(Form("hPrimaryNSD_FMD_%c_vtx%d",ringChar,v), |
118 | Form("hPrimaryNSD_FMD_%c_vtx%d",ringChar,v), | |
4b818035 | 119 | fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi()); |
507687cd | 120 | hPrimaryNSD->Sumw2(); |
121 | fListOfPrimaries.Add(hPrimaryNSD); | |
122 | ||
04f1ff3d | 123 | |
124 | ||
d31dce33 | 125 | } |
126 | } | |
127 | ||
04f1ff3d | 128 | |
d31dce33 | 129 | |
130 | ||
131 | for(Int_t det =1; det<=3;det++) { | |
132 | Int_t nRings = (det==1 ? 1 : 2); | |
133 | for(Int_t ring = 0;ring<nRings;ring++) { | |
134 | Int_t nSec = (ring == 1 ? 40 : 20); | |
135 | Char_t ringChar = (ring == 0 ? 'I' : 'O'); | |
136 | TH1F* doubleHits = new TH1F(Form("DoubleHits_FMD%d%c",det,ringChar), | |
4b818035 | 137 | Form("DoubleHits_FMD%d%c",det,ringChar),fNbinsEta, fEtaLow,fEtaHigh); |
d31dce33 | 138 | TH1F* allHits = new TH1F(Form("allHits_FMD%d%c",det,ringChar), |
4b818035 | 139 | Form("allHits_FMD%d%c",det,ringChar), fNbinsEta, fEtaLow,fEtaHigh); |
d31dce33 | 140 | |
141 | doubleHits->Sumw2(); | |
142 | allHits->Sumw2(); | |
143 | fListOfHits.Add(allHits); | |
144 | fListOfHits.Add(doubleHits); | |
145 | ||
146 | for(Int_t v=0; v<fNvtxBins;v++) { | |
147 | TH2F* hHits = new TH2F(Form("hHits_FMD%d%c_vtx%d", det,ringChar,v), | |
148 | Form("hHits_FMD%d%c_vtx%d", det,ringChar,v), | |
4b818035 | 149 | fNbinsEta, fEtaLow,fEtaHigh, nSec, 0, 2*TMath::Pi()); |
d31dce33 | 150 | hHits->Sumw2(); |
151 | fListOfHits.Add(hHits); | |
507687cd | 152 | TH2F* hHitsNSD = new TH2F(Form("hHitsNSD_FMD%d%c_vtx%d", det,ringChar,v), |
153 | Form("hHitsNSD_FMD%d%c_vtx%d", det,ringChar,v), | |
4b818035 | 154 | fNbinsEta, fEtaLow,fEtaHigh, nSec, 0, 2*TMath::Pi()); |
507687cd | 155 | hHitsNSD->Sumw2(); |
156 | fListOfHits.Add(hHitsNSD); | |
157 | ||
d31dce33 | 158 | |
159 | } | |
160 | } | |
161 | } | |
162 | ||
163 | TH1F* hEventsSelected = new TH1F("EventsSelected","EventsSelected",fNvtxBins,0,fNvtxBins); | |
164 | TH1F* hEventsAll = new TH1F("EventsAll","EventsAll",fNvtxBins,0,fNvtxBins); | |
059c7c6b | 165 | TH1F* hEventsAllNSD = new TH1F("EventsAllNSD","EventsAllNSD",fNvtxBins,0,fNvtxBins); |
f55d559b | 166 | TH1F* hEventsSelectedVtx = new TH1F("EventsSelectedVtx","EventsSelectedVtx",fNvtxBins,0,fNvtxBins); |
167 | TH1F* hEventsSelectedTrigger = new TH1F("EventsSelectedTrigger","EventsSelectedTrigger",fNvtxBins,0,fNvtxBins); | |
f55d559b | 168 | |
059c7c6b | 169 | TH1F* hEventsSelectedNSDVtx = new TH1F("EventsSelectedNSDVtx","EventsSelectedNSDVtx",fNvtxBins,0,fNvtxBins); |
170 | TH1F* hEventsSelectedNSD = new TH1F("EventsSelectedNSD","EventsSelectedNSD",fNvtxBins,0,fNvtxBins); | |
171 | ||
850ad94d | 172 | TH1F* hXvtx = new TH1F("hXvtx","x vertex distribution",100,-2,2); |
173 | TH1F* hYvtx = new TH1F("hYvtx","y vertex distribution",100,-2,2); | |
174 | TH1F* hZvtx = new TH1F("hZvtx","z vertex distribution",4*fNvtxBins,-4*fZvtxCut,4*fZvtxCut); | |
175 | ||
176 | fListOfPrimaries.Add(hXvtx); | |
177 | fListOfPrimaries.Add(hYvtx); | |
178 | fListOfPrimaries.Add(hZvtx); | |
f55d559b | 179 | |
0b0a4ae5 | 180 | hEventsSelected->Sumw2(); |
181 | hEventsAll->Sumw2(); | |
059c7c6b | 182 | hEventsAllNSD->Sumw2(); |
183 | ||
d31dce33 | 184 | fListOfHits.Add(hEventsSelected); |
f55d559b | 185 | fListOfHits.Add(hEventsSelectedVtx); |
186 | fListOfHits.Add(hEventsSelectedTrigger); | |
059c7c6b | 187 | fListOfHits.Add(hEventsSelectedNSDVtx); |
188 | fListOfHits.Add(hEventsSelectedNSD); | |
189 | ||
190 | ||
d31dce33 | 191 | fListOfPrimaries.Add(hEventsAll); |
059c7c6b | 192 | fListOfPrimaries.Add(hEventsAllNSD); |
d31dce33 | 193 | |
ab3e0abc | 194 | for(Int_t v=0; v<fNvtxBins;v++) { |
195 | ||
196 | for(Int_t iring = 0; iring<2;iring++) { | |
197 | Char_t ringChar = (iring == 0 ? 'I' : 'O'); | |
198 | Int_t nSec = (iring == 1 ? 40 : 20); | |
199 | TH2F* hAnalysed = new TH2F(Form("Analysed_FMD%c_vtx%d",ringChar,v), | |
200 | Form("Analysed_FMD%c_vtx%d",ringChar,v), | |
4b818035 | 201 | fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi()); |
ab3e0abc | 202 | |
203 | hAnalysed->Sumw2(); | |
204 | fListOfPrimaries.Add(hAnalysed); | |
205 | ||
059c7c6b | 206 | TH2F* hAnalysedNSD = new TH2F(Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v), |
207 | Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v), | |
4b818035 | 208 | fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi()); |
059c7c6b | 209 | |
210 | hAnalysedNSD->Sumw2(); | |
211 | fListOfPrimaries.Add(hAnalysedNSD); | |
212 | ||
ab3e0abc | 213 | TH2F* hInel = new TH2F(Form("Inel_FMD%c_vtx%d",ringChar,v), |
214 | Form("Inel_FMD%c_vtx%d",ringChar,v), | |
4b818035 | 215 | fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi()); |
ab3e0abc | 216 | |
217 | hInel->Sumw2(); | |
218 | fListOfPrimaries.Add(hInel); | |
219 | ||
059c7c6b | 220 | TH2F* hNSD = new TH2F(Form("NSD_FMD%c_vtx%d",ringChar,v), |
221 | Form("NSD_FMD%c_vtx%d",ringChar,v), | |
4b818035 | 222 | fNbinsEta, fEtaLow,fEtaHigh, nSec, 0,2*TMath::Pi()); |
059c7c6b | 223 | |
224 | hNSD->Sumw2(); | |
225 | fListOfPrimaries.Add(hNSD); | |
226 | ||
ab3e0abc | 227 | } |
228 | } | |
d31dce33 | 229 | |
230 | fVertexBins.SetName("VertexBins"); | |
231 | fVertexBins.GetXaxis()->Set(fNvtxBins,-1*fZvtxCut,fZvtxCut); | |
232 | ||
507687cd | 233 | |
234 | ||
d31dce33 | 235 | } |
236 | //_____________________________________________________________________ | |
237 | void AliFMDAnalysisTaskGenerateCorrection::Init() | |
238 | { | |
239 | fLastTrackByStrip.Reset(-1); | |
240 | ||
241 | ||
242 | } | |
243 | //_____________________________________________________________________ | |
244 | void AliFMDAnalysisTaskGenerateCorrection::UserExec(Option_t */*option*/) | |
245 | { | |
246 | ||
247 | fLastTrackByStrip.Reset(-1); | |
248 | fHitsByStrip.Reset(0); | |
249 | AliMCEvent* mcevent = MCEvent(); | |
250 | ||
251 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); | |
252 | ||
253 | ||
254 | AliESDEvent* esdevent = (AliESDEvent*)InputEvent(); | |
059c7c6b | 255 | |
256 | pars->SetTriggerStatus(esdevent); | |
257 | ||
d31dce33 | 258 | Double_t esdvertex[3]; |
f55d559b | 259 | Bool_t vtxStatus = pars->GetVertex(esdevent,esdvertex); |
d31dce33 | 260 | |
f7356393 | 261 | /* Double_t deltaEsd = 2*fZvtxCut/fNvtxBins; |
262 | Double_t vertexBinDoubleEsd = (esdvertex[2] + fZvtxCut) / deltaEsd; | |
263 | Int_t vertexBinEsd = (Int_t)vertexBinDoubleEsd;*/ | |
264 | ||
d31dce33 | 265 | AliMCParticle* particle = 0; |
266 | AliStack* stack = mcevent->Stack(); | |
267 | ||
268 | UShort_t det,sec,strip; | |
269 | Char_t ring; | |
270 | ||
271 | Int_t nTracks = mcevent->GetNumberOfTracks(); | |
272 | AliHeader* header = mcevent->Header(); | |
273 | AliGenEventHeader* genHeader = header->GenEventHeader(); | |
274 | ||
059c7c6b | 275 | AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader); |
507687cd | 276 | AliGenDPMjetEventHeader* dpmHeader = dynamic_cast<AliGenDPMjetEventHeader*>(header->GenEventHeader()); |
277 | ||
278 | if (!pythiaGenHeader && !dpmHeader) { | |
279 | std::cout<<" no pythia or dpm header! - NSD selection unusable"<<std::endl; | |
04d7f248 | 280 | //return; |
059c7c6b | 281 | } |
059c7c6b | 282 | Bool_t nsd = kTRUE; |
04d7f248 | 283 | if(pythiaGenHeader) { |
284 | Int_t pythiaType = pythiaGenHeader->ProcessType(); | |
285 | ||
286 | if(pythiaType==92 || pythiaType==93) | |
287 | nsd = kFALSE; | |
288 | } | |
507687cd | 289 | if(dpmHeader) { |
290 | Int_t processType = dpmHeader->ProcessType(); | |
291 | if(processType == 5 || processType == 6) | |
292 | nsd = kFALSE; | |
293 | ||
294 | } | |
295 | ||
059c7c6b | 296 | |
d31dce33 | 297 | TArrayF vertex; |
298 | genHeader->PrimaryVertex(vertex); | |
299 | ||
850ad94d | 300 | TH1F* hXvtx = (TH1F*)fListOfPrimaries.FindObject("hXvtx"); |
301 | hXvtx->Fill(vertex.At(0)); | |
302 | TH1F* hYvtx = (TH1F*)fListOfPrimaries.FindObject("hYvtx"); | |
303 | hYvtx->Fill(vertex.At(1)); | |
304 | TH1F* hZvtx = (TH1F*)fListOfPrimaries.FindObject("hZvtx"); | |
305 | hZvtx->Fill(vertex.At(2)); | |
306 | ||
307 | ||
059c7c6b | 308 | |
d31dce33 | 309 | |
310 | Double_t delta = 2*fZvtxCut/fNvtxBins; | |
311 | Double_t vertexBinDouble = (vertex.At(2) + fZvtxCut) / delta; | |
312 | Int_t vertexBin = (Int_t)vertexBinDouble; | |
313 | ||
314 | // Vertex determination correction | |
f55d559b | 315 | TH1F* hEventsSelected = (TH1F*)fListOfHits.FindObject("EventsSelected"); |
316 | TH1F* hEventsSelectedVtx = (TH1F*)fListOfHits.FindObject("EventsSelectedVtx"); | |
317 | TH1F* hEventsSelectedTrigger = (TH1F*)fListOfHits.FindObject("EventsSelectedTrigger"); | |
059c7c6b | 318 | TH1F* hEventsSelectedNSDVtx = (TH1F*)fListOfHits.FindObject("EventsSelectedNSDVtx"); |
319 | TH1F* hEventsSelectedNSD = (TH1F*)fListOfHits.FindObject("EventsSelectedNSD"); | |
f55d559b | 320 | TH1F* hEventsAll = (TH1F*)fListOfPrimaries.FindObject("EventsAll"); |
059c7c6b | 321 | TH1F* hEventsAllNSD = (TH1F*)fListOfPrimaries.FindObject("EventsAllNSD"); |
f55d559b | 322 | |
d31dce33 | 323 | // TH1F* hTriggered = (TH1F*)fListOfHits.FindObject("Triggered"); |
324 | // TH1F* hTriggeredAll = (TH1F*)fListOfPrimaries.FindObject("TriggeredAll"); | |
325 | ||
326 | Bool_t vtxFound = kTRUE; | |
f55d559b | 327 | if(!vtxStatus) |
d31dce33 | 328 | vtxFound = kFALSE; |
d31dce33 | 329 | |
4b8bdb60 | 330 | //if(TMath::Abs(vertex.At(2)) > fZvtxCut) { |
331 | // vtxFound = kFALSE; | |
059c7c6b | 332 | |
4b8bdb60 | 333 | //} |
df2a9c32 | 334 | |
335 | if(TMath::Abs(vertex.At(2)) > fZvtxCut) { | |
336 | return; | |
337 | } | |
338 | ||
339 | ||
059c7c6b | 340 | Bool_t isTriggered = pars->IsEventTriggered(AliFMDAnaParameters::kMB1); |
341 | Bool_t isTriggeredNSD = pars->IsEventTriggered(AliFMDAnaParameters::kNSD); | |
f55d559b | 342 | if(vtxFound && isTriggered) hEventsSelected->Fill(vertexBin); |
d31dce33 | 343 | |
f55d559b | 344 | if(vtxFound) hEventsSelectedVtx->Fill(vertexBin); |
345 | if(isTriggered) hEventsSelectedTrigger->Fill(vertexBin); | |
059c7c6b | 346 | |
347 | if(vtxFound && isTriggeredNSD) hEventsSelectedNSDVtx->Fill(vertexBin); | |
348 | if(isTriggeredNSD) hEventsSelectedNSD->Fill(vertexBin); | |
349 | ||
350 | ||
d31dce33 | 351 | hEventsAll->Fill(vertexBin); |
059c7c6b | 352 | if(nsd) hEventsAllNSD->Fill(vertexBin); |
70d74659 | 353 | |
f7356393 | 354 | // FMD dead channels |
355 | ||
356 | TH1F* hFMDReadChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDReadChannels_vtx%d",vertexBin)); | |
357 | TH1F* hFMDAllChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDAllChannels_vtx%d",vertexBin)); | |
358 | ||
359 | AliESDFMD* fmd = esdevent->GetFMDData(); | |
360 | ||
361 | for(UShort_t d=1;d<=3;d++) { | |
362 | Int_t nRings = (d==1 ? 1 : 2); | |
363 | for (UShort_t ir = 0; ir < nRings; ir++) { | |
364 | Char_t r = (ir == 0 ? 'I' : 'O'); | |
365 | UShort_t nsec = (ir == 0 ? 20 : 40); | |
366 | UShort_t nstr = (ir == 0 ? 512 : 256); | |
367 | for(UShort_t s =0; s < nsec; s++) { | |
368 | for(UShort_t str = 0; str < nstr; str++) { | |
369 | Float_t mult = fmd->Multiplicity(d,r,s,str); | |
370 | ||
371 | hFMDAllChannels->Fill(pars->GetEtaFromStrip(d,r,s,str,esdvertex[2])); | |
372 | ||
373 | if(mult != AliESDFMD::kInvalidMult) | |
374 | hFMDReadChannels->Fill(pars->GetEtaFromStrip(d,r,s,str,esdvertex[2])); | |
375 | } | |
376 | } | |
377 | } | |
378 | } | |
379 | // End, FMD dead channels | |
df2a9c32 | 380 | |
d31dce33 | 381 | for(Int_t i = 0 ;i<nTracks;i++) { |
7aad0c47 | 382 | particle = (AliMCParticle*) mcevent->GetTrack(i); |
d31dce33 | 383 | |
384 | if(!particle) | |
385 | continue; | |
386 | ||
387 | if(stack->IsPhysicalPrimary(i) && particle->Charge() != 0) { | |
388 | ||
a7caf551 | 389 | //if(vtxFound && isTriggered) { |
df2a9c32 | 390 | TH2F* hPrimaryInner = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'I',vertexBin)); |
391 | TH2F* hPrimaryOuter = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'O',vertexBin)); | |
392 | hPrimaryInner->Fill(particle->Eta(),particle->Phi()); | |
393 | hPrimaryOuter->Fill(particle->Eta(),particle->Phi()); | |
394 | if( isTriggeredNSD) { | |
395 | TH2F* hPrimaryInnerNSD = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",'I',vertexBin)); | |
396 | TH2F* hPrimaryOuterNSD = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",'O',vertexBin)); | |
397 | hPrimaryInnerNSD->Fill(particle->Eta(),particle->Phi()); | |
398 | hPrimaryOuterNSD->Fill(particle->Eta(),particle->Phi()); | |
a7caf551 | 399 | // } |
400 | } | |
ab3e0abc | 401 | TH2F* hAnalysedInner = (TH2F*)fListOfPrimaries.FindObject( Form("Analysed_FMD%c_vtx%d",'I',vertexBin)); |
402 | TH2F* hAnalysedOuter = (TH2F*)fListOfPrimaries.FindObject( Form("Analysed_FMD%c_vtx%d",'O',vertexBin)); | |
059c7c6b | 403 | TH2F* hAnalysedNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'I',vertexBin)); |
404 | TH2F* hAnalysedNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'O',vertexBin)); | |
ab3e0abc | 405 | TH2F* hInelInner = (TH2F*)fListOfPrimaries.FindObject( Form("Inel_FMD%c_vtx%d",'I',vertexBin)); |
406 | TH2F* hInelOuter = (TH2F*)fListOfPrimaries.FindObject( Form("Inel_FMD%c_vtx%d",'O',vertexBin)); | |
059c7c6b | 407 | TH2F* hNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'I',vertexBin)); |
408 | TH2F* hNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'O',vertexBin)); | |
ab3e0abc | 409 | |
820f4fcc | 410 | //if(vtxFound && isTriggered) { |
059c7c6b | 411 | if(isTriggeredNSD) { |
412 | hAnalysedNSDInner->Fill(particle->Eta(),particle->Phi()); | |
413 | hAnalysedNSDOuter->Fill(particle->Eta(),particle->Phi()); | |
414 | } | |
df2a9c32 | 415 | if(isTriggered && vtxFound) { |
ab3e0abc | 416 | hAnalysedInner->Fill(particle->Eta(),particle->Phi()); |
417 | hAnalysedOuter->Fill(particle->Eta(),particle->Phi()); | |
418 | } | |
419 | hInelInner->Fill(particle->Eta(),particle->Phi()); | |
420 | hInelOuter->Fill(particle->Eta(),particle->Phi()); | |
421 | ||
059c7c6b | 422 | if(nsd) { |
423 | hNSDInner->Fill(particle->Eta(),particle->Phi()); | |
424 | hNSDOuter->Fill(particle->Eta(),particle->Phi()); | |
425 | } | |
d31dce33 | 426 | } |
a7caf551 | 427 | //if(!vtxFound || !isTriggered) continue; |
d31dce33 | 428 | |
429 | for(Int_t j=0; j<particle->GetNumberOfTrackReferences();j++) { | |
430 | ||
431 | AliTrackReference* ref = particle->GetTrackReference(j); | |
432 | ||
433 | if(ref->DetectorId() != AliTrackReference::kFMD) | |
434 | continue; | |
ab3e0abc | 435 | |
d31dce33 | 436 | AliFMDStripIndex::Unpack(ref->UserId(),det,ring,sec,strip); |
437 | Float_t thisStripTrack = fLastTrackByStrip(det,ring,sec,strip); | |
438 | if(particle->Charge() != 0 && i != thisStripTrack ) { | |
439 | ||
440 | Float_t phi = pars->GetPhiFromSector(det,ring,sec); | |
441 | Float_t eta = pars->GetEtaFromStrip(det,ring,sec,strip,vertex.At(2)); | |
442 | ||
443 | TH2F* hHits = (TH2F*)fListOfHits.FindObject(Form("hHits_FMD%d%c_vtx%d", det,ring,vertexBin)); | |
444 | hHits->Fill(eta,phi); | |
507687cd | 445 | if( isTriggeredNSD) { |
446 | TH2F* hHitsNSD = (TH2F*)fListOfHits.FindObject(Form("hHitsNSD_FMD%d%c_vtx%d", det,ring,vertexBin)); | |
447 | hHitsNSD->Fill(eta,phi); | |
448 | } | |
449 | ||
d31dce33 | 450 | Float_t nstrips = (ring =='O' ? 256 : 512); |
451 | fHitsByStrip(det,ring,sec,strip) +=1; | |
452 | TH1F* allHits = (TH1F*)fListOfHits.FindObject(Form("allHits_FMD%d%c",det,ring)); | |
453 | TH1F* doubleHits = (TH1F*)fListOfHits.FindObject(Form("DoubleHits_FMD%d%c",det,ring)); | |
454 | ||
455 | if(fHitsByStrip(det,ring,sec,strip) == 1) | |
456 | allHits->Fill(eta); | |
457 | ||
458 | doubleHits->Fill(eta); | |
459 | ||
460 | fLastTrackByStrip(det,ring,sec,strip) = (Float_t)i; | |
461 | if(strip >0) | |
462 | fLastTrackByStrip(det,ring,sec,strip-1) = (Float_t)i; | |
463 | if(strip < (nstrips - 1)) | |
464 | fLastTrackByStrip(det,ring,sec,strip+1) = (Float_t)i; | |
465 | } | |
466 | } | |
467 | ||
468 | } | |
04f1ff3d | 469 | |
04f1ff3d | 470 | |
df2a9c32 | 471 | if(vtxFound && isTriggered) { |
472 | //SPD part HHD | |
473 | TH2F* hSPDMult = (TH2F*)fListOfHits.FindObject(Form("hSPDhits_vtx%d", vertexBin)); | |
474 | ||
475 | const AliMultiplicity* spdmult = esdevent->GetMultiplicity(); | |
476 | for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++) | |
477 | hSPDMult->Fill(spdmult->GetEta(j),spdmult->GetPhi(j)); | |
d31dce33 | 478 | |
df2a9c32 | 479 | for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++) |
480 | hSPDMult->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),spdmult->GetPhiSingle(j)); | |
481 | ||
482 | } | |
483 | ||
d31dce33 | 484 | PostData(1, &fListOfHits); |
485 | PostData(2, &fListOfPrimaries); | |
486 | PostData(3, &fVertexBins); | |
487 | } | |
488 | //_____________________________________________________________________ | |
489 | void AliFMDAnalysisTaskGenerateCorrection::Terminate(Option_t */*option*/) | |
490 | { | |
491 | /* TH1F* allHits = (TH1F*)fListOfHits.FindObject("allHits"); | |
492 | TH1F* doubleHits = (TH1F*)fListOfHits.FindObject("DoubleHits"); | |
493 | ||
494 | doubleHits->Divide(allHits); | |
495 | GenerateCorrection(); | |
496 | PostData(1, &fListOfHits); | |
497 | PostData(4, &fListOfCorrection);*/ | |
498 | ||
499 | } | |
500 | //_____________________________________________________________________ | |
501 | void AliFMDAnalysisTaskGenerateCorrection::GenerateCorrection() { | |
502 | ||
503 | fBackground = new AliFMDAnaCalibBackgroundCorrection(); | |
504 | fEventSelectionEff = new AliFMDAnaCalibEventSelectionEfficiency(); | |
505 | ||
ab3e0abc | 506 | //Event selection |
f55d559b | 507 | TH1F* hEventsSelected = (TH1F*)fListOfHits.FindObject("EventsSelected"); |
508 | TH1F* hEventsSelectedVtx = (TH1F*)fListOfHits.FindObject("EventsSelectedVtx"); | |
509 | TH1F* hEventsSelectedTrigger = (TH1F*)fListOfHits.FindObject("EventsSelectedTrigger"); | |
059c7c6b | 510 | TH1F* hEventsSelectedNSDVtx = (TH1F*)fListOfHits.FindObject("EventsSelectedNSDVtx"); |
511 | TH1F* hEventsSelectedNSD = (TH1F*)fListOfHits.FindObject("EventsSelectedNSD"); | |
512 | ||
f55d559b | 513 | TH1F* hEventsAll = (TH1F*)fListOfPrimaries.FindObject("EventsAll"); |
059c7c6b | 514 | TH1F* hEventsAllNSD = (TH1F*)fListOfPrimaries.FindObject("EventsAllNSD"); |
820f4fcc | 515 | TH1F* hEventsSelectedVtxDivByTr = (TH1F*)hEventsSelectedVtx->Clone("hEventsSelectedVtxDivByTr"); |
059c7c6b | 516 | TH1F* hEventsSelectedNSDVtxDivByNSD = (TH1F*)hEventsSelectedNSDVtx->Clone("hEventsSelectedNSDVtxDivByNSD"); |
517 | ||
820f4fcc | 518 | fListOfHits.Add(hEventsSelectedVtxDivByTr); |
059c7c6b | 519 | fListOfHits.Add(hEventsSelectedNSDVtxDivByNSD); |
520 | hEventsSelectedNSDVtxDivByNSD->Divide(hEventsSelectedNSD); | |
820f4fcc | 521 | hEventsSelectedVtxDivByTr->Divide(hEventsSelectedTrigger); |
059c7c6b | 522 | |
523 | for(Int_t v=0;v<fNvtxBins ; v++) { | |
ab3e0abc | 524 | TH2F* hAnalysedInner = (TH2F*)fListOfPrimaries.FindObject(Form("Analysed_FMD%c_vtx%d",'I',v)); |
525 | TH2F* hAnalysedOuter = (TH2F*)fListOfPrimaries.FindObject(Form("Analysed_FMD%c_vtx%d",'O',v)); | |
059c7c6b | 526 | TH2F* hAnalysedNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'I',v)); |
527 | TH2F* hAnalysedNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("AnalysedNSD_FMD%c_vtx%d",'O',v)); | |
528 | ||
ab3e0abc | 529 | TH2F* hInelInner = (TH2F*)fListOfPrimaries.FindObject(Form("Inel_FMD%c_vtx%d",'I',v)); |
530 | TH2F* hInelOuter = (TH2F*)fListOfPrimaries.FindObject(Form("Inel_FMD%c_vtx%d",'O',v)); | |
059c7c6b | 531 | TH2F* hNSDInner = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'I',v)); |
532 | TH2F* hNSDOuter = (TH2F*)fListOfPrimaries.FindObject( Form("NSD_FMD%c_vtx%d",'O',v)); | |
820f4fcc | 533 | // hAnalysedInner->Scale((hEventsSelected->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelected->GetBinContent(v+1))); |
534 | //hAnalysedOuter->Scale((hEventsSelected->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelected->GetBinContent(v+1))); | |
535 | ||
536 | hAnalysedInner->Scale((hEventsSelectedTrigger->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedTrigger->GetBinContent(v+1))); | |
537 | ||
538 | hAnalysedOuter->Scale((hEventsSelectedTrigger->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedTrigger->GetBinContent(v+1))); | |
059c7c6b | 539 | hAnalysedNSDInner->Scale((hEventsSelectedNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedNSD->GetBinContent(v+1))); |
540 | ||
541 | hAnalysedNSDOuter->Scale((hEventsSelectedNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsSelectedNSD->GetBinContent(v+1))); | |
542 | ||
820f4fcc | 543 | |
059c7c6b | 544 | |
ab3e0abc | 545 | hInelInner->Scale((hEventsAll->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAll->GetBinContent(v+1))); |
546 | hInelOuter->Scale((hEventsAll->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAll->GetBinContent(v+1))); | |
820f4fcc | 547 | |
059c7c6b | 548 | hNSDInner->Scale((hEventsAllNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAllNSD->GetBinContent(v+1))); |
549 | hNSDOuter->Scale((hEventsAllNSD->GetBinContent(v+1) == 0 ? 0 : 1/hEventsAllNSD->GetBinContent(v+1))); | |
550 | ||
820f4fcc | 551 | |
ab3e0abc | 552 | hAnalysedInner->Divide(hInelInner); |
553 | hAnalysedOuter->Divide(hInelOuter); | |
820f4fcc | 554 | |
059c7c6b | 555 | hAnalysedNSDInner->Divide(hNSDInner); |
556 | hAnalysedNSDOuter->Divide(hNSDOuter); | |
557 | ||
558 | fEventSelectionEff->SetCorrection("INEL",v,'I',hAnalysedInner); | |
559 | fEventSelectionEff->SetCorrection("INEL",v,'O',hAnalysedOuter); | |
560 | //NSD | |
561 | fEventSelectionEff->SetCorrection("NSD",v,'I',hAnalysedNSDInner); | |
562 | fEventSelectionEff->SetCorrection("NSD",v,'O',hAnalysedNSDOuter); | |
563 | ||
f7356393 | 564 | //FMD dead channels |
565 | TH1F* hFMDReadChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDReadChannels_vtx%d",v)); | |
566 | ||
567 | TH1F* hFMDAllChannels = (TH1F*)fListOfHits.FindObject(Form("hFMDAllChannels_vtx%d",v)); | |
568 | if(hFMDReadChannels) { | |
569 | TH1F* hFMDDeadCorrection = (TH1F*)hFMDReadChannels->Clone("hFMDDeadCorrection"); | |
570 | hFMDDeadCorrection->Divide(hFMDAllChannels); | |
571 | fBackground->SetFMDDeadCorrection(v,hFMDDeadCorrection); | |
572 | fListOfCorrection.Add(hFMDDeadCorrection); | |
573 | } | |
574 | else AliWarning("No Dead Channel Correction generated"); | |
059c7c6b | 575 | |
541c19ed | 576 | } |
ab3e0abc | 577 | |
820f4fcc | 578 | Float_t vtxEff = 1; |
579 | if(hEventsSelectedTrigger->GetEntries()) | |
580 | vtxEff = hEventsSelectedVtx->GetEntries() / hEventsSelectedTrigger->GetEntries(); | |
581 | fEventSelectionEff->SetVtxToTriggerRatio(vtxEff); | |
ab3e0abc | 582 | |
b85ea106 | 583 | // hEventsAll->Divide(hEventsAll,hEventsSelected,1,1,"B"); |
f55d559b | 584 | hEventsSelectedVtx->Divide(hEventsAll); |
585 | hEventsSelectedTrigger->Divide(hEventsAll); | |
0b0a4ae5 | 586 | |
059c7c6b | 587 | hEventsSelectedNSDVtx->Divide(hEventsAllNSD); |
588 | hEventsSelectedNSD->Divide(hEventsAllNSD); | |
589 | ||
0b0a4ae5 | 590 | for(Int_t i = 1; i<=hEventsSelected->GetNbinsX(); i++) { |
591 | if(hEventsSelected->GetBinContent(i) == 0 ) | |
592 | continue; | |
059c7c6b | 593 | Float_t b = hEventsSelected->GetBinContent(i); |
594 | // Float_t b = hEventsSelected->GetBinContent(i)*hEventsSelectedTrigger->GetBinContent(i); | |
b85ea106 | 595 | Float_t db = hEventsSelected->GetBinError(i); |
0b0a4ae5 | 596 | Float_t sum = hEventsAll->GetBinContent(i); |
597 | Float_t dsum = hEventsAll->GetBinError(i); | |
b85ea106 | 598 | Float_t a = sum-b; |
599 | Float_t da = TMath::Sqrt(TMath::Power(db,2) + TMath::Power(dsum,2)); | |
0b0a4ae5 | 600 | |
b85ea106 | 601 | Float_t cor = sum / b; |
602 | Float_t ecor = TMath::Sqrt(TMath::Power(da,2) + TMath::Power(a/(b*db),2)) / b; | |
0b0a4ae5 | 603 | |
b85ea106 | 604 | hEventsAll->SetBinContent(i,cor); |
605 | hEventsAll->SetBinError(i,ecor); | |
0b0a4ae5 | 606 | |
607 | } | |
d31dce33 | 608 | |
ab3e0abc | 609 | //TH1F* hEventTest = (TH1F*)hEventsAll->Clone("hEventTest"); |
610 | ||
611 | ||
612 | ||
b85ea106 | 613 | fEventSelectionEff->SetCorrection(hEventsAll); |
d31dce33 | 614 | |
615 | for(Int_t det= 1; det <=3; det++) { | |
616 | Int_t nRings = (det==1 ? 1 : 2); | |
617 | ||
618 | for(Int_t iring = 0; iring<nRings; iring++) { | |
619 | Char_t ring = (iring == 0 ? 'I' : 'O'); | |
620 | TH1F* allHits = (TH1F*)fListOfHits.FindObject(Form("allHits_FMD%d%c",det,ring)); | |
621 | TH1F* doubleHits = (TH1F*)fListOfHits.FindObject(Form("DoubleHits_FMD%d%c",det,ring)); | |
b85ea106 | 622 | allHits->Divide(doubleHits); |
623 | ||
624 | fBackground->SetDoubleHitCorrection(det,ring,allHits); | |
625 | ||
d31dce33 | 626 | for(Int_t vertexBin=0;vertexBin<fNvtxBins ;vertexBin++) { |
627 | TH2F* hHits = (TH2F*)fListOfHits.FindObject(Form("hHits_FMD%d%c_vtx%d", det,ring,vertexBin)); | |
507687cd | 628 | TH2F* hPrimary = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",ring,vertexBin)); |
629 | TH2F* hCorrection = (TH2F*)hHits->Clone(Form("FMD%d%c_vtxbin_%d_correction",det,ring,vertexBin)); | |
d31dce33 | 630 | hCorrection->Divide(hPrimary); |
507687cd | 631 | |
632 | TH2F* hHitsNSD = (TH2F*)fListOfHits.FindObject(Form("hHitsNSD_FMD%d%c_vtx%d", det,ring,vertexBin)); | |
633 | TH2F* hPrimaryNSD = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",ring,vertexBin)); | |
df2a9c32 | 634 | TH2F* hCorrectionNSD = 0; |
635 | if(hHitsNSD && hPrimaryNSD) { | |
636 | hCorrectionNSD = (TH2F*)hHitsNSD->Clone(Form("FMDNSD%d%c_vtxbin_%d_correction",det,ring,vertexBin)); | |
637 | hCorrectionNSD->Divide(hPrimaryNSD); | |
638 | } | |
0b0a4ae5 | 639 | |
d31dce33 | 640 | hCorrection->SetTitle(hCorrection->GetName()); |
641 | fListOfCorrection.Add(hCorrection); | |
642 | fBackground->SetBgCorrection(det,ring,vertexBin,hCorrection); | |
df2a9c32 | 643 | |
644 | if(hCorrectionNSD) { | |
645 | fBackground->SetNSDBgCorrection(det,ring,vertexBin,hCorrectionNSD); | |
646 | hCorrectionNSD->SetTitle(hCorrectionNSD->GetName()); | |
647 | fListOfCorrection.Add(hCorrectionNSD); | |
648 | } | |
d31dce33 | 649 | |
650 | } | |
651 | ||
652 | } | |
653 | } | |
04f1ff3d | 654 | for(Int_t vertexBin=0;vertexBin<fNvtxBins ;vertexBin++) { |
655 | TH2F* hPrimary = (TH2F*)fListOfPrimaries.FindObject( Form("hPrimary_FMD_%c_vtx%d",'I',vertexBin)); | |
656 | TH2F* hSPDMult = (TH2F*)fListOfHits.FindObject(Form("hSPDhits_vtx%d", vertexBin)); | |
11e702b3 | 657 | if(!hSPDMult) continue; |
658 | ||
04f1ff3d | 659 | TH2F* hCorrection = (TH2F*)hSPDMult->Clone(Form("SPD_vtxbin_%d_correction",vertexBin)); |
660 | hCorrection->SetTitle(hCorrection->GetName()); | |
661 | fListOfCorrection.Add(hCorrection); | |
662 | hCorrection->Divide(hPrimary); | |
f7356393 | 663 | |
04f1ff3d | 664 | |
665 | TH1F* hAlive = new TH1F(Form("hAliveSPD_vtxbin%d",vertexBin),Form("hAliveSPD_vtxbin%d",vertexBin),hSPDMult->GetNbinsX(),hSPDMult->GetXaxis()->GetXmin(), hSPDMult->GetXaxis()->GetXmax()); | |
666 | TH1F* hPresent = new TH1F(Form("hPresentSPD_vtxbin%d",vertexBin),Form("hPresentSPD_vtxbin%d",vertexBin),hSPDMult->GetNbinsX(),hSPDMult->GetXaxis()->GetXmin(), hSPDMult->GetXaxis()->GetXmax()); | |
667 | for(Int_t xx = 1; xx <=hSPDMult->GetNbinsX(); xx++) { | |
668 | ||
df2a9c32 | 669 | |
670 | ||
04f1ff3d | 671 | for(Int_t yy = 1; yy <=hSPDMult->GetNbinsY(); yy++) { |
df2a9c32 | 672 | if(TMath::Abs(hCorrection->GetXaxis()->GetBinCenter(xx)) > 1.9) { |
673 | hCorrection->SetBinContent(xx,yy,0.); | |
674 | hCorrection->SetBinError(xx,yy,0.); | |
675 | } | |
676 | ||
677 | if(hCorrection->GetBinContent(xx,yy) > 0.9) { | |
678 | hAlive->Fill(hCorrection->GetXaxis()->GetBinCenter(xx) ); | |
679 | } | |
680 | else { | |
681 | hCorrection->SetBinContent(xx,yy,0.); | |
682 | hCorrection->SetBinError(xx,yy,0.); | |
683 | } | |
684 | ||
04f1ff3d | 685 | hPresent->Fill(hCorrection->GetXaxis()->GetBinCenter(xx)); |
686 | ||
687 | } | |
688 | } | |
689 | TH1F* hDeadCorrection = (TH1F*)hAlive->Clone(Form("hSPDDeadCorrection_vtxbin%d",vertexBin)); | |
690 | hDeadCorrection->Divide(hPresent); | |
691 | fBackground->SetSPDDeadCorrection(vertexBin,hDeadCorrection); | |
692 | fListOfCorrection.Add(hDeadCorrection); | |
ab3e0abc | 693 | |
f7356393 | 694 | fBackground->SetBgCorrection(0,'Q',vertexBin,hCorrection); |
695 | } | |
ab3e0abc | 696 | |
697 | ||
d31dce33 | 698 | TAxis refAxis(fNvtxBins,-1*fZvtxCut,fZvtxCut); |
699 | fBackground->SetRefAxis(&refAxis); | |
700 | ||
701 | } | |
702 | //_____________________________________________________________________ | |
703 | void AliFMDAnalysisTaskGenerateCorrection::ReadFromFile(const Char_t* filename, Bool_t storeInOCDB, Int_t /*runNo*/) { | |
0b0a4ae5 | 704 | |
d31dce33 | 705 | TFile infile(filename); |
706 | TH1F* hVertex = (TH1F*)infile.Get("VertexBins"); | |
707 | fZvtxCut = hVertex->GetXaxis()->GetXmax(); | |
708 | fNvtxBins = hVertex->GetXaxis()->GetNbins(); | |
709 | fVertexBins.SetName("VertexBins"); | |
710 | fVertexBins.GetXaxis()->Set(fNvtxBins,-1*fZvtxCut,fZvtxCut); | |
711 | ||
712 | TList* listOfHits = (TList*)infile.Get("Hits"); | |
713 | TList* listOfPrim = (TList*)infile.Get("Primaries"); | |
714 | ||
f55d559b | 715 | TH1F* hEventsSelected = (TH1F*)listOfHits->FindObject("EventsSelected"); |
716 | TH1F* hEventsSelectedVtx = (TH1F*)listOfHits->FindObject("EventsSelectedVtx"); | |
717 | TH1F* hEventsSelectedTrigger = (TH1F*)listOfHits->FindObject("EventsSelectedTrigger"); | |
059c7c6b | 718 | TH1F* hEventsSelectedNSDVtx = (TH1F*)listOfHits->FindObject("EventsSelectedNSDVtx"); |
719 | TH1F* hEventsSelectedNSD = (TH1F*)listOfHits->FindObject("EventsSelectedNSD"); | |
f55d559b | 720 | TH1F* hEventsAll = (TH1F*)listOfPrim->FindObject("EventsAll"); |
059c7c6b | 721 | TH1F* hEventsAllNSD = (TH1F*)listOfPrim->FindObject("EventsAllNSD"); |
f55d559b | 722 | |
d31dce33 | 723 | fListOfHits.Add(hEventsSelected); |
f55d559b | 724 | fListOfHits.Add(hEventsSelectedVtx); |
059c7c6b | 725 | fListOfHits.Add(hEventsSelectedNSD); |
726 | fListOfHits.Add(hEventsSelectedNSDVtx); | |
f55d559b | 727 | fListOfHits.Add(hEventsSelectedTrigger); |
d31dce33 | 728 | fListOfPrimaries.Add(hEventsAll); |
059c7c6b | 729 | fListOfPrimaries.Add(hEventsAllNSD); |
d31dce33 | 730 | |
850ad94d | 731 | TH1F* hXvtx = (TH1F*)listOfPrim->FindObject("hXvtx"); |
732 | TH1F* hYvtx = (TH1F*)listOfPrim->FindObject("hYvtx"); | |
733 | TH1F* hZvtx = (TH1F*)listOfPrim->FindObject("hZvtx"); | |
734 | fListOfPrimaries.Add(hXvtx); | |
735 | fListOfPrimaries.Add(hYvtx); | |
736 | fListOfPrimaries.Add(hZvtx); | |
737 | ||
d31dce33 | 738 | for(Int_t det =1; det<=3;det++) |
059c7c6b | 739 | { |
740 | Int_t nRings = (det==1 ? 1 : 2); | |
741 | for(Int_t ring = 0;ring<nRings;ring++) | |
742 | { | |
743 | Char_t ringChar = (ring == 0 ? 'I' : 'O'); | |
744 | TH1F* allHits = (TH1F*)listOfHits->FindObject(Form("allHits_FMD%d%c",det,ringChar)); | |
745 | TH1F* doubleHits = (TH1F*)listOfHits->FindObject(Form("DoubleHits_FMD%d%c",det,ringChar)); | |
746 | fListOfHits.Add(allHits); | |
747 | fListOfHits.Add(doubleHits); | |
748 | for(Int_t v=0; v<fNvtxBins;v++) | |
749 | { | |
750 | ||
751 | TH2F* hHits = (TH2F*)listOfHits->FindObject(Form("hHits_FMD%d%c_vtx%d", det,ringChar,v)); | |
752 | fListOfHits.Add(hHits); | |
507687cd | 753 | TH2F* hHitsNSD = (TH2F*)listOfHits->FindObject(Form("hHitsNSD_FMD%d%c_vtx%d", det,ringChar,v)); |
df2a9c32 | 754 | if(hHitsNSD) |
755 | fListOfHits.Add(hHitsNSD); | |
059c7c6b | 756 | } |
757 | } | |
758 | } | |
04f1ff3d | 759 | for(Int_t v=0; v<fNvtxBins;v++) { |
760 | TH2F* hSPDHits = (TH2F*)listOfHits->FindObject(Form("hSPDhits_vtx%d", v)); | |
761 | fListOfHits.Add(hSPDHits); | |
f7356393 | 762 | TH1F* hFMDReadChannels = (TH1F*)listOfHits->FindObject(Form("hFMDReadChannels_vtx%d",v)); |
763 | TH1F* hFMDAllChannels = (TH1F*)listOfHits->FindObject(Form("hFMDAllChannels_vtx%d",v)); | |
04f1ff3d | 764 | |
f7356393 | 765 | if(hFMDReadChannels && hFMDAllChannels) { |
766 | fListOfHits.Add(hFMDReadChannels); | |
767 | fListOfHits.Add(hFMDAllChannels); | |
768 | } | |
04f1ff3d | 769 | for(Int_t iring = 0; iring<2;iring++) { |
770 | Char_t ringChar = (iring == 0 ? 'I' : 'O'); | |
771 | ||
d31dce33 | 772 | |
773 | TH2F* hPrimary = (TH2F*)listOfPrim->FindObject( Form("hPrimary_FMD_%c_vtx%d",ringChar,v)); | |
507687cd | 774 | TH2F* hPrimaryNSD = (TH2F*)listOfPrim->FindObject( Form("hPrimaryNSD_FMD_%c_vtx%d",ringChar,v)); |
775 | ||
ab3e0abc | 776 | TH2F* hAnalysed = (TH2F*)listOfPrim->FindObject(Form("Analysed_FMD%c_vtx%d",ringChar,v)); |
059c7c6b | 777 | TH2F* hAnalysedNSD = (TH2F*)listOfPrim->FindObject(Form("AnalysedNSD_FMD%c_vtx%d",ringChar,v)); |
ab3e0abc | 778 | TH2F* hInel = (TH2F*)listOfPrim->FindObject(Form("Inel_FMD%c_vtx%d",ringChar,v)); |
059c7c6b | 779 | TH2F* hNSD = (TH2F*)listOfPrim->FindObject(Form("NSD_FMD%c_vtx%d",ringChar,v)); |
d31dce33 | 780 | |
ab3e0abc | 781 | fListOfPrimaries.Add(hPrimary); |
df2a9c32 | 782 | if(hPrimaryNSD) |
783 | fListOfPrimaries.Add(hPrimaryNSD); | |
ab3e0abc | 784 | fListOfPrimaries.Add(hAnalysed); |
785 | fListOfPrimaries.Add(hInel); | |
059c7c6b | 786 | fListOfPrimaries.Add(hAnalysedNSD); |
787 | fListOfPrimaries.Add(hNSD); | |
d31dce33 | 788 | } |
789 | } | |
790 | GenerateCorrection(); | |
791 | ||
792 | TFile fout("backgroundFromFile.root","recreate"); | |
793 | fListOfHits.Write(); | |
794 | fListOfPrimaries.Write(); | |
795 | fListOfCorrection.Write(); | |
796 | fVertexBins.Write(); | |
797 | ||
798 | fout.Close(); | |
0b0a4ae5 | 799 | AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); |
cc83fca2 | 800 | if (!storeInOCDB) { |
801 | pars->SetBackgroundPath("."); | |
802 | pars->SetEnergyPath("."); | |
803 | pars->SetEventSelectionPath("."); | |
804 | pars->SetSharingEfficiencyPath("."); | |
d31dce33 | 805 | } |
cc83fca2 | 806 | AliInfo(Form("Generating %s", pars->GetPath(pars->GetBackgroundID()))); |
807 | TFile fbg(pars->GetPath(pars->GetBackgroundID()),"RECREATE"); | |
808 | fBackground->Write(AliFMDAnaParameters::GetBackgroundID()); | |
809 | fbg.Close(); | |
810 | ||
811 | AliInfo(Form("Generating %s", pars->GetPath(pars->GetEventSelectionEffID()))); | |
812 | TFile feselect(pars->GetPath(pars->GetEventSelectionEffID()),"RECREATE"); | |
813 | fEventSelectionEff->Write(AliFMDAnaParameters::GetEventSelectionEffID()); | |
814 | feselect.Close(); | |
d31dce33 | 815 | } |
816 | //_____________________________________________________________________ | |
817 | // | |
818 | // EOF | |
819 | // |