lcsim/src/org/lcsim/mc/fast/reconstructedparticle
diff -u -r1.3 -r1.4
--- MCFastReconstructedParticle.java 2 Jul 2005 01:28:44 -0000 1.3
+++ MCFastReconstructedParticle.java 2 Jul 2005 06:38:53 -0000 1.4
@@ -12,6 +12,7 @@
import org.lcsim.event.Track;
import static java.lang.Math.sqrt;
+import org.lcsim.particle.ParticleType;
import org.lcsim.spacegeom.CartesianPoint;
import org.lcsim.spacegeom.SpacePoint;
@@ -22,9 +23,6 @@
public class MCFastReconstructedParticle implements ReconstructedParticle
{
// ReconstructedParticle attributes
- private int _type;
-// private Hep3Vector _momentum;
-// private double _energy;
private double[] _covMatrix = new double[10];
private double _mass;
private double _charge;
@@ -38,18 +36,20 @@
private BasicHepLorentzVector _fourVec = new BasicHepLorentzVector();
- public MCFastReconstructedParticle(Track t, double mass)
+ public MCFastReconstructedParticle(Track t, ParticleType type)
{
- _mass = mass;
+ _mass = type.mass();
addTrack(t);
- double e = sqrt(t.getPX()*t.getPX()+t.getPY()*t.getPY()+t.getPZ()*t.getPZ() + mass*mass);
+ double e = sqrt(t.getPX()*t.getPX()+t.getPY()*t.getPY()+t.getPZ()*t.getPZ() + _mass*_mass);
_fourVec.setV3(e, t.getPX(), t.getPY(), t.getPZ());
_charge = t.getCharge();
+
+ addParticleID(new MCFastParticleID(type));
}
- public MCFastReconstructedParticle(Cluster c, double mass)
+ public MCFastReconstructedParticle(Cluster c, ParticleType type)
{
- _mass = mass;
+ _mass = type.mass();
addCluster(c);
double e = c.getEnergy();
double p = sqrt(e*e-_mass*_mass);
@@ -61,6 +61,8 @@
double pz = p*pos.cosTheta();
_fourVec.setV3(e, px, py, pz);
_charge = 0.;
+
+ addParticleID(new MCFastParticleID(type));
}
// ReconstructedParticle interface
@@ -69,7 +71,7 @@
*/
public int getType()
{
- return _type;
+ return _particleIdUsed.getType();
}
/** The magnitude of the reconstructed particle's momentum
@@ -166,6 +168,7 @@
public void addParticleID(ParticleID pid)
{
_particleIds.add(pid);
+ _particleIdUsed = pid;
}
/**Add a particle that has been used to create this particle.
lcsim/src/org/lcsim/mc/fast/reconstructedparticle
diff -u -r1.3 -r1.4
--- MCFastReconstructedParticleDriver.java 2 Jul 2005 01:28:44 -0000 1.3
+++ MCFastReconstructedParticleDriver.java 2 Jul 2005 06:38:53 -0000 1.4
@@ -10,6 +10,7 @@
package org.lcsim.mc.fast.reconstructedparticle;
+import hep.physics.particle.Particle;
import java.util.ArrayList;
import java.util.List;
import org.lcsim.event.Cluster;
@@ -17,8 +18,17 @@
import org.lcsim.event.ReconstructedParticle;
import org.lcsim.event.Track;
import org.lcsim.mc.fast.cluster.ronan.ReconHADCluster;
+import org.lcsim.mc.fast.tracking.ReconTrack;
+import org.lcsim.particle.ParticleType;
import org.lcsim.util.Driver;
+import static java.lang.Math.abs;
+import org.lcsim.mc.fast.cluster.ronan.ReconEMCluster;
+import org.lcsim.particle.Electron;
+import org.lcsim.particle.Muon;
+import org.lcsim.particle.Neutron;
+import org.lcsim.particle.Photon;
+import org.lcsim.particle.Pion;
/**
*
* @author ngraf
@@ -38,10 +48,30 @@
List<Track> tracks = event.getTracks();
for(Track t : tracks)
{
- // assume pion mass for charged tracks
- double mass = 140.;
-// System.out.println(t);
- MCFastReconstructedParticle rp = new MCFastReconstructedParticle(t, mass);
+ ParticleType type = null;
+ if(t instanceof ReconTrack)
+ {
+ ReconTrack rt = (ReconTrack) t;
+ Particle p = rt.getMCParticle();
+ int pdgid = p.getPDGID();
+
+ // electrons and muons are special
+ if(abs(pdgid)== 11)
+ {
+ type = new Electron((int)Math.signum(pdgid));
+ }
+ else if(abs(pdgid)== 13)
+ {
+ type = new Muon((int)Math.signum(pdgid));
+ }
+ else
+ {
+ type = new Pion(rt.getCharge());
+ }
+ // assume pion for remaining charged tracks
+
+ }
+ MCFastReconstructedParticle rp = new MCFastReconstructedParticle(t, type);
rpList.add(rp);
}
@@ -49,16 +79,21 @@
List<Cluster> clusters = event.getClusters();
for(Cluster c : clusters)
{
-// System.out.println(c);
+ ParticleType type = null;
// photons for EM
- double mass = 0.;
+ if( c instanceof ReconEMCluster)
+ {
+ type = new Photon();
+ }
// assume neutron here for had cluster
- if(c instanceof ReconHADCluster) mass = 939.;
- MCFastReconstructedParticle rp = new MCFastReconstructedParticle(c, mass);
+ else if(c instanceof ReconHADCluster)
+ {
+ type = new Neutron();
+ }
+ MCFastReconstructedParticle rp = new MCFastReconstructedParticle(c, type);
rpList.add(rp);
}
-
-// System.out.println(tracks.size()+ " tracks, "+clusters.size()+" clusters, "+rpList.size()+" reconstructedParticles");
+ // add the reconstructedparticles to the event
event.put("MCFastReconstructedParticles", rpList, ReconstructedParticle.class, 0);
}