]>
Commit | Line | Data |
---|---|---|
7e4038b5 | 1 | // |
7984e5f7 | 2 | // Class to do the sharing correction. That is, a filter that merges |
3 | // adjacent strip signals presumably originating from a single particle | |
4 | // that impinges on the detector in such a way that it deposite energy | |
5 | // into two or more strips. | |
6 | // | |
7 | // Input: | |
8 | // - AliESDFMD object - from reconstruction | |
9 | // | |
10 | // Output: | |
11 | // - AliESDFMD object - copy of input, but with signals merged | |
12 | // | |
13 | // Corrections used: | |
14 | // - AliFMDCorrELossFit | |
15 | // | |
16 | // Histograms: | |
17 | // - For each ring (FMD1i, FMD2i, FMD2o, FMD3i, FMD3o) the distribution of | |
18 | // signals before and after the filter. | |
19 | // - For each ring (see above), an array of distributions of number of | |
20 | // hit strips for each vertex bin (if enabled - see Init method) | |
21 | // | |
22 | // | |
7e4038b5 | 23 | // |
24 | #include "AliFMDSharingFilter.h" | |
25 | #include <AliESDFMD.h> | |
26 | #include <TAxis.h> | |
27 | #include <TList.h> | |
28 | #include <TH1.h> | |
29 | #include <TMath.h> | |
0bd4b00f | 30 | #include "AliForwardCorrectionManager.h" |
fb3430ac | 31 | #include "AliFMDCorrELossFit.h" |
7e4038b5 | 32 | #include <AliLog.h> |
0bd4b00f | 33 | #include <TROOT.h> |
5bb5d1f6 | 34 | #include <THStack.h> |
f7cfc454 | 35 | #include <TParameter.h> |
0bd4b00f | 36 | #include <iostream> |
37 | #include <iomanip> | |
7e4038b5 | 38 | |
39 | ClassImp(AliFMDSharingFilter) | |
40 | #if 0 | |
41 | ; // This is for Emacs | |
42 | #endif | |
43 | ||
5bb5d1f6 | 44 | #define DBG(L,M) \ |
45 | do { if (L>fDebug)break; std::cout << (M) << std::flush;} while(false) | |
46 | #define DBGL(L,M) \ | |
47 | do { if (L>fDebug)break; std::cout << (M) << std::endl;} while(false) | |
48 | ||
49 | ||
7e4038b5 | 50 | |
51 | //____________________________________________________________________ | |
52 | AliFMDSharingFilter::AliFMDSharingFilter() | |
53 | : TNamed(), | |
54 | fRingHistos(), | |
ea3e5d95 | 55 | fCorrectAngles(kFALSE), |
5bb5d1f6 | 56 | fSummed(0), |
57 | fHighCuts(0), | |
d2638bb7 | 58 | fLowCuts(0), |
5bb5d1f6 | 59 | fOper(0), |
40196108 | 60 | fDebug(0), |
d2638bb7 | 61 | fZeroSharedHitsBelowThreshold(false), |
62 | fLCuts(), | |
7b212e49 | 63 | fHCuts(), |
d1013ccf | 64 | fUseSimpleMerging(false), |
6f4a5c0d | 65 | fThreeStripSharing(true), |
66 | fRecalculateEta(false) | |
7984e5f7 | 67 | { |
68 | // | |
69 | // Default Constructor - do not use | |
70 | // | |
6ab100ec | 71 | DGUARD(fDebug,0, "Default CTOR for AliFMDSharingFilter"); |
7984e5f7 | 72 | } |
7e4038b5 | 73 | |
74 | //____________________________________________________________________ | |
75 | AliFMDSharingFilter::AliFMDSharingFilter(const char* title) | |
76 | : TNamed("fmdSharingFilter", title), | |
77 | fRingHistos(), | |
ea3e5d95 | 78 | fCorrectAngles(kFALSE), |
5bb5d1f6 | 79 | fSummed(0), |
80 | fHighCuts(0), | |
d2638bb7 | 81 | fLowCuts(0), |
5bb5d1f6 | 82 | fOper(0), |
40196108 | 83 | fDebug(0), |
d2638bb7 | 84 | fZeroSharedHitsBelowThreshold(false), |
85 | fLCuts(), | |
7b212e49 | 86 | fHCuts(), |
d1013ccf | 87 | fUseSimpleMerging(false), |
6f4a5c0d | 88 | fThreeStripSharing(true), |
89 | fRecalculateEta(false) | |
7e4038b5 | 90 | { |
7984e5f7 | 91 | // |
92 | // Constructor | |
93 | // | |
94 | // Parameters: | |
95 | // title Title of object - not significant | |
96 | // | |
6ab100ec | 97 | DGUARD(fDebug,0, "Named CTOR for AliFMDSharingFilter: %s", title); |
1c8feb73 | 98 | fRingHistos.SetName(GetName()); |
99 | fRingHistos.SetOwner(); | |
100 | ||
7e4038b5 | 101 | fRingHistos.Add(new RingHistos(1, 'I')); |
102 | fRingHistos.Add(new RingHistos(2, 'I')); | |
103 | fRingHistos.Add(new RingHistos(2, 'O')); | |
104 | fRingHistos.Add(new RingHistos(3, 'I')); | |
105 | fRingHistos.Add(new RingHistos(3, 'O')); | |
d2638bb7 | 106 | |
107 | fHCuts.SetNXi(1); | |
108 | fHCuts.SetIncludeSigma(1); | |
109 | fLCuts.SetMultCuts(.15); | |
7e4038b5 | 110 | } |
111 | ||
112 | //____________________________________________________________________ | |
113 | AliFMDSharingFilter::AliFMDSharingFilter(const AliFMDSharingFilter& o) | |
114 | : TNamed(o), | |
115 | fRingHistos(), | |
ea3e5d95 | 116 | fCorrectAngles(o.fCorrectAngles), |
5bb5d1f6 | 117 | fSummed(o.fSummed), |
118 | fHighCuts(o.fHighCuts), | |
d2638bb7 | 119 | fLowCuts(o.fLowCuts), |
5bb5d1f6 | 120 | fOper(o.fOper), |
40196108 | 121 | fDebug(o.fDebug), |
d2638bb7 | 122 | fZeroSharedHitsBelowThreshold(o.fZeroSharedHitsBelowThreshold), |
123 | fLCuts(o.fLCuts), | |
7b212e49 | 124 | fHCuts(o.fHCuts), |
d1013ccf | 125 | fUseSimpleMerging(o.fUseSimpleMerging), |
6f4a5c0d | 126 | fThreeStripSharing(o.fThreeStripSharing), |
127 | fRecalculateEta(o.fRecalculateEta) | |
7e4038b5 | 128 | { |
7984e5f7 | 129 | // |
130 | // Copy constructor | |
131 | // | |
132 | // Parameters: | |
133 | // o Object to copy from | |
134 | // | |
6ab100ec | 135 | DGUARD(fDebug,0, "Copy CTOR for AliFMDSharingFilter"); |
7e4038b5 | 136 | TIter next(&o.fRingHistos); |
137 | TObject* obj = 0; | |
138 | while ((obj = next())) fRingHistos.Add(obj); | |
139 | } | |
140 | ||
141 | //____________________________________________________________________ | |
142 | AliFMDSharingFilter::~AliFMDSharingFilter() | |
143 | { | |
7984e5f7 | 144 | // |
145 | // Destructor | |
146 | // | |
6ab100ec | 147 | DGUARD(fDebug,3, "DTOR for AliFMDSharingFilter"); |
7e4038b5 | 148 | fRingHistos.Delete(); |
149 | } | |
150 | ||
151 | //____________________________________________________________________ | |
152 | AliFMDSharingFilter& | |
153 | AliFMDSharingFilter::operator=(const AliFMDSharingFilter& o) | |
154 | { | |
7984e5f7 | 155 | // |
156 | // Assignment operator | |
157 | // | |
158 | // Parameters: | |
159 | // o Object to assign from | |
160 | // | |
161 | // Return: | |
162 | // Reference to this | |
163 | // | |
6ab100ec | 164 | DGUARD(fDebug,3, "Assigment for AliFMDSharingFilter"); |
d015ecfe | 165 | if (&o == this) return *this; |
ea3e5d95 | 166 | TNamed::operator=(o); |
7e4038b5 | 167 | |
40196108 | 168 | fCorrectAngles = o.fCorrectAngles; |
40196108 | 169 | fDebug = o.fDebug; |
170 | fOper = o.fOper; | |
171 | fSummed = o.fSummed; | |
172 | fHighCuts = o.fHighCuts; | |
d2638bb7 | 173 | fLowCuts = o.fLowCuts; |
40196108 | 174 | fZeroSharedHitsBelowThreshold = o.fZeroSharedHitsBelowThreshold; |
d2638bb7 | 175 | fLCuts = o.fLCuts; |
176 | fHCuts = o.fHCuts; | |
7b212e49 | 177 | fUseSimpleMerging = o.fUseSimpleMerging; |
d1013ccf | 178 | fThreeStripSharing = o.fThreeStripSharing; |
6f4a5c0d | 179 | fRecalculateEta = o.fRecalculateEta; |
7b212e49 | 180 | |
7e4038b5 | 181 | fRingHistos.Delete(); |
182 | TIter next(&o.fRingHistos); | |
183 | TObject* obj = 0; | |
184 | while ((obj = next())) fRingHistos.Add(obj); | |
185 | ||
186 | return *this; | |
187 | } | |
188 | ||
189 | //____________________________________________________________________ | |
190 | AliFMDSharingFilter::RingHistos* | |
191 | AliFMDSharingFilter::GetRingHistos(UShort_t d, Char_t r) const | |
192 | { | |
7984e5f7 | 193 | // |
194 | // Get the ring histogram container | |
195 | // | |
196 | // Parameters: | |
197 | // d Detector | |
198 | // r Ring | |
199 | // | |
200 | // Return: | |
201 | // Ring histogram container | |
202 | // | |
7e4038b5 | 203 | Int_t idx = -1; |
204 | switch (d) { | |
205 | case 1: idx = 0; break; | |
206 | case 2: idx = 1 + (r == 'I' || r == 'i' ? 0 : 1); break; | |
207 | case 3: idx = 3 + (r == 'I' || r == 'i' ? 0 : 1); break; | |
208 | } | |
209 | if (idx < 0 || idx >= fRingHistos.GetEntries()) return 0; | |
210 | ||
211 | return static_cast<RingHistos*>(fRingHistos.At(idx)); | |
212 | } | |
213 | ||
5bb5d1f6 | 214 | //____________________________________________________________________ |
215 | void | |
e2ebf8c4 | 216 | AliFMDSharingFilter::Init(const TAxis& axis) |
5bb5d1f6 | 217 | { |
218 | // Initialise | |
6ab100ec | 219 | DGUARD(fDebug,1, "Initialize for AliFMDSharingFilter"); |
5c1012c1 | 220 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); |
221 | AliFMDCorrELossFit* fits = fcm.GetELossFit(); | |
5bb5d1f6 | 222 | |
223 | // Get the high cut. The high cut is defined as the | |
224 | // most-probably-value peak found from the energy distributions, minus | |
225 | // 2 times the width of the corresponding Landau. | |
4077f3e8 | 226 | |
a76fb27d | 227 | TAxis eAxis(axis.GetNbins(), |
228 | axis.GetXmin(), | |
229 | axis.GetXmax()); | |
5c1012c1 | 230 | if(fits) |
231 | eAxis.Set(fits->GetEtaAxis().GetNbins(), | |
232 | fits->GetEtaAxis().GetXmin(), | |
233 | fits->GetEtaAxis().GetXmax()); | |
5bb5d1f6 | 234 | |
5c1012c1 | 235 | UShort_t nEta = eAxis.GetNbins(); |
4077f3e8 | 236 | |
5bb5d1f6 | 237 | fHighCuts->SetBins(nEta, eAxis.GetXmin(), eAxis.GetXmax(), 5, .5, 5.5); |
238 | fHighCuts->GetYaxis()->SetBinLabel(1, "FMD1i"); | |
239 | fHighCuts->GetYaxis()->SetBinLabel(2, "FMD2i"); | |
240 | fHighCuts->GetYaxis()->SetBinLabel(3, "FMD2o"); | |
241 | fHighCuts->GetYaxis()->SetBinLabel(4, "FMD3i"); | |
242 | fHighCuts->GetYaxis()->SetBinLabel(5, "FMD3o"); | |
243 | ||
d2638bb7 | 244 | fLowCuts->SetBins(nEta, eAxis.GetXmin(), eAxis.GetXmax(), 5, .5, 5.5); |
245 | fLowCuts->GetYaxis()->SetBinLabel(1, "FMD1i"); | |
246 | fLowCuts->GetYaxis()->SetBinLabel(2, "FMD2i"); | |
247 | fLowCuts->GetYaxis()->SetBinLabel(3, "FMD2o"); | |
248 | fLowCuts->GetYaxis()->SetBinLabel(4, "FMD3i"); | |
249 | fLowCuts->GetYaxis()->SetBinLabel(5, "FMD3o"); | |
250 | ||
5bb5d1f6 | 251 | UShort_t ybin = 0; |
252 | for (UShort_t d = 1; d <= 3; d++) { | |
253 | UShort_t nr = (d == 1 ? 1 : 2); | |
254 | for (UShort_t q = 0; q < nr; q++) { | |
255 | Char_t r = (q == 0 ? 'I' : 'O'); | |
256 | ybin++; | |
257 | for (UShort_t e = 1; e <= nEta; e++) { | |
258 | Double_t eta = eAxis.GetBinCenter(e); | |
4077f3e8 | 259 | |
58ebb4bf | 260 | if (fDebug > 3) fHCuts.Print(); |
261 | ||
d2638bb7 | 262 | Double_t hcut = GetHighCut(d, r, eta, false); |
263 | Double_t lcut = GetLowCut(d, r, eta); | |
4077f3e8 | 264 | |
d2638bb7 | 265 | if (hcut > 0) fHighCuts->SetBinContent(e, ybin, hcut); |
266 | if (lcut > 0) fLowCuts ->SetBinContent(e, ybin, lcut); | |
5bb5d1f6 | 267 | } |
268 | } | |
269 | } | |
270 | } | |
271 | ||
7e4038b5 | 272 | //____________________________________________________________________ |
273 | Bool_t | |
274 | AliFMDSharingFilter::Filter(const AliESDFMD& input, | |
275 | Bool_t lowFlux, | |
6f4a5c0d | 276 | AliESDFMD& output, |
277 | Double_t zvtx) | |
7e4038b5 | 278 | { |
7984e5f7 | 279 | // |
280 | // Filter the input AliESDFMD object | |
281 | // | |
282 | // Parameters: | |
283 | // input Input | |
284 | // lowFlux If this is a low-flux event | |
285 | // output Output AliESDFMD object | |
286 | // | |
287 | // Return: | |
288 | // True on success, false otherwise | |
289 | // | |
6ab100ec | 290 | DGUARD(fDebug,1, "Filter event in AliFMDSharingFilter"); |
7e4038b5 | 291 | output.Clear(); |
292 | TIter next(&fRingHistos); | |
0bd4b00f | 293 | RingHistos* o = 0; |
7e4038b5 | 294 | while ((o = static_cast<RingHistos*>(next()))) |
295 | o->Clear(); | |
296 | ||
5bb5d1f6 | 297 | if (fOper) fOper->Reset(0); |
298 | Int_t nNone = 0; | |
299 | Int_t nCandidate = 0; | |
300 | Int_t nMerged = 0; | |
301 | Int_t nSummed = 0; | |
7e4038b5 | 302 | |
5bb5d1f6 | 303 | Status status[512]; |
304 | ||
7e4038b5 | 305 | for(UShort_t d = 1; d <= 3; d++) { |
306 | Int_t nRings = (d == 1 ? 1 : 2); | |
307 | for (UShort_t q = 0; q < nRings; q++) { | |
5bb5d1f6 | 308 | Char_t r = (q == 0 ? 'I' : 'O'); |
309 | UShort_t nsec = (q == 0 ? 20 : 40); | |
310 | UShort_t nstr = (q == 0 ? 512 : 256); | |
7e4038b5 | 311 | RingHistos* histos = GetRingHistos(d, r); |
312 | ||
313 | for(UShort_t s = 0; s < nsec; s++) { | |
7b212e49 | 314 | |
5bb5d1f6 | 315 | for (UShort_t t = 0; t < nstr; t++) status[t] = kCandidate; |
7b212e49 | 316 | |
5bb5d1f6 | 317 | #ifdef USE_OLDER_MERGING |
318 | Bool_t usedThis = kFALSE; | |
319 | Bool_t usedPrev = kFALSE; | |
320 | #endif | |
7b212e49 | 321 | //For simple merging |
322 | Bool_t used = kFALSE; | |
b0036461 | 323 | Double_t eTotal = -1; |
7f1cfdfd | 324 | Int_t nDistanceBefore = -1; |
325 | Int_t nDistanceAfter = -1; | |
326 | Bool_t twoLow = kFALSE; | |
7e4038b5 | 327 | for(UShort_t t = 0; t < nstr; t++) { |
7f1cfdfd | 328 | nDistanceBefore++; |
329 | nDistanceAfter++; | |
330 | ||
7e4038b5 | 331 | output.SetMultiplicity(d,r,s,t,0.); |
332 | Float_t mult = SignalInStrip(input,d,r,s,t); | |
7b212e49 | 333 | //For simple merging |
7f1cfdfd | 334 | Float_t multNext = 0; |
335 | Float_t multNextNext = 0; | |
336 | ||
7b212e49 | 337 | if(t<nstr-1) multNext = SignalInStrip(input,d,r,s,t+1); |
7f1cfdfd | 338 | if(t<nstr-2) multNextNext = SignalInStrip(input,d,r,s,t+2); |
7b212e49 | 339 | if(multNext == AliESDFMD::kInvalidMult) multNext = 0; |
7f1cfdfd | 340 | if(multNextNext == AliESDFMD::kInvalidMult) multNextNext = 0; |
9223d782 | 341 | if(!fThreeStripSharing) multNextNext = 0; |
5bb5d1f6 | 342 | // Get the pseudo-rapidity |
343 | Double_t eta = input.Eta(d,r,s,t); | |
344 | Double_t phi = input.Phi(d,r,s,t) * TMath::Pi() / 180.; | |
345 | if (s == 0) output.SetEta(d,r,s,t,eta); | |
7e4038b5 | 346 | |
6f4a5c0d | 347 | Double_t etaOld = eta; |
348 | Double_t etaCalc = 0; | |
349 | if(fRecalculateEta) { | |
350 | etaCalc = AliForwardUtil::GetEtaFromStrip(d,r,s,t,zvtx); | |
351 | eta = etaCalc; | |
352 | } | |
353 | if(fRecalculateEta && mult > 0 && mult != AliESDFMD::kInvalidMult ) { | |
354 | Double_t cosOld = TMath::Cos(2*TMath::ATan(TMath::Exp(-1*TMath::Abs(etaOld)))); | |
355 | Double_t cosNew = TMath::Cos(2*TMath::ATan(TMath::Exp(-1*TMath::Abs(etaCalc)))); | |
356 | if(mult > 0) mult = (mult/cosOld)*cosNew; | |
357 | if(multNext > 0) multNext = (multNext/cosOld)*cosNew; | |
358 | if(multNextNext > 0) multNextNext = (multNextNext/cosOld)*cosNew; | |
359 | ||
360 | //No corrections beyond this point | |
361 | // if(eta < -4) { | |
362 | // mult = 0; multNext = 0; multNextNext = 0; | |
363 | // } | |
364 | } | |
365 | ||
7e4038b5 | 366 | // Keep dead-channel information. |
367 | if(mult == AliESDFMD::kInvalidMult) | |
368 | output.SetMultiplicity(d,r,s,t,AliESDFMD::kInvalidMult); | |
7b212e49 | 369 | |
7e4038b5 | 370 | // If no signal or dead strip, go on. |
5bb5d1f6 | 371 | if (mult == AliESDFMD::kInvalidMult || mult == 0) { |
372 | if (mult == 0) histos->fSum->Fill(eta,phi,mult); | |
373 | status[t] = kNone; | |
374 | continue; | |
375 | } | |
7e4038b5 | 376 | |
7e4038b5 | 377 | // Fill the diagnostics histogram |
378 | histos->fBefore->Fill(mult); | |
7e4038b5 | 379 | |
7b212e49 | 380 | Double_t mergedEnergy = 0; |
381 | ||
382 | if(fUseSimpleMerging) { | |
383 | Float_t etot = 0; | |
7f1cfdfd | 384 | if (t < nstr-1) histos->fNeighborsBefore->Fill(mult,multNext); |
385 | if(mult > GetHighCut(d, r, eta ,false)) { | |
386 | histos->fDistanceBefore->Fill(nDistanceBefore); | |
387 | nDistanceBefore = -1; | |
388 | } | |
7b212e49 | 389 | |
9223d782 | 390 | if(eTotal > 0) { |
391 | if(fThreeStripSharing && multNext > GetLowCut(d, r, eta) && | |
7f1cfdfd | 392 | (multNext < GetHighCut(d, r, eta ,false) || twoLow)) { |
b0036461 | 393 | eTotal = eTotal + multNext; |
394 | used = kTRUE; | |
f26a8959 | 395 | histos->fTriple->Fill(eTotal); |
7f1cfdfd | 396 | twoLow = kFALSE; |
f26a8959 | 397 | } |
398 | else { | |
399 | used = kFALSE; | |
400 | histos->fDouble->Fill(eTotal); | |
b0036461 | 401 | } |
b0036461 | 402 | etot = eTotal; |
403 | eTotal = -1; | |
7b212e49 | 404 | } |
b0036461 | 405 | else { |
b0036461 | 406 | if(used) {used = kFALSE; continue; } |
7f1cfdfd | 407 | if(mult > GetLowCut(d, r, eta)) etot = mult; |
b0036461 | 408 | |
409 | if(mult > GetLowCut(d, r, eta) && | |
410 | multNext > GetLowCut(d, r, eta) && | |
411 | (mult < GetHighCut(d, r, eta ,false) || | |
412 | multNext < GetHighCut(d, r, eta ,false))) { | |
7f1cfdfd | 413 | |
414 | if(mult < GetHighCut(d, r, eta ,false) && | |
415 | multNext < GetHighCut(d, r, eta ,false) ) | |
416 | twoLow = kTRUE; | |
417 | ||
9223d782 | 418 | if(mult>multNext && multNextNext < GetLowCut(d, r, eta)) |
d1013ccf | 419 | { |
420 | etot = mult + multNext; | |
421 | used=kTRUE; | |
422 | histos->fDouble->Fill(etot); | |
423 | } | |
b0036461 | 424 | else { |
425 | etot = 0; | |
426 | eTotal = mult + multNext; | |
427 | } | |
428 | } | |
f26a8959 | 429 | else { |
430 | if(etot > 0) { | |
431 | histos->fSingle->Fill(etot); | |
432 | histos->fSinglePerStrip->Fill(etot,t); | |
433 | } | |
434 | } | |
b0036461 | 435 | } |
f26a8959 | 436 | |
7b212e49 | 437 | mergedEnergy = etot; |
7f1cfdfd | 438 | if(mergedEnergy > GetHighCut(d, r, eta ,false) ) { |
439 | histos->fDistanceAfter->Fill(nDistanceAfter); | |
440 | nDistanceAfter = -1; | |
441 | } | |
b0036461 | 442 | //if(mult>0 && multNext >0) |
443 | // std::cout<<mult<<" "<<multNext<<" "<<mergedEnergy<<std::endl; | |
7b212e49 | 444 | } |
445 | else { | |
446 | // Get next and previous signal - if any | |
447 | Double_t prevE = 0; | |
448 | Double_t nextE = 0; | |
449 | Status prevStatus = (t == 0 ? kNone : status[t-1]); | |
450 | Status thisStatus = status[t]; | |
451 | Status nextStatus = (t == nstr-1 ? kNone : status[t+1]); | |
452 | if (t != 0) { | |
453 | prevE = SignalInStrip(input,d,r,s,t-1); | |
454 | if (prevE == AliESDFMD::kInvalidMult) prevE = 0; | |
455 | } | |
456 | if (t != nstr - 1) { | |
457 | nextE = SignalInStrip(input,d,r,s,t+1); | |
458 | if (nextE == AliESDFMD::kInvalidMult) nextE = 0; | |
459 | } | |
460 | if (t != 0) histos->fNeighborsBefore->Fill(prevE, mult); | |
461 | ||
5bb5d1f6 | 462 | #ifdef USE_OLDER_MERGING |
7b212e49 | 463 | /*Double_t*/ mergedEnergy = MultiplicityOfStrip(mult,eta,prevE,nextE, |
464 | lowFlux,d,r,s,t, | |
465 | usedPrev,usedThis); | |
466 | status[t] = (usedPrev ? kMergedWithOther : kNone); | |
467 | if (t != nstr - 1) status[t] = (usedThis ? kMergedWithOther : kNone); | |
5bb5d1f6 | 468 | #else |
7b212e49 | 469 | /*Double_t*/ mergedEnergy = MultiplicityOfStrip(mult, prevE, nextE, |
470 | eta, lowFlux, | |
471 | d, r, s, t, | |
472 | prevStatus, | |
473 | thisStatus, | |
474 | nextStatus); | |
475 | if (t != 0) status[t-1] = prevStatus; | |
476 | if (t != nstr-1) status[t+1] = nextStatus; | |
477 | status[t] = thisStatus; | |
478 | ||
5bb5d1f6 | 479 | #endif |
7b212e49 | 480 | // If we're processing on non-angle corrected data, we |
481 | // should do the angle correction here | |
482 | } | |
5bb5d1f6 | 483 | if (!fCorrectAngles) |
484 | mergedEnergy = AngleCorrect(mergedEnergy, eta); | |
485 | if (mergedEnergy > 0) histos->Incr(); | |
7b212e49 | 486 | |
5bb5d1f6 | 487 | if (t != 0) |
488 | histos->fNeighborsAfter->Fill(output.Multiplicity(d,r,s,t-1), | |
489 | mergedEnergy); | |
490 | histos->fBeforeAfter->Fill(mult, mergedEnergy); | |
f26a8959 | 491 | if(mergedEnergy > 0) |
492 | histos->fAfter->Fill(mergedEnergy); | |
5bb5d1f6 | 493 | histos->fSum->Fill(eta,phi,mergedEnergy); |
7b212e49 | 494 | |
7e4038b5 | 495 | output.SetMultiplicity(d,r,s,t,mergedEnergy); |
7e4038b5 | 496 | } // for strip |
5bb5d1f6 | 497 | for (UShort_t t = 0; t < nstr; t++) { |
498 | if (fOper) fOper->operator()(d, r, s, t) = status[t]; | |
499 | switch (status[t]) { | |
500 | case kNone: nNone++; break; | |
501 | case kCandidate: nCandidate++; break; | |
502 | case kMergedWithOther: nMerged++; break; | |
503 | case kMergedInto: nSummed++; break; | |
504 | } | |
505 | } | |
7e4038b5 | 506 | } // for sector |
507 | } // for ring | |
508 | } // for detector | |
5bb5d1f6 | 509 | fSummed->Fill(kNone, nNone); |
510 | fSummed->Fill(kCandidate, nCandidate); | |
511 | fSummed->Fill(kMergedWithOther, nMerged); | |
512 | fSummed->Fill(kMergedInto, nSummed); | |
7e4038b5 | 513 | |
6ab100ec | 514 | DBGL(5, Form("none=%9d, candidate=%9d, merged=%9d, summed=%9d", |
5bb5d1f6 | 515 | nNone, nCandidate, nMerged, nSummed)); |
7e4038b5 | 516 | next.Reset(); |
517 | while ((o = static_cast<RingHistos*>(next()))) | |
518 | o->Finish(); | |
519 | ||
520 | return kTRUE; | |
521 | } | |
522 | ||
523 | //_____________________________________________________________________ | |
524 | Double_t | |
525 | AliFMDSharingFilter::SignalInStrip(const AliESDFMD& input, | |
526 | UShort_t d, | |
527 | Char_t r, | |
528 | UShort_t s, | |
529 | UShort_t t) const | |
530 | { | |
7984e5f7 | 531 | // |
532 | // Get the signal in a strip | |
533 | // | |
534 | // Parameters: | |
535 | // fmd ESD object | |
536 | // d Detector | |
537 | // r Ring | |
538 | // s Sector | |
539 | // t Strip | |
540 | // | |
541 | // Return: | |
542 | // The energy signal | |
543 | // | |
7e4038b5 | 544 | Double_t mult = input.Multiplicity(d,r,s,t); |
5bb5d1f6 | 545 | // In case of |
546 | // - bad value (invalid or 0) | |
547 | // - we want angle corrected and data is | |
548 | // - we don't want angle corrected and data isn't | |
549 | // just return read value | |
550 | if (mult == AliESDFMD::kInvalidMult || | |
551 | mult == 0 || | |
552 | (fCorrectAngles && input.IsAngleCorrected()) || | |
553 | (!fCorrectAngles && !input.IsAngleCorrected())) | |
554 | return mult; | |
555 | ||
556 | // If we want angle corrected data, correct it, | |
557 | // otherwise de-correct it | |
558 | if (fCorrectAngles) mult = AngleCorrect(mult, input.Eta(d,r,s,t)); | |
559 | else mult = DeAngleCorrect(mult, input.Eta(d,r,s,t)); | |
7e4038b5 | 560 | return mult; |
561 | } | |
0bd4b00f | 562 | //_____________________________________________________________________ |
563 | Double_t | |
d2638bb7 | 564 | AliFMDSharingFilter::GetLowCut(UShort_t d, Char_t r, Double_t eta) const |
0bd4b00f | 565 | { |
7984e5f7 | 566 | // |
567 | // Get the low cut. Normally, the low cut is taken to be the lower | |
568 | // value of the fit range used when generating the energy loss fits. | |
569 | // However, if fLowCut is set (using SetLowCit) to a value greater | |
570 | // than 0, then that value is used. | |
571 | // | |
d2638bb7 | 572 | return fLCuts.GetMultCut(d,r,eta,false); |
573 | #if 0 | |
574 | if (!fCutAtFractionOfMPV && fLowCut > 0) return fLowCut; | |
575 | ||
0bd4b00f | 576 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); |
577 | AliFMDCorrELossFit* fits = fcm.GetELossFit(); | |
d2638bb7 | 578 | |
579 | if (fCutAtFractionOfMPV) { | |
580 | AliFMDCorrELossFit::ELossFit* func = fits->GetFit(d,r,eta); | |
581 | return fFractionOfMPV*func->GetDelta() ; | |
582 | } | |
0bd4b00f | 583 | return fits->GetLowCut(); |
d2638bb7 | 584 | #endif |
0bd4b00f | 585 | } |
7e4038b5 | 586 | |
587 | //_____________________________________________________________________ | |
588 | Double_t | |
5bb5d1f6 | 589 | AliFMDSharingFilter::GetHighCut(UShort_t d, Char_t r, |
590 | Double_t eta, Bool_t errors) const | |
7e4038b5 | 591 | { |
7984e5f7 | 592 | // |
593 | // Get the high cut. The high cut is defined as the | |
594 | // most-probably-value peak found from the energy distributions, minus | |
595 | // 2 times the width of the corresponding Landau. | |
596 | // | |
d2638bb7 | 597 | return fHCuts.GetMultCut(d,r,eta,errors); |
5bb5d1f6 | 598 | } |
599 | ||
600 | //_____________________________________________________________________ | |
601 | namespace { | |
602 | const char* status2String(AliFMDSharingFilter::Status s) | |
603 | { | |
604 | switch(s) { | |
605 | case AliFMDSharingFilter::kNone: return "none "; | |
606 | case AliFMDSharingFilter::kCandidate: return "candidate"; | |
607 | case AliFMDSharingFilter::kMergedWithOther: return "merged "; | |
608 | case AliFMDSharingFilter::kMergedInto: return "summed "; | |
609 | } | |
610 | return "unknown "; | |
0bd4b00f | 611 | } |
5bb5d1f6 | 612 | } |
613 | ||
614 | //_____________________________________________________________________ | |
615 | Double_t | |
616 | AliFMDSharingFilter::MultiplicityOfStrip(Double_t thisE, | |
617 | Double_t prevE, | |
618 | Double_t nextE, | |
619 | Double_t eta, | |
620 | Bool_t lowFlux, | |
621 | UShort_t d, | |
622 | Char_t r, | |
623 | UShort_t s, | |
624 | UShort_t t, | |
625 | Status& prevStatus, | |
626 | Status& thisStatus, | |
627 | Status& nextStatus) const | |
628 | { | |
629 | Double_t lowCut = GetLowCut(d, r, eta); | |
630 | ||
631 | DBG(3,Form("FMD%d%c[%2d,%3d]: this=%9f(%s), prev=%9f(%s), next=%9f(%s)", | |
632 | d, r, s, t, | |
633 | thisE, status2String(thisStatus), | |
634 | prevE, status2String(prevStatus), | |
635 | nextE, status2String(nextStatus))); | |
636 | ||
637 | // If below cut, then modify zero signal and make sure the next | |
638 | // strip is considered a candidate. | |
639 | if (thisE < lowCut || thisE > 20) { | |
640 | thisStatus = kNone; | |
6ab100ec | 641 | DBGL(5,Form(" %9f<%9f || %9f>20, 0'ed", thisE, lowCut, thisE)); |
5bb5d1f6 | 642 | if (prevStatus == kCandidate) prevStatus = kNone; |
643 | return 0; | |
644 | } | |
645 | // It this strip was merged with the previous strip, then | |
646 | // make the next strip a candidate and zero the value in this strip. | |
647 | if (thisStatus == kMergedWithOther) { | |
6ab100ec | 648 | DBGL(5,Form(" Merged with other, 0'ed")); |
5bb5d1f6 | 649 | return 0; |
0bd4b00f | 650 | } |
651 | ||
5bb5d1f6 | 652 | // Get the upper cut on the sharing |
653 | Double_t highCut = GetHighCut(d, r, eta ,false); | |
654 | if (highCut <= 0) { | |
655 | thisStatus = kNone; | |
656 | return 0; | |
657 | } | |
658 | ||
659 | // Only for low-flux events | |
660 | if (lowFlux) { | |
661 | // If this is smaller than the next, and the next is larger | |
662 | // then the cut, mark both as candidates for sharing. | |
663 | // They should be be merged on the next iteration | |
664 | if (thisE < nextE && nextE > highCut) { | |
665 | thisStatus = kCandidate; | |
666 | nextStatus = kCandidate; | |
667 | return 0; | |
668 | } | |
669 | } | |
670 | ||
671 | // Variable to sum signal in | |
672 | Double_t totalE = thisE; | |
673 | ||
674 | // If the previous signal was between the two cuts, and is still | |
675 | // marked as a candidate , then merge it in here. | |
676 | if (prevStatus == kCandidate && prevE > lowCut && prevE < highCut) { | |
677 | totalE += prevE; | |
678 | prevStatus = kMergedWithOther; | |
679 | DBG(3, Form(" Prev candidate %9f<%9f<%9f->%9f", | |
680 | lowCut, prevE, highCut, totalE)); | |
681 | } | |
682 | ||
683 | // If the next signal is between the two cuts, then merge it here | |
684 | if (nextE > lowCut && nextE < highCut) { | |
685 | totalE += nextE; | |
686 | nextStatus = kMergedWithOther; | |
687 | DBG(3, Form(" Next %9f<%9f<%9f->%9f", lowCut, nextE, highCut,totalE)); | |
688 | } | |
689 | ||
690 | // If the signal is bigger than the high-cut, then return the value | |
691 | if (totalE > highCut) { | |
692 | if (totalE > thisE) | |
693 | thisStatus = kMergedInto; | |
694 | else | |
695 | thisStatus = kNone; | |
6ab100ec | 696 | DBGL(5, Form(" %9f>%f9 (was %9f) -> %9f %s", |
5bb5d1f6 | 697 | totalE, highCut, thisE, totalE,status2String(thisStatus))); |
698 | return totalE; | |
699 | } | |
700 | else { | |
701 | // This is below cut, so flag next as a candidate | |
702 | DBG(3, Form(" %9f<=%9f, next candidate", totalE, highCut)); | |
703 | nextStatus = kCandidate; | |
704 | } | |
705 | ||
706 | // If the total signal is smaller than low cut then zero this and kill this | |
707 | if (totalE < lowCut) { | |
6ab100ec | 708 | DBGL(5, Form(" %9f<%9f (was %9f), zeroed", totalE, lowCut, thisE)); |
5bb5d1f6 | 709 | thisStatus = kNone; |
710 | return 0; | |
0bd4b00f | 711 | } |
5bb5d1f6 | 712 | |
713 | // If total signal not above high cut or lower than low cut, | |
714 | // mark this as a candidate for merging into the next, and zero signal | |
6ab100ec | 715 | DBGL(5, Form(" %9f<%9f<%9f (was %9f), zeroed, candidate", |
5bb5d1f6 | 716 | lowCut, totalE, highCut, thisE)); |
717 | thisStatus = kCandidate; | |
f7cfc454 | 718 | return (fZeroSharedHitsBelowThreshold ? 0 : totalE); |
7e4038b5 | 719 | } |
720 | ||
721 | //_____________________________________________________________________ | |
722 | Double_t | |
723 | AliFMDSharingFilter::MultiplicityOfStrip(Double_t mult, | |
724 | Double_t eta, | |
725 | Double_t prevE, | |
726 | Double_t nextE, | |
727 | Bool_t lowFlux, | |
728 | UShort_t d, | |
729 | Char_t r, | |
730 | UShort_t /*s*/, | |
731 | UShort_t /*t*/, | |
732 | Bool_t& usedPrev, | |
fb3430ac | 733 | Bool_t& usedThis) const |
7e4038b5 | 734 | { |
7984e5f7 | 735 | // |
736 | // The actual algorithm | |
737 | // | |
738 | // Parameters: | |
739 | // mult The unfiltered signal in the strip | |
740 | // eta Psuedo rapidity | |
741 | // prevE Previous strip signal (or 0) | |
742 | // nextE Next strip signal (or 0) | |
743 | // lowFlux Whether this is a low flux event | |
744 | // d Detector | |
745 | // r Ring | |
746 | // s Sector | |
747 | // t Strip | |
748 | // usedPrev Whether the previous strip was used in sharing or not | |
749 | // usedThis Wether this strip was used in sharing or not. | |
750 | // | |
751 | // Return: | |
752 | // The filtered signal in the strip | |
753 | // | |
754 | ||
7e4038b5 | 755 | // IF the multiplicity is very large, or below the cut, reject it, and |
756 | // flag it as candidate for sharing | |
5bb5d1f6 | 757 | Double_t lowCut = GetLowCut(d,r,eta); |
0bd4b00f | 758 | if(mult > 12 || mult < lowCut) { |
7e4038b5 | 759 | usedThis = kFALSE; |
760 | usedPrev = kFALSE; | |
761 | return 0; | |
762 | } | |
763 | ||
764 | // If this was shared with the previous signal, return 0 and mark it as | |
765 | // not a candiate for sharing | |
766 | if(usedThis) { | |
767 | usedThis = kFALSE; | |
768 | usedPrev = kTRUE; | |
769 | return 0.; | |
770 | } | |
771 | ||
772 | //analyse and perform sharing on one strip | |
773 | ||
0bd4b00f | 774 | // Get the high cut |
5bb5d1f6 | 775 | Double_t highCut = GetHighCut(d, r, eta, false); |
776 | if (highCut <= 0) { | |
777 | usedThis = kFALSE; | |
778 | usedPrev = kTRUE; | |
779 | return 0; | |
780 | } | |
7e4038b5 | 781 | |
782 | // If this signal is smaller than the next, and the next signal is smaller | |
783 | // than then the high cut, and it's a low-flux event, then mark this and | |
784 | // the next signal as candidates for sharing | |
785 | // | |
786 | // This is the test if the signal is the smaller of two possibly | |
787 | // shared signals. | |
788 | if (mult < nextE && | |
789 | nextE > highCut && | |
790 | lowFlux) { | |
791 | usedThis = kFALSE; | |
792 | usedPrev = kFALSE; | |
793 | return 0; | |
794 | } | |
795 | ||
796 | Double_t totalE = mult; | |
797 | ||
798 | // If the previous signal was larger than the low cut, and | |
799 | // the previous was smaller than high cut, and the previous signal | |
800 | // isn't marked as used, then add it's energy to this signal | |
0bd4b00f | 801 | if (prevE > lowCut && |
7e4038b5 | 802 | prevE < highCut && |
803 | !usedPrev) | |
804 | totalE += prevE; | |
805 | ||
806 | // If the next signal is larger than the low cut, and | |
5bb5d1f6 | 807 | // the next signal is smaller than the high cut, then add the next signal |
7e4038b5 | 808 | // to this, and marked the next signal as used |
0bd4b00f | 809 | if(nextE > lowCut && nextE < highCut ) { |
7e4038b5 | 810 | totalE += nextE; |
811 | usedThis = kTRUE; | |
812 | } | |
813 | ||
814 | // If we're processing on non-angle corrected data, we should do the | |
815 | // angle correction here | |
5bb5d1f6 | 816 | // if (!fCorrectAngles) |
817 | // totalE = AngleCorrect(totalE, eta); | |
7e4038b5 | 818 | |
819 | // Fill post processing histogram | |
820 | // if(totalE > fLowCut) | |
821 | // GetRingHistos(d,r)->fAfter->Fill(totalE); | |
822 | ||
823 | // Return value | |
824 | Double_t mergedEnergy = 0; | |
825 | ||
826 | if(totalE > 0) { | |
827 | // If we have a signal, then this is used (sharedPrev=true) and | |
828 | // the signal is set to the result | |
829 | mergedEnergy = totalE; | |
830 | usedPrev = kTRUE; | |
831 | } | |
832 | else { | |
833 | // If we do not have a signal (too low), then this is not shared, | |
834 | // and the next strip is not shared either | |
835 | usedThis = kFALSE; | |
836 | usedPrev = kFALSE; | |
837 | } | |
838 | ||
839 | return mergedEnergy; | |
840 | } | |
841 | //____________________________________________________________________ | |
842 | Double_t | |
843 | AliFMDSharingFilter::AngleCorrect(Double_t mult, Double_t eta) const | |
844 | { | |
7984e5f7 | 845 | // |
846 | // Angle correct the signal | |
847 | // | |
848 | // Parameters: | |
849 | // mult Angle Un-corrected Signal | |
850 | // eta Pseudo-rapidity | |
851 | // | |
852 | // Return: | |
853 | // Angle corrected signal | |
854 | // | |
7e4038b5 | 855 | Double_t theta = 2 * TMath::ATan(TMath::Exp(-eta)); |
856 | if (eta < 0) theta -= TMath::Pi(); | |
857 | return mult * TMath::Cos(theta); | |
858 | } | |
859 | //____________________________________________________________________ | |
860 | Double_t | |
861 | AliFMDSharingFilter::DeAngleCorrect(Double_t mult, Double_t eta) const | |
862 | { | |
7984e5f7 | 863 | // |
864 | // Angle de-correct the signal | |
865 | // | |
866 | // Parameters: | |
867 | // mult Angle corrected Signal | |
868 | // eta Pseudo-rapidity | |
869 | // | |
870 | // Return: | |
871 | // Angle un-corrected signal | |
872 | // | |
7e4038b5 | 873 | Double_t theta = 2 * TMath::ATan(TMath::Exp(-eta)); |
874 | if (eta < 0) theta -= TMath::Pi(); | |
875 | return mult / TMath::Cos(theta); | |
876 | } | |
877 | ||
878 | //____________________________________________________________________ | |
879 | void | |
fb3430ac | 880 | AliFMDSharingFilter::ScaleHistograms(const TList* dir, Int_t nEvents) |
7e4038b5 | 881 | { |
7984e5f7 | 882 | // |
883 | // Scale the histograms to the total number of events | |
884 | // | |
885 | // Parameters: | |
886 | // dir Where the output is | |
887 | // nEvents Number of events | |
888 | // | |
6ab100ec | 889 | DGUARD(fDebug,1, "Scale histograms in AliFMDSharingFilter"); |
7e4038b5 | 890 | if (nEvents <= 0) return; |
9d99b0dd | 891 | TList* d = static_cast<TList*>(dir->FindObject(GetName())); |
892 | if (!d) return; | |
7e4038b5 | 893 | |
894 | TIter next(&fRingHistos); | |
895 | RingHistos* o = 0; | |
5bb5d1f6 | 896 | THStack* sums = new THStack("sums", "Sum of ring signals"); |
897 | while ((o = static_cast<RingHistos*>(next()))) { | |
9d99b0dd | 898 | o->ScaleHistograms(d, nEvents); |
5bb5d1f6 | 899 | TH1D* sum = o->fSum->ProjectionX(o->GetName(), 1, o->fSum->GetNbinsY(),"e"); |
900 | sum->Scale(1., "width"); | |
901 | sum->SetTitle(o->GetName()); | |
902 | sum->SetDirectory(0); | |
903 | sum->SetYTitle("#sum #Delta/#Delta_{mip}"); | |
904 | sums->Add(sum); | |
905 | } | |
906 | d->Add(sums); | |
7e4038b5 | 907 | } |
908 | ||
909 | //____________________________________________________________________ | |
910 | void | |
9d99b0dd | 911 | AliFMDSharingFilter::DefineOutput(TList* dir) |
7e4038b5 | 912 | { |
7984e5f7 | 913 | // |
914 | // Define the output histograms. These are put in a sub list of the | |
915 | // passed list. The histograms are merged before the parent task calls | |
916 | // AliAnalysisTaskSE::Terminate | |
917 | // | |
918 | // Parameters: | |
919 | // dir Directory to add to | |
920 | // | |
6ab100ec | 921 | DGUARD(fDebug,1, "Define output in AliFMDSharingFilter"); |
7e4038b5 | 922 | TList* d = new TList; |
923 | d->SetName(GetName()); | |
924 | dir->Add(d); | |
5bb5d1f6 | 925 | |
926 | fSummed = new TH2I("operations", "Strip operations", | |
927 | kMergedInto, kNone-.5, kMergedInto+.5, | |
928 | 51201, -.5, 51200.5); | |
929 | fSummed->SetXTitle("Operation"); | |
930 | fSummed->SetYTitle("# of strips"); | |
931 | fSummed->SetZTitle("Events"); | |
932 | fSummed->GetXaxis()->SetBinLabel(kNone, "None"); | |
933 | fSummed->GetXaxis()->SetBinLabel(kCandidate, "Candidate"); | |
934 | fSummed->GetXaxis()->SetBinLabel(kMergedWithOther, "Merged w/other"); | |
935 | fSummed->GetXaxis()->SetBinLabel(kMergedInto, "Merged into"); | |
936 | fSummed->SetDirectory(0); | |
937 | d->Add(fSummed); | |
938 | ||
939 | fHighCuts = new TH2D("highCuts", "High cuts used", 1,0,1, 1,0,1); | |
940 | fHighCuts->SetXTitle("#eta"); | |
941 | fHighCuts->SetDirectory(0); | |
942 | d->Add(fHighCuts); | |
943 | ||
d2638bb7 | 944 | fLowCuts = new TH2D("lowCuts", "Low cuts used", 1,0,1, 1,0,1); |
945 | fLowCuts->SetXTitle("#eta"); | |
946 | fLowCuts->SetDirectory(0); | |
947 | d->Add(fLowCuts); | |
948 | ||
0082a8fc | 949 | TNamed* angle = new TNamed("angle", fCorrectAngles ? |
950 | "corrected" : "uncorrected"); | |
f7cfc454 | 951 | angle->SetUniqueID(fCorrectAngles); |
0082a8fc | 952 | TNamed* low = new TNamed("lowSignal", fZeroSharedHitsBelowThreshold ? |
953 | "zeroed" : "kept"); | |
f7cfc454 | 954 | low->SetUniqueID(fZeroSharedHitsBelowThreshold); |
0082a8fc | 955 | TNamed* simple = new TNamed("simple", fUseSimpleMerging ? "yes" : "no"); |
956 | simple->SetUniqueID(fUseSimpleMerging); | |
957 | ||
d2638bb7 | 958 | // d->Add(lowCut); |
959 | // d->Add(nXi); | |
960 | // d->Add(sigma); | |
f7cfc454 | 961 | d->Add(angle); |
962 | d->Add(low); | |
0082a8fc | 963 | d->Add(simple); |
d2638bb7 | 964 | fLCuts.Output(d,"lCuts"); |
965 | fHCuts.Output(d,"hCuts"); | |
5bb5d1f6 | 966 | |
7e4038b5 | 967 | TIter next(&fRingHistos); |
968 | RingHistos* o = 0; | |
969 | while ((o = static_cast<RingHistos*>(next()))) { | |
970 | o->Output(d); | |
971 | } | |
972 | } | |
0bd4b00f | 973 | //____________________________________________________________________ |
974 | void | |
975 | AliFMDSharingFilter::Print(Option_t* /*option*/) const | |
976 | { | |
7984e5f7 | 977 | // |
978 | // Print information | |
979 | // | |
980 | // Parameters: | |
981 | // option Not used | |
982 | // | |
0bd4b00f | 983 | char ind[gROOT->GetDirLevel()+1]; |
984 | for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' '; | |
985 | ind[gROOT->GetDirLevel()] = '\0'; | |
1f480471 | 986 | std::cout << ind << ClassName() << ": " << GetName() << '\n' |
5bb5d1f6 | 987 | << std::boolalpha |
988 | << ind << " Debug: " << fDebug << "\n" | |
f7cfc454 | 989 | << ind << " Use corrected angles: " << fCorrectAngles << '\n' |
990 | << ind << " Zero below threshold: " | |
7b212e49 | 991 | << fZeroSharedHitsBelowThreshold << '\n' |
992 | << ind << " Use simple sharing: " << fUseSimpleMerging << '\n' | |
5bb5d1f6 | 993 | << std::noboolalpha << std::endl; |
d2638bb7 | 994 | std::cout << ind << " Low cuts: " << std::endl; |
995 | fLCuts.Print(); | |
996 | std::cout << ind << " High cuts: " << std::endl; | |
997 | fHCuts.Print(); | |
0bd4b00f | 998 | } |
7e4038b5 | 999 | |
1000 | //==================================================================== | |
1001 | AliFMDSharingFilter::RingHistos::RingHistos() | |
9d99b0dd | 1002 | : AliForwardUtil::RingHistos(), |
7e4038b5 | 1003 | fBefore(0), |
1004 | fAfter(0), | |
f26a8959 | 1005 | fSingle(0), |
1006 | fDouble(0), | |
1007 | fTriple(0), | |
1008 | fSinglePerStrip(0), | |
7f1cfdfd | 1009 | fDistanceBefore(0), |
1010 | fDistanceAfter(0), | |
5bb5d1f6 | 1011 | fBeforeAfter(0), |
1012 | fNeighborsBefore(0), | |
1013 | fNeighborsAfter(0), | |
1014 | fSum(0), | |
7e4038b5 | 1015 | fHits(0), |
1016 | fNHits(0) | |
7984e5f7 | 1017 | { |
1018 | // | |
1019 | // Default CTOR | |
1020 | // | |
1021 | ||
1022 | } | |
7e4038b5 | 1023 | |
1024 | //____________________________________________________________________ | |
1025 | AliFMDSharingFilter::RingHistos::RingHistos(UShort_t d, Char_t r) | |
9d99b0dd | 1026 | : AliForwardUtil::RingHistos(d,r), |
7e4038b5 | 1027 | fBefore(0), |
1028 | fAfter(0), | |
f26a8959 | 1029 | fSingle(0), |
1030 | fDouble(0), | |
1031 | fTriple(0), | |
1032 | fSinglePerStrip(0), | |
7f1cfdfd | 1033 | fDistanceBefore(0), |
1034 | fDistanceAfter(0), | |
5bb5d1f6 | 1035 | fBeforeAfter(0), |
1036 | fNeighborsBefore(0), | |
1037 | fNeighborsAfter(0), | |
1038 | fSum(0), | |
7e4038b5 | 1039 | fHits(0), |
1040 | fNHits(0) | |
1041 | { | |
7984e5f7 | 1042 | // |
1043 | // Constructor | |
1044 | // | |
1045 | // Parameters: | |
1046 | // d detector | |
1047 | // r ring | |
1048 | // | |
9b2f2e39 | 1049 | fBefore = new TH1D("esdEloss", Form("Energy loss in %s (reconstruction)", |
1050 | GetName()), 600, 0, 15); | |
7e4038b5 | 1051 | fBefore->SetXTitle("#Delta E/#Delta E_{mip}"); |
1052 | fBefore->SetYTitle("P(#Delta E/#Delta E_{mip})"); | |
5bb5d1f6 | 1053 | fBefore->SetFillColor(Color()); |
7e4038b5 | 1054 | fBefore->SetFillStyle(3001); |
f7cfc454 | 1055 | fBefore->SetLineColor(kBlack); |
1056 | fBefore->SetLineStyle(2); | |
7e4038b5 | 1057 | fBefore->SetDirectory(0); |
5bb5d1f6 | 1058 | |
1059 | fAfter = static_cast<TH1D*>(fBefore->Clone("anaEloss")); | |
9b2f2e39 | 1060 | fAfter->SetTitle(Form("Energy loss in %s (sharing corrected)", GetName())); |
5bb5d1f6 | 1061 | fAfter->SetFillColor(Color()+2); |
f7cfc454 | 1062 | fAfter->SetLineStyle(1); |
7e4038b5 | 1063 | fAfter->SetDirectory(0); |
f26a8959 | 1064 | |
1065 | fSingle = new TH1D("singleEloss", "Energy loss (single strips)", | |
1066 | 600, 0, 15); | |
9b2f2e39 | 1067 | fSingle->SetXTitle("#Delta/#Delta_{mip}"); |
1068 | fSingle->SetYTitle("P(#Delta/#Delta_{mip})"); | |
1069 | fSingle->SetFillColor(Color()); | |
f26a8959 | 1070 | fSingle->SetFillStyle(3001); |
1071 | fSingle->SetLineColor(kBlack); | |
1072 | fSingle->SetLineStyle(2); | |
1073 | fSingle->SetDirectory(0); | |
1074 | ||
9b2f2e39 | 1075 | fDouble = static_cast<TH1D*>(fSingle->Clone("doubleEloss")); |
1076 | fDouble->SetTitle("Energy loss (two strips)"); | |
1077 | fDouble->SetFillColor(Color()+1); | |
f26a8959 | 1078 | fDouble->SetDirectory(0); |
9b2f2e39 | 1079 | |
1080 | fTriple = static_cast<TH1D*>(fSingle->Clone("tripleEloss")); | |
1081 | fTriple->SetTitle("Energy loss (three strips)"); | |
1082 | fTriple->SetFillColor(Color()+2); | |
f26a8959 | 1083 | fTriple->SetDirectory(0); |
1084 | ||
1085 | //Int_t nBinsForInner = (r == 'I' ? 32 : 16); | |
1086 | Int_t nBinsForInner = (r == 'I' ? 512 : 256); | |
1087 | Int_t nStrips = (r == 'I' ? 512 : 256); | |
1088 | ||
1089 | fSinglePerStrip = new TH2D("singlePerStrip", "SinglePerStrip", | |
1090 | 600,0,15, nBinsForInner,0,nStrips); | |
9b2f2e39 | 1091 | fSinglePerStrip->SetXTitle("#Delta/#Delta_{mip}"); |
1092 | fSinglePerStrip->SetYTitle("Strip #"); | |
f26a8959 | 1093 | fSinglePerStrip->SetZTitle("Counts"); |
1094 | fSinglePerStrip->SetDirectory(0); | |
7e4038b5 | 1095 | |
7f1cfdfd | 1096 | fDistanceBefore = new TH1D("distanceBefore", "Distance before sharing", |
9b2f2e39 | 1097 | nStrips , 0,nStrips ); |
7f1cfdfd | 1098 | fDistanceBefore->SetXTitle("Distance"); |
1099 | fDistanceBefore->SetYTitle("Counts"); | |
1100 | fDistanceBefore->SetFillColor(kGreen+2); | |
1101 | fDistanceBefore->SetFillStyle(3001); | |
1102 | fDistanceBefore->SetLineColor(kBlack); | |
1103 | fDistanceBefore->SetLineStyle(2); | |
1104 | fDistanceBefore->SetDirectory(0); | |
1105 | ||
9b2f2e39 | 1106 | fDistanceAfter = static_cast<TH1D*>(fDistanceBefore->Clone("distanceAfter")); |
1107 | fDistanceAfter->SetTitle("Distance after sharing"); | |
7f1cfdfd | 1108 | fDistanceAfter->SetFillColor(kGreen+1); |
7f1cfdfd | 1109 | fDistanceAfter->SetDirectory(0); |
1110 | ||
f26a8959 | 1111 | |
5bb5d1f6 | 1112 | Double_t max = 15; |
1113 | Double_t min = -1; | |
1114 | Int_t n = int((max-min) / (max / 300)); | |
1115 | fBeforeAfter = new TH2D("beforeAfter", "Before and after correlation", | |
1116 | n, min, max, n, min, max); | |
1117 | fBeforeAfter->SetXTitle("#Delta E/#Delta E_{mip} before"); | |
1118 | fBeforeAfter->SetYTitle("#Delta E/#Delta E_{mip} after"); | |
1119 | fBeforeAfter->SetZTitle("Correlation"); | |
1120 | fBeforeAfter->SetDirectory(0); | |
1121 | ||
1122 | fNeighborsBefore = static_cast<TH2D*>(fBeforeAfter->Clone("neighborsBefore")); | |
f7cfc454 | 1123 | fNeighborsBefore->SetTitle("Correlation of neighbors before"); |
5bb5d1f6 | 1124 | fNeighborsBefore->SetXTitle("#Delta E_{i}/#Delta E_{mip}"); |
1125 | fNeighborsBefore->SetYTitle("#Delta E_{i+1}/#Delta E_{mip}"); | |
1126 | fNeighborsBefore->SetDirectory(0); | |
1127 | ||
1128 | fNeighborsAfter = | |
1129 | static_cast<TH2D*>(fNeighborsBefore->Clone("neighborsAfter")); | |
1130 | fNeighborsAfter->SetTitle("Correlation of neighbors after"); | |
1131 | fNeighborsAfter->SetDirectory(0); | |
1132 | ||
1133 | fSum = new TH2D("summed", "Summed signal", 200, -4, 6, | |
1134 | (fRing == 'I' || fRing == 'i' ? 20 : 40), 0, 2*TMath::Pi()); | |
1135 | fSum->SetDirectory(0); | |
1136 | fSum->Sumw2(); | |
1137 | fSum->SetMarkerColor(Color()); | |
1138 | // fSum->SetFillColor(Color()); | |
1139 | fSum->SetXTitle("#eta"); | |
1140 | fSum->SetYTitle("#varphi [radians]"); | |
1141 | fSum->SetZTitle("#sum #Delta/#Delta_{mip}(#eta,#varphi) "); | |
1142 | ||
1143 | fHits = new TH1D("hits", "Number of hits", 200, 0, 200000); | |
7e4038b5 | 1144 | fHits->SetDirectory(0); |
1145 | fHits->SetXTitle("# of hits"); | |
1146 | fHits->SetFillColor(kGreen+1); | |
1147 | } | |
1148 | //____________________________________________________________________ | |
1149 | AliFMDSharingFilter::RingHistos::RingHistos(const RingHistos& o) | |
9d99b0dd | 1150 | : AliForwardUtil::RingHistos(o), |
7e4038b5 | 1151 | fBefore(o.fBefore), |
1152 | fAfter(o.fAfter), | |
f26a8959 | 1153 | fSingle(o.fSingle), |
1154 | fDouble(o.fDouble), | |
1155 | fTriple(o.fTriple), | |
1156 | fSinglePerStrip(o.fSinglePerStrip), | |
7f1cfdfd | 1157 | fDistanceBefore(o.fDistanceBefore), |
1158 | fDistanceAfter(o.fDistanceAfter), | |
5bb5d1f6 | 1159 | fBeforeAfter(o.fBeforeAfter), |
1160 | fNeighborsBefore(o.fNeighborsBefore), | |
1161 | fNeighborsAfter(o.fNeighborsAfter), | |
1162 | fSum(o.fSum), | |
7e4038b5 | 1163 | fHits(o.fHits), |
1164 | fNHits(o.fNHits) | |
7984e5f7 | 1165 | { |
1166 | // | |
1167 | // Copy constructor | |
1168 | // | |
1169 | // Parameters: | |
1170 | // o Object to copy from | |
1171 | // | |
1172 | } | |
7e4038b5 | 1173 | |
1174 | //____________________________________________________________________ | |
1175 | AliFMDSharingFilter::RingHistos& | |
1176 | AliFMDSharingFilter::RingHistos::operator=(const RingHistos& o) | |
1177 | { | |
7984e5f7 | 1178 | // |
1179 | // Assignment operator | |
1180 | // | |
1181 | // Parameters: | |
1182 | // o Object to assign from | |
1183 | // | |
1184 | // Return: | |
1185 | // Reference to this | |
1186 | // | |
d015ecfe | 1187 | if (&o == this) return *this; |
9d99b0dd | 1188 | AliForwardUtil::RingHistos::operator=(o); |
7e4038b5 | 1189 | fDet = o.fDet; |
1190 | fRing = o.fRing; | |
1191 | ||
1192 | if (fBefore) delete fBefore; | |
1193 | if (fAfter) delete fAfter; | |
f26a8959 | 1194 | if (fSingle) delete fSingle; |
1195 | if (fDouble) delete fDouble; | |
1196 | if (fTriple) delete fTriple; | |
1197 | if (fSinglePerStrip) delete fSinglePerStrip; | |
7f1cfdfd | 1198 | if (fDistanceBefore) delete fDistanceBefore; |
1199 | if (fDistanceAfter) delete fDistanceAfter; | |
7e4038b5 | 1200 | if (fHits) delete fHits; |
1201 | ||
f26a8959 | 1202 | |
5bb5d1f6 | 1203 | fBefore = static_cast<TH1D*>(o.fBefore->Clone()); |
1204 | fAfter = static_cast<TH1D*>(o.fAfter->Clone()); | |
f26a8959 | 1205 | fSingle = static_cast<TH1D*>(o.fSingle->Clone()); |
1206 | fDouble = static_cast<TH1D*>(o.fDouble->Clone()); | |
1207 | fTriple = static_cast<TH1D*>(o.fTriple->Clone()); | |
1208 | fSinglePerStrip = static_cast<TH2D*>(o.fSinglePerStrip->Clone()); | |
7f1cfdfd | 1209 | fDistanceBefore = static_cast<TH1D*>(o.fDistanceBefore->Clone()); |
1210 | fDistanceAfter = static_cast<TH1D*>(o.fDistanceAfter->Clone()); | |
5bb5d1f6 | 1211 | fBeforeAfter = static_cast<TH2D*>(o.fBeforeAfter->Clone()); |
1212 | fNeighborsBefore = static_cast<TH2D*>(o.fNeighborsBefore->Clone()); | |
1213 | fNeighborsAfter = static_cast<TH2D*>(o.fNeighborsAfter->Clone()); | |
1214 | fHits = static_cast<TH1D*>(o.fHits->Clone()); | |
1215 | fSum = static_cast<TH2D*>(o.fSum->Clone()); | |
1216 | ||
7e4038b5 | 1217 | return *this; |
1218 | } | |
1219 | //____________________________________________________________________ | |
1220 | AliFMDSharingFilter::RingHistos::~RingHistos() | |
1221 | { | |
7984e5f7 | 1222 | // |
1223 | // Destructor | |
1224 | // | |
7e4038b5 | 1225 | } |
1226 | //____________________________________________________________________ | |
1227 | void | |
1228 | AliFMDSharingFilter::RingHistos::Finish() | |
1229 | { | |
7984e5f7 | 1230 | // |
1231 | // Finish off | |
1232 | // | |
1233 | // | |
7e4038b5 | 1234 | fHits->Fill(fNHits); |
1235 | } | |
1236 | ||
9d99b0dd | 1237 | //____________________________________________________________________ |
1238 | void | |
fb3430ac | 1239 | AliFMDSharingFilter::RingHistos::ScaleHistograms(const TList* dir, |
1240 | Int_t nEvents) | |
9d99b0dd | 1241 | { |
7984e5f7 | 1242 | // |
1243 | // Scale the histograms to the total number of events | |
1244 | // | |
1245 | // Parameters: | |
1246 | // nEvents Number of events | |
1247 | // dir Where the output is | |
1248 | // | |
9d99b0dd | 1249 | TList* l = GetOutputList(dir); |
1250 | if (!l) return; | |
1251 | ||
f7cfc454 | 1252 | #if 0 |
1253 | TH1D* before = static_cast<TH1D*>(l->FindObject("esdEloss")); | |
1254 | TH1D* after = static_cast<TH1D*>(l->FindObject("anaEloss")); | |
9d99b0dd | 1255 | if (before) before->Scale(1./nEvents); |
1256 | if (after) after->Scale(1./nEvents); | |
f7cfc454 | 1257 | #endif |
1258 | ||
1259 | TH2D* summed = static_cast<TH2D*>(l->FindObject("summed")); | |
5bb5d1f6 | 1260 | if (summed) summed->Scale(1./nEvents); |
1261 | ||
9d99b0dd | 1262 | } |
1263 | ||
7e4038b5 | 1264 | //____________________________________________________________________ |
1265 | void | |
1266 | AliFMDSharingFilter::RingHistos::Output(TList* dir) | |
1267 | { | |
7984e5f7 | 1268 | // |
1269 | // Make output | |
1270 | // | |
1271 | // Parameters: | |
1272 | // dir where to store | |
1273 | // | |
9d99b0dd | 1274 | TList* d = DefineOutputList(dir); |
5bb5d1f6 | 1275 | |
7e4038b5 | 1276 | d->Add(fBefore); |
1277 | d->Add(fAfter); | |
f26a8959 | 1278 | d->Add(fSingle); |
1279 | d->Add(fDouble); | |
1280 | d->Add(fTriple); | |
1281 | d->Add(fSinglePerStrip); | |
7f1cfdfd | 1282 | d->Add(fDistanceBefore); |
1283 | d->Add(fDistanceAfter); | |
5bb5d1f6 | 1284 | d->Add(fBeforeAfter); |
1285 | d->Add(fNeighborsBefore); | |
1286 | d->Add(fNeighborsAfter); | |
7e4038b5 | 1287 | d->Add(fHits); |
5bb5d1f6 | 1288 | d->Add(fSum); |
1c8feb73 | 1289 | |
1290 | // Removed to avoid doubly adding the list which destroys | |
1291 | // the merging | |
1292 | //dir->Add(d); | |
7e4038b5 | 1293 | } |
1294 | ||
1295 | //____________________________________________________________________ | |
1296 | // | |
1297 | // EOF | |
1298 | // |