lcsim/src/org/lcsim/contrib/SteveMagill
diff -u -r1.4 -r1.5
--- ClusterToReconstructedParticleDriver.java 29 May 2008 22:37:41 -0000 1.4
+++ ClusterToReconstructedParticleDriver.java 20 Aug 2008 20:24:44 -0000 1.5
@@ -28,7 +28,7 @@
*
* Created on March 29, 2007, 1:52 PM
*
- * $Id: ClusterToReconstructedParticleDriver.java,v 1.4 2008/05/29 22:37:41 magill Exp $
+ * $Id: ClusterToReconstructedParticleDriver.java,v 1.5 2008/08/20 20:24:44 magill Exp $
*/
/**
@@ -110,43 +110,90 @@
// first, get tracks and add them to rpList, use cluster E for energy, track P for momentum
List<Track> evtracks = event.get(Track.class,_tracknames);
Map<Track, BasicCluster> trclmap = (Map<Track, BasicCluster>) event.get("TrackClusMap");
+ Map<Track, Integer> trilmap = (Map<Track, Integer>) event.get("TrackILMap");
for (Track itrack : evtracks)
{
BasicCluster trmclus = trclmap.get(itrack);
+ int trIL = trilmap.get(itrack);
double TrclE = trmclus.getEnergy();
double[] TrP = itrack.getMomentum();
double Trpmag = Math.sqrt(TrP[0]*TrP[0]+TrP[1]*TrP[1]+TrP[2]*TrP[2]);
+// if (trIL==0 && TrclE==0.) continue;
double TrE = Math.sqrt(Trpmag*Trpmag+0.01948);
- if (TrclE/Trpmag>2.0)
+ // if E over p less than 1.5, treat as charged pion using track parameters -
+ // if E over p greater than 1.5, use energy flow, constructing a charged pion and a
+ // photon out of the momentum and energy
+ if ((TrclE-Trpmag)/(0.7*Math.sqrt(Trpmag))<2.6) // use track parameters to make a charged pion RP
{
- TrP[0] = TrclE*TrP[0]/Trpmag;
- TrP[1] = TrclE*TrP[1]/Trpmag;
- TrP[2] = TrclE*TrP[2]/Trpmag;
- TrE = Math.sqrt(TrclE*TrclE+0.01948);
- }
- Hep3Vector mom = new BasicHep3Vector(TrP[0],TrP[1],TrP[2]);
- BaseReconstructedParticle rp = new BaseReconstructedParticle(TrE, mom);
- rp.setMass(0.13957);
-// rp.setMass(itrack.getMCParticle().getMass());
- double trq = (double) itrack.getCharge();
- rp.setCharge(trq);
- if (trq>0)
- {
- ParticleType pitype = ParticlePropertyManager.getParticlePropertyProvider().get(211);
- ParticleID id = new BaseParticleID(pitype);
- rp.addParticleID(id);
- rp.setParticleIdUsed(id);
- }
- if (trq<0)
+ Hep3Vector mom = new BasicHep3Vector(TrP[0],TrP[1],TrP[2]);
+ BaseReconstructedParticle rp = new BaseReconstructedParticle(TrE, mom);
+ rp.setMass(0.13957);
+// rp.setMass(itrack.getMCParticle().getMass());
+ double trq = (double) itrack.getCharge();
+ rp.setCharge(trq);
+ if (trq>0)
+ {
+ ParticleType pitype = ParticlePropertyManager.getParticlePropertyProvider().get(211);
+ ParticleID id = new BaseParticleID(pitype);
+ rp.addParticleID(id);
+ rp.setParticleIdUsed(id);
+ }
+ if (trq<0)
+ {
+ ParticleType pitype = ParticlePropertyManager.getParticlePropertyProvider().get(-211);
+ ParticleID id = new BaseParticleID(pitype);
+ rp.addParticleID(id);
+ rp.setParticleIdUsed(id);
+ }
+ rp.addTrack(itrack);
+ rp.addCluster(trmclus);
+ rpList.add(rp);
+ } else // make a pion and a photon out of this object using energy flow
{
- ParticleType pitype = ParticlePropertyManager.getParticlePropertyProvider().get(-211);
- ParticleID id = new BaseParticleID(pitype);
- rp.addParticleID(id);
- rp.setParticleIdUsed(id);
+ // use energy flow, first form charged pion from track
+ Hep3Vector mom = new BasicHep3Vector(TrP[0],TrP[1],TrP[2]);
+ BaseReconstructedParticle rp = new BaseReconstructedParticle(TrE, mom);
+ rp.setMass(0.13957);
+// rp.setMass(itrack.getMCParticle().getMass());
+ double trq = (double) itrack.getCharge();
+ rp.setCharge(trq);
+ if (trq>0)
+ {
+ ParticleType pitype = ParticlePropertyManager.getParticlePropertyProvider().get(211);
+ ParticleID id = new BaseParticleID(pitype);
+ rp.addParticleID(id);
+ rp.setParticleIdUsed(id);
+ }
+ if (trq<0)
+ {
+ ParticleType pitype = ParticlePropertyManager.getParticlePropertyProvider().get(-211);
+ ParticleID id = new BaseParticleID(pitype);
+ rp.addParticleID(id);
+ rp.setParticleIdUsed(id);
+ }
+ rp.addTrack(itrack);
+ rp.addCluster(trmclus);
+ rpList.add(rp);
+ // now, use remaining energy to form a photon
+ double Epho = TrclE-TrE;
+ if (Epho>0)
+ {
+ double ppho[] = new double[3];
+ ppho[0] = Epho*TrP[0]/Trpmag;
+ ppho[1] = Epho*TrP[1]/Trpmag;
+ ppho[2] = Epho*TrP[2]/Trpmag;
+ Hep3Vector pmom = new BasicHep3Vector(ppho[0],ppho[1],ppho[2]);
+ BaseReconstructedParticle pp = new BaseReconstructedParticle(Epho,pmom);
+ pp.setMass(0.);
+ pp.setCharge(0.);
+ ParticleType photype = ParticlePropertyManager.getParticlePropertyProvider().get(22);
+ ParticleID id = new BaseParticleID(photype);
+ pp.addParticleID(id);
+ pp.setParticleIdUsed(id);
+ pp.addCluster(trmclus); // add whole cluster to this particle
+ rpList.add(pp);
+ }
}
- rp.addTrack(itrack);
- rp.addCluster(trmclus);
- rpList.add(rp);
}
// now get photon clusters
@@ -178,9 +225,9 @@
{
double ClEa = neuhclus.getEnergy();
double ClE = nhcalc.getEnergy(neuhclus);
-// if (ClE<0.5) ClE = 0.5;
+ if (ClE<0.5) ClE = 0.5;
double p2mag = ClE*ClE-0.4977*0.4977;
- if (p2mag<0) p2mag = 0;
+// if (p2mag<0) p2mag = 0;
double pmag = Math.sqrt(p2mag);
double[] pos = neuhclus.getPosition();
double norm = sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);