MarlinTPC  1.2.0
PulseFinderTester.h
1 #ifndef PULSE_FINDER_TESTER_H
2 #define PULSE_FINDER_TESTER_H
3 
4 #include "PulseFinder.h"
5 
6 namespace marlintpc
7 {
8 
12 {
13  public:
16 
19 
22  int runAllTests();
23 
24 
25  protected:
31  {
32  // distances of iter1 and iter2 to the begin() iterator
33  int iterator1Distance;
34  int iterator2Distance;
35  // values of *iter1 and *iter2
36  float iterator1Value;
37  float iterator2Value;
38  bool isSplit;
39 
40  IteratorProperties( int iter1Distance, int iter2Distance, float iter1Value, float iter2Value,
41  bool split=false)
42  : iterator1Distance(iter1Distance), iterator2Distance(iter2Distance),
43  iterator1Value(iter1Value), iterator2Value(iter2Value), isSplit(split) {}
44  };
45 
46 // /** A reference consists of a vector of IteratorProperties structs and
47 // * the corresponding begin and end iterators of the data vectors.
48 // */
49 // struct Reference
50 // {
51 // std::vector<IteratorProperties> iteratorPropertiesVec;
52 // std::vector<float>::const_iterator beginIterator;
53 // std::vector<float>::const_iterator endIterator;
54 //
55 // Reference( std::vector<float>::const_iterator begin,
56 // std::vector<float>::const_iterator end)
57 // : beginIterator(begin), endIterator(end) {}
58 // };
59 
63  {
64  size_t nSamples;
65  float firstSample;
66  float lastSample;
67  float time;
68  int quality;
69 
70  CandidateProperties( size_t n, float first, float last, float t, int q)
71  : nSamples(n), firstSample(first), lastSample(last), time(t), quality(q)
72  {}
73 
74  };
75 
80  {
81  size_t nSamples; //< to have something to check if the TrackerData is there
82  //< if it is 0 the trackerData pointer should be NULL
83  int quality;
84  float time;
85  float charge;
86 
87 
88  PulseProperties( size_t n, // nSamples
89  int q, // quality
90  float t, // time
91  float c) //charge (q is already taken by quality)
92  : nSamples(n), quality(q), time(t), charge(c)
93  {}
94  };
95 
99  bool evaluateBruteSearchResult( std::vector< std::pair<std::vector<float>::const_iterator,
100  std::vector<float>::const_iterator> > const & bruteSearchResult,
101  std::vector<IteratorProperties> const & referenceValues ,
102  std::vector<float>::const_iterator beginIterator,
103  std::vector<float>::const_iterator endIterator );
104 
105  bool evaluateSplitResult(std::vector<PulseFinder::InternalSplitPulse> const & splitResult,
106  std::vector<IteratorProperties> const & referenceValues ,
107  std::vector<float>::const_iterator beginIterator,
108  std::vector<float>::const_iterator endIterator );
109 
110  bool evaluatePulseCandidate(std::vector<std::pair<TrackerDataImpl *, int> > candidates,
111  std::vector<CandidateProperties> const & referenceCandidateProperties);
112 
113  bool evaluatePulses(std::vector<TrackerPulse *> const & pulses,
114  std::vector<PulseProperties> const & referencePulseProperties);
115 
121  bool evaluatePlateauCutoff(std::vector<TrackerPulse *> const & pulses,
122  std::vector<std::pair<size_t,size_t> > const & referencePositions,
123  EVENT::FloatVec const & referenceADCValues);
124 
125  PulseFinder * _pulseFinder;
126  // a pulsefinder with pre and post samples and plateau cutoff
127  PulseFinder * _pulseFinderPrePostPlateau;
128 
130 
131 };
132 
133 }
134 
135 #endif //PULSE_FINDER_TESTER_H
~PulseFinderTester()
The destructor.
Definition: PulseFinderTester.cc:80
A reference consists of a vector of IteratorProperties structs and the corresponding begin and end it...
Definition: PulseFinderTester.h:62
bool evaluatePlateauCutoff(std::vector< TrackerPulse * > const &pulses, std::vector< std::pair< size_t, size_t > > const &referencePositions, EVENT::FloatVec const &referenceADCValues)
Compare the adc values in the pulses to the referenceADCValues.
Definition: PulseFinderTester.cc:1022
The PulseFinder class is working horse of the ModularPulseFinderProcessor.
Definition: PulseFinder.h:66
A class which is friend of PulseFinder so it can access the protected members for testing...
Definition: PulseFinderTester.h:11
int runAllTests()
Run all tests and return the number of failed tests.
Definition: PulseFinderTester.cc:95
PulseFinderTester()
The constructor.
Definition: PulseFinderTester.cc:11
float _readoutFrequency
The reference value. Has to be returned correctly.
Definition: PulseFinderTester.h:129
A helper struct to store the distance to the begin iterator and the value which should be at the iter...
Definition: PulseFinderTester.h:30
A struct to store the pulse properties we are checking.
Definition: PulseFinderTester.h:79
bool evaluateBruteSearchResult(std::vector< std::pair< std::vector< float >::const_iterator, std::vector< float >::const_iterator > > const &bruteSearchResult, std::vector< IteratorProperties > const &referenceValues, std::vector< float >::const_iterator beginIterator, std::vector< float >::const_iterator endIterator)
this function gets the search result of the brute search and compares it to the reference values give...
Definition: PulseFinderTester.cc:780