]>
Commit | Line | Data |
---|---|---|
572b0139 | 1 | #ifndef ALIDIELECTRONSIGNALBASE_H |
2 | #define ALIDIELECTRONSIGNALBASE_H | |
3 | ||
4 | /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | //############################################################# | |
8 | //# # | |
9 | //# Class AliDielectronSignalBase # | |
10 | //# Manage Cuts on the legs of the pair # | |
11 | //# # | |
12 | //# Authors: # | |
13 | //# Anton Andronic, GSI / A.Andronic@gsi.de # | |
14 | //# Ionut C. Arsene, GSI / I.C.Arsene@gsi.de # | |
15 | //# Julian Book, Uni Ffm / Julian.Book@cern.ch # | |
16 | //# Frederick Kramer, Uni Ffm, / Frederick.Kramer@cern.ch # | |
17 | //# Magnus Mager, CERN / Magnus.Mager@cern.ch # | |
18 | //# WooJin J. Park, GSI / W.J.Park@gsi.de # | |
19 | //# Jens Wiechula, Uni HD / Jens.Wiechula@cern.ch # | |
20 | //# # | |
21 | //############################################################# | |
22 | ||
23 | #include <TNamed.h> | |
24 | #include <TVectorT.h> | |
25 | #include <TMath.h> | |
26 | ||
27 | class TObjArray; | |
28 | class TPaveText; | |
29 | class TH1; | |
30 | ||
31 | class AliDielectronSignalBase : public TNamed { | |
32 | public: | |
33 | AliDielectronSignalBase(); | |
34 | AliDielectronSignalBase(const char*name, const char* title); | |
35 | ||
36 | virtual ~AliDielectronSignalBase(); | |
37 | ||
38 | ||
39 | void SetIntegralRange(Double_t min, Double_t max) {fIntMin=min;fIntMax=max;} | |
40 | ||
41 | void SetSignal(Double_t val, Double_t valErr) {fValues(0)=val; fErrors(0)=valErr;} | |
42 | void SetBackground(Double_t val, Double_t valErr) {fValues(1)=val; fErrors(1)=valErr;} | |
43 | void SetSignificance(Double_t val, Double_t valErr) {fValues(2)=val; fErrors(2)=valErr;} | |
44 | void SetSignalOverBackground(Double_t val, Double_t valErr) {fValues(3)=val; fErrors(3)=valErr;} | |
8df8e382 | 45 | void SetMass(Double_t val, Double_t valErr) {fValues(4)=val; fErrors(4)=valErr;} |
46 | void SetMassWidth(Double_t val, Double_t valErr) {fValues(5)=val; fErrors(5)=valErr;} | |
47 | ||
572b0139 | 48 | const TVectorD& GetValues() const {return fValues;} |
49 | const TVectorD& GetErrors() const {return fErrors;} | |
50 | ||
51 | Double_t GetIntegralMin() const { return fIntMin; } | |
52 | Double_t GetIntegralMax() const { return fIntMax; } | |
53 | ||
9143d69f | 54 | Double_t GetSignal() const {return fValues(0);} |
55 | Double_t GetBackground() const {return fValues(1);} | |
56 | Double_t GetSignificance() const {return fValues(2);} | |
57 | Double_t GetSignalOverBackground() const {return fValues(3);} | |
58 | Double_t GetMass() const {return fValues(4);} | |
59 | Double_t GetMassWidth() const {return fValues(5);} | |
572b0139 | 60 | |
9143d69f | 61 | Double_t GetSignalError() const {return fErrors(0);} |
62 | Double_t GetBackgroundError() const {return fErrors(1);} | |
63 | Double_t GetSignificanceError() const {return fErrors(2);} | |
64 | Double_t GetSignalOverBackgroundError() const {return fErrors(3);} | |
65 | Double_t GetMassError() const {return fErrors(4);} | |
66 | Double_t GetMassWidthError() const {return fValues(5);} | |
572b0139 | 67 | |
68 | void GetSignal(Double_t &val, Double_t &valErr) {val=fValues(0); valErr=fErrors(0);} | |
69 | void GetBackground(Double_t &val, Double_t &valErr) {val=fValues(1); valErr=fErrors(1);} | |
70 | void GetSignificance(Double_t &val, Double_t &valErr) {val=fValues(2); valErr=fErrors(2);} | |
71 | void GetSignalOverBackground(Double_t &val, Double_t &valErr) {val=fValues(3); valErr=fErrors(3);} | |
72 | ||
73 | /** | |
74 | This function needs to be implemented by the signal extraction classes. | |
75 | ||
76 | The signal extraction is done on the mass spectra. | |
77 | The TObjArray should contain the Inv. Mass spectra of the 10 possible combinations | |
78 | for single and mixed events defined in AliDielectron.cxx | |
79 | In the referece TVectorDs the values and value errors of the result should be stored: | |
80 | Parameter - 0: Signal entries | |
81 | 1: Background entries | |
82 | 2: Significance ( S/sqr(S+B) ) | |
83 | 3: Signal/Background | |
8df8e382 | 84 | 4: Mass |
85 | 5: Mass width | |
572b0139 | 86 | |
87 | It is enough to calculate the signal and background and then call | |
88 | SetSignificanceAndSOB(TVectorD &values, TVectorD &errors) | |
89 | Please also read the description there!!! | |
90 | */ | |
91 | virtual void Process(TObjArray * const /*arrhist*/) = 0; | |
92 | ||
9143d69f | 93 | virtual void Print(Option_t *option="") const; |
94 | ||
572b0139 | 95 | protected: |
96 | ||
97 | void SetSignificanceAndSOB(); | |
98 | TPaveText* DrawStats(Double_t x1=0., Double_t y1=0., Double_t x2=0., Double_t y2=0.); | |
99 | void Reset() {fValues.Zero(); fErrors.Zero();} | |
100 | ||
101 | private: | |
102 | TVectorD fValues; // values | |
103 | TVectorD fErrors; // value errors | |
104 | ||
105 | Double_t fIntMin; // signal extraction range min | |
106 | Double_t fIntMax; // signal extraction range max | |
107 | ||
108 | AliDielectronSignalBase(const AliDielectronSignalBase &c); | |
109 | AliDielectronSignalBase &operator=(const AliDielectronSignalBase &c); | |
110 | ||
111 | ClassDef(AliDielectronSignalBase,2) // Dielectron SignalBase | |
112 | }; | |
113 | ||
114 | // | |
115 | // Inline functions | |
116 | // | |
117 | ||
118 | inline void AliDielectronSignalBase::SetSignificanceAndSOB() | |
119 | { | |
120 | // | |
121 | // calculate significance and signal over background from values | |
122 | // it is expected that: | |
123 | // - 'values' and 'errors' have the size 4 | |
124 | // - Parameters 0 are given: signal and signal error | |
125 | // - Parameters 1 are given: background and background error | |
126 | // - Optionally parameter 2 can be given: signal+background and its error | |
127 | // | |
128 | // The calculated significance and S/B and the corresponding errors | |
129 | // are written in parameters 2 and 3, the first two parameters (signal and background) | |
130 | // stay untouched | |
131 | ||
132 | Double_t signal=fValues(0), signal_err=fErrors(0); | |
133 | Double_t background=fValues(1), background_err=fErrors(1); | |
134 | Double_t sigPlusBack=fValues(2), sigPlusBack_err=fErrors(2); | |
135 | Double_t significance=0, significance_err=0; | |
136 | Double_t sob=0, sob_err=0; | |
137 | ||
138 | if (sigPlusBack<1e-20){ | |
139 | //calculate signal plus background | |
140 | sigPlusBack=signal+background; | |
141 | sigPlusBack_err=TMath::Sqrt( signal_err*signal_err + background_err*background_err ); | |
142 | } | |
143 | ||
144 | if (sigPlusBack>1e-30){ | |
145 | ||
146 | significance=signal/TMath::Sqrt(sigPlusBack); | |
147 | ||
148 | significance_err=TMath::Sqrt((signal_err/signal)*(signal_err/signal)+ | |
149 | (0.5*sigPlusBack_err/sigPlusBack)*(0.5*sigPlusBack_err/sigPlusBack) | |
150 | )*significance; | |
151 | ||
152 | } | |
153 | ||
154 | if (background>1e-30){ | |
155 | sob=signal/background; | |
156 | sob_err=TMath::Sqrt((signal_err/signal)*(signal_err/signal)+ | |
157 | (background_err/background)*(background_err/background))*sob; | |
158 | } | |
159 | ||
160 | fValues(2)=significance; | |
161 | fErrors(2)=significance_err; | |
162 | ||
163 | fValues(3)=sob; | |
164 | fErrors(3)=sob_err; | |
165 | } | |
166 | ||
167 | #endif |