Newer
Older
#include "Event/EventList.hh"
#include "Event/Event.hh"
#include "Particle/Particle.hh"
#include "Particle/ParticleTable.hh"
#include "qft++/topincludes/tensor.hh"
EventList::EventList()
{
}
EventList::~EventList()
{
for (currentEvent = eventList.begin();
currentEvent != eventList.end();
++currentEvent)
delete *currentEvent;
}
void EventList::add(Event* newEvent)
{
if (0 != newEvent)
eventList.push_back(newEvent);
else {
Alert << "can not add 0 pointer to event list" << endmsg;
exit(1);
}
void EventList::removeEvents(unsigned int nBegin, unsigned int nEnd)
{
if ( nBegin < nEnd || eventList.size()>nEnd) {
Alert << "can not remove event no " << nBegin << " - " << nEnd
<< " from list" << endmsg;
exit(1);
}
eventList.erase(eventList.begin()+nBegin, eventList.begin()+nEnd);
}
Event* EventList::nextEvent()
{
if (currentEvent != eventList.end()) {
Event* result = *currentEvent;
++currentEvent;
return result;
} else
return 0;
}
void EventList::rewind()
{
currentEvent = eventList.begin();
return;
}
void EventList::setParticleType(int num, Particle* partRef)
{
particleRefs[num] = partRef;
return;
}
Particle* EventList::particle(unsigned int num)
{
if (num >= 0 && num < particleRefs.size())
return particleRefs[num];
return 0;
}
int EventList::size()
{
return eventList.size();
}
bool EventList::findParticleTypes(ParticleTable& pdtTable)
{
if (eventList.size() == 0) {
Alert << "eventList is empty" << endmsg;
exit(1);
}
bool result = true;
int partsPerEvent = eventList[0]->size();
int i;
for (i=0; i<partsPerEvent; i++) {
Particle* thisParticle;
thisParticle = pdtTable.particle(eventList[0]->p4(i)->Mass());
particleRefs.push_back(thisParticle);
if (0 == thisParticle) {
Warning << "did not find a particle with mass "
<< eventList[0]->p4(i)->Mass() << endmsg;
result = false;
}
}
return result;
}