lcsim/src/org/lcsim/util/heprep
diff -u -r1.9 -r1.10
--- MCParticleConverter.java 6 Apr 2007 20:30:13 -0000 1.9
+++ MCParticleConverter.java 25 Jul 2007 21:36:05 -0000 1.10
@@ -22,7 +22,7 @@
/**
*
* @author tonyj
- * @version $Id: MCParticleConverter.java,v 1.9 2007/04/06 20:30:13 ngraf Exp $
+ * @version $Id: MCParticleConverter.java,v 1.10 2007/07/25 21:36:05 ngraf Exp $
*/
class MCParticleConverter implements HepRepCollectionConverter
{
@@ -65,11 +65,14 @@
HepRepType neutralType = factory.createHepRepType(typeX, "Neutral");
neutralType.addAttValue("color",Color.ORANGE);
- HepRepType photonType = factory.createHepRepType(typeX, "Photon");
+ HepRepType photonType = factory.createHepRepType(neutralType, "Photon");
photonType.addAttValue("color",Color.YELLOW);
- HepRepType neutrinoType = factory.createHepRepType(typeX, "Neutrino");
- neutrinoType.addAttValue("color",Color.GREEN);
+ HepRepType neutrinoType = factory.createHepRepType(neutralType, "Neutrino");
+ neutrinoType.addAttValue("color",Color.ORANGE);
+
+ HepRepType neutralHadronType = factory.createHepRepType(neutralType, "Neutral hadron");
+ neutralHadronType.addAttValue("color",Color.GREEN);
HepRepType chargedType = factory.createHepRepType(typeX, "Charged");
chargedType.addAttValue("color",Color.BLUE);
@@ -111,8 +114,17 @@
if (charge == 0 || field[2] == 0)
{
-
- HepRepInstance instanceX = factory.createHepRepInstance(charge == 0 ? neutral : charged, charge == 0 ? neutralType : chargedType);
+ HepRepInstance instanceX = factory.createHepRepInstance(charged, chargedType);
+ if(charge == 0)
+ {
+ int pdgId = p.getPDGID();
+ //TODO are there nuetral types other than photon, neutrino, and neutral hadron?
+ HepRepType type = neutralHadronType;
+ if(isNeutrino(pdgId)) type = neutrinoType;
+ if(abs(pdgId)==22) type = photonType;
+ instanceX = factory.createHepRepInstance(neutral, type);
+ }
+// HepRepInstance instanceX = factory.createHepRepInstance(charge == 0 ? neutral : charged, charge == 0 ? neutralType : chargedType);
setDefaultAttValues(instanceX,p);
factory.createHepRepPoint(instanceX,start.x(),start.y(),start.z());