MarlinTPC  1.2.0
SimplePedestalCalculatorProcessor.h
1 #ifndef _SIMPLE_PEDESTAL_CALCULATOR_PROCESSOR_H
2 #define _SIMPLE_PEDESTAL_CALCULATOR_PROCESSOR_H
3 
4 //C++
5 #include <map>
6 #include <utility>
7 
8 //LCIO
9 #include <lcio.h>
10 
11 //MARLIN
12 #include <marlin/Processor.h>
13 
14 //TPCCondData
15 #include "Pedestal.h"
16 
17 namespace marlintpc
18 {
19 
36  class SimplePedestalCalculatorProcessor : public marlin::Processor
37  {
38 
39  public:
40 
41  virtual Processor* newProcessor() { return new SimplePedestalCalculatorProcessor; }
42 
44 
47  virtual void init();
48 
51  virtual void processRunHeader( lcio::LCRunHeader* run );
52 
55  virtual void processEvent( lcio::LCEvent * evt ) ;
56 
57 
60  virtual void check( lcio::LCEvent * evt ) ;
61 
62 
65  virtual void end() ;
66 
67  protected:
68 
73  {
74  public:
76 
78  void addSample(int adcValue);
79 
81  size_t getNSamples() const;
82 
86  double getPedestalValue() const;
87 
91  double getPedestalWidth() const;
92 
93  private:
94  size_t _nSamples; // The number number of samples that have been added
95  long long int _sumX; // The sum of all ADC values
96  long long int _sumXSquare; // The sum of the squares of all ADC values
97  };
98 
101  typedef std::map< std::pair<int,int> , pedestalCreator > PedestalCreatorMap_t;
102 
107 
108  // the processor parameters
109  std::string _inputColName, _outputColName, _outputFileName;
110 
111  };
112 }
113 #endif
PedestalCreatorMap_t _pedestalCreatorMap
A map to associate a hardware ID (pair of ints for channel and readout group) to the corresponding pe...
Definition: SimplePedestalCalculatorProcessor.h:106
size_t getNSamples() const
Get the number of samples that have been used to calculate the pedestal.
Definition: SimplePedestalCalculatorProcessor.cc:171
virtual void end()
The end function writes the caclulated pedestals to the lcio file.
Definition: SimplePedestalCalculatorProcessor.cc:130
virtual void init()
Initialises the processor parameters.
Definition: SimplePedestalCalculatorProcessor.cc:59
void addSample(int adcValue)
Add one measured ADC value to the calculation.
Definition: SimplePedestalCalculatorProcessor.cc:219
double getPedestalWidth() const
Get the width of the pedestal.
Definition: SimplePedestalCalculatorProcessor.cc:190
virtual void check(lcio::LCEvent *evt)
Nothing to check.
Definition: SimplePedestalCalculatorProcessor.cc:124
double getPedestalValue() const
Get the pedestal value.
Definition: SimplePedestalCalculatorProcessor.cc:176
The SimpePedestalCalculatorProcessor calculates the pedestal for each channel from all events in the ...
Definition: SimplePedestalCalculatorProcessor.h:36
virtual void processRunHeader(lcio::LCRunHeader *run)
Nothing to do here...
Definition: SimplePedestalCalculatorProcessor.cc:65
Internal helper class to sum up the pedestals and calculate the mean value and width.
Definition: SimplePedestalCalculatorProcessor.h:72
virtual void processEvent(lcio::LCEvent *evt)
Sum up all pedestals in the pedestalCreator classes.
Definition: SimplePedestalCalculatorProcessor.cc:81
std::map< std::pair< int, int >, pedestalCreator > PedestalCreatorMap_t
For better readability: define a pedestal map type.
Definition: SimplePedestalCalculatorProcessor.h:101