TriggerPrimitiveFinderTemplate_tool.cc
Go to the documentation of this file.
1 // A template for creating classes to find trigger primitives for
2 // testing DAQ algorithms
3 
6 
8 
10 public:
12 
13  virtual std::vector<TriggerPrimitiveFinderTool::Hit>
14  findHits(const std::vector<unsigned int>& channel_numbers,
15  const std::vector<std::vector<short>>& collection_samples);
16 
17 
18 private:
19 
20  // Example setting. This can be read from the input fcl file: see
21  // the implementation of the constructor
23 };
24 
25 
27  // set m_threshold from the fcl file.
28  // p.get() can take a second argument which is the default value
29  : m_threshold(p.get<unsigned int>("Threshold"))
30 {
31  // Do any other constructing you want here
32 }
33 
34 // collection_samples is a vector of waveforms. Each waveform is
35 // itself a vector of all the ADC counts, in order, from a single
36 // collection wire. So, eg collection_samples[2] is a vector of the
37 // ADC samples in time order from the 2th collection wire
38 //
39 // (Trigger primitives are per-wire objects, so you'll mostly only act
40 // on one channel at a time, but you're given all of them here so you
41 // can do things like removing coherent noise)
42 //
43 // channel_numbers is a vector of the channel id of each channel in collection_samples, in the same order
44 std::vector<TriggerPrimitiveFinderTool::Hit>
45 TriggerPrimitiveFinderTemplate::findHits(const std::vector<unsigned int>& channel_numbers,
46  const std::vector<std::vector<short>>& collection_samples)
47 {
48  // Make a return vector of TriggerPrimitiveFinderTool::Hit (see TriggerPrimitiveFinderTool.h)
49  auto hits=std::vector<TriggerPrimitiveFinderTool::Hit>();
50 
51  // Construct Hits like:
52  //
53  // 1. TriggerPrimitiveFinderTool::Hit hit(channel, startTime, charge, timeOverThreshold)
54  // or
55  // 2. TriggerPrimitiveFinderTool::Hit hit;
56  // hit.channel=...;
57  // hit.startTime=...;
58  // hit.charge=...;
59  // hit.timeOverThreshold=...;
60  //
61  // Then add each one to the vector of hits
62 
63  return hits;
64 }
65 
#define DEFINE_ART_CLASS_TOOL(tool)
Definition: ToolMacros.h:42
virtual std::vector< TriggerPrimitiveFinderTool::Hit > findHits(const std::vector< unsigned int > &channel_numbers, const std::vector< std::vector< short >> &collection_samples)
struct vector vector
p
Definition: test.py:223
TriggerPrimitiveFinderTemplate(fhicl::ParameterSet const &p)
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115