26 if(argc == 1)
usage();
30 bool detKnown =
false;
33 int tgt_run = -1, tgt_subrun = -1, tgt_evt = -1;
35 while(argc >= 1 &&
argv[0][0] ==
'-'){
43 if(
d ==
"fd" ||
d ==
"fardet" ||
d ==
"dune10kt") isFD =
true;
44 else if(
d ==
"pd" ||
d ==
"protodune" ||
d ==
"np04") isFD =
false;
46 std::cout <<
"Unrecognized detector '" <<
d <<
"'" <<
std::endl;
58 std::vector<int> toks;
60 char* ptok = strtok(
argv[1],
":");
62 toks.push_back(atoi(ptok));
63 ptok = strtok(0,
":");
66 if(toks.empty() || toks.size() > 3)
usage();
68 tgt_evt = toks[toks.size()-1];
69 std::cout <<
"Will look for event " << tgt_evt;
71 tgt_subrun = toks[toks.size()-2];
72 std::cout <<
" in subrun " << tgt_subrun;
75 tgt_run = toks[toks.size()-3];
76 std::cout <<
" in run " << tgt_run;
94 std::cout <<
"Must specify at least one input file" <<
std::endl;
98 const std::vector<std::string> filenames(
argv,
argv + argc);
101 if(filenames[0].find(
"dune10kt") != std::string::npos ||
102 filenames[0].find(
"1x2x6") != std::string::npos){
106 else if(filenames[0].find(
"np04") != std::string::npos){
111 std::cout <<
"Unable to auto-detect detector from filename. Please specify it explicitly with -d" <<
std::endl;
115 std::cout <<
"Auto-detected geometry as ";
116 if(isFD) std::cout <<
"far detector";
else std::cout <<
"ProtoDUNE SP";
126 std::string fclConfig =
"#include \"services_dune.fcl\"\n";
129 "@table::dunefd_services\n" 130 "Geometry.GDML: \"dune10kt_v1_1x2x6.gdml\"\n";
135 "@table::protodune_services\n";
139 "BackTrackerService: @erase \n" 140 "PhotonBackTrackerService: @erase \n" 142 "TFileService: @erase \n";
151 std::cout <<
"Filling index of event numbers..." <<
std::endl;
152 std::map<art::EventID, std::pair<long long, long long>> seek_index;
154 seek_index[
evt.eventAuxiliary().eventID()] = std::make_pair(
evt.fileEntry(),
evt.eventEntry());
161 if(tgt_run >= 0 || tgt_subrun >= 0 || tgt_evt >= 0){
162 if((tgt_run >= 0 &&
int(aux.
run()) != tgt_run ) ||
163 (tgt_subrun >= 0 &&
int(aux.
subRun()) != tgt_subrun) ||
164 (tgt_evt >= 0 &&
int(aux.
event()) != tgt_evt )){
171 tgt_run = tgt_subrun = tgt_evt = -1;
174 std::cout <<
"\nDisplaying event " << aux.
run() <<
":" << aux.
subRun() <<
":" << aux.
event() << std::endl <<
std::endl;
186 std::cout <<
"Previous event" <<
std::endl;
194 if(seek_index.find(tgt) == seek_index.end()){
195 std::cout << tgt <<
" not found in event index! Abort." <<
std::endl;
199 while(std::make_pair(
evt.fileEntry(),
evt.eventEntry()) < seek_index[tgt])
evt.next();
200 while(std::make_pair(
evt.fileEntry(),
evt.eventEntry()) > seek_index[tgt])
evt.previous();
213 std::cout <<
"Unrecognized result code " << res.
code <<
"!" <<
std::endl;
SubRunNumber_t subRun() const noexcept
EventNumber_t event() const noexcept
virtual const provider_type * provider() const override
static void load_services(std::string const &config)
RunNumber_t run() const noexcept
std::string GDMLFile() const
Returns the full directory path to the GDML file source.
Description of geometry of one entire detector.
Result serve(const T &evt, const geo::GeometryCore *geom, const detinfo::DetectorPropertiesData &detprop)
QTextStream & endl(QTextStream &s)