133 JParser<> zap(
"Example program to select events from DST files.");
136 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
138 "<run> <frame index> <trigger counter>"\
139 " (one header line)") =
"";
145 catch(
const exception &error) {
146 FATAL(error.what() << endl);
149 gErrorIgnoreLevel = kFatal;
155 if (selectFile !=
"") {
157 ifstream
in(selectFile.c_str());
159 in.ignore(numeric_limits<streamsize>::max(),
'\n');
161 for (JTag tag;
in >> tag; ) {
162 selection.insert(tag);
168 TFile* out = TFile::Open(
outputFile.c_str(),
"CREATE");
170 if (out == NULL || ! out->IsOpen()) {
179 TFile*
in = TFile::Open(file_name->c_str(),
"EXISTS");
181 if (in != NULL && in->IsOpen()) {
183 TIter iter(in->GetListOfKeys(), kIterBackward);
185 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
187 TKey* p =
dynamic_cast<TKey*
>(in->GetListOfKeys()->Before(key));
189 if (p == NULL || strcmp(key->GetName(), p->GetName()) != 0) {
191 TTree* t1 =
dynamic_cast<TTree*
>(key->ReadObj());
199 if (strcmp((*i)->GetName(), t1->GetName()) == 0) {
208 input.push_back(q =
new TChain(t1->GetName()));
211 q->Add(file_name->c_str());
244 if (tm->GetEntries() == (*i)->GetEntries())
253 output.push_back((*i)->GetTree()->CloneTree(0));
256 for (Long64_t
i = numberOfEvents.getLowerLimit();
i < tm->GetEntries() &&
i < numberOfEvents.getUpperLimit(); ++
i) {
258 STATUS(
"event: " << setw(10) <<
i <<
'\r');
DEBUG(endl);
262 const JTag tag(evt->run_id, evt->frame_index, evt->trigger_counter);
264 DEBUG(
"tag " << tag <<
' ' << (selection.empty() || selection.count(tag)) << endl);
266 if (selection.empty() || selection.count(tag)) {
268 for (
size_t m = 0; m != input.size(); ++m) {
269 input [m]->GetEntry(
i);
Utility class to parse command line options.
static JGlob getFilenames
Function object to get list of files for given pattern.
JLimit JLimit_t
Type definition of limit.
static const char *const TTREE_OFFLINE_EVENT
ROOT TTree name.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const char *const TBRANCH_OFFLINE_EVENT
ROOT TBranch name.
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
#define DEBUG(A)
Message macros.