1 | #ifndef MARS_MMcSpectrumWeight
|
---|
2 | #define MARS_MMcSpectrumWeight
|
---|
3 |
|
---|
4 | #ifndef MARS_MTask
|
---|
5 | #include "MTask.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | class TF1;
|
---|
9 | class TH1;
|
---|
10 | class TH1D;
|
---|
11 | class TSpline3;
|
---|
12 | class MParList;
|
---|
13 | class MMcEvt;
|
---|
14 | class MHillas;
|
---|
15 | class MParameterD;
|
---|
16 | class MPointingPos;
|
---|
17 | class MMcCorsikaRunHeader;
|
---|
18 |
|
---|
19 | class MMcSpectrumWeight : public MTask
|
---|
20 | {
|
---|
21 | private:
|
---|
22 | const MMcEvt *fMcEvt; // Pointer to the container with the MC energy
|
---|
23 | const MHillas *fHillas;
|
---|
24 | MParameterD *fWeight; // Pointer to the output MWeight container
|
---|
25 | MPointingPos *fPointing;
|
---|
26 |
|
---|
27 | TString fNameWeight; // Name of the MWeight container
|
---|
28 | TString fNameMcEvt; // Name of the MMcEvt container
|
---|
29 |
|
---|
30 | TF1 *fFunc; // Function calculating the weights
|
---|
31 | TH1 *fWeightsZd; // Set additional ZA weights
|
---|
32 | TH1 *fWeightsSize; // Set additional ZA weights
|
---|
33 | // TSpline3 *fWeightsSize;
|
---|
34 |
|
---|
35 | Double_t fOldSlope; // Slope of energy spectrum generated with Corsika
|
---|
36 | Double_t fNewSlope; // Slope of the new spectrum (if it is a power law)
|
---|
37 |
|
---|
38 | Double_t fEnergyMin; // Minimum energy simulated
|
---|
39 | Double_t fEnergyMax; // Maximum energy simulated
|
---|
40 |
|
---|
41 | Double_t fNorm; // Normalization constant (additional normalization constant)
|
---|
42 |
|
---|
43 | TString fFormula; // Text Formula for new spectrum: eg. "pow(MMcEvt.fEnergy, -2.0)"
|
---|
44 |
|
---|
45 | Bool_t fAllowChange;
|
---|
46 |
|
---|
47 | // MMcSpectrumWeight
|
---|
48 | void Init(const char *name, const char *title);
|
---|
49 | TString ReplaceX(TString) const;
|
---|
50 |
|
---|
51 | // MTask
|
---|
52 | Bool_t ReInit(MParList *plist);
|
---|
53 | Int_t PreProcess(MParList *pList);
|
---|
54 | Int_t Process();
|
---|
55 |
|
---|
56 | // MParContainer
|
---|
57 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
58 |
|
---|
59 | public:
|
---|
60 | MMcSpectrumWeight(const char *name=NULL, const char *title=NULL);
|
---|
61 | ~MMcSpectrumWeight();
|
---|
62 |
|
---|
63 | // Setter
|
---|
64 | void SetNameWeight(const char *n="MWeight") { fNameWeight = n; }
|
---|
65 | void SetNameMcEvt(const char *n="MMcEvt") { fNameMcEvt = n; }
|
---|
66 | void SetNewSlope(Double_t s=-1) { fNewSlope = s; }
|
---|
67 | void SetNorm(Double_t s=1) { fNorm = s; }
|
---|
68 | void SetFormula(const char *f="") { fFormula = f; }
|
---|
69 | void SetEnergyRange(Double_t min=-2, Double_t max=-1) { fEnergyMin=min; fEnergyMax=max; }
|
---|
70 | void SetOldSlope(Double_t s=-2.6) { fOldSlope=s; }
|
---|
71 | void SetWeightsZd(TH1 *h=0) { fWeightsZd = h; }
|
---|
72 | void SetWeightsSize(TH1D *h=0);
|
---|
73 | Bool_t Set(const MMcCorsikaRunHeader &h);
|
---|
74 |
|
---|
75 | // Getter
|
---|
76 | TString GetFormulaSpecOld() const;
|
---|
77 | TString GetFormulaSpecNew() const;
|
---|
78 | TString GetFormulaWeights() const;
|
---|
79 |
|
---|
80 | TString GetFormulaSpecOldX() const { return ReplaceX(GetFormulaSpecOld()); }
|
---|
81 | TString GetFormulaSpecNewX() const { return ReplaceX(GetFormulaSpecNew()); }
|
---|
82 | TString GetFormulaWeightsX() const { return ReplaceX(GetFormulaWeights()); }
|
---|
83 |
|
---|
84 | Double_t GetSpecNewIntegral() const;
|
---|
85 | Double_t GetSpecOldIntegral() const;
|
---|
86 |
|
---|
87 | Double_t GetEnergyMin() const { return fEnergyMin; }
|
---|
88 | Double_t GetEnergyMax() const { return fEnergyMax; }
|
---|
89 |
|
---|
90 | // TObject
|
---|
91 | void Print(Option_t *o="") const;
|
---|
92 |
|
---|
93 | ClassDef(MMcSpectrumWeight, 0) // Task to calculate weights to change the energy spectrum
|
---|
94 | };
|
---|
95 |
|
---|
96 | #endif
|
---|