ToolDAQFramework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
ReconDataIn.cpp
Go to the documentation of this file.
1 #include "ReconDataIn.h"
2 
4 
5 
6 bool ReconDataIn::Initialise(std::string configfile, DataModel &data){
7 
8  if(configfile!="") m_variables.Initialise(configfile);
9  //m_variables.Print();
10 
11  m_verbose = 0;
12  m_variables.Get("verbose", m_verbose);
13 
14  //Setup and start the stopwatch
15  bool use_stopwatch = false;
16  m_variables.Get("use_stopwatch", use_stopwatch);
17  m_stopwatch = use_stopwatch ? new util::Stopwatch("ReconDataIn") : 0;
18 
19  m_stopwatch_file = "";
20  m_variables.Get("stopwatch_file", m_stopwatch_file);
21 
23 
24  m_data= &data;
25 
26  //get the filename(s)
27  std::string infilestr;
28  if(! m_variables.Get("infilenames", infilestr)) {
29  Log("ERROR: infilenames configuration not found. Cancelling initialisation", ERROR, m_verbose);
30  return false;
31  }
32  //TODO add ability to get filelist, like WCSimReader() - need to take functions out of there & put into a general utilties file? Library? namespace?`
33 
34  //open the chain
35  fTreeRecon = new TChain("reconTree");
36  fTreeRecon->Add(infilestr.c_str());
37 
38  //setup the branches
39  //fTreeRecon->SetBranchAddress("EventNum", &fEvtNum); //Not usde
40  fTreeRecon->SetBranchAddress("TriggerNum", &fRTTriggerNum);
41  fTreeRecon->SetBranchAddress("NDigits", &fRTNHits);
42  fTreeRecon->SetBranchAddress("Energy", &fRTEnergy);
43  fTreeRecon->SetBranchAddress("Reconstructer", &fRTReconstructerInt);
44  fTreeRecon->SetBranchAddress("Time", &fRTTime);
45  fTreeRecon->SetBranchAddress("Vertex", fRTVertex);
46  fTreeRecon->SetBranchAddress("GoodnessOfFit", &fRTGoodnessOfFit);
47  fTreeRecon->SetBranchAddress("GoodnessOfTimeFit", &fRTGoodnessOfTimeFit);
48  fTreeRecon->SetBranchAddress("HasDirection", &fRTHasDirection);
49  fTreeRecon->SetBranchAddress("DirectionEuler", fRTDirectionEuler);
50  fTreeRecon->SetBranchAddress("CherenkovCone", fRTCherenkovCone);
51  fTreeRecon->SetBranchAddress("DirectionLikelihood", &fRTDirectionLikelihood);
52 
53  if(m_stopwatch) Log(m_stopwatch->Result("Initialise"), INFO, m_verbose);
54 
55  return true;
56 }
57 
58 
61 
62  const int nrecons = fTreeRecon->GetEntries();
63  ss << "DEBUG: Reading the result of " << nrecons << " reconstructions";
65  for(int irecon = 0; irecon < nrecons; irecon++) {
66  fTreeRecon->GetEntry(irecon);
67 
68  if(fRTHasDirection) {
71  }
72  else {
74  }
75  }//irecon
76 
77  //All data in the chain is put into RecoInfo
78  // Therefore only need to call Execute() once
79  // Therefore set this data member appropriately
80  m_data->vars.Set("StopLoop",1);
81 
83 
84  return true;
85 }
86 
87 
89  if(m_stopwatch) {
91  m_stopwatch->Start();
92  }
93 
94  delete fTreeRecon;
95 
96  if(m_stopwatch) {
97  Log(m_stopwatch->Result("Finalise"), INFO, m_verbose);
98  delete m_stopwatch;
99  }
100 
101  return true;
102 }
enum EReconstructers Reconstructer_t
std::string Result(std::string method_name, std::string output_file="")
Definition: Stopwatch.cpp:38
TChain * fTreeRecon
Definition: ReconDataIn.h:23
util::Stopwatch * m_stopwatch
The stopwatch, if we&#39;re using one.
Definition: ReconDataIn.h:39
bool Execute()
Definition: ReconDataIn.cpp:59
void Start()
Start the stopwatch.
Definition: Stopwatch.cpp:18
StopwatchTimes Stop()
Stop the stopwatch, returning the CPU time.
Definition: Stopwatch.cpp:24
bool fRTHasDirection
Definition: ReconDataIn.h:31
double fRTGoodnessOfTimeFit
Definition: ReconDataIn.h:36
void StreamToLog(int level)
Definition: ReconDataIn.h:47
double fRTCherenkovCone[2]
Definition: ReconDataIn.h:33
double fRTGoodnessOfFit
Definition: ReconDataIn.h:35
bool Initialise(std::string configfile, DataModel &data)
Definition: ReconDataIn.cpp:6
std::string m_stopwatch_file
Image filename to save the histogram to, if required.
Definition: ReconDataIn.h:41
double fRTEnergy
Definition: ReconDataIn.h:27
double fRTDirectionEuler[3]
Definition: ReconDataIn.h:32
std::stringstream ss
Definition: ReconDataIn.h:45
int fRTReconstructerInt
Definition: ReconDataIn.h:28
void Log(const std::string &message, const int message_level)
Format messages in the same way as for tools.
Definition: Utilities.cpp:276
int fRTTriggerNum
Definition: ReconDataIn.h:25
double fRTDirectionLikelihood
Definition: ReconDataIn.h:34
double fRTTime
Definition: ReconDataIn.h:29
bool Finalise()
Definition: ReconDataIn.cpp:88
double fRTVertex[4]
Definition: ReconDataIn.h:30