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