QwAnalysis
QwEventDisplayTest.cc File Reference

Example code for the event display routines. More...

#include <iostream>
#include <TApplication.h>
#include "QwOptionsTracking.h"
#include "QwLog.h"
#include "QwSubsystemArrayTracking.h"
#include "QwDriftChamberHDC.h"
#include "QwDriftChamberVDC.h"
#include "QwTriggerScintillator.h"
#include "QwMainDetector.h"
#include "QwTreeEventBuffer.h"
#include "QwEventBuffer.h"
#include "QwEventDisplay.h"
+ Include dependency graph for QwEventDisplayTest.cc:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Example code for the event display routines.

Author
Wouter Deconinck; MIT
Derek Jones; The George Washington University; dwjon.nosp@m.es@j.nosp@m.lab.o.nosp@m.rg

Definition in file QwEventDisplayTest.cc.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

First, we set the command line arguments and the configuration filename, and we define the options that can be used in them (using QwOptions).

Now we setup the message logging facilities with the requested loglevels.

Fill the search paths for the parameter files

Load the tracking detectors from file

Definition at line 36 of file QwEventDisplayTest.cc.

References QwParameterFile::AppendToSearchPath(), DefineOptionsTracking(), getenv_safe_string(), QwSubsystemArrayTracking::GetGeometry(), QwOptions::GetValue(), gQwLog, gQwOptions, QwOptions::HasValue(), QwLog::InitLogFile(), QwTreeEventBuffer::OpenNextFile(), QwTreeEventBuffer::ProcessOptions(), QwSubsystemArray::ProcessOptions(), QwOptions::SetCommandLine(), QwOptions::SetConfigFile(), QwEventDisplay::SetEventBuffer(), QwLog::SetFileThreshold(), QwLog::SetScreenColor(), QwLog::SetScreenThreshold(), and QwEventDisplay::SetSubsystemArray().

37 {
38  /// First, we set the command line arguments and the configuration filename,
39  /// and we define the options that can be used in them (using QwOptions).
40  gQwOptions.SetCommandLine(argc, argv);
41  gQwOptions.SetConfigFile("qweventdisplay.conf");
42  // Define the command line options
44 
45  /// Now we setup the message logging facilities with the requested loglevels.
46  if (gQwOptions.HasValue("QwLog.logfile"))
47  gQwLog.InitLogFile(gQwOptions.GetValue<string>("QwLog.logfile"));
48  gQwLog.SetFileThreshold(QwLog::QwLogLevel(gQwOptions.GetValue<int>("QwLog.loglevel-file")));
49  gQwLog.SetScreenThreshold(QwLog::QwLogLevel(gQwOptions.GetValue<int>("QwLog.loglevel-screen")));
50  gQwLog.SetScreenColor(gQwOptions.GetValue<bool>("QwLog.color"));
51 
52  /// Fill the search paths for the parameter files
53  QwParameterFile::AppendToSearchPath(getenv_safe_string("QWSCRATCH")+"/setupfiles");
54  QwParameterFile::AppendToSearchPath(getenv_safe_string("QWANALYSIS")+"/Tracking/prminput");
55 
56  /// Load the tracking detectors from file
58  detectors->ProcessOptions(gQwOptions);
59 
60  // Get detector geometry
61  QwGeometry geometry = detectors->GetGeometry();
62 
63 
64  // Load the simulated event file
65  QwTreeEventBuffer *treebuffer = new QwTreeEventBuffer(geometry);
66  treebuffer->ProcessOptions(gQwOptions);
67  treebuffer->OpenNextFile();
68 
69  // Start this application
70  TApplication theApp("QwEventDisplay", &argc, argv);
71 
72  // Create a QwEventDisplay application
73  QwEventDisplay* display = new QwEventDisplay(gClient->GetRoot(),1200,800);
74  display->SetEventBuffer(treebuffer);
75  display->SetSubsystemArray(detectors);
76 
77  // Now run this application
78  theApp.Run();
79 
80  return 0;
81 
82 }
void InitLogFile(const std::string name, const std::ios_base::openmode mode=kAppend)
Initialize the log file with name &#39;name&#39;.
Definition: QwLog.cc:157
static void AppendToSearchPath(const TString &searchdir)
Add a directory to the search path.
Read simulated QweakSimG4 events and generate hit lists.
void SetScreenThreshold(int thr)
Set the screen log level.
Definition: QwLog.cc:178
bool HasValue(const std::string &key)
Has this key been defined.
Definition: QwOptions.h:233
unsigned int OpenNextFile()
Open the next event file.
QwOptions gQwOptions
Definition: QwOptions.cc:27
void ProcessOptions(QwOptions &options)
Process configuration options (default behavior)
void SetSubsystemArray(QwSubsystemArrayTracking *subsystemarray)
T GetValue(const std::string &key)
Get a templated value.
Definition: QwOptions.h:240
void SetScreenColor(bool flag)
Set the screen color mode.
Definition: QwLog.cc:171
void SetFileThreshold(int thr)
Set the file log level.
Definition: QwLog.cc:185
QwLogLevel
Loglevels.
Definition: QwLog.h:93
void SetConfigFile(const std::string &configfile)
Set a configuration file.
Definition: QwOptions.h:192
void SetEventBuffer(QwTreeEventBuffer *eventbuffer)
const QwGeometry GetGeometry()
Get the detector info for all detectors.
const std::string getenv_safe_string(const char *name)
Definition: QwOptions.h:37
Collection of QwDetectorInfo pointers that specifies an experimental geometry.
Definition: QwGeometry.h:27
void ProcessOptions(QwOptions &options)
Process command line and config file options.
void DefineOptionsTracking(QwOptions &options)
QwLog gQwLog
Definition: QwLog.cc:22
void SetCommandLine(int argc, char *argv[], bool default_config_file=true)
Set the command line arguments.
Definition: QwOptions.cc:112

+ Here is the call graph for this function: