Author: [log in to unmask] Date: Fri Aug 28 19:00:43 2015 New Revision: 3461 Log: If a the daughters of a V0 particle both have tracks to matched to Ecal clusters, set the energy of the V0 particle as the sum of the Ecal cluster energies. Modified: java/trunk/recon/src/main/java/org/hps/recon/particle/HpsReconParticleDriver.java Modified: java/trunk/recon/src/main/java/org/hps/recon/particle/HpsReconParticleDriver.java ============================================================================= --- java/trunk/recon/src/main/java/org/hps/recon/particle/HpsReconParticleDriver.java (original) +++ java/trunk/recon/src/main/java/org/hps/recon/particle/HpsReconParticleDriver.java Fri Aug 28 19:00:43 2015 @@ -184,8 +184,17 @@ vtxFit.getParameters().get("p2Y"), vtxFit.getParameters().get("p2Z"))); fittedMomentum = CoordinateTransformations.transformVectorToDetector(fittedMomentum); - HepLorentzVector fourVector = new BasicHepLorentzVector(0, 0, 0, 0); - ((BasicHepLorentzVector) fourVector).setV3(fourVector.t(), fittedMomentum); + + // If both the electron and positron have an associated Ecal cluster, + // calculate the total energy and assign it to the V0 particle + double v0Energy = 0; + if (!electron.getClusters().isEmpty() && !positron.getClusters().isEmpty()) { + v0Energy += electron.getClusters().get(0).getEnergy(); + v0Energy += positron.getClusters().get(0).getEnergy(); + } + + HepLorentzVector fourVector = new BasicHepLorentzVector(v0Energy, fittedMomentum); + //((BasicHepLorentzVector) fourVector).setV3(fourVector.t(), fittedMomentum); ((BaseReconstructedParticle) candidate).set4Vector(fourVector); // VERBOSE :: Output the fitted momentum data.