ToolDAQFramework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
DataOut.h
Go to the documentation of this file.
1 #ifndef DataOut_H
2 #define DataOut_H
3 
4 #include <string>
5 #include <iostream>
6 #include <map>
7 
8 #include "WCSimRootEvent.hh"
9 #include "WCSimRootGeom.hh"
10 #include "WCSimRootOptions.hh"
11 
12 #include "TFile.h"
13 #include "TTree.h"
14 
15 #include "Tool.h"
16 #include "TimeDelta.h"
17 #include "Stopwatch.h"
18 
19 class DataOut: public Tool {
20 
21 
22  public:
23 
24  DataOut();
25  bool Initialise(std::string configfile,DataModel &data);
26  bool Execute();
27  bool Finalise();
28 
29 
30  private:
32  void ExecuteSubDet(WCSimRootEvent * wcsim_event, std::vector<SubSample> & samples, WCSimRootEvent * original_wcsim_event = 0);
36  void CreateSubEvents(WCSimRootEvent * wcsim_event);
37  //Get the WCSim "date", used later to give the hits the correct absolute time.
38  // Also add the trigger offset from the config file
39  TimeDelta GetOffset(WCSimRootEvent * original_wcsim_event = 0);
42  void FillHits(WCSimRootEvent * wcsim_event, std::vector<SubSample> & samples);
46  void AddTruthInfo(WCSimRootEvent * wcsim_event, WCSimRootEvent * original_wcsim_event, const TimeDelta & time_shift);
47  //Set some trigger header infromation that requires all the hits to be
48  // present to calculate e.g. sumq
49  void FinaliseSubEvents(WCSimRootEvent * wcsim_event);
50 
52  std::string m_output_filename;
54  TFile * m_output_file;
56  TTree * m_event_tree;
58  WCSimRootEvent * m_id_wcsimevent_triggered;
60  WCSimRootEvent * m_od_wcsimevent_triggered;
61 
66 
69 
74 
78  std::string m_stopwatch_file;
79 
81  int m_verbose;
82 
84  std::stringstream m_ss;
85 
88  void StreamToLog(int level) {
89  Log(m_ss.str(), level, m_verbose);
90  m_ss.str("");
91  }
92 
94  enum LogLevel {FATAL=-1, ERROR=0, WARN=1, INFO=2, DEBUG1=3, DEBUG2=4, DEBUG3=5};
95 };
96 
97 
98 #endif
bool Finalise()
Definition: DataOut.cpp:409
std::string m_stopwatch_file
Image filename to save the histogram to, if required.
Definition: DataOut.h:78
void CreateSubEvents(WCSimRootEvent *wcsim_event)
Definition: DataOut.cpp:185
std::stringstream m_ss
For easy formatting of Log messages.
Definition: DataOut.h:84
void FillHits(WCSimRootEvent *wcsim_event, std::vector< SubSample > &samples)
Definition: DataOut.cpp:231
WCSimRootEvent * m_od_wcsimevent_triggered
Output ROOT event structure for OD.
Definition: DataOut.h:60
int m_event_num
Current event number.
Definition: DataOut.h:68
TTree * m_event_tree
Tree contain WCSimRootEvent(s), and the original WCSim filename / event number.
Definition: DataOut.h:56
bool Execute()
Definition: DataOut.cpp:111
TimeDelta m_trigger_offset
A time used to offset all hit times. Set by config file.
Definition: DataOut.h:65
TFile * m_output_file
Output ROOT file.
Definition: DataOut.h:54
bool Initialise(std::string configfile, DataModel &data)
Definition: DataOut.cpp:6
TriggerInfo * m_all_triggers
Combined list of triggers from all sources (ID+OD)
Definition: DataOut.h:63
bool m_save_multiple_hits_per_trigger
If false, only 1 hit is allowed to be saved per trigger, rather than all hits from that trigger...
Definition: DataOut.h:73
void FinaliseSubEvents(WCSimRootEvent *wcsim_event)
Definition: DataOut.cpp:384
void AddTruthInfo(WCSimRootEvent *wcsim_event, WCSimRootEvent *original_wcsim_event, const TimeDelta &time_shift)
Definition: DataOut.cpp:272
void ExecuteSubDet(WCSimRootEvent *wcsim_event, std::vector< SubSample > &samples, WCSimRootEvent *original_wcsim_event=0)
Runs other methods to take information from the DataModel and create/populate the WCSimRootEvent...
Definition: DataOut.cpp:155
TimeDelta GetOffset(WCSimRootEvent *original_wcsim_event=0)
Definition: DataOut.cpp:205
int m_verbose
Verbosity level, as defined in tool parameter file.
Definition: DataOut.h:81
void Log(const std::string &message, const int message_level)
Format messages in the same way as for tools.
Definition: Utilities.cpp:276
WCSimRootEvent * m_id_wcsimevent_triggered
Output ROOT event structure for ID.
Definition: DataOut.h:58
LogLevel
Log level enumerations.
Definition: DataOut.h:94
DataOut()
Definition: DataOut.cpp:3
void StreamToLog(int level)
Definition: DataOut.h:88
util::Stopwatch * m_stopwatch
The stopwatch, if we&#39;re using one.
Definition: DataOut.h:76
bool m_save_only_failed_hits
If true, saves hits that failed the trigger, rather those that passed.
Definition: DataOut.h:71
std::string m_output_filename
Output ROOT filename that this tool RECREATE&#39;s.
Definition: DataOut.h:52