NuMITimeParams.h
Go to the documentation of this file.
1 #ifndef NUMITIMEPARAMS_H
2 #define NUMITIMEPARAMS_H
3 
4 namespace util{
5 
6 
7  // NB: if you are using files for which CalHit was run in a release from
8  // before Sep 20 2015 (ie the first analysis files) you need a version of
9  // this file from before Sep 20 too. See docdb 13518 for a description of the
10  // bug that used to be present in the timing, fixed on this date, and the
11  // workaround removed from this file.
12 
13  /*
14  These cuts are for the Far Detector only.
15 
16  Events in the time window when the beam is expected to arrive (plus a small
17  amount of padding) go into the analysis. Events outside of these windows
18  (plus some extra padding), and also away from the starts and ends of the
19  spill are the "timing sideband". These can be used to derive the expected
20  cosmic background count in the spill windows. Count events in the sideband
21  and then multiply by a scale factor to account for the different livetimes
22  (defined as a Var at the bottom of this file, to be passed in the "wei"
23  field of the Spectrum).
24 
25  A complication: before the shutdown there were problems with the timing
26  system, which led to the beam sometimes appearing to be 64us late. We don't
27  know exactly when this was and wasn't the case, so we open a second timing
28  window, only in this time period, and hence split the sideband into three
29  parts. These cuts are supposed to make this completely transparent to
30  users.
31 
32  The diagram below may or may not help to clarify matters:
33 
34  +------------------------------------------------------+
35  | |<----->| |###| |<----->| |###| |<------>| | before shutdown
36  | |<----->| |###| |<------------------------>| | after shutdown
37  +------------------------------------------------------+
38  0 25 208 217 229 238 272 281 293 302 475 500us (not to scale)
39 
40  |###| = beam window
41  |<->| = timing sideband
42  | | = unused
43  */
44 
45  // Allow slack around the beam window because the blinding extends all the
46  // way out to 208-238us.
48 
49  const int kBeamWindowMinMicroSec = 217;
50  const int kBeamWindowMaxMicroSec = 229;
51 
52  // The out-of-time window before the spill window. Stay away from the very
53  // start of the spill where strange things can happen.
55  const int kMaxTimingSidebandBeforeMicroSec = kBeamWindowMinMicroSec - kBeamWindowPaddingMicroSec;
56 
57  // The out-of-time window after the spill window. Stay away from the very
58  // end of the spill where strange things can happen.
59  const int kMinTimingSidebandAfterMicroSec = kBeamWindowMaxMicroSec + kBeamWindowPaddingMicroSec;
61 
62  // How much the beam peak is shifted when the timing is bad.
63  const int kPeakShiftMicroSec = +64;
64 
65  // Open up a second, identical, window, just later.
66  const int kBeamWindowShiftedMinMicroSec = kBeamWindowMinMicroSec + kPeakShiftMicroSec;
67  const int kBeamWindowShiftedMaxMicroSec = kBeamWindowMaxMicroSec + kPeakShiftMicroSec;
68 
69  // The end of the 2nd timing sideband and start of the third when we're in
70  // bad-timing runs. Allow the same padding as the main beam window.
72  const int kMinTimingSidebandAfterShiftedWindowMicroSec = kBeamWindowShiftedMaxMicroSec + kBeamWindowPaddingMicroSec;
73 
74  // TCR was installed and TDU firmware was updated to a version verified to
75  // not suffer from 64us time jumps at Ash River Oct 28th 2014. The first
76  // good run was 17946, but here we need the last bad run.
77  const int kLastBadTimingRun = 17945;
78 
79 
80  /// How long is the beam window?
81  const int kBeamWindowMicroSec = kBeamWindowMaxMicroSec - kBeamWindowMinMicroSec;
82  /// How long is the part of the spill far from the start and end, and also
83  /// not in the beam window?
85  (kMaxTimingSidebandBeforeMicroSec - kMinTimingSidebandBeforeMicroSec) +
86  (kMaxTimingSidebandAfterMicroSec - kMinTimingSidebandAfterMicroSec);
87 
88  /// Two windows to consider here
90  (kBeamWindowMaxMicroSec - kBeamWindowMinMicroSec) +
91  (kBeamWindowShiftedMaxMicroSec - kBeamWindowShiftedMinMicroSec);
92 
93  /// Two beam windows to cut out here
95  (kMaxTimingSidebandBeforeMicroSec - kMinTimingSidebandBeforeMicroSec) +
96  (kMaxTimingSidebandBeforeShiftedWindowMicroSec - kMinTimingSidebandAfterMicroSec) +
97  (kMaxTimingSidebandAfterMicroSec - kMinTimingSidebandAfterShiftedWindowMicroSec);
98 
99 
100  static inline bool IsInBeamWindow(const int run,
101  const double time)
102  {
103  // In the bad period and in the shifted window
104  if(run <= kLastBadTimingRun &&
105  time > 1000*kBeamWindowShiftedMinMicroSec &&
106  time < 1000*kBeamWindowShiftedMaxMicroSec)
107  return true;
108 
109  // Or in any period and in the main window
110  return (time > 1000*kBeamWindowMinMicroSec &&
111  time < 1000*kBeamWindowMaxMicroSec);
112  }
113 
114 
115 }// end of namespace util
116 
117 #endif // NUMITIMEPARAMS_H
const int kBeamWindowBadPeriodMicroSec
Two windows to consider here.
Filter events based on their run/event numbers.
const int kBeamWindowMicroSec
How long is the beam window?
const int kBeamWindowMinMicroSec
const int kLastBadTimingRun
static bool IsInBeamWindow(const int run, const double time)
const int kBeamWindowShiftedMinMicroSec
const int kMinTimingSidebandAfterShiftedWindowMicroSec
const int kTimingSidebandMicroSec
const int kBeamWindowPaddingMicroSec
const int kMinTimingSidebandAfterMicroSec
const int kBeamWindowMaxMicroSec
const int kMaxTimingSidebandBeforeShiftedWindowMicroSec
const int kMaxTimingSidebandBeforeMicroSec
const int kMinTimingSidebandBeforeMicroSec
const int kBeamWindowShiftedMaxMicroSec
const int kPeakShiftMicroSec
Definition: run.py:1
const int kTimingSidebandBadPeriodMicroSec
Two beam windows to cut out here.
const int kMaxTimingSidebandAfterMicroSec