QwAnalysis
QwControl Class Reference

#include <QwControl.h>

+ Inheritance diagram for QwControl:
+ Collaboration diagram for QwControl:

Public Member Functions

 QwControl (const char *name, bool=false)
 
virtual ~QwControl ()
 
void Run ()
 
void Start ()
 
void OnlineLoop ()
 
void OfflineLoop ()
 
VQwAnalyzerCreateAnalyzer (const char *name)
 
void SetAnalyzer (VQwAnalyzer *analyzer)
 
VQwDataserverCreateDataserver (const char *name)
 
void SetDataserver (VQwDataserver *dataserver)
 
void SetIsOnline (bool online)
 
bool IsOnline ()
 
void SetIsFinished (bool finished)
 
bool IsFinished ()
 
- Public Member Functions inherited from VQwSystem
 VQwSystem (const char *name)
 
virtual ~VQwSystem ()
 

Private Attributes

TThread * fRunThread
 
VQwAnalyzerfAnalyzer
 
VQwDataserverfDataserver
 
bool fIsOnline
 
bool fIsFinished
 

Detailed Description

Definition at line 12 of file QwControl.h.

Constructor & Destructor Documentation

QwControl::QwControl ( const char *  name,
bool  = false 
)
inline

Definition at line 24 of file QwControl.h.

24 : VQwSystem(name) { };
VQwSystem(const char *name)
Definition: VQwSystem.h:10
virtual QwControl::~QwControl ( )
inlinevirtual

Definition at line 25 of file QwControl.h.

25 { };

Member Function Documentation

VQwAnalyzer * QwControl::CreateAnalyzer ( const char *  name)

Definition at line 119 of file QwControl.cc.

120 {
121  if (strcmp (name, "QwTrackingAnalyzer") == 0) {
122  VQwAnalyzer* analyzer = new QwTrackingAnalyzer (name);
123  return analyzer;
124  }
125  return 0;
126 }
VQwDataserver * QwControl::CreateDataserver ( const char *  name)

Definition at line 140 of file QwControl.cc.

141 {
142  if (strcmp (name, "QwTrackingDataserver") == 0) {
143  VQwDataserver* dataserver = new QwTrackingDataserver (name);
144  return dataserver;
145  }
146  return 0;
147 }
bool QwControl::IsFinished ( )
inline

Definition at line 44 of file QwControl.h.

References fIsFinished.

44 { return fIsFinished; };
bool fIsFinished
Definition: QwControl.h:21
bool QwControl::IsOnline ( )
inline

Definition at line 42 of file QwControl.h.

References fIsOnline.

42 { return fIsOnline; };
bool fIsOnline
Definition: QwControl.h:20
void QwControl::OfflineLoop ( )

Definition at line 97 of file QwControl.cc.

References fAnalyzer, fDataserver, VQwDataserver::GetHitList(), VQwDataserver::NextEvent(), VQwAnalyzer::Process(), and VQwAnalyzer::SetHitList().

Referenced by Run().

98 {
99  // Loop over the offline data sources (ascii files, ntuples from geant)
100 
101  // Setup file name
102 
103  int nEvent = 0; // number of processed events
104  int nEventMax = 10; // maximum number of events
105 
106  while (nEvent < nEventMax) {
107  // Get next event from dataserver
110 
111  // Process this event
112  fAnalyzer->Process();
113 
114  nEvent++;
115  }
116 }
VQwDataserver * fDataserver
Definition: QwControl.h:18
virtual void NextEvent()
Definition: VQwDataserver.h:19
virtual QwHitContainer * GetHitList()
Definition: VQwDataserver.h:24
virtual void Process()
Definition: VQwAnalyzer.h:23
virtual void SetHitList(QwHitContainer *hitlist)
Definition: VQwAnalyzer.h:19
VQwAnalyzer * fAnalyzer
Definition: QwControl.h:17

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwControl::OnlineLoop ( )

Definition at line 85 of file QwControl.cc.

86 {
87  // Loop while online data
88 
89  // Wait until buffer ready
90 
91  // Process event
92 
93  // Finish
94 }
void QwControl::Run ( )

Definition at line 42 of file QwControl.cc.

References fIsFinished, fIsOnline, and OfflineLoop().

Referenced by QwRunThread().

43 {
44  // Run online or offline analysis
45  // Offline handles ascii file(s)
46 
47  gBenchmark = new TBenchmark();
48  gBenchmark->Start("QwControlRunThread");
49 
50  // Set up analysis
51  //fAnalysis->FileConfig (fAnalysisSetup);
52 
53  // Online
54  if (fIsOnline) {
55  // Connect to data stream
56  // if (data stream) data loop;
57 
58  // Offline
59  } else {
60  OfflineLoop();
61  }
62  gBenchmark->Show("QwControlRunThread");
63  fIsFinished = true;
64 }
bool fIsFinished
Definition: QwControl.h:21
bool fIsOnline
Definition: QwControl.h:20
void OfflineLoop()
Definition: QwControl.cc:97

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwControl::SetAnalyzer ( VQwAnalyzer analyzer)

Definition at line 128 of file QwControl.cc.

References fAnalyzer.

129 {
130 // TODO (wdc) Why doesn't this work? (and in SetDataserver below)
131 // if (! analyzer->InheritsFrom("VQwAnalyzer")) {
132 // std::cout << "Error: analysis has to inherit from VQwAnalyzer!" << std::endl;
133 // return;
134 // }
135  fAnalyzer = analyzer;
136  return;
137 }
VQwAnalyzer * fAnalyzer
Definition: QwControl.h:17
void QwControl::SetDataserver ( VQwDataserver dataserver)

Definition at line 149 of file QwControl.cc.

References fDataserver.

150 {
151 // if (! dataserver->InheritsFrom("VQwDataserver")) {
152 // std::cout << "Error: dataserver has to inherit from VQwDataserver!" << std::endl;
153 // return;
154 // }
155  fDataserver = dataserver;
156  return;
157 }
VQwDataserver * fDataserver
Definition: QwControl.h:18
void QwControl::SetIsFinished ( bool  finished)
inline

Definition at line 43 of file QwControl.h.

References fIsFinished.

43 { fIsFinished = finished; };
bool fIsFinished
Definition: QwControl.h:21
void QwControl::SetIsOnline ( bool  online)
inline

Definition at line 41 of file QwControl.h.

References fIsOnline.

41 { fIsOnline = online; };
bool fIsOnline
Definition: QwControl.h:20
void QwControl::Start ( )

Definition at line 67 of file QwControl.cc.

References fRunThread, and QwRunThread().

68 {
69  // Start the analysis thread. This will run in the background
70  // but will produce to occasional warning or info message
71 
72  if (fRunThread) {
73  printf(" Warning...deleting old RunThread and starting new one,\n");
74  fRunThread->Delete();
75  }
76  printf(" Starting new RunThread.\n");
77  fRunThread = new TThread("QwRunThread",
78  (void(*) (void*))&(QwRunThread),
79  (void*) this);
80  fRunThread->Run();
81  return;
82 }
void * QwRunThread(void *)
Definition: QwControl.cc:27
TThread * fRunThread
Definition: QwControl.h:15

+ Here is the call graph for this function:

Field Documentation

VQwAnalyzer* QwControl::fAnalyzer
private

Definition at line 17 of file QwControl.h.

Referenced by OfflineLoop(), and SetAnalyzer().

VQwDataserver* QwControl::fDataserver
private

Definition at line 18 of file QwControl.h.

Referenced by OfflineLoop(), and SetDataserver().

bool QwControl::fIsFinished
private

Definition at line 21 of file QwControl.h.

Referenced by IsFinished(), Run(), and SetIsFinished().

bool QwControl::fIsOnline
private

Definition at line 20 of file QwControl.h.

Referenced by IsOnline(), Run(), and SetIsOnline().

TThread* QwControl::fRunThread
private

Definition at line 15 of file QwControl.h.

Referenced by Start().


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