RawUtil.h
Go to the documentation of this file.
1 ///
2 /// \file RawUtil.h
3 /// \brief Functions for getting information about a collection of raw hits.
4 /// \version $Id: RawUtil.h,v 1.3 2012-08-16 01:28:29 bckhouse Exp $
5 /// \author messier@indiana.edu
6 ///
7 #ifndef UTIL_RAWUTIL_H
8 #define UTIL_RAWUTIL_H
9 #include <vector>
11 namespace rawdata { class RawDigit; }
12 
13 namespace util
14 {
15  /// \name Utilities acting on RawDigits
16  /// Used by Cana
17  //@{
18 
19  ///
20  /// A raw slice is just two indices: the index of the first hit in
21  /// the slice, and the index of the last hit in the slice, inclusive.
22  ///
23  typedef std::pair<unsigned int, unsigned int> RawSlice;
24 
25  //....................................................................
26 
27  ///
28  /// \brief Arrange the list of raw hits in time order (early to late)
29  ///
30  /// @param d : The list of digits to be sorted. Sorted on output.
31  ///
32  void TimeSort(std::vector< art::Ptr<rawdata::RawDigit> >& d);
33 
34  ///
35  /// \brief Count the number of digits in each detector view
36  ///
37  /// @param d : The complete list of raw digits to be considered
38  /// @param i1 : Index of the first digit to be considered
39  /// @param i2 : Index of the last digit to be considered (inclusive)
40  /// @param nx : On output, the number of hits in the x view
41  /// @param ny : On output, the number of hits in the y view
42  ///
43  void CountXY(const std::vector< art::Ptr<rawdata::RawDigit> >& d,
44  unsigned int i1,
45  unsigned int i2,
46  unsigned int* nx,
47  unsigned int* ny);
48  ///
49  /// \brief Find boxes in plane/cell units that contain all the hits
50  ///
51  /// @param d : The complete list of raw digits to be considered
52  /// @param i1 : Index of the first hit to be considered
53  /// @param i2 : Index of the last hit to be considered (inclusive)
54  /// @param plane1x : On output, the lowest plane number in the x view
55  /// @param plane2x : On output, the highest plane number in the x view
56  /// @param cell1x : On output, the lowest cell number in the x view
57  /// @param cellx : On output, the highest cell number in the x view
58  /// @param plane1y : On output, the lowest plane number in the y view
59  /// @param plane2y : On output, the highest plane number in the y view
60  /// @param cell1y : On output, the lowest cell number in the y view
61  /// @param celly : On output, the highest cell number in the y view
62  ///
63  void EventBox(const std::vector< art::Ptr<rawdata::RawDigit> >& d,
64  unsigned int i1,
65  unsigned int i2,
66  unsigned int* plane1x,
67  unsigned int* plane2x,
68  unsigned int* cell1x,
69  unsigned int* cell2x,
70  unsigned int* plane1y,
71  unsigned int* plane2y,
72  unsigned int* cell1y,
73  unsigned int* cell2y);
74  ///
75  /// \brief Find windows in time that have significant activity in the detector
76  ///
77  /// @param d - The full raw digit list to consider
78  /// @param dt_tdc - Sliding window size in NOvA clock ticks (64 MHz)
79  /// @param nhit - Total number of hits to look for in window
80  /// @param nhitx - Number of hits required in x view
81  /// @param nhity - Number of hits required in y view
82  /// @param slice - On output, the start and end indicies of the time windows
83  ///
84  /// Note: d must be time sorted on input. See "TimeSort" above.
85  ///
86  void TimeSlice(const std::vector< art::Ptr<rawdata::RawDigit> >& d,
87  unsigned int dt_tdc,
88  unsigned int nhit,
89  unsigned int nhitx,
90  unsigned int nhity,
91  std::vector<RawSlice>& slice);
92  ///
93  /// \brief Filter hits that are "FEB flash" candidates; that is,
94  /// they occur within a specified time of an FEB hit in saturation
95  ///
96  /// @param rd - Input list of raw digits. On output it will be time
97  /// sorted and have had FEB flash hits removed.
98  ///
99  /// @param adc_sat - ADC value to flag a raw hit as being in
100  /// saturation, recommended value is 3400 counts
101  ///
102  /// @param dt_tdc - time difference between time of saturation and
103  /// time of candidate "flash" hit in units of TDC
104  /// counts. Recommended value is 1280 (20 usec)
105  /// Note: 1920 (30 usec) is also a useful optional value.
106  /// @returns the new size of the rd raw hit list
107  ///
108  /// Note that the vector rd will be returned time sorted and equal
109  /// or shorter than its original length
110  ///
111  unsigned int
112  FilterFEBFlash(std::vector< art::Ptr<rawdata::RawDigit> >& rd,
113  int adc_sat=3400,
114  int dt_tdc=1280);
115 
116  //@}
117 }
118 
119 #endif
120 
121 ////////////////////////////////////////////////////////////////////////
Filter events based on their run/event numbers.
nhit
Definition: demo1.py:25
Definition of connection map class.
Definition: CMap.h:19
std::pair< unsigned int, unsigned int > RawSlice
Definition: RawUtil.h:23
void CountXY(const std::vector< art::Ptr< rawdata::RawDigit > > &d, unsigned int i1, unsigned int i2, unsigned int *nx, unsigned int *ny)
Count the number of digits in each detector view.
Definition: RawUtil.cxx:38
void TimeSlice(const std::vector< art::Ptr< rawdata::RawDigit > > &d, unsigned int dt_tdc, unsigned int nhit, unsigned int nhitx, unsigned int nhity, std::vector< RawSlice > &slice)
Find windows in time that have significant activity in the detector.
Definition: RawUtil.cxx:111
Float_t d
Definition: plot.C:236
unsigned int FilterFEBFlash(std::vector< art::Ptr< rawdata::RawDigit > > &rd, int adc_sat=3400, int dt_tdc=1280)
Filter hits that are "FEB flash" candidates; that is, they occur within a specified time of an FEB hi...
Definition: RawUtil.cxx:194
void EventBox(const std::vector< art::Ptr< rawdata::RawDigit > > &d, unsigned int i1, unsigned int i2, unsigned int *plane1x, unsigned int *plane2x, unsigned int *cell1x, unsigned int *cell2x, unsigned int *plane1y, unsigned int *plane2y, unsigned int *cell1y, unsigned int *cell2y)
Find boxes in plane/cell units that contain all the hits.
Definition: RawUtil.cxx:60
void TimeSort(std::vector< art::Ptr< rawdata::RawDigit > > &d)
Arrange the list of raw hits in time order (early to late)
Definition: RawUtil.cxx:31
Definition: fwd.h:28