Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:22

0001 // -*- C++ -*-
0002 //
0003 // TmpTransform.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_TmpTransform_H
0010 #define THEPEG_TmpTransform_H
0011 //
0012 // This is the declaration of the TmpTransform class.
0013 //
0014 
0015 #include "ThePEG/Config/ThePEG.h"
0016 
0017 namespace ThePEG {
0018 
0019 /**
0020  * This is a wrapper class to be used to temporarily make a Lorentz
0021  * transform of an object. When created a pointer to an object and a
0022  * LorentzRotation is provided, and the objects transform(const
0023  * LorentzRotation &) function is called. When the destructed the
0024  * inverse tansformation is performed. In this way one can make sure
0025  * that the inverse transformation is performed even if the function
0026  * where the TmpTransform is created returns or throws an exception.
0027  */
0028 template <typename Ptr>
0029 class TmpTransform {
0030 
0031 public:
0032 
0033 
0034   /**
0035    * The contructor will call the transform(const LorentzRotation &)
0036    * of an object pointed to by \a p with \a r as argument.
0037    */
0038   TmpTransform(Ptr p, const LorentzRotation & r) : ptr(p), rot(r)
0039   {
0040     ptr->transform(rot);
0041   }
0042 
0043   /**
0044    * The destructor performs the inverse of the transformation done in
0045    * the constructor.
0046    */
0047   ~TmpTransform()
0048   {
0049     rot.invert();
0050     ptr->transform(rot);
0051   }
0052 
0053 private:
0054 
0055   /**
0056    * A pointer to the object being transformed.
0057    */
0058   Ptr ptr;
0059 
0060   /**
0061    * The rotation performed in the constructor.
0062    */
0063   LorentzRotation rot;
0064 
0065 private:
0066 
0067   /**
0068    * The assignment operator is private and must never be called.
0069    * In fact, it should not even be implemented.
0070    */
0071   TmpTransform & operator=(const TmpTransform &) = delete;
0072 
0073   /**
0074    * The default constructor is private and must never be called.
0075    * In fact, it should not even be implemented.
0076    */
0077   TmpTransform();
0078 
0079   /**
0080    * The copy constructor is private and must never be called.
0081    * In fact, it should not even be implemented.
0082    */
0083   TmpTransform(const TmpTransform &);
0084 
0085 };
0086 
0087 }
0088 
0089 #endif /* THEPEG_TmpTransform_H */