CMS 3D CMS Logo

VisG4TracksTwig Class Reference

#include <VisSimulation/VisSimBase/interface/VisG4TracksTwig.h>

Inheritance diagram for VisG4TracksTwig:

VisQueuedTwig Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const EndOfEvent * > Observer< const G4Step * > IgSimpleTwig VisEventObserver IgCompoundTwig IgTwig IgRepresentable

List of all members.

Public Types

enum  { CHARGE = 0, PARTICLE = 1 }
enum  { CHARGED = 1, NEUTRAL = 0 }

Public Member Functions

G4TrajectoryContainer * trajectories (void) const
virtual void update (IgTextRep *rep)
 VisG4TracksTwig (IgState *state, IgTwig *parent)

Protected Member Functions

virtual void update (const G4Step *step)
 This routine will be called when the appropriate signal arrives.
virtual void update (const EndOfEvent *event)
 This routine will be called when the appropriate signal arrives.
virtual void update (const BeginOfTrack *track)
 This routine will be called when the appropriate signal arrives.
virtual void update (const BeginOfEvent *event)
 This routine will be called when the appropriate signal arrives.

Private Attributes

G4TrajectoryContainer * m_trajectories


Detailed Description

Definition at line 25 of file VisG4TracksTwig.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
CHARGE 
PARTICLE 

Definition at line 34 of file VisG4TracksTwig.h.

00034 { CHARGE = 0, PARTICLE = 1 };

anonymous enum

Enumerator:
CHARGED 
NEUTRAL 

Definition at line 35 of file VisG4TracksTwig.h.

00035 { CHARGED = 1, NEUTRAL = 0 };


Constructor & Destructor Documentation

VisG4TracksTwig::VisG4TracksTwig ( IgState state,
IgTwig parent 
)

Definition at line 24 of file VisG4TracksTwig.cc.

References CHARGE, CHARGED, IgSimpleTwig::IgSimpleTwig(), NEUTRAL, and PARTICLE.

00025     : VisQueuedTwig (state, parent, "Tracks"),
00026       m_trajectories (new G4TrajectoryContainer)
00027 {
00028     // FIXME: Build contents automatically by track type etc.
00029     // FIXME: create every trajectory as a sub-IgRepresentable (non-twig!)
00030     // so they all become individually selectable.
00031 //     Observer<const BeginOfEvent *>::init ();
00032 //     Observer<const BeginOfTrack *>::init ();
00033 //     Observer<const BeginOfStep *>::init ();
00034 //     Observer<const EndOfEvent *>::init ();
00035 
00036     static const unsigned MAT_ELECTRON  = 0x00ff0000; // green
00037     static const unsigned MAT_MUON      = 0xff000000; // red
00038     static const unsigned MAT_PION      = 0x0000ff00; // blue
00039     static const unsigned MAT_GAMMA     = 0xffffdd00; // yellow
00040     static const unsigned MAT_OTHER     = 0x00ffff00; // cyan
00041     static const unsigned MAT_ALL       = 0xff00ff00; // magenta
00042 
00043     static const int      idElectron [] = { PARTICLE, 2, 11, -11 };
00044     static const int      idMuon []     = { PARTICLE, 2, 13, -13 };
00045     static const int      idPiPlus []   = { PARTICLE, 2, 211, -211 };
00046     static const int      idPiZero []   = { PARTICLE, 1, 111 };
00047     static const int      idGamma []    = { PARTICLE, 1, 22 };
00048     static const int      idCharged []  = { CHARGE, CHARGED,
00049                                            -PARTICLE, 8,
00050                                            11, -11, 13, -13,
00051                                            211, -211, 111, 22 };
00052     static const int      idNeutral []  = { CHARGE, NEUTRAL,
00053                                            -PARTICLE, 8,
00054                                            11, -11, 13, -13,
00055                                            211, -211, 111, 22 };
00056     static const int      idAll []      = { -PARTICLE, 0 };
00057 
00058     // High pT track selections, in pure colours
00059     IgTwig *highpt = new IgSimpleTwig (this, "High Momentum");
00060     new VisG4TrackPtTwig (state, highpt, "Electrons", MAT_ELECTRON, true, this, idElectron);
00061     new VisG4TrackPtTwig (state, highpt, "Muons", MAT_MUON, true, this, idMuon);
00062     new VisG4TrackPtTwig (state, highpt, "Pi+/-", MAT_PION, true, this, idPiPlus);
00063     new VisG4TrackPtTwig (state, highpt, "Pi0", MAT_PION, true, this, idPiZero);
00064     new VisG4TrackPtTwig (state, highpt, "Gammas", MAT_GAMMA, true, this, idGamma);
00065     new VisG4TrackPtTwig (state, highpt, "Other Charged", MAT_OTHER, true, this, idCharged);
00066     new VisG4TrackPtTwig (state, highpt, "Other Neutral", MAT_OTHER, true, this, idNeutral);
00067     new VisG4TrackPtTwig (state, highpt, "All", MAT_ALL, true, this, idAll);
00068 
00069     // Low pT track selections
00070     IgTwig *lowpt = new IgSimpleTwig (this, "Low Momentum");
00071     new VisG4TrackPtTwig (state, lowpt, "Electrons", MAT_ELECTRON, false, this, idElectron);
00072     new VisG4TrackPtTwig (state, lowpt, "Muons", MAT_MUON, false, this, idMuon);
00073     new VisG4TrackPtTwig (state, lowpt, "Pi+/-", MAT_PION, false, this, idPiPlus);
00074     new VisG4TrackPtTwig (state, lowpt, "Pi0", MAT_PION, false, this, idPiZero);
00075     new VisG4TrackPtTwig (state, lowpt, "Gammas", MAT_GAMMA, false, this, idGamma);
00076     new VisG4TrackPtTwig (state, lowpt, "Other Charged", MAT_OTHER, false, this, idCharged);
00077     new VisG4TrackPtTwig (state, lowpt, "Other Neutral", MAT_OTHER, false, this, idNeutral);
00078     new VisG4TrackPtTwig (state, lowpt, "All", MAT_ALL, false, this, idAll);
00079 }


Member Function Documentation

G4TrajectoryContainer * VisG4TracksTwig::trajectories ( void   )  const [inline]

Definition at line 62 of file VisG4TracksTwig.h.

References m_trajectories.

Referenced by VisG4TrackPtTwig::update().

00063 { return m_trajectories; }

void VisG4TracksTwig::update ( const G4Step *   )  [protected, virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 151 of file VisG4TracksTwig.cc.

References ASSERT, lastTrack, and m_trajectories.

00152 {
00153     // Add a trajectory from this track
00154     ASSERT (step);
00155     ASSERT (step->GetTrack () == lastTrack);
00156     ASSERT (! m_trajectories->GetVector ()->empty ());
00157     m_trajectories->GetVector ()->back ()->AppendStep (step);
00158 }

void VisG4TracksTwig::update ( const EndOfEvent  )  [protected, virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 161 of file VisG4TracksTwig.cc.

References IgRepSet::invalidate(), IgTwig::SELF_MASK, and IgTwig::STRUCTURE_MASK.

00162 {
00163     // Make sure we get called the next time too.
00164     // Observer<const EndOfEvent *>::dispatcher ()->renew (this);
00165 
00166     // Invalidate myself and all children.
00167     qApp->lock ();
00168     IgRepSet::invalidate (this, SELF_MASK | STRUCTURE_MASK);
00169     qApp->unlock ();
00170 }

void VisG4TracksTwig::update ( const BeginOfTrack  )  [protected, virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 125 of file VisG4TracksTwig.cc.

References lastTrack, and m_trajectories.

00126 {
00127     // Make sure we get called the next time too.
00128     // Observer<const BeginOfTrack *>::dispatcher ()->renew (this);
00129 
00130     // Add a trajectory from this track
00131     lastTrack = (*track) ();
00132     m_trajectories->insert (new G4Trajectory ((*track) ()));
00133 }

void VisG4TracksTwig::update ( const BeginOfEvent  )  [protected, virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 112 of file VisG4TracksTwig.cc.

References m_trajectories.

00113 {
00114     // Make sure we get called the next time too.
00115     // Observer<const BeginOfEvent *>::dispatcher ()->renew (this);
00116 
00117     // Prepare trajectory container (FIXME: kill trajectories?)
00118     delete m_trajectories;
00119     m_trajectories = new G4TrajectoryContainer;
00120 }

void VisG4TracksTwig::update ( IgTextRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 82 of file VisG4TracksTwig.cc.

References m_trajectories, IgTextRep::setText(), and VisQueuedTwig::update().

00083 {
00084     // Get debugging dump.
00085     VisQueuedTwig::update (rep);
00086     
00087     // Prepare property description.
00088     std::ostringstream text;
00089     switch (m_trajectories->entries ())
00090     {
00091     case 0:
00092         text << "<p>No trajectories</p>";
00093         break;
00094 
00095     case 1:
00096         text << "<p>1 trajectory</p>";
00097         break;
00098 
00099     default:
00100         text << "<p>" << m_trajectories->entries () << " trajectories</p>";
00101         break;
00102     }
00103     text << '\0';
00104 
00105     // Send it over.
00106     qApp->lock ();
00107     rep->setText (text.str ());
00108     qApp->unlock (false);
00109 }


Member Data Documentation

G4TrajectoryContainer* VisG4TracksTwig::m_trajectories [private]

Definition at line 55 of file VisG4TracksTwig.h.

Referenced by trajectories(), and update().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:25 2009 for CMSSW by  doxygen 1.5.4