CEDRIC  Revision_backup-2009-02
VisTrackDetectors.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 VISTRACKDETECTORS_H
10 #define VISTRACKDETECTORS_H
11 
12 #include "FilterVis.h"
13 #include "PhastInterface.h"
14 #include "PhastNode.h"
15 #include <Phast.h>
16 
17 #include <iostream>
18 
20 {
21 public:
22  VisTrackDetectors( int mode, int trackId )
23  : FilterVis(mode), m_trackId(trackId)
24  {
25  //~ std::cout << "VisTrackDetectors " << this << " created for trackID " << m_trackId << std::endl;
26  }
27 
28  void filter( PhastScene* scene, std::list<PhastNode*>& nodes )
29  {
30  const PaEvent& event = PhastInterface::ref().phast()->event;
31  const PaSetup& setup = PhastInterface::ref().phast()->setup;
32  const PaTrack& track = event.vTrack( m_trackId );
33 
34  #if 1 // -- get detector names directly from PaSetup object
35  for( int i=0; i < setup.NDetectors(); ++i )
36  {
37  const PaDetect& det = setup.Detector(i);
38  if( track.NHitsFoundInDetect( det.Name() ) > 0 )
39  nodes.push_back( scene->getDetector( det.Name() ) );
40  }
41  #else // -- first attempt, get detector names via PhastInterface comfort getter (broken?)
42  std::list<std::string> detNames;
44  std::list<std::string>::iterator it;
45  for( it = detNames.begin(); it != detNames.end(); ++it )
46  {
47  if( track.NHitsFoundInDetect( *it ) > 0 )
48  nodes.push_back( scene->getDetector( *it ) );
49  }
50  #endif
51 
52  nodes.push_back( scene->getTrack( m_trackId ) );
53  }
54 
55  virtual bool onParticleSelected( int index )
56  {
57  m_trackId = index;
58  return true;
59  }
60 
61 private:
62  int m_trackId;
63 };
64 
65 #endif
virtual bool onParticleSelected(int index)
Should return true if viewer must be updated afterwards.
Definition: VisTrackDetectors.h:55
PhastNode * getTrack(int id)
Definition: PhastScene.cpp:72
PhastNode * getDetector(std::string name)
Definition: PhastScene.cpp:64
void filter(PhastScene *scene, std::list< PhastNode * > &nodes)
Definition: VisTrackDetectors.h:28
Definition: VisTrackDetectors.h:19
VisTrackDetectors(int mode, int trackId)
Definition: VisTrackDetectors.h:22
int mode()
Definition: FilterVis.h:35
void getDetectorNames(std::list< std::string > &names) const
Fill a list with all detector names.
Definition: PhastInterface.cpp:32
Phast * phast()
Definition: PhastInterface.h:44
Scenegraph holding static and dynamic Phast geometry.
Definition: PhastScene.h:32
static PhastInterface & ref()
Definition: PhastInterface.h:62
Definition: FilterVis.h:16