]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/dielectron/AliDielectronSignalBase.cxx
03dd07e37f02bcb551efd6f1d590267ec0f8181f
[u/mrichter/AliRoot.git] / PWG3 / dielectron / AliDielectronSignalBase.cxx
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
31 #include <TVectorT.h>
32 #include <TPaveText.h>
33 #include <TH1F.h>
34 #include "AliDielectronSignalBase.h"
35
36 ClassImp(AliDielectronSignalBase)
37
38 AliDielectronSignalBase::AliDielectronSignalBase() :
39   TNamed(),
40   fHistSignal(0),
41   fHistBackground(0),
42   fHistDataPM(0),
43   fHistDataPP(0),
44   fHistDataMM(0),
45   fValues(6),
46   fErrors(6),
47   fIntMin(0),
48   fIntMax(0),
49   fFitMin(0),
50   fFitMax(0),
51   fRebin(1),
52   fMethod(kLikeSign),
53   fProcessed(kFALSE)
54 {
55   //
56   // Default Constructor
57   //
58 }
59
60 //______________________________________________
61 AliDielectronSignalBase::AliDielectronSignalBase(const char* name, const char* title) :
62   TNamed(name, title),
63   fHistSignal(0),
64   fHistBackground(0),
65   fHistDataPM(0),
66   fHistDataPP(0),
67   fHistDataMM(0),
68   fValues(6),
69   fErrors(6),
70   fIntMin(0),
71   fIntMax(0),
72   fFitMin(0),
73   fFitMax(0),
74   fRebin(1),
75   fMethod(kLikeSign),
76   fProcessed(kFALSE)
77 {
78   //
79   // Named Constructor
80   //
81 }
82
83 //______________________________________________
84 AliDielectronSignalBase::~AliDielectronSignalBase()
85 {
86   //
87   // Default Destructor
88   //
89   if(fHistSignal) delete fHistSignal;
90   if(fHistBackground) delete fHistBackground;
91 }
92
93 //______________________________________________
94 TPaveText* AliDielectronSignalBase::DrawStats(Double_t x1/*=0.*/, Double_t y1/*=0.*/, Double_t x2/*=0.*/, Double_t y2/*=0.*/)
95 {
96   //
97   // Draw extracted values in a TPaveText
98   // with the corners x1,y2,x2,y2
99   //
100   if (TMath::Abs(x1)<1e-20&&TMath::Abs(x2)<1e-20){
101     x1=.6;
102     x2=.9;
103     y1=.7;
104     y2=.9;
105   }
106   TPaveText *t=new TPaveText(x1,y1,x2,y2,"brNDC");
107   t->SetFillColor(kWhite);
108   t->SetBorderSize(1);
109   t->SetTextAlign(12);
110   t->AddText(Form("Range  : %.2f - %.2f GeV/c^{2}", fIntMin, fIntMax));
111   t->AddText(Form("Signal : %.1f #pm %.1f", fValues(0), fErrors(0)));
112   t->AddText(Form("Backgnd: %.1f #pm %.1f", fValues(1), fErrors(1)));
113   t->AddText(Form("Signif.: %.2f #pm %.2f", fValues(2), fErrors(2)));
114   t->AddText(Form("S/B    : %.2f #pm %.2f", fValues(3), fErrors(3)));
115   if(fValues(4)>0) {
116     t->AddText(Form("Mass: %.2f #pm %.2f GeV/c^{2}", fValues(4), fErrors(4)));
117     t->AddText(Form("Mass res.: %.1f #pm %.1f MeV/c^{2}", 1000*fValues(5), 1000*fErrors(5)));
118   }
119   t->Draw();
120
121   return t;
122 }
123
124 //______________________________________________
125 void AliDielectronSignalBase::Print(Option_t */*option*/) const
126 {
127   //
128   // Print the statistics
129   //
130   printf("Signal : %.5g #pm %.5g\n",fValues(0), fErrors(0));
131   printf("Backgnd: %.5g #pm %.5g\n",fValues(1), fErrors(1));
132   printf("Signif.: %.5g #pm %.5g\n",fValues(2), fErrors(2));
133   printf("SoB    : %.5g #pm %.5g\n",fValues(3), fErrors(3));
134   if(fValues(4)>0){
135     printf("Mass: %.5g #pm %.5g\n", fValues(4), fErrors(4));
136     printf("Mass res.: %.5g #pm %.5g\n", fValues(5), fErrors(5));
137   }
138 }