CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 "fastjet/JetDefinition.hh"
6 #include "fastjet/PseudoJet.hh"
7 #include "fastjet/ClusterSequence.hh"
12 #include "CLHEP/Random/RandomEngine.h"
13 
14 struct JetDistance{
15  double dij;
16  int j1;
17  int j2;
18 };
19 
21  public:
23  bool operator() (const JetDistance& lhs, const JetDistance&rhs) const {return lhs.dij > rhs.dij;};
24 };
25 
26 class Qjets{
27  private:
29  unsigned int _seed;
31  std::map<int,bool> _merged_jets;
32  std::priority_queue <JetDistance, std::vector<JetDistance>, JetDistanceCompare> _distances;
33  CLHEP::HepRandomEngine* _rnEngine;
34 
35  double d_ij(const fastjet::PseudoJet& v1, const fastjet::PseudoJet& v2) const;
36  void computeDCut(fastjet::ClusterSequence & cs);
37 
38  double Rand();
39  bool Prune(JetDistance& jd,fastjet::ClusterSequence & cs);
40  bool JetsUnmerged(const JetDistance& jd) const;
41  bool JetUnmerged(int num) const;
42  void ComputeNewDistanceMeasures(fastjet::ClusterSequence & cs, unsigned int new_jet);
43  void ComputeAllDistances(const std::vector<fastjet::PseudoJet>& inp);
44  double ComputeMinimumDistance();
45  double ComputeNormalization(double dmin);
46  JetDistance GetNextDistance();
47  bool Same(const JetDistance& lhs, const JetDistance& rhs);
48 
49  public:
50  Qjets(double zcut, double dcut_fctr, double exp_min, double exp_max, double rigidity, double truncation_fctr, CLHEP::HepRandomEngine* rnEngine) : _rand_seed_set(false),
51  _zcut(zcut),
52  _dcut(-1.),
53  _dcut_fctr(dcut_fctr),
54  _exp_min(exp_min),
55  _exp_max(exp_max),
56  _rigidity(rigidity),
57  _truncation_fctr(truncation_fctr),
58  _rnEngine(rnEngine)
59  {};
60 
61  void Cluster(fastjet::ClusterSequence & cs);
62  void SetRandSeed(unsigned int seed); /* In case you want reproducible behavior */
63 };
64 #endif
void ComputeNewDistanceMeasures(fastjet::ClusterSequence &cs, unsigned int new_jet)
Definition: Qjets.cc:141
void Cluster(fastjet::ClusterSequence &cs)
Definition: Qjets.cc:61
auto_ptr< ClusterSequence > cs
double _zcut
Definition: Qjets.h:30
JetDistanceCompare()
Definition: Qjets.h:22
bool JetUnmerged(int num) const
Definition: Qjets.cc:10
void SetRandSeed(unsigned int seed)
Definition: Qjets.cc:5
double _dcut
Definition: Qjets.h:30
double _dcut_fctr
Definition: Qjets.h:30
double dij
Definition: Qjets.h:15
double ComputeNormalization(double dmin)
bool Prune(JetDistance &jd, fastjet::ClusterSequence &cs)
Definition: Qjets.cc:116
bool operator()(const JetDistance &lhs, const JetDistance &rhs) const
Definition: Qjets.h:23
int j2
Definition: Qjets.h:17
void computeDCut(fastjet::ClusterSequence &cs)
Definition: Qjets.cc:108
double _exp_max
Definition: Qjets.h:30
JetDistance GetNextDistance()
Definition: Qjets.cc:18
double _exp_min
Definition: Qjets.h:30
unsigned int _seed
Definition: Qjets.h:29
bool _rand_seed_set
Definition: Qjets.h:28
double _truncation_fctr
Definition: Qjets.h:30
Definition: Qjets.h:26
Qjets(double zcut, double dcut_fctr, double exp_min, double exp_max, double rigidity, double truncation_fctr, CLHEP::HepRandomEngine *rnEngine)
Definition: Qjets.h:50
double _rigidity
Definition: Qjets.h:30
CLHEP::HepRandomEngine * _rnEngine
Definition: Qjets.h:33
double Rand()
Definition: Qjets.cc:162
double d_ij(const fastjet::PseudoJet &v1, const fastjet::PseudoJet &v2) const
Definition: Qjets.cc:153
double ComputeMinimumDistance()
void ComputeAllDistances(const std::vector< fastjet::PseudoJet > &inp)
Definition: Qjets.cc:126
std::priority_queue< JetDistance, std::vector< JetDistance >, JetDistanceCompare > _distances
Definition: Qjets.h:32
int j1
Definition: Qjets.h:16
std::map< int, bool > _merged_jets
Definition: Qjets.h:31
volatile std::atomic< bool > shutdown_flag false
bool Same(const JetDistance &lhs, const JetDistance &rhs)
bool JetsUnmerged(const JetDistance &jd) const
Definition: Qjets.cc:14