Print

Print


Commit in lcsim/src/org/lcsim on MAIN
recon/util/McTruthLinker.java+10-171.7 -> 1.8
          /RemoveUnusedMcParticles.java+1-11.2 -> 1.3
util/MergeEventTools.java+24-31.1 -> 1.2
    /RemoveCollectionDriver.java+3-11.1 -> 1.2
+38-22
4 modified files
Added additional checks to also allow input generated by Mokka

lcsim/src/org/lcsim/recon/util
McTruthLinker.java 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- McTruthLinker.java	8 Mar 2013 16:10:44 -0000	1.7
+++ McTruthLinker.java	23 Jan 2014 15:50:11 -0000	1.8
@@ -282,9 +282,9 @@
 	 * Creates a list of skimmed mc particles which are kept together with all
 	 * their ancestors. First of all, all the particles that are created by the
 	 * generator (IntermediateState, Documentation or FinalState) are kept. In
-	 * addition bremsstrahlung photons created by these particles are kept.
-	 * Finally all the particles from a given list (default: gamma, pi0, K0s)
-	 * are kept together with their direct daughters.
+	 * addition all direct daughters created by these particles which are above
+	 * the minimum energy are kept. Finally all the particles from a given list
+	 * (default: gamma, pi0, K0s) are kept together with their direct daughters.
 	 */
 	protected List<MCParticle> createSkimmedMcParticleList(List<MCParticle> mcParticles) {
 
@@ -295,28 +295,21 @@
 			if (mcParticle.getGeneratorStatus() == MCParticle.INTERMEDIATE) {
 				// first add all intermediate particles
 				addMcParticleWithParents(mcParticle, skimmedMcParticles);
-			}
-			if (mcParticle.getGeneratorStatus() == MCParticle.DOCUMENTATION) {
+			} else if (mcParticle.getGeneratorStatus() == MCParticle.DOCUMENTATION) {
 				// add all documentation particles.
 				addMcParticleWithParents(mcParticle, skimmedMcParticles);
-			}
-			if (mcParticle.getGeneratorStatus() > 3) {
+			} else if (mcParticle.getGeneratorStatus() > 3) {
 				// add all particles with unknown generator status.
 				// Mokka adds 100 to the generator status of particles that
 				// should not be passed through simulation.
 				addMcParticleWithParents(mcParticle, skimmedMcParticles);
-			}
-			if (mcParticle.getGeneratorStatus() == MCParticle.FINAL_STATE) {
+			} else if (mcParticle.getGeneratorStatus() == MCParticle.FINAL_STATE) {
 				// add all mc particles created by the generator
 				addMcParticleWithParents(mcParticle, skimmedMcParticles);
-				// check if there is some interaction in the tracking region
-				if (simStatus.isDecayedInCalorimeter()) {
-					// keep bremsstrahlung
-					for (MCParticle daughter : mcParticle.getDaughters()) {
-						if (daughter.getPDGID() == 22 && daughter.getEnergy() > daughterEnergyCut
-								&& !daughter.getSimulatorStatus().isBackscatter()) {
-							addMcParticleWithParents(daughter, skimmedMcParticles);
-						}
+				// keep all daugthers over the minimum energy
+				for (MCParticle daughter : mcParticle.getDaughters()) {
+					if (daughter.getEnergy() > daughterEnergyCut && !daughter.getSimulatorStatus().isBackscatter()) {
+						addMcParticleWithParents(daughter, skimmedMcParticles);
 					}
 				}
 				//

lcsim/src/org/lcsim/recon/util
RemoveUnusedMcParticles.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- RemoveUnusedMcParticles.java	20 Aug 2012 09:40:44 -0000	1.2
+++ RemoveUnusedMcParticles.java	23 Jan 2014 15:50:11 -0000	1.3
@@ -125,7 +125,7 @@
 	 */
 	public static void addMcParticleWithParents(MCParticle mcp,
 			List<MCParticle> mcpList, boolean keepAncestors) {
-		if (!mcpList.contains(mcp)) {
+		if (mcp != null && !mcpList.contains(mcp)) {
 			mcpList.add(mcp);
 			List<MCParticle> parents = mcp.getParents();
 			if (keepAncestors) {

lcsim/src/org/lcsim/util
MergeEventTools.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- MergeEventTools.java	17 Aug 2012 12:02:13 -0000	1.1
+++ MergeEventTools.java	23 Jan 2014 15:50:11 -0000	1.2
@@ -69,9 +69,14 @@
 				continue;
 			}
 			Class collectionType = mergeMetaData.getType();
+			// if the collection does not exist in the event, simply copy it from the mergeEvent
 			if (mergeEvent.get(collectionType, collectionName).isEmpty()) {
 				continue;
 			}
+			if (!event.hasItem(collectionName)) {
+				event.put(collectionName, new ArrayList(), collectionType, mergeMetaData.getFlags());
+				continue;
+			}
 			LCMetaData metaData = event.getMetaData((List) event.get(collectionName));
 			if (collectionType.isAssignableFrom(MCParticle.class)) {
 				mergeMCParticleCollections(metaData, mergeMetaData, mcParticleMap);
@@ -177,7 +182,7 @@
 	 * @return the copied MCParticle
 	 */
 	static public MCParticle getMcParticleCopy(MCParticle mcParticle, Map<MCParticle, MCParticle> mcParticleMap) {
-		if (!mcParticleMap.containsKey(mcParticle)) {
+		if (mcParticle != null && !mcParticleMap.containsKey(mcParticle)) {
 			MCParticle mcParticleCopy = copyMcParticle(mcParticle);
 			mcParticleMap.put(mcParticle, mcParticleCopy);
 			for (MCParticle parent : mcParticle.getParents()) {
@@ -210,7 +215,13 @@
     	double time = hit.getTime();
     	int cellID = hit.getCellID();
     	MCParticle mcParticle = getMcParticleCopy(hit.getMCParticle(), mcParticleMap);
-    	IDetectorElement de = hit.getDetectorElement();
+    	IDetectorElement de = null;
+    	// safeguard for Mokka input
+    	try {
+    		de = hit.getDetectorElement();
+    	} catch (NullPointerException e) {
+    		
+    	}
     	
 		return new BaseSimTrackerHit(position, dEdx, momentum, pathLength, time, cellID, mcParticle, metaData, de);
 	}
@@ -251,6 +262,11 @@
 		BaseSimCalorimeterHit copyHit = new BaseSimCalorimeterHit(id, rawEnergy, time, mcparts, energies, times, pdgs, steps);
 		//copyHit.setDetectorElement(hit.getDetectorElement());
 		copyHit.setMetaData(metaData);
+		try {
+			copyHit.setPosition(hit.getPosition());
+		} catch (Exception e) {
+			
+		}
 		
 		return copyHit;
 	}
@@ -301,10 +317,15 @@
 			rawEnergy += eneList[j];
 		}
 		// need to set time to 0 so it is recalculated from the timeList
-		SimCalorimeterHit mergedHit = new BaseSimCalorimeterHit(hit.getCellID(),
+		BaseSimCalorimeterHit mergedHit = new BaseSimCalorimeterHit(hit.getCellID(),
 				rawEnergy, 0., mcpList, eneList, timeList, pdgList, steps);
 		//mergedHit.setDetectorElement(oldHit.getDetectorElement());
 		mergedHit.setMetaData(metaData);
+		try {
+			mergedHit.setPosition(hit.getPosition());
+		} catch (Exception e) {
+			
+		}
 		return mergedHit;
 	}
 	

lcsim/src/org/lcsim/util
RemoveCollectionDriver.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- RemoveCollectionDriver.java	11 Oct 2012 13:17:30 -0000	1.1
+++ RemoveCollectionDriver.java	23 Jan 2014 15:50:11 -0000	1.2
@@ -29,7 +29,9 @@
 	@Override
 	protected void process(EventHeader event) {
 		for (String collectionName : collectionNames) {
-			event.remove(collectionName);
+			if (event.hasItem(collectionName)) {
+				event.remove(collectionName);
+			}
 		}
 	}
 
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1