Commit in lcsim/src/org/lcsim/recon/util on MAIN
McTruthLinker.java+26-141.1 -> 1.2
Set the weighted lcio flag for all LCRelation collections

lcsim/src/org/lcsim/recon/util
McTruthLinker.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- McTruthLinker.java	13 Apr 2011 17:35:41 -0000	1.1
+++ McTruthLinker.java	14 Apr 2011 05:15:16 -0000	1.2
@@ -66,11 +66,16 @@
  * 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.
+ * 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. 
+ * skimmed mc particle collection to an empty String.
+ * <p>
+ * Do not forget to make the skimmed mc particle collection a subset, if an
+ * output file is created and the original MCParticle collection should be
+ * kept as well.
  * 
  * @author <a href="mailto:[log in to unmask]">Christian Grefe</a>
  */
@@ -79,7 +84,7 @@
 	protected String trackHitMcRelationName = "HelicalTrackMCRelations";
 	protected String trackCollectionName = EventHeader.TRACKS;
 	protected String trackMcRelationName = "TrackMCTruthLink";
-	protected String caloHitsimHitRelationName = "CalorimeterHitRelations";
+	protected String caloHitSimHitRelationName = "CalorimeterHitRelations";
 	protected String clusterCollectionName = "ReconClusters";
 	protected String clusterMcRelationName = "ClusterMCTruthLink";
 	protected String pfoCollectionName = "PandoraPFOCollection";
@@ -132,7 +137,6 @@
 				mcParticlesSkimmed = createSkimmedMcParticleList(mcParticles);
 				mcParticleToSkimmed = fillMcParticleToSkimmedMap(mcParticles, mcParticlesSkimmed);
 				int flags = event.getMetaData(mcParticles).getFlags();
-				flags = LCIOUtil.bitSet(flags, LCIOConstants.BITSubset, true);
 				event.put(mcParticlesSkimmedName, mcParticlesSkimmed, MCParticle.class, flags);
 				print(HLEVEL_NORMAL, "Added skimmed mc particles \""+mcParticlesSkimmedName+"\" to the event.");
 			} catch (IllegalArgumentException e) {
@@ -150,7 +154,9 @@
 				List<LCRelation> trackHitMcRelation = event.get(LCRelation.class, trackHitMcRelationName);
 				trackMcRelation = createTrackMcRelation(tracks, trackHitMcRelation);
 				if (!trackMcRelationName.equals("")) {
-					event.put(trackMcRelationName, trackMcRelation, LCRelation.class, 0);
+					int flags = 0;
+					flags = LCIOUtil.bitSet(flags, LCIOConstants.LCREL_WEIGHTED, true);
+					event.put(trackMcRelationName, trackMcRelation, LCRelation.class, flags);
 					print(HLEVEL_NORMAL, "Added track to mc particle relations \""+trackMcRelationName+"\" to the event.");
 				}
 			} catch (IllegalArgumentException e) {
@@ -162,9 +168,9 @@
 		}
 		
 		// calorimeter hit to mc particle relation
-		if (!caloHitsimHitRelationName.equals("")) { 
+		if (!caloHitSimHitRelationName.equals("")) { 
 			try {
-				caloHitMcRelation = createCaloHitMcRelation(event.get(LCRelation.class, caloHitsimHitRelationName));
+				caloHitMcRelation = createCaloHitMcRelation(event.get(LCRelation.class, caloHitSimHitRelationName));
 			} catch (IllegalArgumentException e) {
 				print(HLEVEL_DEFAULT,
 						"WARNING: no calorimeter hit to mc particle relation created.\n" +
@@ -179,7 +185,9 @@
 				List<Cluster> clusters = event.get(Cluster.class, clusterCollectionName);
 				clusterMcRelation = createClusterMcRelation(clusters, caloHitMcRelation);
 				if (!clusterMcRelationName.equals("")) {
-					event.put(clusterMcRelationName, clusterMcRelation, LCRelation.class, 0);
+					int flags = 0;
+					flags = LCIOUtil.bitSet(flags, LCIOConstants.LCREL_WEIGHTED, true);
+					event.put(clusterMcRelationName, clusterMcRelation, LCRelation.class, flags);
 					print(HLEVEL_NORMAL, "Added cluster to mc particle relations \""+clusterMcRelationName+"\" to the event.");
 				}
 			} catch (IllegalArgumentException e) {
@@ -196,7 +204,9 @@
 				List<ReconstructedParticle> PFOs = event.get(ReconstructedParticle.class, pfoCollectionName);
 				pfoMcRelation = createPfoMcRelation(PFOs, trackMcRelation, clusterMcRelation);
 				if (!pfoMcRelationName.equals("")) {
-					event.put(pfoMcRelationName, pfoMcRelation, LCRelation.class, 0);
+					int flags = 0;
+					flags = LCIOUtil.bitSet(flags, LCIOConstants.LCREL_WEIGHTED, true);
+					event.put(pfoMcRelationName, pfoMcRelation, LCRelation.class, flags);
 					print(HLEVEL_NORMAL, "Added PFO to mc particle relations \""+pfoMcRelationName+"\" to the event.");
 				}
 			} catch (IllegalArgumentException e) {
@@ -242,8 +252,8 @@
 		this.trackMcRelationName = trackMcRelationName;
 	}
 	
-	public void setCaloHitsimHitRelationName(String caloHitsimHitRelationName) {
-		this.caloHitsimHitRelationName = caloHitsimHitRelationName;
+	public void setCaloHitSimHitRelationName(String caloHitSimHitRelationName) {
+		this.caloHitSimHitRelationName = caloHitSimHitRelationName;
 	}
 	
 	public void setClusterCollectionName(String clusterCollectionName) {
@@ -270,9 +280,11 @@
 		this.mcParticlesSkimmedName = mcParticlesSkimmedName;
 	}
 	
-	public void setKeepDaughtersPDGID(Integer[] keepDaughtersPDGID) {
+	public void setKeepDaughtersPDGID(int[] keepDaughtersPDGID) {
 		this.keepDaughtersPDGID.clear();
-		this.keepDaughtersPDGID.addAll(Arrays.asList(keepDaughtersPDGID));
+		for (int pdgid : keepDaughtersPDGID) {
+			this.keepDaughtersPDGID.add(pdgid);
+		}
 	}
 	
 	public void setDaughterEnergyCut(double daughterEnergyCut) {
@@ -380,7 +392,7 @@
 	 * 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}-2*N_{match).
+	 * 1 - (N_{track}+N_{mc}-2*N_{match})/(N_{track}+N_{mc}-N_{match).
 	 * @param tracks The list of tracks to be truth linked
 	 * @param trackHitMcRelation The LCRelations between track hits and mc particles
 	 * @return The weighted LCRelations between tracks and mc particles
CVSspam 0.2.8