1 | #ifndef CSV_H
|
---|
2 | #define CSV_H
|
---|
3 |
|
---|
4 |
|
---|
5 | // SYSTEM INCLUDES
|
---|
6 | #include <iostream>
|
---|
7 | #include <fstream>
|
---|
8 | #include <stdlib.h>
|
---|
9 | //
|
---|
10 |
|
---|
11 | // PROJECT INCLUDES
|
---|
12 | #include <TROOT.h>
|
---|
13 | #include <TH1F.h>
|
---|
14 | #include <TString.h>
|
---|
15 | //
|
---|
16 |
|
---|
17 | // LOCAL INCLUDES
|
---|
18 | #include "pulse.h"
|
---|
19 | #include "pixel.h"
|
---|
20 | #include "pixelsum.h"
|
---|
21 | //
|
---|
22 |
|
---|
23 | // FORWARD REFERENCES
|
---|
24 | //
|
---|
25 |
|
---|
26 | /** Assignment operator.
|
---|
27 | * @todo do me
|
---|
28 | * @warning not implemented
|
---|
29 | * @param from THe value to assign to this object.
|
---|
30 | *
|
---|
31 | * @return A reference to this object.
|
---|
32 | */
|
---|
33 |
|
---|
34 | /**
|
---|
35 | */
|
---|
36 |
|
---|
37 | class Csv
|
---|
38 | {
|
---|
39 | public:
|
---|
40 |
|
---|
41 | // LIFECYCLE
|
---|
42 |
|
---|
43 | /** Default constructor.
|
---|
44 | */
|
---|
45 | Csv(TString path, TString fileName);
|
---|
46 | Csv(TString path, TString fileName, int verbLevel);
|
---|
47 | Csv(TString path, TString fileName, TString suffix, int verbLevel);
|
---|
48 |
|
---|
49 |
|
---|
50 | // /** Copy constructor.
|
---|
51 | // *
|
---|
52 | // * @param from The value to copy to this object.
|
---|
53 | // */
|
---|
54 | /** Destructor.
|
---|
55 | */
|
---|
56 | ~Csv();
|
---|
57 |
|
---|
58 |
|
---|
59 | // OPERATORS
|
---|
60 |
|
---|
61 | /** Assignment operator.
|
---|
62 | *
|
---|
63 | * @param from THe value to assign to this object.
|
---|
64 | *
|
---|
65 | * @return A reference to this object.
|
---|
66 | */
|
---|
67 | // XX& operator=(const XX& from);
|
---|
68 |
|
---|
69 | // OPERATIONS
|
---|
70 | private:
|
---|
71 | /*! \brief Built the path to the CSV file */
|
---|
72 | void BuildPath();
|
---|
73 | /*! \brief close the CSV file */
|
---|
74 | void CloseCsv();
|
---|
75 | /*! \brief open the CSV file */
|
---|
76 | void OpenCsv();
|
---|
77 | public:
|
---|
78 | /*! \brief Write the point set and according header of an fitted pulse to CSV
|
---|
79 | * calls WritePointSetHeader() and WritePointSet()
|
---|
80 | * \param pixel Datatype Pixel, containing all pulse histograms of a Pixel
|
---|
81 | * \param overlayMethod chosen overlaymethod
|
---|
82 | * \param order pulse order aka quantity of photons in signal
|
---|
83 | */
|
---|
84 | bool WritePointSetToCsv(
|
---|
85 | Pixel* pixel,
|
---|
86 | TString overlayMethod,
|
---|
87 | int order
|
---|
88 | );
|
---|
89 | /*! \brief Write header of the point set to CSV */
|
---|
90 | void WritePointSetHeader();
|
---|
91 | /*! \brief Write the point set of an fitted pulse to CSV
|
---|
92 | * \param pixel Datatype Pixel, containing all pulse histograms of a Pixel
|
---|
93 | * \param overlayMethod chosen overlaymethod
|
---|
94 | * \param order pulse order aka quantity of photons in signal
|
---|
95 | */
|
---|
96 | void WritePointSet(
|
---|
97 | Pixel* pixel,
|
---|
98 | TString overlayMethod,
|
---|
99 | int order
|
---|
100 | );
|
---|
101 | /*! \brief Write header of the pulse parameters to CSV */
|
---|
102 | void WritePulseAttributesHeader();
|
---|
103 | /*! \brief Write parameters from pulse fit to CSV
|
---|
104 | * \param pixel Datatype Pixel, containing all pulse histograms of a Pixel
|
---|
105 | * \param pulse Datatype Pulse, containing pulse fit of a Pixel
|
---|
106 | * \param overlayMethod chosen overlaymethod
|
---|
107 | * \param order pulse order aka quantity of photons in signal
|
---|
108 | */
|
---|
109 | void WritePulseAttributes(
|
---|
110 | Pixel* pixel,
|
---|
111 | Pulse* pulse,
|
---|
112 | TString overlayMethod,
|
---|
113 | int order
|
---|
114 | );
|
---|
115 |
|
---|
116 | // ACCESS
|
---|
117 | public:
|
---|
118 | /*! \brief Get the filename of the CSV file */
|
---|
119 | TString GetFilename();
|
---|
120 | /*! \brief Get the path to the CSV file */
|
---|
121 | TString GetPath();
|
---|
122 | /*! \brief Get the verbosity Level of the CSV file */
|
---|
123 | int GetVerbLevel(){return mVerbLevel;}
|
---|
124 | /*! \brief Set the verbosity Level of the CSV file */
|
---|
125 | void SetVerbLevel(int verbLevel){mVerbLevel = verbLevel;}
|
---|
126 | /*! \brief Get the column seperator of the CSV file */
|
---|
127 | TString GetSeparator(){return mSeparator;}
|
---|
128 | /*! \brief Set the column seperator of the CSV file */
|
---|
129 | void SetSeparator(TString separator){mSeparator = separator;}
|
---|
130 | /*! \brief Get ofstream's floating-point decimal precision */
|
---|
131 | int GetPrecision(){return mPrecision;}
|
---|
132 | /*! \brief Set ofstream's floating-point decimal precision */
|
---|
133 | void SetPrecision(int precision){mPrecision = precision;}
|
---|
134 |
|
---|
135 | // INQUIRY
|
---|
136 | private:
|
---|
137 | /*! directory to save csv files */
|
---|
138 | TString mDirectory;
|
---|
139 | /*! csv's filename */
|
---|
140 | TString mFilename;
|
---|
141 | /*! csv's filename suffix */
|
---|
142 | TString mSuffix;
|
---|
143 | /*! path to the CSV file */
|
---|
144 | TString mPath;
|
---|
145 | /*! csv file outstream */
|
---|
146 | ofstream mCsvFile;
|
---|
147 | /*! verbosity Level */
|
---|
148 | int mVerbLevel;
|
---|
149 | /*! column separator in csv file */
|
---|
150 | TString mSeparator;
|
---|
151 | /*! ofstream's floating-point decimal precision */
|
---|
152 | int mPrecision;
|
---|
153 | };
|
---|
154 |
|
---|
155 | #endif // CSV_H
|
---|