simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
TSEvent.h
1 /*
2  * TSEvent.h
3  *
4  * Created on: Sep 27, 2014
5  * Author: Silvestro di Luise
6  * Silvestro.Di.Luise@cern.ch
7  *
8  */
9 
10 #ifndef TSEVENT_H_
11 #define TSEVENT_H_
12 
13 #include <vector>
14 #include <map>
15 #include <unordered_map>
16 
17 #include <TString.h>
18 #include <TH1F.h>
19 #include <TH2F.h>
20 
21 #include "TSNamed.h"
22 
23 #include "TSPOTMgr.h"
24 
25 #include "TSVariable.h"
26 #include "TSCategory.h"
27 #include "TSCategoryCard.h"
28 #include "TSNuiParam.h"
29 #include "TSNuiParamSet.h"
30 
31 #include "TSOscProb.h"
32 #include "TSOscProb3Plus1.h"
33 
34 /*
35  *
36  *
37  *
38  */
39 
40 class TSEvent;
41 
42 
43 class TSEventCommands{
44 
45 public:
46 
47 
48 
49 };
50 
51 class TSEvent: public TSNamed {
52 
53 
54 public:
55 
56  TSEvent();
57  TSEvent(TString name, TString tag, TString title);
58  TSEvent(const TSEvent &);
59  virtual ~TSEvent();
60 
61  void AddResponseFunctionToParam(const TSRespFunc &, const TSNuiParam &);
62 
63 
64  static void ClearProcessChain();
65 
66  double ComputeOscillProb();
67 
68  double ComputeWeight();
69 
70 
71  void Fill();
72 
73  std::map<const TSVariable*,double>& FillValues();
74 
75  TSCategoryCard& GetCategoryCard();
76 
77 
78 
79  int GetId() const {return fId;}
80 
81  int GetNumOfVars() const {return fNumOfVars;}
82 
83  TSNuiParamSet& GetNuiParamSet() {return fNuiParSet;}
84 
85  double GetOscillProb() const {return fOscillProb;}
86 
87  TSOscProb* GetOscillProbFunction() {return fProbFunction;}
88 
89  TSPOTMgr& GetPOTMgr() {return fPOTMgr;}
90 
91  TString GetTag() const {return GetLabel();}
92 
93  const TSVariable* GetVariable(int) const;
94  const TSVariable* GetVarLink(int) const;
95 
96  double GetVarValue(int) const;
97  double GetVarValue(const TSVariable &);
98 
99  double GetWeight() const {return fWeight;}
100  double GetWeightNative() const {return fWeightNative;}
101 
102  double GetWeightPosition(int position);
103  std::vector<double>& GetSavedWeights() {return fWeightSaved;}
104 
105  bool HasVariable(const TSVariable &) const;
106 
107  bool HasCategoryCard() const {return fHasCategory;}
108  bool HasOscillProbFunction() const {return fHasProbFunc;}
109  bool HasWeightParams() const {return fHasWeightParams;}
110 
111 
112  void Init();
113 
114  double Oscillate(int opt=1);
115 
116  virtual void Process();
117  void ProcessWith(double (TSEvent::*p)() ) { (this->*p)(); }
118 
119  void Print() const;
120 
121  double RestoreWeightNative();
122 
123  double ReWeightWith(double);
124  double ReWeightWithSavedPosition(int postion);
125  double ReWeightNativeWith(double);
126 
127  double ReWeightWithNuiParams(int opt=0);
128 
129 
130  double SaveWeightPosition(int position);
131 
132  void SetCategoryCard(const TSCategoryCard &);
133 
134  void SetId(int i) {fId=i;}
135 
136  void SetNativePOT(float POT, float Power=20);
137  void ScaleToPOT(float POT, float Power=20);
138  void ScaleToNativePOT();
139 
140 
141  int SetOscillProbFunction(TSOscProb *);
142 
143  void SetTag(TString tag) { SetLabel(tag); }
144 
145  void SetVariables(const TSArgList &);
146 
147  void SetVarValue(int, double);
148 
149  void SetWeightNative(double w);
150  void SetWeight(double w);
151 
152  int SetWeightParams(const TSNuiParamSet &);
153 
154 
155 private:
156 
157  bool fHasCategory;
158  bool fHasProbFunc;
159  bool fHasWeightParams;
160 
161  TSCategoryCard fCard;
162 
163  int fId;
164  double fWeight;
165  double fWeightNative;
166 
167  std::vector<double> fWeightSaved;
168 
169  TSPOTMgr fPOTMgr;
170 
171  int fNumOfVars;
172 
173  //std::map<TString,const TSVariable*> fVarPtr;
174  //std::map<TString,TSVariable *> fVarList;
175 
176  std::map<int,const TSVariable*> fVarPtr;
177  std::map<int,TSVariable *> fVarList;
178 
179  //std::map<int,TSVariable *>::const_iterator fVarListItr;
180 
181  std::map<const TSVariable*,double> fMapOfValues;
182 
183  TSNuiParamSet fNuiParSet;
184 
185  TSOscProb *fProbFunction;
186  int fIdxEne;
187  int fIdxLen;
188  double fOscillProb;
189 
190 
191  //static members
192  static int fProcChainN;
193 };
194 
195 #endif /* TSEVENT_H_ */
Definition: TSRespFunc.h:28
Definition: TSArgList.h:30
Definition: TSCategoryCard.h:27
Definition: TSVariable.h:55
Definition: TSNuiParam.h:30
void ScaleToPOT(float POT, float Power=20)
Definition: TSEvent.cc:522
Definition: TSEvent.h:43
Definition: TSNuiParamSet.h:36
Definition: TSNamed.h:38
Definition: TSEvent.h:51
Definition: TSPOTMgr.h:26
Definition: TSOscProb.h:27
int SetWeightParams(const TSNuiParamSet &)
Definition: TSEvent.cc:680