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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
// -*- C++ -*-
//
// SubProcess.cc is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
// Copyright (C) 2009-2011 Simon Platzer
//
// 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 SubProcess class.
//
#include "SubProcess.h"
#include "ThePEG/EventRecord/Collision.h"
#include "ThePEG/Config/algorithm.h"
#include "ThePEG/EventRecord/ParticleTraits.h"
#include "ThePEG/Utilities/Rebinder.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include <iostream>
#ifdef ThePEG_TEMPLATES_IN_CC_FILE
#include "SubProcess.tcc"
#endif
using namespace ThePEG;
SubProcess::
SubProcess(const PPair & newIncoming,
tCollPtr newCollision, tcEventBasePtr newHandler,
tSubProPtr newHead, double newGroupWeight)
: theHandler(newHandler), theCollision(newCollision),
theIncoming(newIncoming), isDecayed(false),
theHead(newHead), theGroupWeight(newGroupWeight) {}
SubProcess::~SubProcess() {}
SubProPtr SubProcess::clone() const {
return ptr_new<SubProPtr>(*this);
}
void SubProcess::addIntermediate(tPPtr p, bool fixrelations) {
if ( fixrelations ) {
incoming().first->rep().theChildren.push_back(p);
incoming().second->rep().theChildren.push_back(p);
p->rep().theParents.push_back(incoming().first);
p->rep().theParents.push_back(incoming().second);
}
theIntermediates.push_back(p);
}
void SubProcess::addOutgoing(tPPtr p, bool fixrelations) {
if ( fixrelations ) {
if ( intermediates().empty() ) {
incoming().first->rep().theChildren.push_back(p);
incoming().second->rep().theChildren.push_back(p);
p->rep().theParents.push_back(incoming().first);
p->rep().theParents.push_back(incoming().second);
} else {
for (ParticleVector::iterator it = theIntermediates.begin();
it != theIntermediates.end(); ++it ) {
(**it).rep().theChildren.push_back(p);
p->rep().theParents.push_back(*it);
}
}
}
theOutgoing.push_back(p);
}
void SubProcess::changeIncoming(tPPtr pnew, tPPtr pold) {
if(pold==theIncoming.first) {
theIntermediates.push_back(pold);
theIncoming.first = pnew;
}
else if(pold==theIncoming.second) {
theIntermediates.push_back(pold);
theIncoming.second = pnew;
}
}
void SubProcess::rebind(const EventTranslationMap & trans) {
theIncoming.first = trans.translate(theIncoming.first);
theIncoming.second = trans.translate(theIncoming.second);
theCollision = trans.translate(theCollision);
for ( ParticleVector::iterator pit = theOutgoing.begin();
pit != theOutgoing.end(); ++pit )
*pit = trans.translate(*pit);
for ( ParticleVector::iterator pit = theIntermediates.begin();
pit != theIntermediates.end(); ++pit )
*pit = trans.translate(*pit);
}
void SubProcess::removeEntry(tPPtr p) {
if ( p == theIncoming.first ) theIncoming.first = PPtr();
if ( p == theIncoming.second ) theIncoming.second = PPtr();
ParticleVector::iterator pit = theOutgoing.begin();
while ( pit != theOutgoing.end() ) {
if ( *pit == p ) pit = theOutgoing.erase(pit);
else ++pit;
}
pit = theIntermediates.begin();
while ( pit != theIntermediates.end() ) {
if ( *pit == p ) pit = theIntermediates.erase(pit);
else ++pit;
}
}
void SubProcess::transform(const LorentzRotation & r) {
incoming().first->transform(r);
incoming().second->transform(r);
for_each(intermediates(), Transformer(r));
for_each(outgoing(), Transformer(r));
}
void SubProcess::printMe(ostream& os) const {
os << "--- incoming:" << endl
<< *incoming().first << *incoming().second;
if ( !intermediates().empty() ) os << "--- intermediates:" << endl;
Particle::PrintParticles(os, intermediates().begin(),
intermediates().end());
os << "--- outgoing:" << endl;
Particle::PrintParticles(os, outgoing().begin(), outgoing().end());
}
ostream & ThePEG::operator<<(ostream & os, const SubProcess & sp) {
sp.printMe(os);
return os;
}
void SubProcess::debugme() const {
cerr << *this;
EventRecordBase::debugme();
}
void SubProcess::persistentOutput(PersistentOStream & os) const {
EventConfig::putHandler(os, theHandler);
os << theCollision << theIncoming << theIntermediates << theOutgoing
<< isDecayed << theHead << theGroupWeight;
}
void SubProcess::persistentInput(PersistentIStream & is, int) {
EventConfig::getHandler(is, theHandler);
is >> theCollision >> theIncoming >> theIntermediates >> theOutgoing
>> isDecayed >> theHead >> theGroupWeight;
}
ClassDescription<SubProcess> SubProcess::initSubProcess;
void SubProcess::Init() {}
ThePEG_IMPLEMENT_SET(SubProPtr,SubProcessSet)
|