22 return (d1->
TDC()<d2->
TDC());
50 for (i=i1; i<=i2; ++
i) {
63 unsigned int* plane1x,
64 unsigned int* plane2x,
67 unsigned int* plane1y,
68 unsigned int* plane2y,
87 for (i=i1; i<=i2; ++
i) {
92 if (p<(*plane1x)) (*plane1x) =
p;
93 if (p>(*plane2x)) (*plane2x) =
p;
94 if (c<(*cell1x)) (*cell1x) =
c;
95 if (c>(*cell2x)) (*cell2x) =
c;
98 if (p<(*plane1y)) (*plane1y) =
p;
99 if (p>(*plane2y)) (*plane2y) =
p;
100 if (c<(*cell1y)) (*cell1y) =
c;
101 if (c>(*cell2y)) (*cell2y) =
c;
112 unsigned int tdcwindow,
116 std::vector<RawSlice>& slice)
123 if (nhit<1 || nhit<(nhitx+nhity) ||
d.size()<
nhit)
return;
126 std::vector<RawSlice> tmpslice;
127 for (i=0; i<
d.size(); ++
i) {
133 for (j=i+1; j<
d.size(); ++
j) {
134 dt =
d[
j]->TDC() -
d[
i]->TDC();
144 if (j>=i && (j-i+1)>=nhit) {
148 unsigned int nx=0, ny=0;
153 if (nx>=nhitx && ny>=nhity) {
157 tmpslice.push_back(rs);
166 if (j==
d.size())
break;
171 for (i=0; i<tmpslice.size(); ++
i) {
172 if (tmpslice[i].first==0 && tmpslice[i].
second==0)
continue;
173 for (j=i+1; j<tmpslice.size(); ++
j) {
174 if (tmpslice[j].first <= tmpslice[i].
second) {
175 tmpslice[
i].second = tmpslice[
j].second;
176 tmpslice[
j].first = 0;
177 tmpslice[
j].second= 0;
184 for (
unsigned int i=0; i<tmpslice.size(); ++
i) {
185 if (!(tmpslice[i].first==0 && tmpslice[i].
second==0)) {
186 slice.push_back(tmpslice[i]);
208 std::vector<bool> isgood(rd.size());
209 for (i=0; i<rd.size(); ++
i) isgood[i] =
true;
210 for (i=0; (i+1)<rd.size(); ++
i) {
215 if (rd[i]->ADC()<adc_sat)
continue;
219 unsigned int chi = rd[
i]->DaqChannel();
220 unsigned int diblocki = (chi&0x0FC00000)>>22;
221 unsigned int dcmi = (chi&0x003F0000)>>16;
222 unsigned int febi = (chi&0x0000FF00)>>8;
223 for (j=i+1; j<rd.size(); ++
j) {
227 if ((rd[j]->TDC()-rd[i]->TDC())>dt_tdc)
break;
233 unsigned int chj = rd[
j]->DaqChannel();
234 unsigned int diblockj = (chj&0x0FC00000)>>22;
235 unsigned int dcmj = (chj&0x003F0000)>>16;
236 unsigned int febj = (chj&0x0000FF00)>>8;
238 (diblocki==diblockj) && (dcmi==dcmj) && (febi==febj);
239 if (sameFEB) isgood[
j] =
false;
245 std::vector< art::Ptr<rawdata::RawDigit> >
good;
246 good.reserve(rd.size());
247 for (i=0; i<rd.size(); ++
i) {
248 if (isgood[i]) good.push_back(rd[i]);
int32_t TDC() const
The time of the last baseline sample.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
static bool digi_sort(const art::Ptr< rawdata::RawDigit > d1, const art::Ptr< rawdata::RawDigit > d2)
Collection of basic utilities for working with raw digits.
Vertical planes which measure X.
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
std::pair< unsigned int, unsigned int > RawSlice
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.
View_t View() const
Which coordinate does this plane measure.
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.
unsigned short GetPlane(const rawdata::RawDigit *dig)
Functions for getting information about a collection of raw hits.
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...
unsigned short GetCell(const rawdata::RawDigit *dig)
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.
void TimeSort(std::vector< art::Ptr< rawdata::RawDigit > > &d)
Arrange the list of raw hits in time order (early to late)
Encapsulate the geometry of one entire detector (near, far, ndos)