simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
TSEventDataSet.h
1 /*
2  * TSEventDataSet.h
3  *
4  * Created on: Oct 26, 2014
5  * Author: Silvestro di Luise
6  * Silvestro.Di.Luise@cern.ch
7  *
8  */
9 
10 #ifndef TSEVENTDATASET_H_
11 #define TSEVENTDATASET_H_
12 
13 #include <map>
14 #include <unordered_map>
15 
16 #include <TObjArray.h>
17 
18 #include "TSNamed.h"
19 
20 #include "TSVariable.h"
21 #include "TSSample.h"
22 #include "TSEvent.h"
23 
24 #include "TSParamList.h"
25 #include "TSNuiParamSet.h"
26 
27 #include "MessageMgr.h"
28 
29 /*
30  *
31  */
32 class TSEventDataSet: public TSNamed {
33 
34 public:
36  TSEventDataSet(TString name, TString title);
37 
38  virtual ~TSEventDataSet();
39 
40  void Add(TSEventDataSet &);
41  void AddEvent(TSEvent *);
42 
43  void AddNuiParams(TSNuiParamSet &);
44 
45  void BuildCategoryCardHisto();
46  void BuildCategoryCardMatrix();
47 
48  void Clear();
49  void ClearCategoryCardHisto();
50 
51  double ComputeEffectiveNumOfEvts();
52 
53  void ComputeWeight();
54 
55  void FillHistogram(TH1& ,int);
56  void FillHistogram(TH1& ,const TSVariable &);
57  void FillHistogram(TH2& ,const TSVariable &, const TSVariable &);
58 
59  void FillHistogramWithSelection(TH1& ,const TSVariable &, const TSCategoryCard &);
60 
61  void FillHistograms();
62  void FillHistogramsNoWeight();
63 
64  TSEvent* FindEventId(int);
65  TH1F& GetCategoryCardHisto() {return fCategCardHisto;}
66  TH2F& GetCategoryCardMatrix() {return fCategCardMatrix;}
67 
68  double GetEffectiveNumOfEvts() const {return fEffNumOfEvts;}
69 
70  int GetEntries() const {return fNumOfEvents;}
71  TSEvent* GetEvent(int);
72  TH1F& GetHistogram(const TSVariable &);
73  TH2F& GetHistogram2D(const TSVariable &, const TSVariable &);
74 
75  virtual TH1* GetHistogram();
76 
77  TSNuiParamSet& GetNuiParamSet() {return fNuiParam_Set;}
78  TSParamList& GetParamSet() {return fParamList;}
79  TSParamList& GetParamSetPoI() {return fParamList_PoI;}
80  TSParamList& GetParamSetNui() {return fParamList_Nui;}
81 
82 
83  int GetNumOfEvents() const {return fNumOfEvents;}
84 
85  TSSample& GetSample() {return fSample;}
86 
87  int GetVarIdx(TSVariable &);
88 
89  bool HasProcessComputeWeight() const {return fProcComputeWeight;}
90  bool HasProcessOscillate() const {return fProcOscillate;}
91 
92  bool HasListOfPoI() const {return fHasListOfPoI;}
93  bool HasListOfParams() const {return fHasListOfParams;}
94  bool HasWeightParams() const {return fHasWeightParams;}
95 
96 
97  void Init();
98 
99  virtual void Process();
100 
101  void ProcessEventsWith(double (TSEvent::*method)(int) );
102 
103  void Oscillate();
104 
105  void ResetHistograms();
106 
107  void ReWeightWithSavedPosition(int weight_id=-1);
108 
109  void SelectHistogram(const TSVariable &);
110  void SelectHistogram(const TSVariable &,const TSVariable &);
111 
112  void SetHistogram(const TSVariable &, int, double, double);
113  void SetHistogram(const TSVariable &, int, double *);
114  void SetHistogram(const TSVariable &, const TSVariable &, int, double *, int, double *);
115  void SetHistogram(const TSVariable &, const TSVariable &, int, double, double, int, double, double);
116  void SetHistogram(const TSVariable &, const TSVariable &, int, double , double, int, double *);
117  void SetHistogram(const TSVariable &, const TSVariable &, int, double *, int, double, double);
118 
119  void SetListOfPoI(const TSParamList&);
120 
121  void SetProcessComputeWeight(bool b) {fProcComputeWeight=b;}
122  void SetProcessOscillate(bool b) {fProcOscillate=b;}
123 
124  void SetWeightPosition(int weight_id);
125 
126  void UpdateParamList();
127 
128 private:
129 
130  int fNumOfEvents;
131  double fEffNumOfEvts;
132 
133  TObjArray fEventArray;
134 
135  TSSample fSample;
136 
137  std::map<int,int> fVarMatch;
138  std::map<const TSVariable*,const TSVariable*> fVarMatch2D;
139 
140 
141  TH1F fCategCardHisto;
142  TH2F fCategCardMatrix;
143 
144  bool fHasWeightParams;
145  std::unordered_map<TSNuiParam*,int> fNuiParam_map;
146 
147  bool fHasListOfPoI;
148  bool fHasListOfParams;
149 
150  TSNuiParamSet fNuiParam_Set;
151 
152  TSParamList fParamList;
153  TSParamList fParamList_Nui;
154  TSParamList fParamList_PoI;
155 
156  TH1* fSelectedHistogram;
157  int fSelectedHistoDim;
158  const TSVariable *fSelectedHistoVar[2];
159 
160  int fSavedWeightPosition;
161  bool fProcComputeWeight;
162  bool fProcOscillate;
163 
164 };
165 
166 #endif /* TSEVENTDATASET_H_ */
Definition: TSCategoryCard.h:27
Definition: TSParamList.h:29
Definition: TSEventDataSet.h:32
Definition: TSVariable.h:55
Definition: TSSample.h:61
Definition: TSNuiParamSet.h:36
Definition: TSNamed.h:38
Definition: TSEvent.h:51
virtual void Process()
Definition: TSEventDataSet.cc:562