lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/analysis
diff -u -r1.2 -r1.3
--- Definition.java 10 Jun 2009 17:53:47 -0000 1.2
+++ Definition.java 10 Jun 2009 19:56:51 -0000 1.3
@@ -36,7 +36,7 @@
* the methods.
*
* @author D. Onoprienko
- * @version $Id: Definition.java,v 1.2 2009/06/10 17:53:47 onoprien Exp $
+ * @version $Id: Definition.java,v 1.3 2009/06/10 19:56:51 onoprien Exp $
*/
public class Definition implements IDefinition {
@@ -97,8 +97,12 @@
* it is used as minimum, and symmetric theta range is selected.</dd>
* <dt>"TYPE"</dt> <dd>One ore more <tt>ParticleType</tt> values: only <tt>MCParticles</tt>
* of these types will be selected.</dd>
- * <dt>"PARENT_TYPE"</dt> <dd>One ore more <tt>ParticleType</tt> values: only <tt>MCParticles</tt>
- * whose parent particle belongs to one of the specified types will be selected.</dd>
+ * <dt>"PARENT_TYPE"</dt> <dd>One ore more <tt>ParticleType</tt> values: <tt>MCParticles</tt> are only
+ * selected if all of their parent particles belongs to one of the specified types
+ * (at least one parent must exist for the particle to be selected).</dd>
+ * <dt>"DAUGHTERS_TYPE"</dt> <dd>One ore more <tt>ParticleType</tt> values: <tt>MCParticles</tt> are only
+ * selected if all of their daughter particles belongs to one of the specified types
+ * (at least one daughter must exist for the particle to be selected).</dd>
* <dt>"TRACKABLE"</dt> <dd><tt>boolean</tt> value: if <tt>true</tt> only <tt>MCParticles</tt> that have
* findable tracks, or have daughters and all daughters have findable tracks, will
* be selected. Only applicable to <tt>RecType.PARTICLE</tt>.</dd>
@@ -186,6 +190,16 @@
}
}
+ } else if (name.equalsIgnoreCase("DAUGHTERS_TYPE")) {
+ if (values.length == 0) {
+ cutSet.cut_DaughtersType = null;
+ } else {
+ cutSet.cut_DaughtersType = new HashSet<ParticleType>();
+ for (Object o : values) {
+ cutSet.cut_DaughtersType.add((ParticleType)o);
+ }
+ }
+
} else if (name.equalsIgnoreCase("TRACKABLE")) {
if (type != RecType.PARTICLE) throw new IllegalArgumentException();
cutSet.cut_Tracked = (Boolean) values[0];
@@ -368,6 +382,26 @@
if (cutSet.cut_Type != null && (! cutSet.cut_Type.contains(mcParticle.getType()))) return false;
+ // Parent particle type cut
+
+ if (cutSet.cut_ParentType != null) {
+ List<MCParticle> parents = mcParticle.getParents();
+ if (parents.isEmpty()) return false;
+ for (MCParticle mc : parents) {
+ if (! cutSet.cut_ParentType.contains(mc.getType())) return false;
+ }
+ }
+
+ // Daughter particles type cut
+
+ if (cutSet.cut_DaughtersType != null) {
+ List<MCParticle> daughters = mcParticle.getDaughters();
+ if (daughters.isEmpty()) return false;
+ for (MCParticle mc : daughters) {
+ if (! cutSet.cut_DaughtersType.contains(mc.getType())) return false;
+ }
+ }
+
// Track findable cut
if (type == RecType.PARTICLE && cutSet.cut_Tracked) {
@@ -619,8 +653,7 @@
protected double cut_Pt;
protected int cut_MinTrackerSuperLayers;
protected double cut_ThetaMin, cut_ThetaMax;
- protected Set<ParticleType> cut_Type;
- protected Set<ParticleType> cut_ParentType;
+ protected Set<ParticleType> cut_Type, cut_ParentType, cut_DaughtersType;
protected boolean cut_Tracked;
protected double cut_OriginZ, cut_OriginR;
protected RecType[] cut_Findable, cut_ParentFindable, cut_DaughtersFindable, cut_Found, cut_ParentFound, cut_DaughtersFound;
@@ -632,6 +665,7 @@
cut_ThetaMax = Math.PI;
cut_Type = null;
cut_ParentType = null;
+ cut_DaughtersType = null;
cut_Tracked = false;
cut_OriginZ = Double.NaN;
cut_OriginR = Double.NaN;