LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ClusteringValidation::ClusterCounter Class Reference

Public Member Functions

 ClusterCounter (unsigned int &tpc, unsigned int &plane)
 
void AddHitPreClustering (TrackID id)
 
void AddSignalHitPostClustering (ClusterID id)
 
void AddNoiseHitPostClustering (ClusterID id)
 
void AssociateClusterAndTrack (ClusterID clusID, TrackID trackID)
 
double GetCompleteness (ClusterID id)
 
double GetCleanliness (ClusterID id)
 
double GetEfficiency (TrackID id)
 
ClusterIDs GetListOfClusterIDs ()
 
TrackIDs GetListOfTrackIDs ()
 
int GetNumberHitsFromTrack (TrackID id)
 
int GetNumberHitsInCluster (ClusterID id)
 
int GetNumberHitsInPlane ()
 
std::vector< std::pair< TrackID, ClusterIDs > > GetPhotons ()
 
TrackID GetTrack (ClusterID id)
 
bool IsNoise (ClusterID id)
 
bool IsNoise (TrackID id)
 
bool PassesCut ()
 

Private Attributes

unsigned int tpc
 
unsigned int plane
 
std::map< TrackID, int > numHitsPreClustering
 
std::map< ClusterID, int > numSignalHitsPostClustering
 
std::map< ClusterID, int > numNoiseHitsPostClustering
 
std::map< ClusterID, TrackIDclusterToTrackID
 
std::map< TrackID, ClusterIDstrackToClusterIDs
 
std::map< TrackID, std::map< std::string, double > > particleProperties
 
std::map< TrackID, simb::MCParticletrueParticles
 
art::ServiceHandle< geo::Geometrygeometry
 
art::ServiceHandle< cheat::BackTrackerServicebt_serv
 
art::ServiceHandle< cheat::ParticleInventoryServicepi_serv
 

Detailed Description

Definition at line 77 of file ClusteringValidation_module.cc.

Constructor & Destructor Documentation

ClusteringValidation::ClusterCounter::ClusterCounter ( unsigned int &  tpc,
unsigned int &  plane 
)
explicit

Definition at line 118 of file ClusteringValidation_module.cc.

Member Function Documentation

void ClusteringValidation::ClusterCounter::AddHitPreClustering ( TrackID  id)

Definition at line 123 of file ClusteringValidation_module.cc.

123 { ++numHitsPreClustering[trackID]; }
void ClusteringValidation::ClusterCounter::AddNoiseHitPostClustering ( ClusterID  id)

Definition at line 127 of file ClusteringValidation_module.cc.

127 { ++numNoiseHitsPostClustering[clusID]; }
void ClusteringValidation::ClusterCounter::AddSignalHitPostClustering ( ClusterID  id)

Definition at line 125 of file ClusteringValidation_module.cc.

125 { ++numSignalHitsPostClustering[clusID]; }
std::map< ClusterID, int > numSignalHitsPostClustering
void ClusteringValidation::ClusterCounter::AssociateClusterAndTrack ( ClusterID  clusID,
TrackID  trackID 
)

Definition at line 129 of file ClusteringValidation_module.cc.

129 { clusterToTrackID[clusID] = trackID; trackToClusterIDs[trackID].push_back(clusID); }
std::map< TrackID, ClusterIDs > trackToClusterIDs
std::map< ClusterID, TrackID > clusterToTrackID
double ClusteringValidation::ClusterCounter::GetCleanliness ( ClusterID  id)

Definition at line 133 of file ClusteringValidation_module.cc.

133 { return (double)numSignalHitsPostClustering[clusID]/(double)(GetNumberHitsInCluster(clusID)); }
std::map< ClusterID, int > numSignalHitsPostClustering
double ClusteringValidation::ClusterCounter::GetCompleteness ( ClusterID  id)

Definition at line 131 of file ClusteringValidation_module.cc.

131 { return (double)numSignalHitsPostClustering[clusID]/(double)numHitsPreClustering[clusterToTrackID[clusID]]; }
std::map< ClusterID, int > numSignalHitsPostClustering
std::map< ClusterID, TrackID > clusterToTrackID
double ClusteringValidation::ClusterCounter::GetEfficiency ( TrackID  id)

Definition at line 135 of file ClusteringValidation_module.cc.

135 { return 1/(double)trackToClusterIDs.at(trackID).size(); }
std::map< TrackID, ClusterIDs > trackToClusterIDs
ClusterIDs ClusteringValidation::ClusterCounter::GetListOfClusterIDs ( )

Definition at line 143 of file ClusteringValidation_module.cc.

143 { ClusterIDs v; for (std::map<ClusterID,TrackID>::iterator i = clusterToTrackID.begin(); i != clusterToTrackID.end(); i++) v.push_back(i->first); return v; }
intermediate_table::iterator iterator
std::vector< ClusterID > ClusterIDs
std::map< ClusterID, TrackID > clusterToTrackID
TrackIDs ClusteringValidation::ClusterCounter::GetListOfTrackIDs ( )

Definition at line 145 of file ClusteringValidation_module.cc.

145 { TrackIDs v; for (std::map<TrackID,ClusterIDs>::iterator i = trackToClusterIDs.begin(); i != trackToClusterIDs.end(); i++) v.push_back(i->first); return v; }
intermediate_table::iterator iterator
std::vector< TrackID > TrackIDs
std::map< TrackID, ClusterIDs > trackToClusterIDs
int ClusteringValidation::ClusterCounter::GetNumberHitsFromTrack ( TrackID  id)

Definition at line 137 of file ClusteringValidation_module.cc.

137 { return numHitsPreClustering[trackID]; }
int ClusteringValidation::ClusterCounter::GetNumberHitsInCluster ( ClusterID  id)

Definition at line 139 of file ClusteringValidation_module.cc.

139 { return numSignalHitsPostClustering[clusID] + numNoiseHitsPostClustering[clusID]; }
std::map< ClusterID, int > numSignalHitsPostClustering
int ClusteringValidation::ClusterCounter::GetNumberHitsInPlane ( )

Definition at line 141 of file ClusteringValidation_module.cc.

141 { int nHits = 0; for (auto &trackHits : numHitsPreClustering) nHits += trackHits.second; return nHits; }
std::vector< std::pair< TrackID, ClusterIDs > > ClusteringValidation::ClusterCounter::GetPhotons ( )

Definition at line 147 of file ClusteringValidation_module.cc.

References track.

147  {
148  std::vector<std::pair<TrackID,ClusterIDs> > photonVector;
149  for (unsigned int track = 0; track < GetListOfTrackIDs().size(); ++track)
151  photonVector.push_back(std::pair<TrackID,ClusterIDs>(GetListOfTrackIDs().at(track),trackToClusterIDs.at(GetListOfTrackIDs().at(track))));
152  return photonVector;
153 }
const simb::MCParticle * TrackIdToParticle_P(int const &id)
int PdgCode() const
Definition: MCParticle.h:216
std::map< TrackID, ClusterIDs > trackToClusterIDs
Float_t track
Definition: plot.C:34
art::ServiceHandle< cheat::ParticleInventoryService > pi_serv
TrackID ClusteringValidation::ClusterCounter::GetTrack ( ClusterID  id)

Definition at line 155 of file ClusteringValidation_module.cc.

155 { return clusterToTrackID.at(id); }
std::map< ClusterID, TrackID > clusterToTrackID
bool ClusteringValidation::ClusterCounter::IsNoise ( ClusterID  id)

Definition at line 157 of file ClusteringValidation_module.cc.

157 { return IsNoise(clusterToTrackID.at(clusID)); }
std::map< ClusterID, TrackID > clusterToTrackID
bool ClusteringValidation::ClusterCounter::IsNoise ( TrackID  id)

Definition at line 159 of file ClusteringValidation_module.cc.

159 { return (int)trackID == 0 ? true : false; }
bool ClusteringValidation::ClusterCounter::PassesCut ( )

Definition at line 161 of file ClusteringValidation_module.cc.

161  {
162  if (GetPhotons().size() > 2 || GetPhotons().size() == 0) return false;
163  TrackIDs goodPhotons;
164  for (unsigned int photon = 0; photon < GetPhotons().size(); ++photon)
165  for (unsigned int cluster = 0; cluster < GetPhotons().at(photon).second.size(); ++cluster)
166  if (GetCompleteness(GetPhotons().at(photon).second.at(cluster)) > 0.5) goodPhotons.push_back(GetPhotons().at(photon).first);
167  if ( (GetPhotons().size() == 2 && goodPhotons.size() > 2) || (GetPhotons().size() == 1 && goodPhotons.size() > 1) ) std::cout << "More than 2 with >50%?!" << std::endl;
168  bool pass = ( (GetPhotons().size() == 2 && goodPhotons.size() == 2) || (GetPhotons().size() == 1 && goodPhotons.size() == 1) );
169  return pass;
170 }
std::vector< TrackID > TrackIDs
Cluster finding and building.
std::vector< std::pair< TrackID, ClusterIDs > > GetPhotons()

Member Data Documentation

art::ServiceHandle<cheat::BackTrackerService> ClusteringValidation::ClusterCounter::bt_serv
private

Definition at line 113 of file ClusteringValidation_module.cc.

std::map<ClusterID,TrackID> ClusteringValidation::ClusterCounter::clusterToTrackID
private

Definition at line 107 of file ClusteringValidation_module.cc.

art::ServiceHandle<geo::Geometry> ClusteringValidation::ClusterCounter::geometry
private

Definition at line 112 of file ClusteringValidation_module.cc.

std::map<TrackID,int> ClusteringValidation::ClusterCounter::numHitsPreClustering
private

Definition at line 104 of file ClusteringValidation_module.cc.

std::map<ClusterID,int> ClusteringValidation::ClusterCounter::numNoiseHitsPostClustering
private

Definition at line 106 of file ClusteringValidation_module.cc.

std::map<ClusterID,int> ClusteringValidation::ClusterCounter::numSignalHitsPostClustering
private

Definition at line 105 of file ClusteringValidation_module.cc.

std::map<TrackID,std::map<std::string,double> > ClusteringValidation::ClusterCounter::particleProperties
private

Definition at line 109 of file ClusteringValidation_module.cc.

art::ServiceHandle<cheat::ParticleInventoryService> ClusteringValidation::ClusterCounter::pi_serv
private

Definition at line 114 of file ClusteringValidation_module.cc.

unsigned int ClusteringValidation::ClusterCounter::plane
private

Definition at line 102 of file ClusteringValidation_module.cc.

unsigned int ClusteringValidation::ClusterCounter::tpc
private

Definition at line 102 of file ClusteringValidation_module.cc.

std::map<TrackID,ClusterIDs> ClusteringValidation::ClusterCounter::trackToClusterIDs
private

Definition at line 108 of file ClusteringValidation_module.cc.

std::map<TrackID,simb::MCParticle> ClusteringValidation::ClusterCounter::trueParticles
private

Definition at line 110 of file ClusteringValidation_module.cc.


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