All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
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::MCParticle > 
trueParticles
 
art::ServiceHandle
< geo::Geometry const > 
geometry
 
art::ServiceHandle
< cheat::BackTrackerService
const > 
bt_serv
 
art::ServiceHandle
< cheat::ParticleInventoryService
pi_serv
 

Detailed Description

Definition at line 61 of file ClusteringValidation_module.cc.

Constructor & Destructor Documentation

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

Definition at line 99 of file ClusteringValidation_module.cc.

Member Function Documentation

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

Definition at line 106 of file ClusteringValidation_module.cc.

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

Definition at line 118 of file ClusteringValidation_module.cc.

119 {
120  ++numNoiseHitsPostClustering[clusID];
121 }
std::map< ClusterID, int > numNoiseHitsPostClustering
void ClusteringValidation::ClusterCounter::AddSignalHitPostClustering ( ClusterID  id)

Definition at line 112 of file ClusteringValidation_module.cc.

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

Definition at line 124 of file ClusteringValidation_module.cc.

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

Definition at line 138 of file ClusteringValidation_module.cc.

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

Definition at line 131 of file ClusteringValidation_module.cc.

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

Definition at line 144 of file ClusteringValidation_module.cc.

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

Definition at line 171 of file ClusteringValidation_module.cc.

172 {
173  ClusterIDs v;
174  for (std::map<ClusterID, TrackID>::iterator i = clusterToTrackID.begin();
175  i != clusterToTrackID.end();
176  i++)
177  v.push_back(i->first);
178  return v;
179 }
std::vector< ClusterID > ClusterIDs
std::map< ClusterID, TrackID > clusterToTrackID
TrackIDs ClusteringValidation::ClusterCounter::GetListOfTrackIDs ( )

Definition at line 182 of file ClusteringValidation_module.cc.

183 {
184  TrackIDs v;
185  for (std::map<TrackID, ClusterIDs>::iterator i = trackToClusterIDs.begin();
186  i != trackToClusterIDs.end();
187  i++)
188  v.push_back(i->first);
189  return v;
190 }
std::vector< TrackID > TrackIDs
std::map< TrackID, ClusterIDs > trackToClusterIDs
int ClusteringValidation::ClusterCounter::GetNumberHitsFromTrack ( TrackID  id)

Definition at line 150 of file ClusteringValidation_module.cc.

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

Definition at line 156 of file ClusteringValidation_module.cc.

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

Definition at line 162 of file ClusteringValidation_module.cc.

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

Definition at line 193 of file ClusteringValidation_module.cc.

194 {
195  std::vector<std::pair<TrackID, ClusterIDs>> photonVector;
196  for (unsigned int track = 0; track < GetListOfTrackIDs().size(); ++track)
197  if (!IsNoise(GetListOfTrackIDs().at(track)) &&
198  pi_serv->TrackIdToParticle_P((int)GetListOfTrackIDs().at(track))->PdgCode() == 22)
199  photonVector.push_back(std::pair<TrackID, ClusterIDs>(
201  return photonVector;
202 }
process_name use argoneut_mc_hitfinder track
std::map< TrackID, ClusterIDs > trackToClusterIDs
art::ServiceHandle< cheat::ParticleInventoryService > pi_serv
TrackID ClusteringValidation::ClusterCounter::GetTrack ( ClusterID  id)

Definition at line 205 of file ClusteringValidation_module.cc.

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

Definition at line 211 of file ClusteringValidation_module.cc.

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

Definition at line 217 of file ClusteringValidation_module.cc.

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

Definition at line 223 of file ClusteringValidation_module.cc.

224 {
225  if (GetPhotons().size() > 2 || GetPhotons().size() == 0) return false;
226  TrackIDs goodPhotons;
227  for (unsigned int photon = 0; photon < GetPhotons().size(); ++photon)
228  for (unsigned int cluster = 0; cluster < GetPhotons().at(photon).second.size(); ++cluster)
229  if (GetCompleteness(GetPhotons().at(photon).second.at(cluster)) > 0.5)
230  goodPhotons.push_back(GetPhotons().at(photon).first);
231  if ((GetPhotons().size() == 2 && goodPhotons.size() > 2) ||
232  (GetPhotons().size() == 1 && goodPhotons.size() > 1))
233  std::cout << "More than 2 with >50%?!" << std::endl;
234  bool pass = ((GetPhotons().size() == 2 && goodPhotons.size() == 2) ||
235  (GetPhotons().size() == 1 && goodPhotons.size() == 1));
236  return pass;
237 }
process_name can override from command line with o or output photon
Definition: runPID.fcl:28
process_name cluster
Definition: cheaterreco.fcl:51
std::vector< TrackID > TrackIDs
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
std::vector< std::pair< TrackID, ClusterIDs > > GetPhotons()
BEGIN_PROLOG could also be cout

Member Data Documentation

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

Definition at line 95 of file ClusteringValidation_module.cc.

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

Definition at line 89 of file ClusteringValidation_module.cc.

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

Definition at line 94 of file ClusteringValidation_module.cc.

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

Definition at line 86 of file ClusteringValidation_module.cc.

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

Definition at line 88 of file ClusteringValidation_module.cc.

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

Definition at line 87 of file ClusteringValidation_module.cc.

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

Definition at line 91 of file ClusteringValidation_module.cc.

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

Definition at line 96 of file ClusteringValidation_module.cc.

unsigned int ClusteringValidation::ClusterCounter::plane
private

Definition at line 84 of file ClusteringValidation_module.cc.

unsigned int ClusteringValidation::ClusterCounter::tpc
private

Definition at line 84 of file ClusteringValidation_module.cc.

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

Definition at line 90 of file ClusteringValidation_module.cc.

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

Definition at line 92 of file ClusteringValidation_module.cc.


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