ToolDAQFramework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
ReconInfo.cpp
Go to the documentation of this file.
1 #include "ReconInfo.h"
2 
3 #include <limits>
4 #include <cstdint>
5 
7 {
8  Reset();
9 }
10 
11 void ReconInfo::AddRecon(Reconstructer_t reconstructer, int trigger_num,
12  int nhits, TimeDelta time, double * vertex,
13  double goodness_of_fit, double goodness_of_time_fit,
14  bool fill_has_direction, double energy)
15 {
16  if(fill_has_direction) {
17  if(ReconInfo::ShouldProvideDirection(reconstructer)) {
18  std::cerr << "Reconstructer " << ReconInfo::EnumAsString(reconstructer) << " provides direction information but we are filling reconstruction information without it" << std::endl;
19  }
20  fHasDirection.push_back(false);
21  }
22  fReconstructer.push_back(reconstructer);
23  fTriggerNum.push_back(trigger_num);
24  fNHits.push_back(nhits);
25  fEnergy.push_back(energy);
26  fTime.push_back(time);
27  Pos3D pos;
28  pos.x = vertex[0];
29  pos.y = vertex[1];
30  pos.z = vertex[2];
31  fVertex.push_back(pos);
32  fGoodnessOfFit.push_back(goodness_of_fit);
33  fGoodnessOfTimeFit.push_back(goodness_of_time_fit);
34  fNRecons++;
36 }
37 
38 void ReconInfo::AddRecon(Reconstructer_t reconstructer, int trigger_num,
39  int nhits, TimeDelta time, double * vertex,
40  double goodness_of_fit, double goodness_of_time_fit,
41  double * direction_euler, double * cherenkov_cone,
42  double direction_likelihood, double energy)
43 {
44  AddRecon(reconstructer, trigger_num, nhits, time, vertex, goodness_of_fit, goodness_of_time_fit, false, energy);
45  fHasDirection.push_back(true);
46  DirectionEuler direct;
47  direct.theta = direction_euler[0];
48  direct.phi = direction_euler[1];
49  direct.alpha = direction_euler[2];
50  fDirectionEuler.push_back(direct);
51  CherenkovCone cone;
52  cone.cos_angle = cherenkov_cone[0];
53  cone.ellipticity = cherenkov_cone[1];
54  fCherenkovCone.push_back(cone);
55  fDirectionLikelihood.push_back(direction_likelihood);
56 }
57 
58 void ReconInfo::AddReconFrom(ReconInfo * in, const int irecon)
59 {
60  fReconstructer.push_back(in->GetReconstructer(irecon));
61  fTriggerNum.push_back(in->GetTriggerNum(irecon));
62  fNHits.push_back(in->GetNHits(irecon));
63  fEnergy.push_back(in->GetEnergy(irecon));
64  fTime.push_back(in->GetTime(irecon));
65  fVertex.push_back(in->GetVertex(irecon));
66  fGoodnessOfFit.push_back(in->GetGoodnessOfFit(irecon));
67  fGoodnessOfTimeFit.push_back(in->GetGoodnessOfTimeFit(irecon));
68  fHasDirection.push_back(in->GetHasDirection(irecon));
69  if(in->GetHasDirection(irecon)) {
70  fDirectionEuler.push_back(in->GetDirectionEuler(irecon));
71  fCherenkovCone.push_back(in->GetCherenkovCone(irecon));
72  fDirectionLikelihood.push_back(in->GetDirectionLikelihood(irecon));
73  }
74  fNRecons++;
75  UpdateTimeBoundaries(in->GetTime(irecon));
76 }
77 
79 {
80  switch(r) {
81  case (kReconBONSAI):
82  return "BONSAI";
83  break;
85  return "TestVertices_NoDirection";
86  break;
87  case (kReconTestVertices):
88  return "TestVertices";
89  break;
91  return "Random_NoDirection";
92  break;
93  case (kReconRandom):
94  return "Random";
95  break;
96  default:
97  return "";
98  }
99  return "";
100 }
101 
103 {
104  for(int i = int(kReconUndefined)+1; i <= kReconRandom; i++) {
105  if(s.compare(ReconInfo::EnumAsString((Reconstructer_t)i)) == 0) {
106  return (Reconstructer_t)i;
107  }
108  }
109  std::cerr << "ReconInfo::ReconstructerFromString() Unknown string value " << s << std::endl;
110  return kReconUndefined;
111 }
112 
114 {
115  switch(w) {
116  case (kNClustersStandard):
117  return "NoNClustersWarning";
118  break;
119  case (kNClustersSilent):
120  return "NClustersSilentWarning";
121  break;
122  case (kNClustersNormal):
123  return "NClustersNormalWarning";
124  break;
125  case (kNClustersGolden):
126  return "NClustersGoldenWarning";
127  break;
128  default:
129  return "";
130  }
131  return "";
132 }
133 
135 {
136  for(int i = int(kNClustersUndefined)+1; i <= kNClustersGolden; i++) {
137  if(s.compare(ReconInfo::EnumAsString((NClustersWarning_t)i)) == 0) {
138  return (NClustersWarning_t)i;
139  }
140  }
141  std::cerr << "ReconInfo::NClustersWarningFromString() Unknown string value " << s << std::endl;
142  return kNClustersUndefined;
143 }
144 
146 {
147  switch(w) {
148  case (kSNWarningStandard):
149  return "NoSupernovaWarning";
150  break;
151  case (kSNWarningSilent):
152  return "SupernovaSilentWarning";
153  break;
154  case (kSNWarningNormal):
155  return "SupernovaNormalWarning";
156  break;
157  case (kSNWarningGolden):
158  return "SupernovaGoldenWarning";
159  break;
160  default:
161  return "";
162  }
163  return "";
164 }
165 
167 {
168  for(int i = int(kSNWarningUndefined)+1; i <= kSNWarningGolden; i++) {
169  if(s.compare(ReconInfo::EnumAsString((SNWarning_t)i)) == 0) {
170  return (SNWarning_t)i;
171  }
172  }
173  std::cerr << "ReconInfo::SNWarningFromString() Unknown string value " << s << std::endl;
174  return kSNWarningUndefined;
175 }
176 
178 {
179  switch(r) {
180  case(kReconBONSAI):
181  case(kReconTestVertices):
182  case(kReconRandom):
183  return true;
184  break;
185  default:
186  return false;
187  }
188  return false;
189 }
190 
192 {
193  fNRecons = 0;
194  fFirstTime = std::numeric_limits<TimeDelta::long_time_t>::max() * TimeDelta::s_long_time_unit;
195  fLastTime = std::numeric_limits<TimeDelta::long_time_t>::min() * TimeDelta::s_long_time_unit;
196  //event
197  fReconstructer.clear();
198  fTriggerNum.clear();
199  fNHits.clear();
200  fEnergy.clear();
201  //vertex
202  fTime.clear();
203  fVertex.clear();
204  fGoodnessOfFit.clear();
205  fGoodnessOfTimeFit.clear();
206  //direction
207  fHasDirection.clear();
208  fDirectionEuler.clear();
209  fCherenkovCone.clear();
210  fDirectionLikelihood.clear();
211 }
212 
214 {
215  if(time < fFirstTime)
216  fFirstTime = time;
217  if(time > fLastTime)
218  fLastTime = time;
219 }
enum EReconstructers Reconstructer_t
Pos3D GetVertex(int irecon)
Definition: ReconInfo.h:93
std::vector< Pos3D > fVertex
Definition: ReconInfo.h:119
TimeDelta fLastTime
Definition: ReconInfo.h:109
TimeDelta GetTime(int irecon)
Definition: ReconInfo.h:92
void UpdateTimeBoundaries(TimeDelta time)
Definition: ReconInfo.cpp:213
int fNRecons
Definition: ReconInfo.h:107
static bool ShouldProvideDirection(Reconstructer_t r)
Definition: ReconInfo.cpp:177
double cos_angle
Definition: ReconInfo.h:48
DirectionEuler GetDirectionEuler(int irecon)
Definition: ReconInfo.h:98
CherenkovCone GetCherenkovCone(int irecon)
Definition: ReconInfo.h:99
static constexpr double s_long_time_unit
Relative unit of long time member, i.e. long_unit / short_unit, both ns so = 1.
Definition: TimeDelta.h:47
Reconstructer_t GetReconstructer(int irecon)
Definition: ReconInfo.h:87
double y
Definition: ReconInfo.h:37
std::vector< bool > fHasDirection
Definition: ReconInfo.h:124
enum NClustersWarnings NClustersWarning_t
std::vector< Reconstructer_t > fReconstructer
Definition: ReconInfo.h:112
void AddReconFrom(ReconInfo *in, const int irecon)
Definition: ReconInfo.cpp:58
std::vector< int > fNHits
Definition: ReconInfo.h:114
TimeDelta fFirstTime
Definition: ReconInfo.h:108
static Reconstructer_t ReconstructerFromString(std::string s)
Definition: ReconInfo.cpp:102
double GetGoodnessOfFit(int irecon)
Definition: ReconInfo.h:94
double GetDirectionLikelihood(int irecon)
Definition: ReconInfo.h:100
std::vector< DirectionEuler > fDirectionEuler
Definition: ReconInfo.h:125
double phi
Definition: ReconInfo.h:43
int GetTriggerNum(int irecon)
Definition: ReconInfo.h:88
int GetNHits(int irecon)
Definition: ReconInfo.h:89
std::vector< double > fDirectionLikelihood
Definition: ReconInfo.h:127
static NClustersWarning_t NClustersWarningFromString(std::string s)
Definition: ReconInfo.cpp:134
std::vector< double > fGoodnessOfTimeFit
Definition: ReconInfo.h:121
double x
Definition: ReconInfo.h:37
static SNWarning_t SNWarningFromString(std::string s)
Definition: ReconInfo.cpp:166
void Reset()
Definition: ReconInfo.cpp:191
double z
Definition: ReconInfo.h:37
enum SNWarnings SNWarning_t
double GetGoodnessOfTimeFit(int irecon)
Definition: ReconInfo.h:95
std::vector< double > fEnergy
Definition: ReconInfo.h:115
bool GetHasDirection(int irecon)
Definition: ReconInfo.h:97
std::vector< int > fTriggerNum
Definition: ReconInfo.h:113
static std::string EnumAsString(Reconstructer_t r)
Definition: ReconInfo.cpp:78
std::vector< TimeDelta > fTime
Definition: ReconInfo.h:118
void AddRecon(Reconstructer_t reconstructer, int trigger_num, int nhits, TimeDelta time, double *vertex, double goodness_of_fit, double goodness_of_time_fit, bool fill_has_direction=true, double energy=-1.)
Definition: ReconInfo.cpp:11
std::vector< CherenkovCone > fCherenkovCone
Definition: ReconInfo.h:126
double GetEnergy(int irecon)
Definition: ReconInfo.h:90
double theta
Definition: ReconInfo.h:43
double alpha
Definition: ReconInfo.h:43
std::vector< double > fGoodnessOfFit
Definition: ReconInfo.h:120
double ellipticity
Definition: ReconInfo.h:48