Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
trk::CosmicTrackAna Class Reference
Inheritance diagram for trk::CosmicTrackAna:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 CosmicTrackAna (fhicl::ParameterSet const &pset)
 
virtual ~CosmicTrackAna ()
 
void analyze (art::Event const &evt)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
virtual void beginSubRun (const art::SubRun &sr)
 
void beginJob ()
 
void endJob ()
 
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 Make1DRecoHistograms (std::vector< TH1D * > &hists, TString const sample)
 
void Make1DTruthHistograms (std::vector< TH1D * > &hists, TString const sample)
 
void Make2DRecoHistograms (std::vector< TH2D * > &hists, TString const sample)
 
void Make2DTruthHistograms (std::vector< TH2D * > &hists, TString const sample)
 
std::pair< CosmicTrackInfo, CosmicSignalHitFractionFillRecoInfo (rb::Track const &track, rb::Cluster const &slice)
 
CosmicTrackInfo FillTrueInfo (rb::Track const &track, rb::Cluster const &slice, std::map< geo::CellUniqueId, float > &trueCellPathLength)
 
void FillEventMCTruthHistograms (size_t trkMax)
 
void FillTrackMCTruthHistograms (CosmicTrackInfo const &ti, CosmicTrackInfo const &ri)
 
void FillTrackHistograms (CosmicTrackInfo const &ri, CosmicSignalHitFraction const &shf, rb::Track const &track, std::map< geo::CellUniqueId, float > const &trueCellPathLength)
 
void FilldEdxHistogram (simb::MCParticle const &part)
 

Private Attributes

CosmicTrackSelection fSelection
 object encapsulating selection criteria More...
 
CosmicTrackUtilities fUtilities
 object encapsulating utilitie methods More...
 
std::string fTrackLabel
 Where to find Tracks to reconstruct. More...
 
std::string fExposureLabel
 Where to find CosmicExposure info. More...
 
double fMinSig
 track - using PE values More...
 
bool fFindPurityAndEfficiency
 because the calculation is so slow More...
 
double fLiveTime
 Livetime in sec according to file. More...
 
unsigned int fNevents
 total number of events counter More...
 
int fNTracks
 total number of reconstructed tracks counter More...
 
int fNTracksMC
 total number of MC particles More...
 
int fRun
 Run number. More...
 
int fSubRun
 Subrun number. More...
 
double fCellHalfDepthZ
 extent of a cell in the z direction More...
 
double fDetHalfWidth
 detector half width, cached More...
 
double fDetHalfHeight
 detector half height, cached More...
 
double fDetLength
 detector length, cached More...
 
TH1D * fCosmicRate
 histogram holding single value for cosmic rate in Hz at end of job More...
 
TH1D * fExposure
 histogram holding single value for exposure in s at end of job More...
 
std::vector< TH1D * > fOneDHistsRecoAll
 one dimensional histograms for all tracks More...
 
std::vector< TH1D * > fOneDHistsRecoStop
 one dimensional histograms for stopping tracks More...
 
std::vector< TH1D * > fOneDHistsTruthAll
 one dimensional histograms for all tracks More...
 
std::vector< TH1D * > fOneDHistsTruthStop
 one dimensional histograms for stopping tracks More...
 
std::vector< TH2D * > fTwoDHistsRecoAll
 two dimensional histograms for all tracks More...
 
std::vector< TH2D * > fTwoDHistsRecoStop
 two dimensional histograms for stopping tracks More...
 
std::vector< TH2D * > fTwoDHistsTruthAll
 two dimensional histograms for all tracks More...
 
std::vector< TH2D * > fTwoDHistsTruthStop
 two dimensional histograms for stopping tracks More...
 
CosmicTrackTree fTrigger
 event information More...
 
CosmicTrackInfo fTrackTruth
 single track mc truth information More...
 
CosmicTrackInfo fTrackReco
 single track reco information More...
 
CosmicSignalHitFraction fSigHitFrac
 fraction of signal and hits used More...
 
CosmicHitInfo fCosmicHit
 information about hits More...
 
TTree * fTree
 initializer of TTree for this module More...
 
TTree * fHitTree
 initializer of Hit TTree for this module More...
 
art::ServiceHandle< geo::GeometryfGeom
 
art::ServiceHandle< geo::LiveGeometryfLiveGeom
 
art::ServiceHandle< cheat::BackTrackerfBT
 
art::ServiceHandle< art::TFileServicefTFS
 

Detailed Description

Definition at line 184 of file CosmicTrackAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

trk::CosmicTrackAna::CosmicTrackAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 297 of file CosmicTrackAna_module.cc.

References reconfigure().

298  : EDAnalyzer(pset)
299  , fMinSig (0)
300  , fLiveTime (0)
301  , fNevents (0)
302  , fNTracks (0)
303  , fNTracksMC (0)
304  , fRun (-999)
305  , fSubRun (-999)
306  , fCellHalfDepthZ (-999.)
307  , fDetHalfWidth (-999.)
308  , fDetHalfHeight (-999.)
309  , fDetLength (-999.)
310  {
311  reconfigure(pset);
312  }
void reconfigure(const fhicl::ParameterSet &pset)
double fMinSig
track - using PE values
unsigned int fNevents
total number of events counter
double fDetHalfHeight
detector half height, cached
int fNTracks
total number of reconstructed tracks counter
double fCellHalfDepthZ
extent of a cell in the z direction
double fDetHalfWidth
detector half width, cached
double fLiveTime
Livetime in sec according to file.
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
double fDetLength
detector length, cached
int fNTracksMC
total number of MC particles
int fSubRun
Subrun number.
trk::CosmicTrackAna::~CosmicTrackAna ( )
virtual

Definition at line 315 of file CosmicTrackAna_module.cc.

316  {
317  }

Member Function Documentation

void trk::CosmicTrackAna::analyze ( art::Event const &  evt)
virtual

The analysis method is intended to perform checks of the performance of the reconstruction for the purposes of optimization, testing, and validation.

Parameters
evt- Read-only access to the event data

Implements art::EDAnalyzer.

Definition at line 576 of file CosmicTrackAna_module.cc.

References std::abs(), trk::CosmicTrackUtilities::Azimuth(), geo::PlaneGeo::Cell(), geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), CosmicTrackTree::event, art::EventID::event(), fBT, fCellHalfDepthZ, fDetHalfHeight, fDetHalfWidth, fDetLength, fGeom, FillEventMCTruthHistograms(), FillRecoInfo(), FillTrackHistograms(), FillTrackMCTruthHistograms(), FillTrueInfo(), fNevents, fNTracks, fOneDHistsRecoAll, fOneDHistsRecoStop, fOneDHistsTruthAll, fOneDHistsTruthStop, fRun, fSelection, fSigHitFrac, fSubRun, fTrackLabel, fTrackReco, fTrackTruth, fTree, fTrigger, fTwoDHistsRecoAll, fTwoDHistsTruthAll, fTwoDHistsTruthStop, fUtilities, art::DataViewImpl::getByLabel(), trk::CosmicTrackSelection::GoodReco(), trk::CosmicTrackSelection::GoodSteps(), geo::CellGeo::HalfD(), cheat::BackTracker::HaveTruthInfo(), art::Event::id(), kStepRelativeToMedian, kStepRelativeToMedianVsAz, kTracksFound, LOG_DEBUG, Make1DTruthHistograms(), Make2DTruthHistograms(), std::max(), median(), CosmicTrackTree::nevents, CosmicTrackTree::ntracks, CosmicTrackInfo::pdg, geo::GeometryBase::Plane(), CosmicTrackTree::run, art::Event::run(), fillBadChanDBTables::step, CosmicTrackInfo::stop, CosmicTrackTree::subrun, and art::Event::subRun().

577  {
578  if(fDetLength < 0){
582  fCellHalfDepthZ = fGeom->Plane(0)->Cell(0)->HalfD();
583  }
584 
585  // make the histograms to record Truth related information
586  // if they havent already been made and if there is truth
587  // information in the event
588  if( fBT->HaveTruthInfo() && fOneDHistsTruthAll.size() < 1){
589  this->Make1DTruthHistograms(fOneDHistsTruthAll, "AllTruth");
590  this->Make1DTruthHistograms(fOneDHistsTruthStop, "StopTruth");
591  this->Make2DTruthHistograms(fTwoDHistsTruthAll, "AllTruth");
592  this->Make2DTruthHistograms(fTwoDHistsTruthStop, "StopTruth");
593  }
594 
595 
596  ++fNevents; //Updating counter of number of events in sub-run
597  if(fRun < 0) fRun = evt.run();
598  if(fSubRun < 0) fSubRun = evt.subRun();
599 
600  fTrigger.run = evt.run();
601  fTrigger.subrun = evt.subRun();
602  fTrigger.event = evt.id().event();
604 
605  // now get the tracks that were made by CosmicTrack
606  // and test that there are tracks in the event
608  evt.getByLabel(fTrackLabel,trks);
609  if (trks->size() < 1) {
610  mf::LogWarning("CTAWarn") << "There are " << trks->size()
611  << " Tracks in this event, skip";
612  return;
613  }
614  LOG_DEBUG("CosmicTrackAna") << "There are " << trks->size() << " Tracks in this event";
615 
616  const unsigned int trkMax = trks->size();
617 
618  if( fBT->HaveTruthInfo() )
619  this->FillEventMCTruthHistograms(trkMax);
620 
621  // get a FindMany to grab the slice associated with each track
623 
624  unsigned int numtracks = 0;
625  unsigned int numstop = 0;
626 
627  // TStopwatch ts;
628  // double mcTime = 0.;
629  // double recoTime = 0.;
630 
631  // Loop over tracks
632  for(unsigned int trkIdx = 0; trkIdx < trkMax; ++trkIdx){
633 
634  // find the slice associated to the track
635  cet::maybe_ref<rb::Cluster const> sliceRef(foc.at(trkIdx));
636  if( !sliceRef.isValid() ) continue;
637  rb::Cluster const& slice(sliceRef.ref());
638 
639  rb::Track const& track = trks->at(trkIdx);
640  if(!track.Is3D()) continue;
641 
642  LOG_DEBUG("CosmicTrackAna") << "-----------------------------------------Track starts at "
643  << track.Start().X() << " "
644  << track.Start().Y() << " "
645  << track.Start().Z() << "---------------------------------";
646 
647  // fill the histogram for the step sizes compared to median for a track
648  if(std::abs(track.Stop().Z() - track.Start().Z()) >= 50. &&
649  -track.Dir().Y() < 0.95*track.Dir().Mag() ){
650 
651  std::vector<float> steps;
652  float median = -999.;
653  float largestStep = -999.;
654  fSelection.GoodSteps(track, steps, median);
655 
656  if(median > 0.){
657  for(auto const& step : steps){
659  largestStep = std::max(largestStep, step/median);
660  }
661  fTwoDHistsRecoAll[kStepRelativeToMedianVsAz]->Fill(fUtilities.Azimuth(track.Dir().X(), track.Dir().Z(), track.Dir().Mag()),
662  largestStep);
663  }
664  }// end filling of step size histogram
665 
666  // check the quality of the reconstruction
667  if(fSelection.GoodReco(track) ){
668 
669  //count number of tracks that cross fTrkLengthCut
670  ++numtracks;
671 
672  std::pair<CosmicTrackInfo,
673  CosmicSignalHitFraction> cticshf = this->FillRecoInfo(track, slice);
674 
675  fTrackReco = cticshf.first;
676  fSigHitFrac = cticshf.second;
677 
678  std::map<geo::CellUniqueId, float> trueCellPathLength;
679  fTrackTruth = this->FillTrueInfo(track, slice, trueCellPathLength);
680 
681  if(fTrackReco.stop) ++numstop;
682 
683  fTree->Fill();
684 
685  // ts.Start();
686  if( fBT->HaveTruthInfo() && std::abs(fTrackTruth.pdg) == 13 )
688 
689  // ts.Stop();
690  // mcTime += ts.RealTime();
691  // ts.Reset();
692 
693  LOG_DEBUG("CosmicTrackAna") << "----------------Start find track path length in cell--------------";
694  this->FillTrackHistograms(fTrackReco, fSigHitFrac, track, trueCellPathLength);
695  LOG_DEBUG("CosmicTrackAna") << "----------------End find track path length in cell--------------";
696 
697  }// end if passes track length in z cut
698 
699  }//end loop over tracks
700 
701  // LOG_VERBATIM("CosmicTrackAna") << "mcTime: " << mcTime
702  // << " recoTime: " << recoTime;
703 
704 
705  fOneDHistsRecoAll[kTracksFound] ->Fill(numtracks);
706  fOneDHistsRecoStop[kTracksFound]->Fill(numstop);
707 
708  fNTracks +=numtracks;
709 
710  fTrigger.ntracks = numtracks;
711 
712  return;
713  }
std::pair< CosmicTrackInfo, CosmicSignalHitFraction > FillRecoInfo(rb::Track const &track, rb::Cluster const &slice)
T max(const caf::Proxy< T > &a, T b)
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
unsigned int fNevents
total number of events counter
double HalfD() const
Definition: CellGeo.cxx:205
std::vector< TH2D * > fTwoDHistsTruthAll
two dimensional histograms for all tracks
std::string fTrackLabel
Where to find Tracks to reconstruct.
CosmicTrackSelection fSelection
object encapsulating selection criteria
art::ServiceHandle< cheat::BackTracker > fBT
double fDetHalfHeight
detector half height, cached
std::vector< TH2D * > fTwoDHistsTruthStop
two dimensional histograms for stopping tracks
void FillTrackMCTruthHistograms(CosmicTrackInfo const &ti, CosmicTrackInfo const &ri)
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
Definition: event.h:19
A collection of associated CellHits.
Definition: Cluster.h:47
double DetLength() const
CosmicTrackInfo fTrackReco
single track reco information
largest trajectory step relative to the median vs azimuth
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
const PlaneGeo * Plane(unsigned int i) const
void Make1DTruthHistograms(std::vector< TH1D * > &hists, TString const sample)
int fNTracks
total number of reconstructed tracks counter
CosmicTrackUtilities fUtilities
object encapsulating utilitie methods
std::vector< TH1D * > fOneDHistsTruthStop
one dimensional histograms for stopping tracks
float abs(float number)
Definition: d0nt_math.hpp:39
CosmicTrackInfo FillTrueInfo(rb::Track const &track, rb::Cluster const &slice, std::map< geo::CellUniqueId, float > &trueCellPathLength)
number of tracks found
void Make2DTruthHistograms(std::vector< TH2D * > &hists, TString const sample)
double fCellHalfDepthZ
extent of a cell in the z direction
double fDetHalfWidth
detector half width, cached
CosmicTrackTree fTrigger
event information
std::vector< TH1D * > fOneDHistsTruthAll
one dimensional histograms for all tracks
int evt
float Azimuth(float const &dcosX, float const &dcosZ, float const &magnitude)
double DetHalfHeight() const
std::vector< TH2D * > fTwoDHistsRecoAll
two dimensional histograms for all tracks
double median(TH1D *h)
Definition: absCal.cxx:524
double fDetLength
detector length, cached
void FillEventMCTruthHistograms(size_t trkMax)
double DetHalfWidth() const
void FillTrackHistograms(CosmicTrackInfo const &ri, CosmicSignalHitFraction const &shf, rb::Track const &track, std::map< geo::CellUniqueId, float > const &trueCellPathLength)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< TH1D * > fOneDHistsRecoAll
one dimensional histograms for all tracks
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
Definition: BackTracker.h:133
int fSubRun
Subrun number.
CosmicTrackInfo fTrackTruth
single track mc truth information
art::ServiceHandle< geo::Geometry > fGeom
bool GoodReco(rb::Track const &track)
std::vector< TH1D * > fOneDHistsRecoStop
one dimensional histograms for stopping tracks
TTree * fTree
initializer of TTree for this module
bool GoodSteps(rb::Track const &track, std::vector< float > &steps, float &median)
CosmicSignalHitFraction fSigHitFrac
fraction of signal and hits used
size of steps along trajectory normalized by the median step
void trk::CosmicTrackAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 320 of file CosmicTrackAna_module.cc.

References geo::PlaneGeo::Cell(), fCosmicHit, fCosmicRate, fExposure, fGeom, fHitTree, fOneDHistsRecoAll, fOneDHistsRecoStop, fSigHitFrac, fTFS, fTrackReco, fTrackTruth, fTree, fTrigger, fTwoDHistsRecoAll, fTwoDHistsRecoStop, geo::CellGeo::HalfD(), geo::CellGeo::HalfL(), geo::CellGeo::HalfW(), LOG_DEBUG, art::TFileDirectory::make(), Make1DRecoHistograms(), Make2DRecoHistograms(), geo::GeometryBase::Plane(), and string.

321  {
322 
323  LOG_DEBUG("CosmicTrackAna") << "cell half depth: " << fGeom->Plane(0)->Cell(0)->HalfD() << "\n"
324  << "cell half width: " << fGeom->Plane(0)->Cell(0)->HalfW() << "\n"
325  << "cell half leng: " << fGeom->Plane(0)->Cell(0)->HalfL();
326 
327  // will always want the reco histograms, not sure we will want the truth
328  // histograms until we determine we have MC
329  this->Make1DRecoHistograms(fOneDHistsRecoAll, "AllReco");
330  this->Make1DRecoHistograms(fOneDHistsRecoStop, "StopReco");
331  this->Make2DRecoHistograms(fTwoDHistsRecoAll, "AllReco");
332  this->Make2DRecoHistograms(fTwoDHistsRecoStop, "StopReco");
333 
334  fCosmicRate = fTFS->make<TH1D>("cosmicrate", ";Cosmic Rate (kHz)", 500, 0., 100);
335  fExposure = fTFS->make<TH1D>("exposure", ";Exposure (s)", 1000, 0., 10);
336 
337 
338  std::string trigst("run/I:subrun/I:event/I:nevents/I:ntracks/I");
339  std::string shfst ("signalFraction/F:hitFraction/F:signal/F:totcell/F:hitsX/F:hitsY/F:signalX/F:signalY/F");
340  std::string ctist ("efficiency/F:purity/F:pdg/I");
341  ctist.append(":length/F:momentum/F:momentumCor/F:momentumBPF/F:calorE/F");
342  ctist.append(":dcosX/F:dcosY/F:dcosZ/F");
343  ctist.append(":vtxX/F:vtxY/F:vtxZ/F");
344  ctist.append(":endX/F:endY/F:endZ/F");
345  ctist.append(":deltaVtxPos/F:deltaEndPos/F");
346  ctist.append(":cosTheta/F:azimuth/F");
347  ctist.append(":vtxToEdge/F:endToEdge/F");
348  ctist.append(":cellsPerPlaneX/F:cellsPerPlaneY/F");
349  ctist.append(":planesX/F:planesY/F:xStartPlane/F:yStartPlane/F:xEndPlane/F:yEndPlane/F");
350  ctist.append(":avgResidual/F:maxResidual/F:triCellFrac/F");
351  ctist.append(":stop/O:goodVtx/O:isCalibTrk/O");
352  fTree = fTFS->make<TTree>("Cosmics","CosmicTrackAna Tree");
353  fTree->Branch("trigger", &fTrigger, trigst.c_str());
354  fTree->Branch("truth", &fTrackTruth, ctist.c_str());
355  fTree->Branch("reco", &fTrackReco, ctist.c_str());
356  fTree->Branch("signalHitFraction", &fSigHitFrac, shfst.c_str());
357 
358  std::string chist ("pathLength/F:calibPathLength/F:truePathLength/F:triCellPathLength/F:PE/F:PECorr/F:w/F:distFromEnd/F:cell/I:plane/I:module/I:view/I");
359  fHitTree = fTFS->make<TTree>("Hits","CosmicHit Tree");
360  fHitTree->Branch("hits", &fCosmicHit, chist.c_str());
361 
362  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
double HalfL() const
Definition: CellGeo.cxx:198
double HalfD() const
Definition: CellGeo.cxx:205
void Make1DRecoHistograms(std::vector< TH1D * > &hists, TString const sample)
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
TH1D * fCosmicRate
histogram holding single value for cosmic rate in Hz at end of job
double HalfW() const
Definition: CellGeo.cxx:191
CosmicTrackInfo fTrackReco
single track reco information
const PlaneGeo * Plane(unsigned int i) const
void Make2DRecoHistograms(std::vector< TH2D * > &hists, TString const sample)
std::vector< TH2D * > fTwoDHistsRecoStop
two dimensional histograms for stopping tracks
CosmicTrackTree fTrigger
event information
art::ServiceHandle< art::TFileService > fTFS
std::vector< TH2D * > fTwoDHistsRecoAll
two dimensional histograms for all tracks
TTree * fHitTree
initializer of Hit TTree for this module
T * make(ARGS...args) const
std::vector< TH1D * > fOneDHistsRecoAll
one dimensional histograms for all tracks
CosmicHitInfo fCosmicHit
information about hits
CosmicTrackInfo fTrackTruth
single track mc truth information
art::ServiceHandle< geo::Geometry > fGeom
std::vector< TH1D * > fOneDHistsRecoStop
one dimensional histograms for stopping tracks
TTree * fTree
initializer of TTree for this module
TH1D * fExposure
histogram holding single value for exposure in s at end of job
CosmicSignalHitFraction fSigHitFrac
fraction of signal and hits used
enum BeamMode string
void trk::CosmicTrackAna::beginSubRun ( const art::SubRun sr)
virtual

Definition at line 546 of file CosmicTrackAna_module.cc.

References art::Handle< T >::failedToGet(), fExposureLabel, fLiveTime, art::DataViewImpl::getByLabel(), LOG_INFO, and sumdata::CosmicExposure::totlivetime.

547  {
549  sr.getByLabel(fExposureLabel, ce);
550  if(ce.failedToGet()){
551  mf::LogError("CosmicTrackAna") << "No Cosmic Exposure Info";
552  return;
553  }
554  fLiveTime += ce->totlivetime;
555 
556  LOG_INFO("CosmicTrackAna") << "The live time is now " << fLiveTime;
557 
558  return;
559  }
std::string fExposureLabel
Where to find CosmicExposure info.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
double fLiveTime
Livetime in sec according to file.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
#define LOG_INFO(stream)
Definition: Messenger.h:144
bool failedToGet() const
Definition: Handle.h:196
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
void trk::CosmicTrackAna::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 1407 of file CosmicTrackAna_module.cc.

References DEFINE_ART_MODULE(), fCosmicRate, fExposure, fLiveTime, fNevents, fNTracks, and LOG_VERBATIM.

1408  {
1409  fExposure->Fill(fLiveTime);
1410 
1411  if(fNevents != 0 && fLiveTime != 0){
1412  float cosmicrate = 1.e-3*fNTracks/fLiveTime;
1413 
1414  LOG_VERBATIM("CosmicTrackAna") << "There are: " << fNTracks
1415  << " cosmic tracks selected in this job.\n"
1416  << "Livetime is " << fLiveTime
1417  << " according to CosmicExposure.\n"
1418  << "Note, livetime is for FULL SUBRUN, "
1419  << "so rate is wrong if haven't run full subrun.\n"
1420  << "The cosmic rate is therefore "
1421  << cosmicrate << " Hz \n";
1422 
1423  fCosmicRate->Fill(cosmicrate);
1424  }
1425 
1426  return;
1427  }
unsigned int fNevents
total number of events counter
TH1D * fCosmicRate
histogram holding single value for cosmic rate in Hz at end of job
int fNTracks
total number of reconstructed tracks counter
double fLiveTime
Livetime in sec according to file.
#define LOG_VERBATIM(category)
TH1D * fExposure
histogram holding single value for exposure in s at end of job
void trk::CosmicTrackAna::FilldEdxHistogram ( simb::MCParticle const &  part)
private

Definition at line 993 of file CosmicTrackAna_module.cc.

References std::abs(), dE, dx, simb::MCParticle::E(), fDetHalfHeight, fDetHalfWidth, fDetLength, Fill(), fSelection, fTwoDHistsTruthAll, fTwoDHistsTruthStop, kdEdxVsRange, LOG_WARNING, Mag(), simb::MCParticle::NumberTrajectoryPoints(), simb::MCParticle::Position(), trk::CosmicTrackSelection::Stopper(), and confusionMatrixTree::t.

Referenced by FillTrueInfo().

994  {
995 
996  // loop over the particle trajectory points and determine the
997  // energy loss for each set
998  TVector3 curPos, prevPos;
999  float totalLength = 0.;
1000 
1001  std::vector< std::pair<float, float> > dEdXVsTotalL;
1002 
1003  for(size_t t = 1; t < part.NumberTrajectoryPoints(); ++t){
1004 
1005  if( std::abs(part.Position(t).X()) < fDetHalfWidth &&
1006  std::abs(part.Position(t).Y()) < fDetHalfHeight &&
1007  part.Position(t).Z() > 0. && part.Position(t).Z() < fDetLength &&
1008  std::abs(part.Position(t-1).X()) < fDetHalfWidth &&
1009  std::abs(part.Position(t-1).Y()) < fDetHalfHeight &&
1010  part.Position(t-1).Z() > 0. && part.Position(t-1).Z() < fDetLength ){
1011 
1012  curPos.SetXYZ(part.Position(t).X(), part.Position(t).Y(), part.Position(t).Z());
1013  prevPos.SetXYZ(part.Position(t-1).X(), part.Position(t-1).Y(), part.Position(t-1).Z());
1014 
1015  float dx = (curPos - prevPos).Mag();
1016  float dE = 1.e3*(part.E(t-1) - part.E(t)); // in MeV
1017 
1018  totalLength += dx;
1019 
1020  if(dE < 0. && std::abs(dE) > 1.e-3)
1021  LOG_WARNING("CosmicTrackAna") << "MC dE is negative!! " << dE
1022  << " " << dx
1023  << " " << part.E(t) << " " << part.E(t-1);
1024  if(dx <= 0.){
1025  LOG_WARNING("CosmicTrackAna") << "MC indicates a bad dx: " << dx;
1026  continue;
1027  }
1028 
1029  dEdXVsTotalL.push_back(std::pair<float, float>(dE/dx, totalLength));
1030  // LOG_VERBATIM("CosmicTrackAna") << dE/dx << " " << totalLength;
1031 
1032  }
1033  }
1034 
1035  // loop over the vector of pairs to plot dE/dx vs range
1036  for(auto const& dEdxTotalL : dEdXVsTotalL){
1037  fTwoDHistsTruthAll[kdEdxVsRange]->Fill(totalLength - dEdxTotalL.second, dEdxTotalL.first);
1038  if( fSelection.Stopper(curPos) )
1039  fTwoDHistsTruthStop[kdEdxVsRange]->Fill(totalLength - dEdxTotalL.second, dEdxTotalL.first);
1040  }
1041 
1042  return;
1043 
1044  }
std::vector< TH2D * > fTwoDHistsTruthAll
two dimensional histograms for all tracks
CosmicTrackSelection fSelection
object encapsulating selection criteria
double fDetHalfHeight
detector half height, cached
std::vector< TH2D * > fTwoDHistsTruthStop
two dimensional histograms for stopping tracks
bool Stopper(TVector3 const &finalPoint)
double dE
float abs(float number)
Definition: d0nt_math.hpp:39
double fDetHalfWidth
detector half width, cached
TString part[npart]
Definition: Style.C:32
double dx[NP][NC]
correl_yv Fill(-(dy[iP-1][iC-1]), hyv->GetBinContent(iP, iC))
dE/dx vs remaining length in a track
double fDetLength
detector length, cached
#define LOG_WARNING(category)
float Mag() const
void trk::CosmicTrackAna::FillEventMCTruthHistograms ( size_t  trkMax)
private

Definition at line 716 of file CosmicTrackAna_module.cc.

References std::abs(), trk::CosmicTrackUtilities::Azimuth(), trk::CosmicTrackUtilities::CosTheta(), fBT, fNTracksMC, fOneDHistsTruthAll, fOneDHistsTruthStop, fSelection, fTwoDHistsTruthAll, fUtilities, kAzimuthTrue, kCosCosmicTrue, kEndTrueX, kEndTrueY, kEndTrueZ, kPrimaryTrueEnergy, kRecoEff, kStartTrueX, kStartTrueY, kStartTrueZ, kTrackFindEff, kTracksFoundVsLeft, LOG_DEBUG, LOG_VERBATIM, sim::ParticleNavigator::NumberOfPrimaries(), cheat::BackTracker::ParticleNavigator(), cheat::BackTracker::ParticleToFLSHit(), simb::MCParticle::PdgCode(), sim::ParticleNavigator::Primary(), ratio(), gen_flatrecord::size, trk::CosmicTrackSelection::Stopper(), simb::MCParticle::TrackId(), and trk::CosmicTrackUtilities::TrueLengthEndPoints().

Referenced by analyze().

717  {
718 
719  unsigned int numtracksMC = 0;
720 
721  std::vector<sim::Particle> detParticles;
722 
724 
725  // count how many tracks were left by primary particles in the event
726  for(int p = 0; p < pnav.NumberOfPrimaries(); ++p){
727  if( fBT->ParticleToFLSHit(pnav.Primary(p)->TrackId()).size() > 0){
728  if(std::abs(pnav.Primary(p)->PdgCode()) == 13){
729  ++fNTracksMC;
730  ++numtracksMC;
731  detParticles.push_back(*(pnav.Primary(p)));
732  }
733  }
734  }
735 
736  // no point filling histograms for MC if particles don't leave hits
737  if (detParticles.size() < 1 ) {
738  mf::LogWarning("CTAWarn") << "Failed to find any Mother particles leaving"
739  << " hits in the detector, bail";
740  return;
741  }
742  else {
743  LOG_DEBUG("CosmicTrackAna") << "There are " << detParticles.size()
744  << " Mother particles leaving hits in the detector";
745 
746  for(auto detPart : detParticles){
747  auto lengthEndPoints = fUtilities.TrueLengthEndPoints(detPart);
748 
749  fOneDHistsTruthAll[kPrimaryTrueEnergy]->Fill(detPart.E());
750  fOneDHistsTruthAll[kAzimuthTrue] ->Fill(fUtilities.Azimuth(detPart.Px(), detPart.Pz(), detPart.P()));
751  fOneDHistsTruthAll[kCosCosmicTrue] ->Fill(fUtilities.CosTheta(detPart.Py(), detPart.P()));
752  fOneDHistsTruthAll[kStartTrueX] ->Fill(lengthEndPoints.second.first.X());
753  fOneDHistsTruthAll[kStartTrueY] ->Fill(lengthEndPoints.second.first.Y());
754  fOneDHistsTruthAll[kStartTrueZ] ->Fill(lengthEndPoints.second.first.Z());
755  fOneDHistsTruthAll[kEndTrueX] ->Fill(lengthEndPoints.second.second.X());
756  fOneDHistsTruthAll[kEndTrueY] ->Fill(lengthEndPoints.second.second.Y());
757  fOneDHistsTruthAll[kEndTrueZ] ->Fill(lengthEndPoints.second.second.Z());
758  if( fSelection.Stopper( detPart.EndPosition().Vect() ) ){
759  fOneDHistsTruthStop[kPrimaryTrueEnergy]->Fill(detPart.E());
760  fOneDHistsTruthStop[kAzimuthTrue] ->Fill(fUtilities.Azimuth(detPart.Px(), detPart.Pz(), detPart.P()));
761  fOneDHistsTruthStop[kCosCosmicTrue] ->Fill(fUtilities.CosTheta(detPart.Py(), detPart.P()));
762  fOneDHistsTruthStop[kStartTrueX] ->Fill(lengthEndPoints.second.first.X());
763  fOneDHistsTruthStop[kStartTrueY] ->Fill(lengthEndPoints.second.first.Y());
764  fOneDHistsTruthStop[kStartTrueZ] ->Fill(lengthEndPoints.second.first.Z());
765  fOneDHistsTruthStop[kEndTrueX] ->Fill(lengthEndPoints.second.second.X());
766  fOneDHistsTruthStop[kEndTrueY] ->Fill(lengthEndPoints.second.second.Y());
767  fOneDHistsTruthStop[kEndTrueZ] ->Fill(lengthEndPoints.second.second.Z());
768  }
769  }// end loop over particles (muons)
770 
771  double ratio = 0.;
772  fTwoDHistsTruthAll[kTracksFoundVsLeft]->Fill(numtracksMC*1., trkMax*1.); // fill only for MC
773 
774  if(trkMax > numtracksMC)
775  LOG_VERBATIM("CosmicTrackAna") << "reconstructed more tracks than generated: "
776  << trkMax << " vs " << numtracksMC;
777 
778  ratio = (trkMax*1.)/(numtracksMC*1.);
779  fTwoDHistsTruthAll[kTrackFindEff]->Fill(numtracksMC*1.,ratio);
780  fOneDHistsTruthAll[kRecoEff]->Fill(ratio);
781 
782  }// end if particles were found
783 
784  return;
785  }
truth start position in x
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
int PdgCode() const
Definition: MCParticle.h:211
azimuthal angle of the cosmic ray
std::vector< TH2D * > fTwoDHistsTruthAll
two dimensional histograms for all tracks
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
CosmicTrackSelection fSelection
object encapsulating selection criteria
art::ServiceHandle< cheat::BackTracker > fBT
const char * p
Definition: xmltok.h:285
std::vector< sim::FLSHit > ParticleToFLSHit(const int &trackID) const
All the FLSHits that were created by the track id trackID, sorted from most to least light...
TH1 * ratio(TH1 *h1, TH1 *h2)
bool Stopper(TVector3 const &finalPoint)
CosmicTrackUtilities fUtilities
object encapsulating utilitie methods
std::vector< TH1D * > fOneDHistsTruthStop
one dimensional histograms for stopping tracks
float abs(float number)
Definition: d0nt_math.hpp:39
int TrackId() const
Definition: MCParticle.h:209
std::pair< std::pair< float, float >, std::pair< TVector3, TVector3 > > TrueLengthEndPoints(simb::MCParticle const &part)
cosine theta of cosmic track with respect to zenith
number of tracks found in event vs particles leaving tracks
True energy of particle zero (GeV)
const sim::Particle * Primary(const int) const
std::vector< TH1D * > fOneDHistsTruthAll
one dimensional histograms for all tracks
truth start position in y
float Azimuth(float const &dcosX, float const &dcosZ, float const &magnitude)
float CosTheta(float const &dcosY, float const &magnitude)
truth start position in z
int fNTracksMC
total number of MC particles
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
truth end position in x
truth end position in z
#define LOG_VERBATIM(category)
truth end position in y
std::pair< CosmicTrackInfo, CosmicSignalHitFraction > trk::CosmicTrackAna::FillRecoInfo ( rb::Track const &  track,
rb::Cluster const &  slice 
)
private

Definition at line 1047 of file CosmicTrackAna_module.cc.

References std::abs(), CosmicTrackInfo::avgResidual, CosmicTrackInfo::azimuth, trk::CosmicTrackUtilities::Azimuth(), plot_validation_datamc::c, CosmicTrackInfo::calorE, rb::Cluster::Cell(), CosmicTrackInfo::cellsPerPlaneX, CosmicTrackInfo::cellsPerPlaneY, trk::CosmicTrackSelection::CleanSample(), CosmicTrackInfo::cosTheta, trk::CosmicTrackUtilities::CosTheta(), CosmicTrackInfo::dcosX, CosmicTrackInfo::dcosY, CosmicTrackInfo::dcosZ, rb::Prong::Dir(), trk::CosmicTrackSelection::DistToEdge(), CosmicTrackInfo::endToEdge, CosmicTrackInfo::endX, CosmicTrackInfo::endY, CosmicTrackInfo::endZ, fGeom, Fill(), trk::CosmicTrackUtilities::FindTriCells(), fMinSig, fOneDHistsRecoAll, fOneDHistsRecoStop, fSelection, fUtilities, CosmicTrackInfo::goodVtx, CosmicSignalHitFraction::hitFraction, CosmicSignalHitFraction::hitsX, CosmicSignalHitFraction::hitsY, MECModelEnuComparisons::i, trk::CosmicTrackSelection::IsCalibTrack(), CosmicTrackInfo::isCalibTrk, kCellHitSig, geo::kX, geo::kY, CosmicTrackInfo::length, trk::CosmicTrackUtilities::LengthCorrection(), rb::Cluster::MaxPlane(), CosmicTrackInfo::maxResidual, rb::Cluster::MinPlane(), CosmicTrackInfo::momentum, CosmicTrackInfo::momentumBPF, CosmicTrackInfo::momentumCor, rb::Cluster::NCell(), rb::Cluster::NXCell(), rb::Cluster::NYCell(), path, rb::CellHit::PE(), rb::CellHit::Plane(), CosmicTrackInfo::planesX, CosmicTrackInfo::planesY, trk::CosmicTrackUtilities::RangeMomentum(), CosmicSignalHitFraction::signal, CosmicSignalHitFraction::signalFraction, CosmicSignalHitFraction::signalX, CosmicSignalHitFraction::signalY, rb::Prong::Start(), CosmicTrackInfo::stop, rb::Track::Stop(), trk::CosmicTrackSelection::Stopper(), rb::Cluster::TotalGeV(), rb::Track::TotalLength(), CosmicSignalHitFraction::totcell, trk::CosmicTrackUtilities::TrackResiduals(), rb::Track::Trajectory(), CosmicTrackInfo::triCellFrac, rb::CellHit::View(), CosmicTrackInfo::vtxToEdge, CosmicTrackInfo::vtxX, CosmicTrackInfo::vtxY, CosmicTrackInfo::vtxZ, rb::Cluster::Weight(), CosmicTrackInfo::xEndPlane, CosmicTrackInfo::xStartPlane, CosmicTrackInfo::yEndPlane, and CosmicTrackInfo::yStartPlane.

Referenced by analyze().

1049  {
1050  // determine the number of planes with hits in each view
1051  std::set<unsigned short> xPlanes;
1052  std::set<unsigned short> yPlanes;
1053  for(size_t c = 0; c < track.NCell(); ++c){
1054  if (track.Cell(c)->View() == geo::kX) xPlanes.insert(track.Cell(c)->Plane());
1055  else if(track.Cell(c)->View() == geo::kY) yPlanes.insert(track.Cell(c)->Plane());
1056  }// end loop over cells in track
1057 
1058  // get the residuals along the track
1059  std::vector<float> residuals = fUtilities.TrackResiduals(track);
1060  std::sort(residuals.begin(), residuals.end());
1061  float avResid = 0.;
1062  for(auto resid : residuals) avResid += resid;
1063 
1064  // find the number of tricells in this track
1065  std::map<std::pair<uint32_t, uint32_t>, bool> planeCellMap;
1066  fUtilities.FindTriCells(track, planeCellMap);
1067  float numTriCell = 0.;
1068  for(auto itr : planeCellMap)
1069  if(itr.second) numTriCell += 1.;
1070 
1071  // find the momentum from the BreakPointFitter
1072  bpfit::Path path(*fGeom, track.Trajectory());
1073 
1074  double bpfMom = 0.;
1075  path.MuonParams(0, 0, &bpfMom, 0, 0);
1076 
1077  CosmicTrackInfo ri;
1078  ri.planesX = xPlanes.size();
1079  ri.planesY = yPlanes.size();
1080  ri.length = track.TotalLength();
1083  ri.momentumBPF = bpfMom;
1084  ri.calorE = track.TotalGeV();
1085  ri.vtxX = track.Start().X();
1086  ri.vtxY = track.Start().Y();
1087  ri.vtxZ = track.Start().Z();
1088  ri.endX = track.Stop().X();
1089  ri.endY = track.Stop().Y();
1090  ri.endZ = track.Stop().Z();
1091  ri.dcosX = track.Dir().X()/track.Dir().Mag();
1092  ri.dcosY = track.Dir().Y()/track.Dir().Mag();
1093  ri.dcosZ = track.Dir().Z()/track.Dir().Mag();
1094  ri.cosTheta = fUtilities.CosTheta(track.Dir().Y(), track.Dir().Mag());
1095  ri.azimuth = fUtilities.Azimuth(track.Dir().X(), track.Dir().Z(), track.Dir().Mag());
1096  ri.vtxToEdge = fSelection.DistToEdge(track.Start());
1097  ri.endToEdge = fSelection.DistToEdge(track.Stop());
1098  ri.xStartPlane = 1. * track.MaxPlane(geo::kX);
1099  ri.yStartPlane = 1. * track.MaxPlane(geo::kY);
1100  ri.xEndPlane = 1. * track.MinPlane(geo::kX);
1101  ri.yEndPlane = 1. * track.MinPlane(geo::kY);
1102  ri.cellsPerPlaneX = (ri.planesX > 0.) ? (1. * track.NXCell())/ri.planesX : -999.;
1103  ri.cellsPerPlaneY = (ri.planesY > 0.) ? (1. * track.NYCell())/ri.planesY : -999.;
1104  ri.avgResidual = avResid/track.NCell();
1105  ri.maxResidual = residuals.back();
1106  ri.triCellFrac = 1.*numTriCell/(1.*track.NCell());
1107  ri.stop = fSelection.Stopper(track.Stop());
1108  ri.goodVtx = (std::abs(fSelection.DistToEdge(track.Start())) < 10.) ? true : false;
1109  ri.isCalibTrk = fSelection.IsCalibTrack(track, slice);
1110 
1111  float trkcells = 0.;
1112  float trksig = 0.;
1113  float totcell = 0.;
1114  float totsig = 0.;
1115  float xsig = 0.;
1116  float ysig = 0.;
1117 
1118  // loop over the cell hits from the cluster
1119  for(size_t i = 0; i < slice.NCell(); ++i){
1120  art::Ptr<rb::CellHit> chit = slice.Cell(i);
1121  if(chit->PE() > fMinSig){
1122  fOneDHistsRecoAll[kCellHitSig]->Fill(chit->PE());
1124  totcell += 1.;
1125  totsig += chit->PE();
1126  }
1127  }
1128 
1129  // get the total signal in each view of the track
1130  for(size_t c = 0; c < track.NCell(); ++c){
1131  if(track.Cell(c)->PE() > fMinSig){
1132  trkcells += 1.;
1133  if (track.Cell(c)->View() == geo::kX) xsig += track.Cell(c)->PE()*track.Weight(c);
1134  else if(track.Cell(c)->View() == geo::kY) ysig += track.Cell(c)->PE()*track.Weight(c);
1135  //LOG_VERBATIM("CosmicTrackAna") << xsig << " " << ysig << " " << " " << track.Cell(c)->PE() << " " << track.Weight(c);
1136  }
1137  }
1138 
1139  trksig = xsig + ysig;
1140 
1142  shf.signalFraction = trksig/totsig;
1143  shf.hitFraction = trkcells/totcell;
1144  shf.signal = trksig;
1145  shf.hitsX = track.NXCell();
1146  shf.hitsY = track.NYCell();
1147  shf.totcell = totcell;
1148  shf.signalX = xsig;
1149  shf.signalY = ysig;
1150 
1151  return std::pair<CosmicTrackInfo, CosmicSignalHitFraction>(ri, shf);
1152  }
float LengthCorrection(float const &length)
double fMinSig
track - using PE values
signal size of calibrated cell hits
CosmicTrackSelection fSelection
object encapsulating selection criteria
Vertical planes which measure X.
Definition: PlaneGeo.h:28
void FindTriCells(rb::Track const &track, std::map< std::pair< uint32_t, uint32_t >, bool > &planeCellMap)
Definition: event.h:19
bool Stopper(TVector3 const &finalPoint)
CosmicTrackUtilities fUtilities
object encapsulating utilitie methods
float abs(float number)
Definition: d0nt_math.hpp:39
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
Track parameters (s, X0, KE, beta, ...) along a particular path in the detector.
Definition: Path.h:18
correl_yv Fill(-(dy[iP-1][iC-1]), hyv->GetBinContent(iP, iC))
float PE() const
Definition: CellHit.h:42
std::vector< float > TrackResiduals(rb::Track const &track)
float Azimuth(float const &dcosX, float const &dcosZ, float const &magnitude)
float CosTheta(float const &dcosY, float const &magnitude)
const std::string path
Definition: plot_BEN.C:43
bool IsCalibTrack(rb::Track const &track, rb::Cluster const &slice)
std::vector< TH1D * > fOneDHistsRecoAll
one dimensional histograms for all tracks
art::ServiceHandle< geo::Geometry > fGeom
float DistToEdge(TVector3 const &point)
std::vector< TH1D * > fOneDHistsRecoStop
one dimensional histograms for stopping tracks
bool CleanSample(CosmicTrackInfo const &ri)
float RangeMomentum(rb::Track const &track)
void trk::CosmicTrackAna::FillTrackHistograms ( CosmicTrackInfo const &  ri,
CosmicSignalHitFraction const &  shf,
rb::Track const &  track,
std::map< geo::CellUniqueId, float > const &  trueCellPathLength 
)
private

Definition at line 1155 of file CosmicTrackAna_module.cc.

References std::abs(), CosmicTrackInfo::azimuth, plot_validation_datamc::c, CosmicHitInfo::calibPathLength, rb::CellHit::Cell(), geo::PlaneGeo::Cell(), CosmicHitInfo::cell, rb::Cluster::Cell(), CosmicTrackInfo::cellsPerPlaneX, CosmicTrackInfo::cellsPerPlaneY, trk::CosmicTrackSelection::CleanSample(), CosmicTrackInfo::cosTheta, CosmicTrackInfo::dcosX, CosmicTrackInfo::dcosY, CosmicTrackInfo::dcosZ, rb::Track::DistanceFromEnd(), CosmicHitInfo::distFromEnd, e, CosmicTrackInfo::endToEdge, CosmicTrackInfo::endX, CosmicTrackInfo::endY, CosmicTrackInfo::endZ, fCosmicHit, fGeom, fHitTree, trk::CosmicTrackUtilities::FindTriCells(), calib::FindZBoundaries(), stan::math::floor(), fOneDHistsRecoAll, fOneDHistsRecoStop, fSelection, fTwoDHistsRecoAll, fTwoDHistsRecoStop, fUtilities, geo::CellGeo::HalfW(), CosmicSignalHitFraction::hitFraction, CosmicSignalHitFraction::hitsX, CosmicSignalHitFraction::hitsY, geo::CellGeo::Id(), rb::RecoHit::IsCalibrated(), kAzimuth, kCellHitX, kCellHitY, kCellPlaneX, kCellPlaneY, kCellsPerPlaneX, kCellsPerPlaneXY, kCellsPerPlaneY, kCosCosmic, kDCosX, kDCosY, kDCosZ, kDiffX, kDiffY, kDiffZ, kDirXY, kEndDistToEdge, kEndX, kEndXY, kEndY, kEndZ, kEndZX, kEndZY, kFracHitsUsedVsNum, kFractionHitsUsed, kFractionSigUsed, kHitXPosition, kHitXYPosition, kHitXZPosition, kHitYPosition, kHitYZPosition, kHitZPosition, kPEPerCMVsWX, kPEPerCMVsWY, kPlaneHitX, kPlaneHitY, kResidualsX, kResidualsY, kResidVsAzX, kResidVsAzY, kResidVsCosX, kResidVsCosY, kStartX, kStartXY, kStartY, kStartZ, kStartZX, kStartZY, kTNSX, kTNSY, kTrackLength, kTrackRangeMomentum, kTrkCells, kTrkSig, kVtxDistToEdge, geo::kX, geo::kY, CosmicTrackInfo::length, LOG_WARNING, trk::CosmicTrackUtilities::MakeZBoundaryMap(), calib::MakeZBoundaryMap(), min(), CosmicHitInfo::module, CosmicTrackInfo::momentum, rb::Cluster::NCell(), CosmicHitInfo::pathLength, trk::CosmicTrackUtilities::PathLengthInCell(), calib::PathLengthInCell(), python.hepunit::pc, rb::CellHit::PE(), CosmicHitInfo::PE, rb::RecoHit::PECorr(), CosmicHitInfo::PECorr, rb::CellHit::Plane(), CosmicHitInfo::plane, geo::GeometryBase::Plane(), rb::Cluster::RecoHit(), CosmicSignalHitFraction::signal, CosmicSignalHitFraction::signalFraction, rb::CellHit::TNS(), CosmicSignalHitFraction::totcell, trk::CosmicTrackUtilities::TrackResiduals(), rb::Track::Trajectory(), trk::CosmicTrackUtilities::TriCellPathLength(), CosmicHitInfo::triCellPathLength, CosmicHitInfo::truePathLength, POTSpillRate::view, rb::CellHit::View(), CosmicHitInfo::view, CosmicTrackInfo::vtxToEdge, CosmicTrackInfo::vtxX, CosmicTrackInfo::vtxY, CosmicTrackInfo::vtxZ, CosmicHitInfo::w, rb::RecoHit::X(), rb::RecoHit::Y(), and rb::RecoHit::Z().

Referenced by analyze().

1159  {
1160 
1161  fOneDHistsRecoAll[kTrkSig] ->Fill(shf.signal);
1162  fOneDHistsRecoAll[kTrkCells] ->Fill(shf.hitsX+shf.hitsY);
1163  fOneDHistsRecoAll[kDCosX] ->Fill(ri.dcosX);
1164  fOneDHistsRecoAll[kDCosY] ->Fill(ri.dcosY);
1165  fOneDHistsRecoAll[kDCosZ] ->Fill(ri.dcosZ);
1166  fOneDHistsRecoAll[kAzimuth] ->Fill(ri.azimuth);
1167  fOneDHistsRecoAll[kCosCosmic] ->Fill(ri.cosTheta);
1168  fOneDHistsRecoAll[kStartX] ->Fill(ri.vtxX);
1169  fOneDHistsRecoAll[kStartY] ->Fill(ri.vtxY);
1170  fOneDHistsRecoAll[kStartZ] ->Fill(ri.vtxZ);
1171  fOneDHistsRecoAll[kEndX] ->Fill(ri.endX);
1172  fOneDHistsRecoAll[kEndY] ->Fill(ri.endY);
1173  fOneDHistsRecoAll[kEndZ] ->Fill(ri.endZ);
1174  fOneDHistsRecoAll[kTrackLength] ->Fill(ri.length);
1175  fOneDHistsRecoAll[kTrackRangeMomentum]->Fill(ri.momentum);
1176  fOneDHistsRecoAll[kDiffX] ->Fill(std::abs(ri.vtxX - ri.endX));
1177  fOneDHistsRecoAll[kDiffY] ->Fill(std::abs(ri.vtxY - ri.endY));
1178  fOneDHistsRecoAll[kDiffZ] ->Fill(std::abs(ri.vtxZ - ri.endZ));
1179  fOneDHistsRecoAll[kFractionHitsUsed] ->Fill(shf.hitFraction);
1180  fOneDHistsRecoAll[kFractionSigUsed] ->Fill(shf.signalFraction);
1181  fOneDHistsRecoAll[kVtxDistToEdge] ->Fill(ri.vtxToEdge);
1182  fOneDHistsRecoAll[kEndDistToEdge] ->Fill(ri.endToEdge);
1183  fOneDHistsRecoAll[kCellsPerPlaneX] ->Fill(ri.cellsPerPlaneX);
1184  fOneDHistsRecoAll[kCellsPerPlaneY] ->Fill(ri.cellsPerPlaneY);
1185  fTwoDHistsRecoAll[kDirXY] ->Fill(ri.dcosX,ri.dcosY);
1186  fTwoDHistsRecoAll[kStartXY] ->Fill(ri.vtxX, ri.vtxY);
1187  fTwoDHistsRecoAll[kStartZX] ->Fill(ri.vtxZ, ri.vtxX);
1188  fTwoDHistsRecoAll[kStartZY] ->Fill(ri.vtxZ, ri.vtxY);
1189  fTwoDHistsRecoAll[kEndXY] ->Fill(ri.endX, ri.endY);
1190  fTwoDHistsRecoAll[kEndZX] ->Fill(ri.endZ, ri.endX);
1191  fTwoDHistsRecoAll[kEndZY] ->Fill(ri.endZ, ri.endY);
1192  fTwoDHistsRecoAll[kFracHitsUsedVsNum] ->Fill(shf.totcell, shf.hitFraction);
1193  fTwoDHistsRecoAll[kCellsPerPlaneXY] ->Fill(ri.cellsPerPlaneX, ri.cellsPerPlaneY);
1194 
1195  if( fSelection.CleanSample(ri) ){
1196  fOneDHistsRecoStop[kTrkSig] ->Fill(shf.signal);
1197  fOneDHistsRecoStop[kTrkCells] ->Fill(shf.hitsX+shf.hitsY);
1198  fOneDHistsRecoStop[kDCosX] ->Fill(ri.dcosX);
1199  fOneDHistsRecoStop[kDCosY] ->Fill(ri.dcosY);
1200  fOneDHistsRecoStop[kDCosZ] ->Fill(ri.dcosZ);
1201  fOneDHistsRecoStop[kAzimuth] ->Fill(ri.azimuth);
1202  fOneDHistsRecoStop[kCosCosmic] ->Fill(ri.cosTheta);
1203  fOneDHistsRecoStop[kStartX] ->Fill(ri.vtxX);
1204  fOneDHistsRecoStop[kStartY] ->Fill(ri.vtxY);
1205  fOneDHistsRecoStop[kStartZ] ->Fill(ri.vtxZ);
1206  fOneDHistsRecoStop[kEndX] ->Fill(ri.endX);
1207  fOneDHistsRecoStop[kEndY] ->Fill(ri.endY);
1208  fOneDHistsRecoStop[kEndZ] ->Fill(ri.endZ);
1209  fOneDHistsRecoStop[kTrackLength] ->Fill(ri.length);
1210  fOneDHistsRecoStop[kTrackRangeMomentum]->Fill(ri.momentum);
1211  fOneDHistsRecoStop[kDiffX] ->Fill(std::abs(ri.vtxX - ri.endX));
1212  fOneDHistsRecoStop[kDiffY] ->Fill(std::abs(ri.vtxY - ri.endY));
1213  fOneDHistsRecoStop[kDiffZ] ->Fill(std::abs(ri.vtxZ - ri.endZ));
1214  fOneDHistsRecoStop[kFractionHitsUsed] ->Fill(shf.hitFraction);
1215  fOneDHistsRecoStop[kFractionSigUsed] ->Fill(shf.signalFraction);
1216  fOneDHistsRecoStop[kVtxDistToEdge] ->Fill(ri.vtxToEdge);
1217  fOneDHistsRecoStop[kEndDistToEdge] ->Fill(ri.endToEdge);
1218  fOneDHistsRecoStop[kCellsPerPlaneX] ->Fill(ri.cellsPerPlaneX);
1219  fOneDHistsRecoStop[kCellsPerPlaneY] ->Fill(ri.cellsPerPlaneY);
1220  fTwoDHistsRecoStop[kDirXY] ->Fill(ri.dcosX,ri.dcosY);
1221  fTwoDHistsRecoStop[kStartXY] ->Fill(ri.vtxX, ri.vtxY);
1222  fTwoDHistsRecoStop[kStartZX] ->Fill(ri.vtxZ, ri.vtxX);
1223  fTwoDHistsRecoStop[kStartZY] ->Fill(ri.vtxZ, ri.vtxY);
1224  fTwoDHistsRecoStop[kEndXY] ->Fill(ri.endX, ri.endY);
1225  fTwoDHistsRecoStop[kEndZX] ->Fill(ri.endZ, ri.endX);
1226  fTwoDHistsRecoStop[kEndZY] ->Fill(ri.endZ, ri.endY);
1227  fTwoDHistsRecoStop[kFracHitsUsedVsNum] ->Fill(shf.totcell, shf.hitFraction);
1228  fTwoDHistsRecoStop[kCellsPerPlaneXY] ->Fill(ri.cellsPerPlaneX, ri.cellsPerPlaneY);
1229  }
1230 
1231  // make a map of the z position of each trajectory point of the
1232  // track to its corresponding trajectory point. the map will
1233  // be used to find the residual of the reconstruction to the
1234  // cell hits.
1235  // TVector3 cellCenter;
1236  // TVector3 cellExtent;
1237  // TVector3 lowerBound;
1238  // TVector3 upperBound;
1239  TVector3 point;
1240  float distFromEnd = 0.;
1241  float lengthInCell = 0.;
1242  float calibLengthInCell = 0.;
1243  float trueLengthInCell = 0.;
1244  // double xyz[3] = {0.};
1245 
1246  auto trueCellItr = trueCellPathLength.begin();
1247  zBoundMap zToPlaneBounds = fUtilities.MakeZBoundaryMap(track.Trajectory());
1248  std::set<double> calibZBoundaries;
1249  calib::FindZBoundaries(calibZBoundaries);
1250  auto calibZToPlaneBounds = calib::MakeZBoundaryMap(calibZBoundaries,
1251  track.Trajectory());
1252 
1253  std::map< std::pair<uint32_t, uint32_t>, bool > triCellMap;
1254  std::pair<uint32_t, uint32_t> pc;
1255  double cellWidth = 0.;
1256  fUtilities.FindTriCells(track, triCellMap);
1257 
1258  auto residuals = fUtilities.TrackResiduals(track);
1259 
1260  // Loop through both views and grab every CellHit in this track
1261  for(size_t c = 0; c < track.NCell(); ++c){
1262  const art::Ptr<rb::CellHit> chit = track.Cell(c);
1263  const geo::View_t view = chit->View();
1264 
1265  pc.first = chit->Plane();
1266  pc.second = chit->Cell();
1267  cellWidth = 2. * fGeom->Plane(pc.first)->Cell(pc.second)->HalfW();
1268 
1269  trueCellItr = trueCellPathLength.find(fGeom->Plane(pc.first)->Cell(pc.second)->Id());
1270  if( trueCellItr != trueCellPathLength.end() ) trueLengthInCell = trueCellItr->second;
1271  else trueLengthInCell = -9999.;
1272 
1273  // LOG_VERBATIM("CosmicTrackAna") << chit->Plane() << " " << chit->Cell() << "cell hit view is " << view;
1274 
1275  if(view == geo::kX){
1276  fOneDHistsRecoAll[kCellHitX] ->Fill(pc.second);
1277  fOneDHistsRecoAll[kPlaneHitX] ->Fill(pc.first);
1278  fTwoDHistsRecoAll[kCellPlaneX]->Fill(pc.first, pc.second);
1279  if( fSelection.CleanSample(ri) ){
1280  fOneDHistsRecoStop[kCellHitX] ->Fill(pc.second);
1281  fOneDHistsRecoStop[kPlaneHitX] ->Fill(pc.first);
1282  fTwoDHistsRecoStop[kCellPlaneX]->Fill(pc.first, pc.second);
1283  }
1284  }
1285  else if(view == geo::kY){
1286  fOneDHistsRecoAll[kCellHitY] ->Fill(pc.second);
1287  fOneDHistsRecoAll[kPlaneHitY] ->Fill(pc.first);
1288  fTwoDHistsRecoAll[kCellPlaneY]->Fill(pc.first, pc.second);
1289  if( fSelection.CleanSample(ri) ){
1290  fOneDHistsRecoStop[kCellHitY] ->Fill(pc.second);
1291  fOneDHistsRecoStop[kPlaneHitY] ->Fill(pc.first);
1292  fTwoDHistsRecoStop[kCellPlaneY]->Fill(pc.first, pc.second);
1293  }
1294  }
1295 
1296  const rb::RecoHit rhit = track.RecoHit(chit);
1297  if(!rhit.IsCalibrated()) continue;
1298 
1299  point = TVector3(rhit.X(), rhit.Y(), rhit.Z());
1300  distFromEnd = track.DistanceFromEnd(rhit.Z());
1301 
1302  if(view == geo::kX){
1303  fOneDHistsRecoAll[kResidualsX] ->Fill(residuals[c]);
1304  fOneDHistsRecoAll[kTNSX] ->Fill(chit->TNS());
1305  fTwoDHistsRecoAll[kResidVsCosX]->Fill(residuals[c], ri.cosTheta);
1306  fTwoDHistsRecoAll[kResidVsAzX] ->Fill(residuals[c], ri.azimuth);
1307  }
1308  else if(view == geo::kY){
1309  fOneDHistsRecoAll[kResidualsY] ->Fill(residuals[c]);
1310  fOneDHistsRecoAll[kTNSY] ->Fill(chit->TNS());
1311  fTwoDHistsRecoAll[kResidVsCosY]->Fill(residuals[c], ri.cosTheta);
1312  fTwoDHistsRecoAll[kResidVsAzY] ->Fill(residuals[c], ri.azimuth);
1313  }
1314  fOneDHistsRecoAll[kHitXPosition] ->Fill(rhit.X());
1315  fOneDHistsRecoAll[kHitYPosition] ->Fill(rhit.Y());
1316  fOneDHistsRecoAll[kHitZPosition] ->Fill(rhit.Z());
1317  fTwoDHistsRecoAll[kHitXYPosition]->Fill(rhit.X(), rhit.Y());
1318  fTwoDHistsRecoAll[kHitXZPosition]->Fill(rhit.Z(), rhit.X());
1319  fTwoDHistsRecoAll[kHitYZPosition]->Fill(rhit.Z(), rhit.Y());
1320  if( fSelection.CleanSample(ri) ){
1321  if(distFromEnd >= 0. && distFromEnd <= 20000.){
1322  // find the pathlength through the cell
1323  try{
1324  lengthInCell = fUtilities.PathLengthInCell(zToPlaneBounds, point, pc);
1325  calibLengthInCell = calib::PathLengthInCell(calibZToPlaneBounds, point, pc);
1326  }
1327  catch(cet::exception &e){
1328  LOG_WARNING("CosmicTrackAna")
1329  << "caught exception\n"
1330  << e
1331  << "\n when trying to calculate tracklength in cell. Set it to a std::numeric_limits<float>::min()";
1332  lengthInCell = std::numeric_limits<float>::min();
1333  }
1334 
1335  fCosmicHit.pathLength = lengthInCell;
1336  fCosmicHit.calibPathLength = calibLengthInCell;
1337  fCosmicHit.truePathLength = trueLengthInCell;
1338  fCosmicHit.triCellPathLength = (triCellMap[pc]) ? fUtilities.TriCellPathLength(track, pc.first, cellWidth, view) : -9999.;
1339  fCosmicHit.PE = chit->PE();
1340  fCosmicHit.PECorr = rhit.PECorr();
1341  fCosmicHit.distFromEnd = distFromEnd;
1342  fCosmicHit.view = view;
1343  fCosmicHit.cell = pc.second;
1344  fCosmicHit.plane = pc.first;
1346  if(view == geo::kX){
1347  fCosmicHit.w = rhit.Y();
1348  fTwoDHistsRecoStop[kPEPerCMVsWX]->Fill(rhit.Y(), rhit.PECorr()/lengthInCell);
1349  }
1350  else if(view == geo::kY){
1351  fCosmicHit.w = rhit.X();
1352  fTwoDHistsRecoStop[kPEPerCMVsWY]->Fill(rhit.X(), rhit.PECorr()/lengthInCell);
1353  }
1354  fHitTree->Fill();
1355  } // end if in the correct window from end point of track
1356  if(view == geo::kX){
1357  fOneDHistsRecoStop[kResidualsX] ->Fill(residuals[c]);
1358  fOneDHistsRecoStop[kTNSX] ->Fill(chit->TNS());
1359  fTwoDHistsRecoStop[kResidVsCosX]->Fill(residuals[c], ri.cosTheta);
1360  fTwoDHistsRecoStop[kResidVsAzX] ->Fill(residuals[c], ri.azimuth);
1361  }
1362  else if(view == geo::kY){
1363  fOneDHistsRecoStop[kResidualsY] ->Fill(residuals[c]);
1364  fOneDHistsRecoStop[kTNSY] ->Fill(chit->TNS());
1365  fTwoDHistsRecoStop[kResidVsCosY]->Fill(residuals[c], ri.cosTheta);
1366  fTwoDHistsRecoStop[kResidVsAzY] ->Fill(residuals[c], ri.azimuth);
1367  }
1368  fOneDHistsRecoStop[kHitXPosition] ->Fill(rhit.X());
1369  fOneDHistsRecoStop[kHitYPosition] ->Fill(rhit.Y());
1370  fOneDHistsRecoStop[kHitZPosition] ->Fill(rhit.Z());
1371  fTwoDHistsRecoStop[kHitXYPosition]->Fill(rhit.X(), rhit.Y());
1372  fTwoDHistsRecoStop[kHitXZPosition]->Fill(rhit.Z(), rhit.X());
1373  fTwoDHistsRecoStop[kHitYZPosition]->Fill(rhit.Z(), rhit.Y());
1374  }
1375 
1376  } // end for cells
1377 
1378 // if(cosCosmic < 0.1){
1379 // LOG_VERBATIM("CosmicTrackAna") << "track params " << track.TotalLength() << " " << cosCosmic << " " << azimuth
1380 // << "\ndirection " << dir.X() << " " << dir.Y() << " " << dir.Z()
1381 // << "\nminPlane: " << track.MinPlane() << " maxPlane: " << track.MaxPlane();
1382 // for(size_t p = 0; p < track.NTrajectoryPoints(); ++p){
1383 // TVector3 point = track.TrajectoryPoint(p);
1384 // LOG_VERBATIM("CosmicTrackAna") << point.X() << " " << point.Y() << " " << point.Z();
1385 // }
1386 // }
1387 
1388  return;
1389  }
float TNS() const
Definition: CellHit.h:46
direction cosine in x
float TriCellPathLength(rb::Track const &track, uint32_t const &plane, double const &cellWidth, geo::View_t const &view)
track start position in x
distribution of x/y cellhit times in nano seconds
distribution of x/y cellhit times in nano seconds
PE/cm deposited as a function of W in Y view.
track start position in zx
zBoundMap MakeZBoundaryMap(std::set< double > const &planeZBounds, std::vector< TVector3 > const &trajectory)
Return a map of the z position of each trajectory point on a track to the bounding positions of where...
Definition: CalibUtil.cxx:354
std::map< double, zBounds > zBoundMap
difference in track start and end position in y
CosmicTrackSelection fSelection
object encapsulating selection criteria
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
unsigned short Plane() const
Definition: CellHit.h:39
Fraction of hits in event used in track.
geo::View_t View() const
Definition: CellHit.h:41
distance in cm to closest edge of detector at track vertex
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
reco hit positions in xz
cells hit per plane in Y vs X
residual for each hit vs azimuth
residuals for the tracks
Vertical planes which measure X.
Definition: PlaneGeo.h:28
void FindTriCells(rb::Track const &track, std::map< std::pair< uint32_t, uint32_t >, bool > &planeCellMap)
float Z() const
Definition: RecoHit.h:38
Definition: event.h:19
double HalfW() const
Definition: CellGeo.cxx:191
track end position in zx
PE/cm deposited as a function of W in X view.
track end position in xy
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
difference in track start and end position in z
number of cells in a track
const PlaneGeo * Plane(unsigned int i) const
CosmicTrackUtilities fUtilities
object encapsulating utilitie methods
difference in track start and end position in x
residuals for the tracks
std::vector< TH2D * > fTwoDHistsRecoStop
two dimensional histograms for stopping tracks
float abs(float number)
Definition: d0nt_math.hpp:39
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
position of reco hits in z
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
Definition: RecoHit.h:19
average number of cells hit per plane in y
const CellUniqueId & Id() const
Definition: CellGeo.h:55
cosine theta of cosmic track with respect to zenith
track end position in y
unsigned short Cell() const
Definition: CellHit.h:40
azimuthal angle of the cosmic ray
track signal (Q)
track end position in zy
position of reco hits in y
track start position in z
average number of cells hit per plane in x
track start position in zy
Fraction of hits in event used in track.
direction cosine in z
float PE() const
Definition: CellHit.h:42
std::vector< float > TrackResiduals(rb::Track const &track)
reco hit positions in yz
bool IsCalibrated() const
You MUST check here before accessing PECorr, MIP or GeV.
Definition: RecoHit.cxx:35
std::vector< TH2D * > fTwoDHistsRecoAll
two dimensional histograms for all tracks
TTree * fHitTree
initializer of Hit TTree for this module
track end position in x
length of track
direction in x versus y
#define LOG_WARNING(category)
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
Fraction hits used vs the number of hits that could be used.
reco hit positions in xy
distance in cm to closest edge of detector at track end
zBoundMap MakeZBoundaryMap(std::vector< TVector3 > const &trajectory)
float X() const
Definition: RecoHit.h:36
track start position in xy
momentum of track from range
fvar< T > floor(const fvar< T > &x)
Definition: floor.hpp:11
std::vector< TH1D * > fOneDHistsRecoAll
one dimensional histograms for all tracks
CosmicHitInfo fCosmicHit
information about hits
residual for each hit vs cos(theta)
art::ServiceHandle< geo::Geometry > fGeom
direction cosine in y
float Y() const
Definition: RecoHit.h:37
std::vector< TH1D * > fOneDHistsRecoStop
one dimensional histograms for stopping tracks
float PECorr() const
Definition: RecoHit.cxx:47
bool CleanSample(CosmicTrackInfo const &ri)
track start position in y
void FindZBoundaries(std::set< double > &planeZBounds)
Find the boundaries in the z direction of planes in the detector.
Definition: CalibUtil.cxx:332
track end position in z
Float_t e
Definition: plot.C:35
position of reco hits in x
float PathLengthInCell(zBoundMap const &zBounds, TVector3 const &recoHitLoc, std::pair< uint32_t, uint32_t > const &pc)
float PathLengthInCell(zBoundMap const &zBounds, TVector3 const &recoHitLoc, std::pair< uint32_t, uint32_t > const &pc)
Return the path length of a track in the cell in question.
Definition: CalibUtil.cxx:498
void trk::CosmicTrackAna::FillTrackMCTruthHistograms ( CosmicTrackInfo const &  ti,
CosmicTrackInfo const &  ri 
)
private

Definition at line 907 of file CosmicTrackAna_module.cc.

References std::abs(), CosmicTrackInfo::azimuth, CosmicTrackInfo::cellsPerPlaneX, CosmicTrackInfo::cellsPerPlaneY, trk::CosmicTrackSelection::CleanSample(), CosmicTrackInfo::cosTheta, CosmicTrackInfo::dcosX, CosmicTrackInfo::dcosY, CosmicTrackInfo::dcosZ, CosmicTrackInfo::deltaEndPos, CosmicTrackInfo::deltaVtxPos, CosmicTrackInfo::efficiency, CosmicTrackInfo::endToEdge, CosmicTrackInfo::endZ, fOneDHistsTruthAll, fOneDHistsTruthStop, fSelection, fTwoDHistsTruthAll, fTwoDHistsTruthStop, fUtilities, kDCosXDiff, kDCosXDiffVsZLen, kDCosXRecoVsTrue, kDCosYDiff, kDCosYDiffVsZLen, kDCosYRecoVsTrue, kDCosZDiff, kDCosZDiffVsZLen, kDCosZRecoVsTrue, kDeltaBeg, kDeltaEnd, kDeltaLengthVsCellsPerPlane, kDeltaLengthVsDeltaEndPlane, kDeltaLengthVsDeltaStartPlane, kDeltaLengthVsLength, kDeltaLengthVsPlaneAsymmetry, kDeltaRangeMomentum, kDeltaRangeMomentumUncor, kDeltaRangeMomUncorVsAzimuth, kDeltaRangeMomUncorVsCosTheta, kDeltaRangeMomUncorVsLength, kDeltaRangeMomVsLength, kDeltaTrackLength, kDeltaZBegVsDCosZ, kDeltaZEnd, kDeltaZEndVsDCosZ, kDeltaZEndVsDistToEdge, kDiffBegVsAzimuth, kDiffBegVsCosTheta, kDiffBegVsDCosZ, kDiffEndVsAzimuth, kDiffEndVsCosTheta, kDiffEndVsDCosZ, kTrackEfficiency, kTrackPurity, CosmicTrackInfo::length, trk::CosmicTrackUtilities::LengthCorrection(), std::max(), CosmicTrackInfo::momentum, CosmicTrackInfo::planesX, CosmicTrackInfo::planesY, CosmicTrackInfo::purity, CosmicTrackInfo::vtxZ, CosmicTrackInfo::xEndPlane, CosmicTrackInfo::xStartPlane, CosmicTrackInfo::yEndPlane, and CosmicTrackInfo::yStartPlane.

Referenced by analyze().

909  {
910 
911 
912  float rangeMomUncor = ri.momentum/fUtilities.LengthCorrection(ri.length);
913  float endDiffSign = ti.deltaEndPos/std::abs(ti.deltaEndPos);
914  float begDiffSign = ti.deltaVtxPos/std::abs(ti.deltaVtxPos);
915 
916  fOneDHistsTruthAll[kDeltaZEnd] ->Fill(endDiffSign*std::abs(ri.endZ - ti.endZ));
917  fOneDHistsTruthAll[kDeltaEnd] ->Fill(ti.deltaEndPos);
918  fOneDHistsTruthAll[kDeltaBeg] ->Fill(ti.deltaVtxPos);
919  fOneDHistsTruthAll[kDCosXDiff] ->Fill((ti.dcosX - ri.dcosX)/ti.dcosX);
920  fOneDHistsTruthAll[kDCosYDiff] ->Fill((ti.dcosY - ri.dcosY)/ti.dcosX);
921  fOneDHistsTruthAll[kDCosZDiff] ->Fill((ti.dcosZ - ri.dcosZ)/ti.dcosX);
922  fOneDHistsTruthAll[kTrackPurity] ->Fill(ti.purity);
923  fOneDHistsTruthAll[kTrackEfficiency] ->Fill(ti.efficiency);
924  fOneDHistsTruthAll[kDeltaTrackLength] ->Fill(ti.length - ri.length);
925  fOneDHistsTruthAll[kDeltaRangeMomentum] ->Fill((std::abs(ti.momentum) - ri.momentum)/std::abs(ti.momentum));
926  fOneDHistsTruthAll[kDeltaRangeMomentumUncor] ->Fill((std::abs(ti.momentum) - rangeMomUncor)/std::abs(ti.momentum));
927  fTwoDHistsTruthAll[kDCosXRecoVsTrue] ->Fill(ti.dcosX, ri.dcosX);
928  fTwoDHistsTruthAll[kDCosYRecoVsTrue] ->Fill(ti.dcosY, ri.dcosY);
929  fTwoDHistsTruthAll[kDCosZRecoVsTrue] ->Fill(ti.dcosZ, ri.dcosZ);
930  fTwoDHistsTruthAll[kDCosXDiffVsZLen] ->Fill(std::abs(ri.vtxZ - ri.endZ), (ti.dcosX - ri.dcosZ)/ti.dcosX);
931  fTwoDHistsTruthAll[kDCosYDiffVsZLen] ->Fill(std::abs(ri.vtxZ - ri.endZ), (ti.dcosY - ri.dcosY)/ti.dcosY);
932  fTwoDHistsTruthAll[kDCosZDiffVsZLen] ->Fill(std::abs(ri.vtxZ - ri.endZ), (ti.dcosZ - ri.dcosZ)/ti.dcosZ);
933  fTwoDHistsTruthAll[kDeltaZEndVsDCosZ] ->Fill(endDiffSign * std::abs(ri.endZ - ti.endZ), ri.dcosZ);
934  fTwoDHistsTruthAll[kDeltaZEndVsDistToEdge] ->Fill(endDiffSign * std::abs(ri.endZ - ti.endZ), ti.endToEdge);
935  fTwoDHistsTruthAll[kDeltaZBegVsDCosZ] ->Fill(begDiffSign * std::abs(ri.vtxZ - ti.vtxZ), ri.dcosZ);
936  fTwoDHistsTruthAll[kDiffBegVsDCosZ] ->Fill(ri.dcosZ, ti.deltaVtxPos);
937  fTwoDHistsTruthAll[kDiffEndVsDCosZ] ->Fill(ri.dcosZ, ti.deltaEndPos);
938  fTwoDHistsTruthAll[kDiffBegVsCosTheta] ->Fill(ri.cosTheta, ti.deltaVtxPos);
939  fTwoDHistsTruthAll[kDiffEndVsCosTheta] ->Fill(ri.cosTheta, ti.deltaEndPos);
940  fTwoDHistsTruthAll[kDiffBegVsAzimuth] ->Fill(ri.azimuth, ti.deltaVtxPos);
941  fTwoDHistsTruthAll[kDiffEndVsAzimuth] ->Fill(ri.azimuth, ti.deltaEndPos);
942  fTwoDHistsTruthAll[kDeltaRangeMomVsLength] ->Fill(ri.length, (std::abs(ti.momentum) - ri.momentum)/std::abs(ti.momentum));
943  fTwoDHistsTruthAll[kDeltaRangeMomUncorVsLength]->Fill(ri.length, (std::abs(ti.momentum) - rangeMomUncor)/std::abs(ti.momentum));
944  fTwoDHistsTruthAll[kDeltaLengthVsLength] ->Fill(ri.length, (std::abs(ti.length) - ri.length)/std::abs(ti.length));
945  fTwoDHistsTruthAll[kDeltaLengthVsPlaneAsymmetry]->Fill((ri.planesX - ri.planesY)/(ri.planesX + ri.planesY), (std::abs(ti.length) - ri.length)/std::abs(ti.length));
946  fTwoDHistsTruthAll[kDeltaLengthVsDeltaStartPlane]->Fill(std::abs(ri.xStartPlane - ri.yStartPlane), (std::abs(ti.length) - ri.length)/std::abs(ti.length));
947  fTwoDHistsTruthAll[kDeltaLengthVsDeltaEndPlane] ->Fill(std::abs(ri.xEndPlane - ri.yEndPlane), (std::abs(ti.length) - ri.length)/std::abs(ti.length));
948  fTwoDHistsTruthAll[kDeltaLengthVsCellsPerPlane] ->Fill(std::max(ri.cellsPerPlaneX,ri.cellsPerPlaneY), (std::abs(ti.length) - ri.length)/std::abs(ti.length));
949 
950  // check and see how well the reconstruction works for stoppers selected based on the reconstruction
951  if( fSelection.CleanSample(ri) ){
952  fOneDHistsTruthStop[kDCosXDiff] ->Fill((ti.dcosX - ri.dcosX)/ti.dcosX);
953  fOneDHistsTruthStop[kDCosYDiff] ->Fill((ti.dcosY - ri.dcosY)/ti.dcosY);
954  fOneDHistsTruthStop[kDCosZDiff] ->Fill((ti.dcosZ - ri.dcosZ)/ti.dcosZ);
955  fOneDHistsTruthStop[kDeltaZEnd] ->Fill(endDiffSign*std::abs(ri.endZ - ti.endZ));
956  fOneDHistsTruthStop[kDeltaEnd] ->Fill(ti.deltaEndPos);
957  fOneDHistsTruthStop[kDeltaBeg] ->Fill(ti.deltaVtxPos);
958  fOneDHistsTruthStop[kTrackPurity] ->Fill(ti.purity);
959  fOneDHistsTruthStop[kTrackEfficiency] ->Fill(ti.efficiency);
960  fOneDHistsTruthStop[kDeltaTrackLength] ->Fill(ti.length - ri.length);
961  fOneDHistsTruthStop[kDeltaRangeMomentum] ->Fill((std::abs(ti.momentum) - ri.momentum)/std::abs(ti.momentum));
962  fOneDHistsTruthStop[kDeltaRangeMomentumUncor] ->Fill((std::abs(ti.momentum) - rangeMomUncor)/std::abs(ti.momentum));
963  fTwoDHistsTruthStop[kDCosXRecoVsTrue] ->Fill(ti.dcosX, ri.dcosX);
964  fTwoDHistsTruthStop[kDCosYRecoVsTrue] ->Fill(ti.dcosY, ri.dcosY);
965  fTwoDHistsTruthStop[kDCosZRecoVsTrue] ->Fill(ti.dcosZ, ri.dcosZ);
966  fTwoDHistsTruthStop[kDCosXDiffVsZLen] ->Fill(std::abs(ri.vtxZ - ri.endZ), (ti.dcosX - ri.dcosX)/ti.dcosX);
967  fTwoDHistsTruthStop[kDCosYDiffVsZLen] ->Fill(std::abs(ri.vtxZ - ri.endZ), (ti.dcosY - ri.dcosY)/ti.dcosY);
968  fTwoDHistsTruthStop[kDCosZDiffVsZLen] ->Fill(std::abs(ri.vtxZ - ri.endZ), (ti.dcosZ - ri.dcosZ)/ti.dcosZ);
969  fTwoDHistsTruthStop[kDeltaZEndVsDCosZ] ->Fill(endDiffSign*std::abs(ri.endZ - ti.endZ), ri.dcosZ);
970  fTwoDHistsTruthStop[kDeltaZEndVsDistToEdge] ->Fill(endDiffSign*std::abs(ri.endZ - ti.endZ), ri.endToEdge);
971  fTwoDHistsTruthStop[kDeltaZBegVsDCosZ] ->Fill(begDiffSign*std::abs(ri.vtxZ - ti.vtxZ), ri.dcosZ);
972  fTwoDHistsTruthStop[kDiffBegVsDCosZ] ->Fill(ri.dcosZ, ti.deltaVtxPos);
973  fTwoDHistsTruthStop[kDiffEndVsDCosZ] ->Fill(ri.dcosZ, ti.deltaEndPos);
974  fTwoDHistsTruthStop[kDiffBegVsCosTheta] ->Fill(ri.cosTheta, ti.deltaVtxPos);
975  fTwoDHistsTruthStop[kDiffEndVsCosTheta] ->Fill(ri.cosTheta, ti.deltaEndPos);
976  fTwoDHistsTruthStop[kDiffBegVsAzimuth] ->Fill(ri.azimuth, ti.deltaVtxPos);
977  fTwoDHistsTruthStop[kDiffEndVsAzimuth] ->Fill(ri.azimuth, ti.deltaEndPos);
978  fTwoDHistsTruthStop[kDeltaRangeMomVsLength] ->Fill(ri.length, (std::abs(ti.momentum) - ri.momentum)/std::abs(ti.momentum));
979  fTwoDHistsTruthStop[kDeltaRangeMomUncorVsLength] ->Fill(ri.length, (std::abs(ti.momentum) - rangeMomUncor)/std::abs(ti.momentum));
980  fTwoDHistsTruthStop[kDeltaRangeMomUncorVsCosTheta]->Fill(ri.cosTheta, (std::abs(ti.momentum) - rangeMomUncor)/std::abs(ti.momentum));
981  fTwoDHistsTruthStop[kDeltaRangeMomUncorVsAzimuth] ->Fill(ri.azimuth, (std::abs(ti.momentum) - rangeMomUncor)/std::abs(ti.momentum));
982  fTwoDHistsTruthStop[kDeltaLengthVsLength] ->Fill(ri.length, (std::abs(ti.length) - ri.length)/std::abs(ti.length));
983  fTwoDHistsTruthStop[kDeltaLengthVsPlaneAsymmetry]->Fill((ri.planesX - ri.planesY)/(ri.planesX + ri.planesY), (std::abs(ti.length) - ri.length)/std::abs(ti.length));
984  fTwoDHistsTruthStop[kDeltaLengthVsDeltaStartPlane]->Fill(std::abs(ri.xStartPlane - ri.yStartPlane), (std::abs(ti.length) - ri.length)/std::abs(ti.length));
985  fTwoDHistsTruthStop[kDeltaLengthVsDeltaEndPlane] ->Fill(std::abs(ri.xEndPlane - ri.yEndPlane), (std::abs(ti.length) - ri.length)/std::abs(ti.length));
986  fTwoDHistsTruthStop[kDeltaLengthVsCellsPerPlane] ->Fill(std::max(ri.cellsPerPlaneX,ri.cellsPerPlaneY), (std::abs(ti.length) - ri.length)/std::abs(ti.length));
987  }
988 
989  return;
990  }
difference between true and reco length in cm
T max(const caf::Proxy< T > &a, T b)
float LengthCorrection(float const &length)
fractional length vs difference in end plane in each view
difference in end point of recoed track & simulated vs cosTheta
difference in reco and true range momentum as a function of reco length
std::vector< TH2D * > fTwoDHistsTruthAll
two dimensional histograms for all tracks
difference in reco and true range momentum as a function of azimuth
difference in end point of recoed track & simulated vs dcosZ
Direction cosine in x.
CosmicTrackSelection fSelection
object encapsulating selection criteria
std::vector< TH2D * > fTwoDHistsTruthStop
two dimensional histograms for stopping tracks
efficiency in selecting hits for the track
difference in start point of recoed track & simulated vs cosTheta
Fraction difference in direction cosine in y.
difference in recon and true length as a function of reco length
difference in start point of recoed track & simulated vs dcosZ
difference in reco momentum from range and true momentum
Fraction difference in direction cosine in x vs z length.
CosmicTrackUtilities fUtilities
object encapsulating utilitie methods
std::vector< TH1D * > fOneDHistsTruthStop
one dimensional histograms for stopping tracks
float abs(float number)
Definition: d0nt_math.hpp:39
Fraction difference in direction cosine in z.
Fraction difference in direction cosine in x.
std::vector< TH1D * > fOneDHistsTruthAll
one dimensional histograms for all tracks
difference in start point of recoed track & simulated vs azimuth
fractional length vs difference in start plane in each view
fractional length vs asymmetry in number of planes in each view
difference in z endpoint of recoed track & simulated vs dcosZ
Fraction difference in direction cosine in z vs z length.
purity in selecting hits for the track
Fraction difference in direction cosine in y vs z length.
difference in end point of reconstructed track vs simulated
difference in reco momentum from range uncorrected for track length
difference in z start point of recoed track & simulated vs dcosZ
difference in start point of reconstructed track vs simulated
fractional length vs maximum cells per plane
difference in reco and true range momentum as a function of reco length
difference in reco and true range momentum as a function of cos theta
bool CleanSample(CosmicTrackInfo const &ri)
difference in end point of recoed track & simulated vs azimuth
Direction cosine in z.
difference in z endpoint of recoed track & simulated vs dcosZ
Direction cosine in y.
difference in z end point of reconstructed track vs simulated
CosmicTrackInfo trk::CosmicTrackAna::FillTrueInfo ( rb::Track const &  track,
rb::Cluster const &  slice,
std::map< geo::CellUniqueId, float > &  trueCellPathLength 
)
private

Definition at line 788 of file CosmicTrackAna_module.cc.

References std::abs(), rb::Cluster::AllCells(), CosmicTrackInfo::azimuth, trk::CosmicTrackUtilities::Azimuth(), CosmicTrackInfo::cellsPerPlaneX, CosmicTrackInfo::cellsPerPlaneY, CosmicTrackInfo::cosTheta, trk::CosmicTrackUtilities::CosTheta(), CosmicTrackInfo::dcosX, CosmicTrackInfo::dcosY, CosmicTrackInfo::dcosZ, CosmicTrackInfo::deltaEndPos, CosmicTrackInfo::deltaVtxPos, rb::Prong::Dir(), trk::CosmicTrackSelection::DistToEdge(), CosmicTrackInfo::efficiency, CosmicTrackInfo::endToEdge, CosmicTrackInfo::endX, CosmicTrackInfo::endY, CosmicTrackInfo::endZ, fBT, fFindPurityAndEfficiency, FilldEdxHistogram(), fSelection, fUtilities, CosmicTrackInfo::goodVtx, cheat::BackTracker::HaveTruthInfo(), cheat::BackTracker::HitCollectionEfficiency(), cheat::BackTracker::HitCollectionPurity(), cheat::BackTracker::HitsToParticle(), geo::kXorY, CosmicTrackInfo::length, LOG_DEBUG, CosmicTrackInfo::momentum, CosmicTrackInfo::momentumCor, part, cheat::BackTracker::ParticleToFLSHit(), submit_concat_project::parts, CosmicTrackInfo::pdg, CosmicTrackInfo::purity, rb::Prong::Start(), CosmicTrackInfo::stop, rb::Track::Stop(), trk::CosmicTrackSelection::Stopper(), trackID, trk::CosmicTrackUtilities::TrueLengthEndPoints(), trk::CosmicTrackUtilities::TruePathLengthInCell(), CosmicTrackInfo::vtxToEdge, CosmicTrackInfo::vtxX, CosmicTrackInfo::vtxY, and CosmicTrackInfo::vtxZ.

Referenced by analyze().

791  {
792 
793  CosmicTrackInfo ti;
794 
795  ti.purity = -999.;
796  ti.efficiency = -999.;
797  ti.length = -999.;
798  ti.momentum = -999.;
799  ti.momentumCor = -999.;
800  ti.dcosX = -999.;
801  ti.dcosY = -999.;
802  ti.dcosZ = -999.;
803  ti.vtxX = -999.;
804  ti.vtxY = -999.;
805  ti.vtxZ = -999.;
806  ti.endX = -999.;
807  ti.endY = -999.;
808  ti.endZ = -999.;
809  ti.deltaVtxPos = -999.;
810  ti.deltaEndPos = -999.;
811  ti.cosTheta = -999.;
812  ti.azimuth = -999.;
813  ti.stop = false;
814  ti.goodVtx = false;
815  ti.vtxToEdge = -999.;
816  ti.endToEdge = -999.;
817  ti.cellsPerPlaneX = -999.;
818  ti.cellsPerPlaneY = -999.;
819 
820  if( !fBT->HaveTruthInfo() ) return ti;
821 
822  // get the truth information for this track
823  std::vector< const sim::Particle* > parts = fBT->HitsToParticle(track.AllCells());
824 
825  if(parts.size() > 0){
826 
827  // get the particle for the first IDE as it represents the track ID with the most
828  // energy in the collection of hits
829  auto part = parts.front();
830 
831  // if(track.Dir().Z() > 0)
832  // LOG_VERBATIM("CosmicTrackAna") << "simulation z end point: " << simEnd.Z()
833  // << "\ntrack z end point: " << track.Stop().Z();
834 
835  this->FilldEdxHistogram(*part);
836  auto lengthEndPoints = fUtilities.TrueLengthEndPoints(*part);
837 
838  // get the FLSHits for this track, then make a map
839  // of the cell unique id to the path length of the particle in the cell
840  std::vector<sim::FLSHit> flsHits = fBT->ParticleToFLSHit(part->TrackId());
841  // for( auto flsHit : flsHits)
842  // trueCellPathLength[flsHit.GetCellUniqueId()] = flsHit.GetTotalPathLength();
843  LOG_DEBUG("CosmicTrackAna") << "------------Fill true cell path lengths-------------";
844  trueCellPathLength = fUtilities.TruePathLengthInCell(*part, flsHits);
845  LOG_DEBUG("CosmicTrackAna") << "------------End Fill true cell path lengths-------------";
846 
847  // calculating purity and efficiency take forever.
848  // control whether it is done with a flag
850  // check the efficiency and purity of the track hits for
851  // this MC particle
852  std::set<int> trackID;
853  trackID.insert(part->TrackId());
854  ti.purity = fBT->HitCollectionPurity(trackID, track.AllCells());
855  ti.efficiency = fBT->HitCollectionEfficiency(trackID, track.AllCells(), slice.AllCells(), geo::kXorY);
856  }
857 
858  ti.pdg = part->PdgCode();
859  ti.length = lengthEndPoints.first.first;
860  ti.momentum = lengthEndPoints.first.second;
861  ti.momentumCor = 0.;
862  ti.dcosX = part->Px()/part->P();
863  ti.dcosY = part->Py()/part->P();
864  ti.dcosZ = part->Pz()/part->P();
865  ti.vtxX = lengthEndPoints.second.first.X();
866  ti.vtxY = lengthEndPoints.second.first.Y();
867  ti.vtxZ = lengthEndPoints.second.first.Z();
868  ti.endX = lengthEndPoints.second.second.X();
869  ti.endY = lengthEndPoints.second.second.Y();
870  ti.endZ = lengthEndPoints.second.second.Z();
871  ti.cosTheta = fUtilities.CosTheta(part->Py(), part->P());
872  ti.azimuth = fUtilities.Azimuth(part->Px(), part->Pz(), part->P());
873  ti.stop = fSelection.Stopper(lengthEndPoints.second.second);
874  ti.goodVtx = (std::abs(fSelection.DistToEdge(track.Start())) < 10.) ? true : false;
875  ti.vtxToEdge = fSelection.DistToEdge(lengthEndPoints.second.first);
876  ti.endToEdge = fSelection.DistToEdge(lengthEndPoints.second.second);
877  ti.cellsPerPlaneX = 0.;
878  ti.cellsPerPlaneY = 0.;
879 
880  // fill information about the difference between the true and reconstructed end points
881  TVector3 simEnd(ti.endX, ti.endY, ti.endZ);
882  TVector3 simBeg(ti.vtxX, ti.vtxY, ti.vtxZ);
883  TVector3 recEnd(track.Stop().X(), track.Stop().Y(), track.Stop().Z());
884  TVector3 recBeg(track.Start().X(), track.Start().Y(), track.Start().Z());
885  TVector3 diffEnd = recEnd - simEnd;
886  TVector3 diffBeg = recBeg - simBeg;
887 
888  float diffEndSign = 1.;
889  float recoDCosZ = track.Dir().Z()/track.Dir().Mag();
890  if( (recoDCosZ > 0. && recEnd.Z() > simEnd.Z()) ||
891  (recoDCosZ < 0. && recEnd.Z() < simEnd.Z()) ) diffEndSign = -1.;
892 
893  float diffBegSign = 1.;
894  if( (recoDCosZ > 0. && recBeg.Z() < simBeg.Z()) ||
895  (recoDCosZ < 0. && recBeg.Z() > simBeg.Z()) ) diffBegSign = -1.;
896 
897  ti.deltaVtxPos = diffBegSign*diffBeg.Mag();
898  ti.deltaEndPos = diffEndSign*diffEnd.Mag();
899 
900  }
901 
902  return ti;
903 
904  }
bool fFindPurityAndEfficiency
because the calculation is so slow
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
CosmicTrackSelection fSelection
object encapsulating selection criteria
X or Y views.
Definition: PlaneGeo.h:30
art::ServiceHandle< cheat::BackTracker > fBT
std::vector< sim::FLSHit > ParticleToFLSHit(const int &trackID) const
All the FLSHits that were created by the track id trackID, sorted from most to least light...
Definition: event.h:19
bool Stopper(TVector3 const &finalPoint)
CosmicTrackUtilities fUtilities
object encapsulating utilitie methods
float abs(float number)
Definition: d0nt_math.hpp:39
double HitCollectionEfficiency(const std::set< int > &trackIDs, const std::vector< rb::WeightedHit > &whits, const std::vector< const rb::CellHit * > &allhits, const geo::View_t &view, std::map< int, double > *effMap=0, bool energyEff=false, double *desiredEnergy=0, double *totalEnergy=0, int *desiredHits=0, int *totalHits=0) const
Returns the fraction of all energy in an event from a specific set of Geant4 track IDs that are repre...
std::pair< std::pair< float, float >, std::pair< TVector3, TVector3 > > TrueLengthEndPoints(simb::MCParticle const &part)
std::map< geo::CellUniqueId, float > TruePathLengthInCell(simb::MCParticle const &part, std::vector< sim::FLSHit > const &flsHits)
TString part[npart]
Definition: Style.C:32
void FilldEdxHistogram(simb::MCParticle const &part)
float Azimuth(float const &dcosX, float const &dcosZ, float const &magnitude)
float CosTheta(float const &dcosY, float const &magnitude)
double HitCollectionPurity(const std::set< int > &trackIDs, const std::vector< rb::WeightedHit > &whits, std::map< int, double > *purMap=0, std::map< int, int > *parents=0, bool energyPur=false) const
Returns the fraction of hits in a collection that come from the specified Geant4 track ids...
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
Definition: BackTracker.h:133
float DistToEdge(TVector3 const &point)
Int_t trackID
Definition: plot.C:84
std::vector< const sim::Particle * > HitsToParticle(const std::vector< const rb::CellHit * > &hits) const
Returns vector of sim::Particle objects contributing to the given collection of hits.
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 trk::CosmicTrackAna::Make1DRecoHistograms ( std::vector< TH1D * > &  hists,
TString const  sample 
)
private

Definition at line 365 of file CosmicTrackAna_module.cc.

References fTFS, analysePickle::hist, kAzimuth, kCellHitSig, kCellHitX, kCellHitY, kCellsPerPlaneX, kCellsPerPlaneY, kCosCosmic, kDCosX, kDCosY, kDCosZ, kDiffX, kDiffY, kDiffZ, kEndDistToEdge, kEndX, kEndY, kEndZ, kFractionHitsUsed, kFractionSigUsed, kHitXPosition, kHitYPosition, kHitZPosition, kMax1DRecoHist, kPlaneHitX, kPlaneHitY, kResidualsX, kResidualsY, kStartX, kStartY, kStartZ, kStepRelativeToMedian, kTNSX, kTNSY, kTrackLength, kTrackRangeMomentum, kTracksFound, kTrkCells, kTrkSig, kVtxDistToEdge, art::TFileDirectory::make(), xbins, xmax, ybins, ymax, zbins, and make_true_q0q3_plots::zmax.

Referenced by beginJob().

367  {
368 
369  hists.resize(kMax1DRecoHist);
370 
371  double maxlength = 6600.0;
372  double xmax = 1200.0;
373  double ymax = 1200.0;
374  double zmax = 6500.0;
375  int xbins = 240;
376  int ybins = 240;
377  int zbins = 650;
378  double ncell = 384;
379  double nplane = 960;
380 
381  hists[kDCosX] = fTFS->make<TH1D>("dirCosX"+sample, ";Track direction cos_{X};Number of tracks", 101, -1., 1.);
382  hists[kDCosY] = fTFS->make<TH1D>("dirCosY"+sample, ";Track direction cos_{Y};Number of tracks", 101, -1., 1.);
383  hists[kDCosZ] = fTFS->make<TH1D>("dirCosZ"+sample, ";Track direction cos_{Z};Number of tracks", 101, -1., 1.);
384  hists[kEndX] = fTFS->make<TH1D>("endX"+sample, ";Track end X (cm);Number of tracks", xbins, -xmax, xmax);
385  hists[kEndY] = fTFS->make<TH1D>("endY"+sample, ";Track end Y (cm);Number of tracks", ybins, -ymax, ymax);
386  hists[kEndZ] = fTFS->make<TH1D>("endZ"+sample, ";Track end Z (cm);Number of tracks", zbins, 0., zmax);
387  hists[kStartX] = fTFS->make<TH1D>("startX"+sample, ";Track start X (cm);Number of tracks", xbins, -xmax, xmax);
388  hists[kStartY] = fTFS->make<TH1D>("startY"+sample, ";Track start Y (cm);Number of tracks", ybins, -ymax, ymax);
389  hists[kStartZ] = fTFS->make<TH1D>("startZ"+sample, ";Track start Z (cm);Number of tracks", zbins, 0., zmax);
390  hists[kDiffX] = fTFS->make<TH1D>("lenX"+sample, ";Track end minus start X (cm);Number of tracks", 100, 0., 1000.);
391  hists[kDiffY] = fTFS->make<TH1D>("lenY"+sample, ";Track end minus start Y (cm);Number of tracks", 100, 0., 1000.);
392  hists[kDiffZ] = fTFS->make<TH1D>("lenZ"+sample, ";Track end minus start Z (cm);Number of tracks", 150, 0., 1500.);
393  hists[kFractionHitsUsed] = fTFS->make<TH1D>("fractionHitsUsed"+sample, ";Used / total hits;Number of spills", 100, 0., 1.);
394  hists[kFractionSigUsed] = fTFS->make<TH1D>("fractionSigUsed"+sample, ";Used / total non-noise hits;Number of spills", 100, 0., 1.);
395  hists[kTracksFound] = fTFS->make<TH1D>("numTracks"+sample, ";Number of reconstructed tracks;", 25, 0, 125);
396  hists[kCellHitSig] = fTFS->make<TH1D>("cellHitSig"+sample, ";Hit PE;Number of CellHits", 100, 0., 100.);
397  hists[kTrkSig] = fTFS->make<TH1D>("trksig"+sample, ";Track Signal (Q);counts", 100,0.,100000.);
398  hists[kTrkCells] = fTFS->make<TH1D>("numHits"+sample, ";Number of CellHits in track;Number of tracks", 500,0,500);
399  hists[kEndDistToEdge] = fTFS->make<TH1D>("endDistToEdge"+sample, ";Track end distance to edge (cm);Number of tracks", 300, -1500., 1500.);
400  hists[kVtxDistToEdge] = fTFS->make<TH1D>("vtxDistToEdge"+sample, ";Track vertex distance to edge (cm);Number of tracks", 300, -1500., 1500.);
401  hists[kTrackLength] = fTFS->make<TH1D>("trackLength"+sample, ";Track Length (cm);Number of tracks", 264, 0., 2.*maxlength);
402  hists[kCosCosmic] = fTFS->make<TH1D>("coszenith"+sample, ";cos#theta_{zenith};Number of tracks", 100, 0., 1.);
403  hists[kAzimuth] = fTFS->make<TH1D>("azimuth"+sample, ";#phi (azimuth angle);Number of tracks", 36, 0., 360.);
404  hists[kHitXPosition] = fTFS->make<TH1D>("hitXPosition"+sample, ";Hit X (cm);Number of RecoHits", xbins, -xmax, xmax);
405  hists[kHitYPosition] = fTFS->make<TH1D>("hitYPosition"+sample, ";Hit Y (cm);Number of RecoHits", ybins, -ymax, ymax);
406  hists[kHitZPosition] = fTFS->make<TH1D>("hitZPosition"+sample, ";Hit Z (cm);Number of RecoHits", zbins, 0., zmax);
407  hists[kCellHitX] = fTFS->make<TH1D>("CellX"+sample, ";Track hit cell # in X view;Number of CellHits", ncell, -0.5, ncell-0.5);
408  hists[kCellHitY] = fTFS->make<TH1D>("CellY"+sample, ";Track hit cell # in Y view;Number of CellHits", ncell, -0.5, ncell-0.5);
409  hists[kPlaneHitX] = fTFS->make<TH1D>("PlaneX"+sample, ";Track hit plane # in X view;Number of CellHits", nplane, 0, nplane-0.5);
410  hists[kPlaneHitY] = fTFS->make<TH1D>("PlaneY"+sample, ";Track hit plane # in Y view;Number of CellHits", nplane, 0, nplane-0.5);
411  hists[kResidualsX] = fTFS->make<TH1D>("residualsX"+sample, ";Fit residual (cm) in X view;Number of hits", 400, 0., 1000.);
412  hists[kResidualsY] = fTFS->make<TH1D>("residualsY"+sample, ";Fit residual (cm) in Y view;Number of hits", 400, 0., 1000.);
413  hists[kTNSX] = fTFS->make<TH1D>("HitTNSX"+sample, ";Hit time (ns) in X view;Number of hits", 70000, -1.e5, 6.e5);
414  hists[kTNSY] = fTFS->make<TH1D>("HitTNSY"+sample, ";Hit time (ns) in Y view;Number of hits", 70000, -1.e5, 6.e5);
415  hists[kTrackRangeMomentum]= fTFS->make<TH1D>("rangeMomentum"+sample, ";p_{range} (GeV);Number of tracks", 100, 0., 100.);
416  hists[kCellsPerPlaneX] = fTFS->make<TH1D>("cellsPerPlaneX"+sample, ";<Cells/Plane>_{X view};Number of tracks", 200, 0., 50. );
417  hists[kCellsPerPlaneY] = fTFS->make<TH1D>("cellsPerPlaneY"+sample, ";<Cells/Plane>_{X view};Number of tracks", 200, 0., 50. );
418  hists[kStepRelativeToMedian] = fTFS->make<TH1D>("stepsRelativeToMedian"+sample, ";Step Size/Median Step;Number of tracks", 200, 0., 50.);
419  for( auto hist : hists) hist->Sumw2();
420 
421  return;
422  }
direction cosine in x
track start position in x
distribution of x/y cellhit times in nano seconds
distribution of x/y cellhit times in nano seconds
std::map< std::string, double > xmax
signal size of calibrated cell hits
difference in track start and end position in y
Fraction of hits in event used in track.
distance in cm to closest edge of detector at track vertex
residuals for the tracks
difference in track start and end position in z
number of cells in a track
TString hists[nhists]
Definition: bdt_com.C:3
difference in track start and end position in x
residuals for the tracks
number of tracks found
position of reco hits in z
average number of cells hit per plane in y
cosine theta of cosmic track with respect to zenith
Double_t ymax
Definition: plot.C:25
track end position in y
azimuthal angle of the cosmic ray
track signal (Q)
position of reco hits in y
const int xbins
Definition: MakePlots.C:82
track start position in z
average number of cells hit per plane in x
Fraction of hits in event used in track.
direction cosine in z
art::ServiceHandle< art::TFileService > fTFS
track end position in x
length of track
const int ybins
T * make(ARGS...args) const
distance in cm to closest edge of detector at track end
momentum of track from range
direction cosine in y
track start position in y
track end position in z
position of reco hits in x
const Binning zbins
size of steps along trajectory normalized by the median step
void trk::CosmicTrackAna::Make1DTruthHistograms ( std::vector< TH1D * > &  hists,
TString const  sample 
)
private

Definition at line 425 of file CosmicTrackAna_module.cc.

References fTFS, analysePickle::hist, kAzimuthTrue, kCosCosmicTrue, kDCosXDiff, kDCosYDiff, kDCosZDiff, kDeltaBeg, kDeltaEnd, kDeltaRangeMomentum, kDeltaRangeMomentumUncor, kDeltaTrackLength, kDeltaZEnd, kEndTrueX, kEndTrueY, kEndTrueZ, kMax1DTruthHist, kPrimaryTrueEnergy, kRecoEff, kStartTrueX, kStartTrueY, kStartTrueZ, kTrackEfficiency, kTrackPurity, and art::TFileDirectory::make().

Referenced by analyze().

427  {
428 
429  hists.resize(kMax1DTruthHist);
430 
431  double maxlength = 6600.0;
432 
433  hists[kDCosXDiff] = fTFS->make<TH1D>("dcosXDiff"+sample, ";Fractional error in X direction cosine;Number of tracks", 200, -1., 3.);
434  hists[kDCosYDiff] = fTFS->make<TH1D>("dcosYDiff"+sample, ";Fractional error in Y direction cosine;Number of tracks", 200, -1., 3.);
435  hists[kDCosZDiff] = fTFS->make<TH1D>("dcosZDiff"+sample, ";Fractional error in Z direction cosine;Number of tracks", 200, -1., 3.);
436  hists[kPrimaryTrueEnergy] = fTFS->make<TH1D>("primaryTrueEnergy"+sample, ";True primary energy (GeV);Number of tracks", 200, 0., 50.);
437  hists[kRecoEff] = fTFS->make<TH1D>("recoeff"+sample, ";Fraction of tracks reconstructed;Number of spills", 100, 0., 1.);
438  hists[kTrackPurity] = fTFS->make<TH1D>("trackPurity"+sample, ";Tracking hit purity;Number of tracks", 100, 0., 2.);
439  hists[kTrackEfficiency] = fTFS->make<TH1D>("trackEfficiency"+sample, ";Tracking hit efficiency;Number of tracks", 100, 0., 2.);
440  hists[kDeltaTrackLength] = fTFS->make<TH1D>("errTrackLength"+sample, ";Error in track length (cm);Number of tracks", 264, -maxlength, maxlength);
441  hists[kDeltaRangeMomentum]= fTFS->make<TH1D>("errRangeMom"+sample, ";Error in #Delta p_{range} (GeV/c);Number of tracks", 400, -2, 2.);
442  hists[kDeltaRangeMomentumUncor]= fTFS->make<TH1D>("deltaRangeMomUncor"+sample, ";Error in #Delta p_{range} (uncorrected) (GeV/c);Number of tracks", 100, -2, 2.);
443  hists[kDeltaZEnd] = fTFS->make<TH1D>("errZEnd"+sample, ";Error in Z end position (cm);Number of tracks", 200, -100., 100.);
444  hists[kDeltaEnd] = fTFS->make<TH1D>("errEnd"+sample, ";Error in end position (cm);Number of tracks", 200, -100., 100.);
445  hists[kDeltaBeg] = fTFS->make<TH1D>("errStart"+sample, ";Error in start position (cm);Number of tracks", 200, -100., 100.);
446  hists[kEndTrueX] = fTFS->make<TH1D>("trueEndX"+sample, ";True end position X (cm);Number of true tracks", 80, -800., 800.);
447  hists[kEndTrueY] = fTFS->make<TH1D>("trueEndY"+sample, ";True end position Y (cm);Number of true tracks", 80, -800., 800.);
448  hists[kEndTrueZ] = fTFS->make<TH1D>("trueEndZ"+sample, ";True end position Z (cm);Number of true tracks", 300, 0., 6000.);
449  hists[kStartTrueX] = fTFS->make<TH1D>("trueStartX"+sample, ";True start position X (cm);Number of true tracks", 80, -800., 800.);
450  hists[kStartTrueY] = fTFS->make<TH1D>("trueStartY"+sample, ";True start position Y (cm);Number of true tracks", 80, -800., 800.);
451  hists[kStartTrueZ] = fTFS->make<TH1D>("trueStartZ"+sample, ";True start position Z (cm);Number of true tracks", 300, 0., 6000.);
452  hists[kCosCosmicTrue] = fTFS->make<TH1D>("coscosmic"+sample, ";True cos#theta;Number of true tracks", 100, 0., 1.);
453  hists[kAzimuthTrue] = fTFS->make<TH1D>("azimuth"+sample, ";True #phi;Number of true tracks", 36, 0., 360.);
454 
455  for( auto hist : hists) hist->Sumw2();
456 
457  return;
458  }
difference between true and reco length in cm
truth start position in x
azimuthal angle of the cosmic ray
efficiency in selecting hits for the track
Fraction difference in direction cosine in y.
difference in reco momentum from range and true momentum
TString hists[nhists]
Definition: bdt_com.C:3
cosine theta of cosmic track with respect to zenith
Fraction difference in direction cosine in z.
True energy of particle zero (GeV)
Fraction difference in direction cosine in x.
truth start position in y
art::ServiceHandle< art::TFileService > fTFS
purity in selecting hits for the track
difference in end point of reconstructed track vs simulated
truth start position in z
T * make(ARGS...args) const
difference in reco momentum from range uncorrected for track length
difference in start point of reconstructed track vs simulated
truth end position in x
truth end position in z
truth end position in y
difference in z end point of reconstructed track vs simulated
void trk::CosmicTrackAna::Make2DRecoHistograms ( std::vector< TH2D * > &  hists,
TString const  sample 
)
private

Definition at line 461 of file CosmicTrackAna_module.cc.

References fTFS, analysePickle::hist, kCellPlaneX, kCellPlaneY, kCellsPerPlaneXY, kDirXY, kEndXY, kEndZX, kEndZY, kFracHitsUsedVsNum, kHitXYPosition, kHitXZPosition, kHitYZPosition, kMax2DRecoHist, kPEPerCMVsWX, kPEPerCMVsWY, kResidVsAzX, kResidVsAzY, kResidVsCosX, kResidVsCosY, kStartXY, kStartZX, kStartZY, kStepRelativeToMedianVsAz, art::TFileDirectory::make(), xbins, xmax, ybins, ymax, zbins, and make_true_q0q3_plots::zmax.

Referenced by beginJob().

463  {
464 
465  hists.resize(kMax2DRecoHist);
466 
467  double xmax = 1200.0;
468  double ymax = 1200.0;
469  double zmax = 6500.0;
470  int xbins = 24;
471  int ybins = 24;
472  int zbins = 130;
473  double ncell = 384;
474  double nplane = 960;
475 
476  hists[kEndXY] = fTFS->make<TH2D>("endXY"+sample, ";End X (cm); End Y (cm)", xbins, -xmax, xmax, ybins, -ymax, ymax);
477  hists[kEndZY] = fTFS->make<TH2D>("endZY"+sample, ";End Z (cm); End Y (cm)", zbins, 0., zmax, ybins, -ymax, ymax);
478  hists[kEndZX] = fTFS->make<TH2D>("endZX"+sample, ";End Z (cm); End X (cm)", zbins, 0., zmax, xbins, -xmax, xmax);
479  hists[kStartXY] = fTFS->make<TH2D>("startXY"+sample, ";Start X (cm); Start Y (cm)", xbins, -xmax, xmax, ybins, -ymax, ymax);
480  hists[kStartZY] = fTFS->make<TH2D>("startZY"+sample, ";Start Z (cm); Start Y (cm)", zbins, 0., zmax, ybins, -ymax, ymax);
481  hists[kStartZX] = fTFS->make<TH2D>("startZX"+sample, ";Start Z (cm); Start X (cm)", zbins, 0., zmax, xbins, -xmax, xmax);
482  hists[kDirXY] = fTFS->make<TH2D>("dirXY"+sample, ";Prong Direction X;Prong Direction Y", 101, -1., 1., 101, -1., 1.);
483  hists[kFracHitsUsedVsNum] = fTFS->make<TH2D>("fractionHitsUsedVsNum"+sample, ";Total Hits; Fraction Used", 250, 0., 500., 100, 0., 1.);
484  hists[kHitXYPosition] = fTFS->make<TH2D>("hitXYPosition"+sample, ";Hit X (cm);Hit Y (cm)", 20, -200., 200., 50, -250., 250.);
485  hists[kHitXZPosition] = fTFS->make<TH2D>("hitXZPosition"+sample, ";Hit Z (cm);Hit X (cm)", 150, 0., 1500., 40, -200., 200.);
486  hists[kHitYZPosition] = fTFS->make<TH2D>("hitYZPosition"+sample, ";Hit Z (cm);Hit Y (cm)", 150, 0., 1500., 50, -250., 250.);
487  hists[kCellPlaneX] = fTFS->make<TH2D>("ViewX"+sample, ";Plane no. ;Cell no.", nplane, 0., nplane-0.5, ncell, 0., ncell-0.5);
488  hists[kCellPlaneY] = fTFS->make<TH2D>("ViewY"+sample, ";Plane no. ;Cell no.", nplane, 0., nplane-0.5, ncell, 0., ncell-0.5);
489  hists[kResidVsCosX] = fTFS->make<TH2D>("residVsCosX"+sample, ";Residual (cm);cos(#theta)", 200, 0., 1000., 100, -1., 1.);
490  hists[kResidVsCosY] = fTFS->make<TH2D>("residVsCosY"+sample, ";Residual (cm);cos(#theta)", 200, 0., 1000., 100, -1., 1.);
491  hists[kResidVsAzX] = fTFS->make<TH2D>("residVsAzX"+sample, ";Residual (cm);#phi", 200, 0., 1000., 180, 0., 360.);
492  hists[kResidVsAzY] = fTFS->make<TH2D>("residVsAzY"+sample, ";Residual (cm);#phi", 200, 0., 1000., 180, 0., 360.);
493  hists[kCellsPerPlaneXY] = fTFS->make<TH2D>("cellsPerPlaneXY"+sample, ";<Cells/Plane>_{X view};<Cells/Plane>_{Y view}", 200, 0., 50., 200, 0., 50.);
494  hists[kPEPerCMVsWX] = fTFS->make<TH2D>("pePerCMVsWX"+sample, ";W (cm);PE/cm", xbins, -xmax, xmax, 60, 0., 300.);
495  hists[kPEPerCMVsWY] = fTFS->make<TH2D>("pePerCMVsWY"+sample, ";W (cm);PE/cm", ybins, -ymax, ymax, 60, 0., 300.);
496  hists[kStepRelativeToMedianVsAz] = fTFS->make<TH2D>("stepRelativeToMedianVsAz"+sample, ";#phi;Largest Step/Median Step", 120, 0., 360., 100, 0., 10.);
497 
498  for( auto hist : hists) hist->Sumw2();
499 
500  return;
501  }
std::map< std::string, double > xmax
PE/cm deposited as a function of W in Y view.
track start position in zx
reco hit positions in xz
cells hit per plane in Y vs X
residual for each hit vs azimuth
track end position in zx
PE/cm deposited as a function of W in X view.
track end position in xy
largest trajectory step relative to the median vs azimuth
TString hists[nhists]
Definition: bdt_com.C:3
Double_t ymax
Definition: plot.C:25
track end position in zy
const int xbins
Definition: MakePlots.C:82
track start position in zy
reco hit positions in yz
art::ServiceHandle< art::TFileService > fTFS
direction in x versus y
const int ybins
Fraction hits used vs the number of hits that could be used.
reco hit positions in xy
T * make(ARGS...args) const
track start position in xy
residual for each hit vs cos(theta)
const Binning zbins
void trk::CosmicTrackAna::Make2DTruthHistograms ( std::vector< TH2D * > &  hists,
TString const  sample 
)
private

Definition at line 504 of file CosmicTrackAna_module.cc.

References fTFS, analysePickle::hist, kDCosXDiffVsZLen, kDCosXRecoVsTrue, kDCosYDiffVsZLen, kDCosYRecoVsTrue, kDCosZDiffVsZLen, kDCosZRecoVsTrue, kdEdxVsRange, kDeltaLengthVsCellsPerPlane, kDeltaLengthVsDeltaEndPlane, kDeltaLengthVsDeltaStartPlane, kDeltaLengthVsLength, kDeltaLengthVsPlaneAsymmetry, kDeltaRangeMomUncorVsAzimuth, kDeltaRangeMomUncorVsCosTheta, kDeltaRangeMomUncorVsLength, kDeltaRangeMomVsLength, kDeltaZBegVsDCosZ, kDeltaZEndVsDCosZ, kDeltaZEndVsDistToEdge, kDiffBegVsAzimuth, kDiffBegVsCosTheta, kDiffBegVsDCosZ, kDiffEndVsAzimuth, kDiffEndVsCosTheta, kDiffEndVsDCosZ, kMax2DTruthHist, kTrackFindEff, kTracksFoundVsLeft, and art::TFileDirectory::make().

Referenced by analyze().

506  {
507 
508  hists.resize(kMax2DTruthHist);
509 
510  double maxlength = 6600.0;
511 
512  hists[kDCosXRecoVsTrue] = fTFS->make<TH2D>("dcosXRecoVsTrue"+sample, ";dcos X_{true};dcos X_{reco}", 250, -1., 1., 250, -1., 1.);
513  hists[kDCosYRecoVsTrue] = fTFS->make<TH2D>("dcosYRecoVsTrue"+sample, ";dcos Y_{true};dcos Y_{reco}", 250, -1., 1., 250, -1., 1.);
514  hists[kDCosZRecoVsTrue] = fTFS->make<TH2D>("dcosZRecoVsTrue"+sample, ";dcos Z_{true};dcos Z_{reco}", 250, -1., 1., 250, -1., 1.);
515  hists[kDCosXDiffVsZLen] = fTFS->make<TH2D>("dcosXDiffVsZLen"+sample, ";Z length (cm);dcos_{X} Fractional Difference", 1320, 0., maxlength, 200, -1., 5.);
516  hists[kDCosYDiffVsZLen] = fTFS->make<TH2D>("dcosYDiffVsZLen"+sample, ";Z length (cm);dcos_{Y} Fractional Difference", 1320, 0., maxlength, 200, -1., 3.);
517  hists[kDCosZDiffVsZLen] = fTFS->make<TH2D>("dcosZDiffVsZLen"+sample, ";Z length (cm);dcos_{Z} Fractional Difference", 1320, 0., maxlength, 200, -1., 3.);
518  hists[kTracksFoundVsLeft] = fTFS->make<TH2D>("tracksFoundVsLeft"+sample, ";True tracks;Reco tracks", 25, 0, 125, 25, 0, 125);
519  hists[kTrackFindEff] = fTFS->make<TH2D>("trackfindeff"+sample, ";True tracks;Reco Efficiency", 20, 0, 10, 100, 0, 1);
520  hists[kDeltaZEndVsDCosZ] = fTFS->make<TH2D>("deltaZEndVsDCosZ"+sample, ";#Delta Z_{end} (cm);dZ/dS;", 200, -100., 100., 20, -1., 1.);
521  hists[kDeltaZBegVsDCosZ] = fTFS->make<TH2D>("deltaZBegVsDCosZ"+sample, ";#Delta Z_{start} (cm);dZ/dS;", 200, -100., 100., 20, -1., 1.);
522  hists[kDiffEndVsDCosZ] = fTFS->make<TH2D>("diffEndVsDCosZ"+sample, ";dZ/dS;#Delta_{end} (cm)", 20, -1., 1., 200, -100., 100.);
523  hists[kDiffBegVsDCosZ] = fTFS->make<TH2D>("diffBegVsDCosZ"+sample, ";dZ/dS;#Delta_{start} (cm)", 20, -1., 1., 200, -100., 100.);
524  hists[kDiffEndVsAzimuth] = fTFS->make<TH2D>("diffEndVsAzimuth"+sample, ";#phi;#Delta_{end} (cm);", 120, 0., 360., 200, -100., 100.);
525  hists[kDiffBegVsAzimuth] = fTFS->make<TH2D>("diffBegVsAzimuth"+sample, ";#phi;#Delta_{start} (cm);", 120, 0., 360., 200, -100., 100.);
526  hists[kDiffEndVsCosTheta] = fTFS->make<TH2D>("diffEndVsCosTheta"+sample, ";cos(#theta);#Delta_{end} (cm);", 20, -1., 1., 200, -100., 100.);
527  hists[kDiffBegVsCosTheta] = fTFS->make<TH2D>("diffBegVsCosTheta"+sample, ";cos(#theta);#Delta_{start} (cm);", 20, -1., 1., 200, -100., 100.);
528  hists[kDeltaZEndVsDistToEdge] = fTFS->make<TH2D>("deltaZEndVsDistToEdge"+sample, ";#Delta Z_{end} (cm);Dist To Edge (cm);", 200, -100., 100., 200, -100., 100.);
529  hists[kDeltaRangeMomVsLength] = fTFS->make<TH2D>("deltaMomVsLength"+sample, ";l_{reco} (cm);#Deltap/p", 100, 0., 2500., 2000, -1., 1.);
530  hists[kDeltaRangeMomUncorVsLength] = fTFS->make<TH2D>("deltaMomUncorVsLength"+sample, ";l_{reco} (cm);#Deltap/p", 100, 0., 2500., 2000, -1., 1.);
531  hists[kDeltaRangeMomUncorVsCosTheta] = fTFS->make<TH2D>("deltaMomUncorVsCosTheta"+sample, ";cos#theta_{reco};#Deltap/p", 100, 0., 1., 2000, -1., 1.);
532  hists[kDeltaRangeMomUncorVsAzimuth] = fTFS->make<TH2D>("deltaMomUncorVsAzimuth"+sample, ";#phi_{reco} (deg);#Deltap/p", 100, 0., 360., 2000, -1., 1.);
533  hists[kDeltaLengthVsLength] = fTFS->make<TH2D>("deltaLengthVsLength"+sample, ";l_{reco} (cm);#Deltal/l", 100, 0., 2500., 2000, -1., 1.);
534  hists[kdEdxVsRange] = fTFS->make<TH2D>("dEdxVsRange"+sample, ";Range (cm);dE/dx (MeV)", 5000, 0., 5000., 2000, 0., 20.);
535  hists[kDeltaLengthVsPlaneAsymmetry] = fTFS->make<TH2D>("deltaLengthVsPlaneAsymmetry"+sample, ";Plane Asymmetry;#Deltal/l", 200, -1., 1., 2000, -1., 1.);
536  hists[kDeltaLengthVsDeltaStartPlane] = fTFS->make<TH2D>("deltaLengthVsDeltaStartPlane"+sample, ";#Delta Start Plane;#Deltal/l", 50, 0., 50., 2000, -1., 1.);
537  hists[kDeltaLengthVsDeltaEndPlane] = fTFS->make<TH2D>("deltaLengthVsDeltaEndPlane"+sample, ";#Delta Start Plane;#Deltal/l", 50, 0., 50., 2000, -1., 1.);
538  hists[kDeltaLengthVsCellsPerPlane] = fTFS->make<TH2D>("deltaLengthVsCellsPerPlane"+sample, ";Maximum Cells/Plane;#Deltal/l", 50, 0., 50., 2000, -1., 1.);
539 
540  for( auto hist : hists) hist->Sumw2();
541 
542  return;
543  }
fractional length vs difference in end plane in each view
difference in end point of recoed track & simulated vs cosTheta
difference in reco and true range momentum as a function of reco length
difference in reco and true range momentum as a function of azimuth
difference in end point of recoed track & simulated vs dcosZ
Direction cosine in x.
difference in start point of recoed track & simulated vs cosTheta
difference in recon and true length as a function of reco length
difference in start point of recoed track & simulated vs dcosZ
Fraction difference in direction cosine in x vs z length.
TString hists[nhists]
Definition: bdt_com.C:3
number of tracks found in event vs particles leaving tracks
difference in start point of recoed track & simulated vs azimuth
fractional length vs difference in start plane in each view
fractional length vs asymmetry in number of planes in each view
art::ServiceHandle< art::TFileService > fTFS
difference in z endpoint of recoed track & simulated vs dcosZ
dE/dx vs remaining length in a track
Fraction difference in direction cosine in z vs z length.
Fraction difference in direction cosine in y vs z length.
T * make(ARGS...args) const
difference in z start point of recoed track & simulated vs dcosZ
fractional length vs maximum cells per plane
difference in reco and true range momentum as a function of reco length
difference in reco and true range momentum as a function of cos theta
difference in end point of recoed track & simulated vs azimuth
Direction cosine in z.
difference in z endpoint of recoed track & simulated vs dcosZ
Direction cosine in y.
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 trk::CosmicTrackAna::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 1392 of file CosmicTrackAna_module.cc.

References fExposureLabel, fFindPurityAndEfficiency, fMinSig, fSelection, fTrackLabel, fUtilities, fhicl::ParameterSet::get(), trk::CosmicTrackSelection::reconfigure(), trk::CosmicTrackUtilities::reconfigure(), and string.

Referenced by CosmicTrackAna().

1393  {
1394 
1395  fTrackLabel = pset.get< std::string >("TrackLabel" );
1396  fExposureLabel = pset.get< std::string >("ExposureLabel" );
1397  fMinSig = pset.get< double >("MinSig" );
1398  fFindPurityAndEfficiency = pset.get< bool >("FindPurityAndEfficiency", false);
1399 
1400  fSelection.reconfigure(pset.get<fhicl::ParameterSet>("SelectionCriteria"));
1401  fUtilities.reconfigure(pset.get<fhicl::ParameterSet>("Utilities" ));
1402 
1403  return;
1404  }
bool fFindPurityAndEfficiency
because the calculation is so slow
double fMinSig
track - using PE values
std::string fExposureLabel
Where to find CosmicExposure info.
void reconfigure(fhicl::ParameterSet const &pset)
std::string fTrackLabel
Where to find Tracks to reconstruct.
CosmicTrackSelection fSelection
object encapsulating selection criteria
CosmicTrackUtilities fUtilities
object encapsulating utilitie methods
T get(std::string const &key) const
Definition: ParameterSet.h:231
void reconfigure(fhicl::ParameterSet const &pset)
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

art::ServiceHandle<cheat::BackTracker> trk::CosmicTrackAna::fBT
private

Definition at line 268 of file CosmicTrackAna_module.cc.

Referenced by analyze(), FillEventMCTruthHistograms(), and FillTrueInfo().

double trk::CosmicTrackAna::fCellHalfDepthZ
private

extent of a cell in the z direction

Definition at line 242 of file CosmicTrackAna_module.cc.

Referenced by analyze().

CosmicHitInfo trk::CosmicTrackAna::fCosmicHit
private

information about hits

Definition at line 263 of file CosmicTrackAna_module.cc.

Referenced by beginJob(), and FillTrackHistograms().

TH1D* trk::CosmicTrackAna::fCosmicRate
private

histogram holding single value for cosmic rate in Hz at end of job

Definition at line 247 of file CosmicTrackAna_module.cc.

Referenced by beginJob(), and endJob().

double trk::CosmicTrackAna::fDetHalfHeight
private

detector half height, cached

Definition at line 244 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and FilldEdxHistogram().

double trk::CosmicTrackAna::fDetHalfWidth
private

detector half width, cached

Definition at line 243 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and FilldEdxHistogram().

double trk::CosmicTrackAna::fDetLength
private

detector length, cached

Definition at line 245 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and FilldEdxHistogram().

TH1D* trk::CosmicTrackAna::fExposure
private

histogram holding single value for exposure in s at end of job

Definition at line 248 of file CosmicTrackAna_module.cc.

Referenced by beginJob(), and endJob().

std::string trk::CosmicTrackAna::fExposureLabel
private

Where to find CosmicExposure info.

Definition at line 228 of file CosmicTrackAna_module.cc.

Referenced by beginSubRun(), and reconfigure().

bool trk::CosmicTrackAna::fFindPurityAndEfficiency
private

because the calculation is so slow

Set to true in fcl file to calculate them, false by default

Definition at line 231 of file CosmicTrackAna_module.cc.

Referenced by FillTrueInfo(), and reconfigure().

art::ServiceHandle<geo::Geometry> trk::CosmicTrackAna::fGeom
private

Definition at line 266 of file CosmicTrackAna_module.cc.

Referenced by analyze(), beginJob(), FillRecoInfo(), and FillTrackHistograms().

TTree* trk::CosmicTrackAna::fHitTree
private

initializer of Hit TTree for this module

Definition at line 265 of file CosmicTrackAna_module.cc.

Referenced by beginJob(), and FillTrackHistograms().

art::ServiceHandle<geo::LiveGeometry> trk::CosmicTrackAna::fLiveGeom
private

Definition at line 267 of file CosmicTrackAna_module.cc.

double trk::CosmicTrackAna::fLiveTime
private

Livetime in sec according to file.

Definition at line 236 of file CosmicTrackAna_module.cc.

Referenced by beginSubRun(), and endJob().

double trk::CosmicTrackAna::fMinSig
private

track - using PE values

Minimum signal of cell hit to use in a

Definition at line 229 of file CosmicTrackAna_module.cc.

Referenced by FillRecoInfo(), and reconfigure().

unsigned int trk::CosmicTrackAna::fNevents
private

total number of events counter

Definition at line 237 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and endJob().

int trk::CosmicTrackAna::fNTracks
private

total number of reconstructed tracks counter

Definition at line 238 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and endJob().

int trk::CosmicTrackAna::fNTracksMC
private

total number of MC particles

Definition at line 239 of file CosmicTrackAna_module.cc.

Referenced by FillEventMCTruthHistograms().

std::vector<TH1D *> trk::CosmicTrackAna::fOneDHistsRecoAll
private

one dimensional histograms for all tracks

Definition at line 250 of file CosmicTrackAna_module.cc.

Referenced by analyze(), beginJob(), FillRecoInfo(), and FillTrackHistograms().

std::vector<TH1D *> trk::CosmicTrackAna::fOneDHistsRecoStop
private

one dimensional histograms for stopping tracks

Definition at line 251 of file CosmicTrackAna_module.cc.

Referenced by analyze(), beginJob(), FillRecoInfo(), and FillTrackHistograms().

std::vector<TH1D *> trk::CosmicTrackAna::fOneDHistsTruthAll
private

one dimensional histograms for all tracks

Definition at line 252 of file CosmicTrackAna_module.cc.

Referenced by analyze(), FillEventMCTruthHistograms(), and FillTrackMCTruthHistograms().

std::vector<TH1D *> trk::CosmicTrackAna::fOneDHistsTruthStop
private

one dimensional histograms for stopping tracks

Definition at line 253 of file CosmicTrackAna_module.cc.

Referenced by analyze(), FillEventMCTruthHistograms(), and FillTrackMCTruthHistograms().

int trk::CosmicTrackAna::fRun
private

Run number.

Definition at line 240 of file CosmicTrackAna_module.cc.

Referenced by analyze().

CosmicTrackSelection trk::CosmicTrackAna::fSelection
private
CosmicSignalHitFraction trk::CosmicTrackAna::fSigHitFrac
private

fraction of signal and hits used

Definition at line 262 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and beginJob().

int trk::CosmicTrackAna::fSubRun
private

Subrun number.

Definition at line 241 of file CosmicTrackAna_module.cc.

Referenced by analyze().

art::ServiceHandle<art::TFileService> trk::CosmicTrackAna::fTFS
private
std::string trk::CosmicTrackAna::fTrackLabel
private

Where to find Tracks to reconstruct.

Definition at line 227 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and reconfigure().

CosmicTrackInfo trk::CosmicTrackAna::fTrackReco
private

single track reco information

Definition at line 261 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and beginJob().

CosmicTrackInfo trk::CosmicTrackAna::fTrackTruth
private

single track mc truth information

Definition at line 260 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and beginJob().

TTree* trk::CosmicTrackAna::fTree
private

initializer of TTree for this module

Definition at line 264 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and beginJob().

CosmicTrackTree trk::CosmicTrackAna::fTrigger
private

event information

Definition at line 259 of file CosmicTrackAna_module.cc.

Referenced by analyze(), and beginJob().

std::vector<TH2D *> trk::CosmicTrackAna::fTwoDHistsRecoAll
private

two dimensional histograms for all tracks

Definition at line 254 of file CosmicTrackAna_module.cc.

Referenced by analyze(), beginJob(), and FillTrackHistograms().

std::vector<TH2D *> trk::CosmicTrackAna::fTwoDHistsRecoStop
private

two dimensional histograms for stopping tracks

Definition at line 255 of file CosmicTrackAna_module.cc.

Referenced by beginJob(), and FillTrackHistograms().

std::vector<TH2D *> trk::CosmicTrackAna::fTwoDHistsTruthAll
private

two dimensional histograms for all tracks

Definition at line 256 of file CosmicTrackAna_module.cc.

Referenced by analyze(), FilldEdxHistogram(), FillEventMCTruthHistograms(), and FillTrackMCTruthHistograms().

std::vector<TH2D *> trk::CosmicTrackAna::fTwoDHistsTruthStop
private

two dimensional histograms for stopping tracks

Definition at line 257 of file CosmicTrackAna_module.cc.

Referenced by analyze(), FilldEdxHistogram(), and FillTrackMCTruthHistograms().

CosmicTrackUtilities trk::CosmicTrackAna::fUtilities
private

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