]>
Commit | Line | Data |
---|---|---|
572b0139 | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /////////////////////////////////////////////////////////////////////////// | |
17 | // Dielectron SignalBase // | |
18 | // // | |
19 | // // | |
20 | /* | |
21 | Base class for signal extraction from a histogram or an array of histograms | |
22 | The histogram is assumed to be an inv. mass spectrum, | |
23 | the array of histograms is assumed to be an array with inv. mass histograms | |
24 | resulting from single and mixed events, as defined in AliDielectron.cxx | |
25 | ||
26 | */ | |
27 | // // | |
28 | /////////////////////////////////////////////////////////////////////////// | |
29 | ||
30 | ||
48609e3d | 31 | #include <TVectorT.h> |
32 | #include <TPaveText.h> | |
bc75eeb5 | 33 | #include <TH1F.h> |
48609e3d | 34 | #include "AliDielectronSignalBase.h" |
572b0139 | 35 | |
36 | ClassImp(AliDielectronSignalBase) | |
37 | ||
38 | AliDielectronSignalBase::AliDielectronSignalBase() : | |
39 | TNamed(), | |
bc75eeb5 | 40 | fHistSignal(0), |
41 | fHistBackground(0), | |
42 | fHistDataPM(0), | |
43 | fHistDataPP(0), | |
44 | fHistDataMM(0), | |
8df8e382 | 45 | fValues(6), |
46 | fErrors(6), | |
bc75eeb5 | 47 | fIntMin(0), |
48 | fIntMax(0), | |
49 | fFitMin(0), | |
50 | fFitMax(0), | |
51 | fRebin(1), | |
52 | fMethod(kLikeSign), | |
554e40f8 | 53 | fScaleMin(0.), |
54 | fScaleMax(0.), | |
ffbede40 | 55 | fScaleFactor(1.), |
bc75eeb5 | 56 | fProcessed(kFALSE) |
572b0139 | 57 | { |
58 | // | |
59 | // Default Constructor | |
60 | // | |
572b0139 | 61 | } |
62 | ||
63 | //______________________________________________ | |
64 | AliDielectronSignalBase::AliDielectronSignalBase(const char* name, const char* title) : | |
65 | TNamed(name, title), | |
bc75eeb5 | 66 | fHistSignal(0), |
67 | fHistBackground(0), | |
68 | fHistDataPM(0), | |
69 | fHistDataPP(0), | |
70 | fHistDataMM(0), | |
8df8e382 | 71 | fValues(6), |
72 | fErrors(6), | |
bc75eeb5 | 73 | fIntMin(0), |
74 | fIntMax(0), | |
75 | fFitMin(0), | |
76 | fFitMax(0), | |
77 | fRebin(1), | |
78 | fMethod(kLikeSign), | |
554e40f8 | 79 | fScaleMin(0.), |
80 | fScaleMax(0.), | |
ffbede40 | 81 | fScaleFactor(1.), |
bc75eeb5 | 82 | fProcessed(kFALSE) |
572b0139 | 83 | { |
84 | // | |
85 | // Named Constructor | |
86 | // | |
87 | } | |
88 | ||
89 | //______________________________________________ | |
90 | AliDielectronSignalBase::~AliDielectronSignalBase() | |
91 | { | |
92 | // | |
93 | // Default Destructor | |
94 | // | |
bc75eeb5 | 95 | if(fHistSignal) delete fHistSignal; |
96 | if(fHistBackground) delete fHistBackground; | |
554e40f8 | 97 | if (fHistDataPP) delete fHistDataPP; |
98 | if (fHistDataPM) delete fHistDataPM; | |
99 | if (fHistDataMM) delete fHistDataMM; | |
100 | ||
572b0139 | 101 | } |
102 | ||
103 | //______________________________________________ | |
104 | TPaveText* AliDielectronSignalBase::DrawStats(Double_t x1/*=0.*/, Double_t y1/*=0.*/, Double_t x2/*=0.*/, Double_t y2/*=0.*/) | |
105 | { | |
106 | // | |
107 | // Draw extracted values in a TPaveText | |
108 | // with the corners x1,y2,x2,y2 | |
109 | // | |
110 | if (TMath::Abs(x1)<1e-20&&TMath::Abs(x2)<1e-20){ | |
111 | x1=.6; | |
112 | x2=.9; | |
113 | y1=.7; | |
114 | y2=.9; | |
115 | } | |
116 | TPaveText *t=new TPaveText(x1,y1,x2,y2,"brNDC"); | |
117 | t->SetFillColor(kWhite); | |
118 | t->SetBorderSize(1); | |
119 | t->SetTextAlign(12); | |
bc75eeb5 | 120 | t->AddText(Form("Range : %.2f - %.2f GeV/c^{2}", fIntMin, fIntMax)); |
121 | t->AddText(Form("Signal : %.1f #pm %.1f", fValues(0), fErrors(0))); | |
122 | t->AddText(Form("Backgnd: %.1f #pm %.1f", fValues(1), fErrors(1))); | |
123 | t->AddText(Form("Signif.: %.2f #pm %.2f", fValues(2), fErrors(2))); | |
124 | t->AddText(Form("S/B : %.2f #pm %.2f", fValues(3), fErrors(3))); | |
125 | if(fValues(4)>0) { | |
126 | t->AddText(Form("Mass: %.2f #pm %.2f GeV/c^{2}", fValues(4), fErrors(4))); | |
127 | t->AddText(Form("Mass res.: %.1f #pm %.1f MeV/c^{2}", 1000*fValues(5), 1000*fErrors(5))); | |
8df8e382 | 128 | } |
572b0139 | 129 | t->Draw(); |
130 | ||
131 | return t; | |
132 | } | |
133 | ||
9143d69f | 134 | //______________________________________________ |
135 | void AliDielectronSignalBase::Print(Option_t */*option*/) const | |
136 | { | |
137 | // | |
138 | // Print the statistics | |
139 | // | |
bc75eeb5 | 140 | printf("Signal : %.5g #pm %.5g\n",fValues(0), fErrors(0)); |
141 | printf("Backgnd: %.5g #pm %.5g\n",fValues(1), fErrors(1)); | |
142 | printf("Signif.: %.5g #pm %.5g\n",fValues(2), fErrors(2)); | |
143 | printf("SoB : %.5g #pm %.5g\n",fValues(3), fErrors(3)); | |
144 | if(fValues(4)>0){ | |
145 | printf("Mass: %.5g #pm %.5g\n", fValues(4), fErrors(4)); | |
146 | printf("Mass res.: %.5g #pm %.5g\n", fValues(5), fErrors(5)); | |
9143d69f | 147 | } |
148 | } | |
2a14a7b1 | 149 | |
150 | //______________________________________________ | |
554e40f8 | 151 | Double_t AliDielectronSignalBase::ScaleHistograms(TH1* histRaw, TH1* histBackground, Double_t intMin, Double_t intMax) |
2a14a7b1 | 152 | { |
153 | // | |
154 | // scale histBackground to match the integral of histRaw in the interval intMin, intMax | |
155 | // | |
ffbede40 | 156 | |
157 | //protect using over and underflow bins in normalisation calculation | |
158 | if (intMin<histRaw->GetXaxis()->GetXmin()) intMin=histRaw->GetXaxis()->GetXmin(); | |
159 | if (intMin<histBackground->GetXaxis()->GetXmin()) intMin=histBackground->GetXaxis()->GetXmin(); | |
160 | ||
161 | if (intMax>histRaw->GetXaxis()->GetXmax()) | |
162 | intMax=histRaw->GetXaxis()->GetXmax()-histRaw->GetBinWidth(histRaw->GetNbinsX())/2.; | |
163 | if (intMax>histBackground->GetXaxis()->GetXmax()) | |
164 | intMax=histBackground->GetXaxis()->GetXmax()-histBackground->GetBinWidth(histBackground->GetNbinsX())/2.; | |
2a14a7b1 | 165 | |
166 | Double_t intRaw = histRaw->Integral(histRaw->FindBin(intMin),histRaw->FindBin(intMax)); | |
167 | Double_t intBack = histBackground->Integral(histBackground->FindBin(intMin),histBackground->FindBin(intMax)); | |
554e40f8 | 168 | Double_t scaleFactor=intBack>0?intRaw/intBack:0.; |
2a14a7b1 | 169 | if (intBack>0){ |
170 | histBackground->Sumw2(); | |
554e40f8 | 171 | histBackground->Scale(scaleFactor); |
2a14a7b1 | 172 | } |
554e40f8 | 173 | |
174 | return scaleFactor; | |
2a14a7b1 | 175 | } |