Skip to content
Snippets Groups Projects
Commit 9cfb7e40 authored by Michael Leyhe's avatar Michael Leyhe
Browse files

Added Alert if no events have been read in from File.

parent 494d1d35
No related branches found
No related tags found
No related merge requests found
......@@ -315,8 +315,7 @@ bool ParserBase::parseCommandLine(int argc, char **argv)
cerr << e.what() << std::endl;
cerr << "You can use -h or --help to obtain the description of the program parameters." << endl;
// cerr << "This is the command line options\n" << endl;
exit(0);
exit(1);
// return false;
}
catch(...){
......
......@@ -62,7 +62,7 @@ EventReaderDefault::~EventReaderDefault()
bool EventReaderDefault::fill(EventList& evtList, int evtStart, int evtStop)
{
int currentEvtNo=0;
while (currentFile != fileNames.end()) {
currentStream.open(currentFile->c_str());
if (!currentStream) {
......@@ -75,37 +75,32 @@ bool EventReaderDefault::fill(EventList& evtList, int evtStart, int evtStop)
double e,px,py,pz;
Event* newEvent = new Event();
int parts;
if(_useWeight)
{
double weight;
currentStream >> weight;
newEvent->addWeight(weight);
}
{
double weight;
currentStream >> weight;
newEvent->addWeight(weight);
}
Vector4<double> fvX(0,0,0,0); //X four-vector
for (parts = 0; parts < numParticles; parts++) {
if(_energyFirst) currentStream >> e >> px >> py >> pz;
else currentStream >> px >> py >> pz >> e;
newEvent->addParticle(e/_unitScaleFactor, px/_unitScaleFactor, py/_unitScaleFactor, pz/_unitScaleFactor);
Vector4<double> tmp = newEvent->p4(parts);
if(isMassrangeParticle(parts)) fvX= fvX+tmp;
}
if(_useMassRange){
if(_useMassRange){
if(fvX.Mass()<_massMin || fvX.Mass()>_massMax ){
delete newEvent;
continue;
}
}
if(currentEvtNo<evtStart || currentEvtNo>evtStop){
currentEvtNo++;
delete newEvent;
continue;
}
currentEvtNo++;
if (!currentStream.fail()) {
evtList.add(newEvent);
......@@ -114,6 +109,10 @@ bool EventReaderDefault::fill(EventList& evtList, int evtStart, int evtStop)
else currentStream >> px >> py >> pz >> e;
}
}
if (currentEvtNo == 0){
Alert << "No events have been read in from File: " << *currentFile << " ! \nNo events in massRange? Wrong order of particles? currentEvtNo = " << currentEvtNo;
exit(1);
}
currentStream.close();
++currentFile;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment