CFEL - ASG Software Suite  2.5.0
CASS
root_converter.h
Go to the documentation of this file.
1 // Copyright (C) 2010 Lutz Foucar
2 
3 /**
4  * @file root_converter.h file contains declaration of processor 2000
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _ROOT_CONVERTER_H_
10 #define _ROOT_CONVERTER_H_
11 
12 #include <string>
13 
14 #include "processor.h"
15 
16 class TFile;
17 
18 namespace cass
19 {
20 /** root file converter
21  *
22  * @PPList "2000": Writes histograms to root file
23  *
24  * will convert all histograms defined in cass to root histograms and write
25  * them to a root file. Filename can be chosen with the -o parameter at
26  * program start.
27  *
28  * @cassttng Processor/\%name\%/{FileName} \n
29  * The name of the output root file. Default is "output.root"
30  * @cassttng Processor/\%name\%/Processor/{size} \n
31  * How many Processors should be written to the root file.
32  * @cassttng Processor/\%name\%/Processor/\%id\%/{Name} \n
33  * Name of the Processor that should be written into the root file.
34  * Default is "unknown"
35  * @cassttng Processor/\%name\%/Processor/\%id\%/{GroupName} \n
36  * Name of the group in the h5 file into which the Processor
37  * should be written into. Default is "/". Note that the eventid will
38  * be prepended to the Name given here.
39  * @cassttng Processor/\%name\%/Processor/\%id\%/{ValName} \n
40  * Name that the data should have in the root file. Default is the
41  * name of the Processor.
42  * @cassttng Processor/\%name\%/ProcessorSummary/size \n
43  * How many Processors should be written to the root file.
44  * @cassttng Processor/\%name\%/ProcessorSummary/\%id\%/{Name} \n
45  * Name of the Processor that should be written into the root file.
46  * Default is "unknown"
47  * @cassttng Processor/\%name\%/ProcessorSummary/\%id\%/{GroupName} \n
48  * Name of the group in the root file into which the Processor
49  * should be written into. Default is "/"
50  * @cassttng Processor/\%name\%/ProcessorSummary/\%id\%/{ValName} \n
51  * Name that the data should have in the root file. Default is the
52  * name of the Processor.
53  *
54  * @author Lutz Foucar
55  */
56 class pp2000 : public Processor
57 {
58 public:
59  /** struct bundleing info for writing an entry to file
60  *
61  * @author Lutz Foucar
62  */
63  struct entry_t
64  {
65  /** constructor
66  *
67  * @param _name the name of the value in the file
68  * @param _groupname the group where the data will be written to
69  * @param _pp the processor holding the data to be written
70  */
71  entry_t(const std::string &_name,
72  const std::string &_groupname,
73  shared_pointer _pp)
74  : name(_name), groupname(_groupname),pp(_pp)
75  {}
76 
77  /** name of the value in the file */
78  std::string name;
79 
80  /** group where the data will be written to */
81  std::string groupname;
82 
83  /** processor holding the data to be written */
85  };
86 
87  /** Construct processor for converting histograms to root histograms */
88  pp2000(const name_t&name);
89 
90  /** only a stub does nothing, but needs to be there because its pure virtual in base class */
91  virtual void processEvent(const CASSEvent&);
92 
93  /** load the settings of this pp */
94  virtual void loadSettings(size_t);
95 
96  /** dump all histogram to a root file just before quitting */
97  virtual void aboutToQuit();
98 
99  /** overwrite the retrieval of an histogram */
100  virtual const result_t& result(const CASSEvent::id_t eventid=0);
101 
102  /** overwrite the release */
103  virtual void releaseEvent(const CASSEvent &){}
104 
105 protected:
106  /** the root filename where we store the data in */
107  std::string _rootfilename;
108 
109  /** container with all pps that contain the histograms to dump to hdf5 */
110  std::list<entry_t> _ppList;
111 
112  /** container for all pps that should be written when program quits */
113  std::list<entry_t> _ppSummaryList;
114 
115  /** the root file */
116  TFile * _rootfile;
117 
118 private:
119  /** a lock to make the process reentrant */
121 };
122 }//end namespace cass
123 
124 #endif
shared_pointer pp
processor holding the data to be written
Event to store all LCLS Data.
Definition: cass_event.h:32
const name_t name() const
retrieve the name of this processor
Definition: processor.h:167
check if FEL is off by checking for bykick which is eventid
root file converter
uint64_t id_t
define the id type
Definition: cass_event.h:52
QMutex _lock
a lock to make the process reentrant
std::string _rootfilename
the root filename where we store the data in
virtual void releaseEvent(const CASSEvent &)
overwrite the release
base class for processors.
Definition: processor.h:39
std::list< entry_t > _ppSummaryList
container for all pps that should be written when program quits
std::string groupname
group where the data will be written to
std::list< entry_t > _ppList
container with all pps that contain the histograms to dump to hdf5
entry_t(const std::string &_name, const std::string &_groupname, shared_pointer _pp)
constructor
pp2000(const name_t &name)
Construct processor for converting histograms to root histograms.
virtual void processEvent(const CASSEvent &)
only a stub does nothing, but needs to be there because its pure virtual in base class ...
file contains processors baseclass declaration
virtual const result_t & result(const CASSEvent::id_t eventid=0)
overwrite the retrieval of an histogram
const name_t _name
the processors name
Definition: processor.h:259
virtual void loadSettings(size_t)
load the settings of this pp
TFile * _rootfile
the root file
std::string name_t
define the name type
Definition: processor.h:46
std::tr1::shared_ptr< Processor > shared_pointer
a shared pointer of this
Definition: processor.h:43
virtual void aboutToQuit()
dump all histogram to a root file just before quitting
std::string name
name of the value in the file
struct bundleing info for writing an entry to file