MarlinTPC  1.2.0
TimePixCalibrationProcessor.h
1 #ifndef TIMEPIXCALIBRATIONPROCESSOR_H
2 #define TIMEPIXCALIBRATIONPROCESSOR_H
3 
4 // C++
5 #include <string>
6 #include <fstream>
7 
8 // LCIO
9 #include "lcio.h"
10 
11 // Marlin
12 #include "marlin/Processor.h"
13 #include "TimePixPixelMode.h"
14 #include "TimePixPixelInterpolationProcessor.h"
15 #include "TimePixCalibParam.h"
16 #include "lccd/ConditionsMap.hh"
17 
18 //AIDA
19 #include <AIDA/AIDA.h>
20 
21 namespace AIDA
22 {
23 class IHistogram2D;
24 }
25 
26 namespace marlintpc
27 {
28 
29 /* the following comment is tranfered to doxygen documentation
30  * which begins with a second asterix, or in case of on line comment an extra third slash
31  */
32 
59 class TimePixCalibrationProcessor : public marlin::Processor
60 {
61  public:
62 
63  /* This method will be called by the marlin package
64  * It returns a processor of the currend type (here TimePixCalibrationProcessor)
65  */
66  Processor* newProcessor()
67  {
68  return new TimePixCalibrationProcessor;
69  }
70 
71  /* the default constructor
72  * here the processor parameters are registered to the marlin package
73  * other initialisation should be placed in the init method
74  */
76 
77  /* Called at the begin of the job before anything is read.
78  * Use to initialize the processor, e.g. book histograms
79  */
80  void init();
81 
82  /* Called for every run.
83  * in this processor it is not used
84  */
85  void processRunHeader(lcio::LCRunHeader* run);
86 
87  /* Called for every event - the working horse.
88  * Here the real conversion take place
89  */
90  void processEvent(lcio::LCEvent* evt);
91 
92  /* Called after data processing for clean up.
93  * e.g. saving contol histograms, delete created objects
94  * (which are not stored in a collection/event), etc.
95  */
96  void end();
97 
98 
99  protected:
100 
101  /* normally the doxygen documentation is placed before the method/variable
102  * but for one line comments in case of variables is may be more convenient to you
103  * to place it after the variable. In this case you use an arrow to tell doxygen
104  * to which variable the comment belongs to.
105  */
106 
107  /* For input and output maps: 4 histograms are created in the processor for each of the chips,
108  * to compare the pixel map before and after the calibration.
109  * (for single chips only one of the histograms will be full, while the others are empty)
110  */
111  AIDA::IHistogram2D * _inputMapHisto0;
112  AIDA::IHistogram2D * _outputMapHisto0;
113  AIDA::IHistogram2D * _inputMapHisto1;
114  AIDA::IHistogram2D * _outputMapHisto1;
115  AIDA::IHistogram2D * _inputMapHisto2;
116  AIDA::IHistogram2D * _outputMapHisto2;
117  AIDA::IHistogram2D * _inputMapHisto3;
118  AIDA::IHistogram2D * _outputMapHisto3;
119 
120  std::string _inputColName;
121  std::string _inputCalibrationData;
122  std::string _outputColName;
123 
124  std::string _dataFileList;
125  std::ifstream _infile;
126 
127  int _nColumn;
128  int _nRow;
131  double _vTHL;
132 
136 
137  int _nRun;
138  int _nEvt;
139 
142  void createInputPixelMap(LCCollection* inCol);
143 
146  float calibrateTimePixel(int chipID, int pixelID, float pixelValue);
147 
150  float calibrateChargePixel(int chipID, float pixelValue);
151 
154  float interpolatePixelCharge(int chipID, int pixelID);
155 
156  tpcconddata::TimePixMap* map;
157  std::map< tpcconddata::TimePixPixelMode::PixelKey, float> inMap;
158 
159 
160  /* Called to read the calibration parameters by their index (param)
161  *
162  */
163  float getParameter(int chipID, int param);
164 
165  bool _isFirstEvent;
166  LCCollection* _vCalib;
167 
168 };
169 } // class declaration
170 #endif
171 
172 
173 
int _minNoPixelToInterpolate
Definition: TimePixCalibrationProcessor.h:130
float calibrateChargePixel(int chipID, float pixelValue)
Called to preform calibration on pixel in TOT mode (convert into electrons and add THL offset) ...
Definition: TimePixCalibrationProcessor.cc:482
int _nRun
Definition: TimePixCalibrationProcessor.h:137
double _vTHL
Definition: TimePixCalibrationProcessor.h:131
std::string _inputColName
Definition: TimePixCalibrationProcessor.h:120
int _nEvt
Definition: TimePixCalibrationProcessor.h:138
tpcconddata::TimePixMap * map
Definition: TimePixCalibrationProcessor.h:156
float interpolatePixelCharge(int chipID, int pixelID)
Called to interpolate charge for pixels in TIME mode (by using surrounding pixels in TOT mode) ...
Definition: TimePixCalibrationProcessor.cc:511
Calibration data converting Processor of the MarlinTPC package .
Definition: TimePixCalibrationProcessor.h:59
int _nColumn
Definition: TimePixCalibrationProcessor.h:127
float calibrateTimePixel(int chipID, int pixelID, float pixelValue)
Called to preform calibration on pixel in TIME mode (correct for Clock distribution & Time-Walk) ...
Definition: TimePixCalibrationProcessor.cc:447
std::string _inputCalibrationData
Definition: TimePixCalibrationProcessor.h:121
std::ifstream _infile
Definition: TimePixCalibrationProcessor.h:125
int _nParameters
Definition: TimePixCalibrationProcessor.h:129
std::string _dataFileList
Definition: TimePixCalibrationProcessor.h:124
int _nRow
Definition: TimePixCalibrationProcessor.h:128
void createInputPixelMap(LCCollection *inCol)
Called to create input map with pixel values for the interpolation (needed for Time-Walk correction) ...
Definition: TimePixCalibrationProcessor.cc:363
bool _outputIsTransient
give the status which is set to the transient flag of the output collection
Definition: TimePixCalibrationProcessor.h:135
std::string _outputColName
Definition: TimePixCalibrationProcessor.h:122