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;
151 inputFile = getFilenames(inputFile);
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()) {
177 for (vector<string>::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) {
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));
258 STATUS(
"event: " << setw(10) << i <<
'\r');
DEBUG(endl);
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);