File indexing completed on 2026-04-25 08:29:08
0001 #ifndef MACRO_GETENTRIES_C
0002 #define MACRO_GETENTRIES_C
0003
0004 #include <frog/FROG.h>
0005 #include <ffaobjects/SyncObjectv1.h>
0006
0007 R__LOAD_LIBRARY(libFROG.so)
0008 R__LOAD_LIBRARY(libffaobjects.so)
0009
0010 void GetEntriesAndEventNr(const std::string &file)
0011 {
0012 gSystem->Load("libFROG.so");
0013 gSystem->Load("libg4dst.so");
0014
0015
0016 for (int i = 0; i < kMAXSIGNALS; i++)
0017 {
0018 gSystem->IgnoreSignal((ESignals)i);
0019 }
0020 FROG *fr = new FROG();
0021 TFile *f = TFile::Open(fr->location(file));
0022 cout << "Getting events for " << file << endl;
0023 TTree *T = (TTree *) f->Get("T");
0024 if (! T)
0025 {
0026 cout << "Number of Entries: -2" << endl;
0027 }
0028 else
0029 {
0030 cout << "Number of Entries: " << T->GetEntries() << endl;
0031 }
0032 long lastEvent = -1;
0033 long firstEvent = -1;
0034 if (T)
0035 {
0036 SyncObjectv1 *sync {nullptr};
0037 T->SetBranchAddress("DST#Sync",&sync);
0038 T->GetEntry(0);
0039 if (sync)
0040 {
0041 firstEvent=sync->EventNumber();
0042 }
0043 T->GetEntry(T->GetEntries()-1);
0044 if (sync)
0045 {
0046 lastEvent=sync->EventNumber();
0047 }
0048 }
0049 cout << "First event number: " << firstEvent << endl;
0050 cout << "Last event number: " << lastEvent << endl;
0051 }
0052 #endif