Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
hough::HoughValidate Class Reference

Validate Hough transform algorithms. More...

Inheritance diagram for hough::HoughValidate:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 HoughValidate (fhicl::ParameterSet const &p)
 
virtual ~HoughValidate ()
 
void beginJob ()
 
void analyze (const art::Event &e)
 
void reconfigure (const fhicl::ParameterSet &p)
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

void HoughLineToDetector (const rb::HoughResult *hr, unsigned int hrIdx, double *pz1, double *px1, double *pz2, double *px2)
 

Private Attributes

TTree * fNtTree
 
HValidateNtfNt
 
std::string fMCLabel
 Label for process that made MCTruth. More...
 
std::string fSliceLabel
 Label for process that made Cluster. More...
 
std::string fHoughResultLabel
 Label for process that made HoughResult. More...
 
bool fIsMC
 Flag for is MC or not. More...
 
std::string fCAFLabel
 label for the process that made the standard records More...
 
bool fApplyCAFCuts
 should we apply the caf level cuts? More...
 
int fCutType
 what cuts to apply (see CAFCutter.h) More...
 
recovalid::CAFCutter fCAFCutter
 the CAFCutter helper class More...
 
unsigned int fMinHit
 Slices must have at least this many hits. More...
 
unsigned int fMinHitX
 Minimum hits in x-view/slice. More...
 
unsigned int fMinHitY
 Minumum hits in y-view/slice. More...
 
TH1I * fNumHLX
 
TH1I * fNumHLY
 
TH1F * fThreshX
 
TH1F * fThreshY
 
TH1I * fOnlineX [4]
 
TH1I * fOnlineY [4]
 
TH1F * fRhoX [4]
 
TH1F * fRhoY [4]
 
TH1F * fThetaX [4]
 
TH1F * fThetaY [4]
 
TH1F * fPeakX [4]
 
TH1F * fPeakY [4]
 
TH1F * fPeakThreshX [4]
 
TH1F * fPeakThreshY [4]
 
TH1F * fPerpDX [4]
 
TH1F * fPerpDY [4]
 

Detailed Description

Validate Hough transform algorithms.

Definition at line 52 of file HoughValidate_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

hough::HoughValidate::HoughValidate ( fhicl::ParameterSet const &  p)
explicit

Definition at line 121 of file HoughValidate_module.cc.

References reconfigure().

122  : EDAnalyzer(p)
123  {
124  this->reconfigure(p);
125  }
const char * p
Definition: xmltok.h:285
void reconfigure(const fhicl::ParameterSet &p)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
hough::HoughValidate::~HoughValidate ( )
virtual

Definition at line 245 of file HoughValidate_module.cc.

246  {
247  }

Member Function Documentation

void hough::HoughValidate::analyze ( const art::Event e)

Require a minimum number of hits in each view

Definition at line 301 of file HoughValidate_module.cc.

References rb::Cluster::AllCells(), ana::assert(), simb::MCNeutrino::CCNC(), getBrightness::cell, geo::GeometryBase::CountCellsOnLineFast(), DEFINE_ART_MODULE(), geo::DsqrToLine(), simb::MCParticle::E(), art::EventID::event(), hough::HValidateNt::evt, fApplyCAFCuts, fCAFCutter, fCAFLabel, fCutType, fHoughResultLabel, fIsMC, fMCLabel, fMinHit, fMinHitX, fMinHitY, fNt, fNtTree, fNumHLX, fNumHLY, fOnlineX, fOnlineY, rb::HoughResult::fPeak, fPeakThreshX, fPeakThreshY, fPeakX, fPeakY, fPerpDX, fPerpDY, fRhoX, fRhoY, fSliceLabel, fThetaX, fThetaY, fThreshX, fThreshY, rb::HoughResult::fView, geom(), art::DataViewImpl::getByLabel(), HoughLineToDetector(), MECModelEnuComparisons::i, art::Event::id(), rb::IsFiltered(), rb::Cluster::IsNoise(), geo::kX, geo::kY, hough::HValidateNt::mcdp1x, hough::HValidateNt::mcdp1y, hough::HValidateNt::mcdp2x, hough::HValidateNt::mcdp2y, hough::HValidateNt::mcdp3x, hough::HValidateNt::mcdp3y, hough::HValidateNt::mcdp4x, hough::HValidateNt::mcdp4y, getGoodRuns4SAM::n, rb::Cluster::NCell(), simb::MCNeutrino::Nu(), hough::HValidateNt::nuCCNC, hough::HValidateNt::nuE, hough::HValidateNt::numHLX, hough::HValidateNt::numHLY, hough::HValidateNt::nupdg, hough::HValidateNt::nuX, hough::HValidateNt::nuY, hough::HValidateNt::nuZ, rb::Cluster::NXCell(), rb::Cluster::NYCell(), hough::HValidateNt::on1x, hough::HValidateNt::on1y, hough::HValidateNt::on2x, hough::HValidateNt::on2y, hough::HValidateNt::on3x, hough::HValidateNt::on3y, hough::HValidateNt::on4x, hough::HValidateNt::on4y, recovalid::CAFCutter::passCuts(), simb::MCParticle::PdgCode(), hough::HValidateNt::peak1x, hough::HValidateNt::peak1y, hough::HValidateNt::peak2x, hough::HValidateNt::peak2y, hough::HValidateNt::peak3x, hough::HValidateNt::peak3y, hough::HValidateNt::peak4x, hough::HValidateNt::peak4y, hough::HValidateNt::perpdist1x, hough::HValidateNt::perpdist1y, hough::HValidateNt::perpdist2x, hough::HValidateNt::perpdist2y, hough::HValidateNt::perpdist3x, hough::HValidateNt::perpdist3y, hough::HValidateNt::perpdist4x, hough::HValidateNt::perpdist4y, NDAPDHVSetting::plane, hough::HValidateNt::rho1x, hough::HValidateNt::rho1y, hough::HValidateNt::rho2x, hough::HValidateNt::rho2y, hough::HValidateNt::rho3x, hough::HValidateNt::rho3y, hough::HValidateNt::rho4x, hough::HValidateNt::rho4y, hough::HValidateNt::run, art::Event::run(), rb::HoughResult::SlopeIcept(), std::sqrt(), hough::HValidateNt::subrun, art::Event::subRun(), hough::HValidateNt::theta1x, hough::HValidateNt::theta1y, hough::HValidateNt::theta2x, hough::HValidateNt::theta2y, hough::HValidateNt::theta3x, hough::HValidateNt::theta3y, hough::HValidateNt::theta4x, hough::HValidateNt::theta4y, hough::HValidateNt::threshx, hough::HValidateNt::threshy, simb::MCParticle::Vx(), simb::MCParticle::Vy(), simb::MCParticle::Vz(), x1, and submit_syst::x2.

302  {
303 
304  // get the slices and we'll then get the HoughResults associated with the slice
306  evt.getByLabel(fSliceLabel, hSlices);
307 
308  // get the MCTruth info
310  if(fIsMC == 1) evt.getByLabel(fMCLabel, mclist);
311 
312  // Get the FMP for the Standard Records
314 
315  /*
316  // NOTE: I was using this for the MC dot product validation, but I'm
317  // temporarily skipping that since sim::ParticleList is no longer being used
318 
319  // get the particle list for trajectory lengths
320  art::Handle< std::vector<sim::ParticleList> > particlelist;
321  evt.getByLabel("geantgen", particlelist);
322  */
323 
324  // load event ID info into Ntuple
325  fNt->run = evt.run();
326  fNt->subrun = evt.subRun();
327  fNt->evt = evt.id().event();
328 
329  // a set of temp vectors to fill the Ntuple
330  std::vector<int> numHLXtemp;
331  std::vector<int> numHLYtemp;
332 
333  std::vector<double> nuXtemp;
334  std::vector<double> nuYtemp;
335  std::vector<double> nuZtemp;
336  std::vector<double> nuEtemp;
337 
338  std::vector<int> nupdgtemp;
339  std::vector<int> nuCCNCtemp;
340 
341  const unsigned int NUM = 4;
342  std::vector<double> perpdistxtemp[NUM];
343  std::vector<double> perpdistytemp[NUM];
344 
345  std::vector<double> mcdpxtemp[NUM];
346  std::vector<double> mcdpytemp[NUM];
347 
348  std::vector<double> onxtemp[NUM];
349  std::vector<double> onytemp[NUM];
350 
351  std::vector<double> rhoxtemp[NUM];
352  std::vector<double> rhoytemp[NUM];
353 
354  std::vector<double> thetaxtemp[NUM];
355  std::vector<double> thetaytemp[NUM];
356 
357  std::vector<double> threshxtemp;
358  std::vector<double> threshytemp;
359 
360  std::vector<double> peakxtemp[NUM]; // 1st, 2nd, 3rd peak in X
361  std::vector<double> peakytemp[NUM]; // 1st, 2nd, 3rd peak in Y
362 
363  //object to get hough lines associated with the slice
365 
366  // Loop over slices
367  for(unsigned int slIdx = 0; slIdx < hSlices->size(); ++slIdx){
368 
369 
370  // Apply the CAF-level cuts
371  bool pass = true;
372  if( fApplyCAFCuts ) {
373  // get record associated with the slice
374  std::vector< art::Ptr<caf::StandardRecord> > records = recordFMP.at(slIdx);
375  if (records.size() > 0 && recordFMP.isValid()) {
376  pass = fCAFCutter.passCuts(fCutType, records[0].get());
377  }
378  else { pass = false; }
379  }
380 
381  if(!pass) continue;
382 
383 
384 
385  if(rb::IsFiltered(evt,hSlices,slIdx)) continue;
386 
387  const rb::Cluster& slice = (*hSlices)[slIdx];
388 
389  if(slice.IsNoise()) continue;
390 
391  ///Require a minimum number of hits in each view
392  if(slice.NXCell() < fMinHitX) continue;
393  if(slice.NYCell() < fMinHitY) continue;
394  if(slice.NCell() < fMinHit) continue;
395 
396  // Get HitMap containing all slice hits
397  const rb::HitMap hitmap(slice.AllCells());
398 
399  std::vector< art::Ptr<rb::HoughResult> > hrs = fmhr.at(slIdx);
400 
401  // This validation information is gathered for both data and MC
402  for(unsigned int hrIdx = 0; hrIdx < hrs.size(); ++hrIdx) {
403 
404  // Skip empty HoughResults
405  if(hrs.size() == 0) continue;
406 
407  if(hrs[hrIdx]->fView == geo::kX) {
408 
409  const rb::HoughResult* hrxp = hrs[hrIdx].get();
410 
411  const unsigned int xpMax = hrxp->fPeak.size();
412 
413  numHLXtemp.push_back(xpMax);
414  fNumHLX->Fill(xpMax);
415 
416  if(xpMax == 0 || xpMax > NUM) continue;
417 
418  fThreshX->Fill(hrxp->fPeak[0].fThr);
419  threshxtemp.push_back(hrxp->fPeak[0].fThr); // temp in X
420 
421  // Loop over Hough Peaks
422  for(unsigned int pIdx = 0; pIdx < xpMax; ++pIdx){
423 
425 
426  double z1, z2, x1, x2;
427  std::vector< geo::OfflineChan > hrx_online;
428 
429  this->HoughLineToDetector(hrxp, pIdx, &z1, &x1, &z2, &x2);
430 
431  assert(hrxp->fView == geo::kX);
432  geom->CountCellsOnLineFast(hrxp->fView,
433  x1, z1,
434  x2, z2,
435  hrx_online);
436 
437  int online_x = -1;
438  int counter_x = 0;
439  for(unsigned int n = 0; n < hrx_online.size(); ++n){
440  const unsigned int plane = hrx_online[n].Plane();
441  const unsigned int cell = hrx_online[n].Cell();
442  if(hitmap.CellExists(plane,cell)){
443  ++counter_x;
444  }
445  }
446 
447  if(counter_x > 0) online_x = counter_x;
448 
449  fOnlineX[pIdx]->Fill(online_x);
450  fRhoX[pIdx]->Fill(hrxp->fPeak[pIdx].fRho);
451  fThetaX[pIdx]->Fill(hrxp->fPeak[pIdx].fTheta);
452  fPeakX[pIdx]->Fill(hrxp->fPeak[pIdx].fH);
453  fPeakThreshX[pIdx]->Fill((hrxp->fPeak[pIdx].fH)/(hrxp->fPeak[pIdx].fThr));
454 
455  onxtemp[pIdx].push_back(online_x);
456  rhoxtemp[pIdx].push_back(hrxp->fPeak[pIdx].fRho);
457  thetaxtemp[pIdx].push_back(hrxp->fPeak[pIdx].fTheta);
458  peakxtemp[pIdx].push_back(hrxp->fPeak[pIdx].fH);
459  } // end loop over peaks
460  } // end loop over X-view
461 
462  if(hrs[hrIdx]->fView == geo::kY) {
463 
464  const rb::HoughResult* hryp = hrs[hrIdx].get();
465 
466  const unsigned int ypMax = hryp->fPeak.size();
467 
468  numHLYtemp.push_back(ypMax);
469  fNumHLY->Fill(ypMax);
470  if(ypMax == 0 || ypMax > NUM) continue;
471  fThreshY->Fill(hryp->fPeak[0].fThr);
472  threshytemp.push_back(hryp->fPeak[0].fThr);
473 
474  for(unsigned int pIdx = 0; pIdx < ypMax; ++pIdx){
475 
477 
478  double z1, z2, x1, x2;
479  std::vector< geo::OfflineChan > hry_online;
480 
481  this->HoughLineToDetector(hryp, pIdx, &z1, &x1, &z2, &x2);
482 
483  assert(hryp->fView == geo::kY);
484  geom->CountCellsOnLineFast(hryp->fView,
485  x1, z1,
486  x2, z2,
487  hry_online);
488 
489  // Initialise number of lines in y to -1 for cases where there are X Hough
490  // lines but no Y and vice-versa
491  int online_y = -1;
492  int counter_y = 0;
493 
494  for(unsigned int n = 0; n < hry_online.size(); ++n){
495  const unsigned int plane = hry_online[n].Plane();
496  const unsigned int cell = hry_online[n].Cell();
497  if(hitmap.CellExists(plane,cell)){
498  ++counter_y;
499  }
500  }
501 
502  if(counter_y > 0) online_y = counter_y;
503 
504  fOnlineY[pIdx]->Fill(online_y);
505  fRhoY[pIdx]->Fill(hryp->fPeak[pIdx].fRho);
506  fThetaY[pIdx]->Fill(hryp->fPeak[pIdx].fTheta);
507  fPeakY[pIdx]->Fill(hryp->fPeak[pIdx].fH);
508  fPeakThreshY[pIdx]->Fill((hryp->fPeak[pIdx].fH)/(hryp->fPeak[pIdx].fThr));
509 
510  onytemp[pIdx].push_back(online_y);
511  rhoytemp[pIdx].push_back(hryp->fPeak[pIdx].fRho);
512  thetaytemp[pIdx].push_back(hryp->fPeak[pIdx].fTheta);
513  peakytemp[pIdx].push_back(hryp->fPeak[pIdx].fH);
514  } // end loop over peaks
515  } // end loop over Y-view
516  } // end loop over HoughResults
517 
518 
519  // additional validation info gathered for MC files
520  if(fIsMC == 1){
521 
522  // validate perpendicular distance to top four lines
523  if(hrs.size() > 0){
524 
525  for(unsigned int i = 0; i < mclist->size(); i++) {
526 
527  simb::MCNeutrino nu = (*mclist)[i].GetNeutrino();
528  simb::MCParticle Nu = nu.Nu();
529 
530  // BEWARE OF SEGFAULTS!!! If this MCTruth did NOT come from a neutrino,
531  // then we must skip the next bit to avoid segfaluts.
532  if(!(Nu.PdgCode() == 12 || Nu.PdgCode() == 14 || Nu.PdgCode() == 16)) continue;
533 
534  double xt = Nu.Vx();
535  double yt = Nu.Vy();
536  double zt = Nu.Vz();
537 
538  nuXtemp.push_back(xt);
539  nuYtemp.push_back(yt);
540  nuZtemp.push_back(zt);
541  nuEtemp.push_back(Nu.E());
542  nupdgtemp.push_back(Nu.PdgCode());
543  nuCCNCtemp.push_back(nu.CCNC());
544 
545 
546  for(unsigned int hrIdx = 0; hrIdx < hrs.size(); ++hrIdx) {
547 
548  // variables used in validation
549  double m1 = 0.0;
550  double b1 = 0.0;
551  double distx = 0.0, disty = 0.0;
552 
553  //x-view mc validation
554  if(hrs[hrIdx]->fView == geo::kX) {
555  const rb::HoughResult* hrxp = hrs[hrIdx].get();
556  const unsigned int xpMax = hrxp->fPeak.size();
557 
558  if(xpMax == 0 || xpMax >= NUM) continue;
559  for(unsigned int pIdx = 0;pIdx < xpMax; ++pIdx){
560  // perpendicular distance to ith line validation
561  hrxp->SlopeIcept(pIdx, &m1, &b1);
562  distx = sqrt(geo::DsqrToLine(zt, xt, 0.0, b1, 100.0, 100.0*m1 + b1));
563  perpdistxtemp[pIdx].push_back(distx);
564 
565  fPerpDX[pIdx]->Fill(distx);
566  } // end loop over x-view Peaks
567  } // end if fView == geo::kX
568 
569  //y-view mc validation
570  if(hrs[hrIdx]->fView == geo::kY) {
571  const rb::HoughResult* hryp = hrs[hrIdx].get();
572  const unsigned int ypMax = hryp->fPeak.size();
573 
574  if(ypMax == 0 || ypMax >= NUM) continue;
575  for(unsigned int pIdx = 0;pIdx < ypMax; ++pIdx){
576  // perpendicular distance to ith line validation
577  hryp->SlopeIcept(pIdx, &m1, &b1);
578  disty = sqrt(geo::DsqrToLine(zt, yt, 0.0, b1, 100.0, 100.0*m1 + b1));
579  perpdistytemp[pIdx].push_back(disty);
580 
581  fPerpDY[pIdx]->Fill(disty);
582  } // end loop over y-view Peaks
583  } // end if fView == geo::kY
584 
585  } // end for hrIdx
586  } // end for i (loop over size of MClist)
587  } // if hrs->size() > 0
588  } // end if(fIsMC)
589 
590 
591  } // end loop over slices
592 
593  // NOTE: I was using this for the MC dot product validation, but I'm
594  // temporarily skipping that since sim::ParticleList is no longer being used
595  //
596  // If I decide to put this back in, it belongs in the if(hr->size() > 0) loop found above
597  /*
598  if(hr->size() > 0) {
599 
600  // MC dot product validation
601  //
602  // NOTE: This could be a little more efficient if I had integrated this section into the other loops
603  // (instead of looping over mclist two seperate times.) BUT this already runs very quickly and it
604  // was cleaner to code and debug this way...
605 
606  for(unsigned int k = 0; k < hr->size(); ++k) {
607  if((*hHoughs)[k].fPeak.size() != 0) {
608 
609  // variables used in MC-trajectory dot product validation
610  double dp = -999.0;
611  unsigned int track1 = 999, track2 = 999;
612 
613  double xy = 0.0, z = 0.0;
614  double m = 0.0, b = 0.0;
615 
616  // x-view
617  if((*hHoughs)[k].fView == geo::kX) {
618 
619  //std::cout << "\n\nevent ID: " << evt.id() << "\n";
620 
621  // loop over the number of MC reactions
622  for(unsigned int i = 0; i < particlelist->size(); ++i) {
623 
624  art::Ptr<sim::ParticleList> plist(particlelist, i);
625 
626  // loop over all particles and find the one closest to first hough line
627  (*hHoughs)[k].SlopeIcept(0, &m, &b);
628  for (unsigned int c = 0; c != plist->fParticles.size(); ++c) {
629 
630  int pdg = (*plist).fParticles[c].PdgCode();
631 
632  // don't let a hough line match a particle that wouldn't leave a signal in the detector
633  // (nu-e, nu-mu, nu-tau, neutron, pi0)
634 
635 
636 
637  // ADD ANTI-MATTER VERSIONS OF THESE PARTICLES AS WELL!!!!!!!
638 
639 
640 
641  if(pdg != 12 && pdg != 14 && pdg != 16 && pdg != 2112 && pdg != 111) {
642 
643  double mcslope = 0.0;
644  double xytemp = 0.0;
645  double dptemp = 0.0;
646  double d = 0.0;
647 
648  xytemp = (*plist).fParticles[c].Px();
649  z = (*plist).fParticles[c].Pz();
650  // make (xy,z) a unit vector
651  xy = xytemp/sqrt(xytemp*xytemp + z*z);
652  z = z/sqrt(xytemp*xytemp + z*z);
653 
654  if(z != 0.0) mcslope = xy/z;
655  else mcslope = 1.0E9;
656 
657  dptemp = (1 + m*mcslope)/sqrt(1 + m*m + mcslope*mcslope + m*m*mcslope*mcslope);
658  if(dptemp < 0.0) dptemp = -dptemp;
659 
660  d = sqrt(geo::DsqrToLine((*plist).fParticles[c].Vz(),(*plist).fParticles[c].Vx(), 0.0, b, 100.0, 100.0*m + b));
661 
662  // dot product must be bigger than the old one AND the hough line must pass within 10.0cm of the true vertex of the particle
663  // AND the track-length of the particle must be > 20.0cm
664  if(dptemp > dp && d < 10.0 && (*plist).fParticles[c].Trajectory().TotalLength() > 10.0) {dp = dptemp; track1 = c;}
665 
666  } // end if(pdg codes)
667 
668  } // end for c
669 
670  mcdp1xtemp.push_back(dp);
671 
672  //std::cout << "height/threshold = " << (*hHoughs)[k].fPeak[0].fH/(*hHoughs)[k].fPeak[0].fThr
673  //<< " peak = " << (*hHoughs)[k].fPeak[0].fH
674  //<< " threshold = " << (*hHoughs)[k].fPeak[0].fThr
675  //<< " dp = " << dp << "\n";
676 
677  //if(dp < 0.0) std::cout << "\n\nFirst line X: (no match)\n";
678  //else std::cout << "\n\nFirst line X: particle# = " << track1 << " PDG = " << (*plist).fParticles[track1].PdgCode() << " dp = " << dp
679  // << " track length = " << (*plist).fParticles[track1].Trajectory().TotalLength() << "\n";
680 
681 
682 
683  // loop over all particles and find the one closest to second hough line
684  dp = -999.0;
685  if((*hHoughs)[k].fPeak.size() > 1) {
686 
687  (*hHoughs)[k].SlopeIcept(1, &m, &b);
688  for (unsigned int c = 0; c != plist->fParticles.size(); ++c) {
689 
690 
691  // skip particle if it is already associated with the first hough line
692  if(c != track1) {
693 
694  int pdg = (*plist).fParticles[c].PdgCode();
695 
696  // don't let a hough line match a particle that wouldn't leave a signal in the detector (nu-e, nu-mu, nu-tau, neutron, pi0)
697  if(pdg != 12 && pdg != 14 && pdg != 16 && pdg != 2112 && pdg != 111) {
698 
699  double mcslope = 0.0;
700  double xytemp = 0.0;
701  double dptemp = 0.0;
702  double d = 0.0;
703 
704  xytemp = (*plist).fParticles[c].Px();
705  z = (*plist).fParticles[c].Pz();
706  // make (xy,z) a unit vector
707  xy = xytemp/sqrt(xytemp*xytemp + z*z);
708  z = z/sqrt(xytemp*xytemp + z*z);
709 
710  if(z != 0.0) mcslope = xy/z;
711  else mcslope = 1.0E9;
712 
713  dptemp = (1 + m*mcslope)/sqrt(1 + m*m + mcslope*mcslope + m*m*mcslope*mcslope);
714  if(dptemp < 0.0) dptemp = -dptemp;
715 
716  d = sqrt(geo::DsqrToLine((*plist).fParticles[c].Vz(),(*plist).fParticles[c].Vx(), 0.0, b, 100.0, 100.0*m + b));
717 
718  // dot product must be bigger than the old one AND the hough line must pass within 10.0cm of the true vertex of the particle
719  // AND the track-length of the particle must be > 20.0cm
720  if(dptemp > dp && d < 10.0 && (*plist).fParticles[c].Trajectory().TotalLength() > 10.0) {dp = dptemp; track2 = c;}
721 
722  } // end if(pdg codes)
723 
724  } // end if(c != track1)
725  } // end for c
726 
727  mcdp2xtemp.push_back(dp);
728 
729  //if(dp < 0.0) std::cout << "\n\nSecond line X: (no match)\n";
730  //else std::cout << "\n\nSecond line X: particle# = " << track2 << " PDG = " << (*plist).fParticles[track2].PdgCode() << " dp = " << dp
731  // << " track length = " << (*plist).fParticles[track2].Trajectory().TotalLength() << "\n";
732  } // end if(peak.size > 1)
733 
734 
735 
736  // loop over all particles and find the one closest to third hough line
737  dp = -999.0;
738  if((*hHoughs)[k].fPeak.size() > 2) {
739 
740  (*hHoughs)[k].SlopeIcept(2, &m, &b);
741  for (unsigned int c = 0; c != plist->fParticles.size(); ++c) {
742 
743  // skip particle if it is already associated with the first or second hough line
744  if(c != track1 && c != track2) {
745 
746  int pdg = (*plist).fParticles[c].PdgCode();
747 
748  // don't let a hough line match a particle that wouldn't leave a signal in the detector (nu-e, nu-mu, nu-tau, neutron, pi0)
749  if(pdg != 12 && pdg != 14 && pdg != 16 && pdg != 2112 && pdg != 111) {
750 
751  double mcslope = 0.0;
752  double xytemp = 0.0;
753  double dptemp = 0.0;
754  double d = 0.0;
755 
756  xytemp = (*plist).fParticles[c].Px();
757  z = (*plist).fParticles[c].Pz();
758  // make (xy,z) a unit vector
759  xy = xytemp/sqrt(xytemp*xytemp + z*z);
760  z = z/sqrt(xytemp*xytemp + z*z);
761 
762  if(z != 0.0) mcslope = xy/z;
763  else mcslope = 1.0E9;
764 
765  dptemp = (1 + m*mcslope)/sqrt(1 + m*m + mcslope*mcslope + m*m*mcslope*mcslope);
766  if(dptemp < 0.0) dptemp = -dptemp;
767 
768  d = sqrt(geo::DsqrToLine((*plist).fParticles[c].Vz(),(*plist).fParticles[c].Vx(), 0.0, b, 100.0, 100.0*m + b));
769 
770  // dot product must be bigger than the old one AND the hough line must pass within 10.0cm of the true vertex of the particle
771  // AND the track-length of the particle must be > 20.0cm
772  if(dptemp > dp && d < 10.0 && (*plist).fParticles[c].Trajectory().TotalLength() > 10.0) dp = dptemp;
773 
774  } // end if(pdg codes)
775 
776  } // end if(c != track1 && c != track2)
777  } // end for c
778 
779  mcdp3xtemp.push_back(dp);
780 
781  //if(dp < 0.0) std::cout << "\n\nThird line X: (no match)\n";
782  //else std::cout << "\n\nThird line X: particle# = " << track3 << " PDG = " << (*plist).fParticles[track3].PdgCode() << " dp = " << dp
783  // << " track length = " << (*plist).fParticles[track3].Trajectory().TotalLength() << "\n";
784  } // end if(peak.size > 2)
785 
786  } // end for i
787  } // end if(x-view)
788 
789 
790 
791  // y-view
792  if((*hHoughs)[k].fView == geo::kY) {
793 
794  // loop over the number of MC reactions
795  for(unsigned int i = 0; i < particlelist->size(); ++i) {
796 
797  art::Ptr<sim::ParticleList> plist(particlelist, i);
798 
799  // loop over all particles and find the one closest to first hough line
800  (*hHoughs)[k].SlopeIcept(0, &m, &b);
801  for (unsigned int c = 0; c != plist->fParticles.size(); ++c) {
802 
803  int pdg = (*plist).fParticles[c].PdgCode();
804 
805  // don't let a hough line match a particle that wouldn't leave a signal in the detector (nu-e, nu-mu, nu-tau, neutron, pi0)
806  if(pdg != 12 && pdg != 14 && pdg != 16 && pdg != 2112 && pdg != 111) {
807 
808  double mcslope = 0.0;
809  double xytemp = 0.0;
810  double dptemp = 0.0;
811  double d = 0.0;
812 
813  xytemp = (*plist).fParticles[c].Py();
814  z = (*plist).fParticles[c].Pz();
815  // make (xy,z) a unit vector
816  xy = xytemp/sqrt(xytemp*xytemp + z*z);
817  z = z/sqrt(xytemp*xytemp + z*z);
818 
819  if(z != 0.0) mcslope = xy/z;
820  else mcslope = 1.0E9;
821 
822  dptemp = (1 + m*mcslope)/sqrt(1 + m*m + mcslope*mcslope + m*m*mcslope*mcslope);
823  if(dptemp < 0.0) dptemp = -dptemp;
824 
825  d = sqrt(geo::DsqrToLine((*plist).fParticles[c].Vz(),(*plist).fParticles[c].Vy(), 0.0, b, 100.0, 100.0*m + b));
826 
827  // dot product must be bigger than the old one AND the hough line must pass within 10.0cm of the true vertex of the particle
828  // AND the track-length of the particle must be > 20.0cm
829  if(dptemp > dp && d < 10.0 && (*plist).fParticles[c].Trajectory().TotalLength() > 10.0) {dp = dptemp; track1 = c;}
830 
831  } // end if(pdg codes)
832 
833  } // end for c
834 
835  mcdp1ytemp.push_back(dp);
836 
837  //if(dp < 0.0) std::cout << "\n\nFirst line Y: (no match)\n";
838  //else std::cout << "\n\nFirst line Y: particle# = " << track1 << " PDG = " << (*plist).fParticles[track1].PdgCode() << " dp = " << dp
839  // << " track length = " << (*plist).fParticles[track1].Trajectory().TotalLength() << "\n";
840 
841 
842  // loop over all particles and find the one closest to second hough line
843  dp = -999.0;
844  if((*hHoughs)[k].fPeak.size() > 1) {
845 
846  (*hHoughs)[k].SlopeIcept(1, &m, &b);
847  for (unsigned int c = 0; c != plist->fParticles.size(); ++c) {
848 
849 
850  // skip particle if it is already associated with the first hough line
851  if(c != track1) {
852 
853  int pdg = (*plist).fParticles[c].PdgCode();
854 
855  // don't let a hough line match a particle that wouldn't leave a signal in the detector (nu-e, nu-mu, nu-tau, neutron, pi0)
856  if(pdg != 12 && pdg != 14 && pdg != 16 && pdg != 2112 && pdg != 111) {
857 
858  double mcslope = 0.0;
859  double xytemp = 0.0;
860  double dptemp = 0.0;
861  double d = 0.0;
862 
863  xytemp = (*plist).fParticles[c].Py();
864  z = (*plist).fParticles[c].Pz();
865  // make (xy,z) a unit vector
866  xy = xytemp/sqrt(xytemp*xytemp + z*z);
867  z = z/sqrt(xytemp*xytemp + z*z);
868 
869  if(z != 0.0) mcslope = xy/z;
870  else mcslope = 1.0E9;
871 
872  dptemp = (1 + m*mcslope)/sqrt(1 + m*m + mcslope*mcslope + m*m*mcslope*mcslope);
873  if(dptemp < 0.0) dptemp = -dptemp;
874 
875  d = sqrt(geo::DsqrToLine((*plist).fParticles[c].Vz(),(*plist).fParticles[c].Vy(), 0.0, b, 100.0, 100.0*m + b));
876 
877  // dot product must be bigger than the old one AND the hough line must pass within 10.0cm of the true vertex of the particle
878  // AND the track-length of the particle must be > 20.0cm
879  if(dptemp > dp && d < 10.0 && (*plist).fParticles[c].Trajectory().TotalLength() > 10.0) {dp = dptemp; track2 = c;}
880 
881  } // end if(pdg codes)
882 
883  } // end if(c != track1)
884  } // end for c
885 
886  mcdp2ytemp.push_back(dp);
887 
888  //if(dp < 0.0) std::cout << "\n\nSecond line Y: (no match)\n";
889  //else std::cout << "\n\nSecond line Y: particle# = " << track2 << " PDG = " << (*plist).fParticles[track2].PdgCode() << " dp = " << dp
890  // << " track length = " << (*plist).fParticles[track2].Trajectory().TotalLength() << "\n";
891  } // end if(peak.size > 1)
892 
893 
894 
895  // loop over all particles and find the one closest to third hough line
896  dp = -999.0;
897  if((*hHoughs)[k].fPeak.size() > 2) {
898 
899  (*hHoughs)[k].SlopeIcept(2, &m, &b);
900  for (unsigned int c = 0; c != plist->fParticles.size(); ++c) {
901 
902  // skip particle if it is already associated with the first or second hough line
903  if(c != track1 && c != track2) {
904 
905  int pdg = (*plist).fParticles[c].PdgCode();
906 
907  // don't let a hough line match a particle that wouldn't leave a signal in the detector (nu-e, nu-mu, nu-tau, neutron, pi0)
908  if(pdg != 12 && pdg != 14 && pdg != 16 && pdg != 2112 && pdg != 111) {
909 
910  double mcslope = 0.0;
911  double xytemp = 0.0;
912  double dptemp = 0.0;
913  double d = 0.0;
914 
915  xytemp = (*plist).fParticles[c].Py();
916  z = (*plist).fParticles[c].Pz();
917  // make (xy,z) a unit vector
918  xy = xytemp/sqrt(xytemp*xytemp + z*z);
919  z = z/sqrt(xytemp*xytemp + z*z);
920 
921  if(z != 0.0) mcslope = xy/z;
922  else mcslope = 1.0E9;
923 
924  dptemp = (1 + m*mcslope)/sqrt(1 + m*m + mcslope*mcslope + m*m*mcslope*mcslope);
925  if(dptemp < 0.0) dptemp = -dptemp;
926 
927  d = sqrt(geo::DsqrToLine((*plist).fParticles[c].Vz(),(*plist).fParticles[c].Vy(), 0.0, b, 100.0, 100.0*m + b));
928 
929  // dot product must be bigger than the old one AND the hough line must pass within 10.0cm of the true vertex of the particle
930  // AND the track-length of the particle must be > 20.0cm
931  if(dptemp > dp && d < 10.0 && (*plist).fParticles[c].Trajectory().TotalLength() > 10.0) dp = dptemp;
932 
933  } // end if(pdg codes)
934 
935  } // end if(c != track1 && c != track2)
936  } // end for c
937 
938  mcdp3ytemp.push_back(dp);
939 
940  //if(dp < 0.0) std::cout << "\n\nThird line Y: (no match)\n";
941  //else std::cout << "\n\nThird line Y: particle# = " << track3 << " PDG = " << (*plist).fParticles[track3].PdgCode() << " dp = " << dp
942  // << " track length = " << (*plist).fParticles[track3].Trajectory().TotalLength() << "\n";
943  } // end if(peak.size > 2)
944 
945  } // end for i
946  } // end if(y-view)
947 
948  } // end if((*hHoughs)[k].size() != 0)
949  } // end for k
950  } // end dot product validation
951  */
952 
953 
954 
955 
956  fNt->numHLX = numHLXtemp;
957  fNt->numHLY = numHLYtemp;
958 
959  fNt->nuX = nuXtemp;
960  fNt->nuY = nuYtemp;
961  fNt->nuZ = nuZtemp;
962  fNt->nuE = nuEtemp;
963 
964  fNt->nupdg = nupdgtemp;
965  fNt->nuCCNC = nuCCNCtemp;
966 
967  fNt->perpdist1x = perpdistxtemp[0];
968  fNt->perpdist1y = perpdistytemp[0];
969  fNt->perpdist2x = perpdistxtemp[1];
970  fNt->perpdist2y = perpdistytemp[1];
971  fNt->perpdist3x = perpdistxtemp[2];
972  fNt->perpdist3y = perpdistytemp[2];
973  fNt->perpdist4x = perpdistxtemp[3];
974  fNt->perpdist4y = perpdistytemp[3];
975 
976  fNt->mcdp1x = mcdpxtemp[0];
977  fNt->mcdp1y = mcdpytemp[0];
978  fNt->mcdp2x = mcdpxtemp[1];
979  fNt->mcdp2y = mcdpytemp[1];
980  fNt->mcdp3x = mcdpxtemp[2];
981  fNt->mcdp3y = mcdpytemp[2];
982  fNt->mcdp4x = mcdpxtemp[3];
983  fNt->mcdp4y = mcdpytemp[3];
984 
985  fNt->on1x = onxtemp[0];
986  fNt->on2x = onxtemp[1];
987  fNt->on3x = onxtemp[2];
988  fNt->on4x = onxtemp[3];
989  fNt->on1y = onytemp[0];
990  fNt->on2y = onytemp[1];
991  fNt->on3y = onytemp[2];
992  fNt->on4y = onytemp[3];
993 
994  fNt->rho1x = rhoxtemp[0];
995  fNt->rho2x = rhoxtemp[1];
996  fNt->rho3x = rhoxtemp[2];
997  fNt->rho4x = rhoxtemp[3];
998  fNt->rho1y = rhoytemp[0];
999  fNt->rho2y = rhoytemp[1];
1000  fNt->rho3y = rhoytemp[2];
1001  fNt->rho4y = rhoytemp[3];
1002 
1003  fNt->theta1x = thetaxtemp[0];
1004  fNt->theta2x = thetaxtemp[1];
1005  fNt->theta3x = thetaxtemp[2];
1006  fNt->theta4x = thetaxtemp[3];
1007  fNt->theta1y = thetaytemp[0];
1008  fNt->theta2y = thetaytemp[1];
1009  fNt->theta3y = thetaytemp[2];
1010  fNt->theta4y = thetaytemp[3];
1011 
1012  fNt->threshx = threshxtemp;
1013  fNt->threshy = threshytemp;
1014 
1015  fNt->peak1x = peakxtemp[0];
1016  fNt->peak2x = peakxtemp[1];
1017  fNt->peak3x = peakxtemp[2];
1018  fNt->peak4x = peakxtemp[3];
1019  fNt->peak1y = peakytemp[0];
1020  fNt->peak2y = peakytemp[1];
1021  fNt->peak3y = peakytemp[2];
1022  fNt->peak4y = peakytemp[3];
1023 
1024  fNtTree->Fill();
1025 
1026  return;
1027 
1028  }
double E(const int i=0) const
Definition: MCParticle.h:232
std::vector< double > on3x
Definition: HValidateNt.h:55
std::vector< double > perpdist2x
Definition: HValidateNt.h:37
std::vector< double > nuE
Definition: HValidateNt.h:30
recovalid::CAFCutter fCAFCutter
the CAFCutter helper class
std::vector< double > peak3y
Definition: HValidateNt.h:89
std::vector< double > mcdp3x
Definition: HValidateNt.h:48
int PdgCode() const
Definition: MCParticle.h:211
int CCNC() const
Definition: MCNeutrino.h:148
std::vector< double > mcdp4x
Definition: HValidateNt.h:50
std::vector< double > theta3x
Definition: HValidateNt.h:73
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
std::vector< double > mcdp3y
Definition: HValidateNt.h:49
std::vector< int > nupdg
Definition: HValidateNt.h:32
std::vector< double > mcdp4y
Definition: HValidateNt.h:51
std::vector< double > peak3x
Definition: HValidateNt.h:85
std::vector< double > on1x
Definition: HValidateNt.h:53
unsigned int fMinHitX
Minimum hits in x-view/slice.
std::vector< double > mcdp2x
Definition: HValidateNt.h:46
std::vector< double > perpdist2y
Definition: HValidateNt.h:38
Float_t x1[n_points_granero]
Definition: compare.C:5
unsigned int fMinHitY
Minumum hits in y-view/slice.
std::vector< int > nuCCNC
Definition: HValidateNt.h:33
std::vector< HoughPeak > fPeak
List of peaks found in Hough space.
Definition: HoughResult.h:61
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
T sqrt(T number)
Definition: d0nt_math.hpp:156
std::string fMCLabel
Label for process that made MCTruth.
std::vector< double > threshy
Definition: HValidateNt.h:81
void HoughLineToDetector(const rb::HoughResult *hr, unsigned int hrIdx, double *pz1, double *px1, double *pz2, double *px2)
Vertical planes which measure X.
Definition: PlaneGeo.h:28
std::vector< double > on4x
Definition: HValidateNt.h:56
A collection of associated CellHits.
Definition: Cluster.h:47
std::vector< double > nuX
Definition: HValidateNt.h:27
std::vector< double > peak1x
Definition: HValidateNt.h:83
std::vector< double > theta4y
Definition: HValidateNt.h:78
std::vector< double > theta1x
Definition: HValidateNt.h:71
std::vector< double > rho3x
Definition: HValidateNt.h:64
std::vector< double > on1y
Definition: HValidateNt.h:57
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Definition: Cluster.cxx:180
void CountCellsOnLineFast(double x1, double y1, double z1, double x2, double y2, double z2, std::vector< OfflineChan > &Xhitsonline, std::vector< OfflineChan > &Yhitsonline)
Make list of cells in each view traversed by a line segment.
Provides efficient lookup of CellHits by plane and cell number.
Definition: HitMap.h:22
std::vector< double > mcdp2y
Definition: HValidateNt.h:47
std::vector< double > rho2x
Definition: HValidateNt.h:63
std::vector< int > numHLX
Definition: HValidateNt.h:24
int fCutType
what cuts to apply (see CAFCutter.h)
std::vector< double > theta2x
Definition: HValidateNt.h:72
std::vector< double > mcdp1y
Definition: HValidateNt.h:45
bool passCuts(int cut, const caf::StandardRecord *sr)
Definition: CAFCutter.cxx:37
void SlopeIcept(unsigned int i, double *m, double *b) const
Slope and intercepts of Hough lines.
Definition: HoughResult.cxx:62
int subrun
subrun number
Definition: HValidateNt.h:21
std::vector< double > theta4x
Definition: HValidateNt.h:74
std::vector< double > theta2y
Definition: HValidateNt.h:76
int run
run number
Definition: HValidateNt.h:20
double DsqrToLine(double x0, double y0, double x1, double y1, double x2, double y2)
In two dimensions, return the perpendicular distance from a point (x0,y0) to a line defined by end po...
Definition: Geo.cxx:338
std::vector< double > peak1y
Definition: HValidateNt.h:87
int evt
std::vector< double > mcdp1x
Definition: HValidateNt.h:44
std::vector< double > peak2y
Definition: HValidateNt.h:88
std::vector< double > peak4y
Definition: HValidateNt.h:90
unsigned int fMinHit
Slices must have at least this many hits.
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
Definition: FilterList.h:96
std::vector< int > numHLY
Definition: HValidateNt.h:25
bool fApplyCAFCuts
should we apply the caf level cuts?
std::vector< double > perpdist1y
Definition: HValidateNt.h:36
std::vector< double > theta3y
Definition: HValidateNt.h:77
std::vector< double > perpdist4x
Definition: HValidateNt.h:41
std::vector< double > rho2y
Definition: HValidateNt.h:67
geo::View_t fView
Transform of x or y view?
Definition: HoughResult.h:56
std::vector< double > on3y
Definition: HValidateNt.h:59
std::vector< double > rho1y
Definition: HValidateNt.h:66
unsigned int NYCell() const
Number of cells in the y-view.
Definition: Cluster.h:108
std::vector< double > rho3y
Definition: HValidateNt.h:68
std::string fSliceLabel
Label for process that made Cluster.
double Vx(const int i=0) const
Definition: MCParticle.h:220
std::vector< double > peak4x
Definition: HValidateNt.h:86
std::vector< double > nuZ
Definition: HValidateNt.h:29
std::vector< double > theta1y
Definition: HValidateNt.h:75
std::vector< double > threshx
Definition: HValidateNt.h:80
std::vector< double > nuY
Definition: HValidateNt.h:28
std::vector< double > on2y
Definition: HValidateNt.h:58
bool fIsMC
Flag for is MC or not.
std::vector< double > perpdist3y
Definition: HValidateNt.h:40
unsigned int NXCell() const
Number of cells in the x-view.
Definition: Cluster.h:106
std::vector< double > rho4y
Definition: HValidateNt.h:69
std::string fCAFLabel
label for the process that made the standard records
void geom(int which=0)
Definition: geom.C:163
std::vector< double > rho4x
Definition: HValidateNt.h:65
double Vz(const int i=0) const
Definition: MCParticle.h:222
assert(nhit_max >=nhit_nbins)
int evt
event number
Definition: HValidateNt.h:22
std::vector< double > perpdist3x
Definition: HValidateNt.h:39
std::vector< double > perpdist4y
Definition: HValidateNt.h:42
std::vector< double > peak2x
Definition: HValidateNt.h:84
std::vector< double > on2x
Definition: HValidateNt.h:54
bool IsNoise() const
Is the noise flag set?
Definition: Cluster.h:163
std::string fHoughResultLabel
Label for process that made HoughResult.
Summary from a Hough transform applied to a group of cell hits.
Definition: HoughResult.h:35
Event generator information.
Definition: MCNeutrino.h:18
std::vector< double > rho1x
Definition: HValidateNt.h:62
double Vy(const int i=0) const
Definition: MCParticle.h:221
std::vector< double > perpdist1x
Definition: HValidateNt.h:35
std::vector< double > on4y
Definition: HValidateNt.h:60
void hough::HoughValidate::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 129 of file HoughValidate_module.cc.

References fNt, fNtTree, fNumHLX, fNumHLY, fOnlineX, fOnlineY, fPeakThreshX, fPeakThreshY, fPeakX, fPeakY, fPerpDX, fPerpDY, fRhoX, fRhoY, fThetaX, fThetaY, fThreshX, fThreshY, MECModelEnuComparisons::i, art::TFileDirectory::make(), plotROC::title, and febshutoff_auto::val.

130  {
131 
133 
134  // book Ntuple
135  fNt = new HValidateNt;
136  fNtTree = tfs->make<TTree>("hough", "Hough Analysis Tree");
137  fNtTree->Branch("fHValidateNt", "hough::HValidateNt", &fNt, 1600, 99);
138 
139  // book histos
140  const TString val[4] = {"1st","2nd","3rd","4th"};
141  const unsigned int maxHists = 4;
142 
143  fNumHLX = tfs->make<TH1I>("NumHoughLinesX",
144  ";Number of X Hough lines;Number of slices",
145  11,-0.5,10.5);
146  fNumHLY = tfs->make<TH1I>("NumHoughLinesY",
147  ";Number of Y Hough lines;Number of slices",
148  11,-0.5,10.5);
149 
150  fThreshX = tfs->make<TH1F>("ThresholdValueX",
151  ";X view threshold (arbitrary units);Number of slices",
152  100,0.0,5.0);
153  fThreshY = tfs->make<TH1F>("ThresholdValueY",
154  ";Y view threshold (arbitrary units);Number of slices",
155  100,0.0,5.0);
156 
157 
158  char title[100];
159  for(unsigned int i = 0; i < maxHists; ++i){
160 
161  sprintf(title,";Number of hits on %s line in X view;Number of slices",val[i].Data());
162  fOnlineX[i] = tfs->make<TH1I>("HitsOnLineX"+val[i],
163  title,
164  301,0,300);
165 
166 
167  sprintf(title,";Number of hits on %s line in Y view;Number of slices",val[i].Data());
168  fOnlineY[i] = tfs->make<TH1I>("HitsOnLineY"+val[i],
169  title,
170  301,0,300);
171 
172  sprintf(title,";#rho for %s line in X view (cm);Number of slices",val[i].Data());
173  fRhoX[i] = tfs->make<TH1F>("RhoX"+val[i],
174  title,
175  200,-400.0,400.0);
176 
177  sprintf(title,";#rho for %s line in Y view (cm);Number of slices",val[i].Data());
178  fRhoY[i] = tfs->make<TH1F>("RhoY"+val[i],
179  title,
180  200,-400.0,400.0);
181 
182  sprintf(title,";#theta for %s line in X view (radians);Number of slices",val[i].Data());
183  fThetaX[i] = tfs->make<TH1F>("ThetaX"+val[i],
184  title,
185  40,0.0,4.0);
186 
187  sprintf(title,";#theta for %s line in Y view (radians);Number of slices",val[i].Data());
188  fThetaY[i] = tfs->make<TH1F>("ThetaY"+val[i],
189  title,
190  40,0.0,4.0);
191 
192  sprintf(title,";Peak value in Hough space map for %s line in X view (arbitrary units);Number of slices",val[i].Data());
193  fPeakX[i] = tfs->make<TH1F>("PeakX"+val[i],
194  title,
195  200,0.0,2000.0);
196 
197  sprintf(title,";Peak over threshold for %s line in X view;Number of slices",val[i].Data());
198  fPeakThreshX[i] = tfs->make<TH1F>("PeakOverThreshX"+val[i],
199  title,
200  200,0.0,10000.0);
201 
202  sprintf(title,";Peak value in Hough space map for %s line in Y view (arbitrary units);Number of slices",val[i].Data());
203  fPeakY[i] = tfs->make<TH1F>("PeakY"+val[i],
204  title,
205  200,0.0,2000.0);
206 
207  sprintf(title,";Peak over threshold for %s line in X view;Number of slices",val[i].Data());
208  fPeakThreshY[i] = tfs->make<TH1F>("PeakOverThreshY"+val[i],
209  title,
210  200,0.0,10000.0);
211 
212  sprintf(title,";Perpendicular distance from true vertex to %s line in X-view (cm);Number of slices",val[i].Data());
213  fPerpDX[i] = tfs->make<TH1F>("PerpDistX"+val[i],
214  title,
215  100,0.0,100.0);
216 
217  sprintf(title,";Perpendicular distance from true vertex to %s line in Y view (cm);Number of slices",val[i].Data());
218  fPerpDY[i] = tfs->make<TH1F>("PerpDistY"+val[i],
219  title,
220  100,0.0,100.0);
221 
222  } // end loop over histogram arrays
223 
224  }
T * make(ARGS...args) const
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDAnalyzer::currentContext ( ) const
protectedinherited
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
void hough::HoughValidate::HoughLineToDetector ( const rb::HoughResult hr,
unsigned int  hrIdx,
double *  pz1,
double *  px1,
double *  pz2,
double *  px2 
)
private

Definition at line 250 of file HoughValidate_module.cc.

References geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), rb::HoughResult::fView, geom(), geo::kX, rb::HoughResult::SlopeIcept(), x1, and submit_syst::x2.

Referenced by analyze().

256  {
258 
259  double slope, icept;
260  hr->SlopeIcept(lineIdx, &slope, &icept);
261 
262  double x1 = 0, x2 = 0;
263  if (hr->fView == geo::kX) {
264  x1 = geom->DetHalfWidth();
265  x2 = -geom->DetHalfWidth();
266  }
267  else {
268  x1 = geom->DetHalfHeight();
269  x2 = -geom->DetHalfHeight();
270  }
271 
272  double z1, z2;
273  z1 = (x1-icept)/slope;
274  z2 = (x2-icept)/slope;
275 
276  if(z1 < 0.0){
277  z1 = 0.0;
278  x1 = slope*z1 + icept;
279  }
280  if(z1 > geom->DetLength()){
281  z1 = geom->DetLength();
282  x1 = slope*z1 + icept;
283  }
284  if(z2 < 0.0){
285  z2 = 0.0;
286  x2 = slope*z2 + icept;
287  }
288  if(z2 > geom->DetLength()){
289  z2 = geom->DetLength();
290  x2 = slope*z2 + icept;
291  }
292 
293  *pz1 = z1;
294  *px1 = x1;
295  *pz2 = z2;
296  *px2 = x2;
297 
298  }
Float_t x1[n_points_granero]
Definition: compare.C:5
Vertical planes which measure X.
Definition: PlaneGeo.h:28
double DetLength() const
void SlopeIcept(unsigned int i, double *m, double *b) const
Slope and intercepts of Hough lines.
Definition: HoughResult.cxx:62
double DetHalfHeight() const
geo::View_t fView
Transform of x or y view?
Definition: HoughResult.h:56
double DetHalfWidth() const
void geom(int which=0)
Definition: geom.C:163
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void hough::HoughValidate::reconfigure ( const fhicl::ParameterSet p)

Definition at line 228 of file HoughValidate_module.cc.

References fApplyCAFCuts, fCAFLabel, fCutType, fHoughResultLabel, fIsMC, fMCLabel, fMinHit, fMinHitX, fMinHitY, fSliceLabel, fhicl::ParameterSet::get(), and string.

Referenced by HoughValidate().

229  {
230  fMCLabel = p.get< std::string > ("MCLabel");
231  fSliceLabel = p.get< std::string > ("SliceLabel");
232  fHoughResultLabel = p.get< std::string > ("HoughResultLabel");
233  fIsMC = p.get< bool > ("IsMC");
234  fMinHit = p.get< unsigned int >("MinHit");
235  fMinHitX = p.get< unsigned int >("MinHitX");
236  fMinHitY = p.get< unsigned int >("MinHitY");
237 
238  fCAFLabel = p.get< std::string > ("CAFLabel");
239  fApplyCAFCuts = p.get< bool > ("ApplyCAFCuts");
240  fCutType = p.get< int > ("CutType");
241  }
unsigned int fMinHitX
Minimum hits in x-view/slice.
unsigned int fMinHitY
Minumum hits in y-view/slice.
std::string fMCLabel
Label for process that made MCTruth.
int fCutType
what cuts to apply (see CAFCutter.h)
T get(std::string const &key) const
Definition: ParameterSet.h:231
unsigned int fMinHit
Slices must have at least this many hits.
bool fApplyCAFCuts
should we apply the caf level cuts?
std::string fSliceLabel
Label for process that made Cluster.
bool fIsMC
Flag for is MC or not.
std::string fCAFLabel
label for the process that made the standard records
std::string fHoughResultLabel
Label for process that made HoughResult.
enum BeamMode string
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

Referenced by art::RootOutput::RootOutput().

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

bool hough::HoughValidate::fApplyCAFCuts
private

should we apply the caf level cuts?

Definition at line 80 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

recovalid::CAFCutter hough::HoughValidate::fCAFCutter
private

the CAFCutter helper class

Definition at line 83 of file HoughValidate_module.cc.

Referenced by analyze().

std::string hough::HoughValidate::fCAFLabel
private

label for the process that made the standard records

Definition at line 79 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

int hough::HoughValidate::fCutType
private

what cuts to apply (see CAFCutter.h)

Definition at line 81 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

std::string hough::HoughValidate::fHoughResultLabel
private

Label for process that made HoughResult.

Definition at line 76 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

bool hough::HoughValidate::fIsMC
private

Flag for is MC or not.

Definition at line 77 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

std::string hough::HoughValidate::fMCLabel
private

Label for process that made MCTruth.

Definition at line 74 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

unsigned int hough::HoughValidate::fMinHit
private

Slices must have at least this many hits.

Definition at line 85 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

unsigned int hough::HoughValidate::fMinHitX
private

Minimum hits in x-view/slice.

Definition at line 86 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

unsigned int hough::HoughValidate::fMinHitY
private

Minumum hits in y-view/slice.

Definition at line 87 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

HValidateNt* hough::HoughValidate::fNt
private

Definition at line 72 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TTree* hough::HoughValidate::fNtTree
private

Definition at line 71 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1I* hough::HoughValidate::fNumHLX
private

Definition at line 90 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1I* hough::HoughValidate::fNumHLY
private

Definition at line 91 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1I* hough::HoughValidate::fOnlineX[4]
private

Definition at line 96 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1I* hough::HoughValidate::fOnlineY[4]
private

Definition at line 97 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fPeakThreshX[4]
private

Definition at line 108 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fPeakThreshY[4]
private

Definition at line 109 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fPeakX[4]
private

Definition at line 105 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fPeakY[4]
private

Definition at line 106 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fPerpDX[4]
private

Definition at line 111 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fPerpDY[4]
private

Definition at line 112 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fRhoX[4]
private

Definition at line 99 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fRhoY[4]
private

Definition at line 100 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

std::string hough::HoughValidate::fSliceLabel
private

Label for process that made Cluster.

Definition at line 75 of file HoughValidate_module.cc.

Referenced by analyze(), and reconfigure().

TH1F* hough::HoughValidate::fThetaX[4]
private

Definition at line 102 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fThetaY[4]
private

Definition at line 103 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fThreshX
private

Definition at line 93 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().

TH1F* hough::HoughValidate::fThreshY
private

Definition at line 94 of file HoughValidate_module.cc.

Referenced by analyze(), and beginJob().


The documentation for this class was generated from the following file: