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