stablejet is hosted by Hepforge, IPPP Durham
StableJet
SimpleEvent.hh
1 #ifndef SIMPLEEVENT_HH_
2 #define SIMPLEEVENT_HH_
3 
4 #include "PythiaJetGun.hh"
5 #include "geners/ClassId.hh"
6 
7 // The following structure represents a jet
9 {
10  // Parton originating the jet
12 
13  // The constituent jet particles
14  std::vector<PythiaJetGun::Particle> jetParticles;
15 
16  inline bool operator==(const SimulatedJet& r) const
17  {return parton == r.parton && jetParticles == r.jetParticles;}
18 
19  inline bool operator!=(const SimulatedJet& r) const
20  {return !(*this == r);}
21 
22  // The sum of all constituent 4-vectors
23  rk::P4 jetSum() const;
24 
25  // The sum of 4-vectors which includes charged particles only
26  rk::P4 chargedSum() const;
27 
28  // Comparison operators for sorting vectors of jets using std::sort.
29  // Jets will be sorted by their transverse momentum.
30  inline bool operator<(const SimulatedJet& r) const
31  {
32  return jetSum().pt() < r.jetSum().pt();
33  }
34  inline bool operator>(const SimulatedJet& r) const
35  {
36  return jetSum().pt() > r.jetSum().pt();
37  }
38 
39  // I/O methods needed for writing
40  inline gs::ClassId classId() const {return gs::ClassId(*this);}
41  bool write(std::ostream& of) const;
42 
43  // I/O methods needed for reading
44  static inline const char* classname() {return "SimulatedJet";}
45  static inline unsigned version() {return 1;}
46  static void restore(const gs::ClassId& id, std::istream& in,
47  SimulatedJet* ptr);
48 };
49 
50 // The "event" is a collection of jets. In addition,
51 // there are some convenience functions for studying
52 // event properties.
53 struct SimpleEvent : public std::vector<SimulatedJet>
54 {
55  bool operator==(const SimpleEvent& r) const;
56 
57  inline bool operator!=(const SimpleEvent& r) const
58  {return !(*this == r);}
59 
60  // Find the 4-momentum of a jet closest to the given direction.
61  // This function can be used to find event jets matching to
62  // the reconstructed jets.
63  rk::P4 closestJet(double eta, double phi) const;
64 
65  // Find another jet which has closest direction
66  // to the jet with the given number
67  unsigned closestJetNumber(unsigned thisJetNumber) const;
68 
69  // Return the "delta R" for the two closest jets in the event
70  double minDr() const;
71 
72  // I/O methods needed for writing
73  inline gs::ClassId classId() const {return gs::ClassId(*this);}
74  bool write(std::ostream& of) const;
75 
76  // I/O methods needed for reading
77  static inline const char* classname() {return "SimpleEvent";}
78  static inline unsigned version() {return 1;}
79  static void restore(const gs::ClassId& id, std::istream& in,
80  SimpleEvent* ptr);
81 };
82 
83 // The following function figures out the angle phi at which
84 // particle track hits the calorimeter situated at radius r
85 // away from the production point, assuming simple circular
86 // trajectory in magnetic field B and neglecting the energy
87 // losses along the way. The return value indicates whether
88 // the particle actually reaches the calorimeter.
89 bool phiAtRadius(const PythiaJetGun::Particle& particle, double B,
90  double r, double *phi);
91 
92 #endif // SIMPLEEVENT_HH_