#include <Ig_Extensions/IgOpenInventor/interface/IgParticleChar.hpp>
Public Member Functions | |
float | getCharge () const |
accessor for the charge of the particle | |
int | getGeantCode () const |
int | getIsajetCode () const |
float | getMass () const |
accessor for the mass of the particle (GeV/c^2) | |
SoMaterial * | getMaterial () const |
accessor for the SoMaterial used to represent the particle | |
const char * | getName () const |
gets the pretty (long) name of the particle | |
int | getPythiaCode () const |
SoDrawStyle * | getStyle () const |
accessor for the SoDrawStyle used to represent the particle | |
IgParticleChar (int geantCode, int pythiaCode, int isaCode, const char *name, const char *label, float mass, float charge) | |
create a particleChar with the given characteristics | |
void | setMaterial (SoMaterial *particleMaterial) |
sets the SoMaterial used when drawing a particle of this type | |
void | setStyle (SoDrawStyle *particleStyle) |
sets the SoStyle used when drawing a particle of this type | |
Static Public Member Functions | |
static void | deleteParticles () |
zero out the internal database of the standard particle set | |
static void | dumpDB (std::ostream &os) |
print out the entire database | |
static IgParticleChar * | getByGeantID (const int p_code) |
accessor for GEANT code: note that this is not guaranteed to be unique | |
static IgParticleChar * | getByIsajetID (const int p_code) |
method to look up a ParticleChar by ISAJET id | |
static IgParticleChar * | getByName (const char *string) |
method to look up a ParticleChar by name | |
static IgParticleChar * | getByPythiaID (const int p_code) |
method to look up a ParticleChar by PYTHIA id | |
static void | initParticles () |
initialise the internal database with the standard particle set | |
Protected Member Functions | |
void | print (std::ostream &os) const |
print information | |
Private Types | |
typedef std::map< std::string, IgParticleChar * > | CMapToParticleList |
Private Member Functions | |
~IgParticleChar () | |
Private Attributes | |
const float | charge |
const int | geantCode |
const int | isajetCode |
const SbString | label |
const float | mass |
const SbString | name |
SoMaterial * | particleMaterial |
SoDrawStyle * | particleStyle |
const int | pythiaCode |
Static Private Attributes | |
static SbBool | inited = FALSE |
static CMapToParticleList * | particleList = NULL |
Friends | |
std::ostream & | operator<< (std::ostream &os, const IgParticleChar &pc) |
extractor for output |
This class maintains a small database of standard particle names, masses, charges, Monte Carlo IDs (PYTHIA, ISAJET, GEANT), as well as the OpenInventor characteristics which could be used to represent pure particle tracks: material and line type.
Each IgParticleChar maintains both a name and a short tag suitable for use in a display.
The standard particles loaded into the database are: unknown, antiunknown, electron, positron, muon, antimuon, proton, antiproton, neutron, antineutron, pion, antipion, deuteron, tritium, alpha, and he3. Particles are taken to have negative charge, anti-particles have positive.
Note that several "particles" may have the same code: GEANT only has one neutrino type while Isajet and Pythia have the full set.
Definition at line 41 of file IgParticleChar.h.
typedef std::map< std::string, IgParticleChar*> IgParticleChar::CMapToParticleList [private] |
Definition at line 91 of file IgParticleChar.h.
IgParticleChar::IgParticleChar | ( | int | geantCode, | |
int | pythiaCode, | |||
int | isaCode, | |||
const char * | name, | |||
const char * | label, | |||
float | mass, | |||
float | charge | |||
) |
create a particleChar with the given characteristics
Definition at line 26 of file IgParticleChar.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), name, particleList, and parsecf::pyparsing::test().
Referenced by initParticles().
00028 : geantCode (g), 00029 pythiaCode (p), 00030 isajetCode (isa), 00031 name (nm), 00032 label (lbl), 00033 mass (mas), 00034 charge (q) 00035 { 00036 std::pair< CMapToParticleList::iterator, bool > test; 00037 test = particleList->insert (CMapToParticleList::value_type (std::string (nm), this)); 00038 if (!test.second) 00039 { 00040 std::cout << "IgParticleChar: error creating particle " << name.getString () << std::endl; 00041 } 00042 }
IgParticleChar::~IgParticleChar | ( | ) | [private] |
Definition at line 75 of file IgParticleChar.cc.
References NULL, particleMaterial, and particleStyle.
00076 { 00077 particleMaterial->unref (); 00078 particleMaterial = NULL; 00079 particleStyle->unref (); 00080 particleStyle = NULL; 00081 }
void IgParticleChar::deleteParticles | ( | ) | [static] |
zero out the internal database of the standard particle set
method to remove a particle from the database
Definition at line 187 of file IgParticleChar.cc.
void IgParticleChar::dumpDB | ( | std::ostream & | os | ) | [static] |
print out the entire database
dump the entire internal database
Definition at line 245 of file IgParticleChar.cc.
References lat::endl(), it, and particleList.
00246 { 00247 os << "Dumping the ParticleChar Database..." << std::endl; 00248 for (CMapToParticleList::const_iterator it=particleList->begin (); it != particleList->end (); it++) 00249 { 00250 os << it->first << std::endl; 00251 if (it->second) os << *it->second; 00252 } 00253 }
IgParticleChar * IgParticleChar::getByGeantID | ( | const int | p_code | ) | [static] |
accessor for GEANT code: note that this is not guaranteed to be unique
method to look up a ParticleChar by GEANT id
Definition at line 200 of file IgParticleChar.cc.
References geantCode, getByName(), i, and particleList.
Referenced by IgSoIdealTrack::initialise().
00201 { 00202 CMapToParticleList::const_iterator i = particleList->begin (); 00203 for (i = particleList->begin (); i != particleList->end (); i++) 00204 { 00205 IgParticleChar* pChar = i->second; 00206 if (pChar->geantCode == p_code) 00207 return pChar; 00208 } 00209 // nothing found 00210 return getByName ("unknown"); 00211 }
IgParticleChar * IgParticleChar::getByIsajetID | ( | const int | p_code | ) | [static] |
method to look up a ParticleChar by ISAJET id
Definition at line 230 of file IgParticleChar.cc.
References getByName(), i, isajetCode, and particleList.
00231 { 00232 CMapToParticleList::const_iterator i = particleList->begin (); 00233 for (i = particleList->begin (); i != particleList->end (); i++) 00234 { 00235 IgParticleChar* pChar = i->second; 00236 if (pChar->isajetCode == p_code) 00237 return pChar; 00238 } 00239 // nothing found 00240 return getByName ("unknown"); 00241 }
IgParticleChar * IgParticleChar::getByName | ( | const char * | string | ) | [static] |
method to look up a ParticleChar by name
Definition at line 192 of file IgParticleChar.cc.
References it, and particleList.
Referenced by getByGeantID(), getByIsajetID(), getByPythiaID(), VisTrackTwig::update(), VisTkIdealHelixTracksTwig::update(), VisTrackingParticleTwig::update(), VisMuonTwig::update(), and VisSimTrackTwig::update().
00193 { 00194 CMapToParticleList::iterator it = particleList->find (string); 00195 return it != particleList->end () ? it->second : 0; 00196 }
IgParticleChar * IgParticleChar::getByPythiaID | ( | const int | p_code | ) | [static] |
method to look up a ParticleChar by PYTHIA id
Definition at line 215 of file IgParticleChar.cc.
References getByName(), i, particleList, and pythiaCode.
00216 { 00217 CMapToParticleList::const_iterator i = particleList->begin (); 00218 for (i = particleList->begin (); i != particleList->end (); i++) 00219 { 00220 IgParticleChar* pChar = i->second; 00221 if (pChar->pythiaCode == p_code) 00222 return pChar; 00223 } 00224 // nothing found 00225 return getByName ("unknown"); 00226 }
float IgParticleChar::getCharge | ( | ) | const |
accessor for the charge of the particle
Definition at line 67 of file IgParticleChar.cc.
References charge.
Referenced by IgSoIdealTrack::initialise().
00068 { return charge; }
int IgParticleChar::getGeantCode | ( | ) | const [inline] |
int IgParticleChar::getIsajetCode | ( | ) | const |
float IgParticleChar::getMass | ( | ) | const |
accessor for the mass of the particle (GeV/c^2)
Definition at line 62 of file IgParticleChar.cc.
References mass.
Referenced by IgSoIdealTrack::angleToTime(), IgSoIdealTrack::initEndPts(), IgSoIdealTrack::timeToAngle(), IgSoIdealTrack::timeToXY(), IgSoIdealTrack::timeToZ(), and IgSoIdealTrack::zToTime().
00063 { return mass; }
SoMaterial * IgParticleChar::getMaterial | ( | ) | const [inline] |
accessor for the SoMaterial used to represent the particle
Definition at line 114 of file IgParticleChar.h.
References particleMaterial.
Referenced by IgSoIdealTrack::refresh().
00115 { return particleMaterial; }
const char * IgParticleChar::getName | ( | void | ) | const |
gets the pretty (long) name of the particle
accessor for the name of the particle
Definition at line 72 of file IgParticleChar.cc.
References name.
Referenced by IgSoIdealTrack::initialise().
00073 { return name.getString (); }
int IgParticleChar::getPythiaCode | ( | ) | const |
SoDrawStyle * IgParticleChar::getStyle | ( | ) | const [inline] |
accessor for the SoDrawStyle used to represent the particle
Definition at line 118 of file IgParticleChar.h.
References particleStyle.
Referenced by IgSoIdealTrack::refresh().
00119 { return particleStyle; }
void IgParticleChar::initParticles | ( | ) | [static] |
initialise the internal database with the standard particle set
method to initialize the database with the standard particle set
Definition at line 85 of file IgParticleChar.cc.
References charge, metsig::electron, i, IgParticleChar(), inited, metsig::muon, particleList, setMaterial(), setStyle(), TRUE, and edm::productstatus::unknown().
Referenced by IgSoIdealTrack::initClass(), initNodes(), and initShapes().
00086 { 00087 if (inited) 00088 return; 00089 00090 inited = TRUE; 00091 particleList = new CMapToParticleList (); 00092 IgParticleChar* unknown = new IgParticleChar (-1, 0, 0, "unknown", "unk-", 1.0F, -1.0F); 00093 IgParticleChar* antiunknown = new IgParticleChar (-1, 0, 0, "antiunknown", "unk+", 1.0F, +1.0F); 00094 new IgParticleChar (-1, 0, 0, "neutralunknown", "unk0", 1.0F, +0.0F); 00095 IgParticleChar* electron = new IgParticleChar (3, 11, 12, "electron", "e-", 0.000510999F, -1.0F); 00096 IgParticleChar* positron = new IgParticleChar (2, -11, -12, "positron", "e+", 0.000510999F, +1.0F); 00097 IgParticleChar* muon = new IgParticleChar (6, 13, 14, "muon", "mu-", 0.105658F, -1.0F); 00098 IgParticleChar* antimuon = new IgParticleChar (5, -13, -14, "antimuon", "mu+", 0.105658F, +1.0F); 00099 IgParticleChar* proton = new IgParticleChar (14, 2212, 1120, "proton", "p", 0.9382723F, 1.0F); 00100 IgParticleChar* antiproton = new IgParticleChar (15, -2212, -1120, "antiproton", "pbar", 0.9382723F, -1.0F); 00101 new IgParticleChar (1, 22, 0, "gamma", "gamma", 0.0000E+00F, 0.0F); 00102 new IgParticleChar (4, 12, 11, "eneutrino", "eneu", 0.F, 0.0F); 00103 new IgParticleChar (4, 14, 13, "muneutrino", "muneu", 0.F, 0.0F); 00104 new IgParticleChar (4, 16, 15, "tauneutrino","tauneu", 0.F, 0.0F); 00105 new IgParticleChar (4, -12, -11, "antieneutrino","eneubar", 0.F, 0.0F); 00106 new IgParticleChar (4, -14, -13, "antimuneutrino","muneubar", 0.F, 0.0F); 00107 new IgParticleChar (4, -16, -15, "antitauneutrino","tauneubar", 0.F, 0.0F); 00108 new IgParticleChar (13, 2112, 1220, "neutron", "n", 0.939566F, 0.0F); 00109 new IgParticleChar (25, -2112, -1220, "antineutron", "nbar", 0.939566F, 0.0F); 00110 IgParticleChar* pion = new IgParticleChar (9, -211, -120, "pion", "pi-", 0.139567F, -1.0F); 00111 IgParticleChar* antipion = new IgParticleChar (8, 211, 120, "antipion", "pi+", 0.139567F, +1.0F); 00112 new IgParticleChar (45, 0, 0, "deuteron", "d", 1.875613F, 1.0F); 00113 new IgParticleChar (46, 0, 0, "tritium", "tritium", 2.80925F, 1.0F); 00114 new IgParticleChar (47, 0, 0, "alpha", "alpha", 3.727417F, 2.0F); 00115 new IgParticleChar (49, 0, 0, "he3", "he3", 2.80923F, 2.0F); 00116 IgParticleChar* kplus = new IgParticleChar (11, 321, 130, "kplus", "k+", 0.493677F, +1.0F); 00117 IgParticleChar* kminus = new IgParticleChar (12, -321, -130, "kminus", "k-", 0.493677F, -1.0F); 00118 new IgParticleChar (10, 130, -20, "klong", "k0l", 0.497672F, 0.F); 00119 new IgParticleChar (16, 310, 20, "kshort", "k0s", 0.497672F, 0.F); 00120 IgParticleChar* ximinus = new IgParticleChar (11, 3312, 2330, "ximinus", "Xi-", 1.32132F, -1.0F); 00121 00122 SoDrawStyle* curveStyle = new SoDrawStyle (); 00123 curveStyle->lineWidth = 1.0; 00124 curveStyle->pointSize = 4; 00125 SoDrawStyle* dottedCurveStyle = new SoDrawStyle (); 00126 dottedCurveStyle->lineWidth = 1.0; 00127 dottedCurveStyle->pointSize = 4; 00128 dottedCurveStyle->linePattern = 0xff00; // bitmask: solid is 0xffff; 00129 SoMaterial* curveColour = new SoMaterial (); 00130 curveColour->diffuseColor.setValue (0.4F, 0.4F, 0.4F); 00131 00132 CMapToParticleList::const_iterator i = particleList->begin (); 00133 for (i = particleList->begin (); i != particleList->end (); i++) 00134 { 00135 IgParticleChar* pChar = i->second; 00136 pChar-> setMaterial (curveColour); 00137 if ( pChar->charge == 0 ) 00138 { 00139 pChar->setStyle (dottedCurveStyle); 00140 } 00141 else 00142 { 00143 pChar-> setStyle (curveStyle); 00144 } 00145 } 00146 00147 // set particle-specific values: colour and line style 00148 00149 curveColour = new SoMaterial (); 00150 curveColour->diffuseColor.setValue (1.0, 0.0, 0.0); 00151 muon->setMaterial (curveColour); 00152 antimuon->setMaterial (curveColour); 00153 00154 curveColour = new SoMaterial (); 00155 curveColour->diffuseColor.setValue (0.0, 1.0, 0.0); 00156 electron->setMaterial (curveColour); 00157 positron->setMaterial (curveColour); 00158 00159 curveColour = new SoMaterial (); 00160 curveColour->diffuseColor.setValue (0.0, 0.0, 1.0); 00161 pion->setMaterial (curveColour); 00162 antipion->setMaterial (curveColour); 00163 00164 curveColour = new SoMaterial (); 00165 curveColour->diffuseColor.setValue (0.5, 0.5, 0.0); 00166 proton->setMaterial (curveColour); 00167 00168 curveColour = new SoMaterial (); 00169 curveColour->diffuseColor.setValue (0.45F, 0.55F, 0.0F); 00170 antiproton->setMaterial (curveColour); 00171 00172 curveColour = new SoMaterial (); 00173 curveColour->diffuseColor.setValue (0.2F, 0.2F, 0.2F); 00174 unknown->setMaterial (curveColour); 00175 antiunknown->setMaterial (curveColour); 00176 00177 curveColour = new SoMaterial (); 00178 curveColour->diffuseColor.setValue (0.0, 0.65F, 0.65F); 00179 kplus->setMaterial (curveColour); 00180 kminus->setMaterial (curveColour); 00181 ximinus->setMaterial (curveColour); 00182 00183 }
void IgParticleChar::print | ( | std::ostream & | os | ) | const [protected] |
print information
Definition at line 257 of file IgParticleChar.cc.
References charge, lat::endl(), label, mass, and name.
Referenced by operator<<().
00258 { 00259 os << "Particle: " << name.getString () 00260 << ", Label: " << label.getString () 00261 << ", Charge: " << charge 00262 << ", Mass: " << mass << std::endl; 00263 }
void IgParticleChar::setMaterial | ( | SoMaterial * | particleMaterial | ) |
sets the SoMaterial used when drawing a particle of this type
set the SoMaterial used to represent the particle
Definition at line 46 of file IgParticleChar.cc.
References particleMaterial.
Referenced by initParticles().
00047 { 00048 particleMaterial = m; 00049 m->ref (); 00050 }
void IgParticleChar::setStyle | ( | SoDrawStyle * | particleStyle | ) |
sets the SoStyle used when drawing a particle of this type
set the SoDrawStyle used to represent the particle
Definition at line 54 of file IgParticleChar.cc.
References particleStyle.
Referenced by initParticles().
00055 { 00056 particleStyle = s; 00057 s->ref (); 00058 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const IgParticleChar & | pc | |||
) | [friend] |
extractor for output
Definition at line 122 of file IgParticleChar.h.
00123 { 00124 pc.print (os); 00125 return os; 00126 }
const float IgParticleChar::charge [private] |
Definition at line 101 of file IgParticleChar.h.
Referenced by getCharge(), initParticles(), and print().
const int IgParticleChar::geantCode [private] |
SbBool IgParticleChar::inited = FALSE [static, private] |
const int IgParticleChar::isajetCode [private] |
const SbString IgParticleChar::label [private] |
const float IgParticleChar::mass [private] |
const SbString IgParticleChar::name [private] |
Definition at line 97 of file IgParticleChar.h.
Referenced by getName(), IgParticleChar(), and print().
IgParticleChar::CMapToParticleList * IgParticleChar::particleList = NULL [static, private] |
Definition at line 99 of file IgParticleChar.h.
Referenced by dumpDB(), getByGeantID(), getByIsajetID(), getByName(), getByPythiaID(), IgParticleChar(), and initParticles().
SoMaterial* IgParticleChar::particleMaterial [private] |
Definition at line 95 of file IgParticleChar.h.
Referenced by getMaterial(), setMaterial(), and ~IgParticleChar().
SoDrawStyle* IgParticleChar::particleStyle [private] |
Definition at line 96 of file IgParticleChar.h.
Referenced by getStyle(), setStyle(), and ~IgParticleChar().
const int IgParticleChar::pythiaCode [private] |