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