lcsim/src/org/lcsim/contrib/uiowa/structural
diff -u -r1.2 -r1.3
--- PerfectPFA.java 3 Jan 2006 19:34:15 -0000 1.2
+++ PerfectPFA.java 6 Jan 2006 22:59:47 -0000 1.3
@@ -33,7 +33,7 @@
/**
* A perfect PFA
*
- * @version $Id: PerfectPFA.java,v 1.2 2006/01/03 19:34:15 mcharles Exp $
+ * @version $Id: PerfectPFA.java,v 1.3 2006/01/06 22:59:47 mcharles Exp $
*/
public class PerfectPFA extends Driver
@@ -52,6 +52,7 @@
ICloud1D m_hTotalEnergyPrimaryRonAllNeutrinos;
ICloud1D m_hTotalEnergyPrimaryCheat;
ICloud1D m_hTotalEnergyPrimaryCheatNoNeutrinos;
+ ICloud1D m_hTotalEnergyPrimaryCheatSomeNeutrinos;
ICloud1D m_hTotalEnergyPrimaryCheatAllNeutrinos;
ICloud1D m_hTotalEnergyPrimaryCheatCheat;
EventHeader m_event;
@@ -73,6 +74,7 @@
m_hTotalEnergyPrimaryRonAllNeutrinos = m_histoFactory.createCloud1D("hTotalEnergyPrimaryRonAllNeutrinos");
m_hTotalEnergyCheat = m_histoFactory.createCloud1D("hTotalEnergyCheat");
m_hTotalEnergyPrimaryCheatNoNeutrinos = m_histoFactory.createCloud1D("hTotalEnergyPrimaryCheatNoNeutrinos");
+ m_hTotalEnergyPrimaryCheatSomeNeutrinos = m_histoFactory.createCloud1D("hTotalEnergyPrimaryCheatSomeNeutrinos");
m_hTotalEnergyPrimaryCheatAllNeutrinos = m_histoFactory.createCloud1D("hTotalEnergyPrimaryCheatAllNeutrinos");
m_hTotalEnergyPrimaryCheat = m_histoFactory.createCloud1D("hTotalEnergyPrimaryCheat");
m_hTotalEnergyPrimaryCheatCheat = m_histoFactory.createCloud1D("hTotalEnergyPrimaryCheatCheat");
@@ -122,7 +124,7 @@
// Now, for each charged MC particle, build a TrackExtrapolationInfo object...
Map<TrackExtrapolationInfo, Cluster> mapHelixToCluster = new HashMap<TrackExtrapolationInfo, Cluster>();
Map<Cluster, List<TrackExtrapolationInfo>> mapClusterToHelix = new HashMap<Cluster, List<TrackExtrapolationInfo>>();
- Set<MCParticle> particleSet = mapParticlesToClusters.keySet();
+ Set<MCParticle> particleSet = mapParticlesToClusters.keySet(); // <- particleSet is the set of particles contributing to clusters
for (MCParticle part : particleSet) {
if (Math.abs(part.getCharge()) > 0.5) {
// Charged particle
@@ -165,8 +167,9 @@
for (MCParticle part : particleSet) {
BasicCluster clus = mapParticlesToClusters.get(part);
- List<MCParticle> primaries = mapParticleToPrimary.get(part);
+ List<MCParticle> primaries = mapParticleToPrimary.get(part); // <-- primaries from this particle (which contributes to one or more clusters)
if (clus != null && clus.getCalorimeterHits().size()>0) {
+ // Found something with calorimeter hits...
if (Math.abs(part.getCharge()) > 0.5) {
// Charged particle
pfaEnergySumRon += part.getEnergy();
@@ -186,7 +189,7 @@
cheatEnergySum += part.getEnergy();
for (MCParticle primary : primaries) {
if (!usedPrimaryAll.contains(primary)) {
- cheatEnergySumPrimary += primary.getEnergy();
+ cheatEnergySumPrimary += primary.getEnergy(); // <-- count energy of each primary
usedPrimaryAll.add(primary);
}
}
@@ -214,13 +217,21 @@
if (pdg==12 || pdg==14 || pdg==16 || pdg==18 || pdg==-12 || pdg==-14 || pdg==-16 || pdg==-18) {
truthNeutrinoEnergySum += p.getEnergy();
List<MCParticle> primaries = mapParticleToPrimary.get(p);
+ boolean flagUsedPrimaryAll = false;
+ boolean flagUsedPrimaryCharged = false;
for (MCParticle primary : primaries) {
- if (!usedPrimaryAll.contains(p)) {
- truthNeutrinoEnergySumForPrimaryAll += p.getEnergy();
+ if (usedPrimaryAll.contains(primary)) {
+ flagUsedPrimaryAll = true;
+ }
+ if (usedPrimaryCharged.contains(primary)) {
+ flagUsedPrimaryCharged = true;
}
- if (!usedPrimaryCharged.contains(p)) {
- truthNeutrinoEnergySumForPrimaryCharged += p.getEnergy();
- }
+ }
+ if (!flagUsedPrimaryAll) {
+ truthNeutrinoEnergySumForPrimaryAll += p.getEnergy();
+ }
+ if (!flagUsedPrimaryCharged) {
+ truthNeutrinoEnergySumForPrimaryCharged += p.getEnergy();
}
}
}
@@ -233,6 +244,7 @@
m_hTotalEnergyPrimaryRonNoNeutrinos.fill(pfaEnergySumRonPrimary);
m_hTotalEnergyPrimaryCheatNoNeutrinos.fill(cheatEnergySumPrimary);
+ m_hTotalEnergyPrimaryCheatSomeNeutrinos.fill(cheatEnergySumPrimary+truthNeutrinoEnergySumForPrimaryAll);
m_hTotalEnergyPrimaryRonAllNeutrinos.fill(pfaEnergySumRonPrimary+truthNeutrinoEnergySum);
m_hTotalEnergyPrimaryCheatAllNeutrinos.fill(cheatEnergySumPrimary+truthNeutrinoEnergySum);