Skip to content
Snippets Groups Projects
Event.cc 2.32 KiB
Newer Older
//************************************************************************//
//									  //
//  Copyright 2013 Bertram Kopf (bertram@ep1.rub.de)			  //
//  	      	   Julian Pychy (julian@ep1.rub.de)			  //
//          	   - Ruhr-Universität Bochum 				  //
//									  //
//  This file is part of Pawian.					  //
//									  //
//  Pawian is free software: you can redistribute it and/or modify	  //
//  it under the terms of the GNU General Public License as published by  //
//  the Free Software Foundation, either version 3 of the License, or 	  //
//  (at your option) any later version.	 	      	  	   	  //
//									  //
//  Pawian is distributed in the hope that it will be useful,		  //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of	  //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the	  //
//  GNU General Public License for more details.	      		  //
//									  //
//  You should have received a copy of the GNU General Public License     //
//  along with Pawian.  If not, see <http://www.gnu.org/licenses/>.	  //
//									  //
//************************************************************************//

#include "Event/Event.hh"
#include <vector>

Event::Event() : weight(1.),
  evtNo(0)
{}
Event::Event(int evtNumber) : 
  weight(1.),
  evtNo(evtNumber)
{}
Event::~Event()
{
  std::vector<EvtPartData*>::iterator iter;
  for (iter = particles.begin(); iter != particles.end(); ++iter)
    delete *iter;
}
  
Vector4<float>* Event::p4(unsigned int i)
{
  if (particles.size() > i)
    return particles[i]->vector4;
  else {
    Alert << "accessing " << i << "th of " 
	  << particles.size() << " particles" << endmsg;
    exit(1);
  }
float* Event::pid(unsigned int i)
{
  if (particles.size() > i)
    return particles[i]->pidVector;
  else {
    Alert << "accessing pid of " << i << "th of " 
	  << particles.size() << " particles" << endmsg;
    exit(1);
  }
}


void Event::addParticle(double e, double px, double py, double pz)
{
  EvtPartData* evtData = new EvtPartData(e,px,py,pz);
  particles.push_back(evtData);
  return;
}

void Event::addWeight(double theWeight)
{
  weight = theWeight;
}

int Event::size()
{
  return particles.size();
}

bool Event::operator<(const Event& compare) const{
  bool result=false;
  if ( evtNo < compare.eventNo()) result=true;
  return result;
}