thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
PID.h
1 // -*- C++ -*-
2 //
3 // PID.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2019 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_PID_H
10 #define ThePEG_PID_H
11 
12 #include "EnumParticles.h"
13 
14 namespace ThePEG {
15 
23 class PID {
24 public:
28  template <typename T>
29  PID(T t) {
30  t.ERROR_only_use_long_as_Particle_ID_type();
31  }
32 
36  template <typename T>
37  operator T() const {
38  T t;
39  t.ERROR_only_use_long_as_Particle_ID_type();
40  return t;
41  }
42 
46  PID operator-() const;
47 
48 private:
52  long id;
53 };
54 
56 template <> inline PID::PID(long t) : id(t) {}
57 
59 template <> inline PID::PID(int t) : id(t) {}
60 
62 template <> inline PID::PID(ParticleID::ParticleCodes t) : id(t) {}
63 
65 template <> inline PID::operator long() const { return id; }
66 
70 inline PID PID::operator-() const {
71  return -id;
72 }
73 
74 }
75 
76 #endif /* ThePEG_PID_H */
PID is a helper class implementing the type of PDG particle ids.
Definition: PID.h:23
PID operator-() const
The negation operator.
Definition: PID.h:70
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
ParticleCodes
Enumeration to give identifiers to PDG id numbers.
Definition: EnumParticles.h:23
long id
The particle id.
Definition: PID.h:52
PID(T t)
Generic construction is disallowed.
Definition: PID.h:29