]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/AliDielectronSignalBase.h
Fix in LHC magnets initialization convention: for pA beams the provided energy
[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 {
5720c765 35 kFittedMC = 0,
ac390e40 36 kFitted,
bc75eeb5 37 kLikeSign,
45b2b1b8 38 kLikeSignArithm,
b9d223bb 39 kLikeSignRcorr,
40 kLikeSignArithmRcorr,
2a14a7b1 41 kEventMixing,
42 kRotation
bc75eeb5 43 };
44
572b0139 45 AliDielectronSignalBase();
46 AliDielectronSignalBase(const char*name, const char* title);
bc75eeb5 47
572b0139 48 virtual ~AliDielectronSignalBase();
572b0139 49
50 void SetIntegralRange(Double_t min, Double_t max) {fIntMin=min;fIntMax=max;}
bc75eeb5 51 void SetFitRange(Double_t min, Double_t max) {fFitMin=min; fFitMax=max;}
52 void SetRebin(Int_t factor) {fRebin = factor;}
53 void SetMethod(EBackgroundMethod method) {fMethod = method;}
b9d223bb 54 Int_t GetMethod() const { return (Int_t)fMethod; }
bc75eeb5 55
572b0139 56 const TVectorD& GetValues() const {return fValues;}
57 const TVectorD& GetErrors() const {return fErrors;}
58
bc75eeb5 59 Double_t GetIntegralMin() const { return fIntMin; }
60 Double_t GetIntegralMax() const { return fIntMax; }
61 Double_t GetSignal() const { return fValues(0);}
62 Double_t GetSignalError() const { return fErrors(0);}
63 Double_t GetBackground() const { return fValues(1);}
64 Double_t GetBackgroundError() const { return fErrors(1);}
65 Double_t GetSignificance() const { return fValues(2);}
66 Double_t GetSignificanceError() const { return fErrors(2);}
67 Double_t GetSB() const { return fValues(3);}
68 Double_t GetSBError() const { return fErrors(3);}
69 Double_t GetMass() const { return fValues(4);}
70 Double_t GetMassError() const { return fErrors(4);}
71 Double_t GetMassWidth() const { return fValues(5);}
72 Double_t GetMassWidthError() const { return fErrors(5);}
5720c765 73
2a14a7b1 74 TH1* GetSignalHistogram() const {return fHistSignal;}
75 TH1* GetBackgroundHistogram() const {return fHistBackground;}
76 TH1* GetUnlikeSignHistogram() const {return fHistDataPM;}
ac390e40 77 TH1* GetRfactorHistogram() const {return fHistRfactor;}
78
554e40f8 79 void SetScaleRawToBackground(Double_t intMin, Double_t intMax) { fScaleMin=intMin; fScaleMax=intMax; }
fd6ebd85 80 void SetScaleRawToBackground(Double_t intMin, Double_t intMax, Double_t intMin2, Double_t intMax2) { fScaleMin=intMin; fScaleMax=intMax; fScaleMin2=intMin2; fScaleMax2=intMax2; }
d327d9cd 81 Double_t GetScaleMin() const { return fScaleMin; }
82 Double_t GetScaleMax() const { return fScaleMax; }
fd6ebd85 83 Double_t GetScaleMin2() const { return fScaleMin2; }
84 Double_t GetScaleMax2() const { return fScaleMax2; }
554e40f8 85 Double_t GetScaleFactor() const { return fScaleFactor; }
ac390e40 86
87 void SetMixingCorrection(Bool_t mixcorr=kTRUE) { fMixingCorr=mixcorr; }
2a14a7b1 88
554e40f8 89 static Double_t ScaleHistograms(TH1* histRaw, TH1* histBackground, Double_t intMin, Double_t intMax);
fd6ebd85 90 static Double_t ScaleHistograms(TH1* histRaw, TH1* histBackground, Double_t intMin, Double_t intMax, Double_t intMin2, Double_t intMax2);
2a14a7b1 91
bc75eeb5 92 virtual void Print(Option_t *option="") const;
572b0139 93
94 /**
95 This function needs to be implemented by the signal extraction classes.
bc75eeb5 96 Here all the work should be done.
572b0139 97
98 The signal extraction is done on the mass spectra.
99 The TObjArray should contain the Inv. Mass spectra of the 10 possible combinations
100 for single and mixed events defined in AliDielectron.cxx
572b0139 101 */
102 virtual void Process(TObjArray * const /*arrhist*/) = 0;
bc75eeb5 103
104protected:
572b0139 105
2a14a7b1 106 TH1 *fHistSignal; // histogram of pure signal
107 TH1 *fHistBackground; // histogram of background (fitted=0, like-sign=1, event mixing=2)
108 TH1 *fHistDataPM; // histogram of selected +- pair candidates
109 TH1 *fHistDataPP; // histogram of selected ++ pair candidates
110 TH1 *fHistDataMM; // histogram of selected -- pair candidates
5720c765 111 TH1 *fHistDataME; // histogram of selected +- pair candidates from mixed event
ac390e40 112 TH1 *fHistRfactor; // histogram of R factors
113
5720c765 114 TVectorD fValues; // values
115 TVectorD fErrors; // value errors
bc75eeb5 116
5720c765 117 Double_t fIntMin; // signal extraction range min
118 Double_t fIntMax; // signal extraction range max
119 Double_t fFitMin; // fit range lowest inv. mass
120 Double_t fFitMax; // fit range highest inv. mass
bc75eeb5 121
5720c765 122 Int_t fRebin; // histogram rebin factor
123 EBackgroundMethod fMethod; // method for background substraction
124 Double_t fScaleMin; // min for scaling of raw and background histogram
125 Double_t fScaleMax; // max for scaling of raw and background histogram
fd6ebd85 126 Double_t fScaleMin2; // min for scaling of raw and background histogram
127 Double_t fScaleMax2; // max for scaling of raw and background histogram
5720c765 128 Double_t fScaleFactor; // scale factor of raw to background histogram scaling
ac390e40 129 Bool_t fMixingCorr; // switch for bin by bin correction with R factor
554e40f8 130
5720c765 131 Bool_t fProcessed; // flag
554e40f8 132
5720c765 133 void SetSignificanceAndSOB(); // calculate the significance and S/B
572b0139 134 TPaveText* DrawStats(Double_t x1=0., Double_t y1=0., Double_t x2=0., Double_t y2=0.);
bc75eeb5 135
572b0139 136 AliDielectronSignalBase(const AliDielectronSignalBase &c);
137 AliDielectronSignalBase &operator=(const AliDielectronSignalBase &c);
138
554e40f8 139 ClassDef(AliDielectronSignalBase,4) // Dielectron SignalBase
572b0139 140};
141
572b0139 142inline void AliDielectronSignalBase::SetSignificanceAndSOB()
143{
144 //
bc75eeb5 145 // Calculate S/B and significance
572b0139 146 //
bc75eeb5 147 // Signal/Background
148 fValues(3) = (fValues(1)>0 ? fValues(0)/fValues(1) : 0);
149 Float_t epsSig = (fValues(0)>0 ? fErrors(0)/fValues(0) : 0);
150 Float_t epsBknd = (fValues(1)>0 ? fErrors(1)/fValues(1) : 0);
151 fErrors(3) = fValues(3)*TMath::Sqrt(epsSig*epsSig + epsBknd*epsBknd);
152 // Significance
153 fValues(2) = ((fValues(0)+fValues(1))>0 ? fValues(0)/TMath::Sqrt(fValues(0)+fValues(1)) : 0);
e4339752 154 Float_t s = (fValues(0)>0?fValues(0):0); Float_t b = fValues(1);
bc75eeb5 155 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 156}
157
158#endif