48 const int frame_index,
51 frame_index(frame_index),
62 friend inline std::istream&
operator>>(std::istream& in, JTag& tag)
76 friend inline std::ostream&
operator<<(std::ostream& out,
const JTag& tag)
80 return out << setw(8) << tag.run <<
' '
81 << setw(6) << tag.frame_index <<
' '
82 << setw(6) << tag.counter;
92 friend inline bool operator<(
const JTag& first,
const JTag& second)
94 if (first.run == second.run) {
96 if (first.frame_index == second.frame_index)
97 return first.counter < second.counter;
99 return first.frame_index < second.frame_index;
103 return first.run < second.run;
120 int main(
int argc,
char **argv)
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));
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);
int main(int argc, char **argv)
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
Auxiliaries for defining the range of iterations of objects.
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
bool operator<(const Head &first, const Head &second)
Less than operator.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static JGlob getFilenames
Function object to get list of files for given pattern.
static const char *const TTREE_OFFLINE_EVENT
ROOT TTree name.
static const char *const TBRANCH_OFFLINE_EVENT
ROOT TBranch name.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
int frame_index
from the raw data
int run_id
DAQ run identifier.
ULong64_t trigger_counter
trigger counter
Auxiliary class for defining the range of iterations of objects.