QwAnalysis
QwEventDisplayTest.cc
Go to the documentation of this file.
1 /*------------------------------------------------------------------------*//*!
2 
3  \file QwEventDisplayTest.cc
4  \ingroup QwTrackingAnl
5 
6  \brief Example code for the event display routines
7 
8  \author Wouter Deconinck; MIT
9  \author Derek Jones; The George Washington University; dwjones@jlab.org
10 
11 *//*-------------------------------------------------------------------------*/
12 //
13 // Standard C and C++ headers
14 #include <iostream>
15 
16 // ROOT headers
17 #include <TApplication.h>
18 
19 // Qweak headers
20 #include "QwOptionsTracking.h"
21 #include "QwLog.h"
22 
23 // Qweak subsystem headers
25 //#include "QwGasElectronMultiplier.h"
26 #include "QwDriftChamberHDC.h"
27 #include "QwDriftChamberVDC.h"
28 #include "QwTriggerScintillator.h"
29 #include "QwMainDetector.h"
30 #include "QwTreeEventBuffer.h"
31 #include "QwEventBuffer.h"
32 
33 // Qweak event display header
34 #include "QwEventDisplay.h"
35 
36 int main (int argc, char* argv[])
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
Load the options for the tracking subsystems.
unsigned int OpenNextFile()
Open the next event file.
Definition of the class that reads simulated QweakSimG4 events.
This is the main executable for the tracking analysis.
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)
A logfile class, based on an identical class in the Hermes analyzer.
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.
int main(int argc, char **argv)
Definition: QwRoot.cc:20
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