Commit in lcsim/src/org/lcsim/util on MAIN | |||
OverlayDriver.java | +29 | -9 | 1.14 -> 1.15 |
Added treatment of calorimeter steps and improved randomization logic
diff -u -r1.14 -r1.15 --- OverlayDriver.java 19 Jul 2012 22:31:24 -0000 1.14 +++ OverlayDriver.java 20 Jul 2012 17:56:14 -0000 1.15 @@ -331,7 +331,9 @@
EventHeader overlayEvent = null; if (randomizeOverlay) {
- overlayEvent = skipEvents(overlayEvents, this.getRandom().nextInt((int)overlayEvents.getEstimatedSize()));
+ int maxNumber = (int) Math.abs(overlayWeight + 1); + int skipEvents = this.getRandom().nextInt(maxNumber) + 1; + overlayEvent = skipEvents(overlayEvents, skipEvents);
} else { overlayEvent = getNextEvent(overlayEvents); }
@@ -437,6 +439,7 @@
} else { event.put(collection.getName(), entries, collection.getType(), collection.getFlags()); }
+// ((BaseLCSimEvent) event).put(collection.getName(), entries, collection.getType(), collection.getFlags(), collection.getIntegerParameters(), collection.getFloatParameters(), collection.getStringParameters());
if (this.getHistogramLevel() > HLEVEL_NORMAL) System.out.println("Putting collection "+collection.getName()+" into event."); }
@@ -533,6 +536,7 @@
List<Float> eneList = new ArrayList<Float>(); List<Float> timeList = new ArrayList<Float>(); List<Integer> pdgList = new ArrayList<Integer>();
+ List<float[]> steps = new ArrayList<float[]>();
double rawEnergy = 0.; for (int i = 0; i != hit.getMCParticleCount(); i++) { float hitTime = (float) (hit.getContributedTime(i) + time);
@@ -543,7 +547,10 @@
mcList.add(hit.getMCParticle(i)); eneList.add(hitEnergy); timeList.add(hitTime);
- if (hasPDG) pdgList.add(hit.getPDG(i));
+ if (hasPDG) { + pdgList.add(hit.getPDG(i)); + steps.add(hit.getStepPosition(i)); + }
rawEnergy += hitEnergy; } int hitEntries = mcList.size();
@@ -557,11 +564,13 @@
mcArr[i] = mcList.get(i); eneArr[i] = eneList.get(i); timeArr[i] = timeList.get(i);
- if (hasPDG) pdgArr[i] = pdgList.get(i);
+ if (hasPDG) { + pdgArr[i] = pdgList.get(i); + }
} // need to set time to 0 so it is recalculated from the timeList movedHit = new BaseSimCalorimeterHit(hit.getCellID(),
- rawEnergy, 0., mcArr, eneArr, timeArr, pdgArr);
+ rawEnergy, 0., mcArr, eneArr, timeArr, pdgArr, steps);
//movedHit.setDetectorElement(hit.getDetectorElement()); movedHit.setMetaData(collection); } else {
@@ -699,6 +708,7 @@
float[] energies = new float[nMCP]; float[] times = new float[nMCP]; int[] pdgs = null;
+ List<float[]> steps = new ArrayList<float[]>();
if (hasPDG) pdgs = new int[nMCP]; // fill arrays with values from hit for (int i = 0; i != nMCP; i++) {
@@ -707,10 +717,13 @@
mcparts[i] = mcParticleReferences.get(hitMC); energies[i] = (float)hit.getContributedEnergy(i); times[i] = (float)hit.getContributedTime(i);
- if (hasPDG) pdgs[i] = hit.getPDG(i);
+ if (hasPDG){ + pdgs[i] = hit.getPDG(i); + steps.add(hit.getStepPosition(i)); + }
}
- BaseSimCalorimeterHit copyHit = new BaseSimCalorimeterHit(id, rawEnergy, time, mcparts, energies, times, pdgs);
+ BaseSimCalorimeterHit copyHit = new BaseSimCalorimeterHit(id, rawEnergy, time, mcparts, energies, times, pdgs, steps);
//copyHit.setDetectorElement(hit.getDetectorElement()); copyHit.setMetaData(meta);
@@ -796,13 +809,17 @@
float[] timeList = new float[nMcP]; int[] pdgList = null; if (hasPDG) pdgList = new int[nMcP];
+ List<float[]> steps = new ArrayList<float[]>();
double rawEnergy = 0.; // fill arrays with values from hit for (int i = 0; i != nHitMcP; i++) { mcpList[i] = oldHit.getMCParticle(i); eneList[i] = (float)oldHit.getContributedEnergy(i); timeList[i] = (float)oldHit.getContributedTime(i);
- if (hasPDG) pdgList[i] = oldHit.getPDG(i);
+ if (hasPDG) { + pdgList[i] = oldHit.getPDG(i); + steps.add(hit.getStepPosition(i)); + }
rawEnergy += eneList[i]; } // add values of overlay hit
@@ -815,12 +832,15 @@
mcpList[j] = mcParticleReferences.get(hitMC); eneList[j] = (float)hit.getContributedEnergy(i); timeList[j] = (float)hit.getContributedTime(i);
- if (hasPDG) pdgList[j] = hit.getPDG(i);
+ if (hasPDG) { + pdgList[j] = hit.getPDG(i); + steps.add(hit.getStepPosition(i)); + }
rawEnergy += eneList[j]; } // need to set time to 0 so it is recalculated from the timeList SimCalorimeterHit mergedHit = new BaseSimCalorimeterHit(oldHit.getCellID(),
- rawEnergy, 0., mcpList, eneList, timeList, pdgList);
+ rawEnergy, 0., mcpList, eneList, timeList, pdgList, steps);
//mergedHit.setDetectorElement(oldHit.getDetectorElement()); mergedHit.setMetaData(collection); // replace old hit with merged hit
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