1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
// -*- C++ -*-
//
// EventConfig.cc is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the EventConfig class.
//
#include "EventConfig.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/PDT/ParticleData.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#ifdef ThePEG_TEMPLATES_IN_CC_FILE
// #include "EventConfig.tcc"
#endif
using namespace ThePEG;
tcEventBasePtr EventConfig::currentGenerator;
void EventConfig::putHandler(PersistentOStream & os, tcEventBasePtr h) {
if ( !currentGenerator ) os << "" << h;
else {
tcIPtr handler = dynamic_ptr_cast<tcIPtr>(h);
if ( handler ) os << handler->fullName();
else os << "";
os << tcEventBasePtr();
}
}
void EventConfig::getHandler(PersistentIStream & is, tcEventBasePtr & h) {
string pxh;
is >> pxh >> h;
if ( currentGenerator ) {
tcEGPtr eg = dynamic_ptr_cast<tcEGPtr>(currentGenerator);
h = eg->getObject<EventRecordBase>(pxh);
}
}
void EventConfig::putParticleData(PersistentOStream & os, tcEventPDPtr pd) {
if ( !currentGenerator ) os << 0 << pd;
else os << pd->id() << tcEventPDPtr();
}
void EventConfig::getParticleData(PersistentIStream & is, cEventPDPtr & pd) {
long pid;
is >> pid >> pd;
if ( !pd && currentGenerator ) {
tcEGPtr eg = dynamic_ptr_cast<tcEGPtr>(currentGenerator);
pd = eg->getParticleData(pid);
}
}
string EventConfig::nameHandler(tcEventBasePtr h) {
tcIPtr handler = dynamic_ptr_cast<tcIPtr>(h);
if ( handler ) return handler->name();
return "";
}
|