Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Particle Class Reference

List of all members.

Detailed Description

A particle, with a name and energy.

Author:
Susanna Butterworth
Version:
Date
2006-07-11 15:14:02 +0100 (Tue, 11 Jul 2006)
Revision
1241

Definition at line 17 of file Particle.java.


Public Member Functions

 Particle ()
 Particle (String desc, double E)
double getEnergy ()
void setEnergy (double e)
String getName ()
String toString ()
void setName (String p)
boolean equals (Object obj)
int hashCode ()

Static Public Attributes

String PROTON = "p"
String ANTIPROTON = "pbar"
String POSITRON = "e+"
String ELECTRON = "e-"
String PHOTON = "gamma"

Private Attributes

double energy
String name
int hashCode_
boolean dirtyHashCode_

Constructor & Destructor Documentation

Particle  ) 
 

Create an empty particle.

Definition at line 54 of file Particle.java.

00054 {}

Particle String  desc,
double  E
 

Create an particle with energy and description.

Definition at line 58 of file Particle.java.

00058                                           {
00059     name=desc;
00060     energy=E;
00061     dirtyHashCode_=true;
00062     }


Member Function Documentation

boolean equals Object  obj  ) 
 

Override the Object equals method. Use the particle name and energy.

Definition at line 90 of file Particle.java.

References Particle.getEnergy(), and Particle.getName().

Referenced by Collision.equals().

00090                                      {
00091 
00092     if (obj==null) { return false; }
00093 
00094     if ( !this.getClass().equals(obj.getClass())  ) { return false; }
00095 
00096     Particle c = (Particle)obj;
00097     return (name.equals(c.getName()) && 
00098             Match.compareDouble(energy,c.getEnergy()));         
00099     }

double getEnergy  ) 
 

Definition at line 64 of file Particle.java.

Referenced by Particle.equals().

00064                              {
00065     return energy;
00066     }

String getName  ) 
 

Definition at line 72 of file Particle.java.

Referenced by Particle.equals(), MCProcessType.getBeams(), MCProcessType.hasPhoton(), and MCProcessType.hasProton().

00072 { return name; }

int hashCode  ) 
 

Definition at line 101 of file Particle.java.

00101                          { 
00102     if (dirtyHashCode_){
00103         hashCode_ = (new Double(energy)).hashCode()+name.hashCode();
00104         dirtyHashCode_=false;
00105     }
00106     return hashCode_; 
00107     }

void setEnergy double  e  ) 
 

Definition at line 68 of file Particle.java.

Referenced by DBManager.fill().

00068                                    {
00069     dirtyHashCode_=true;
00070     energy=e;
00071     }

void setName String  p  ) 
 

Set particle 1

Definition at line 82 of file Particle.java.

Referenced by DBManager.fill().

00082                                  {
00083     dirtyHashCode_=true;
00084     name = p;
00085     }

String toString  ) 
 

Definition at line 75 of file Particle.java.

Referenced by MCProcessType.toString(), and Collision.toString().

00075                             {
00076     return energy+" GeV "+name;
00077     }


Member Data Documentation

String ANTIPROTON = "pbar" [static]
 

Should agree with HepML http://hepforge.cedar.ac.uk/hepml/schemas/particle.xsd

Definition at line 33 of file Particle.java.

boolean dirtyHashCode_ [private]
 

Definition at line 22 of file Particle.java.

String ELECTRON = "e-" [static]
 

Should agree with HepML http://hepforge.cedar.ac.uk/hepml/schemas/particle.xsd

Definition at line 43 of file Particle.java.

double energy [private]
 

Definition at line 19 of file Particle.java.

int hashCode_ [private]
 

Definition at line 21 of file Particle.java.

String name [private]
 

Definition at line 20 of file Particle.java.

String PHOTON = "gamma" [static]
 

Should agree with HepML http://hepforge.cedar.ac.uk/hepml/schemas/particle.xsd

Definition at line 48 of file Particle.java.

String POSITRON = "e+" [static]
 

Should agree with HepML http://hepforge.cedar.ac.uk/hepml/schemas/particle.xsd

Definition at line 38 of file Particle.java.

String PROTON = "p" [static]
 

Should agree with HepML http://hepforge.cedar.ac.uk/hepml/schemas/particle.xsd

Definition at line 28 of file Particle.java.


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007