Belle II Software  release-06-01-15
CDCTriggerMLPData.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #ifndef CDCTRIGGERMLPDATA_H
9 #define CDCTRIGGERMLPDATA_H
10 
11 #include <TObject.h>
12 
13 namespace Belle2 {
19  class CDCTriggerMLPData : public TObject {
20  public:
25 
27  void addCounters(unsigned nWires)
28  {
29  std::vector<unsigned short> counters;
30  counters.assign(nWires, 0);
31  hitCounters.push_back(counters);
32  }
36  void addHit(unsigned iSL, int iTS);
38  void countTrack() { ++trackCounter; }
40  void addSample(const std::vector<float>& input, const std::vector<float>& target)
41  {
42  inputSamples.push_back(input);
43  targetSamples.push_back(target);
44  }
45 
47  short getTrackCounter() const { return trackCounter; }
51  unsigned short getHitCounter(unsigned iSL, int iTS) const;
53  unsigned nSamples() const { return targetSamples.size(); }
55  const std::vector<float>& getInput(unsigned i) const { return inputSamples[i]; }
57  const std::vector<float>& getTarget(unsigned i) const { return targetSamples[i]; }
58 
59  private:
61  std::vector<std::vector<float>> inputSamples;
63  std::vector<std::vector<float>> targetSamples;
66  std::vector<std::vector<unsigned short>> hitCounters;
68  short trackCounter;
69 
72  };
74 }
75 #endif
Struct for training data of a single MLP for the neuro trigger.
std::vector< std::vector< unsigned short > > hitCounters
hit counter of active track segment IDs, used to determine the relevant id range for an MLP.
short getTrackCounter() const
get track counter
void addSample(const std::vector< float > &input, const std::vector< float > &target)
add a pair of input and target
void addHit(unsigned iSL, int iTS)
increase counter for super layer and track segment number in super layer.
ClassDef(CDCTriggerMLPData, 1)
Needed to make the ROOT object storable.
void countTrack()
increase track counter
std::vector< std::vector< float > > targetSamples
list of target values for network training.
unsigned short getHitCounter(unsigned iSL, int iTS) const
get hit counter for super layer and track segment number is super layer.
unsigned nSamples() const
get number of samples (same for input and target)
const std::vector< float > & getInput(unsigned i) const
get input vector of sample i
std::vector< std::vector< float > > inputSamples
list of input vectors for network training.
void addCounters(unsigned nWires)
add hit counters for a layer with nWires
CDCTriggerMLPData()
default constructor.
~CDCTriggerMLPData()
destructor, empty because we don't allocate memory anywhere.
short trackCounter
number of tracks used for the hit counter.
const std::vector< float > & getTarget(unsigned i) const
get target value of sample i
Abstract base class for different kinds of events.