Print

Print


Commit in lcsim/src/org/lcsim on MAIN
mc/fast/reconstructedparticle/MCFastParticleID.java+3-81.3 -> 1.4
                             /MCFastReconstructedParticle.java+7-491.6 -> 1.7
                             /MCFastReconstructedParticleDriver.java+37-271.8 -> 1.9
particle/Electron.java-421.1 removed
        /KLong.java-511.1 removed
        /Muon.java-421.1 removed
        /Neutron.java-311.1 removed
        /ParticleType.java-471.2 removed
        /Photon.java-311.1 removed
        /Pion.java-461.1 removed
+47-374
7 removed + 3 modified, total 10 files
Remove code that duplicates freehep functionality

lcsim/src/org/lcsim/mc/fast/reconstructedparticle
MCFastParticleID.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- MCFastParticleID.java	15 Jul 2005 22:09:29 -0000	1.3
+++ MCFastParticleID.java	20 Aug 2005 21:54:44 -0000	1.4
@@ -1,7 +1,7 @@
 package org.lcsim.mc.fast.reconstructedparticle;
 
+import hep.physics.particle.properties.ParticleType;
 import org.lcsim.event.ParticleID;
-import org.lcsim.particle.ParticleType;
 
 /**
  * An implementation of ParticleID appropriate for the fast Monte Carlo
@@ -20,14 +20,14 @@
      */
     public int getType()
     {
-        return _type.pdgId();
+        return _type.getPDGID();
     }
     
     /** The PDG code of this id - UnknownPDG ( 999999 ) if unknown.
      */
     public int getPDG()
     {
-        return _type.pdgId();
+        return _type.getPDGID();
     }
     
     /**The likelihood  of this hypothesis - in a user defined normalization.
@@ -52,9 +52,4 @@
     {
         return new double[1];
     }
-    
-    /** Constant to be used if the PDG code is not known or undefined.
-     */
-    public final static int UnknownPDG = 999999;
-    
 }

lcsim/src/org/lcsim/mc/fast/reconstructedparticle
MCFastReconstructedParticle.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- MCFastReconstructedParticle.java	15 Jul 2005 22:09:29 -0000	1.6
+++ MCFastReconstructedParticle.java	20 Aug 2005 21:54:44 -0000	1.7
@@ -5,10 +5,9 @@
 import hep.physics.vec.Hep3Vector;
 import hep.physics.vec.HepLorentzVector;
 import hep.physics.particle.Particle;
+import hep.physics.particle.properties.ParticleType;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Random;
-import org.lcsim.event.MCParticle;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.ParticleID;
 import org.lcsim.event.ReconstructedParticle;
@@ -16,9 +15,7 @@
 
 import static java.lang.Math.sqrt;
 import static java.lang.Math.pow;
-import org.lcsim.particle.ParticleType;
-import org.lcsim.spacegeom.CartesianPoint;
-import org.lcsim.spacegeom.SpacePoint;
+
 
 /**
  *
@@ -41,12 +38,14 @@
     
     public MCFastReconstructedParticle(Track t, ParticleType type, Particle p)
     {
-        _mass = type.mass();
+        _mass = type.getMass();
         addTrack(t);
         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();
         
+        // Fixme: Probably wrong, this is not a point on the track, nor should we assume that the track
+        // reference point is at the POCA.
         _referencePoint = new BasicHep3Vector(t.getReferencePointX(), t.getReferencePointY(), t.getReferencePointZ());
         
         addParticleID(new MCFastParticleID(type));
@@ -54,7 +53,7 @@
     
     public MCFastReconstructedParticle(Cluster c,  ParticleType type, Particle p)
     {
-        _mass = type.mass();
+        _mass = type.getMass();
         addCluster(c);
         double e = c.getEnergy();
         double pm = sqrt(e*e-_mass*_mass);
@@ -75,133 +74,92 @@
   
     // ReconstructedParticle interface
     
-    /** Type of reconstructed particle.
-     */
     public int getType()
     {
         return _particleIdUsed.getType();
     }
     
-    /** The magnitude of the reconstructed particle's momentum
-     */
     public Hep3Vector getMomentum()
     {
         return _fourVec.v3();
     }
     
-    /** Energy of the  reconstructed particle
-     */
     public double getEnergy()
     {
         return _fourVec.t();
     }
     
-    /** Covariance matrix of the reconstructed particle's 4vector (10 parameters).
-     *  Stored as lower triangle matrix of the four momentum (px,py,pz,E), i.e.
-     *  cov(px,px), cov(py,px), cov( py,py ) , ....
-     */
     public double[] getCovMatrix()
     {
         return _covMatrix;
     }
     
-    /** Mass of the  reconstructed particle, set independently from four vector quantities
-     */
     public double getMass()
     {
         return _mass;
     }
     
-    /** Charge of the reconstructed particle.
-     */
     public double getCharge()
     {
         return _charge;
     }
     
-    /** Reference point of the reconstructedParticle parameters.
-     */
     public Hep3Vector getReferencePoint()
     {
         return _referencePoint;
     }
     
-    /** The particle Id's sorted by their likelihood.
-     * @see ParticleID
-     */
     public List<ParticleID> getParticleIDs()
     {
         return _particleIds;
     }
     
-    /** The particle Id used for the kinematics of this particle.
-     * @see ParticleID
-     */
     public ParticleID getParticleIDUsed()
     {
         return _particleIdUsed;
     }
     
-    /** The overall goodness of the PID on a scale of [0;1].
-     */
     public double getGoodnessOfPID()
     {
         return _goodnessOfPid;
     }
-    
-    /** The reconstructed particles that have been combined to this particle.
-     */
+
     public List<ReconstructedParticle> getParticles()
     {
         return _particles;
     }
     
-    /** The clusters that have been used for this particle.
-     */
     public List<Cluster> getClusters()
     {
         return _clusters;
     }
     
-    /** The tracks that have been used for this particle.
-     */
     public List<Track> getTracks()
     {
         return _tracks;
     }
     
-    /**Add a ParticleID object.
-     * @see ParticleID
-     */
     public void addParticleID(ParticleID pid)
     {
         _particleIds.add(pid);
         _particleIdUsed = pid;
     }
     
-    /**Add a particle that has been used to create this particle.
-     */
     public void addParticle(ReconstructedParticle particle)
     {
         _particles.add(particle);
     }
     
-    /**Add a cluster that has been used to create this particle.
-     */
     public void addCluster(Cluster cluster)
     {
         _clusters.add(cluster);
     }
     
-    /**Add a track that has been used to create this particle.
-     */
     public void addTrack(Track track)
     {
         _tracks.add(track);
     }
     
-    /**Returns this particles momentum and energy as a four vector
-     */
     public HepLorentzVector asFourVector()
     {
         return _fourVec;

lcsim/src/org/lcsim/mc/fast/reconstructedparticle
MCFastReconstructedParticleDriver.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- MCFastReconstructedParticleDriver.java	9 Aug 2005 18:34:45 -0000	1.8
+++ MCFastReconstructedParticleDriver.java	20 Aug 2005 21:54:44 -0000	1.9
@@ -1,42 +1,25 @@
-/*
- * MCFastReconstructedParticleDriver.java
- *
- * Created on July 1, 2005, 2:55 PM
- *
- * To change this template, choose Tools | Options and locate the template under
- * the Source Creation and Management node. Right-click the template and choose
- * Open. You can then make changes to the template in the Source Editor.
- */
-
 package org.lcsim.mc.fast.reconstructedparticle;
 
 import hep.physics.particle.Particle;
+import hep.physics.particle.properties.ParticlePropertyManager;
+import hep.physics.particle.properties.ParticlePropertyProvider;
+import hep.physics.particle.properties.ParticleType;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
-import org.lcsim.event.MCParticle;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.EventHeader;
 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 org.lcsim.mc.fast.reconstructedparticle.IDResolutionTables;
 import org.lcsim.conditions.ConditionsEvent;
 import org.lcsim.conditions.ConditionsListener;
 import org.lcsim.conditions.ConditionsSet;
 
 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;
-import org.lcsim.particle.KLong;
-
 import org.lcsim.util.aida.AIDA;
 /**
  *
@@ -44,13 +27,40 @@
  */
 public class MCFastReconstructedParticleDriver extends Driver implements ConditionsListener
 {
-    
+    private ParticlePropertyProvider ppp;
     private IDResolutionTables IDEff;
     private AIDA aida = AIDA.defaultInstance();
+    private ParticleType eminus;
+    private ParticleType eplus;
+    private ParticleType klong;
+    private ParticleType muminus;
+    private ParticleType muplus;
+    private ParticleType neutron;
+    private ParticleType photon;
+    private ParticleType pizero;
+    private ParticleType piplus;
+    private ParticleType piminus;
     
     /** Creates a new instance of MCFastReconstructedParticleDriver */
     public MCFastReconstructedParticleDriver()
     {
+       this(ParticlePropertyManager.getParticlePropertyProvider());
+    }
+    
+    public MCFastReconstructedParticleDriver(ParticlePropertyProvider ppp)
+    {
+       this.ppp = ppp;
+       // 
+       eminus = ppp.get(11);
+       eplus = ppp.get(-11);
+       klong = ppp.get(130);
+       muminus = ppp.get(13);
+       muplus = ppp.get(-13);
+       neutron = ppp.get(2112);
+       photon = ppp.get(22);
+       pizero = ppp.get(111);
+       piplus = ppp.get(211);
+       piminus = ppp.get(-211);
     }
     
     protected void process(EventHeader event)
@@ -83,15 +93,15 @@
                 // electrons and muons are special
                 if((abs(pdgid)== 11) && (rand.nextDouble() < IDEff.getElectronEff()))
                 {
-                    type = new Electron(rt.getCharge());
+                    type = rt.getCharge() > 0 ? eplus : eminus;
                 }
                 else if((abs(pdgid)== 13) && (rand.nextDouble() < IDEff.getMuonEff()))
                 {
-                    type = new Muon(rt.getCharge());
+                    type = rt.getCharge() > 0 ? muplus : muminus;
                 }
                 else
                 {
-                    type = new Pion(rt.getCharge());
+                    type = rt.getCharge() == 0 ? pizero : rt.getCharge() > 0 ? piplus : piminus;
                 }
                 
                 if ((p.getEnergy() > 10) && (hist)) 
@@ -128,7 +138,7 @@
             {
                 ReconEMCluster emc = (ReconEMCluster) c;
                 p = emc.getMCParticle();
-                type = new Photon();
+                type = photon;
                 if (hist)
                 {
                     aida.histogram1D("photonCLS-particle", 150, -3, 3).fill((emc.getEnergy()-emc.getMCParticle().getEnergy())/(Math.sqrt(emc.getMCParticle().getEnergy())));
@@ -147,11 +157,11 @@
                 
                 if ((abs(pdgid)==2112) && (rand.nextDouble() < IDEff.getNeutronEff()))
                 {
-                    type = new Neutron();
+                    type = neutron;
                 }
                 else
                 {
-                    type = new KLong();
+                    type = klong;
                 }               
             }
             MCFastReconstructedParticle rp = new MCFastReconstructedParticle(c, type, p);

lcsim/src/org/lcsim/particle
Electron.java removed after 1.1
diff -N Electron.java
--- Electron.java	2 Jul 2005 06:37:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,42 +0,0 @@
-package org.lcsim.particle;
-/**
- * An electron particle class.
- *
- * @suthor Norman A. Graf
- * @version 1.0
- */
-public class Electron implements ParticleType
-{
-    private int _charge;
-    
-    /**
-     * Fully qualified constructor.
-     *
-     * @param   charge The charge of this Electron.
-     */
-    public Electron(int charge)
-    {
-        if((charge<-1 || charge>1) || charge==0) throw (new IllegalArgumentException("The charge of an electron can only be -1 or 1!"));
-        _charge = charge;
-    }
-    public String name()
-    {
-        return ParticleType.ELECTRON+(_charge>0?"+":"-");
-    }
-    public double mass()
-    {
-        return 0.000511;
-    }
-    public int charge()
-    {
-        return _charge;
-    }
-    public int pdgId()
-    {
-        return -11*_charge; // e- is particle
-    }
-    public String toString()
-    {
-        return name()+" "+mass()+" "+charge()+" "+pdgId();
-    }
-}
\ No newline at end of file

lcsim/src/org/lcsim/particle
KLong.java removed after 1.1
diff -N KLong.java
--- KLong.java	15 Jul 2005 22:12:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,51 +0,0 @@
-/*
- * KLong.java
- *
- * Created on July 6, 2005, 8:21 PM
- *
- * To change this template, choose Tools | Options and locate the template under
- * the Source Creation and Management node. Right-click the template and choose
- * Open. You can then make changes to the template in the Source Editor.
- */
-
-package org.lcsim.particle;
-
-import org.lcsim.particle.ParticleType;
-
-/**
- *
- * @author Daniel
- */
-public class KLong implements ParticleType
-{
-    
-    /** Creates a new instance of KLong */
-    public KLong() 
-    {
-    }
-    
-    public String name()
-    {
-	return ParticleType.KLONG;
-    }
-    
-    public double mass()
-    {
-	return 0.4977;
-    }
-    
-    public int charge()
-    {
-	return 0;
-    }
-    
-    public int pdgId()
-    {
- 	return 130;
-    }
-    
-    public String toString()
-    {
-	return name()+" "+mass()+" "+charge()+" "+pdgId();
-    }
-}

lcsim/src/org/lcsim/particle
Muon.java removed after 1.1
diff -N Muon.java
--- Muon.java	2 Jul 2005 06:37:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,42 +0,0 @@
-package org.lcsim.particle;
-/**
- * A muon particle class.
- *
- * @suthor Norman A. Graf
- * @version 1.0
- */
-public class Muon implements ParticleType
-{
-    private int _charge;
-    
-    /**
-     * Fully qualified constructor.
-     *
-     * @param   charge The charge of this Muon.
-     */
-    public Muon(int charge)
-    {
-        if((charge<-1 || charge>1) || charge==0) throw (new IllegalArgumentException("The charge of a muon can only be -1 or 1!"));
-        _charge = charge;
-    }
-    public String name()
-    {
-        return ParticleType.MUON+(_charge>0?"+":"-");
-    }
-    public double mass()
-    {
-        return 0.113;
-    }
-    public int charge()
-    {
-        return _charge;
-    }
-    public int pdgId()
-    {
-        return -13*_charge; // mu- is particle
-    }
-    public String toString()
-    {
-        return name()+" "+mass()+" "+charge()+" "+pdgId();
-    }
-}

lcsim/src/org/lcsim/particle
Neutron.java removed after 1.1
diff -N Neutron.java
--- Neutron.java	2 Jul 2005 06:37:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-package org.lcsim.particle;
-/**
-* A neutron particle class.
-*
-* @suthor Norman A. Graf
-* @version 1.0
-*/
-public class Neutron implements ParticleType
-{
-
-	public String name()
-	{
-		return ParticleType.NEUTRON;
-	}
-	public double mass()
-	{
-		return 0.939;
-	}
-	public int charge()
-	{
-		return 0;
-	}
-	public int pdgId()
-	{
-		return 2112;
-	}
-	public String toString()
-	{
-		return name()+" "+mass()+" "+charge()+" "+pdgId();
-	}
-}
\ No newline at end of file

lcsim/src/org/lcsim/particle
ParticleType.java removed after 1.2
diff -N ParticleType.java
--- ParticleType.java	15 Jul 2005 22:15:33 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,47 +0,0 @@
-package org.lcsim.particle;
-/**
- * A class to encapsulate a particle type.
- *
- *
- *
- *@author Norman A. Graf
- *@version 1.0
- */
-public interface ParticleType
-{
-    
-    /**
-     * The commonly used name for this particle.
-     *
-     * @return  String name
-     */
-    public String name();
-    
-    /**
-     * The mass of this particle.
-     *
-     * @return double particle mass
-     */
-    public double mass();
-    
-    /**
-     * The charge of this particle.
-     *
-     * @return int charge
-     */
-    public int charge();
-    
-    /**
-     * The Particle Data Group  code for this particle
-     *
-     * @return int PDG Id
-     */
-    public int pdgId();
-    
-    public static final String PHOTON = "Photon";
-    public static final String ELECTRON = "Electron";
-    public static final String PION = "Pi";
-    public static final String MUON = "Muon";
-    public static final String NEUTRON = "Neutron";
-    public static final String KLONG = "K0Long";
-}

lcsim/src/org/lcsim/particle
Photon.java removed after 1.1
diff -N Photon.java
--- Photon.java	2 Jul 2005 06:37:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-package org.lcsim.particle;
-/**
- * A photon particle class.
- *
- * @suthor Norman A. Graf
- * @version 1.0
- */
-public class Photon implements ParticleType
-{
-    
-    public String name()
-    {
-        return ParticleType.PHOTON;
-    }
-    public double mass()
-    {
-        return 0.;
-    }
-    public int charge()
-    {
-        return 0;
-    }
-    public int pdgId()
-    {
-        return 22;
-    }
-    public String toString()
-    {
-        return name()+" "+mass()+" "+charge()+" "+pdgId();
-    }
-}

lcsim/src/org/lcsim/particle
Pion.java removed after 1.1
diff -N Pion.java
--- Pion.java	2 Jul 2005 06:37:33 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,46 +0,0 @@
-package org.lcsim.particle;
-/**
- * A pion particle class.
- *
- * @suthor Norman A. Graf
- * @version 1.0
- */
-public class Pion implements ParticleType
-{
-    private int _charge;
-    
-    /**
-     * Fully qualified constructor.
-     *
-     * @param   charge The charge of this Pion.
-     */
-    public Pion(int charge)
-    {
-        if(charge<-1 || charge>1) throw (new IllegalArgumentException("The charge of a pion can only be -1, 0, or 1!"));
-        _charge = charge;
-    }
-    public String name()
-    {
-        return ParticleType.PION+(_charge==0?"0":(_charge>0?"+":"-"));
-    }
-    public double mass()
-    {
-        double mass = 0.135;
-        if(_charge!=0) mass = 0.1396;
-        return mass;
-    }
-    public int charge()
-    {
-        return _charge;
-    }
-    public int pdgId()
-    {
-        int id = 111; // pi0
-        if(_charge!=0) id=211*_charge; // pi+ is particle
-        return id;
-    }
-    public String toString()
-    {
-        return name()+" "+mass()+" "+charge()+" "+pdgId();
-    }
-}
\ No newline at end of file
CVSspam 0.2.8