lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/util/job
diff -u -r1.5 -r1.6
--- JobManager.java 1 Feb 2009 19:40:41 -0000 1.5
+++ JobManager.java 18 Feb 2009 03:29:09 -0000 1.6
@@ -27,7 +27,7 @@
* </ul>
*
* @author D. Onoprienko
- * @version $Id: JobManager.java,v 1.5 2009/02/01 19:40:41 onoprien Exp $
+ * @version $Id: JobManager.java,v 1.6 2009/02/18 03:29:09 onoprien Exp $
*/
public class JobManager extends org.lcsim.util.Driver implements ConditionsListener {
@@ -113,7 +113,8 @@
try {
singleton = (T) singletonType.getDeclaredMethod("defaultInstance").invoke(null);
} catch (Exception x) {
- throw new IllegalArgumentException("Singleton of this type does not have default instance, must be registered explicitly",x);
+ throw new IllegalArgumentException("Singleton of type " + singletonType +
+ " does not have default instance, must be registered explicitly",x);
}
put(singleton, singletonType);
}
@@ -124,9 +125,10 @@
* Register a singleton of the specified type.
* If the given object is not an instance of the specified type, <tt>IllegalArgumentException</tt> is thrown.
*/
- public void put(Object singleton, Class type) {
- if (! type.isInstance(singleton)) throw new IllegalArgumentException();
- _singletons.put(type, singleton);
+ public void put(Object singleton, Class singletonType) {
+ if (! singletonType.isInstance(singleton)) throw new IllegalArgumentException();
+ Object previous = _singletons.put(singletonType, singleton);
+ if (previous != null) System.out.println("Replacing previously registered singleton of type "+ singletonType);
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/util/constants
diff -N Particles.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Particles.java 18 Feb 2009 03:29:09 -0000 1.1
@@ -0,0 +1,33 @@
+package org.lcsim.contrib.onoprien.util.constants;
+
+import hep.physics.particle.properties.ParticlePropertyProvider;
+import hep.physics.particle.properties.ParticlePropertyManager;
+import hep.physics.particle.properties.ParticleType;
+
+/**
+ * Frequently used particle types.
+ *
+ * @author D. Onoprienko
+ * @version $Id: Particles.java,v 1.1 2009/02/18 03:29:09 onoprien Exp $
+ */
+public class Particles {
+
+ public static final ParticlePropertyProvider PROVIDER = ParticlePropertyManager.getParticlePropertyProvider();
+
+ public static final ParticleType E_MINUS = PROVIDER.get(11);
+ public static final ParticleType E_PLUS = PROVIDER.get(-11);
+ public static final ParticleType MU_MINUS = PROVIDER.get(13);
+ public static final ParticleType MU_PLUS = PROVIDER.get(-13);
+ public static final ParticleType TAU_MINUS = PROVIDER.get(15);
+ public static final ParticleType TAU_PLUS = PROVIDER.get(-15);
+
+ public static final ParticleType PI_PLUS = PROVIDER.get(211);
+ public static final ParticleType PI_MINUS = PROVIDER.get(-211);
+ public static final ParticleType PI_0 = PROVIDER.get(111);
+ public static final ParticleType K_SHORT = PROVIDER.get(310);
+ public static final ParticleType LAMBDA = PROVIDER.get(3122);
+ public static final ParticleType SIGMA_PLUS = PROVIDER.get(3222);
+ public static final ParticleType SIGMA_MINUS = PROVIDER.get(3112);
+ public static final ParticleType SIGMA_0 = PROVIDER.get(3212);
+
+}