LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ClusteringValidation::ClusterCounter Class Reference

Public Member Functions

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

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::Geometry const > geometry
 
art::ServiceHandle< cheat::BackTrackerService const > bt_serv
 
art::ServiceHandle< cheat::ParticleInventoryServicepi_serv
 

Detailed Description

Definition at line 62 of file ClusteringValidation_module.cc.

Member Function Documentation

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

Definition at line 96 of file ClusteringValidation_module.cc.

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

Definition at line 106 of file ClusteringValidation_module.cc.

107 {
108  ++numNoiseHitsPostClustering[clusID];
109 }
std::map< ClusterID, int > numNoiseHitsPostClustering
void ClusteringValidation::ClusterCounter::AddSignalHitPostClustering ( ClusterID  id)

Definition at line 101 of file ClusteringValidation_module.cc.

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

Definition at line 111 of file ClusteringValidation_module.cc.

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

Definition at line 124 of file ClusteringValidation_module.cc.

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

Definition at line 118 of file ClusteringValidation_module.cc.

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

Definition at line 129 of file ClusteringValidation_module.cc.

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

Definition at line 152 of file ClusteringValidation_module.cc.

153 {
154  ClusterIDs v;
156  i != clusterToTrackID.end();
157  i++)
158  v.push_back(i->first);
159  return v;
160 }
intermediate_table::iterator iterator
std::vector< ClusterID > ClusterIDs
std::map< ClusterID, TrackID > clusterToTrackID
TrackIDs ClusteringValidation::ClusterCounter::GetListOfTrackIDs ( )

Definition at line 162 of file ClusteringValidation_module.cc.

163 {
164  TrackIDs v;
166  i != trackToClusterIDs.end();
167  i++)
168  v.push_back(i->first);
169  return v;
170 }
intermediate_table::iterator iterator
std::vector< TrackID > TrackIDs
std::map< TrackID, ClusterIDs > trackToClusterIDs
int ClusteringValidation::ClusterCounter::GetNumberHitsFromTrack ( TrackID  id)

Definition at line 134 of file ClusteringValidation_module.cc.

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

Definition at line 139 of file ClusteringValidation_module.cc.

140 {
142 }
std::map< ClusterID, int > numNoiseHitsPostClustering
std::map< ClusterID, int > numSignalHitsPostClustering
int ClusteringValidation::ClusterCounter::GetNumberHitsInPlane ( )

Definition at line 144 of file ClusteringValidation_module.cc.

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

Definition at line 172 of file ClusteringValidation_module.cc.

References track.

173 {
174  std::vector<std::pair<TrackID, ClusterIDs>> photonVector;
175  for (unsigned int track = 0; track < GetListOfTrackIDs().size(); ++track)
176  if (!IsNoise(GetListOfTrackIDs().at(track)) &&
178  photonVector.push_back(std::pair<TrackID, ClusterIDs>(
180  return photonVector;
181 }
int PdgCode() const
Definition: MCParticle.h:213
const simb::MCParticle * TrackIdToParticle_P(int id) const
std::map< TrackID, ClusterIDs > trackToClusterIDs
Float_t track
Definition: plot.C:35
art::ServiceHandle< cheat::ParticleInventoryService > pi_serv
TrackID ClusteringValidation::ClusterCounter::GetTrack ( ClusterID  id)

Definition at line 183 of file ClusteringValidation_module.cc.

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

Definition at line 188 of file ClusteringValidation_module.cc.

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

Definition at line 193 of file ClusteringValidation_module.cc.

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

Definition at line 198 of file ClusteringValidation_module.cc.

References util::size().

199 {
200  if (GetPhotons().size() > 2 || GetPhotons().size() == 0) return false;
201  TrackIDs goodPhotons;
202  for (unsigned int photon = 0; photon < GetPhotons().size(); ++photon)
203  for (unsigned int cluster = 0; cluster < GetPhotons().at(photon).second.size(); ++cluster)
204  if (GetCompleteness(GetPhotons().at(photon).second.at(cluster)) > 0.5)
205  goodPhotons.push_back(GetPhotons().at(photon).first);
206  if ((GetPhotons().size() == 2 && goodPhotons.size() > 2) ||
207  (GetPhotons().size() == 1 && goodPhotons.size() > 1))
208  std::cout << "More than 2 with >50%?!" << std::endl;
209  bool pass = ((GetPhotons().size() == 2 && goodPhotons.size() == 2) ||
210  (GetPhotons().size() == 1 && goodPhotons.size() == 1));
211  return pass;
212 }
std::vector< TrackID > TrackIDs
Cluster finding and building.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
std::vector< std::pair< TrackID, ClusterIDs > > GetPhotons()
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82

Member Data Documentation

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

Definition at line 92 of file ClusteringValidation_module.cc.

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

Definition at line 86 of file ClusteringValidation_module.cc.

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

Definition at line 91 of file ClusteringValidation_module.cc.

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

Definition at line 83 of file ClusteringValidation_module.cc.

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

Definition at line 85 of file ClusteringValidation_module.cc.

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

Definition at line 84 of file ClusteringValidation_module.cc.

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

Definition at line 88 of file ClusteringValidation_module.cc.

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

Definition at line 93 of file ClusteringValidation_module.cc.

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

Definition at line 87 of file ClusteringValidation_module.cc.

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

Definition at line 89 of file ClusteringValidation_module.cc.


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