LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LCFourVector.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 #ifndef UTIL_LCFourVector_H
3 #define UTIL_LCFourVector_H 1
4 
5 #include "EVENT/LCObject.h"
6 #include "CLHEP/Vector/LorentzVector.h"
7 
8 
9 // CLHEP 1.9 and higher introduce a namespace:
10 namespace CLHEP{}
11 using namespace CLHEP ;
12 
13 
14 namespace UTIL {
15 
16 
29  template<class TT>
30  class LCFourVector : public HepLorentzVector {
31 
32  protected:
33  const TT* _lcObj = nullptr ;
34 
35  public:
36  virtual ~LCFourVector() { /*no_op*/; }
37 
38  LCFourVector(const LCFourVector& ) = default ;
39  LCFourVector& operator=(const LCFourVector& ) = default ;
40 
43  inline LCFourVector( const TT* lcObj) : _lcObj(lcObj) {
44  }
45 
46 
52 
53  _lcObj = dynamic_cast< const TT* >( lcObj ) ;
54 
55  if( _lcObj == 0 )
56  throw EVENT::Exception("Dynamic cast failed for LCFourVector() !") ;
57  }
58 
68  const TT* operator->() const { return _lcObj ; }
69 
70 
75  const TT* lcObj() const { return _lcObj ; }
76 
77 
78 
79  protected:
80  LCFourVector() {} // no default c'tor
81 
82  }; // class
83 
84 } // namespace UTIL
85 
86 
87 #include "UTIL/LCFourVector.icc"
88 
89 
90 #endif /* ifndef UTIL_LCFOURVECTOR_H */
91 
The generic object that is held in an LCCollection.
Definition: LCObject.h:30
Base exception class for LCIO - all other exceptions extend this.
Definition: Exceptions.h:21
const TT * operator->() const
Instances of LCFourVector serve as a handle to the templated type.
Definition: LCFourVector.h:68
LCFourVector(const TT *lcObj)
Constructor for templated type,e.g.
Definition: LCFourVector.h:43
Four vector used in LCIO.
Definition: LCFourVector.h:30
virtual ~LCFourVector()
Definition: LCFourVector.h:36
LCFourVector(const EVENT::LCObject *lcObj)
Constructor for LCObject.
Definition: LCFourVector.h:51
const TT * lcObj() const
Pointer to the LCObject that has been used to create the four vector.
Definition: LCFourVector.h:75