00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_Collision_H
00010 #define ThePEG_Collision_H
00011
00012
00013 #include "EventConfig.h"
00014 #include "Particle.h"
00015 #include "StandardSelectors.h"
00016 #include "ThePEG/Vectors/LorentzVector.h"
00017 #include "ThePEG/Vectors/LorentzRotation.h"
00018
00019 namespace ThePEG {
00020
00034 class Collision: public EventRecordBase {
00035
00036 public:
00037
00041 friend class EventHandler;
00043 friend class Event;
00045 friend class Step;
00046
00047 public:
00048
00059 Collision(const PPair & newIncoming, tEventPtr newEvent = tEventPtr(),
00060 tcEventBasePtr newHandler = tcEventBasePtr())
00061 : theIncoming(newIncoming), theEvent(newEvent), theHandler(newHandler) {
00062 addParticle(incoming().first);
00063 addParticle(incoming().second);
00064 }
00065
00069 ~Collision();
00070
00071 public:
00072
00079 tStepPtr newStep(tcEventBasePtr newHandler = tcEventBasePtr());
00080
00084 void addStep(tStepPtr s);
00085
00090 tcEventBasePtr handler() const { return theHandler; }
00091
00096 tEventPtr event() const { return theEvent; }
00097
00108 template <class OutputIterator>
00109 void select(OutputIterator r, const SelectorBase & s) const;
00110
00116 template <class OutputIterator>
00117 void selectFinalState(OutputIterator r) const {
00118 select(r, SelectFinalState());
00119 }
00120
00125 tPVector getFinalState() const {
00126 tPVector ret;
00127 selectFinalState(back_inserter(ret));
00128 return ret;
00129 }
00130
00135 tSubProPtr primarySubProcess() const {
00136 return subProcesses().empty()? SubProPtr(): subProcesses().front();
00137 }
00138
00142 const SubProcessVector & subProcesses() const {
00143 return theSubProcesses;
00144 }
00145
00149 tcStepPtr finalStep() const {
00150 return steps().empty()? tcStepPtr(): tcStepPtr(steps().back());
00151 }
00152
00156 tStepPtr finalStep() {
00157 return steps().empty()? StepPtr(): steps().back();
00158 }
00159
00163 const StepVector & steps() const { return theSteps; }
00164
00168 tcStepPtr step(unsigned int i) const {
00169 return i < steps().size()? tcStepPtr(theSteps[i]): tcStepPtr();
00170 }
00171
00177 const PPair & incoming() const { return theIncoming; }
00178
00185 tParticleSet getRemnants() const;
00186
00193 bool isRemnant(tPPtr p) const { return member(getRemnants(), p); }
00194
00196
00200 const LorentzPoint & vertex() const { return theVertex; }
00201
00205 void vertex(const LorentzPoint & p) { theVertex = p; }
00206
00210 void transform(const LorentzRotation &);
00211
00216 Energy2 m2() const {
00217 return ( incoming().first->momentum() + incoming().second->momentum() ).m2();
00218 }
00219
00226 void removeDecay(tPPtr);
00227
00233 void removeParticle(tPPtr);
00234
00238 void cleanSteps();
00239
00243 void popStep();
00244
00246
00247 public:
00248
00252 void persistentOutput(PersistentOStream &) const;
00253
00257 void persistentInput(PersistentIStream &, int);
00258
00262 static void Init();
00263
00264 protected:
00265
00271 void addSubProcess(tSubProPtr p);
00272
00276 void removeSubProcess(tSubProPtr p);
00277
00281 template <class Iterator>
00282 void addParticles(Iterator first, Iterator last);
00283
00287 void addParticle(tPPtr p);
00288
00292 void removeEntry(tPPtr p);
00293
00295
00299 const ParticleSet & all() const { return allParticles; }
00300
00305 CollPtr clone() const;
00306
00314 void rebind(const EventTranslationMap & trans);
00315
00316 private:
00317
00321 PPair theIncoming;
00322
00326 StepVector theSteps;
00327
00332 SubProcessVector theSubProcesses;
00333
00337 ParticleSet allParticles;
00338
00342 tEventPtr theEvent;
00343
00348 tcEventBasePtr theHandler;
00349
00353 LorentzPoint theVertex;
00354
00355 private:
00356
00360 static ClassDescription<Collision> initCollision;
00361
00366 Collision() {}
00367
00372 friend class ClassTraits<Collision>;
00373
00377 Collision & operator=(const Collision &);
00378
00380 friend ostream & operator<<(ostream & os, const Collision & c);
00381
00382 };
00383
00385 ostream & operator<<(ostream &, const Collision &);
00386
00387
00392 template <>
00393 struct BaseClassTrait<Collision,1>: public ClassTraitsType {
00395 typedef EventRecordBase NthBase;
00396 };
00397
00400 template <>
00401 struct ClassTraits<Collision>: public ClassTraitsBase<Collision> {
00403 static string className() { return "ThePEG::Collision"; }
00405 static TPtr create() { return TPtr::Create(Collision()); }
00406 };
00407
00410 }
00411
00412 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
00413 #include "Collision.tcc"
00414 #endif
00415
00416 #endif