ContainedSlice_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: ContainedSlice
3 // Module Type: filter
4 // File: ContainedSlice_module.cc
5 //
6 // Generated at Tue May 21 09:39:04 2013 by Matthew Tamsett using artmod
7 // from art v1_02_06.
8 ////////////////////////////////////////////////////////////////////////
9 
17 #include "DAQChannelMap/DAQChannelMap.h"
18 #include "NovaDAQConventions/DAQConventions.h"
19 #include "TVector3.h"
20 
21 //---------------------------------------------------------------------
22 namespace novaddt {
23  class ContainedSlice;
24 }
25 //---------------------------------------------------------------------
27  public:
28  explicit ContainedSlice(fhicl::ParameterSet const & p);
29  virtual ~ContainedSlice();
30  bool filter(art::Event & event) override;
31  bool beginRun(art::Run & r) override;
32  bool beginSubRun(art::SubRun & sr) override;
33  void endJob() override;
34  void printDDTSlices(art::Handle< std::vector<novaddt::HitList> > & ddt_slices);
35  void findBoundingBox(novaddt::HitList & xz_hits, novaddt::HitList & yz_hits,
36  TVector3 & start, TVector3 & end);
37  void filterForContainedHitLists(art::Handle< std::vector<novaddt::HitList> > & ddt_slices,
38  std::unique_ptr< std::vector<HitList> > & contained_hitlists);
39  bool defineContainmentRegion(art::Event & event);
40  void zeroCuts();
41  private:
42  // FHiCL configuration options
43  std::string _sliceModuleLabel; ///< label of module making the HitList
44  std::string _sliceInstanceLabel; ///< instance label making the HitList
45  float _xMin; ///< lower x fiducial cut
46  float _xMax; ///< upper x fiducial cut
47  float _yMin; ///< lower y fiducial cut
48  float _yMax; ///< upper y fiducial cut
49  unsigned int _zMin; ///< lower z fiducial cut
50  unsigned int _zMax; ///< upper z fiducial cut
51  unsigned int _secondaryZMin; ///< optional secondary lower z fiducial cut
52  unsigned int _secondaryZMax; ///< optional secondary upper z fiducial cut
53  bool _useSecondaryZCuts; ///< Apply the optional secondary z cuts
54  bool _autoconfigure; ///< Autoconfigure z containment cuts
55  unsigned int _autoconfigureMinZOffset; ///< The distance from the lower edge set by autoconfigure
56  unsigned int _autoconfigureMaxZOffset; ///< The distance from the upper edge set by autoconfigure
57  unsigned int _autoconfigureInt; ///< Run autoconfigure after every this number of events
58  std::string _detector; ///< Detector ID, can be one of FD, ND or NDOS
59  int _detector_id; ///< Detector ID int used to configure DAQ channel map
60  std::string _autoconfigureSliceModuleLabel; ///< label of module making the HitList for use in auto configuration
61  std::string _autoconfigureSliceInstanceLabel; ///< instance label making the HitList for use in auto configuration
62  bool _verbose; ///< Turn on verbose mode
63 
64  bool _reconfigure = true; ///< Force a reconfigure if autoconfigure is enabled
65  unsigned int _nDCMsPerDiBlock; ///< Number of DCMs per diblock
66  unsigned int _nPlanesPerDiBlock; ///< Number of Planes per diblock
67 
68  unsigned int _nEvents = 0;///< number of events seen
69  unsigned int _nSlices = 0;///< number of slices seen
70  unsigned int _nFilteredSlices = 0;///< number of slices filtered
71  unsigned int _nAutoconfigures = 0;///< number of times autoconfigure is run
72  unsigned int _nDiblocks = 0;///< The total number of diblocks found
73  unsigned int _nGoodDiblocks = 0;///< The number of diblocks with all DCMs
74 };
75 //---------------------------------------------------------------------
77 : _sliceModuleLabel (p.get<std::string >("SliceModuleLabel" ))
78  , _sliceInstanceLabel(p.get<std::string >("SliceInstanceLabel", ""))
79  , _xMin (p.get<float>("Xmin"))
80  , _xMax (p.get<float>("Xmax"))
81  , _yMin (p.get<float>("Ymin"))
82  , _yMax (p.get<float>("Ymax"))
83  , _zMin (p.get<unsigned int>("Zmin"))
84  , _zMax (p.get<unsigned int>("Zmax"))
85  , _secondaryZMin (p.get<unsigned int>("SecondaryZmin"))
86  , _secondaryZMax (p.get<unsigned int>("SecondaryZmax"))
87  , _useSecondaryZCuts(p.get<bool>("UseSecondaryZCuts"))
88  , _autoconfigure (p.get<bool>("Autoconfigure"))
89  , _autoconfigureMinZOffset (p.get<unsigned int>("AutoconfigureMinZOffset"))
90  , _autoconfigureMaxZOffset (p.get<unsigned int>("AutoconfigureMaxZOffset"))
91  , _autoconfigureInt (p.get<unsigned int>("AutoconfigureInterval"))
92  , _detector (p.get<std::string>("Detector"))
93  , _autoconfigureSliceModuleLabel (p.get<std::string >("AutoconfigureSliceModuleLabel" ))
94  , _autoconfigureSliceInstanceLabel(p.get<std::string >("AutoconfigureSliceInstanceLabel", ""))
95  , _verbose(p.get<bool>("Verbose"))
96 {
97  std::cout << "--- novaddt::ContainedSlice instantiate" << std::endl;
98  std::cout << "\t SliceModuleLabel: " << _sliceModuleLabel << std::endl;
99  std::cout << "\t SliceInstanceLabel: " << _sliceInstanceLabel << std::endl;
100  std::cout << "\t X fiducial cuts: " << _xMin << " to " << _xMax << std::endl;
101  std::cout << "\t Y fiducial cuts: " << _yMin << " to " << _yMax << std::endl;
102  std::cout << "\t Z fiducial cuts: " << _zMin << " to " << _zMax << std::endl;
103  std::cout << "\t Use secondary z cuts: " << _useSecondaryZCuts << std::endl;
104  std::cout << "\t Secondary Z fiducial cuts: " << _secondaryZMin << " to " << _secondaryZMax << std::endl;
105  std::cout << "\t Autoconfigure: " << _autoconfigure << std::endl;
106  std::cout << "\t Autoconfigure min Z offset:" << _autoconfigureMinZOffset << std::endl;
107  std::cout << "\t Autoconfigure max Z offset:" << _autoconfigureMaxZOffset << std::endl;
108  std::cout << "\t Autoconfigure interval: " << _autoconfigureInt << std::endl;
109  std::cout << "\t Detector: " << _detector << std::endl;
110  std::cout << "\t AC SliceModuleLabel: " << _autoconfigureSliceModuleLabel << std::endl;
111  std::cout << "\t AC SliceInstanceLabel: " << _autoconfigureSliceInstanceLabel << std::endl;
112  std::cout << "\t Verbose: " << _verbose << std::endl;
113 
114  // Assert that a valid detector has been setup
115  assert( (_detector == "FD") ||
116  (_detector == "ND") ||
117  (_detector == "NDOS") );
118  // Set the detector id int
119  if(_detector == "FD"){
121  // These should really be got from DAQ channel map
122  _nDCMsPerDiBlock = 12;
123  _nPlanesPerDiBlock = 64;
124  } else if (_detector == "ND") {
126  _nDCMsPerDiBlock = 4;
127  _nPlanesPerDiBlock = 64;
128  } else {
130  _nDCMsPerDiBlock = 4;
131  _nPlanesPerDiBlock = 64;
132  }
133 
134  produces<std::vector<HitList>>("ContainedTimeSpaceSlice");
135 }
136 //---------------------------------------------------------------------
138 {
139  // Clean up dynamic memory and other resources here.
140 }
141 //---------------------------------------------------------------------
143 {
144  if (_verbose) std::cout << "ContainedSlice::beginRun, setting reconfigure to true\n";
145  _reconfigure = true;
146  return true;
147 }
148 //---------------------------------------------------------------------
150 {
151  if (_verbose) std::cout << "ContainedSlice::beginSubRun, setting reconfigure to true\n";
152  _reconfigure = true;
153  return true;
154 }
155 //---------------------------------------------------------------------
157 {
158  // Implementation of required member function here.
159  //std::cout << "=== novaddt::ContainedSlice filter. Event: "
160  // << event.id().event()
161  // << std::endl;
162  _nEvents++;
163  // make a hit list return
164  std::unique_ptr< std::vector<HitList> > contained_hitlists(new std::vector<HitList>);
165 
166  // autoconfigure
167  if (_autoconfigure &&
168  ( ((_nEvents%_autoconfigureInt) == 0) || (_reconfigure) )
169  ){
170  bool containment_defined = defineContainmentRegion(event);
171 
172  if (!containment_defined){
173  event.put(std::move(contained_hitlists),"ContainedTimeSpaceSlice");
174  return false;
175  }
176  }
177 
178  // get the online ddt slices
180  event.getByLabel(_sliceModuleLabel, _sliceInstanceLabel, slices);
181  //std::cout << "\tgot " << slices->size() << " slices" << std::endl;
182  _nSlices+=slices->size();
183 
184 
185  //printDDTSlices(slices);
186 
187  // filter for contained slices
188  filterForContainedHitLists(slices, contained_hitlists);
189  //std::cout << "\trecording " << contained_hitlists->size() << " contained slices" << std::endl;
190 
191  //put the hits into the event for later use
192  _nFilteredSlices+=contained_hitlists->size();
193  event.put(std::move(contained_hitlists),"ContainedTimeSpaceSlice");
194 
195  //if (contained_hitlists->size() == 0) return false;
196  return true;
197 }
198 //---------------------------------------------------------------------
199 void novaddt::ContainedSlice::printDDTSlices(art::Handle< std::vector<novaddt::HitList> > & ddt_slices)
200 {
201  // loop over grouped hit list
202  for(unsigned int i = 0; i < ddt_slices->size(); ++i){
203  novaddt::HitList hits(ddt_slices->at(i));
204  // sort them
205  sort(hits.begin(), hits.end(), novaddt::CompareDAQHit<novaddt::TDC>());
206  // earliest and latest TDC
207  int eTDC = hits[0].TDC().val;
208  int lTDC = hits[hits.size()-1].TDC().val;
209  int ADC_sum = 0.;
210  novaddt::HitList xz_hits;
211  novaddt::HitList yz_hits;
212  // loop over hits in each slice
213  for(unsigned int j = 0; j < hits.size(); ++j){
215  ADC_sum = ADC_sum + hit.ADC().val;
216  std::string view = "y";
217  if( hit.View().val == daqchannelmap::X_VIEW ){
218  xz_hits.push_back(hit);
219  view = "x";
220  } else {
221  yz_hits.push_back(hit);
222  }
223  //LOG_DEBUG("ContainedSlice") << "\t\t\thit[" << j
224  //<< "]: TDC: " << hit.TDC().val
225  //<< ", ADC: " << hit.ADC().val
226  //<< ", plane: " << hit.Plane().val
227  //<< ", " << view
228  //<< "-cell: " << hit.Cell().val
229  //<< std::endl;
230  } // end of loop on hits
231  TVector3 start(0,0,0);
232  TVector3 end(0,0,0);
233  findBoundingBox(xz_hits, yz_hits, start, end);
234  // print them
235  LOG_DEBUG("ContainedSlice") << "\t\tHit list[" << i
236  << "]: " << hits.size()
237  << " hits, TDC: " << eTDC
238  << " - " << lTDC
239  << ", ADC sum: " << ADC_sum
240  << ", x: " << start.X()
241  << " - " << end.X()
242  << ", y: " << start.Y()
243  << " - " << end.Y()
244  << ", z: " << start.Z()
245  << " - " << end.Z()
246  << std::endl;
247 
248  } // end of loop on sliced hits
249 }
250 //---------------------------------------------------------------------
252  TVector3 & start, TVector3 & end)
253 
254 {
255  //if (_verbose) std::cout << "finding bounding box, "
256  //<< xz_hits.size() << " xz hits, "
257  //<< yz_hits.size() << " yz hits"
258  //<< std::endl;
259  // find z boundaries
260  // default to the mid point
261  int xz_z_min = 448;
262  int xz_z_max = 448;
263  int xz_x_min = 192;
264  int xz_x_max = 192;
265  if (xz_hits.size() > 0){
266  xz_z_min = xz_hits[0].Plane().val;
267  xz_z_max = xz_hits[0].Plane().val;
268  xz_x_min = xz_hits[0].Cell().val;
269  xz_x_max = xz_hits[0].Cell().val;
270  }
271  for (auto const& hit : xz_hits){
272  if (hit.Plane().val < xz_z_min) xz_z_min = hit.Plane().val;
273  if (hit.Plane().val > xz_z_max) xz_z_max = hit.Plane().val;
274  if (hit.Cell().val < xz_x_min) xz_x_min = hit.Cell().val;
275  if (hit.Cell().val > xz_x_max) xz_x_max = hit.Cell().val;
276  }
277 
278  int yz_z_min = 448;
279  int yz_z_max = 448;
280  int yz_y_min = 192;
281  int yz_y_max = 192;
282  if (yz_hits.size() > 0){
283  yz_z_min = yz_hits[0].Plane().val;
284  yz_z_max = yz_hits[0].Plane().val;
285  yz_y_min = yz_hits[0].Cell().val;
286  yz_y_max = yz_hits[0].Cell().val;
287  }
288  for (auto const& hit : yz_hits){
289  if (hit.Plane().val < yz_z_min) yz_z_min = hit.Plane().val;
290  if (hit.Plane().val > yz_z_max) yz_z_max = hit.Plane().val;
291  if (hit.Cell().val < yz_y_min) yz_y_min = hit.Cell().val;
292  if (hit.Cell().val > yz_y_max) yz_y_max = hit.Cell().val;
293  }
294 
295  int z_min = std::min(xz_z_min,yz_z_min);
296  int z_max = std::max(xz_z_max,yz_z_max);
297 
298  start.SetXYZ( double (xz_x_min),
299  double (yz_y_min),
300  double (z_min));
301  end.SetXYZ( double (xz_x_max),
302  double (yz_y_max),
303  double (z_max));
304  return;
305 }
306 //---------------------------------------------------------------------
307 void novaddt::ContainedSlice::filterForContainedHitLists(art::Handle< std::vector<novaddt::HitList> > & ddt_slices,
308  std::unique_ptr< std::vector<HitList> > & contained_hitlists)
309 {
310  // loop over grouped hit list
311  for(unsigned int i = 0; i < ddt_slices->size(); ++i){
312  novaddt::HitList hits(ddt_slices->at(i));
313  // earliest and latest TDC
314  // sort them
315  //sort(hits.begin(), hits.end(), novaddt::CompareDAQHit<novaddt::TDC>());
316  //int eTDC = hits[0].TDC().val;
317  //int lTDC = hits[hits.size()-1].TDC().val;
318  //unsigned int eTDC = 0;
319  //unsigned int lTDC = 0;
320  //unsigned int ADC_sum = 0;
321  novaddt::HitList xz_hits;
322  novaddt::HitList yz_hits;
323  // loop over hits in each slice
324  for(unsigned int j = 0; j < hits.size(); ++j){
326  //if (j == 0) {
327  //eTDC = hit.TDC().val;
328  //lTDC = hit.TDC().val;
329  //} else {
330  //if (hit.TDC().val < eTDC) eTDC = hit.TDC().val;
331  //if (hit.TDC().val > lTDC) lTDC = hit.TDC().val;
332  //}
333  //ADC_sum = ADC_sum + hit.ADC().val;
334  //std::string view = "y";
335  if( hit.View().val == daqchannelmap::X_VIEW ){
336  xz_hits.push_back(hit);
337  //view = "x";
338  } else {
339  yz_hits.push_back(hit);
340  }
341  //LOG_DEBUG("ContainedSlice") << "\t\t\thit[" << j
342  //<< "]: TDC: " << hit.TDC().val
343  //<< ", ADC: " << hit.ADC().val
344  //<< ", plane: " << hit.Plane().val
345  //<< ", " << view
346  //<< "-cell: " << hit.Cell().val
347  //<< std::endl;
348  } // end of loop on hits
349  TVector3 start(0,0,0);
350  TVector3 end(0,0,0);
351  findBoundingBox(xz_hits, yz_hits, start, end);
352  //LOG_DEBUG("ContainedSlice") << "\t\tHit list[" << i
353  //<< "]: " << hits.size()
354  //<< " hits, TDC: " << eTDC
355  //<< " - " << lTDC
356  //<< ", ADC sum: " << ADC_sum
357  //<< ", x: " << start.X()
358  //<< " - " << end.X()
359  //<< ", y: " << start.Y()
360  //<< " - " << end.Y()
361  //<< ", z: " << start.Z()
362  //<< " - " << end.Z()
363  //<< std::endl;
364  // containment
365  // x
366  if ((start.X() < _xMin) || (start.X() > _xMax) ||
367  (end.X() < _xMin) || (end.X() > _xMax)){
368  //LOG_DEBUG("ContainedSlice") << "\t\t - failed due to x-containment" << std::endl;
369  continue;
370  }
371  // y
372  if ((start.Y() < _yMin) || (start.Y() > _yMax) ||
373  (end.Y() < _yMin) || (end.Y() > _yMax)){
374  //LOG_DEBUG("ContainedSlice") << "\t\t - failed due to y-containment" << std::endl;
375  continue;
376  }
377  // z
378  if (_useSecondaryZCuts){
379  if (((start.Z() < _zMin) || (start.Z() > _zMax) ||
380  (end.Z() < _zMin) || (end.Z() > _zMax)) &&
381  ((start.Z() < _secondaryZMin) || (start.Z() > _secondaryZMax) ||
382  (end.Z() < _secondaryZMin) || (end.Z() > _secondaryZMax)))
383  {
384  //LOG_DEBUG("ContainedSlice") << "\t\t - failed due to z-containment" << std::endl;
385  continue;
386  }
387  } else {
388  if ((start.Z() < _zMin) || (start.Z() > _zMax) ||
389  (end.Z() < _zMin) || (end.Z() > _zMax)){
390  //LOG_DEBUG("ContainedSlice") << "\t\t - failed due to z-containment" << std::endl;
391  continue;
392  }
393  }
394 
395  // if we reach here then we're contained
396  //LOG_DEBUG("ContainedSlice") << "\t\tslice " << i << " is contained (" << hits.size() << " hits)" << std::endl;
397  contained_hitlists->push_back(hits);
398  } // end of loop on hit lists
399 }
400 //---------------------------------------------------------------------
402 {
403  if (_verbose) std::cout << "--- Defining containment region\n";
405  _reconfigure = false;
406  std::vector<daqchannelmap::diblock_t> active_diblocks;
407  std::map <daqchannelmap::diblock_t, std::vector<novaddt::DCM> > dcms_per_diblock;
408 
409  // get the hits
410  // to get the best estimate of active regions the most hits should be used
411  // therefore we get the hits after TDC sort
412  if (_verbose) std::cout << "\tgetting single hit list" << std::endl;
415  if (_verbose) std::cout << "\tgot " << hits->size() << " hits\n";
416 
417  // loop over hits
418  for(unsigned int i = 0; i < hits->size(); ++i){
420  //daqchannelmap::diblock_t diblock = daqchannelmap::DAQChannelMap::getInstance()->getDiBlock(hits->at(i).Chan());
421  novaddt::DCM dcm = hits->at(i).getDCM();
422  /*
423  std::string view = "y";
424  if( hits->at(i).View().val == daqchannelmap::X_VIEW ) view = "x";
425  if (_verbose) std::cout << " DCM: " << dcm.val
426  << ", diblock: " << diblock
427  << ", view: " << view
428  << std::endl;
429  */
430 
431  // Is this a new diblock?
432  if(std::find(active_diblocks.begin(), active_diblocks.end(), diblock)==active_diblocks.end()){
433  active_diblocks.push_back(diblock);
434  dcms_per_diblock[diblock].push_back(dcm);
435 
436  //if (_verbose) std::cout << " - Found new diblock: " << diblock
437  // << ", DCM: " << dcm.val
438  // << std::endl;
439  } else {
440  // Is this a new DCM?
441  // There are only 12 DCMs per diblock on the FD (and less on the other detectors)
442  // so only try the find if we haven't reached this number
443  if (dcms_per_diblock[diblock].size() == 12) continue;
444 
445  if(std::find(dcms_per_diblock[diblock].begin(), dcms_per_diblock[diblock].end(), dcm)==dcms_per_diblock[diblock].end()){
446  dcms_per_diblock[diblock].push_back(dcm);
447 
448  //if (_verbose) std::cout << " - Found a new DCM: " << dcm.val
449  // << ", diblock: " << diblock
450  // << std::endl;
451  }
452  } // end of is new diblock or DCM
453  } // end of loop on hits
454 
455  // sort the diblocks
456  std::sort(active_diblocks.begin(), active_diblocks.end());
457 
458  if (_verbose) std::cout << "Found: " << active_diblocks.size()
459  << " diblocks" << std::endl;
460  std::vector<daqchannelmap::diblock_t> good_diblocks;
461  for ( auto db : active_diblocks ){
462  _nDiblocks++;
463  if (_verbose) std::cout << " DB: " << db
464  << ", DCMs: " << dcms_per_diblock[db].size()
465  << std::endl;
466  // Only accept diblocks where all DCMs were active
467  if (dcms_per_diblock[db].size() == _nDCMsPerDiBlock){
468  _nGoodDiblocks++;
469  good_diblocks.push_back(db);
470  }
471  //for (auto dcm : dcms_per_diblock[db]){
472  // if (_verbose) std::cout << " - DCM: " << dcm.val << std::endl;
473  //}
474  }
475 
476  if (_verbose) std::cout << "Of these " << good_diblocks.size()
477  << " have the correct number of DCMs " << std::endl;
478 
479  // If there are no good diblocks then we can't define containment
480  if (good_diblocks.size() == 0){
481  if (_verbose) std::cout << "No good diblocks so containment cannot be defined" << std::endl;
482  zeroCuts();
483  return false;
484  }
485 
486  // Use the list of good diblocks to define our containment region
487  // We expect that this should be divided into one, or two continuous regions
488  // We do this by finding edges
489  std::vector<daqchannelmap::diblock_t> diblock_edges;
490  // Add the leading edge
491  diblock_edges.push_back(good_diblocks[0]);
492 
493  // Iterate over diblocks looking for edges
494  // Ignoring the first & last entries since by definition that has to be an edge
495  for (unsigned int i=1; i < good_diblocks.size(); ++i){
496  if (good_diblocks[i] != (good_diblocks[i-1]+1)){
497  diblock_edges.push_back(good_diblocks[i-1]);
498  diblock_edges.push_back(good_diblocks[i]);
499  }
500  }
501 
502  // Add the trailing edge
503  diblock_edges.push_back(good_diblocks[good_diblocks.size()-1]);
504 
505  if (_verbose){
506  std::cout << "Found " << diblock_edges.size()
507  << " diblock edges" << std::endl;
508  for (auto db : diblock_edges) std::cout << " " << db << std::endl;
509  }
510 
511  // Check that an appropriate number of edges have been found
512  if ((diblock_edges.size() != 2) && (diblock_edges.size() != 4)){
513  if (_verbose) std::cout << "More than two continuous regions found. Containment cannot be defined" << std::endl;
514  zeroCuts();
515  return false;
516  }
517 
518  // Set the containment cuts
519  // Recall that the diblock convention starts from 1
520  // Lower edges are therefore set from diblock number -1
521  // Upper edges from diblock number
522  _zMin = ((diblock_edges[0]-1)*_nPlanesPerDiBlock) + _autoconfigureMinZOffset;
523  _zMax = (diblock_edges[1]*_nPlanesPerDiBlock) - _autoconfigureMaxZOffset;
524  if (diblock_edges.size() == 4){
525  _useSecondaryZCuts = true;
528  } else {
529  _useSecondaryZCuts = false;
530  }
531 
532  if (_verbose){
533  std::cout << "Autoconfigured fiducial volume to: " << std::endl;
534  std::cout << "\t Z fiducial cuts: " << _zMin << " to " << _zMax << std::endl;
535  std::cout << "\t Use secondary z cuts: " << _useSecondaryZCuts << std::endl;
536  std::cout << "\t Secondary Z fiducial cuts: " << _secondaryZMin << " to " << _secondaryZMax << std::endl;
537  }
538 
539  return true;
540 }
541 //---------------------------------------------------------------------
543 {
544  _zMin = 0;
545  _zMax = 0;
546  _useSecondaryZCuts = false;
547  _secondaryZMin = 0;
548  _secondaryZMax = 0;
549  _reconfigure = true;
550  if (_verbose){
551  std::cout << "Zero-ed fiducial volume to: " << std::endl;
552  std::cout << "\t Z fiducial cuts: " << _zMin << " to " << _zMax << std::endl;
553  std::cout << "\t Use secondary z cuts: " << _useSecondaryZCuts << std::endl;
554  std::cout << "\t Secondary Z fiducial cuts: " << _secondaryZMin << " to " << _secondaryZMax << std::endl;
555  }
556 }
557 //---------------------------------------------------------------------
559 {
560  std::cout << "--- novaddt::ContainedSlice endJob" << std::endl;
561  std::cout << "\tNumber of events: " << _nEvents << std::endl;
562  std::cout << "\tNumber of slices: " << _nSlices << std::endl;
563  std::cout << "\tNumber of slices filtered: " << _nFilteredSlices << std::endl;
564  std::cout << "\tNumber of autoconfigures: " << _nAutoconfigures << std::endl;
565  std::cout << "\tNumber of DBs with any DCMs:" << _nDiblocks << std::endl;
566  std::cout << "\tNumber of DBs with all DCMs:" << _nGoodDiblocks << std::endl;
567 }
568 //---------------------------------------------------------------------
float _yMax
upper y fiducial cut
T max(const caf::Proxy< T > &a, T b)
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
std::string _detector
Detector ID, can be one of FD, ND or NDOS.
diblock
print "ROW IS " print row
Definition: geo2elec.py:31
std::string _sliceInstanceLabel
instance label making the HitList
unsigned int _nDiblocks
The total number of diblocks found.
unsigned int _zMax
upper z fiducial cut
void findBoundingBox(novaddt::HitList &xz_hits, novaddt::HitList &yz_hits, TVector3 &start, TVector3 &end)
std::vector< DAQHit > HitList
Definition: HitList.h:15
const char * p
Definition: xmltok.h:285
void printDDTSlices(art::Handle< std::vector< novaddt::HitList > > &ddt_slices)
float _xMax
upper x fiducial cut
bool _verbose
Turn on verbose mode.
unsigned int _autoconfigureMaxZOffset
The distance from the upper edge set by autoconfigure.
unsigned int _nFilteredSlices
number of slices filtered
int _detector_id
Detector ID int used to configure DAQ channel map.
unsigned int _secondaryZMax
optional secondary upper z fiducial cut
unsigned int _secondaryZMin
optional secondary lower z fiducial cut
DEFINE_ART_MODULE(TestTMapFile)
bool defineContainmentRegion(art::Event &event)
Definition: Run.h:31
std::string _autoconfigureSliceModuleLabel
label of module making the HitList for use in auto configuration
unsigned int _nDCMsPerDiBlock
Number of DCMs per diblock.
unsigned int _nPlanesPerDiBlock
Number of Planes per diblock.
unsigned int _autoconfigureMinZOffset
The distance from the lower edge set by autoconfigure.
Far Detector at Ash River, MN.
void hits()
Definition: readHits.C:15
unsigned int _nGoodDiblocks
The number of diblocks with all DCMs.
bool _useSecondaryZCuts
Apply the optional secondary z cuts.
static DAQChannelMap * getInstance(int detID)
unsigned int _nSlices
number of slices seen
novaddt::ADC const & ADC() const
Definition: DAQHit.h:73
Prototype Near Detector on the surface at FNAL.
bool _reconfigure
Force a reconfigure if autoconfigure is enabled.
novaddt::View const & View() const
Definition: DAQHit.h:72
Identifier for the X measuring view of the detector (top)
Near Detector in the NuMI cavern.
caf::StandardRecord * sr
const double j
Definition: BetheBloch.cxx:29
OStream cout
Definition: OStream.cxx:6
unsigned int _nAutoconfigures
number of times autoconfigure is run
unsigned int _nEvents
number of events seen
float _yMin
lower y fiducial cut
bool beginSubRun(art::SubRun &sr) override
bool beginRun(art::Run &r) override
bool filter(art::Event &event) override
float _xMin
lower x fiducial cut
Definition: structs.h:12
value_type val
Definition: BaseProducts.h:137
assert(nhit_max >=nhit_nbins)
uint32_t diblock_t
Type for diblocks and blocks.
bool _autoconfigure
Autoconfigure z containment cuts.
TRandom3 r(0)
std::string _autoconfigureSliceInstanceLabel
instance label making the HitList for use in auto configuration
value_type val
Definition: BaseProducts.h:65
ContainedSlice(fhicl::ParameterSet const &p)
T min(const caf::Proxy< T > &a, T b)
std::string _sliceModuleLabel
label of module making the HitList
unsigned int _autoconfigureInt
Run autoconfigure after every this number of events.
unsigned int _zMin
lower z fiducial cut
diblock_t getDiBlock(dchan daqchan) const
Decode the diblock ID from a dchan.
void filterForContainedHitLists(art::Handle< std::vector< novaddt::HitList > > &ddt_slices, std::unique_ptr< std::vector< HitList > > &contained_hitlists)
enum BeamMode string