Author: [log in to unmask] Date: Fri Sep 25 06:56:20 2015 New Revision: 3712 Log: do stuff Modified: java/trunk/recon/src/main/java/org/hps/recon/particle/HpsReconParticleDriver.java java/trunk/recon/src/main/java/org/hps/recon/particle/ReconParticleDriver.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 Sep 25 06:56:20 2015 @@ -7,17 +7,13 @@ import hep.physics.vec.VecOp; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import org.lcsim.event.EventHeader; import org.lcsim.event.ReconstructedParticle; import org.lcsim.event.Track; import org.lcsim.event.Vertex; import org.lcsim.event.base.BaseReconstructedParticle; -import org.lcsim.fit.helicaltrack.HelicalTrackFit; -import org.lcsim.recon.tracking.seedtracker.SeedTrack; import org.hps.recon.tracking.CoordinateTransformations; import org.hps.recon.tracking.TrackType; import org.hps.recon.vertexing.BilliorTrack; @@ -25,23 +21,24 @@ import org.hps.recon.vertexing.BilliorVertexer; /** - * The main HPS implementation of ReconParticleDriver. Method generates - * V0 candidates and does vertex fits. - * + * The main HPS implementation of ReconParticleDriver. Method generates V0 + * candidates and does vertex fits. + * * @author Omar Moreno <[log in to unmask]> */ public class HpsReconParticleDriver extends ReconParticleDriver { - + /** * LCIO collection name for Moller candidate particles generated without * constraints. */ protected String unconstrainedMollerCandidatesColName = "UnconstrainedMollerCandidates"; /** - * LCIO collection name for Moller candidate particles generated with beam spot - * constraints. - */ - protected String beamConMollerCandidatesColName = "BeamspotConstrainedMollerCandidates"; ; + * LCIO collection name for Moller candidate particles generated with beam + * spot constraints. + */ + protected String beamConMollerCandidatesColName = "BeamspotConstrainedMollerCandidates"; + ; /** * LCIO collection name for Moller candidate particles generated with target * constraints. @@ -53,8 +50,8 @@ */ protected String unconstrainedMollerVerticesColName = "UnconstrainedMollerVertices"; /** - * LCIO collection name for Moller candidate vertices generated with beam spot - * constraints. + * LCIO collection name for Moller candidate vertices generated with beam + * spot constraints. */ protected String beamConMollerVerticesColName = "BeamspotConstrainedMollerVertices"; /** @@ -62,7 +59,7 @@ * constraints. */ protected String targetConMollerVerticesColName = "TargetConstrainedMollerVertices"; - + /** * Stores reconstructed Moller candidate particles generated without * constraints. @@ -79,7 +76,8 @@ */ protected List<ReconstructedParticle> targetConMollerCandidates; /** - * Stores reconstructed Moller candidate vertices generated without constraints. + * Stores reconstructed Moller candidate vertices generated without + * constraints. */ protected List<Vertex> unconstrainedMollerVertices; /** @@ -95,19 +93,25 @@ /** * Represents a type of constraint for vertex fitting. - * + * * @author Omar Moreno <[log in to unmask]> */ - private enum Constraint { - /** Represents a fit with no constraints. */ - UNCONSTRAINED, - /** Represents a fit with beam spot constraints. */ - BS_CONSTRAINED, - /** Represents a fit with target constraints. */ + private enum Constraint { + + /** + * Represents a fit with no constraints. + */ + UNCONSTRAINED, + /** + * Represents a fit with beam spot constraints. + */ + BS_CONSTRAINED, + /** + * Represents a fit with target constraints. + */ TARGET_CONSTRAINED } - /** * Processes the track and cluster collections in the event into * reconstructed particles and V0 candidate particles and vertices. These @@ -117,16 +121,16 @@ */ @Override protected void process(EventHeader event) { - + unconstrainedMollerCandidates = new ArrayList<ReconstructedParticle>(); beamConMollerCandidates = new ArrayList<ReconstructedParticle>(); targetConMollerCandidates = new ArrayList<ReconstructedParticle>(); unconstrainedMollerVertices = new ArrayList<Vertex>(); beamConMollerVertices = new ArrayList<Vertex>(); targetConMollerVertices = new ArrayList<Vertex>(); - + super.process(event); - + event.put(unconstrainedMollerCandidatesColName, unconstrainedMollerCandidates, ReconstructedParticle.class, 0); event.put(beamConMollerCandidatesColName, beamConMollerCandidates, ReconstructedParticle.class, 0); event.put(targetConMollerCandidatesColName, targetConMollerCandidates, ReconstructedParticle.class, 0); @@ -134,23 +138,23 @@ event.put(beamConMollerVerticesColName, beamConMollerVertices, Vertex.class, 0); event.put(targetConMollerVerticesColName, targetConMollerVertices, Vertex.class, 0); } - - /** - * Creates reconstructed V0 candidate particles and vertices for - * electron positron pairs using no constraints, beam constraints, - * and target constraints. These are saved to the appropriate lists - * in the super class. + + /** + * Creates reconstructed V0 candidate particles and vertices for electron + * positron pairs using no constraints, beam constraints, and target + * constraints. These are saved to the appropriate lists in the super class. + * * @param electrons - The list of electrons. * @param positrons - The list of positrons. */ @Override protected void findVertices(List<ReconstructedParticle> electrons, List<ReconstructedParticle> positrons) { - + // Iterate over the positrons and electrons to perform vertexing // on the pairs. - for(ReconstructedParticle positron : positrons) { - for(ReconstructedParticle electron : electrons) { - + for (ReconstructedParticle positron : positrons) { + for (ReconstructedParticle electron : electrons) { + // Don't vertex a GBL track with a SeedTrack. if (TrackType.isGBL(positron.getType()) != TrackType.isGBL(electron.getType())) { continue; @@ -159,243 +163,256 @@ if ((positron.getType() & electron.getType() & 0x1f) == 0) { continue; } - + // Make V0 candidates this.makeV0Candidates(electron, positron); } } - + + List<ReconstructedParticle> topElectrons = new ArrayList<ReconstructedParticle>(); + List<ReconstructedParticle> botElectrons = new ArrayList<ReconstructedParticle>(); + for (ReconstructedParticle electron : electrons) { + if (electron.getTracks().get(0).getTrackStates().get(0).getTanLambda() > 0) { + topElectrons.add(electron); + } else { + botElectrons.add(electron); + } + } + // Iterate over the collection of electrons and create e-e- pairs - for (int firstElectronN = 0; firstElectronN < electrons.size(); firstElectronN++) { - ReconstructedParticle firstElectron = electrons.get(firstElectronN); - - for (int secondElectronN = firstElectronN + 1; secondElectronN < electrons.size(); secondElectronN++) { - - ReconstructedParticle secondElectron = electrons.get(secondElectronN); - - // Don't vertex the same particles. This is needed when making - // Moller candidates. - if (firstElectron == secondElectron) continue; - + for (ReconstructedParticle topElectron : topElectrons) { + + for (ReconstructedParticle botElectron : botElectrons) { // Don't vertex a GBL track with a SeedTrack. - if (TrackType.isGBL(firstElectron.getType()) != TrackType.isGBL(secondElectron.getType())) { + if (TrackType.isGBL(topElectron.getType()) != TrackType.isGBL(botElectron.getType())) { continue; } // Only vertex two particles if at least one strategy found both tracks. Take out this check once we reduce the number of tracks. - if ((firstElectron.getType() & secondElectron.getType() & 0x1f) == 0) { + if ((topElectron.getType() & botElectron.getType() & 0x1f) == 0) { continue; } - // Require the the mollers are in opposite volumes - if (firstElectron.getTracks().get(0).getTrackStates().get(0).getTanLambda() - *secondElectron.getTracks().get(0).getTrackStates().get(0).getTanLambda() > 0) continue; - // Make Moller candidates - this.makeMollerCandidates(firstElectron, secondElectron); + this.makeMollerCandidates(topElectron, botElectron); } } } - - /** - * Sets the default LCIO collection names if they are not already - * defined previously. + + /** + * Sets the default LCIO collection names if they are not already defined + * previously. */ @Override - protected void startOfData(){ + protected void startOfData() { // If the LCIO collection names have not been defined, assign // them to the default names. - if(unconstrainedV0CandidatesColName == null) { unconstrainedV0CandidatesColName = "UnconstrainedV0Candidates"; } - if(beamConV0CandidatesColName == null) { beamConV0CandidatesColName = "BeamspotConstrainedV0Candidates"; } - if(targetConV0CandidatesColName == null) { targetConV0CandidatesColName = "TargetConstrainedV0Candidates"; } - if(unconstrainedV0VerticesColName == null) { unconstrainedV0VerticesColName = "UnconstrainedV0Vertices"; } - if(beamConV0VerticesColName == null) { beamConV0VerticesColName = "BeamspotConstrainedV0Vertices"; } - if(targetConV0VerticesColName == null) { targetConV0VerticesColName = "TargetConstrainedV0Vertices"; } - } - - /** - * Fits a vertex from an electron/positron track pair using the - * indicated constraint. + if (unconstrainedV0CandidatesColName == null) { + unconstrainedV0CandidatesColName = "UnconstrainedV0Candidates"; + } + if (beamConV0CandidatesColName == null) { + beamConV0CandidatesColName = "BeamspotConstrainedV0Candidates"; + } + if (targetConV0CandidatesColName == null) { + targetConV0CandidatesColName = "TargetConstrainedV0Candidates"; + } + if (unconstrainedV0VerticesColName == null) { + unconstrainedV0VerticesColName = "UnconstrainedV0Vertices"; + } + if (beamConV0VerticesColName == null) { + beamConV0VerticesColName = "BeamspotConstrainedV0Vertices"; + } + if (targetConV0VerticesColName == null) { + targetConV0VerticesColName = "TargetConstrainedV0Vertices"; + } + } + + /** + * Fits a vertex from an electron/positron track pair using the indicated + * constraint. + * * @param constraint - The constraint type to use. * @param electron - The electron track. * @param positron - The positron track. * @return Returns the reconstructed vertex as a <code>BilliorVertex * </code> object. */ - private BilliorVertex fitVertex(Constraint constraint, BilliorTrack electron, BilliorTrack positron){ + private BilliorVertex fitVertex(Constraint constraint, BilliorTrack electron, BilliorTrack positron) { // Create a vertex fitter from the magnetic field. BilliorVertexer vtxFitter = new BilliorVertexer(bField); // TODO: The beam size should come from the conditions database. vtxFitter.setBeamSize(beamSize); - + // Perform the vertexing based on the specified constraint. - switch(constraint){ - case UNCONSTRAINED: - vtxFitter.doBeamSpotConstraint(false); + switch (constraint) { + case UNCONSTRAINED: + vtxFitter.doBeamSpotConstraint(false); break; case BS_CONSTRAINED: - vtxFitter.doBeamSpotConstraint(true); + vtxFitter.doBeamSpotConstraint(true); break; case TARGET_CONSTRAINED: vtxFitter.doTargetConstraint(true); break; } - + // Add the electron and positron tracks to a track list for // the vertex fitter. List<BilliorTrack> billiorTracks = new ArrayList<BilliorTrack>(); billiorTracks.add(electron); billiorTracks.add(positron); - + // Find and return a vertex based on the tracks. return vtxFitter.fitVertex(billiorTracks); } - - /** - * - */ - private void makeV0Candidates(ReconstructedParticle electron, ReconstructedParticle positron) { + + /** + * + */ + private void makeV0Candidates(ReconstructedParticle electron, ReconstructedParticle positron) { // Covert the tracks to BilliorTracks. - BilliorTrack electronBTrack = toBilliorTrack(electron.getTracks().get(0)); + BilliorTrack electronBTrack = toBilliorTrack(electron.getTracks().get(0)); BilliorTrack positronBTrack = toBilliorTrack(positron.getTracks().get(0)); // Create candidate particles for each constraint. - for(Constraint constraint : Constraint.values()) { - + for (Constraint constraint : Constraint.values()) { + // Generate a candidate vertex and particle. BilliorVertex vtxFit = fitVertex(constraint, electronBTrack, positronBTrack); - ReconstructedParticle candidate = this.makeReconstructedParticle(electron, positron, vtxFit); - + ReconstructedParticle candidate = this.makeReconstructedParticle(electron, positron, vtxFit); + // Add the candidate vertex and particle to the // appropriate LCIO collection. - switch(constraint){ - - case UNCONSTRAINED: + switch (constraint) { + + case UNCONSTRAINED: unconstrainedV0Vertices.add(vtxFit); - unconstrainedV0Candidates.add(candidate); - break; - + unconstrainedV0Candidates.add(candidate); + break; + case BS_CONSTRAINED: beamConV0Vertices.add(vtxFit); beamConV0Candidates.add(candidate); break; - + case TARGET_CONSTRAINED: targetConV0Vertices.add(vtxFit); targetConV0Candidates.add(candidate); break; - + } } } - - /** - * - */ - private void makeMollerCandidates(ReconstructedParticle firstElectron, ReconstructedParticle secondElectron) { + + /** + * + */ + private void makeMollerCandidates(ReconstructedParticle topElectron, ReconstructedParticle botElectron) { // Covert the tracks to BilliorTracks. - BilliorTrack firstElectronBTrack = toBilliorTrack(firstElectron.getTracks().get(0)); - BilliorTrack secondElectronBTrack = toBilliorTrack(secondElectron.getTracks().get(0)); + BilliorTrack firstElectronBTrack = toBilliorTrack(topElectron.getTracks().get(0)); + BilliorTrack secondElectronBTrack = toBilliorTrack(botElectron.getTracks().get(0)); // Create candidate particles for each constraint. - for(Constraint constraint : Constraint.values()) { - + for (Constraint constraint : Constraint.values()) { + // Generate a candidate vertex and particle. BilliorVertex vtxFit = fitVertex(constraint, firstElectronBTrack, secondElectronBTrack); - ReconstructedParticle candidate = this.makeReconstructedParticle(firstElectron, secondElectron, vtxFit); - + ReconstructedParticle candidate = this.makeReconstructedParticle(topElectron, botElectron, vtxFit); + // Add the candidate vertex and particle to the // appropriate LCIO collection. - switch(constraint){ - - case UNCONSTRAINED: + switch (constraint) { + + case UNCONSTRAINED: unconstrainedMollerVertices.add(vtxFit); - unconstrainedMollerCandidates.add(candidate); - break; - + unconstrainedMollerCandidates.add(candidate); + break; + case BS_CONSTRAINED: beamConMollerVertices.add(vtxFit); beamConMollerCandidates.add(candidate); break; - + case TARGET_CONSTRAINED: targetConMollerVertices.add(vtxFit); targetConMollerCandidates.add(candidate); break; - + } } } - - /** - * Creates a reconstructed V0 candidate particle from an electron, - * positron, and billior vertex. + + /** + * Creates a reconstructed V0 candidate particle from an electron, positron, + * and billior vertex. + * * @param electron - The electron. * @param positron - The positron. * @param vtxFit - The billior vertex. - * @return Returns a reconstructed particle with properties generated - * from the child particles and vertex given as an argument. - */ - private ReconstructedParticle makeReconstructedParticle(ReconstructedParticle electron, ReconstructedParticle positron, BilliorVertex vtxFit){ - + * @return Returns a reconstructed particle with properties generated from + * the child particles and vertex given as an argument. + */ + private ReconstructedParticle makeReconstructedParticle(ReconstructedParticle electron, ReconstructedParticle positron, BilliorVertex vtxFit) { + // Create a new reconstructed particle to represent the V0 // candidate and populate it with the electron and positron. ReconstructedParticle candidate = new BaseReconstructedParticle(); ((BaseReconstructedParticle) candidate).setStartVertex(vtxFit); candidate.addParticle(electron); candidate.addParticle(positron); - + // Set the type of the V0 particle. This will only be needed for pass 2. ((BaseReconstructedParticle) candidate).setType(electron.getType()); - + // TODO: The calculation of the total fitted momentum should be // done within BilloirVertex. // Calculate the candidate particle momentum and associate it // with the reconstructed candidate particle. ((BaseReconstructedParticle) candidate).setMass(vtxFit.getParameters().get("invMass")); - Hep3Vector fittedMomentum = new BasicHep3Vector(vtxFit.getParameters().get("p1X"), - vtxFit.getParameters().get("p1Y"), - vtxFit.getParameters().get("p1Z")); - fittedMomentum = VecOp.add(fittedMomentum, new BasicHep3Vector(vtxFit.getParameters().get("p2X"), - vtxFit.getParameters().get("p2Y"), - vtxFit.getParameters().get("p2Z"))); + Hep3Vector fittedMomentum = new BasicHep3Vector(vtxFit.getParameters().get("p1X"), + vtxFit.getParameters().get("p1Y"), + vtxFit.getParameters().get("p1Z")); + fittedMomentum = VecOp.add(fittedMomentum, new BasicHep3Vector(vtxFit.getParameters().get("p2X"), + vtxFit.getParameters().get("p2Y"), + vtxFit.getParameters().get("p2Z"))); fittedMomentum = CoordinateTransformations.transformVectorToDetector(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()) { + 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); + + HepLorentzVector fourVector = new BasicHepLorentzVector(v0Energy, fittedMomentum); //((BasicHepLorentzVector) fourVector).setV3(fourVector.t(), fittedMomentum); ((BaseReconstructedParticle) candidate).set4Vector(fourVector); - + // Set the charge of the particle double particleCharge = electron.getCharge() + positron.getCharge(); - ((BaseReconstructedParticle) candidate).setCharge(particleCharge); - + ((BaseReconstructedParticle) candidate).setCharge(particleCharge); + // VERBOSE :: Output the fitted momentum data. printDebug("Fitted momentum in tracking frame: " + fittedMomentum.toString()); printDebug("Fitted momentum in detector frame: " + fittedMomentum.toString()); - + // Add the ReconstructedParticle to the vertex. vtxFit.setAssociatedParticle(candidate); - + // Set the vertex position as the reference point of the V0 particle ((BaseReconstructedParticle) candidate).setReferencePoint(vtxFit.getPosition()); - + // Return the V0 candidate. return candidate; } - + /** * Converts a <code>Track</code> object to a <code>BilliorTrack * </code> object. + * * @param track - The original track. * @return Returns the original track as a <code>BilliorTrack * </code> object. Modified: java/trunk/recon/src/main/java/org/hps/recon/particle/ReconParticleDriver.java ============================================================================= --- java/trunk/recon/src/main/java/org/hps/recon/particle/ReconParticleDriver.java (original) +++ java/trunk/recon/src/main/java/org/hps/recon/particle/ReconParticleDriver.java Fri Sep 25 06:56:20 2015 @@ -33,11 +33,18 @@ */ public abstract class ReconParticleDriver extends Driver { - /** Utility used to determine if a track and cluster are matched */ - TrackClusterMatcher matcher = new TrackClusterMatcher(); - + /** + * Utility used to determine if a track and cluster are matched + */ + TrackClusterMatcher matcher = new TrackClusterMatcher(); + String[] trackCollectionNames = null; - + + public static final int ELECTRON = 0; + public static final int POSITRON = 1; + public static final int MOLLER_TOP = 0; + public static final int MOLLER_BOT = 1; + /** * Sets the name of the LCIO collection for beam spot constrained V0 * candidate particles. @@ -159,7 +166,8 @@ /** * Set the names of the LCIO track collections used as input. * - * @param trackCollectionNames Array of collection names. If not set, use all Track collections in the event. + * @param trackCollectionNames Array of collection names. If not set, use + * all Track collections in the event. */ public void setTrackCollectionNames(String[] trackCollectionNames) { this.trackCollectionNames = trackCollectionNames; @@ -172,16 +180,16 @@ @Override protected void detectorChanged(Detector detector) { matcher.enablePlots(false); - + // Set the magnetic field parameters to the appropriate values. Hep3Vector ip = new BasicHep3Vector(0., 0., 1.); bField = detector.getFieldMap().getField(ip).y(); if (bField < 0) { flipSign = -1; } - + matcher.setBFieldMap(detector.getFieldMap()); - + } /** @@ -207,36 +215,36 @@ * data. */ protected List<ReconstructedParticle> makeReconstructedParticles(List<Cluster> clusters, List<List<Track>> trackCollections) { - + // Create a list in which to store reconstructed particles. List<ReconstructedParticle> particles = new ArrayList<ReconstructedParticle>(); // Create a list of unmatched clusters. A cluster should be // removed from the list if a matching track is found. Set<Cluster> unmatchedClusters = new HashSet<Cluster>(clusters); - + // Loop through all of the track collections and try to match every // track to a cluster. Allow a cluster to be matched to multiple // tracks and use a probability (to be coded later) to determine what // the best match is. // TODO: At some point, pull this out to it's own method - for (List<Track> tracks : trackCollections) { - for (Track track : tracks) { - + for (List<Track> tracks : trackCollections) { + for (Track track : tracks) { + // Create a reconstructed particle to represent the track. ReconstructedParticle particle = new BaseReconstructedParticle(); - + // Store the track in the particle. particle.addTrack(track); - + // Set the type of the particle. This is used to identify // the tracking strategy used in finding the track associated with // this particle. ((BaseReconstructedParticle) particle).setType(track.getType()); - + // Derive the charge of the particle from the track. ((BaseReconstructedParticle) particle).setCharge(track.getCharge() * flipSign); - + // Extrapolate the particle ID from the track. Positively // charged particles are assumed to be positrons and those // with negative charges are assumed to be electrons. @@ -245,16 +253,16 @@ } else if (particle.getCharge() < 0) { ((BaseReconstructedParticle) particle).setParticleIdUsed(new SimpleParticleID(11, 0, 0, 0)); } - + Cluster matchedCluster = null; - + // Track the best matching cluster for the track. // TODO: This should find the best match not just the first match. clusterLoop: for (Cluster cluster : clusters) { // Check if the cluster and track are a valid match. if (matcher.isMatch(cluster, track)) { - + // Store the matched cluster. matchedCluster = cluster; @@ -263,35 +271,39 @@ break clusterLoop; } } - + // If a cluster was found that matches the track... if (matchedCluster != null) { particle.addCluster(matchedCluster); - + int pid = particle.getParticleIDUsed().getPDG(); - if (Math.abs(pid) == 11) ((BaseCluster) matchedCluster).setParticleId(pid); - + if (Math.abs(pid) == 11) { + ((BaseCluster) matchedCluster).setParticleId(pid); + } + unmatchedClusters.remove(matchedCluster); } - + // Add the particle to the list of reconstructed particles. particles.add(particle); } } - + // Iterate over the remaining unmatched clusters. - if (!unmatchedClusters.isEmpty()) { + if (!unmatchedClusters.isEmpty()) { for (Cluster unmatchedCluster : unmatchedClusters) { - + // Create a reconstructed particle to represent the unmatched cluster. ReconstructedParticle particle = new BaseReconstructedParticle(); - + // The particle is assumed to be a photon, since it did not leave a track. ((BaseReconstructedParticle) particle).setParticleIdUsed(new SimpleParticleID(22, 0, 0, 0)); - + int pid = particle.getParticleIDUsed().getPDG(); - if (Math.abs(pid) != 11) ((BaseCluster) unmatchedCluster).setParticleId(pid); - + if (Math.abs(pid) != 11) { + ((BaseCluster) unmatchedCluster).setParticleId(pid); + } + // Add the cluster to the particle. particle.addCluster(unmatchedCluster); @@ -302,33 +314,33 @@ particles.add(particle); } } - + // Apply the corrections to the Ecal clusters - for (Cluster cluster : clusters) { - if (cluster.getParticleId() != 0) { + for (Cluster cluster : clusters) { + if (cluster.getParticleId() != 0) { ClusterUtilities.applyCorrections(cluster); } } - - for (ReconstructedParticle particle : particles) { + + for (ReconstructedParticle particle : particles) { double clusterEnergy = 0; - Hep3Vector momentum = null; - - if (!particle.getClusters().isEmpty()) { + Hep3Vector momentum = null; + + if (!particle.getClusters().isEmpty()) { clusterEnergy = particle.getClusters().get(0).getEnergy(); } - + if (!particle.getTracks().isEmpty()) { momentum = new BasicHep3Vector(particle.getTracks().get(0).getTrackStates().get(0).getMomentum()); momentum = CoordinateTransformations.transformVectorToDetector(momentum); - } else if (!particle.getClusters().isEmpty()) { + } else if (!particle.getClusters().isEmpty()) { momentum = new BasicHep3Vector(particle.getClusters().get(0).getPosition()); momentum = VecOp.mult(clusterEnergy, VecOp.unit(momentum)); } HepLorentzVector fourVector = new BasicHepLorentzVector(clusterEnergy, momentum); ((BaseReconstructedParticle) particle).set4Vector(fourVector); } - + // Return the list of reconstructed particles. return particles; } @@ -355,10 +367,12 @@ */ @Override protected void process(EventHeader event) { - + // All events are required to contain Ecal clusters. If // the event lacks these, then it should be skipped. - if (!event.hasCollection(Cluster.class, ecalClustersCollectionName)) return; + if (!event.hasCollection(Cluster.class, ecalClustersCollectionName)) { + return; + } // VERBOSE :: Note that a new event is being read. printDebug("\nProcessing Event..."); @@ -368,7 +382,7 @@ // VERBOSE :: Output the number of clusters in the event. printDebug("Clusters :: " + clusters.size()); - + // Get all collections of the type Track from the event. This is // required in case an event contains different track collection // for each of the different tracking strategies. If the event @@ -406,7 +420,7 @@ // Loop through all of the track collections present in the event and // create final state particles. finalStateParticles.addAll(makeReconstructedParticles(clusters, trackCollections)); - + // VERBOSE :: Output the number of reconstructed particles. printDebug("Final State Particles :: " + finalStateParticles.size()); @@ -500,7 +514,7 @@ } @Override - protected void endOfData() { + protected void endOfData() { //matcher.saveHistograms(); } @@ -508,12 +522,11 @@ // ==== Class Variables ========================================= // ============================================================== // Local variables. - /** * Indicates whether debug text should be output or not. */ private boolean debug = false; - + /** * The simple name of the class used for debug print statements. */