1 /* 2 * BaseParticleID.java 3 * 4 * Created on March 24, 2006, 1:21 PM 5 * 6 * $Id: BaseParticleID.java,v 1.1 2006/03/25 00:37:03 ngraf Exp $ 7 */ 8 9 package org.lcsim.event.base; 10 11 import hep.physics.particle.properties.ParticleType; 12 import org.lcsim.event.*; 13 14 /** 15 * 16 * @author Norman Graf 17 */ 18 public class BaseParticleID implements ParticleID 19 { 20 protected ParticleType _type; 21 protected double _likelihood; 22 protected int _algorithmType; 23 protected double[] _algorithmParameters; 24 25 /** Creates a new instance of BaseParticleID */ 26 public BaseParticleID() 27 { 28 } 29 30 /** 31 * Fully qualified constructor 32 * @param type the ParticleType for this ID 33 */ 34 public BaseParticleID(ParticleType type) 35 { 36 _type = type; 37 } 38 39 // include these setters since I don't know what the final inheriting classes will 40 // look like. 41 42 /** 43 * Set the particle type. Note that this overrides the previous type. 44 * @param type The ParticleType of this ID. 45 */ 46 public void setType(ParticleType type) 47 { 48 _type = type; 49 } 50 51 /** 52 * Set the likelihood for this type ID 53 * @param p The likelihood for this identification. 54 */ 55 public void setLikelihood(double p) 56 { 57 _likelihood = p; 58 } 59 60 /** 61 * Set the algorithm type used to make this identification. 62 * @param alg The algorithm type. Not yet defined. 63 */ 64 //TODO define what this is! 65 public void setAlgorithmType(int alg) 66 { 67 _algorithmType = alg; 68 } 69 70 /** 71 * Set the parameters used in the algorithm. 72 * @param pars an array of parameters appropriate for the algorithm typ.e Not yet defined. 73 */ 74 // TODO define what these are! 75 public void setParameters(double[] pars) 76 { 77 _algorithmParameters = pars; 78 } 79 80 81 // ParticleID interface 82 83 /** 84 * return the algorithm type. 85 * @return currently returns 0. not yet defined. 86 */ 87 // TODO define what this is! 88 public int getType() 89 { 90 return 0; 91 } 92 93 /** 94 * The PDG code of this id - UnknownPDG ( 999999 ) if unknown. 95 * @return the Particle Data Group id for this particle type. 96 */ 97 public int getPDG() 98 { 99 if(_type==null) 100 { 101 return UnknownPDG; 102 } 103 else 104 { 105 return _type.getPDGID(); 106 } 107 } 108 109 /** 110 * The likelihood of this hypothesis - in a user defined normalization. 111 * @return The likelihood for this particle identification 112 */ 113 public double getLikelihood() 114 { 115 return _likelihood; 116 } 117 118 /** 119 * Type of the algorithm/module that created this hypothesis. 120 * Check/set collection parameters PIDAlgorithmTypeName and PIDAlgorithmTypeID. 121 * @return the algorithm type. 122 */ 123 public int getAlgorithmType() 124 { 125 return _algorithmType; 126 } 127 128 /** 129 * Parameters associated with this hypothesis. 130 * Check/set collection parameter PIDParameterNames for decoding the indices. 131 * @return the list of parameters for the algorithm used in identifying this particle. 132 */ 133 public double[] getParameters() 134 { 135 return _algorithmParameters; 136 } 137 }