Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

sim::PartToHitTable Class Reference

#include <PartToHitTable.h>

List of all members.

Public Types

typedef std::vector< const
FLSHit * > 
HitList

Public Member Functions

 PartToHitTable (const ParticleList &plist, const FLSHitList &hitlist)
const HitListoperator[] (unsigned int i) const

Private Attributes

std::vector< HitListfHitLists
 Table of hits by particle index.


Detailed Description

Build a table which connects a particle to the MC hits it produced

Definition at line 20 of file PartToHitTable.h.


Member Typedef Documentation

typedef std::vector<const FLSHit*> sim::PartToHitTable::HitList
 

Definition at line 25 of file PartToHitTable.h.


Constructor & Destructor Documentation

PartToHitTable::PartToHitTable const ParticleList plist,
const FLSHitList hitlist
 

Definition at line 8 of file PartToHitTable.cxx.

References fHitLists, sim::FLSHitList::fHits, and sim::ParticleList::fParticles.

00009                                                           :
00010   fHitLists(plist.fParticles.size())
00011 {
00012   unsigned register int i;
00013   //
00014   // The sizes can be large, so try to do this as efficiently as
00015   // possible. The following makes only two passes over the lists
00016   //
00017   // First build a look up table to map trackIds to an index inside
00018   // the particle list
00019   std::map<int,int> trk2indx;
00020   for (i=0; i<plist.fParticles.size(); ++i) {
00021     trk2indx[plist.fParticles[i].fTrackId] = i;
00022   }
00023   
00024   // Now, use that map to build the lists
00025   for (i=0; i<hitlist.fHits.size(); ++i) {
00026     int indx = trk2indx[hitlist.fHits[i].fTrackId];
00027     fHitLists[indx].push_back(&hitlist.fHits[i]);
00028   }
00029 }
  


Member Function Documentation

const PartToHitTable::HitList & PartToHitTable::operator[] unsigned int  i  )  const
 

Return the vector of hits for the particle who's index is i

Parameters:
i : Index of particle in orignial ParticleList
Exceptions:
: Assert that the index i is in range

Definition at line 41 of file PartToHitTable.cxx.

References fHitLists.

00042 {
00043   assert(i<fHitLists.size());
00044   return fHitLists[i];
00045 }


Member Data Documentation

std::vector<HitList> sim::PartToHitTable::fHitLists [private]
 

Table of hits by particle index.

Definition at line 30 of file PartToHitTable.h.

Referenced by operator[](), and PartToHitTable().


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 04:45:34 2009 for NOvA Offline by  doxygen 1.3.9.1