bool NTupleEventReader::hasNextEvent() {
    if (numberOfFiles == 0)
        throw NoFileFoundException("No input file found!");
    // bool hasNextInNTuple = input->LoadTree(currentEventEntry) >= 0;
    bool isWithinEventRange = currentEventEntry < maximalNumberOfEvents;
		if (currentEventEntry <= 0) {
			gSystem->Load("libFWCoreFWLite.so"); 
			AutoLibraryLoader::enable();
			gSystem->Load("libDataFormatsFWLite.so");
			gSystem->Load("libDataFormatsPatCandidates.so");
			evtchain = new fwlite::ChainEvent(samplefiles);
			cout << "Go to first event\n";
			evtchain->toBegin();
		} else ++(*evtchain);
		static TString prevFile;
		const char *currFile = getCurrentFile();
		if (prevFile != currFile) {
			cout << "Loaded file: " << currFile << endl;
			prevFile = currFile;
		}
		currentEventEntry++;
		processedEvents++;
		return (isWithinEventRange && (currentEventEntry <= 0 || 
			(evtchain != 0 && evtchain->atEnd() == false)));
    // return hasNextInNTuple && isWithinEventRange;
}
示例#2
0
bool NTupleEventReader::hasNextEvent() {
	if (numberOfFiles == 0)
		throw NoFileFoundException("No input file found!");
	bool hasNextInNTuple = input->LoadTree(currentEventEntry) >= 0;
	bool isWithinEventRange = currentEventEntry < maximalNumberOfEvents || maximalNumberOfEvents <= 0;
	return hasNextInNTuple && isWithinEventRange;
}
const char* NTupleEventReader::getCurrentFile() const {
	/*
	if (input->GetCurrentFile() == 0)
		throw NoFileFoundException("Tried to access nonexistent file.");
    return input->GetCurrentFile()->GetName();
    */
	if (evtchain == 0 || evtchain->getTFile() == 0)
		throw NoFileFoundException("Tried to access nonexistent file.");
	return evtchain->getTFile()->GetName();
}
示例#4
0
bool NTupleEventReader::hasNextEvent() {
    if (numberOfFiles == 0)
        throw NoFileFoundException("No input file found!");
    bool hasNextInNTuple = input->LoadTree(currentEventEntry) >= 0;
		static TString prevFile;
		const char *currFile = getCurrentFile();
		if (prevFile != currFile) {
			cout << "Loaded file: " << currFile << endl;
			prevFile = currFile;
		}
    bool isWithinEventRange = currentEventEntry < maximalNumberOfEvents;
    return hasNextInNTuple && isWithinEventRange;
}
示例#5
0
void NTupleEventReader::addInputFile(const char * fileName) {
    unsigned long filesAdded = input->Add(fileName, -1);//-1 == number of events is not read!
    if (filesAdded <= 0)
        throw NoFileFoundException("No file found in '" + TString(fileName) + "'");
    numberOfFiles += filesAdded;
}
示例#6
0
const char* NTupleEventReader::getCurrentFile() const {
	if (input->GetCurrentFile() == 0)
		throw NoFileFoundException("Tried to access non-existent file.");
	return input->GetCurrentFile()->GetName();
}