The purpose of this package is to allow the user to easily access mc truth information and compare it to their reconstructed quantities. This package contains both MCCheater and BackTracker modules. We are moving towards using BackTracker methods so that is what I will focus on here.
To run the cheater job, do:
nova -c job/cheaterrecojob.fcl -s sourcefile.root
The important output is generally named cheater_hist.root. This contains the histograms of efficiency and purity created by the module.
To alter the options, work with RecoCheckAna.fcl. For whatever reco objects you would want to check the efficiency and purity of, change the appropriate ModuleLabel. For example, to check the tracks created by Kalman Tracker, I change the TrackModuleLabel to read "kalmantrack". One can change the Check options as appropriate - if you are only interested in checking the Kalman Tracks, you can turn off the CheckClusters and CheckShowers. CheckMuons is described below. LinkByMaxEff set to true means that one finds the mc particle with the max efficiency for a reco object and plots the corresponding efficiency and purity. If you set it to false, it instead finds the mc particle with the max purity and plots the corresponding efficiency and purity.
Efficiency, Purity, and CheckMuons¶
Efficiency is defined for a reco object (track, shower, ect.) Given the reco object, each hit of the reco object is tested to see if it corresponds to a particular mc particle. The total number of hits within the reco object that correspond to the particle is recorded. Then, for all the hits in the event, each hit is tested to see if it corresponds to the mc particle. This number is summed. Efficiency is the division of these two numbers. A loop over all the mc particles is created and efficiency for each reco object is found for each mc particle.
Efficiency DOES have an energy cut - it is default set to 10%. That is, if the fraction of energy contributed to the hit by the mc particle is less than 10%, it doesn't count as desired. To change this, (NOTE: this could change in the future) alter the value of fMinContribFrac, which is defined in BackTracker.cxx. It currently lives on line 39.
Purity is found as follows. Each hit of the reco object is tested to see if it corresponds to a particular mc particle. The total number that match is divided by the total number of hits in the reco object. A loop over all the mc particles is created and purity for each reco object is found for each mc particle.
CheckMuons is a slightly different algorithm. It first find just the muon mc particles. For each muon, it finds the 3D track with the highest efficiency. Then it plots the efficiency and purity of this track. However, if you switch LinkByMaxEff to false, it will find the 3D track with the highest purity and plot the efficiency and purity of that track.
- FLS Hit: A mc particle leaves fls hits. These are before raw digits or cell hits are made. There can be multiple fls hits left by a particle in the same cell.
- sim::Particle: This is a mc particle and it contains all the information about the particle that you might want, like PDG code and initial energy.
- trackID: There is a unique trackID for each mc particle in the event. This number is often used to reference who depositied the FLS hit, which particle links to which FLS hits, ect.
- trackIDE: structure in BackTracker that relates trackID, fraction of energy deposited in cell/plane pair, and total energy deposited by that trackID in the plane/cell pair.
BackTracker contains (hopefully) all the functions that one would desire to get truth information comparisons with their objects.
- CellToPhotonSignal: given a plane/cell pair, returns a vector of all the photon signals which occured in that plane and cell. Note - since this isn't correlated with a hit, it gives all the hits in the plane/cell pair for any time in the event.
- CellToFLSHit: given a plane/cell pair, returns a vector of all the FLSHits which occured in that plane and cell. Note - since this isn't correlated with a hit, it gives all the hits in the plane/cell pair for any time in the event.
- CellToTrackID: given a plane/cell pair, returns a vector of trackIDE structures. TrackIDE structures contain the trackID, the energy fraction that the trackID deposited in the plane/cell pair compared to the total energy deposited in the plane/cell pair, and lastly, the energy deposited. Note: this includes all the FLSHits created in the cell without looking at their time. Thus, the true energy fraction of your cell hit might not match the energy fraction calculated in this method.
- CellToParticle: given a plane/cell pair, returns a vector of sim::Particles that leave FLS Hits in that location. sim::Particles are mc particles and contain all the information about the particle that you might want, like PDG code and initial energy.
- HitToFLSHit: input is a cell hit. First this function populates a map of track ID's and number of photons contributed to the cell hit. The photons are checked to make sure they are sufficiently "in time" with the hit. This map is sorted to make the largest contributors first. Then the FLS hits for this plane/cell are found. All the FLS hits which have matching track ID's to the retained, in-time photon signals are returned in a vector.
- EnergyFromTrackId: given a cell hit, function finds all the FLS hits for that plane/cell. Of the FLS hits that match the given track ID, their deposited energy is summed and returned.
- HitToParticle: given a cell hit, returns the particle who left the most energy in that cell hit. This is correctly associated in time; however, this doesn't allow one to know any other particles that might have also contributed to that cell hit.
- TrackIDToParticle: given a track ID, returns the particle.
- HitsToParticle: given a collection of cell hits, first populates map of track IDs and photons contributed in time to the cell hits. The map is then sorted from most contributed photons to least. If the track ID matches a particle (and they should), the particles are returned in a vector. This vector will also be sorted from largest contribution to least.
- HitsToTrackIDE: function is given collection of cell hits. Looping over each hit, the FLS hits are obtained and a map is populated of track ID's and total amount of energy deposited. If the total energy is greater than 1e-5, makes a trackIDE structure with the track ID's, total energy deposited by each ID, and the fraction of the total deposited energy for each ID.
- HitToTrackIDE: same as above function, but allows user to simply feed the function one hit instead of a collection of hits.
- CellToXYZ: Looping over all the FLS hits for a plane/cell pair, finds the midpoint of the FLS hit step, and weights that (x,y,z) location by the energy deposited. After taking the weighted average of all the FLS hits, returns the location as a vector of doubles.
- HitToXYZ: Given a cell hit, loops over all the associated FLS hits and weights the average location by energy, as done in CellToXYZ.
- HitCollectionPurity: given a track ID and a collection of hits, loops over each hit. For each hit, gets the vector of trackIDE's. Of these, loop through to see if any track ID's match the given track ID. If so, count the hit as desired. Return purity, which is the total number of desired hits divided by the total number of hits in the collection of hits.
- HitCollectionEfficiency: given track ID's, a collection of hits, a collection of all the hits, and a view, loops over the first collection of hits. For each hit, gets the corresponding trackIDEs and loops over to determine if any of the trackIDs match the given track ID's. If any do and the energyFrac from the trackIDE is greater than fMinContribFrac, count hit as desired. Then loop over the collection of all the hits. Again find how many match the given track ID's and pass the fMinContribFrac cut. For this, get a total number. Return the number of desired hits by the number of total hits.
- CloseInTime: given a cell hit and a photon signal, determines if they are close in time. This is done by using the two constants, kWindowNs (default 1000) and kOffsetNs (default 350). The first is how "close" in time the two signals should be to be considered related; the second is the estimated offset in time of the two time scales. The function returns true if the absolute value of the difference in time between the cell hit and photon plus the kOffsetNS is less than kWindowNs.
- AccumulateHitContributions: given a cell hit and a map of track IDs and number of photons, first this function gets all the photon signals corresponding to the cell and plane of the cell hit. Then for each photon, checks if it is CloseInTime. If it is, fill map with track ID and number of photons in the photon signal.