ToolDAQFramework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
WCSimReader.h
Go to the documentation of this file.
1 #ifndef WCSimReader_H
2 #define WCSimReader_H
3 
4 #include <string>
5 #include <iostream>
6 #include <sstream>
7 
8 #include "WCSimRootOptions.hh"
9 #include "WCSimRootEvent.hh"
10 #include "WCSimRootGeom.hh"
11 
12 #include "TChain.h"
13 
14 #include "Tool.h"
15 #include "TFile.h"
16 #include "TVectorT.h"
17 #include "Stopwatch.h"
18 
19 class WCSimReader: public Tool {
20 
21 
22  public:
23 
24  WCSimReader();
25  bool Initialise(std::string configfile,DataModel &data);
26  bool Execute();
27  bool Finalise();
28 
29 
30  private:
31  //methods used in Initialise
32 
34  bool ReadTree(TChain * chain);
36  bool AddTreeToChain(const char * fname, TChain * chain);
40  bool CompareTree(TChain * chain, int mode);
42  template <typename T> bool CompareVariable(T v1, T v2, const char * tag);
43 
44  //methods used in Execute
45 
48 
50  TChain * m_chain_opt;
52  TChain * m_chain_event;
54  TChain * m_chain_geom;
55 
57  WCSimRootOptions * m_wcsim_opt;
59  WCSimRootEvent * m_wcsim_event_ID;
61  WCSimRootEvent * m_wcsim_event_OD;
63  WCSimRootGeom * m_wcsim_geom;
65  WCSimRootTrigger * m_wcsim_trigger;
66 
72  long int m_n_events;
73 
74  // interpose an interval between events
75  // this allows to convert simulated data, which always start at t = 0,
76  // to look like real data in which events are separated over time
77  // have to be used with care: dark noise should be generated in WCSim for a given time window, not around physics hits
78  // units: ns
80 
82  std::string m_input_filename;
84  std::string m_input_filelist;
85 
89  std::string m_stopwatch_file;
90 
92  int m_verbose;
93 
95  std::stringstream m_ss;
96 
98  void StreamToLog(int level) {
99  Log(m_ss.str(), level, m_verbose);
100  m_ss.str("");
101  }
102 
104  enum LogLevel {FATAL=-1, ERROR=0, WARN=1, INFO=2, DEBUG1=3, DEBUG2=4, DEBUG3=5};
105 };
106 
107 
108 #endif
std::string m_input_filelist
The input WCSim filelist filename from config file.
Definition: WCSimReader.h:84
TChain * m_chain_event
Input wcsimT chain - holds WCSim events.
Definition: WCSimReader.h:52
SubSample GetDigits()
Creates a SubSample containing the digits from the current m_wcsim_trigger.
long int m_current_event_num
The current WCSim event number.
Definition: WCSimReader.h:68
util::Stopwatch * m_stopwatch
The stopwatch, if we&#39;re using one.
Definition: WCSimReader.h:87
int m_verbose
Verbosity level.
Definition: WCSimReader.h:92
float m_interpose_interval
Definition: WCSimReader.h:79
std::string m_stopwatch_file
Image filename to save the histogram to, if required.
Definition: WCSimReader.h:89
WCSimRootGeom * m_wcsim_geom
Holds geometry information - tank size, PMT size, PMT positions, etc.
Definition: WCSimReader.h:63
bool AddTreeToChain(const char *fname, TChain *chain)
Adds a file (or files - wildcards allowed) to the chain.
bool Initialise(std::string configfile, DataModel &data)
Definition: WCSimReader.cpp:7
bool Execute()
TChain * m_chain_geom
Input wcsimGeoT chain - holds WCSim geometry.
Definition: WCSimReader.h:54
LogLevel
enumeration of the log levels
Definition: WCSimReader.h:104
bool CompareVariable(T v1, T v2, const char *tag)
Checks for equality between 2 variables.
TChain * m_chain_opt
Input wcsimRootOptionsT chain - holds WCSim run options.
Definition: WCSimReader.h:50
std::stringstream m_ss
Streamer for easy formatting of log messages.
Definition: WCSimReader.h:95
WCSimRootEvent * m_wcsim_event_ID
Holds event information for the ID - tracks, hits, digits.
Definition: WCSimReader.h:59
long int m_first_event_num
The first WCSim event number to read.
Definition: WCSimReader.h:70
bool CompareTree(TChain *chain, int mode)
bool ReadTree(TChain *chain)
Calls AddTreeToChain for m_input_filename, or for every file within the m_input_filelist.
WCSimRootTrigger * m_wcsim_trigger
Holds trigger information - trigger time, digits, etc.
Definition: WCSimReader.h:65
WCSimRootEvent * m_wcsim_event_OD
Holds event information for the OD - hits, digits.
Definition: WCSimReader.h:61
void Log(const std::string &message, const int message_level)
Format messages in the same way as for tools.
Definition: Utilities.cpp:276
long int m_n_events
The total number of events in m_chain_event.
Definition: WCSimReader.h:72
WCSimRootOptions * m_wcsim_opt
Holds WCSim running options - trigger thresholds, geometry names, input .kin filename, etc.
Definition: WCSimReader.h:57
bool Finalise()
std::string m_input_filename
The input WCSim filename from config file (wildcards allowed)
Definition: WCSimReader.h:82
void StreamToLog(int level)
Helper function to print streamer at specified level, and clear streamer.
Definition: WCSimReader.h:98