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