]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/dielectron/AliDielectronSignalBase.h
Adding Id to PWG3 classes for better tracking of the coverity defect fixes (Ivana)
[u/mrichter/AliRoot.git] / PWG3 / dielectron / AliDielectronSignalBase.h
CommitLineData
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
27de2dfb 7/* $Id$ */
8
572b0139 9//#############################################################
10//# #
11//# Class AliDielectronSignalBase #
12//# Manage Cuts on the legs of the pair #
13//# #
14//# Authors: #
15//# Anton Andronic, GSI / A.Andronic@gsi.de #
16//# Ionut C. Arsene, GSI / I.C.Arsene@gsi.de #
17//# Julian Book, Uni Ffm / Julian.Book@cern.ch #
18//# Frederick Kramer, Uni Ffm, / Frederick.Kramer@cern.ch #
19//# Magnus Mager, CERN / Magnus.Mager@cern.ch #
20//# WooJin J. Park, GSI / W.J.Park@gsi.de #
21//# Jens Wiechula, Uni HD / Jens.Wiechula@cern.ch #
22//# #
23//#############################################################
24
bc75eeb5 25
572b0139 26#include <TNamed.h>
27#include <TVectorT.h>
28#include <TMath.h>
29
30class TObjArray;
31class TPaveText;
bc75eeb5 32class TH1F;
572b0139 33
34class AliDielectronSignalBase : public TNamed {
35public:
bc75eeb5 36 enum EBackgroundMethod {
37 kFitted = 0,
38 kLikeSign,
45b2b1b8 39 kLikeSignArithm,
2a14a7b1 40 kEventMixing,
41 kRotation
bc75eeb5 42 };
43
572b0139 44 AliDielectronSignalBase();
45 AliDielectronSignalBase(const char*name, const char* title);
bc75eeb5 46
572b0139 47 virtual ~AliDielectronSignalBase();
572b0139 48
49 void SetIntegralRange(Double_t min, Double_t max) {fIntMin=min;fIntMax=max;}
bc75eeb5 50 void SetFitRange(Double_t min, Double_t max) {fFitMin=min; fFitMax=max;}
51 void SetRebin(Int_t factor) {fRebin = factor;}
52 void SetMethod(EBackgroundMethod method) {fMethod = method;}
53
572b0139 54 const TVectorD& GetValues() const {return fValues;}
55 const TVectorD& GetErrors() const {return fErrors;}
56
bc75eeb5 57 Double_t GetIntegralMin() const { return fIntMin; }
58 Double_t GetIntegralMax() const { return fIntMax; }
59 Double_t GetSignal() const { return fValues(0);}
60 Double_t GetSignalError() const { return fErrors(0);}
61 Double_t GetBackground() const { return fValues(1);}
62 Double_t GetBackgroundError() const { return fErrors(1);}
63 Double_t GetSignificance() const { return fValues(2);}
64 Double_t GetSignificanceError() const { return fErrors(2);}
65 Double_t GetSB() const { return fValues(3);}
66 Double_t GetSBError() const { return fErrors(3);}
67 Double_t GetMass() const { return fValues(4);}
68 Double_t GetMassError() const { return fErrors(4);}
69 Double_t GetMassWidth() const { return fValues(5);}
70 Double_t GetMassWidthError() const { return fErrors(5);}
71
2a14a7b1 72 TH1* GetSignalHistogram() const {return fHistSignal;}
73 TH1* GetBackgroundHistogram() const {return fHistBackground;}
74 TH1* GetUnlikeSignHistogram() const {return fHistDataPM;}
554e40f8 75
76 void SetScaleRawToBackground(Double_t intMin, Double_t intMax) { fScaleMin=intMin; fScaleMax=intMax; }
77 Double_t GetScaleFactor() const { return fScaleFactor; }
2a14a7b1 78
554e40f8 79 static Double_t ScaleHistograms(TH1* histRaw, TH1* histBackground, Double_t intMin, Double_t intMax);
2a14a7b1 80
bc75eeb5 81 virtual void Print(Option_t *option="") const;
572b0139 82
83 /**
84 This function needs to be implemented by the signal extraction classes.
bc75eeb5 85 Here all the work should be done.
572b0139 86
87 The signal extraction is done on the mass spectra.
88 The TObjArray should contain the Inv. Mass spectra of the 10 possible combinations
89 for single and mixed events defined in AliDielectron.cxx
572b0139 90 */
91 virtual void Process(TObjArray * const /*arrhist*/) = 0;
bc75eeb5 92
93protected:
572b0139 94
2a14a7b1 95 TH1 *fHistSignal; // histogram of pure signal
96 TH1 *fHistBackground; // histogram of background (fitted=0, like-sign=1, event mixing=2)
97 TH1 *fHistDataPM; // histogram of selected +- pair candidates
98 TH1 *fHistDataPP; // histogram of selected ++ pair candidates
99 TH1 *fHistDataMM; // histogram of selected -- pair candidates
bc75eeb5 100
101 TVectorD fValues; // values
102 TVectorD fErrors; // value errors
103
104 Double_t fIntMin; // signal extraction range min
105 Double_t fIntMax; // signal extraction range max
106 Double_t fFitMin; // fit range lowest inv. mass
107 Double_t fFitMax; // fit range highest inv. mass
108
109 Int_t fRebin; // histogram rebin factor
110 EBackgroundMethod fMethod; // method for background substraction
554e40f8 111 Double_t fScaleMin; // min for scaling of raw and background histogram
112 Double_t fScaleMax; // max for scaling of raw and background histogram
113 Double_t fScaleFactor; // scale factor of raw to background histogram scaling
114
bc75eeb5 115 Bool_t fProcessed; // flag
554e40f8 116
bc75eeb5 117 void SetSignificanceAndSOB(); // calculate the significance and S/B
572b0139 118 TPaveText* DrawStats(Double_t x1=0., Double_t y1=0., Double_t x2=0., Double_t y2=0.);
bc75eeb5 119
572b0139 120 AliDielectronSignalBase(const AliDielectronSignalBase &c);
121 AliDielectronSignalBase &operator=(const AliDielectronSignalBase &c);
122
554e40f8 123 ClassDef(AliDielectronSignalBase,4) // Dielectron SignalBase
572b0139 124};
125
572b0139 126inline void AliDielectronSignalBase::SetSignificanceAndSOB()
127{
128 //
bc75eeb5 129 // Calculate S/B and significance
572b0139 130 //
bc75eeb5 131 // Signal/Background
132 fValues(3) = (fValues(1)>0 ? fValues(0)/fValues(1) : 0);
133 Float_t epsSig = (fValues(0)>0 ? fErrors(0)/fValues(0) : 0);
134 Float_t epsBknd = (fValues(1)>0 ? fErrors(1)/fValues(1) : 0);
135 fErrors(3) = fValues(3)*TMath::Sqrt(epsSig*epsSig + epsBknd*epsBknd);
136 // Significance
137 fValues(2) = ((fValues(0)+fValues(1))>0 ? fValues(0)/TMath::Sqrt(fValues(0)+fValues(1)) : 0);
138 Float_t s = fValues(0); Float_t b = fValues(1);
139 fErrors(2) = ((s+b)>0 ? TMath::Sqrt((s*(s+2*b)*(s+2*b)+b*s*s)/(4*TMath::Power(s+b,3))) : 0);
572b0139 140}
141
142#endif