FEBOverflowTrigger_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: FEBOverflowTrigger
3 // Module Type: filter
4 // File: FEBOverflowTrigger_module.cc
5 //
6 // Generated at Mon Apr 14 17:00:29 2014 by Luke Vinton using artmod
7 // from cetpkgsupport v1_05_03.
8 ////////////////////////////////////////////////////////////////////////
9 
17 #include "fhiclcpp/ParameterSet.h"
18 
19 //Copied from HighETrigger
25 
26 #include <memory>
27 //copied from HighETrigger
28 #include <string>
29 #include <algorithm>
30 
31 namespace novaddt {
32  class FEBOverflowTrigger;
33 }
34 
36 public:
37  explicit FEBOverflowTrigger(fhicl::ParameterSet const & p);
38  virtual ~FEBOverflowTrigger();
39 
40  bool filter(art::Event & e) override;
41 
42 
43 private:
46 
47 };
48 
49 
51  :
52  hit_label_(p.get<std::string>("hit_label")),
53  hit_instance_(p.get<std::string>("hit_instance")),
54  prescale_(p.get<unsigned>("prescale")),
56 {
57  produces<std::vector<TriggerDecision>>();
58 }
59 
61 {
62  std::cout << "\n\tNumber of FEB overflow Triggers = " << trigger_counts_
63  << "\n" << std::endl;
64 }
65 
67 {
68  bool result = false;
69  std::unique_ptr<std::vector<TriggerDecision>>
70  trigger_decisions(new std::vector<TriggerDecision>);
71 
74 
75  bool foundOverflowHit = false;
76  novaddt::TDC overflowTime = 0;
77 
78  for (auto const& hit : *hits){
79  if(hit.FEBOverflowError()){
80  foundOverflowHit=true;
81  overflowTime = hit.TDC();
82  }
83  }
84 
85  //TDC dt = 64000; //64MHz * 1 ms
86  //TDC s = 0.95;
87  //TDC t0 = overflowTime - 0.95 * dt; // start time is 950 us back from overflow
88 
89  double dt = 64000;
90  double sdt = 0.95 * dt;
91  TDC tdt = sdt;
92  TDC t0 = overflowTime - tdt; // start time is 950 us back from overflow
93 
94  if(foundOverflowHit){
96  if (trigger_counts_ % prescale_ == prescale_ - 1)
97  {
98  trigger_decisions->emplace_back
100  result = true;
101  }
102  }
103 
104  e.put(std::move(trigger_decisions));
105  return result;
106 
107 }
108 
const char * p
Definition: xmltok.h:285
bool filter(art::Event &e) override
DEFINE_ART_MODULE(TestTMapFile)
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
Definition: Cand.cxx:23
void hits()
Definition: readHits.C:15
OStream cout
Definition: OStream.cxx:6
FEBOverflowTrigger(fhicl::ParameterSet const &p)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Definition: structs.h:12
Float_t e
Definition: plot.C:35
enum BeamMode string