8 if(configfile!=
"") m_variables.Initialise(configfile);
15 bool use_stopwatch =
false;
16 m_variables.Get(
"use_stopwatch", use_stopwatch);
44 float out_vertex[3]={0,0,0};
45 float out_direction[6]={0,0,0,0,0,0};
46 float out_cosine[3]={0,0,0};
47 float out_maxlike[3]={0,0,0};
48 double dout_vertex[3]={0,0,0};
49 double dout_direction[3]={0,0,0};
50 double dout_cone[2]={0,0};
52 unsigned int num_triggers = m_data->IDTriggers.m_num_triggers;
53 std::vector<std::vector<float> > info = m_data->IDTriggers.m_info;
56 for (
int itrigger = 0; itrigger < num_triggers; itrigger++) {
61 std::vector<float> the_info = info[itrigger];
64 for(std::vector<SubSample>::iterator is = m_data->IDSamples.begin(); is != m_data->IDSamples.end(); ++is){
67 const size_t nhits_in_subsample = is->m_time.size();
70 for(
size_t ihit = is->m_first_unique; ihit < nhits_in_subsample; ihit++) {
72 if(std::find(is->m_trigger_readout_windows[ihit].begin(),
73 is->m_trigger_readout_windows[ihit].end(),
74 itrigger) == is->m_trigger_readout_windows[ihit].end())
78 m_ss <<
"DEBUG: Hit " << ihit <<
" at time " << is->m_time[ihit];
81 m_in_Ts ->push_back(is->m_time[ihit]);
82 m_in_Qs ->push_back(is->m_charge[ihit]);
91 m_ss <<
"INFO: " <<
m_in_nhits <<
" hits in current trigger. Not running test vertices reconstruction";
96 m_ss <<
"DEBUG: test vertices reconstruction running over " <<
m_in_nhits <<
" hits";
98 m_ss <<
"DEBUG: First hit time relative to sample: " <<
m_in_Ts->at(0);
101 bool success =
false;
102 int ninfos = the_info.size();
106 out_vertex[0] = the_info[1];
107 out_vertex[1] = the_info[2];
108 out_vertex[2] = the_info[3];
109 out_cosine[0] = the_info[4];
110 out_cosine[1] = the_info[5];
111 out_cosine[2] = the_info[6];
118 out_direction[0] = atan2(sqrt(pow(out_cosine[0],2) + pow(out_cosine[1],2)),out_cosine[2]);
119 out_direction[1] = atan2(out_cosine[1],out_cosine[0]);
120 out_direction[2] = 0;
122 m_ss <<
"INFO: warning: unexpected trigger info structure: " << ninfos <<
" info entries ";
127 m_ss <<
"DEBUG: vertex reconstructed at x, y, z:";
128 for(
int i = 0; i < 3; i++) {
129 m_ss <<
" " << out_vertex[i] <<
",";
131 m_ss <<
"DEBUG: reconstructed euler angles:";
132 for(
int i = 0; i < 3; i++) {
133 m_ss <<
" " << out_direction[i] <<
",";
139 for(
int i = 0; i < 3; i++) {
140 dout_vertex[i] = out_vertex[i];
141 dout_direction[i] = out_direction[i];
144 TimeDelta vertex_time = m_data->IDTriggers.m_trigger_time.at(itrigger);
146 vertex_time, &(dout_vertex[0]), out_maxlike[2], out_maxlike[1],
147 &(dout_direction[0]), &(dout_cone[0]), out_direction[5]);
std::string Result(std::string method_name, std::string output_file="")
std::vector< float > * m_in_Qs
Charges of hits in a trigger.
void Start()
Start the stopwatch.
StopwatchTimes Stop()
Stop the stopwatch, returning the CPU time.
bool Execute()
Executre function used to perform Tool perpose.
bool Initialise(std::string configfile, DataModel &data)
Initialise Function for setting up Tool resorces.
util::Stopwatch * m_stopwatch
The stopwatch, if we're using one.
bool Finalise()
Finalise funciton used to clean up resorces.
int m_verbose
Verbosity level, as defined in tool parameter file.
std::vector< int > * m_in_PMTIDs
PMT IDs of hits in a trigger.
unsigned int m_nhits_max
Above this number of hits in a trigger, don't run BONSAI. Equality is run. Set in config file...
std::vector< float > * m_in_Ts
Times of hits in a trigger.
std::string m_stopwatch_file
Image filename to save the histogram to, if required.
int m_in_nhits
Number of hits in a trigger.
test_vertices_reconstruction()
Simple constructor.
void Log(const std::string &message, const int message_level)
Format messages in the same way as for tools.
std::stringstream m_ss
For easy formatting of Log messages.
void StreamToLog(int level)