View Javadoc

1   /*
2    * MCReconstructedParticle.java
3    *
4    * Created on February 6, 2007, 1:09 PM
5    *
6    * To change this template, choose Tools | Options and locate the template under
7    * the Source Creation and Management node. Right-click the template and choose
8    * Open. You can then make changes to the template in the Source Editor.
9    */
10  
11  package org.lcsim.event.base;
12  import hep.physics.vec.BasicHep3Vector;
13  import hep.physics.vec.BasicHepLorentzVector;
14  import hep.physics.vec.Hep3Vector;
15  
16  import org.lcsim.event.MCParticle;
17  import org.lcsim.event.ParticleID;
18  
19  /**
20   *
21   * @author cassell
22   */
23  public class MCReconstructedParticle extends BaseReconstructedParticle
24  {
25      MCParticle pp;
26      /** Creates a new instance of MCReconstructedParticle */
27      public MCReconstructedParticle(MCParticle p)
28      {
29          super(p.getEnergy(),p.getMomentum());
30          super.setMass(p.getMass());
31          super.setCharge(p.getCharge());
32          super.setReferencePoint(p.getOrigin());
33          super.setGoodnessOfPid(1.);
34          ParticleID pid = new CheatParticleID(p.getPDGID());
35          super.setParticleIdUsed(pid);
36          super.addParticleID(pid);
37          pp = p;
38      }
39      public void useMassAndP(double mass)
40      {
41          super.setMass(mass);
42          Hep3Vector mom = super.getMomentum();
43          double E = Math.sqrt(mass*mass+mom.x()*mom.x()+mom.y()*mom.y()+mom.z()*mom.z());
44          super.set4Vector(new BasicHepLorentzVector(E,mom));
45      }
46      public void useMassAndE(double mass)
47      {
48          super.setMass(mass);
49          Hep3Vector mom = super.getMomentum();
50          double pmag = Math.sqrt(mom.x()*mom.x()+mom.y()*mom.y()+mom.z()*mom.z());
51          double norm = 0.;
52          if(super.getEnergy() > mass)
53          {
54              norm = Math.sqrt(super.getEnergy()*super.getEnergy()-mass*mass)/pmag;
55          }
56          Hep3Vector newmom = new BasicHep3Vector(mom.x()*norm, mom.y()*norm, mom.z()*norm);
57          super.set4Vector(new BasicHepLorentzVector(super.getEnergy(),newmom));
58      }
59      public MCParticle getMCParticle(){return pp;}
60  }