CEDRIC  Revision_backup-2009-02
PID.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright (C) 2008 Boris Iven, Max Hermann
4  *
5  * This file is part of the "CEDRIC Event Display" application.
6  *
7  *****************************************************************************/
8 
9 #ifndef PID_H
10 #define PID_H
11 
12 #include <QString>
13 
14 #include <osg/Vec3>
15 #include <osg/Vec4>
16 
17 #include <map>
18 
19 
20 class PID
21 {
22 public:
23  static osg::Vec4 getColor( int pid );
24  static QString getName ( int pid );
25 
26 private:
27  struct PIDInfo
28  {
29  QString name;
30  osg::Vec3 color;
31 
32  // Default QString and osg::Vec3 operator== overloadings are the right ones,
33  // so there is no need for own implementation.
34 
36  PIDInfo(): name("default"), color(1,1,0)
37  {}
38 
40  PIDInfo( int index ): name(QString::number(index)), color(0,0,0)
41  {}
42 
44  PIDInfo( QString name_, osg::Vec3 color_=osg::Vec3(1,1,1) ): name(name_), color(color_)
45  {}
46  };
47 
48  std::map<int, PIDInfo> m_PIDMap;
49 
50  struct GEANT3_TableEntry
51  { int id; std::string name; int options; double mass; double charge; double lifetime; };
52 
53  static GEANT3_TableEntry s_GEANT3_Table[];
54 
55 
58 public:
59  static PID& ref() { static PID singleton; return singleton; }
60 private:
61  PID();
62  ~PID() {}
63  PID( const PID& /*singleton*/ ) {}
64  PID& operator = ( const PID& /*singleton*/ ) { return *this; }
66 };
67 
68 #endif
static PID & ref()
Definition: PID.h:59
Definition: PID.h:20
static QString getName(int pid)
Definition: PID.cpp:76
static osg::Vec4 getColor(int pid)
Definition: PID.cpp:71