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