|
|
|||
File indexing completed on 2026-08-06 09:38:21
0001 // -*- C++ -*- 0002 // 0003 // Collision.h is a part of ThePEG - Toolkit for HEP Event Generation 0004 // Copyright (C) 1999-2019 Leif Lonnblad 0005 // 0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details. 0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 0008 // 0009 #ifndef ThePEG_Collision_H 0010 #define ThePEG_Collision_H 0011 // This is the decalaration of the Collision class. It 0012 0013 #include "EventConfig.h" 0014 #include "Particle.h" 0015 #include "StandardSelectors.h" 0016 #include "ThePEG/Vectors/LorentzVector.h" 0017 #include "ThePEG/Vectors/LorentzRotation.h" 0018 0019 namespace ThePEG { 0020 0021 /** 0022 * This is the decalaration of the Collision class. It contains all 0023 * <code>Particle</code>s produced in the generation of a collision 0024 * between two particles in an Event. The particles are divided into 0025 * <code>Step</code>s corresponding to the particles present after a 0026 * given step in the event generation. The collision also carries 0027 * information about the <code>SubProcesses</code> in the collision. 0028 * 0029 * @see Event 0030 * @see Step 0031 * @see SubProcess 0032 * @see Particle 0033 */ 0034 class Collision: public EventRecordBase { 0035 0036 public: 0037 0038 /** 0039 * EventHandler is a friend of most Event classes. 0040 */ 0041 friend class EventHandler; 0042 /** Most of the Event classes are friends with each other. */ 0043 friend class Event; 0044 /** Most of the Event classes are friends with each other. */ 0045 friend class Step; 0046 0047 public: 0048 0049 /** 0050 * The standard constructor takes a pair of incoming particles as 0051 * argument. Optionally can be given a pointer to the Event which 0052 * this Collision belongs, and a pointer to the EventHandler 0053 * which produced this collision. 0054 * @param newIncoming a pair of incoming particles. 0055 * @param newEvent the Event to which this Collision belongs. 0056 * @param newHandler the handler object in charge of the generation 0057 * of this Collision. 0058 */ 0059 Collision(const PPair & newIncoming, tEventPtr newEvent = tEventPtr(), 0060 tcEventBasePtr newHandler = tcEventBasePtr()) 0061 : theIncoming(newIncoming), theEvent(newEvent), theHandler(newHandler) { 0062 addParticle(incoming().first); 0063 addParticle(incoming().second); 0064 } 0065 0066 /** 0067 * The destructor 0068 */ 0069 ~Collision(); 0070 0071 public: 0072 0073 /** 0074 * Create a new step in this collision, which is a copy of 0075 * the last step (if any) and return a pointer to it. 0076 * @param newHandler the handler object in charge of generating the 0077 * new step. 0078 */ 0079 tStepPtr newStep(tcEventBasePtr newHandler = tcEventBasePtr()); 0080 0081 /** 0082 * Add a new Step to this Collision. 0083 */ 0084 void addStep(tStepPtr s); 0085 0086 /** 0087 * Return a pointer to the EventHandler which produced this 0088 * Collision. May be the null pointer. 0089 */ 0090 tcEventBasePtr handler() const { return theHandler; } 0091 0092 /** 0093 * Return a pointer to the Event to which this Collision 0094 * belongs. May be the null pointer. 0095 */ 0096 tEventPtr event() const { return theEvent; } 0097 0098 /** @name Functions for accessing particles etc. */ 0099 //@{ 0100 /** 0101 * Extract particles from this Collision which satisfies the 0102 * requirements given by an object of the SelectorBase class. 0103 * @param r an output iterator specifying where the extracted 0104 * (pointers to) particles will be appended. 0105 * @param s SelectorBase object defining which particles should be 0106 * extracted. 0107 */ 0108 template <class OutputIterator> 0109 void select(OutputIterator r, const SelectorBase & s) const; 0110 0111 /** 0112 * Extract all final state particles in this Collision. 0113 * @param r an output iterator specifying where the extracted 0114 * (pointers to) particles will be appended. 0115 */ 0116 template <class OutputIterator> 0117 void selectFinalState(OutputIterator r) const { 0118 select(r, SelectFinalState()); 0119 } 0120 0121 /** 0122 * Extract all final state particles in this Collision. 0123 * @return a vector of pointers to the extracted particles. 0124 */ 0125 tPVector getFinalState() const { 0126 tPVector ret; 0127 selectFinalState(back_inserter(ret)); 0128 return ret; 0129 } 0130 0131 /** 0132 * Return a pointer to the primary SubProcess in this Collision. May 0133 * be the null pointer. 0134 */ 0135 tSubProPtr primarySubProcess() const { 0136 return subProcesses().empty()? SubProPtr(): subProcesses().front(); 0137 } 0138 0139 /** 0140 * Return the possibly empty list of sub processes in this Collision. 0141 */ 0142 const SubProcessVector & subProcesses() const { 0143 return theSubProcesses; 0144 } 0145 0146 /** 0147 * Return a const pointer to the last step in this Collission. 0148 */ 0149 tcStepPtr finalStep() const { 0150 return steps().empty()? tcStepPtr(): tcStepPtr(steps().back()); 0151 } 0152 0153 /** 0154 * Return a pointer to the last step in this Collission. 0155 */ 0156 tStepPtr finalStep() { 0157 return steps().empty()? StepPtr(): steps().back(); 0158 } 0159 0160 /** 0161 * Return the vector of steps in this Collision. 0162 */ 0163 const StepVector & steps() const { return theSteps; } 0164 0165 /** 0166 * Return a pointer to a given Step in this Collision. 0167 */ 0168 tcStepPtr step(unsigned int i) const { 0169 return i < steps().size()? tcStepPtr(theSteps[i]): tcStepPtr(); 0170 } 0171 0172 /** 0173 * Return a reference to the pair of colliding particles in this 0174 * Collision. 0175 */ 0176 0177 const PPair & incoming() const { return theIncoming; } 0178 0179 /** 0180 * Return the set of remnants in this collision. Remnants are 0181 * defined as the daughters of the incoming particles which are not 0182 * incoming particles to any SubProcess or children thereof which 0183 * are present in the final state. 0184 */ 0185 tParticleSet getRemnants() const; 0186 0187 /** 0188 * Return true if the given particle is a remnant of the colliding 0189 * particles. Calls the getRemnants method, so to check several 0190 * particles it is better to call getRemnants directly and check if 0191 * the particles are members of the resulting set by hand. 0192 */ 0193 bool isRemnant(tPPtr p) const { return member(getRemnants(), p); } 0194 0195 //@} 0196 0197 /** 0198 * Return the vertex position of this Collision. 0199 */ 0200 const LorentzPoint & vertex() const { return theVertex; } 0201 0202 /** 0203 * Set the vertex position of this Collision. 0204 */ 0205 void vertex(const LorentzPoint & p) { theVertex = p; } 0206 0207 /** 0208 * Transform all particles in this Collision. 0209 */ 0210 void transform(const LorentzRotation &); 0211 0212 /** 0213 * Return the total invariant mass squared of the final-state 0214 * particles in this Collision. 0215 */ 0216 Energy2 m2() const { 0217 return ( incoming().first->momentum() + incoming().second->momentum() ).m2(); 0218 } 0219 0220 /** @name Functions for removing entires from a Collision. */ 0221 //@{ 0222 /** 0223 * Remove (recursively) the decay products from a given Particle and 0224 * add the particle to the list of final state particles. 0225 */ 0226 void removeDecay(tPPtr); 0227 0228 /** 0229 * Remove (recursively) the given Particle from the Collision. If 0230 * this was the last daughter of the mother Particle, the latter is 0231 * added to the list of final state particles. 0232 */ 0233 void removeParticle(tPPtr); 0234 0235 /** 0236 * Remove all steps which have no new particles introduced in them. 0237 */ 0238 void cleanSteps(); 0239 0240 /** 0241 * Remove the last Step in this Collision. 0242 */ 0243 void popStep(); 0244 0245 //@} 0246 0247 public: 0248 0249 /** 0250 * Standard function for writing to a persistent stream. 0251 */ 0252 void persistentOutput(PersistentOStream &) const; 0253 0254 /** 0255 * Standard functions for reading from a persistent stream. 0256 */ 0257 void persistentInput(PersistentIStream &, int); 0258 0259 /** 0260 * Standard Init function. @see Base::Init(). 0261 */ 0262 static void Init(); 0263 0264 protected: 0265 0266 /** @name Internal functions for adding and removing entires. */ 0267 //@{ 0268 /** 0269 * Add a new SubProcess to this Collision. 0270 */ 0271 void addSubProcess(tSubProPtr p); 0272 0273 /** 0274 * Remove a SubProcess from this Collision. 0275 */ 0276 void removeSubProcess(tSubProPtr p); 0277 0278 /** 0279 * Add a range of particles to this Collision. 0280 */ 0281 template <class Iterator> 0282 void addParticles(Iterator first, Iterator last); 0283 0284 /** 0285 * Add a particle to this Collision. 0286 */ 0287 void addParticle(tPPtr p); 0288 0289 /** 0290 * Remove a given Particle entry. 0291 */ 0292 void removeEntry(tPPtr p); 0293 0294 //@} 0295 0296 /** 0297 * Return a reference to the list of all particles in this Collision. 0298 */ 0299 const ParticleSet & all() const { return allParticles; } 0300 0301 /** 0302 * Clone this Collision. This also makes clones of all steps, sub 0303 * processes and particles in this Collision. 0304 */ 0305 CollPtr clone() const; 0306 0307 /** 0308 * Rebind to cloned objects. When a Collision is cloned, a shallow 0309 * copy is done first, then all <code>Particle</code>s etc, are 0310 * cloned, and finally this method is used to see to that the 0311 * pointers in the cloned Collision points to the cloned 0312 * <code>Particle</code>s etc. 0313 */ 0314 void rebind(const EventTranslationMap & trans); 0315 0316 private: 0317 0318 /** 0319 * The pair of colliding particles. 0320 */ 0321 PPair theIncoming; 0322 0323 /** 0324 * A vector of all steps in this Collision. 0325 */ 0326 StepVector theSteps; 0327 0328 /** 0329 * A vector of all sub-processes in this Collision. The front 0330 * element points to the primary sub-process. 0331 */ 0332 SubProcessVector theSubProcesses; 0333 0334 /** 0335 * A set of all particles in this Collision. 0336 */ 0337 ParticleSet allParticles; 0338 0339 /** 0340 * A pointer to the Event to which this Collision belongs. 0341 */ 0342 tEventPtr theEvent; 0343 0344 /** 0345 * A pointer to the EventHandler which performed the generation 0346 * of this Collision. 0347 */ 0348 tcEventBasePtr theHandler; 0349 0350 /** 0351 * The vertex position of this Collision 0352 */ 0353 LorentzPoint theVertex; 0354 0355 private: 0356 0357 /** 0358 * Describe concrete class with persistent data. 0359 */ 0360 static ClassDescription<Collision> initCollision; 0361 0362 /** 0363 * Private default constructor must only be used by the 0364 * PersistentIStream class via the ClassTraits<Collision> class . 0365 */ 0366 Collision() {} 0367 0368 /** 0369 * The ClassTraits<Collision> class must be a friend to be able to 0370 * use the private default constructor. 0371 */ 0372 friend struct ClassTraits<Collision>; 0373 0374 /** 0375 * The assignment operator is private and not implemented. 0376 */ 0377 Collision & operator=(const Collision &) = delete; 0378 0379 /** Output to a standard ostream. */ 0380 friend ostream & operator<<(ostream & os, const Collision & c); 0381 0382 }; 0383 0384 /** Output a Collision to a standard ostream. */ 0385 ostream & operator<<(ostream &, const Collision &); 0386 0387 0388 /** @cond TRAITSPECIALIZATIONS */ 0389 0390 /** This template specialization informs ThePEG about the 0391 * base class of Collision. */ 0392 template <> 0393 struct BaseClassTrait<Collision,1>: public ClassTraitsType { 0394 /** Typedef of the first base class of Collision. */ 0395 typedef EventRecordBase NthBase; 0396 }; 0397 0398 /** This template specialization informs ThePEG about the name of 0399 * the Collision class and how to create it. */ 0400 template <> 0401 struct ClassTraits<Collision>: public ClassTraitsBase<Collision> { 0402 /** Return a platform-independent class name */ 0403 static string className() { return "ThePEG::Collision"; } 0404 /** Create a Collision object. */ 0405 static TPtr create() { return TPtr::Create(Collision()); } 0406 }; 0407 0408 /** @endcond */ 0409 0410 } 0411 0412 #ifndef ThePEG_TEMPLATES_IN_CC_FILE 0413 #include "Collision.tcc" 0414 #endif 0415 0416 #endif /* ThePEG_Collision_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|