CbmRoot
PairAnalysisSignalExt.cxx
Go to the documentation of this file.
1 // Dielectron SignalExt //
3 // //
4 // //
5 /*
6 Ext class for signal extraction from a histogram or an array of histograms
7 The histogram is assumed to be an inv. mass spectrum,
8 the array of histograms is assumed to be an array with inv. mass histograms
9 resulting from single and mixed events, as defined in PairAnalysis.cxx
10 
11 */
12 // //
14 
15 
16 #include <TDatabasePDG.h>
17 #include <TF1.h>
18 #include <TH1.h>
19 #include <TList.h>
20 #include <TPaveText.h>
21 #include <TProfile.h>
22 #include <TProfile2D.h>
23 #include <TROOT.h>
24 #include <TVectorT.h>
25 
26 #include <TCollection.h>
27 #include <TF1.h>
28 //#include <TH1.h>
29 #include <TCanvas.h>
30 #include <TGaxis.h>
31 #include <TH2F.h>
32 #include <TLatex.h>
33 #include <TLegend.h>
34 #include <TLine.h>
35 #include <TMath.h>
36 #include <TString.h>
37 
38 #include "PairAnalysis.h"
39 #include "PairAnalysisHelper.h"
40 #include "PairAnalysisSignalMC.h"
41 #include "PairAnalysisStyler.h"
42 
43 #include "PairAnalysisFunction.h"
44 #include "PairAnalysisSignalExt.h"
45 
47 
51  {"S", "B", "S/#sqrt{S+B}", "S/B", "Mass", "MassWidth", "ChiSqNDFmatch"};
53  "FittedMC",
54  "Fitted",
55  "like-sign",
56  "like-sign (arithm.)",
57  "like-sign #times R(#Deltam)",
58  "like-sign (arithm.) #times R(#Deltam)",
59  "fitted like-sign",
60  "mixed event",
61  "fitted mixed event",
62  "track rotation",
63  "cocktail"};
64 
66  : PairAnalysisSignalExt("PairAnalysisSignalExt", "title") {
67  //
68  // Default Constructor
69  //
70 }
71 
72 //______________________________________________
74  const char* title)
75  : PairAnalysisFunction(name, title), fValues(7), fErrors(7) {
76  //
77  // Named Constructor
78  //
79 }
80 
81 //______________________________________________
83  : PairAnalysisFunction(c.GetName(), c.GetTitle())
84  , fArrHists(c.fArrHists)
85  , fArrCocktail(c.fArrCocktail)
86  , fHistSignal(c.GetSignalHistogram())
87  , fHistSB(c.GetSoverBHistogram())
88  , fHistSgn(c.GetSignificanceHistogram())
89  , fHistBackground(c.GetBackgroundHistogram())
90  , fHistCocktail(c.GetCocktailHistogram())
91  , fHistDataPM(c.GetUnlikeSignHistogram())
92  , fHistRfactor(c.GetRfactorHistogram())
93  , fHistSignalMC(c.GetMCSignalShape())
94  , fValues(c.GetValues())
95  , fErrors(c.GetErrors())
96  , fIntMin(c.GetIntegralMin())
97  , fIntMax(c.GetIntegralMax())
98  , fRebin(c.GetRebin())
99  ,
100  // fRebinStat(1.), //TODO
101  // fBinLimits(0x0), //TODO
102  fMethod(c.GetMethod())
103  , fScaleMin(c.GetScaleMin())
104  , fScaleMax(c.GetScaleMax())
105  , fScaleMin2(c.GetScaleMin2())
106  , fScaleMax2(c.GetScaleMax2())
107  , fScaleFactor(c.GetScaleFactor())
108  , fPeakMethod(c.GetExtractionMethod())
109 // fExtrFunc(0x0) //TODO: needed
110 {
111  //
112  // Copy Constructor
113  //
114 }
115 
116 //______________________________________________
118  //
119  // Default Destructor
120  //
121  // TODO: add new datamembers
122  if (fArrHists) delete fArrHists;
123  if (fArrCocktail) delete fArrCocktail;
124  if (fHistSignal) delete fHistSignal;
125  if (fHistSB) delete fHistSB;
126  if (fHistSgn) delete fHistSgn;
127  if (fHistBackground) delete fHistBackground;
128  if (fHistCocktail) delete fHistCocktail;
129  if (fHistDataPP) delete fHistDataPP;
130  if (fHistDataPM) delete fHistDataPM;
131  if (fHistDataMM) delete fHistDataMM;
132  if (fHistDataME) delete fHistDataME;
133  if (fHistRfactor) delete fHistRfactor;
134  if (fHistSignalMC) delete fHistSignalMC;
135  if (fExtrFunc) delete fExtrFunc;
136  if (fBinLimits) delete fBinLimits;
137 }
138 
139 //______________________________________________
140 TPaveText* PairAnalysisSignalExt::DrawStats(Double_t x1 /*=0.*/,
141  Double_t y1 /*=0.*/,
142  Double_t x2 /*=0.*/,
143  Double_t y2 /*=0.*/,
144  TString opt /*="pRnbsSmrc"*/) {
145  //
146  // Draw extracted values in a TPaveText
147  //
148  // with the corners x1,y2,x2,y2
149  // use option string to select information displayed:
150  // p := Particle name using fPOIpdg
151  // R := integration Range
152  // n := Number of signal counts
153  // b := Background
154  // s := signal-to-bgrd
155  // S := Significance
156  // m := mass position
157  // r := mass resolution (sigma or fwhm)
158  // c := matching Chi2/ndf
159  //
160  if (TMath::Abs(x1) < 1e-20 && TMath::Abs(x2) < 1e-20) {
161  x1 = .6;
162  x2 = .9;
163  y1 = .7;
164  y2 = .9;
165  }
166  if (y1 < 0.5)
167  y2 = y1 + 0.025 * opt.Length();
168  else
169  y1 = y2 - 0.025 * opt.Length();
170 
171  // particle of interest
172  // TParticlePDG *fPOI = TDatabasePDG::Instance()->GetParticle(fPOIpdg);
173 
174  TPaveText* t = new TPaveText(x1, y1, x2, y2, "brNDC");
175  t->SetFillColor(0);
176  t->SetFillStyle(kFEmpty);
177  t->SetBorderSize(0);
178  t->SetTextAlign(12);
179  if (opt.Contains("p"))
180  t->AddText(
181  Form("#bf{%s}", (fPOI ? fPOI->GetName() : "particle not found")));
182  if (opt.Contains("R"))
183  t->AddText(Form("%.2f < %s < %.2f GeV/c^{2}", fIntMin, "m_{inv}", fIntMax));
184  if (opt.Contains("n"))
185  t->AddText(
186  Form("%s: %.4g #pm %.4g", fgkValueNames[0], fValues(0), fErrors(0)));
187  if (opt.Contains("b"))
188  t->AddText(
189  Form("%s: %.4g #pm %.4g", fgkValueNames[1], fValues(1), fErrors(1)));
190  Int_t smallS2B = (fValues(3) < 0.1 ? 1 : 100);
191  if (opt.Contains("s"))
192  t->AddText(Form("%s: %.2f #pm %.2f%s",
193  fgkValueNames[3],
194  fValues(3) * 100 / smallS2B,
195  fErrors(3) * 100 / smallS2B,
196  smallS2B > 1 ? "" : "%"));
197  if (opt.Contains("S"))
198  t->AddText(
199  Form("%s: %.1f #pm %.1f", fgkValueNames[2], fValues(2), fErrors(2)));
200  if (opt.Contains("m") && fValues(4) > 0)
201  t->AddText(Form("Mass: %.2f #pm %.2f GeV/c^{2}", fValues(4), fErrors(4)));
202  if (opt.Contains("r") && fValues(5) > 0)
203  t->AddText(Form("Mass res.: %.1f #pm %.1f MeV/c^{2}",
204  1000 * fValues(5),
205  1000 * fErrors(5)));
206  if (opt.Contains("c") && fValues(6) > 0)
207  t->AddText(Form("Match chi2/ndf.: %.1f", fValues(6)));
208  t->Draw();
209 
210  return t;
211 }
212 
213 //______________________________________________
214 void PairAnalysisSignalExt::Print(Option_t* /*option*/) const {
215  //
216  // Print the statistics
217  //
218  printf("Signal : %.5g #pm %.5g (+-%.3g%%)\n",
219  fValues(0),
220  fErrors(0),
221  100 * fErrors(0) / fValues(0));
222  printf("Backgnd: %.5g #pm %.5g (+-%.3g%%)\n",
223  fValues(1),
224  fErrors(1),
225  100 * fErrors(1) / fValues(1));
226  printf("Signif : %.5g #pm %.5g (+-%.3g%%)\n",
227  fValues(2),
228  fErrors(2),
229  100 * fErrors(2) / fValues(2));
230  printf("SoB : %.5g #pm %.5g (+-%.3g%%)\n",
231  fValues(3),
232  fErrors(3),
233  100 * fErrors(3) / fValues(3));
234  if (fValues(4) > 0) printf("Mass: %.5g #pm %.5g\n", fValues(4), fErrors(4));
235  if (fValues(5) > 0)
236  printf("Mass res.: %.5g #pm %.5g\n", fValues(5), fErrors(5));
237  if (fValues(6) > 0) printf("Match chi2/ndf: %.5g \n", fValues(6));
238  printf("Scale : %.5g \n", fScaleFactor);
239  printf("Mass int.: %.5g - %.5g \n", fIntMin, fIntMax);
240 }
241 
242 //______________________________________________
244  TH1* histBackground,
245  Double_t intMin,
246  Double_t intMax) {
247  //
248  // scale histBackground to match the integral of histRaw in the interval intMin, intMax
249  //
250 
251  //protect using over and underflow bins in normalisation calculation
252  if (intMin < histRaw->GetXaxis()->GetXmin())
253  intMin = histRaw->GetXaxis()->GetXmin();
254  if (intMin < histBackground->GetXaxis()->GetXmin())
255  intMin = histBackground->GetXaxis()->GetXmin();
256 
257  if (intMax > histRaw->GetXaxis()->GetXmax())
258  intMax = histRaw->GetXaxis()->GetXmax()
259  - histRaw->GetBinWidth(histRaw->GetNbinsX()) / 2.;
260  if (intMax > histBackground->GetXaxis()->GetXmax())
261  intMax = histBackground->GetXaxis()->GetXmax()
262  - histBackground->GetBinWidth(histBackground->GetNbinsX()) / 2.;
263 
264  Double_t intRaw =
265  histRaw->Integral(histRaw->FindBin(intMin), histRaw->FindBin(intMax));
266  Double_t intBack = histBackground->Integral(histBackground->FindBin(intMin),
267  histBackground->FindBin(intMax));
268  fScaleFactor = intBack > 0 ? intRaw / intBack : 1.;
269  // scale
270  if (histBackground->GetDefaultSumw2()) histBackground->Sumw2();
271  histBackground->Scale(fScaleFactor);
272 
273  return fScaleFactor;
274 }
275 
276 //______________________________________________
278  TH1* histBackground,
279  Double_t intMin,
280  Double_t intMax,
281  Double_t intMin2,
282  Double_t intMax2) {
283  //
284  // scale histBackground to match the integral of "histRaw" in the interval "intMin", "intMax" and "intMin2", "intMax2"
285  //
286 
287  if (TMath::Abs(intMin2 - intMax2) < 0.00001)
288  return (ScaleHistograms(histRaw, histBackground, intMin, intMax));
289 
290  //protect using over and underflow bins in normalisation calculation
291  if (intMin < histRaw->GetXaxis()->GetXmin())
292  intMin = histRaw->GetXaxis()->GetXmin();
293  if (intMin < histBackground->GetXaxis()->GetXmin())
294  intMin = histBackground->GetXaxis()->GetXmin();
295 
296  if (intMax2 > histRaw->GetXaxis()->GetXmax())
297  intMax2 = histRaw->GetXaxis()->GetXmax()
298  - histRaw->GetBinWidth(histRaw->GetNbinsX()) / 2.;
299  if (intMax2 > histBackground->GetXaxis()->GetXmax())
300  intMax2 = histBackground->GetXaxis()->GetXmax()
301  - histBackground->GetBinWidth(histBackground->GetNbinsX()) / 2.;
302 
303  Double_t intRaw =
304  histRaw->Integral(histRaw->FindBin(intMin), histRaw->FindBin(intMax));
305  Double_t intBack = histBackground->Integral(histBackground->FindBin(intMin),
306  histBackground->FindBin(intMax));
307  intRaw +=
308  histRaw->Integral(histRaw->FindBin(intMin2), histRaw->FindBin(intMax2));
309  intBack += histBackground->Integral(histBackground->FindBin(intMin2),
310  histBackground->FindBin(intMax2));
311 
312  fScaleFactor = intBack > 0 ? intRaw / intBack : 1.;
313  // scale
314  if (histBackground->GetDefaultSumw2()) histBackground->Sumw2();
315  histBackground->Scale(fScaleFactor);
316 
317  return fScaleFactor;
318 }
319 
320 //______________________________________________
321 TH1* PairAnalysisSignalExt::MergeObjects(TH1* obj1, TH1* obj2, Double_t val) {
322  //
323  // function to merge all TH1 inherited objects
324  // (needed because TProfile::Add with negative 'val' does not what is needed)
325  // what about TProfile2D (inherits from TH2D) ?
326  //
327  if (!obj1) return obj2;
328  if (!obj2) return obj1;
329 
330  TString key = Form("%s_%s", obj1->GetName(), "Signal");
331  if (obj1->IsA() == TProfile2D::Class()
332  && obj2->IsA() == TProfile2D::Class()) {
333  if (val >= 0.) {
334  //summation
335  ((TProfile2D*) obj1)->Add(((TProfile2D*) obj2), val);
336  return (TH1*) obj1->Clone(key.Data()); //TOCHECK: clone needed??
337  } else
338  return 0x0;
339  } else if (obj1->IsA() == TProfile::Class()
340  && obj2->IsA() == TProfile::Class()) {
341  if (val >= 0.) {
342  //summation
343  ((TProfile*) obj1)->Add(((TProfile*) obj2), val);
344  return (TH1*) obj1->Clone(key.Data()); //TOCHECK: clone needed??
345  } else {
346  // ONLY 1D subtraction
347  TH1D* histSign = new TH1D(key.Data(),
348  "",
349  obj1->GetXaxis()->GetNbins(),
350  obj1->GetXaxis()->GetXmin(),
351  obj1->GetXaxis()->GetXmax());
352  if (histSign->GetDefaultSumw2()) histSign->Sumw2();
353  histSign->SetDirectory(0);
354 
355  for (Int_t i = 0; i <= obj1->GetNbinsX(); i++) {
356  histSign->SetBinContent(
357  i, obj1->GetBinContent(i) - obj2->GetBinContent(i));
358  histSign->SetBinError(
359  i,
360  TMath::Sqrt(obj1->GetBinError(i) * obj1->GetBinError(i)
361  - obj2->GetBinError(i) * obj2->GetBinError(i)));
362  }
363  return histSign;
364  }
365 
366  /*
367  TList listH;
368  TString listHargs;
369  listHargs.Form("((TCollection*)0x%lx)", (ULong_t)&listH);
370  Int_t error = 0;
371  listH.Add(obj2);
372  obj1->Execute("Merge", listHargs.Data(), &error);
373  */
374  } else { // Histograms
375  if (val < 0.) { // subtraction
376  TH1* histSign = (TH1*) obj1->Clone(key.Data());
377  histSign->Add(obj2, val);
378  return histSign;
379  } else { // merge
380  obj1->Add(obj2, val);
381  return obj1;
382  }
383  }
384 }
385 
386 //______________________________________________
387 TObject*
389  Bool_t replaceValErr,
390  TH1F* mcShape) {
391  //
392  // Describe the extracted peak by the selected "method" and overwrite signal etc if activated
393  //
394 
395  if (replaceValErr) fPeakMethod = method;
396  Double_t data = 0.;
397  Double_t mc = 0.;
398  Double_t massPOI = TDatabasePDG::Instance()->GetParticle(fPOIpdg)->Mass();
399  Double_t sigPOI = massPOI * 0.02;
400  Double_t nPOI = fHistSignal->GetBinContent(fHistSignal->FindBin(massPOI));
401  Double_t binWidth = fHistSignal->GetBinWidth(fHistSignal->FindBin(massPOI));
402  TF1* fit = 0x0;
403  Int_t fitResult = 0;
404  Int_t parMass = -1;
405  Int_t parSigma = -1;
407  //PairAnalysisSignalFit *fExtrFunc = new PairAnalysisSignalFit();
408  // PairAnalysisSignalFunc fct;// = 0;//new PairAnalysisSignalFunc();
409 
410  Info(
411  "DescribePeakShape", "Signal extraction method: %d", (Int_t) fPeakMethod);
412 
413  // do the scaling/fitting
414  switch (method) {
415  case kBinCounting: /*nothing needs to be done*/ break;
416 
417  case kMCScaledMax:
418  if (!mcShape) {
419  Error("DescribePeakShape", "No MC histogram passed. Returning.");
420  return 0x0;
421  }
422  data = fHistSignal->GetBinContent(fHistSignal->FindBin(massPOI));
423  mc = mcShape->GetBinContent(fHistSignal->FindBin(massPOI));
424  mcShape->Scale(data / mc);
425  break;
426 
427  case kMCScaledInt:
428  if (!mcShape) {
429  Error("DescribePeakShape", "No MC histogram passed. Returning.");
430  return 0x0;
431  }
432  if (mcShape->GetBinWidth(1) != fHistSignal->GetBinWidth(1))
433  printf(
434  " WARNING: MC and signal histogram have different bin widths. \n");
435  data = fHistSignal->Integral(fHistSignal->FindBin(fIntMin),
436  fHistSignal->FindBin(fIntMax));
437  mc =
438  mcShape->Integral(mcShape->FindBin(fIntMin), mcShape->FindBin(fIntMax));
439  mcShape->Scale(data / mc);
440  break;
441 
442  case kMCFitted:
443  if (!mcShape && !fgHistSimPM) {
444  printf(" ERROR: No MC histogram passed or set. Returning. \n");
445  return 0x0;
446  }
447  if (!fgHistSimPM) fgHistSimPM = mcShape;
448  if (fgHistSimPM->GetBinWidth(1) != fHistSignal->GetBinWidth(1))
449  fgHistSimPM->Rebin(fRebin);
450  // fit = new TF1("fitMC",PairAnalysisSignalFunc::PeakFunMC,fFitMin,fFitMax,1);
451  fit = new TF1(
453  fit->SetParNames("N");
454  fitResult = fHistSignal->Fit(fit, "RNI0Q");
455  break;
456 
457  case kCrystalBall:
458  fit = new TF1("Crystal Ball",
459  fExtrFunc,
461  fFitMin,
462  fFitMax,
463  5);
464  fit->SetParNames("alpha", "n", "meanx", "sigma", "N");
465  // fit->SetParameters(-.2,5.,gMjpsi,.06,20);
466  // fit->SetParameters(1.,3.6,gMjpsi,.08,700);
467  fit->SetParameters(0.4, 4.0, massPOI, sigPOI, 1.3 * nPOI);
468  fit->SetParLimits(0, 0.0, 1.);
469  fit->SetParLimits(1, 0.01, 10.);
470  fit->SetParLimits(2, massPOI - sigPOI, massPOI + sigPOI);
471  fit->SetParLimits(3, sigPOI / 5, 5 * sigPOI);
472  fit->SetParLimits(4, 0.2 * nPOI, 2.0 * nPOI);
473  parMass = 2;
474  parSigma = 3;
475  fitResult = fHistSignal->Fit(fit, "RNI0Q");
476  break;
477 
478  case kGaus:
479  fit = new TF1("Gaussisan",
480  fExtrFunc,
482  fFitMin,
483  fFitMax,
484  3);
485  //fit = new TF1("fitGaus","gaus",fFitMin,fFitMax);
486  fit->SetParNames("N", "meanx", "sigma");
487  fit->SetParameters(1.3 * nPOI, massPOI, sigPOI);
488  fit->SetParLimits(0, 0.2 * nPOI, 2.0 * nPOI);
489  fit->SetParLimits(1, massPOI - sigPOI, massPOI + sigPOI);
490  fit->SetParLimits(2, sigPOI / 5, 5 * sigPOI);
491  parMass = 1;
492  parSigma = 2;
493  // fit->Print("V");
494  fitResult = fHistSignal->Fit(fit, "RNI0");
495  break;
496 
497  case kUserFunc:
499  Fatal("DescribePeakShape", "Function class not added!");
500  return 0x0;
501  }
503  fitResult = fHistSignal->Fit(fit, "RNI0Q");
504  break;
505  }
506 
507  // warning in case of fit issues
508  if (fitResult != 0)
509  Warning("DescripePeakShape", "fit has error/issue (%d)", fitResult);
510 
511  // store chi2/ndf of the fit
512  if (fit)
513  fValues(6) = (fit->GetNDF() ? fit->GetChisquare() / fit->GetNDF() : -1.);
514 
515  // overwrite values and errors if requested
516  if (replaceValErr) {
517  switch (method) {
518  case kBinCounting:
519  fValues(0) =
520  fHistSignal->IntegralAndError(fHistSignal->FindBin(fIntMin),
521  fHistSignal->FindBin(fIntMax),
522  fErrors(0));
524  break;
525  case kMCScaledMax:
526  case kMCScaledInt:
527  fValues(0) = mcShape->IntegralAndError(
528  mcShape->FindBin(fIntMin), mcShape->FindBin(fIntMax), fErrors(0));
530  break;
531 
532  case kMCFitted:
533  case kCrystalBall:
534  case kGaus:
535  case kUserFunc:
536  fValues(0) = fit->Integral(fIntMin, fIntMax) / binWidth;
537  fErrors(0) = fit->IntegralError(fIntMin, fIntMax) / binWidth;
539  break;
540  }
541 
542  // set mass position and width
543  if (parMass >= 0) {
544  fValues(4) = fit->GetParameter(parMass);
545  fErrors(4) = fit->GetParError(parMass);
546  }
547  if (parSigma >= 0) {
548  fValues(5) = fit->GetParameter(parSigma);
549  fErrors(5) = fit->GetParError(parSigma);
550  } else {
551  // calculate FWHM
552  SetFWHM();
553  }
554  }
555 
556  // set the peak method obj
557  switch (method) {
558  case kBinCounting:
559  if (replaceValErr) fgPeakShape = (TH1F*) fHistSignal->Clone("BinCount");
560  // delete fExtrFunc;
561  return (TH1F*) fHistSignal->Clone("BinCountReturn");
562  break;
563  case kMCScaledMax:
564  case kMCScaledInt:
565  if (replaceValErr) fgPeakShape = mcShape;
566  // delete fExtrFunc;
567  return mcShape;
568  break;
569  case kMCFitted:
570  case kCrystalBall:
571  case kGaus:
572  if (fgHistSimPM)
573  fit->SetName(Form("mcShapeFunc-%s", fgHistSimPM->GetName()));
574  if (replaceValErr) fgPeakShape = fit;
575  // delete fExtrFunc;
576  fPeakIsTF1 = kTRUE;
577  return fit;
578  case kUserFunc:
579  fit->SetName(Form("UserFunc"));
580  if (replaceValErr) fgPeakShape = fit;
581  fit->Print();
582  fPeakIsTF1 = kTRUE;
583  break;
584  }
585 
586  // printf("true integration range: %f %f \n",
587  // fHistSignal->GetBinLowEdge(fHistSignal->FindBin(fIntMin)),
588  // fHistSignal->GetBinLowEdge(fHistSignal->FindBin(fIntMax))+fHistSignal->GetBinWidth(fHistSignal->FindBin(fIntMax)));
589  //delete fExtrFunc;
590  // if(fgPeakShape->IsA()==TF1::Class()) fPeakIsTF1=kTRUE;
591  if (replaceValErr && fgPeakShape->IsA() == TF1::Class()) fPeakIsTF1 = kTRUE;
592  return fgPeakShape;
593 }
594 
595 //______________________________________________
596 void PairAnalysisSignalExt::Process(TObjArray* const arrhist) {
597  //
598  // process signal subtraction
599  //
600  fArrHists = arrhist;
601  fArrHists->SetOwner(kFALSE);
602 
603  // calculate optimal binning if configured
604  if (fRebinStat < 1. && fBinLimits == 0x0) {
606  (TH1*) FindObject(arrhist, PairAnalysis::kSEPM), fRebinStat);
607  }
608 
609 
610  // clean up spectra
611  if (fProcessed && 0) { //TODO: not needed??
612  if (fHistDataPP) {
613  delete fHistDataPP;
614  fHistDataPP = 0x0;
615  }
616  if (fHistDataPM) {
617  delete fHistDataPM;
618  fHistDataPM = 0x0;
619  }
620  if (fHistDataMM) {
621  delete fHistDataMM;
622  fHistDataMM = 0x0;
623  }
624 
625  if (fHistDataME) {
626  delete fHistDataME;
627  fHistDataME = 0x0;
628  }
629  if (fHistRfactor) {
630  delete fHistRfactor;
631  fHistRfactor = 0x0;
632  }
633 
634  if (fHistMixPP) {
635  delete fHistMixPP;
636  fHistMixPP = 0x0;
637  }
638  if (fHistMixPM) {
639  delete fHistMixPM;
640  fHistMixPM = 0x0;
641  }
642  if (fHistMixMM) {
643  delete fHistMixMM;
644  fHistMixMM = 0x0;
645  }
646  if (fHistMixMP) {
647  delete fHistMixMP;
648  fHistMixMP = 0x0;
649  }
650 
651  if (fHistDataTR) {
652  delete fHistDataTR;
653  fHistDataTR = 0x0;
654  }
655 
656  if (fHistSignal) {
657  delete fHistSignal;
658  fHistSignal = 0x0;
659  }
660  if (fHistBackground) {
661  delete fHistBackground;
662  fHistBackground = 0x0;
663  }
664  if (fHistSB) {
665  delete fHistSB;
666  fHistSB = 0x0;
667  }
668  if (fHistSgn) {
669  delete fHistSgn;
670  fHistSgn = 0x0;
671  }
672  if (fHistCocktail) {
673  delete fHistCocktail;
674  fHistCocktail = 0x0;
675  }
676  }
677 
679  // SE ++
680  fHistDataPP = (TH1*) FindObject(arrhist, PairAnalysis::kSEPP);
681  if (fHistDataPP) {
682  if (fBinLimits) {
683  fHistDataPP = fHistDataPP->Rebin(
684  fBinLimits->GetSize() - 1, "histPP", fBinLimits->GetArray());
685  fHistDataPP->Scale(1., "width");
686  } else
687  fHistDataPP->Clone("histPP");
688  if (fHistDataPP->GetDefaultSumw2()) fHistDataPP->Sumw2();
689  fHistDataPP->SetDirectory(0);
690  if (fRebin > 1) fHistDataPP->Rebin(fRebin);
691  }
692  // SE +-
693  fHistDataPM = (TH1*) FindObject(arrhist, PairAnalysis::kSEPM);
694  if (fHistDataPM) {
695  if (fBinLimits) {
696  fHistDataPM = fHistDataPM->Rebin(
697  fBinLimits->GetSize() - 1, "histPM", fBinLimits->GetArray());
698  fHistDataPM->Scale(1., "width");
699  } else
700  fHistDataPM->Clone("histPM");
701  if (fHistDataPM->GetDefaultSumw2()) fHistDataPM->Sumw2();
702  fHistDataPM->SetDirectory(0);
703  if (fRebin > 1) fHistDataPM->Rebin(fRebin);
704  fHistDataPM->SetYTitle((fBinLimits ? "dN/dm" : "Counts"));
705  }
706  // SE --
707  fHistDataMM = (TH1*) FindObject(arrhist, PairAnalysis::kSEMM);
708  if (fHistDataMM) {
709  if (fBinLimits) {
710  fHistDataMM = fHistDataMM->Rebin(
711  fBinLimits->GetSize() - 1, "histMM", fBinLimits->GetArray());
712  fHistDataMM->Scale(1., "width");
713  } else
714  fHistDataMM->Clone("histMM");
715  if (fHistDataMM->GetDefaultSumw2()) fHistDataMM->Sumw2();
716  fHistDataMM->SetDirectory(0);
717  if (fRebin > 1) fHistDataMM->Rebin(fRebin);
718  }
719  // ME ++
720  fHistMixPP = (TH1*) FindObject(arrhist, PairAnalysis::kMEPP);
721  if (fHistMixPP) {
722  if (fBinLimits) {
723  fHistMixPP = fHistMixPP->Rebin(
724  fBinLimits->GetSize() - 1, "mixPP", fBinLimits->GetArray());
725  fHistMixPP->Scale(1., "width");
726  } else
727  fHistMixPP->Clone("mixPP");
728  if (fHistMixPP->GetDefaultSumw2()) fHistMixPP->Sumw2();
729  fHistMixPP->SetDirectory(0);
730  if (fRebin > 1) fHistMixPP->Rebin(fRebin);
731  }
732  // ME +-
733  fHistMixPM = (TH1*) FindObject(arrhist, PairAnalysis::kMEPM);
734  if (fHistMixPM) {
735  if (fBinLimits) {
736  fHistMixPM = fHistMixPM->Rebin(
737  fBinLimits->GetSize() - 1, "mixPM", fBinLimits->GetArray());
738  fHistMixPM->Scale(1., "width");
739  } else
740  fHistMixPM->Clone("mixPM");
741  if (fHistMixPM->GetDefaultSumw2()) fHistMixPM->Sumw2();
742  fHistMixPM->SetDirectory(0);
743  if (fRebin > 1) fHistMixPM->Rebin(fRebin);
744  }
745  // ME -+
746  fHistMixMP = (TH1*) FindObject(arrhist, PairAnalysis::kMEMP);
747  if (fHistMixMP) {
748  if (fBinLimits) {
749  fHistMixMP = fHistMixMP->Rebin(
750  fBinLimits->GetSize() - 1, "mixMP", fBinLimits->GetArray());
751  fHistMixMP->Scale(1., "width");
752  } else
753  fHistMixMP->Clone("mixMP");
754  if (fHistMixMP->GetDefaultSumw2()) fHistMixMP->Sumw2();
755  fHistMixMP->SetDirectory(0);
756  if (fRebin > 1) fHistMixMP->Rebin(fRebin);
757 
758  if (fHistMixPM) fHistMixMP->Add(fHistMixPM); // merge ME +- and -+
759  }
760  // ME --
761  fHistMixMM = (TH1*) FindObject(arrhist, PairAnalysis::kMEMM);
762  if (fHistMixMM) {
763  if (fBinLimits) {
764  fHistMixMM = fHistMixMM->Rebin(
765  fBinLimits->GetSize() - 1, "mixMM", fBinLimits->GetArray());
766  fHistMixMM->Scale(1., "width");
767  } else
768  fHistMixMM->Clone("mixMM");
769  if (fHistMixMM->GetDefaultSumw2()) fHistMixMM->Sumw2();
770  fHistMixMM->SetDirectory(0);
771  if (fRebin > 1) fHistMixMM->Rebin(fRebin);
772  }
773  // TR +-
774  fHistDataTR = (TH1*) FindObject(arrhist, PairAnalysis::kSEPMRot);
775  if (fHistDataTR) {
776  if (fBinLimits) {
777  fHistDataTR = fHistDataTR->Rebin(
778  fBinLimits->GetSize() - 1, "histTR", fBinLimits->GetArray());
779  fHistDataTR->Scale(1., "width");
780  } else
781  fHistDataTR->Clone("histTR");
782  if (fHistDataTR->GetDefaultSumw2()) fHistDataTR->Sumw2();
783  fHistDataTR->SetDirectory(0);
784  if (fRebin > 1) fHistDataTR->Rebin(fRebin);
785  }
786 
787  // init histograms for R-factor, subtracted signal, background
788  fHistSignal = new TH1D("HistSignal",
789  "Substracted signal",
790  fHistDataPM->GetXaxis()->GetNbins(),
791  fHistDataPM->GetXaxis()->GetXbins()->GetArray());
792  fHistSignal->SetXTitle(fHistDataPM->GetXaxis()->GetTitle());
793  fHistSignal->SetYTitle(fHistDataPM->GetYaxis()->GetTitle());
794  if (fHistSignal->GetDefaultSumw2()) fHistSignal->Sumw2();
795  fHistSignal->SetDirectory(0);
796  fHistBackground = new TH1D("HistBackground",
797  "Background contribution",
798  fHistDataPM->GetXaxis()->GetNbins(),
799  fHistDataPM->GetXaxis()->GetXbins()->GetArray());
800  if (fHistBackground->GetDefaultSumw2()) fHistBackground->Sumw2();
801  fHistBackground->SetDirectory(0);
802  fHistRfactor =
803  new TH1D("HistRfactor",
804  "Rfactor;;N^{mix}_{+-}/2#sqrt{N^{mix}_{++} N^{mix}_{--}}",
805  fHistDataPM->GetXaxis()->GetNbins(),
806  fHistDataPM->GetXaxis()->GetXbins()->GetArray());
807  if (fHistRfactor->GetDefaultSumw2()) fHistRfactor->Sumw2();
808  fHistRfactor->SetDirectory(0);
809 
810  // cocktail
811  if (fArrCocktail && fArrCocktail->GetEntriesFast()) {
812  // printf("rebin %d cocktail histograms\n",fArrCocktail->GetEntriesFast());
813  fHistCocktail = new TH1D("HistCocktail",
814  "Cocktail contribution",
815  fHistDataPM->GetXaxis()->GetNbins(),
816  fHistDataPM->GetXaxis()->GetXbins()->GetArray());
817  fHistCocktail->SetXTitle(fHistDataPM->GetXaxis()->GetTitle());
818  fHistCocktail->SetYTitle(fHistDataPM->GetYaxis()->GetTitle());
819  if (fHistCocktail->GetDefaultSumw2()) fHistCocktail->Sumw2();
820  fHistCocktail->SetDirectory(0);
821 
822  // loop over all ingredients
823  for (Int_t i = 0; i < fArrCocktail->GetEntriesFast(); i++) {
824  TH1* htmp = static_cast<TH1*>(fArrCocktail->UncheckedAt(i));
825  if (fBinLimits) {
826  htmp = htmp->Rebin(
827  fBinLimits->GetSize() - 1, htmp->GetTitle(), fBinLimits->GetArray());
828  if (htmp->GetDefaultSumw2()) htmp->Sumw2();
829  htmp->SetDirectory(0);
830  htmp->Scale(1., "width");
831  fArrCocktail->AddAt(htmp, i);
832  }
833  // else htmp->Clone("histTR");
834  // if(fHistDataTR->GetDefaultSumw2()) fHistDataTR->Sumw2();
835  // fHistDataTR->SetDirectory(0);
836  if (fRebin > 1) htmp->Rebin(fRebin);
837  fHistCocktail->Add(htmp, +1.);
838  }
839  }
840 
842  /*
843  for(Int_t i=0; i<arrhist->GetEntriesFast(); i++) {
844  TH1* htmp = static_cast<TH1*>(arrhist->UncheckedAt(i));
845  if( htmp->GetNbinsX()!=fHistSignal->GetNbinsX() ) {
846  TArrayD *limits = PairAnalysisHelper::MakeStatBinLimits( htmp , fRebinStat);
847  htmp = htmp->Rebin(limits->GetSize()-1,htmp->GetTitle(),limits->GetArray());
848  if(htmp->GetDefaultSumw2()) htmp->Sumw2();
849  htmp->SetDirectory(0);
850  htmp->Scale(1.,"width");
851  arrhist->AddAt(htmp,i);
852  }
853  }
854  */
855 
856  // process method
857  switch (fMethod) {
858  case kLikeSign:
859  case kLikeSignArithm:
860  case kLikeSignRcorr:
862  ProcessLS(); // process like-sign subtraction method
863  break;
864 
865  case kEventMixing:
866  ProcessEM(); // process event mixing method
867  break;
868 
869  case kRotation: ProcessTR(); break;
870 
871  case kCocktail:
872  fCocktailSubtr = kTRUE;
873  ProcessCocktail();
874  break;
875 
876  default:
877  Warning(
878  "Process",
879  "Subtraction method not supported. Please check SetMethod() function.");
880  }
881 
882 
883  // set S/B and Significance histos
884  if (!fPeakIsTF1)
885  fHistSB = (TH1*) fgPeakShape->Clone("histSB");
886  else {
887  fHistSB = (TH1*) fHistSignal->Clone("histSB");
888  fHistSB->Reset("CEIS");
889  fHistSB->Eval((TF1*) fgPeakShape);
890  }
891  fHistSB->Divide(fHistBackground);
892  fHistSB->SetYTitle("S/B");
893 
894  //significance
895  fHistSgn = (TH1*) fHistSignal->Clone("histSB");
896  fHistSgn->Reset("CEIS");
897  Double_t s = 0.;
898  Double_t b = 0.;
899  for (Int_t i = 1; i <= fHistSgn->GetNbinsX(); i++) {
900 
901  if (!fPeakIsTF1)
902  s = static_cast<TH1*>(fgPeakShape)->GetBinContent(i);
903  else
904  s = static_cast<TF1*>(fgPeakShape)->Eval(fHistSgn->GetBinCenter(i));
905  b = fHistBackground->GetBinContent(i);
906 
907  if (s + b < 1.e-6) continue;
908  fHistSgn->SetBinContent(i, s / TMath::Sqrt(s + b));
909  }
910  fHistSgn->SetYTitle("S/#sqrt{S+B}");
911  // fErrors(2) = ((s+b)>0 ? fValues(2)*TMath::Sqrt(be*be + TMath::Power(se*(s+2*b)/s, 2)) / 2 / (s+b) : 0);
912 }
913 
914 //______________________________________________
916  //
917  // signal subtraction suing the like-sign method
918  //
919 
923 
924  // protections
925  if (!fHistDataPP || !fHistDataMM) return;
926 
927  // fill background histogram
928  for (Int_t ibin = 1; ibin <= fHistDataPM->GetXaxis()->GetNbins(); ibin++) {
929  Float_t pp = fHistDataPP->GetBinContent(ibin);
930  Float_t ppe = fHistDataPP->GetBinError(ibin);
931  Float_t mm = fHistDataMM->GetBinContent(ibin);
932  Float_t mme = fHistDataMM->GetBinError(ibin);
933 
934  Float_t background = 2 * TMath::Sqrt(pp * mm);
935  // Float_t ebackground = TMath::Sqrt(mm+pp); // do not use it since LS could be weighted err!=sqrt(entries)
936  Float_t ebackground =
937  TMath::Sqrt(mm / pp * ppe * ppe + pp / mm * mme * mme);
938  // Arithmetic mean instead of geometric
940  background = (pp + mm);
941  // ebackground=TMath::Sqrt(pp+mm);
942  ebackground = TMath::Sqrt(ppe * ppe + mme * mme);
943  if (TMath::Abs(ebackground) < 1e-30) ebackground = 1;
944  }
945  // set contents
946  fHistBackground->SetBinContent(ibin, background);
947  fHistBackground->SetBinError(ibin, ebackground);
948  }
949 
950  //correct LS spectrum bin-by-bin with R factor obtained in mixed events
953 
954  // protections
955  if (!fHistMixPM || fHistMixPP || !fHistMixMM) return;
956 
957  // fill R-factor histogram
958  for (Int_t ibin = 1; ibin <= fHistMixPM->GetXaxis()->GetNbins(); ibin++) {
959  Float_t pp = fHistMixPP->GetBinContent(ibin);
960  Float_t ppe = fHistMixPP->GetBinError(ibin);
961  Float_t mm = fHistMixMM->GetBinContent(ibin);
962  Float_t mme = fHistMixMM->GetBinError(ibin);
963  Float_t pm = fHistMixPM->GetBinContent(ibin);
964  Float_t pme = fHistMixPM->GetBinError(ibin);
965 
966  Float_t background = 2 * TMath::Sqrt(pp * mm);
967  // do not use it since ME could be weighted err!=sqrt(entries)
968  // Float_t ebackground = TMath::Sqrt(mm+pp);
969  Float_t ebackground =
970  TMath::Sqrt(mm / pp * ppe * ppe + pp / mm * mme * mme);
971  //Arithmetic mean instead of geometric
972  if (fMethod == kLikeSignArithm) {
973  background = (pp + mm);
974  ebackground = TMath::Sqrt(ppe * ppe + mme * mme);
975  if (TMath::Abs(ebackground) < 1e-30) ebackground = 1;
976  }
977 
978  Float_t rcon = 1.0;
979  Float_t rerr = 0.0;
980  if (background > 0.0) {
981  rcon = pm / background;
982  rerr = TMath::Sqrt((1. / background) * (1. / background) * pme * pme
983  + (pm / (background * background))
984  * (pm / (background * background)) * ebackground
985  * ebackground);
986  }
987  fHistRfactor->SetBinContent(ibin, rcon);
988  fHistRfactor->SetBinError(ibin, rerr);
989  }
990  // correction
991  fHistBackground->Multiply(fHistRfactor);
992  }
993 
994  //scale histograms to match integral between fScaleMin and fScaleMax
995  // or if fScaleMax < fScaleMin use fScaleMin as scale factor
996  ScaleBackground();
997 
998  //subtract background
999  fHistSignal->Add(fHistDataPM);
1000  fHistSignal->Add(fHistBackground, -1);
1001 
1002  //subtract cocktail (if added)
1003  if (fCocktailSubtr) fHistSignal->Add(fHistCocktail, -1);
1004 
1005  // background
1006  fValues(1) =
1007  fHistBackground->IntegralAndError(fHistBackground->FindBin(fIntMin),
1008  fHistBackground->FindBin(fIntMax),
1009  fErrors(1));
1010 
1011  // signal depending on peak description method
1013  //printf("%f %f\n",fValues(0),fValues(1));
1014  // SetSignificanceAndSOB();
1015 
1016  fProcessed = kTRUE;
1017 }
1018 
1019 //______________________________________________
1021  //
1022  // signal subtraction using event mixing (+-,-+) method
1023  //
1024 
1025  if (!fHistMixMP) {
1026  Error("ProcessEM", "Mixed event histogram missing");
1027  return;
1028  }
1029 
1030 
1031  // fill background histogram
1032  for (Int_t ibin = 1; ibin <= fHistDataPM->GetXaxis()->GetNbins(); ibin++) {
1033  Float_t pm = fHistMixMP->GetBinContent(ibin);
1034  Float_t pme = fHistMixMP->GetBinError(ibin);
1035 
1036  Float_t background = pm;
1037  Float_t ebackground = TMath::Sqrt(pme * pme);
1038  //TODO: Float_t ebackground = TMath::Power(pm, 3./4);
1039 
1040  // set contents
1041  fHistBackground->SetBinContent(ibin, background);
1042  fHistBackground->SetBinError(ibin, ebackground);
1043  }
1044 
1045  //scale histograms to match integral between fScaleMin and fScaleMax
1046  // or if fScaleMax < fScaleMin use fScaleMin as scale factor
1047  ScaleBackground();
1048 
1049  //subtract background
1050  fHistSignal->Add(fHistDataPM);
1051  fHistSignal->Add(fHistBackground, -1);
1052  // fHistSignal = MergeObjects(fHistDataPM,fHistBackground,-1.);
1053 
1054  //subtract cocktail (if added)
1055  if (fCocktailSubtr) fHistSignal->Add(fHistCocktail, -1);
1056 
1057  // background
1058  fValues(1) =
1059  fHistBackground->IntegralAndError(fHistBackground->FindBin(fIntMin),
1060  fHistBackground->FindBin(fIntMax),
1061  fErrors(1));
1062 
1063  // signal depending on peak description method
1065 
1066  fProcessed = kTRUE;
1067 }
1068 
1069 //______________________________________________
1071  //
1072  // signal subtraction using the track-rotation method
1073  //
1074 
1075  if (!fHistDataTR) {
1076  Error("ProcessTR", "Track rotation histogram missing");
1077  return;
1078  }
1079 
1080  // fill background histogram
1081  for (Int_t ibin = 1; ibin <= fHistDataPM->GetXaxis()->GetNbins(); ibin++) {
1082  Float_t pm = fHistDataTR->GetBinContent(ibin);
1083  Float_t pme = fHistDataTR->GetBinError(ibin);
1084 
1085  Float_t background = pm;
1086  Float_t ebackground = TMath::Sqrt(pme * pme);
1087 
1088  // set contents
1089  fHistBackground->SetBinContent(ibin, background);
1090  fHistBackground->SetBinError(ibin, ebackground);
1091  }
1092 
1093  // scale according to number of interations used in track rotation
1094  fHistBackground->Scale(1. / fNiterTR);
1095 
1096  //scale histograms to match integral between fScaleMin and fScaleMax
1097  // or if fScaleMax < fScaleMin use fScaleMin as scale factor
1098  ScaleBackground();
1099 
1100  //subtract background
1101  fHistSignal->Add(fHistDataPM);
1102  fHistSignal->Add(fHistBackground, -1);
1103 
1104  //subtract cocktail (if added)
1105  if (fCocktailSubtr) fHistSignal->Add(fHistCocktail, -1);
1106 
1107  // background
1108  fValues(1) =
1109  fHistBackground->IntegralAndError(fHistBackground->FindBin(fIntMin),
1110  fHistBackground->FindBin(fIntMax),
1111  fErrors(1));
1112 
1113  // signal depending on peak description method
1115 
1116  fProcessed = kTRUE;
1117 }
1118 
1119 //______________________________________________
1121  //
1122  // signal subtraction using the cocktail method
1123  //
1124 
1125  if (!fArrCocktail) {
1126  Error("ProcessCocktail", "Cocktail histograms missing");
1127  return;
1128  }
1129 
1130  // fill background histogram
1132 
1133  //scale histograms to match integral between fScaleMin and fScaleMax
1134  // or if fScaleMax < fScaleMin use fScaleMin as scale factor
1135  ScaleBackground();
1136 
1137  //subtract background
1138  fHistSignal->Add(fHistDataPM);
1139  fHistSignal->Add(fHistBackground, -1);
1140 
1141  // background
1142  fValues(1) =
1143  fHistBackground->IntegralAndError(fHistBackground->FindBin(fIntMin),
1144  fHistBackground->FindBin(fIntMax),
1145  fErrors(1));
1146 
1147  // signal depending on peak description method
1149 
1150  fProcessed = kTRUE;
1151 }
1152 
1153 //______________________________________________
1154 void PairAnalysisSignalExt::Draw(const Option_t* option) {
1177 
1178  Info("Draw",
1179  "Signal extraction results for '%s'",
1181  TString optString(option);
1182  optString.ToLower();
1183  printf("Plot extraction: bgrd. estimator: '%s' \t options: '%s' \n",
1185  optString.Data());
1186  Bool_t optTask = optString.Contains("same");
1187  optString.ReplaceAll("same", "");
1188  Bool_t optLegFull = optString.Contains("legf");
1189  optString.ReplaceAll("legf", "");
1190  Bool_t optLeg = optString.Contains("leg");
1191  optString.ReplaceAll("leg", "");
1192  Bool_t optCan = optString.Contains("can");
1193  optString.ReplaceAll("can", "");
1194  Bool_t optLine = optString.Contains("line");
1195  optString.ReplaceAll("line", "");
1196  Bool_t optStat = optString.Contains("stat");
1197  optString.ReplaceAll("stat", "");
1198  Bool_t optSSB = optString.Contains("ssb");
1199  optString.ReplaceAll("ssb", "");
1200  Bool_t optSB = optString.Contains("sb");
1201  optString.ReplaceAll("sb", "");
1202  Bool_t optSgn = optString.Contains("sgn");
1203  optString.ReplaceAll("sgn", "");
1204  Bool_t optOnlyRaw = optString.Contains("onlyraw");
1205  optString.ReplaceAll("onlyraw", "");
1206  Bool_t optOnlySig = optString.Contains("onlysig");
1207  optString.ReplaceAll("onlysig", "");
1208  Bool_t optNoSig = optString.Contains("nosig");
1209  optString.ReplaceAll("nosig", "");
1210  Bool_t optNoBgrd = optString.Contains("nobgrd");
1211  optString.ReplaceAll("nobgrd", "");
1212  Bool_t optOnlyMC = optString.Contains("onlymc");
1213  optString.ReplaceAll("onlymc", "");
1214  Bool_t optNoMC = optString.Contains("nomc");
1215  optString.ReplaceAll("nomc", "");
1216  Bool_t optCocktail = optString.Contains("cocktail");
1217  optString.ReplaceAll("cocktail", "");
1218  optString.ReplaceAll(" ", "");
1219 
1222 
1224  if (optLegFull) optLeg = kTRUE;
1225 
1227  TCanvas* c = 0;
1228  if (optCan) {
1229  TString key =
1230  Form("cSignalExtraction%s",
1231  (optSB ? "SB" : (optSgn ? "SGN" : (optSSB ? "SSB" : ""))));
1232  c = (TCanvas*) gROOT->FindObject(key.Data());
1233  if (!c) c = new TCanvas(key.Data(), key.Data());
1234  // c->Clear();
1235  c->cd();
1236  }
1237 
1238  Int_t nobj = 0;
1239  TObject* obj;
1241  TList* prim = gPad->GetListOfPrimitives();
1242  for (Int_t io = 0; io < prim->GetSize(); io++) {
1243  obj = prim->At(io);
1244  if (obj->InheritsFrom(TH1::Class()) && obj != prim->At(io + 1)) nobj++;
1245  }
1246 
1247  // add or get legend
1248  TLegend* leg = 0;
1249  if ((optLeg && optTask && !nobj) || (optLeg && !optTask)) {
1250  leg = new TLegend(.75,
1251  .3,
1252  1. - gPad->GetTopMargin() - gStyle->GetTickLength("X"),
1253  1. - gPad->GetRightMargin() - gStyle->GetTickLength("Y"),
1254  fArrHists->GetName(),
1255  "nbNDC");
1256  if (optTask) leg->SetHeader("");
1257  } else if (optLeg && nobj) {
1258  leg = (TLegend*) prim->FindObject("TPave");
1259  }
1260 
1261  // logaritmic style
1262  gPad->SetLogx(optString.Contains("logx"));
1263  gPad->SetLogy(optString.Contains("logy"));
1264  gPad->SetLogz(optString.Contains("logz"));
1265  optString.ReplaceAll("logx", "");
1266  optString.ReplaceAll("logy", "");
1267  optString.ReplaceAll("logz", "");
1268 
1270  if (optString.Contains("e2") || optString.Contains("e3")
1271  || optString.Contains("e4")) {
1272  // printf("set x-error style \n");
1273  gStyle->SetErrorX(0.5);
1274  // PairAnalysisStyler::SetForceFillStyle(1);
1275  }
1276 
1277  Int_t i = nobj; // TODO: obsolete?
1278  Info("Draw", "this is object number: %d", nobj);
1279 
1280 
1281  TString ytitle = fHistDataPM->GetYaxis()->GetTitle();
1282  // add bin width to y-axis title
1283  if (!(fHistDataPM->GetXaxis()->IsVariableBinSize())) {
1284  ytitle += Form("/%.0f MeV/#it{c}^{2}", fHistDataPM->GetBinWidth(1) * 1e3);
1285  }
1286  fHistDataPM->GetYaxis()->SetTitle(ytitle.Data());
1287  fHistSignal->GetYaxis()->SetTitle(ytitle.Data());
1288 
1289  // styling
1290  fHistDataPM->SetNameTitle(Form("unlike-sign%s", GetName()), "unlike-sign");
1291  fHistDataPM->UseCurrentStyle();
1293  if (fPlotMin != fPlotMax) fHistDataPM->SetAxisRange(fPlotMin, fPlotMax, "X");
1294 
1297  fHistBackground->UseCurrentStyle();
1299 
1300  fHistSignal->SetNameTitle(Form("signal%s", GetName()), "signal");
1301  fHistSignal->UseCurrentStyle();
1303  if (fPlotMin != fPlotMax) fHistSignal->SetAxisRange(fPlotMin, fPlotMax, "X");
1304 
1305  if (fHistCocktail) {
1306  fHistCocktail->SetNameTitle(Form("cocktail%s", GetName()), "cocktail");
1307  fHistCocktail->UseCurrentStyle();
1309  if (fPlotMin != fPlotMax)
1310  fHistCocktail->SetAxisRange(fPlotMin, fPlotMax, "X");
1311  }
1312 
1313  if (optSB) {
1314  fHistSB->SetNameTitle(Form("s2b%s", GetName()), "signal");
1315  fHistSB->UseCurrentStyle();
1317  if (fPlotMin != fPlotMax) fHistSB->SetAxisRange(fPlotMin, fPlotMax, "X");
1318  } else if (optSgn) {
1319  fHistSgn->SetNameTitle(Form("sgn%s", GetName()), "signal");
1320  fHistSgn->UseCurrentStyle();
1322  if (fPlotMin != fPlotMax) fHistSgn->SetAxisRange(fPlotMin, fPlotMax, "X");
1323  }
1324 
1325  // fHistRfactor->UseCurrentStyle();
1326  // fHistRfactor->SetTitle("");
1328 
1329  fgPeakShape->UseCurrentStyle();
1330  // fgPeakShape->SetTitle("");
1332 
1333  // draw stuff
1334  if (c) c->cd(1);
1335  Info("Draw", "Start plotting stuff with option -%s-", optString.Data());
1336  TString drawOpt = (optString.IsNull() ? "EP" : optString);
1337  // draw spectra
1338  if (!optOnlyMC) {
1339 
1340  if (optSB && !optOnlyRaw && !optNoSig) {
1341  fHistSB->Draw(i > 0 ? (drawOpt + "same").Data() : drawOpt.Data());
1342  i++;
1343  } else if (optSgn && !optOnlyRaw && !optNoSig) {
1344  fHistSgn->Draw(i > 0 ? (drawOpt + "same").Data() : drawOpt.Data());
1345  i++;
1346  } else if (optOnlySig) {
1347  drawOpt = (optString.IsNull() ? "EP0" : optString);
1348  fHistSignal->DrawCopy(i > 0 ? (drawOpt + "same").Data() : drawOpt.Data());
1349  i++;
1350  drawOpt = (optString.IsNull() ? "L same" : optString + "same");
1351  if (fPeakIsTF1) {
1352  static_cast<TF1*>(fgPeakShape)->DrawCopy(drawOpt.Data());
1353  i++;
1354  }
1355  } else if (!optSB && !optSgn) {
1356  fHistDataPM->DrawCopy(i > 0 ? (drawOpt + "same").Data() : drawOpt.Data());
1357  i++;
1358  if (fMethod == kRotation || fMethod == kEventMixing
1359  || fMethod == kCocktail)
1360  drawOpt = (optString.IsNull() ? "HIST" : optString);
1361  if (!optNoBgrd) {
1362  fHistBackground->DrawCopy(i > 0 ? (drawOpt + "same").Data()
1363  : drawOpt.Data());
1364  i++;
1365  }
1366  if (!optOnlyRaw && !optNoSig) {
1367  drawOpt = (optString.IsNull() ? "EP0" : optString);
1368  fHistSignal->DrawCopy(i > 0 ? (drawOpt + "same").Data()
1369  : drawOpt.Data());
1370  i++;
1371  drawOpt = (optString.IsNull() ? "L same" : optString + "same");
1372  if (fPeakIsTF1) {
1373  static_cast<TF1*>(fgPeakShape)->DrawCopy(drawOpt.Data());
1374  i++;
1375  }
1376  }
1377  }
1378  // add cocktail
1379  if (optCocktail && fHistCocktail) {
1380  drawOpt = (optString.IsNull() ? "HIST" : optString);
1381  if (optSSB) {
1382  fHistCocktail->Divide(fHistDataPM);
1383  fHistCocktail->SetYTitle(Form("S/(S+B)"));
1384  }
1385  if (optSB) {
1386  fHistCocktail->Divide(fHistBackground);
1387  fHistCocktail->SetYTitle(Form("%s", GetValueName(3)));
1388  }
1389  if (optSgn) {
1391  }
1392  fHistCocktail->DrawCopy(i > 0 ? (drawOpt + "same").Data()
1393  : drawOpt.Data());
1394  i++; //TODO: needed?
1395  // fHistCocktail->DrawCopy((drawOpt+"same").Data()); i++;
1396  }
1397  }
1398 
1399  // draw MC signals
1400  if (!optNoMC) {
1401  if (!optSgn) {
1402  TIter nextObj(fArrHists);
1403  TH1* hmc;
1404  Int_t isty = 0;
1405  while ((hmc = dynamic_cast<TH1*>(nextObj()))) {
1406  TString key = hmc->GetTitle(); //hmc->GetName();
1407  TString tit = hmc->GetTitle();
1408  if (key.CountChar('_') != 1) continue; // only reconstr. MC signals
1409  // remove cocktail subtracted signals
1410  if (optOnlySig && fCocktailSubtr
1412  continue;
1413  else if (optOnlySig && !fCocktailSubtr && fArrCocktail
1414  && !FindObjectByTitle(fArrCocktail, key))
1415  continue;
1416  else if (optCocktail && FindObjectByTitle(fArrCocktail, key))
1417  continue;
1418  PairAnalysisStyler::Style(hmc, isty++);
1419  // check if rebinning is necessary
1420  if (1 && fHistSignal->GetNbinsX() != hmc->GetNbinsX()) {
1421  if (fBinLimits) {
1422  hmc = hmc->Rebin(
1423  fBinLimits->GetSize() - 1, key.Data(), fBinLimits->GetArray());
1424  hmc->SetTitle(tit.Data());
1425  hmc->Scale(1., "width");
1426  }
1427  if (fRebin > 1) hmc->Rebin(fRebin);
1428  }
1429  if (optSSB) {
1430  hmc->Divide(fHistDataPM);
1431  hmc->SetYTitle(Form("S/(S+B)"));
1432  }
1433  if (optSB) {
1434  hmc->Divide(fHistBackground);
1435  hmc->SetYTitle(Form("%s", GetValueName(3)));
1436  }
1437  if (fPlotMin != fPlotMax) hmc->SetAxisRange(fPlotMin, fPlotMax, "X");
1438  hmc->Draw(i > 0 ? "HISTsame" : "HIST");
1439  i++;
1440  }
1441  }
1442  }
1443 
1445  Double_t max = -1e10;
1446  Double_t min = +1e10;
1447  //TListIter nextObj(gPad->GetListOfPrimitives(),kIterForward);
1448  TListIter nextObj(gPad->GetListOfPrimitives(), kIterBackward);
1449  // TObject *obj;
1450  while ((obj = nextObj())) {
1451  if (obj->InheritsFrom(TH1::Class())) {
1452  TH1* hobj = static_cast<TH1*>(obj);
1453  max = TMath::Max(
1454  max,
1455  PairAnalysisHelper::GetContentMaximum(hobj)); //hobj->GetMaximum();
1456  Double_t tmpmax = max * (gPad->GetLogy() ? 5. : 1.1);
1457  hobj->SetMaximum(tmpmax);
1458 
1459  Double_t objmin = PairAnalysisHelper::GetContentMinimum(hobj, kTRUE);
1460  if (gPad->GetLogy() && objmin < 0.) objmin = 0.5;
1461  min = TMath::Min(min, objmin);
1462  Double_t tmpmin = min * (min < 0. ? 1.1 : 0.9);
1463  hobj->SetMinimum(tmpmin);
1464 
1465  // Printf("after %s max%f \t min%f \t for logy %.3e >? %.3e",
1466  // hobj->GetTitle(),tmpmax,tmpmin, tmpmax/(tmpmin>0.?tmpmin:1.),TMath::Power(10.,TGaxis::GetMaxDigits()));
1467  // automatically set log option
1468  if (gPad->GetLogy()
1469  && (tmpmax / (tmpmin > 0. ? tmpmin : 1.)
1470  > TMath::Power(10., TGaxis::GetMaxDigits())
1471  || tmpmin < TMath::Power(10., -TGaxis::GetMaxDigits()))) {
1472  hobj->GetYaxis()->SetMoreLogLabels(kFALSE);
1473  hobj->GetYaxis()->SetNoExponent(kFALSE);
1474  }
1475  // if(gPad->GetLogy()) break;
1476  }
1477  }
1478 
1479  // add legend entries
1480  TListIter nextObjFwd(gPad->GetListOfPrimitives(), kIterForward);
1481  if (optLeg && leg) {
1482  nextObjFwd.Reset();
1483  Int_t ileg = 0;
1484  while ((obj = nextObjFwd())) {
1485  if (obj->InheritsFrom(TH1::Class()) || obj->InheritsFrom(TF1::Class())) {
1486  // TH1 *hleg = static_cast<TH1*>(obj);
1487  if (nobj && ileg < nobj) {
1488  ileg++;
1489  continue;
1490  }
1491 
1492  TString histClass = obj->GetTitle(); //hleg->GetName();
1493  if (histClass.IsNull()) histClass = obj->GetName();
1494  histClass.ReplaceAll("Pair.", "");
1495  histClass.ReplaceAll("Pair_", "");
1496  // change default signal names to titles
1497  for (Int_t isig = 0; isig < PairAnalysisSignalMC::kNSignals; isig++) {
1498  histClass.ReplaceAll(PairAnalysisSignalMC::fgkSignals[isig][0],
1500  }
1501  // remove trailing and leading spaces
1502  histClass.Remove(TString::kBoth, ' ');
1503  // histClass.Remove(TString::kBoth,'.');
1504  // histClass.Remove(TString::kBoth,'_');
1505 
1506  // modify legend option
1507  TString legOpt = obj->GetDrawOption();
1508  legOpt.ToLower();
1509  legOpt += "l";
1510  legOpt.ReplaceAll("hist", "");
1511  legOpt.ReplaceAll("same", "");
1512  legOpt.ReplaceAll("scat", "");
1513  legOpt.ReplaceAll("col", "");
1514  legOpt.ReplaceAll("z", "");
1515  legOpt.ReplaceAll("text", "");
1516  legOpt.ReplaceAll("e", "");
1517  // Printf("hist %s legopt %s",histClass.Data(),legOpt.Data());
1518  if (ileg == nobj && optTask)
1519  leg->AddEntry((TObject*) 0x0, fArrHists->GetName(), "");
1520  leg->AddEntry(obj, histClass.Data(), legOpt.Data());
1521  ileg++;
1522  }
1523  }
1524  }
1525 
1528  if (leg) {
1529  PairAnalysisStyler::SetLegendAttributes(leg, optLegFull);
1530  if (!nobj) leg->Draw(); // was w/o !nobj
1531  }
1532 
1533  // baseline
1534  TLine* line = new TLine();
1535  line->SetLineColor(kBlack);
1536  line->SetLineStyle(kDashed);
1537  if (optLine) line->DrawLine(fPlotMin, 0., fPlotMax, 0.);
1538 
1539  // draw statistics box
1540  if (optStat)
1541  DrawStats(0.7,
1542  gPad->GetBottomMargin() + gStyle->GetTickLength("Y"),
1543  1. - gPad->GetRightMargin() - gStyle->GetTickLength("X"),
1544  gPad->GetBottomMargin() + gStyle->GetTickLength("Y") + 5 * 0.025);
1545 
1546 
1547  // styling
1548  // gPad->RedrawAxis();
1549 }
1550 
1552  //
1553  // scale histograms according to method and integral limits
1554  //
1555 
1556  TH1* scalingRef;
1557  // scalingRef->Sumw2();
1558  switch (fSclMethod) {
1559  case kSclToRaw: scalingRef = fHistDataPM; break;
1560  case kSclToLikeSign:
1561  scalingRef = (TH1*) fHistDataPP->Clone();
1562  scalingRef->Add(fHistDataMM);
1563  break; //arithmetic mean
1564  default: scalingRef = nullptr; break;
1565  }
1567  fScaleFactor = ScaleHistograms(scalingRef,
1569  fScaleMin,
1570  fScaleMax,
1571  fScaleMin2,
1572  fScaleMax2);
1573  else if (fScaleMax > fScaleMin)
1574  fScaleFactor =
1576  else if (fScaleMin > 0.) {
1578  fHistBackground->Scale(fScaleFactor);
1579  }
1580 
1581  // clean up
1582  if (fSclMethod == kSclToLikeSign && scalingRef) delete scalingRef;
1583 }
PairAnalysis::kMEMP
@ kMEMP
Definition: PairAnalysis.h:31
PairAnalysisSignalExt::fHistDataTR
TH1 * fHistDataTR
Definition: PairAnalysisSignalExt.h:230
PairAnalysisSignalExt::ProcessLS
void ProcessLS()
Definition: PairAnalysisSignalExt.cxx:915
PairAnalysisSignalExt::fIntMax
Double_t fIntMax
Definition: PairAnalysisSignalExt.h:236
PairAnalysisSignalExt::kLikeSignRcorr
@ kLikeSignRcorr
Definition: PairAnalysisSignalExt.h:33
PairAnalysisSignalExt::PairAnalysisSignalExt
PairAnalysisSignalExt()
Definition: PairAnalysisSignalExt.cxx:65
PairAnalysisSignalExt::fPlotMin
Double_t fPlotMin
Definition: PairAnalysisSignalExt.h:237
PairAnalysisSignalExt::SetFWHM
void SetFWHM()
Definition: PairAnalysisSignalExt.h:341
PairAnalysisSignalExt::fPlotMax
Double_t fPlotMax
Definition: PairAnalysisSignalExt.h:238
PairAnalysisFunction
Definition: PairAnalysisFunction.h:22
PairAnalysisSignalExt::fCocktailSubtr
Bool_t fCocktailSubtr
Definition: PairAnalysisSignalExt.h:256
PairAnalysisStyler::SetLegendAttributes
void SetLegendAttributes(TLegend *leg, Bool_t fill=kFALSE)
Definition: PairAnalysisStyler.cxx:466
PairAnalysisSignalExt::Print
void Print(Option_t *option="") const
Definition: PairAnalysisSignalExt.cxx:214
PairAnalysisSignalExt::GetValueName
static const char * GetValueName(Int_t i)
Definition: PairAnalysisSignalExt.h:140
PairAnalysisSignalExt::fErrors
TVectorD fErrors
Definition: PairAnalysisSignalExt.h:233
PairAnalysisSignalExt::fMixingCorr
Bool_t fMixingCorr
Definition: PairAnalysisSignalExt.h:254
PairAnalysisSignalExt::fgkBackgroundMethodNames
static const char * fgkBackgroundMethodNames[11]
Definition: PairAnalysisSignalExt.h:274
PairAnalysisSignalExt::fArrCocktail
TObjArray * fArrCocktail
Definition: PairAnalysisSignalExt.h:211
PairAnalysisSignalExt::fHistDataME
TH1 * fHistDataME
Definition: PairAnalysisSignalExt.h:221
PairAnalysis::kSEPP
@ kSEPP
Definition: PairAnalysis.h:27
PairAnalysisStyler::kFit
@ kFit
Definition: PairAnalysisStyler.h:25
PairAnalysisHelper.h
PairAnalysisSignalExt
Definition: PairAnalysisSignalExt.h:25
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
PairAnalysisSignalExt::kRotation
@ kRotation
Definition: PairAnalysisSignalExt.h:38
PairAnalysisSignalExt::fHistDataPP
TH1 * fHistDataPP
Definition: PairAnalysisSignalExt.h:219
PairAnalysisStyler::kRaw
@ kRaw
Definition: PairAnalysisStyler.h:25
PairAnalysisSignalExt::ProcessCocktail
void ProcessCocktail()
Definition: PairAnalysisSignalExt.cxx:1120
PairAnalysis::kMEPM
@ kMEPM
Definition: PairAnalysis.h:32
PairAnalysisSignalExt::fScaleMin
Double_t fScaleMin
Definition: PairAnalysisSignalExt.h:247
PairAnalysisSignalExt::ProcessTR
void ProcessTR()
Definition: PairAnalysisSignalExt.cxx:1070
PairAnalysisSignalExt::kUserFunc
@ kUserFunc
Definition: PairAnalysisSignalExt.h:49
PairAnalysisSignalExt::fHistMixMP
TH1 * fHistMixMP
Definition: PairAnalysisSignalExt.h:229
PairAnalysisSignalExt::fHistDataPM
TH1 * fHistDataPM
Definition: PairAnalysisSignalExt.h:218
PairAnalysisHelper::MakeStatBinLimits
TArrayD * MakeStatBinLimits(TH1 *h, Double_t stat)
Definition: PairAnalysisHelper.cxx:203
PairAnalysisFunction::fFitMax
Double_t fFitMax
Definition: PairAnalysisFunction.h:107
PairAnalysisSignalExt::fMethod
EBackgroundMethod fMethod
Definition: PairAnalysisSignalExt.h:245
PairAnalysisSignalExt::fBinLimits
TArrayD * fBinLimits
Definition: PairAnalysisSignalExt.h:242
PairAnalysisFunction::fPOIpdg
Int_t fPOIpdg
Definition: PairAnalysisFunction.h:110
PairAnalysisSignalExt::FindObjectByTitle
TObject * FindObjectByTitle(TObjArray *arrhist, TString ref)
Definition: PairAnalysisSignalExt.h:298
PairAnalysisSignalExt::kCocktail
@ kCocktail
Definition: PairAnalysisSignalExt.h:39
PairAnalysisSignalExt::kLikeSign
@ kLikeSign
Definition: PairAnalysisSignalExt.h:31
PairAnalysisSignalExt::fHistMixPP
TH1 * fHistMixPP
Definition: PairAnalysisSignalExt.h:227
PairAnalysisSignalExt::fHistSignal
TH1 * fHistSignal
Definition: PairAnalysisSignalExt.h:212
PairAnalysisFunction::fFitMin
Double_t fFitMin
Definition: PairAnalysisFunction.h:106
min
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:33
PairAnalysisSignalExt::fArrHists
TObjArray * fArrHists
Definition: PairAnalysisSignalExt.h:210
PairAnalysisSignalExt::fExtrFunc
PairAnalysisFunction * fExtrFunc
Definition: PairAnalysisSignalExt.h:258
PairAnalysisFunction::PairAnalysisFunction
PairAnalysisFunction()
PairAnalysisSignalExt::kMCScaledMax
@ kMCScaledMax
Definition: PairAnalysisSignalExt.h:44
PairAnalysisSignalExt::fScaleMax2
Double_t fScaleMax2
Definition: PairAnalysisSignalExt.h:250
PairAnalysisSignalExt.h
PairAnalysisFunction.h
PairAnalysis.h
PairAnalysisSignalExt::kEventMixing
@ kEventMixing
Definition: PairAnalysisSignalExt.h:36
PairAnalysisSignalExt::fHistDataMM
TH1 * fHistDataMM
Definition: PairAnalysisSignalExt.h:220
PairAnalysisFunction::PeakFunGauss
Double_t PeakFunGauss(const Double_t *x, const Double_t *par)
Definition: PairAnalysisFunction.cxx:202
PairAnalysisSignalExt::fRebin
Int_t fRebin
Definition: PairAnalysisSignalExt.h:240
PairAnalysisSignalExt::fProcessed
Bool_t fProcessed
Definition: PairAnalysisSignalExt.h:265
PairAnalysisSignalExt::fIntMin
Double_t fIntMin
Definition: PairAnalysisSignalExt.h:235
PairAnalysisSignalExt::fgkValueNames
static const char * fgkValueNames[7]
Definition: PairAnalysisSignalExt.h:272
PairAnalysisSignalExt::FillSignificance
void FillSignificance(TH1 *hfill, TObject *signal, TH1 *hbgrd)
Definition: PairAnalysisSignalExt.h:386
PairAnalysis::kSEMM
@ kSEMM
Definition: PairAnalysis.h:29
PairAnalysisSignalExt::DescribePeakShape
TObject * DescribePeakShape(ESignalExtractionMethod method=kMCFitted, Bool_t replaceValErr=kFALSE, TH1F *mcShape=0x0)
Definition: PairAnalysisSignalExt.cxx:388
PairAnalysisSignalExt::ScaleHistograms
Double_t ScaleHistograms(TH1 *histRaw, TH1 *histBackground, Double_t intMin, Double_t intMax)
Definition: PairAnalysisSignalExt.cxx:243
PairAnalysisSignalExt::Draw
void Draw(const Option_t *option="")
Definition: PairAnalysisSignalExt.cxx:1154
PairAnalysisSignalExt::fNiterTR
Int_t fNiterTR
Definition: PairAnalysisSignalExt.h:251
PairAnalysisSignalMC::kNSignals
@ kNSignals
Definition: PairAnalysisSignalMC.h:57
PairAnalysisSignalExt::fValues
TVectorD fValues
Definition: PairAnalysisSignalExt.h:232
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
PairAnalysisSignalExt::Process
void Process(TObjArray *const arrhist)
Definition: PairAnalysisSignalExt.cxx:596
PairAnalysisSignalExt::fHistMixMM
TH1 * fHistMixMM
Definition: PairAnalysisSignalExt.h:228
PairAnalysis::kSEPM
@ kSEPM
Definition: PairAnalysis.h:28
PairAnalysisSignalExt::fHistSgn
TH1 * fHistSgn
Definition: PairAnalysisSignalExt.h:214
PairAnalysisSignalExt::FindObject
TObject * FindObject(TObjArray *arrhist, PairAnalysis::EPairType type) const
Definition: PairAnalysisSignalExt.h:283
PairAnalysisSignalExt::ESignalExtractionMethod
ESignalExtractionMethod
Definition: PairAnalysisSignalExt.h:42
PairAnalysis::kMEMM
@ kMEMM
Definition: PairAnalysis.h:33
PairAnalysisFunction::fPOI
TParticlePDG * fPOI
Definition: PairAnalysisFunction.h:109
PairAnalysisSignalExt::kSclToRaw
@ kSclToRaw
Definition: PairAnalysisSignalExt.h:52
PairAnalysisStyler::LoadStyle
void LoadStyle()
Definition: PairAnalysisStyler.cxx:49
PairAnalysisSignalExt::kGaus
@ kGaus
Definition: PairAnalysisSignalExt.h:48
PairAnalysisStyler.h
PairAnalysisSignalExt::kCrystalBall
@ kCrystalBall
Definition: PairAnalysisSignalExt.h:47
PairAnalysisSignalExt::fHistMixPM
TH1 * fHistMixPM
Definition: PairAnalysisSignalExt.h:226
PairAnalysisSignalExt::fSclMethod
EScalingMethod fSclMethod
Definition: PairAnalysisSignalExt.h:246
PairAnalysisSignalExt::fHistRfactor
TH1 * fHistRfactor
Definition: PairAnalysisSignalExt.h:223
PairAnalysisSignalExt::ProcessEM
void ProcessEM()
Definition: PairAnalysisSignalExt.cxx:1020
PairAnalysisSignalExt::ScaleBackground
void ScaleBackground()
Definition: PairAnalysisSignalExt.cxx:1551
PairAnalysisSignalExt::kLikeSignArithmRcorr
@ kLikeSignArithmRcorr
Definition: PairAnalysisSignalExt.h:34
PairAnalysisSignalExt::fHistSignalMC
TH1 * fHistSignalMC
Definition: PairAnalysisSignalExt.h:224
PairAnalysisStyler::kSig
@ kSig
Definition: PairAnalysisStyler.h:25
PairAnalysisFunction::PeakFunMC
Double_t PeakFunMC(const Double_t *x, const Double_t *par)
Definition: PairAnalysisFunction.cxx:99
PairAnalysisSignalExt::fScaleFactor
Double_t fScaleFactor
Definition: PairAnalysisSignalExt.h:253
PairAnalysisFunction::GetCombinedFunction
TF1 * GetCombinedFunction() const
Definition: PairAnalysisFunction.h:83
PairAnalysisSignalExt::fRebinStat
Double_t fRebinStat
Definition: PairAnalysisSignalExt.h:241
PairAnalysisSignalExt::kMCFitted
@ kMCFitted
Definition: PairAnalysisSignalExt.h:46
PairAnalysis::kMEPP
@ kMEPP
Definition: PairAnalysis.h:30
PairAnalysisSignalExt::kSclToLikeSign
@ kSclToLikeSign
Definition: PairAnalysisSignalExt.h:52
PairAnalysisSignalExt::kLikeSignArithm
@ kLikeSignArithm
Definition: PairAnalysisSignalExt.h:32
PairAnalysisSignalExt::fPeakMethod
ESignalExtractionMethod fPeakMethod
Definition: PairAnalysisSignalExt.h:259
PairAnalysisStyler::kBgrd
@ kBgrd
Definition: PairAnalysisStyler.h:25
PairAnalysisSignalExt::MergeObjects
static TH1 * MergeObjects(TH1 *obj1, TH1 *obj2, Double_t val=+1.)
Definition: PairAnalysisSignalExt.cxx:321
PairAnalysisSignalExt::fHistSB
TH1 * fHistSB
Definition: PairAnalysisSignalExt.h:213
PairAnalysisSignalExt::fHistBackground
TH1 * fHistBackground
Definition: PairAnalysisSignalExt.h:215
PairAnalysisSignalMC.h
PairAnalysisSignalExt::SetSignificanceAndSOB
void SetSignificanceAndSOB()
Definition: PairAnalysisSignalExt.h:314
PairAnalysis::kSEPMRot
@ kSEPMRot
Definition: PairAnalysis.h:34
PairAnalysisSignalExt::fgPeakShape
static TObject * fgPeakShape
Definition: PairAnalysisSignalExt.h:262
PairAnalysisStyler::Style
void Style(TObject *obj, Int_t idx=0)
Definition: PairAnalysisStyler.cxx:262
PairAnalysisSignalExt::fHistCocktail
TH1 * fHistCocktail
Definition: PairAnalysisSignalExt.h:217
PairAnalysisSignalExt::fScaleMax
Double_t fScaleMax
Definition: PairAnalysisSignalExt.h:248
PairAnalysisSignalExt::kMCScaledInt
@ kMCScaledInt
Definition: PairAnalysisSignalExt.h:45
max
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:36
PairAnalysisSignalExt::kBinCounting
@ kBinCounting
Definition: PairAnalysisSignalExt.h:43
PairAnalysisHelper::GetContentMaximum
Double_t GetContentMaximum(TH1 *h, Bool_t inclErr=kTRUE)
Definition: PairAnalysisHelper.cxx:513
PairAnalysisFunction::PeakFunCB
Double_t PeakFunCB(const Double_t *x, const Double_t *par)
Definition: PairAnalysisFunction.cxx:121
PairAnalysisSignalExt::DrawStats
TPaveText * DrawStats(Double_t x1=0., Double_t y1=0., Double_t x2=0., Double_t y2=0., TString opt="pRnbsSmrc")
Definition: PairAnalysisSignalExt.cxx:140
PairAnalysisHelper::GetContentMinimum
Double_t GetContentMinimum(TH1 *h, Bool_t inclErr=kTRUE)
Definition: PairAnalysisHelper.cxx:480
PairAnalysisSignalExt::~PairAnalysisSignalExt
~PairAnalysisSignalExt()
Definition: PairAnalysisSignalExt.cxx:117
PairAnalysisSignalMC::fgkSignals
static const char * fgkSignals[kNSignals][2]
Definition: PairAnalysisSignalMC.h:207
PairAnalysisSignalExt::fgHistSimPM
static TH1F * fgHistSimPM
Definition: PairAnalysisSignalExt.h:266
PairAnalysisSignalExt::fScaleMin2
Double_t fScaleMin2
Definition: PairAnalysisSignalExt.h:249
PairAnalysisStyler::kCocktail
@ kCocktail
Definition: PairAnalysisStyler.h:25
PairAnalysisSignalExt::fPeakIsTF1
Bool_t fPeakIsTF1
Definition: PairAnalysisSignalExt.h:263