source: trunk/Mars/mhflux/MHAlpha.h@ 10014

Last change on this file since 10014 was 9303, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 4.8 KB
Line 
1#ifndef MARS_MHAlpha
2#define MARS_MHAlpha
3
4#ifndef MARS_MH
5#include "MH.h"
6#endif
7
8#ifndef MARS_MTime
9#include "MTime.h"
10#endif
11
12#ifndef MARS_MAlphaFitter
13#include "MAlphaFitter.h"
14#endif
15
16#ifndef ROOT_TH3
17#include <TH3.h>
18#endif
19
20class MParList;
21class MParameterD;
22class MParameterI;
23class MHillas;
24class MHMatrix;
25class MPointingPos;
26
27class MHAlpha : public MH
28{
29protected:
30 TH3D fHist; // Alpha vs. theta and energy
31 TH1D fHistTime; //! temporary histogram to get alpha vs. time
32
33 TString fNameParameter;
34
35 MParContainer *fParameter; //!
36
37 const TH3D *fOffData;
38
39 MAlphaFitter fFit; // SEEMS THAT STREAMER HAS SOME PROBLEMS... MAYBE IF FUNC IS USED AT THE SAME TIME FOR FITS (PAINT)
40
41private:
42 TH1D fHEnergy; // excess events vs energy
43 TH1D fHTheta; // excess events vs theta
44 TH1D fHTime; // excess events vs time;
45
46 MParameterD *fResult; //!
47 MParameterD *fSigma; //!
48 MParameterD *fEnergy; //!
49 MParameterI *fBin; //!
50 MPointingPos *fPointPos; //!
51
52 MTime *fTimeEffOn; //! Time to steer filling of fHTime
53 MTime *fTime; //! Event-Time to finalize fHTime
54 MTime fLastTime; //! Last fTimeEffOn
55
56 UShort_t fNumTimeBins; // Number of time bins to fill together
57 UShort_t fNumRebin; //!
58
59 //const TString fNameProjAlpha; //! This should make sure, that gROOT doen't confuse the projection with something else
60protected:
61 MHillas *fHillas; //!
62 MHMatrix *fMatrix; //!
63 Int_t fMap[15]; //!
64
65 Bool_t fSkipHistTime;
66 Bool_t fSkipHistTheta;
67 Bool_t fSkipHistEnergy;
68 Bool_t fForceUsingSize;
69
70private:
71 Float_t FitEnergyBins(Bool_t paint=kFALSE);
72 void FitThetaBins(Bool_t paint=kFALSE);
73
74 void UpdateAlphaTime(Bool_t final=kFALSE);
75 void InitAlphaTime(const MTime &t);
76 void FinalAlphaTime(MBinning &bins);
77
78 void SetBin(Int_t bin);
79
80 void PaintText(Double_t val, Double_t error) const;
81 void PaintText(const TH1D &h) const;
82
83 Int_t DistancetoPrimitive(Int_t px, Int_t py);
84
85 virtual Bool_t GetParameter(const MParList &pl);
86 virtual Double_t GetVal() const;
87 virtual const char *GetParameterRule() const
88 {
89 return "MHillasSrc.fAlpha";
90 }
91
92public:
93 MHAlpha(const char *name=NULL, const char *title=NULL);
94
95 // MH
96 Bool_t SetupFill(const MParList *pl);
97 Int_t Fill(const MParContainer *par, const Stat_t w=1);
98 Bool_t Finalize();
99
100 // MHAlpha
101 const TH3D &GetHist() const { return fHist; }
102 const MAlphaFitter &GetAlphaFitter() const { return fFit; }
103
104 const TH1D &GetHEnergy() const { return fHEnergy; }
105
106 const TH3D *GetOffData() const { return fOffData; }
107
108 // Setter
109 void SetNameParameter(const char *name) { fNameParameter=name; }
110 virtual void SetOffData(const MHAlpha &h)
111 {
112 fOffData = &h.fHist;
113 fForceUsingSize = h.fForceUsingSize;
114 fNumTimeBins = h.fNumTimeBins;
115 }
116 void SetNumTimeBins(UShort_t n) { fNumTimeBins = n; }
117/*
118 void SetSizeCuts(Float_t min, Float_t max) { fSizeMin=min; fSizeMax=max; }
119 void SetSizeMin(Float_t min) { fSizeMin=min; }
120 void SetSizeMax(Float_t max) { fSizeMax=max; }
121 void SetEnergyCuts(Float_t min, Float_t max) { fEnergyMin=min; fEnergyMax=max; }
122 void SetEnergyMin(Float_t min) { fEnergyMin=min; }
123 void SetEnergyMax(Float_t max) { fEnergyMax=max; }
124
125 void SetCuts(const MHAlpha &h) {
126 fSizeMin = h.fSizeMin; fEnergyMin = h.fEnergyMin;
127 fSizeMax = h.fSizeMax; fEnergyMax = h.fEnergyMax;
128 }
129 */
130
131 void SkipHistTime(Bool_t b=kTRUE) { fSkipHistTime=b; }
132 void SkipHistTheta(Bool_t b=kTRUE) { fSkipHistTheta=b; }
133 void SkipHistEnergy(Bool_t b=kTRUE) { fSkipHistEnergy=b; }
134 void ForceUsingSize(Bool_t b=kTRUE) { fForceUsingSize=b; }
135
136 Bool_t FitAlpha()
137 {
138 return fFit.FitAlpha(fHist, fOffData);
139 }
140
141 void DrawNicePlot(const char *title="MAGIC Telescope observation", const char *watermark="preliminary", Int_t binlo=-1, Int_t binhi=9999) { DrawNicePlot(kTRUE, title, watermark, binlo, binhi); } //*MENU*
142 void DrawNicePlot(Bool_t newc, const char *title=0, const char *watermark=0, Int_t binlo=-1, Int_t binhi=9999);
143 void DrawAll() { DrawAll(kTRUE); } //*MENU*
144 void DrawAll(Bool_t newc);
145
146 virtual void InitMapping(MHMatrix *mat, Int_t type=0);
147 void StopMapping();
148
149 void ApplyScaling();
150
151 // TObject
152 void Paint(Option_t *opt="");
153 void Draw(Option_t *option="");
154 void RecursiveRemove(TObject *obj);
155
156 // MParContainer
157 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
158
159 ClassDef(MHAlpha, 1) // Alpha-Plot which is fitted online
160};
161
162#endif
Note: See TracBrowser for help on using the repository browser.