]>
Commit | Line | Data |
---|---|---|
2410262d | 1 | |
2 | /************************************************************************** | |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Authors: Øystein Djuvsland <oysteind@ift.uib.no> * | |
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 | ||
18 | #include "AliHLTPHOSPhysicsAnalyzerPeakFitter.h" | |
19 | #include "TMath.h" | |
20 | #include "TF1.h" | |
21 | #include "TFile.h" | |
22 | ||
23 | ||
24 | ClassImp(AliHLTPHOSPhysicsAnalyzerPeakFitter); | |
25 | ||
26 | AliHLTPHOSPhysicsAnalyzerPeakFitter::AliHLTPHOSPhysicsAnalyzerPeakFitter() : fGainLow(80), fGainHigh(5), | |
27 | fRootHistPtr(0) | |
28 | { | |
6e709a0d | 29 | //Constructor |
2410262d | 30 | } |
31 | ||
32 | AliHLTPHOSPhysicsAnalyzerPeakFitter::~AliHLTPHOSPhysicsAnalyzerPeakFitter() | |
33 | { | |
6e709a0d | 34 | //Destructor |
2410262d | 35 | } |
36 | ||
6e709a0d | 37 | AliHLTPHOSPhysicsAnalyzerPeakFitter::AliHLTPHOSPhysicsAnalyzerPeakFitter(const AliHLTPHOSPhysicsAnalyzerPeakFitter&): fGainLow(80), fGainHigh(5), |
38 | fRootHistPtr(0) | |
39 | { | |
40 | //Copy constructor | |
41 | } | |
42 | ||
43 | ||
2410262d | 44 | Int_t |
45 | AliHLTPHOSPhysicsAnalyzerPeakFitter::FitGaussian() | |
46 | { | |
6e709a0d | 47 | //FitGaussian |
48 | ||
2410262d | 49 | Int_t maxBin = fRootHistPtr->GetMaximumBin(); |
50 | Float_t binWidth = fRootHistPtr->GetBinWidth(maxBin); | |
51 | Float_t maxBinValue = (Float_t)(maxBin * binWidth); | |
52 | Float_t lowRange = maxBinValue - 0.03; | |
53 | Float_t highRange = maxBinValue + 0.03; | |
54 | ||
55 | TF1* gaussian = new TF1("gaussian", "gaus", 0.1, 0.2); | |
6e709a0d | 56 | |
2410262d | 57 | fRootHistPtr->Fit(gaussian->GetName(), "", "",lowRange, highRange); |
58 | ||
59 | return 0; | |
60 | ||
61 | } | |
62 | ||
63 | Int_t | |
64 | AliHLTPHOSPhysicsAnalyzerPeakFitter::FitLorentzian() | |
65 | { | |
6e709a0d | 66 | //FitLorentzian |
2410262d | 67 | Int_t maxBin = fRootHistPtr->GetMaximumBin(); |
68 | Float_t binWidth = fRootHistPtr->GetBinWidth(maxBin); | |
69 | Float_t maxBinValue = (Float_t)(maxBin * binWidth); | |
70 | Double_t lowRange = maxBinValue - 0.03; | |
71 | Double_t highRange = maxBinValue + 0.03; | |
72 | ||
2410262d | 73 | char* name = "lorentzian"; |
74 | ||
75 | TF1* lorentzian = new TF1(name, "([0]*1/TMath::Pi())*[1]/((x[0]-[2])*(x[0]-[2])+[1]*[1])", lowRange, highRange); | |
76 | ||
77 | Double_t params[3] = {fRootHistPtr->GetBinContent(maxBin)/20, 0.01, 0.135}; | |
78 | lorentzian->SetParameters(params); | |
79 | ||
80 | fRootHistPtr->Fit(lorentzian->GetName(), "", "", lowRange, highRange); | |
81 | ||
82 | lorentzian->GetParameters(params); | |
83 | ||
6e709a0d | 84 | TFile *outfile = new TFile("/afsuser/odjuvsland","recreate"); |
2410262d | 85 | fRootHistPtr->Write(); |
86 | outfile->Close(); | |
87 | ||
88 | return 0; | |
89 | } | |
90 |