31
32
#include "TGClient.h"
34
#include "src/common_cpp/Recon/SciFi/TrackerData.hh"
35
#include "src/common_cpp/Recon/SciFi/TrackerDataManager.hh"
36
#include "src/common_cpp/Recon/SciFi/TrackerDataPlotterBase.hh"
37
#include "src/common_cpp/Recon/SciFi/TrackerDataPlotterSpoints.hh"
38
#include "src/common_cpp/Recon/SciFi/TrackerDataPlotterXYZ.hh"
39
#include "src/common_cpp/Recon/SciFi/TrackerDataPlotterSZ.hh"
40
#include "src/common_cpp/Recon/SciFi/TrackerDataPlotterInfoBox.hh"
35
#include "src/common_cpp/Plotting/SciFi/TrackerData.hh"
36
#include "src/common_cpp/Plotting/SciFi/TrackerDataManager.hh"
37
#include "src/common_cpp/Plotting/SciFi/TrackerDataPlotterBase.hh"
38
#include "src/common_cpp/Plotting/SciFi/TrackerDataPlotterSpoints.hh"
39
#include "src/common_cpp/Plotting/SciFi/TrackerDataPlotterXYZ.hh"
40
#include "src/common_cpp/Plotting/SciFi/TrackerDataPlotterSZ.hh"
41
#include "src/common_cpp/Plotting/SciFi/TrackerDataPlotterInfoBox.hh"
42
43
#include "src/common_cpp/DataStructure/Spill.hh"
43
44
#include "src/common_cpp/DataStructure/Data.hh"
52
53
// First argument to code should be the input ROOT file name
53
54
std::string filename = std::string(argv[1]);
55
// Check if the user wants to pause between evts, indicated by making second argument to code "1"
56
std::string str_pause;
56
// Parse any extra arguments supplied
57
// -p -> pause between spills
58
// -w -> wait for input milliseconds between spills
59
// -g -> enables saving xyz plots and gives output graphics file type
60
// -f -> select the first tree entry to start from
57
61
bool bool_pause = false;
59
std::string s1 = std::string(argv[2]);
60
if (s1 == "1") bool_pause = true;
62
bool bool_save = false;
64
std::string save_type = "";
68
for (int i = 2; i < argc; i++) {
69
if ( std::strcmp(argv[i], "-f") == 0 ) {
71
std::stringstream ss1;
74
std::cout << "Starting from entry: " << start_num << std::endl;
77
if ( std::strcmp(argv[i], "-w") == 0 ) {
79
std::stringstream ss1;
82
std::cout << "Waiting " << wait_time << " milliseconds between events" << std::endl;
85
if ( std::strcmp(argv[i], "-p") == 0 ) {
86
std::cout << "Will wait for user input between spills\n";
88
} else if ( std::strcmp(argv[i], "-g") == 0 ) {
89
if ( (i+1) < argc ) save_type = argv[i + 1];
90
if ( (save_type == "eps") || (save_type == "pdf") || (save_type == "png") ) {
91
std::cout << "Saving plots as " << save_type << " files.\n";
94
std::cerr << "Invalid graphics output type given\n";
64
TApplication theApp("App", &argc, argv);
65
std::cout << "Opening file " << filename << std::endl;
67
irstream infile(filename.c_str(), "Spill");
69
99
// Set up the data manager and plotters
70
100
MAUS::TrackerDataManager tdm;
101
tdm.set_print_tracks(true);
102
tdm.set_print_seeds(true);
71
103
MAUS::TrackerDataPlotterBase *xyzPlotter = new MAUS::TrackerDataPlotterXYZ();
105
xyzPlotter->SetSaveOutput(true);
106
xyzPlotter->SetOutputName("xyzPlotterOutput." + save_type);
72
108
MAUS::TrackerDataPlotterBase *szPlotter = new MAUS::TrackerDataPlotterSZ();
73
109
MAUS::TrackerDataPlotterBase *infoBoxPlotter
74
= new MAUS::TrackerDataPlotterInfoBox(275, 600, 0.585, 0.93);
110
= new MAUS::TrackerDataPlotterInfoBox(300, 750, 0.585, 0.945);
75
111
std::vector<MAUS::TrackerDataPlotterBase*> plotters;
76
112
plotters.push_back(xyzPlotter);
77
113
plotters.push_back(szPlotter);
78
114
plotters.push_back(infoBoxPlotter);
80
// Loop over all events
81
while (infile >> readEvent != NULL) {
116
// Set up ROOT app, input file, and MAUS data class
117
TApplication theApp("App", &argc, argv);
118
std::cout << "Opening file " << filename << std::endl;
119
irstream infile(filename.c_str(), "Spill");
122
// Loop over all spills
123
if (start_num > 0) infile.set_current_event(start_num);
124
while ( infile >> readEvent != NULL ) {
82
125
infile >> branchName("data") >> data;
83
126
MAUS::Spill* spill = data.GetSpill();
84
127
if (spill != NULL && spill->GetDaqEventType() == "physics_event") {