MarlinTPC  1.2.0
TimePixXYReaderProcessor.h
1 #ifndef TimePixXYReaderProcessor_h
2 #define TimePixXYReaderProcessor_h 1
3 
4 
5 // Marlin
6 #include "marlin/DataSourceProcessor.h"
7 
8 // STD C++
9 #include <fstream>
10 #include <string>
11 #include <cstdlib>
12 #include <sys/stat.h>
13 
14 
15 // Forward declarations
16 namespace IMPL{
17 
18  class LCCollectionVec;
19 }
20 
21 
22 
23 namespace marlin{
24 
76  class TimePixXYReaderProcessor : public DataSourceProcessor {
77 
78  public:
79 
82 
83  virtual TimePixXYReaderProcessor* newProcessor();
84 
85 
90  virtual void readDataSource( int numEvents );
91 
92  virtual void init();
93 
94 
95  protected:
96 
97  // --- Protected methods --- //
98 
100  int getChipID( const int& col, const int& row ) const;
101 
103  IMPL::LCCollectionVec* readXYFile( const std::string& fileName );
104 
105  // --- Protected data members --- //
106 
107  std::string _outputColName;
108  std::string _listName ;
109  std::string _detName;
110  std::string _subDetName;
111  std::string _dataDescription;
112 
113  std::ifstream _inFile;
114 
115  std::vector<int> _chipIDs;
116 
120 
123 
124  int _runNr;
125  int _evtNr;
126  int _nChipRow;
129  unsigned _activatedPixels;
130 
131  const int _nPixels;
132  const int _nBoardsPerFec;
133  const int _nChipsPerBoard;
134 
137 
138  };
139 
140 
141 } // end of namespace marlin
142 
143 #endif // TimePixXYReaderProcessor_h
std::string _listName
Name of the file containing the list of data files.
Definition: TimePixXYReaderProcessor.h:108
int _runNr
Run number, set to 0 per default.
Definition: TimePixXYReaderProcessor.h:124
std::ifstream _inFile
Reads list of data files.
Definition: TimePixXYReaderProcessor.h:113
bool _noChipHeaders
set to true if frames have no header lines separating data of different chips, default is false ...
Definition: TimePixXYReaderProcessor.h:121
const int _nPixels
Number of pixels per row and column on each chip, fixed to 256.
Definition: TimePixXYReaderProcessor.h:131
std::string _dataDescription
Description of the data (optional).
Definition: TimePixXYReaderProcessor.h:111
int _nChipRow
Number of chips in each row.
Definition: TimePixXYReaderProcessor.h:126
int _charsAfterTimestamp
number of characters following the timestamp in Timepix frame file name
Definition: TimePixXYReaderProcessor.h:119
virtual void readDataSource(int numEvents)
Creates events with TrackerRawData collections from the TimePix raw data input files and calls all ac...
Definition: TimePixXYReaderProcessor.cc:173
int _minPixels
Minimum number of activated pixels in an event. Events with less pixels are skipped.
Definition: TimePixXYReaderProcessor.h:128
int _lengthOfTimestamp
number of digits of timestamp
Definition: TimePixXYReaderProcessor.h:118
std::string _subDetName
Name of the subdetector (optional).
Definition: TimePixXYReaderProcessor.h:110
int _nChipColumn
Number of chips in each row.
Definition: TimePixXYReaderProcessor.h:127
bool _enableTimeStamps
if true timestamp from Timepix frames will be stored in corresponding events
Definition: TimePixXYReaderProcessor.h:117
const int _nChipsPerBoard
Number of chips per board, fixed to 8.
Definition: TimePixXYReaderProcessor.h:133
std::vector< int > _chipIDs
Contains the IDs of the different chips.
Definition: TimePixXYReaderProcessor.h:115
std::string _detName
Name of the detector (optional).
Definition: TimePixXYReaderProcessor.h:109
bool _outputIsTransient
Transient collections are not written to disc.
Definition: TimePixXYReaderProcessor.h:136
int _evtNr
Number of the current event.
Definition: TimePixXYReaderProcessor.h:125
std::string _outputColName
Name of the output collection.
Definition: TimePixXYReaderProcessor.h:107
int _maxPixelsPerChip
maximum number of pixels read out per chip, depends on readout system, default is 4096 ...
Definition: TimePixXYReaderProcessor.h:122
Writes data to TrackerRawDataCollection named TimePixRawData.
Definition: TimePixXYReaderProcessor.h:76
const int _nBoardsPerFec
Number of boards per FEC, fixed to 4.
Definition: TimePixXYReaderProcessor.h:132
int getChipID(const int &col, const int &row) const
Returns the chip ID for a given x and y position of a pixel.
Definition: TimePixXYReaderProcessor.cc:465
unsigned _activatedPixels
Number of activated pixels in the current event.
Definition: TimePixXYReaderProcessor.h:129
bool _isFirstEvent
Before the first event a run header is added to the data stream.
Definition: TimePixXYReaderProcessor.h:135
IMPL::LCCollectionVec * readXYFile(const std::string &fileName)
Returns a collection with all (zero-suppressed) pixels in one event, read from a file of the format x...
Definition: TimePixXYReaderProcessor.cc:281
TimePixXYReaderProcessor()
C'tor.
Definition: TimePixXYReaderProcessor.cc:24