public class McTruthLinker extends Driver
By default three LCRelations are created
The weights of these relations are based on fractions contributed by the mc particle. For the track relation it is based on the fraction of hits and for clusters it is based on the fraction of energy. Non-charged PFOs use the weight of the clusters, while charged PFOs use a combined weight of the tracks and the clusters, based on a global track to cluster weight. As a default only the track relations are used for charged PFOs.
Instead of the simple fraction-based weights described above a weight based on a Tanimoto metric can be used. Then also the hits produced by a mc particle which are not part of the reconstructed object are taken into account. This leads to a lower weight for missed hits.
For all objects, only the relation to the MCParticle which has the highest weight is kept. Setting the fullRecoRelation switch to true will keep all relations instead.
By default a reduced set of MCParticles is created. This skimmed list contains only those MCParticles created by the generator (intermediate and final state particles) and emitted bremsstrahlung photons. In addition all particles which are of a pre-defined set of particle types and which decay in flight in the tracking system and their intermediate daughters are kept. By default these particle types are gamma, pi0 and K0s. There is also an energy cut applied to which of these daughter particles are kept. All relations which would point to an MCParticle not contained in this reduced list point to their closest ancestor which is in this list instead. Again, this behavior can be switched off, by setting the name of the skimmed mc particle collection to an empty String.
Driver.AbortRunException, Driver.NextEventException
Modifier and Type | Field and Description |
---|---|
protected String |
caloHitSimHitRelationName |
protected String |
clusterCollectionName |
protected String |
clusterMcRelationName |
protected double |
daughterEnergyCut |
protected boolean |
fullRecoRelation |
protected List<Integer> |
keepDaughtersPDGID |
protected String |
mcParticleCollectionName |
protected List<MCParticle> |
mcParticlesSkimmed |
protected String |
mcParticlesSkimmedName |
protected Map<MCParticle,MCParticle> |
mcParticleToSkimmed |
protected double |
pfoClusterWeight |
protected String |
pfoCollectionName |
protected String |
pfoMcRelationName |
protected double |
pfoTrackWeight |
protected String |
trackCollectionName |
protected String |
trackHitMcRelationName |
protected String |
trackMcRelationName |
protected boolean |
useSkimmedMcParticles |
protected boolean |
useTanimotoDistance |
HLEVEL_DEFAULT, HLEVEL_FULL, HLEVEL_HIGH, HLEVEL_NORMAL, HLEVEL_OFF
Constructor and Description |
---|
McTruthLinker() |
Modifier and Type | Method and Description |
---|---|
protected void |
addMcParticleWithParents(MCParticle mcParticle,
List<MCParticle> mcParticles)
Adds an mc particle to a list of mc particles if it is not yet in the
list.
|
protected List<LCRelation> |
createCaloHitMcRelation(List<LCRelation> caloHitSimHitRelation)
Creates the relations from calorimeter hits to mc particles by using a
list of LCRelations from CalorimeterHits to SimCalorimeterHits and the
intrinsic link to mc particles of the sim hits.
|
protected List<LCRelation> |
createClusterMcRelation(List<Cluster> clusters,
List<LCRelation> caloHitMcRelation)
Creates the relations from Clusters to MCParticles by using a list of
LCRelations from CalorimeterHits to MCParticles.
|
protected List<LCRelation> |
createPfoMcRelation(List<ReconstructedParticle> recoParticles,
List<LCRelation> trackMcRelation,
List<LCRelation> clusterMcRelation)
Creates the relations from PFOs to MCParticles by using a list of
LCRelations from Tracks to MCParticles and a second list of LCRelations
from Clusters to MCParticles.
|
static <F,T> RelationalTable<F,T> |
createRelationalTable(List<LCRelation> relations)
Converts a List of LCRelations (one to one relations with weights) into a
RelationalTable (many to many relations with weights).
|
protected List<MCParticle> |
createSkimmedMcParticleList(List<MCParticle> mcParticles)
Creates a list of skimmed mc particles which are kept together with all
their ancestors.
|
protected List<LCRelation> |
createTrackMcRelation(List<Track> tracks,
List<LCRelation> trackHitMcRelation)
Creates the relations from tracks to mc particles by using a list of
LCRelations from hits to mc particles.
|
protected Map<MCParticle,MCParticle> |
fillMcParticleToSkimmedMap(List<MCParticle> mcParticles,
List<MCParticle> skimmedMcParticles)
Fills a map connecting an mc particle with its closest ancestor that is
present in the skimmed mc particle list.
|
protected MCParticle |
findMcParticleAncestor(MCParticle mcParticle,
List<MCParticle> mcParticles)
Finds the first ancestor of a given mc particle within a list of mc
particles.
|
protected void |
print(int histogramLevel,
String message)
Helper method to write a message to the output stream if the histogram
level set for the driver is equal or higher than the given value.
|
protected void |
print(int histogramLevel,
String message,
boolean error)
Helper method to write a message to the output stream if the histogram
level set for the driver is equal or higher than the given value.
|
protected void |
process(EventHeader event)
Called by the framework to process an event.
|
void |
setCaloHitSimHitRelationName(String caloHitSimHitRelationName) |
void |
setClusterCollectionName(String clusterCollectionName) |
void |
setClusterMcRelationName(String clusterMcRelationName) |
void |
setDaughterEnergyCut(double daughterEnergyCut) |
void |
setFullRecoRelation(boolean fullRecoRelation) |
void |
setKeepDaughtersPDGID(int[] keepDaughtersPDGID) |
void |
setMcParticleCollectionName(String mcParticleCollectionName) |
void |
setMcParticlesSkimmedName(String mcParticlesSkimmedName) |
void |
setPfoClusterWeight(double pfoClusterWeight) |
void |
setPfoCollectionName(String pfoCollectionName) |
void |
setPfoMcRelationName(String pfoMcRelationName) |
void |
setPfoTrackWeight(double pfoTrackWeight) |
void |
setTrackCollectionName(String trackCollectionName) |
void |
setTrackHitMcRelationName(String trackHitMcRelationName) |
void |
setTrackMcRelationName(String trackMcRelationName) |
void |
setUseTanimotoDistance(boolean useTanimotoDistance) |
static Map |
sortMapByHighestValue(Map map)
Creates a map with its keys sorted by its values in descending order from
an existing map.
|
protected void |
startOfData()
Called before the first event is processed, or after a rewind.
|
add, clearStatistics, contains, detectorChanged, drivers, endOfData, getConditionsManager, getHistogramLevel, getLogger, getName, getRandom, printStatistics, processChildren, remove, resume, setHistogramLevel, setLogLevel, setRandom, suspend
protected String trackHitMcRelationName
protected String trackCollectionName
protected String trackMcRelationName
protected String caloHitSimHitRelationName
protected String clusterCollectionName
protected String clusterMcRelationName
protected String pfoCollectionName
protected String pfoMcRelationName
protected String mcParticleCollectionName
protected String mcParticlesSkimmedName
protected double pfoTrackWeight
protected double pfoClusterWeight
protected boolean fullRecoRelation
protected boolean useTanimotoDistance
protected boolean useSkimmedMcParticles
protected List<MCParticle> mcParticlesSkimmed
protected Map<MCParticle,MCParticle> mcParticleToSkimmed
protected double daughterEnergyCut
protected void startOfData()
Driver
startOfData
in class Driver
protected void process(EventHeader event)
Driver
super.process(event)
to cause the child processes to be executed.
In addition the process event call can throw some special exceptions:
process
in class Driver
event
- The event to be processedDriver.NextEventException
,
Driver.AbortRunException
public void setFullRecoRelation(boolean fullRecoRelation)
public void setUseTanimotoDistance(boolean useTanimotoDistance)
public void setPfoTrackWeight(double pfoTrackWeight) throws IllegalArgumentException
IllegalArgumentException
public void setPfoClusterWeight(double pfoClusterWeight) throws IllegalArgumentException
IllegalArgumentException
public void setTrackHitMcRelationName(String trackHitMcRelationName)
public void setTrackCollectionName(String trackCollectionName)
public void setTrackMcRelationName(String trackMcRelationName)
public void setCaloHitSimHitRelationName(String caloHitSimHitRelationName)
public void setClusterCollectionName(String clusterCollectionName)
public void setClusterMcRelationName(String clusterMcRelationName)
public void setPfoCollectionName(String pfoCollectionName)
public void setPfoMcRelationName(String pfoMcRelationName)
public void setMcParticleCollectionName(String mcParticleCollectionName)
public void setMcParticlesSkimmedName(String mcParticlesSkimmedName)
public void setKeepDaughtersPDGID(int[] keepDaughtersPDGID)
public void setDaughterEnergyCut(double daughterEnergyCut)
protected List<MCParticle> createSkimmedMcParticleList(List<MCParticle> mcParticles)
protected Map<MCParticle,MCParticle> fillMcParticleToSkimmedMap(List<MCParticle> mcParticles, List<MCParticle> skimmedMcParticles)
mcParticles
- The list of all mc particlesskimmedMcParticles
- A subset of the mc particlesprotected List<LCRelation> createTrackMcRelation(List<Track> tracks, List<LCRelation> trackHitMcRelation)
The relations are weighted by the fraction of hits belonging to a certain mc particle (N_{match}/N_{track}).
In case of Tanimoto distance also the total number of hits produced by the mc particle are taken into account. It gives less weight to tracks that miss true hits. The weight is then calculated as 1 - (N_{track}+N_{mc}-2*N_{match})/(N_{track}+N_{mc}-N_{match).
tracks
- The list of tracks to be truth linkedtrackHitMcRelation
- The LCRelations between track hits and mc particlesprotected List<LCRelation> createCaloHitMcRelation(List<LCRelation> caloHitSimHitRelation)
The produced relations are weighted by the energy fraction contributed by the mc particle to the SimCalorimeterHit (E_{MC,Hit}/E_{Hit})
caloHitSimHitRelation
- The relations between CalorimeterHits and SimCalorimeterHitsprotected List<LCRelation> createClusterMcRelation(List<Cluster> clusters, List<LCRelation> caloHitMcRelation) throws IllegalArgumentException
The produced relations are weighted by the energy fraction contributed by the MCParticle to the Cluster (E_{MC,Cluster}/E_{Cluster})
clusters
- The list of clusters to be truth linkedcaloHitMcRelation
- The relations between CalorimeterHits and MCParticlesIllegalArgumentException
protected List<LCRelation> createPfoMcRelation(List<ReconstructedParticle> recoParticles, List<LCRelation> trackMcRelation, List<LCRelation> clusterMcRelation) throws IllegalArgumentException
In case of a non-charged PFO the relation is weighted using the weights from the contributing Cluster to MCParticle relations.
For charged PFOs the weight of the relations are calculated separately for tracks and clusters and then combined depending on a global track to cluster weight. By default the track weight is 1 and the cluster weight is 0. Thus, only the relation via track is taken into account.
recoParticles
- The list of PFOs to be truth linkedtrackMcRelation
- The relations between Tracks and MCParticlesclusterMcRelation
- The relations between Clusters and MCParticlesIllegalArgumentException
protected void print(int histogramLevel, String message)
histogramLevel
- The level at which the message is printedmessage
- The message, which will be printed to the streamprotected void print(int histogramLevel, String message, boolean error)
histogramLevel
- The level at which the message is printedmessage
- The message, which will be printed to the streamerror
- If true, writes to error stream instead of standardprotected void addMcParticleWithParents(MCParticle mcParticle, List<MCParticle> mcParticles)
mcParticle
- The mc particle to be added to the listmcParticles
- The list to add the mc particle toprotected MCParticle findMcParticleAncestor(MCParticle mcParticle, List<MCParticle> mcParticles)
mcParticle
- The mc particlemcParticles
- The list of mc particles containing possible ancestorspublic static <F,T> RelationalTable<F,T> createRelationalTable(List<LCRelation> relations)
relations
- A list of LCRelationsCopyright © 2016 Linear Collider Detector (LCD). All rights reserved.