1 #ifndef ALIDIELECTRONSIGNALFUNC_H
2 #define ALIDIELECTRONSIGNALFUNC_H
4 /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 //#############################################################
9 //# Class AliDielectronSignalFunc #
12 //# Anton Andronic, GSI / A.Andronic@gsi.de #
13 //# Ionut C. Arsene, GSI / I.C.Arsene@gsi.de #
14 //# Julian Book, Uni Ffm / Julian.Book@cern.ch #
15 //# Frederick Kramer, Uni Ffm, / Frederick.Kramer@cern.ch #
16 //# Magnus Mager, CERN / Magnus.Mager@cern.ch #
17 //# WooJin J. Park, GSI / W.J.Park@gsi.de #
18 //# Jens Wiechula, Uni HD / Jens.Wiechula@cern.ch #
20 //#############################################################
23 Class used for extracting the signal from an invariant mass spectrum.
24 It implements the AliDielectronSignalBase class and it uses user provided
25 functions to fit the unlike-sign spectrum (and the like-sign one).
29 AliDielectronSignalFunc *signalProcess = new AliDielectronSignalFunc();
30 TObjArray *histoArray = new TObjArray();
31 histoArray->Add(signalPP); // add the spectrum histograms to the array
32 histoArray->Add(signalPM); // the order is important !!!
33 histoArray->Add(signalMM);
34 // set the extraction method
35 // AliDielectronSignalBase::kFitted --> fit only the unlike-sign spectrum and extract everything from that
36 // AliDielectronSignalBase::kLikeSign --> fit both the unlike- and like-sign spectra
37 // AliDielectronSignalBase::kEventMixing --> fit both the unlike- and like-sign spectra from event mixing
38 signalProcess->SetMethod(AliDielectronSignalBase::kLikeSign);
39 // Initialize the functions to be used and pass them to the signal object
40 // External preparation of the functions can(should) be done as this can be a 5 or more parameter fit
41 TF1* gaus = new TF1("gaus", "gaus", 0., 4.);
42 TF1* expo = new TF1("expo", "[0]*exp([1]*x)", 0., 4.);
43 TF1* combined = new TF1("combined", "gaus + [3]*exp([4]*x)", 0.,4.);
44 combined->SetParameter(1, 3.1);
45 combined->SetParameter(1, 0.1);
46 signalPP->Fit(expo, "SME", "", 2.4, 4.0);
47 signalPM->Fit(gaus, "SME", "", 3.0, 3.15);
49 gaus->GetParameters(&pars[0]);
50 expo->GetParameters(&pars[3]);
51 combined->SetParameters(pars);
52 combined->SetParLimits(1, 3.05, 3.15);
53 combined->SetParLimits(2, 0.03, 0.1);
54 signalProcess->SetFunctions(combined, gaus, expo, 1, 2);
56 signalProcess->SetFitRange(2.4,4.0);
57 // Use the integral of the fit function to estimate the signal or not
58 // The background will always be estimated from the fit
59 // signalProcess->SetUseIntegral(kTRUE);
60 signalProcess->SetFitOption("SME");
61 // Give the range where the signal is calculated
62 signalProcess->SetIntegralRange(3.0,3.15);
63 signalProcess->SetRebin(2);
64 signalProcess->Process(histoArray);
65 signalProcess->Draw("stat");
66 signalProcess->Print();
73 #include "AliDielectronSignalBase.h"
75 class AliDielectronSignalFunc : public AliDielectronSignalBase {
77 AliDielectronSignalFunc();
78 AliDielectronSignalFunc(const char*name, const char* title);
79 AliDielectronSignalFunc(const AliDielectronSignalFunc &c);
80 AliDielectronSignalFunc &operator=(const AliDielectronSignalFunc &c);
82 virtual ~AliDielectronSignalFunc();
84 virtual void Process(TObjArray * const arrhist);
85 void ProcessFit(TObjArray * const arrhist); // fit the SE +- distribution
86 void ProcessLS(TObjArray * const arrhist); // substract the fitted SE like-sign background
87 void ProcessEM(TObjArray * const arrhist); // substract the fitted SE+ME like-sign background
89 void SetMCSignalShape(TH1F* hist) { fgHistSimPM=hist; }
90 void SetUseIntegral(Bool_t flag=kTRUE) {fUseIntegral = flag;};
91 void SetFunctions(TF1 * const combined, TF1 * const sig=0, TF1 * const back=0, Int_t parM=1, Int_t parMres=2);
92 void CombineFunc(TF1 * const peak=0, TF1 * const bgnd=0);
93 void SetFitOption(const char* opt) {
96 if(!fFitOpt.Contains("s")) fFitOpt += "s";
98 void SetDefaults(Int_t type);
100 TF1* GetSignalFunction() const { return fFuncSignal; }
101 TF1* GetBackgroundFunction() const { return fFuncBackground; }
102 TF1* GetCombinedFunction() const { return fFuncSigBack; }
104 Int_t GetPolDeg() const { return fPolDeg; }
105 Int_t GetDof() const { return fDof; }
106 Double_t GetChi2Dof() const { return fChi2Dof; }
108 virtual void Draw(const Option_t* option = "");
113 static Double_t PeakFunMC(const Double_t *x, const Double_t *par); // peak function from a mc histo
114 static Double_t PeakFunCB(const Double_t *x, const Double_t *par); // crystal ball function
115 static Double_t PeakFunGaus(const Double_t *x, const Double_t *par); // gaussian
117 static Double_t PeakBgndFun(const Double_t *x, const Double_t *par); // combine any bgrd and any peak function
119 static TF1 *fFuncSignal; // Function for the signal description
120 static TF1 *fFuncBackground; // Function for the background description
121 TF1 *fFuncSigBack; // Combined function signal plus background
122 Int_t fParMass; // the index of the parameter corresponding to the resonance mass
123 Int_t fParMassWidth; // the index of the parameter corresponding to the resonance mass width
125 TString fFitOpt; // fit option used
126 Bool_t fUseIntegral; // use the integral of the fitted functions to extract signal and background
128 Int_t fPolDeg; // polynomial degree of the background function
129 Int_t fDof; // degrees of freedom
130 Double_t fChi2Dof; // chi2/dof of the fitted inv mass spectra
132 static Int_t fNparPeak; // number of parameters for peak function
133 static Int_t fNparBgnd; // number of parameters for background function
135 static TH1F* fgHistSimPM; // simulated peak shape
137 ClassDef(AliDielectronSignalFunc,2) // Dielectron SignalFunc