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, double dcut_fctr, double exp_min, double exp_max, double rigidity, double truncation_fctr, CLHEP::HepRandomEngine* rnEngine) : _rand_seed_set(false),
54  _zcut(zcut),
55  _dcut(-1.),
56  _dcut_fctr(dcut_fctr),
57  _exp_min(exp_min),
58  _exp_max(exp_max),
59  _rigidity(rigidity),
60  _truncation_fctr(truncation_fctr),
61  _rnEngine(rnEngine)
62  {};
63 
64  void Cluster(fastjet::ClusterSequence & cs);
65  void SetRandSeed(unsigned int seed); /* In case you want reproducible behavior */
66 };
67 
68 
70 public:
71  QjetsBaseExtras():_wij(-1.) {}
72  ~QjetsBaseExtras() override {}
73  virtual double weight() const {return _wij;}
74  friend class Qjets;
75 
76  protected:
77  double _wij;
78 };
79 
80 #endif
double _zcut
Definition: Qjets.h:33
double _wij
Definition: Qjets.h:77
JetDistanceCompare()
Definition: Qjets.h:24
unique_ptr< ClusterSequence > cs
double dij
Definition: Qjets.h:17
QjetsBaseExtras()
Definition: Qjets.h:71
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
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
std::map< int, bool > _merged_jets
Definition: Qjets.h:34
~QjetsBaseExtras() override
Definition: Qjets.h:72
virtual double weight() const
Definition: Qjets.h:73