26#include "DataLoader.hh"
27#include "EventAnalysisOrbit.hh"
28#include "RBDSException.hh"
30#include "BDSOutputROOTEventHeader.hh"
37 std::cout <<
"usage: rebdsimOrbit <dataFile> <outputfile> <index>" << std::endl;
38 std::cout <<
" <datafile> - root file to operate on ie run1.root" << std::endl;
39 std::cout <<
" <outputfile> - name of output file ie optics.root" << std::endl;
40 std::cout <<
" <index> - index of orbit to pull from file (default 1)" << std::endl;
41 std::cout <<
"This only works on a single file - no wildcards." << std::endl;
44int main(
int argc,
char* argv[])
46 if (argc < 3 || argc >= 5)
52 std::string inputFileName = std::string(argv[1]);
53 std::string outputFileName = std::string(argv[2]);
58 {index = std::stoi(argv[3]);}
66 TFile* outputFile =
new TFile(outputFileName.c_str(),
"RECREATE");
73 TTree* headerTree =
new TTree(
"Header",
"REBDSIM Header");
74 headerTree->Branch(
"Header.",
"BDSOutputROOTEventHeader", headerOut);
80 std::cout <<
"Result written to: " << outputFileName << std::endl;
85 {std::cerr << error.
what() << std::endl;
return 1;}
86 catch (
const std::exception& error)
87 {std::cerr << error.what() << std::endl;
return 1;}
Loader for a ROOT file using classes used to generate the file.
std::vector< std::string > GetFileNames()
Accessor.
Event * GetEvent()
Accessor.
TChain * GetEventTree()
Accessor.
Simple analysis to pull out first hit in each sampler.
void ExtractOrbit(int index)
Extract an orbit from the data.
void WriteOrbit(TFile *f)
Write orbit to a ROOT file.
General exception with possible name of object and message.
const char * what() const noexcept override
Override message in std::exception.