RawEventList.cxx
Go to the documentation of this file.
1 #include <iostream>
2 #include "NovaTimingUtilities/TimingUtilities.h"
6 
7 using namespace om;
8 
9 static const double kUSEC_PER_TDC = (1.0E6/64.0E6);
10 //static const unsigned int kADC_ERROR = 0xFFFFFFFF;
11 static const int kNSEC_PER_USEC = 1000;
12 static const int kNS_PER_RANGE_TICK = 500;
13 
14 // Min. time difference between two events to be considered continuous (in NOvA
15 // clock ticks)
16 static const int kTIME_CONT_THRESHOLD = 1;
17 
18 //......................................................................
19 
21 
22 //......................................................................
23 
25 
26 //......................................................................
27 
29 {
30  fEventList.push_back(evtsum);
31 }
32 
33 //......................................................................
34 
36 {
37  std::vector<RawEventSummary>::iterator it;
38  for (it = fEventList.begin(); it != fEventList.end(); ++it){
39  if (it->fEventIncomplete) return true;
40  }
41  return false;
42 }
43 
44 //......................................................................
45 
47 {
48  double startTimeInNanoSeconds = (evtsum.fT0 * kUSEC_PER_TDC) * kNSEC_PER_USEC;
49  double duration = evtsum.fRange * kNS_PER_RANGE_TICK;
50  double endTimeInNanoSeconds = startTimeInNanoSeconds + duration;
51  double endTimeInTDC = endTimeInNanoSeconds / kNSEC_PER_USEC / kUSEC_PER_TDC;
52  return endTimeInTDC;
53 }
54 
55 //......................................................................
56 
57 unsigned long int RawEventList::EventEndTime()
58 {
59  return this->EventEndTime(fEventList.back());
60 }
61 
62 //......................................................................
64  const RawEventSummary& evtSecond)
65 {
66  return evtSecond.fT0 - this->EventEndTime(evtFirst);
67 }
68 
69 //......................................................................
71 {
72  int size = this->Size();
73  if (size > 1) {
74  long int diff = this->TimeDiffBetweenEvents(fEventList[size - 2],
75  fEventList[size - 1]);
76  return diff;
77  }
78  return 0;
79 }
80 
81 //......................................................................
82 
84  const RawEventSummary& evtSecond)
85 {
86  long int differenceInTime = evtSecond.fT0 - this->EventEndTime(evtFirst);
87  if (differenceInTime < kTIME_CONT_THRESHOLD) return true;
88  return false;
89 }
90 
91 //......................................................................
92 
94 {
95  int size = this->Size();
96  if (size > 1) {
97  bool eventsContinuous = this->IsEventContinuousInTime(fEventList[size - 2],
98  fEventList[size - 1]);
99  if (!eventsContinuous) return false;
100  }
101  return true;
102 }
103 
104 //......................................................................
105 
107 {
108  return fEventList.size();
109 }
110 
111 ////////////////////////////////////////////////////////////////////////
bool ContainsIncompleteEvents()
unsigned long int fT0
Trigger time in nova time units (64 Mhz ticks)
set< int >::iterator it
long int TimeDiffBetweenEvents()
std::vector< RawEventSummary > fEventList
List of raw events.
Definition: RawEventList.h:34
unsigned int fRange
Trigger length in units of 500 nsec.
::xsd::cxx::tree::duration< char, simple_type > duration
Definition: Database.h:188
static const int kNS_PER_RANGE_TICK
A simple object that conatins all the global settings.
static const int kTIME_CONT_THRESHOLD
Dumps a summary of info about events to the screen.
static const double kUSEC_PER_TDC
Definition: RawEventList.cxx:9
unsigned long int EventEndTime()
static const int kNSEC_PER_USEC
Online Monitoring package header.
void AddEventToRawEventList(const RawEventSummary &evtsum)
bool IsEventContinuousInTime()
All the interesting event-level data.