CMS 3D CMS Logo

Qjets.h
Go to the documentation of this file.
1 #ifndef RecoJets_JetAlgorithms_QJets_h
2 #define RecoJets_JetAlgorithms_QJets_h
3 #include <queue>
4 #include <vector>
5 #include <list>
6 #include <algorithm>
7 #include "fastjet/JetDefinition.hh"
8 #include "fastjet/PseudoJet.hh"
9 #include "fastjet/ClusterSequence.hh"
14 #include "CLHEP/Random/RandomEngine.h"
15 
16 struct JetDistance {
17  double dij;
18  int j1;
19  int j2;
20 };
21 
23 public:
25  bool operator()(const JetDistance& lhs, const JetDistance& rhs) const { return lhs.dij > rhs.dij; };
26 };
27 
28 class Qjets {
29 private:
30  double omega;
32  unsigned int _seed;
33  double _zcut, _dcut, _dcut_fctr, _exp_min, _exp_max, _rigidity, _truncation_fctr;
34  std::map<int, bool> _merged_jets;
35  std::priority_queue<JetDistance, std::vector<JetDistance>, JetDistanceCompare> _distances;
36  CLHEP::HepRandomEngine* _rnEngine;
37 
38  double d_ij(const fastjet::PseudoJet& v1, const fastjet::PseudoJet& v2) const;
39  void computeDCut(fastjet::ClusterSequence& cs);
40 
41  double Rand();
42  bool Prune(JetDistance& jd, fastjet::ClusterSequence& cs);
43  bool JetsUnmerged(const JetDistance& jd) const;
44  bool JetUnmerged(int num) const;
45  void ComputeNewDistanceMeasures(fastjet::ClusterSequence& cs, unsigned int new_jet);
46  void ComputeAllDistances(const std::vector<fastjet::PseudoJet>& inp);
47  double ComputeMinimumDistance();
48  double ComputeNormalization(double dmin);
49  JetDistance GetNextDistance();
50  bool Same(const JetDistance& lhs, const JetDistance& rhs);
51 
52 public:
53  Qjets(double zcut,
54  double dcut_fctr,
55  double exp_min,
56  double exp_max,
57  double rigidity,
58  double truncation_fctr,
59  CLHEP::HepRandomEngine* rnEngine)
60  : _rand_seed_set(false),
61  _zcut(zcut),
62  _dcut(-1.),
63  _dcut_fctr(dcut_fctr),
64  _exp_min(exp_min),
65  _exp_max(exp_max),
66  _rigidity(rigidity),
67  _truncation_fctr(truncation_fctr),
68  _rnEngine(rnEngine){};
69 
70  void Cluster(fastjet::ClusterSequence& cs);
71  void SetRandSeed(unsigned int seed); /* In case you want reproducible behavior */
72 };
73 
75 public:
76  QjetsBaseExtras() : _wij(-1.) {}
77  ~QjetsBaseExtras() override {}
78  virtual double weight() const { return _wij; }
79  friend class Qjets;
80 
81 protected:
82  double _wij;
83 };
84 
85 #endif
double _zcut
Definition: Qjets.h:33
double _wij
Definition: Qjets.h:82
JetDistanceCompare()
Definition: Qjets.h:24
unique_ptr< ClusterSequence > cs
double dij
Definition: Qjets.h:17
QjetsBaseExtras()
Definition: Qjets.h:76
bool operator()(const JetDistance &lhs, const JetDistance &rhs) const
Definition: Qjets.h:25
int j2
Definition: Qjets.h:19
double omega
Definition: Qjets.h:30
unsigned int _seed
Definition: Qjets.h:32
bool _rand_seed_set
Definition: Qjets.h:31
std::map< int, bool > _merged_jets
Definition: Qjets.h:34
Definition: Qjets.h:28
Qjets(double zcut, double dcut_fctr, double exp_min, double exp_max, double rigidity, double truncation_fctr, CLHEP::HepRandomEngine *rnEngine)
Definition: Qjets.h:53
CLHEP::HepRandomEngine * _rnEngine
Definition: Qjets.h:36
std::priority_queue< JetDistance, std::vector< JetDistance >, JetDistanceCompare > _distances
Definition: Qjets.h:35
int j1
Definition: Qjets.h:18
~QjetsBaseExtras() override
Definition: Qjets.h:77
virtual double weight() const
Definition: Qjets.h:78