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