Fork me on GitHub

source: git/external/PUPPI/puppiParticle.hh@ cd616b9

ImprovedOutputFile Timing dual_readout llp
Last change on this file since cd616b9 was fa33983, checked in by Pavel Demin <pavel.demin@…>, 10 years ago

add PUPPI and RunPUPPI module

  • Property mode set to 100644
File size: 2.6 KB
Line 
1#ifndef PUPPIPARTICLE_HH
2#define PUPPIPARTICLE_HH
3
4#include <functional>
5#include <algorithm>
6
7
8//............ class to keep track of particles used in the puppi code storing pt,eta,metric value, id (LV,PU) and position in the orignal vector of particles
9class puppiParticle {
10
11 public:
12
13 puppiParticle(){
14 fPt_ = 0.;
15 fEta_ = 0.;
16 fPval_ = 1.;
17 fParticleId_ = -1;
18 fPosition_ = -1;
19 };
20
21 puppiParticle(const float & pt, const float & eta, const float & pval, const int & particleId, const int & position):
22 fPt_(pt),
23 fEta_(eta),
24 fPval_(pval),
25 fParticleId_(particleId),
26 fPosition_(position)
27 {};
28
29 puppiParticle(const puppiParticle & particle) {
30 fPt_ = particle.fPt_;
31 fEta_ = particle.fEta_;
32 fPval_ = particle.fPval_;
33 fParticleId_ = particle.fParticleId_;
34 fPosition_ = particle.fPosition_;
35
36 }
37
38 virtual ~puppiParticle(){};
39
40 // sort asaf of pt
41 bool operator < (const puppiParticle & particle2) const {
42 if(fPt_ < particle2.fPt_) return true;
43 else return false;
44 };
45
46
47 // oper operator =
48 bool operator == (const puppiParticle & particle2) const {
49 if( fPt_ == particle2.fPt_ and fEta_ == particle2.fEta_ and
50 fPval_ == particle2.fPval_ and fParticleId_ == particle2.fParticleId_ and
51 fPosition_ == particle2.fPosition_) return true;
52 else return false ;
53 };
54
55 float fPt_; // pt of the candidate
56 float fEta_; // eta of the candidate
57 float fPval_; // metric value
58 int fParticleId_; // particle id means user_index
59 int fPosition_; // position in the original particle vector
60
61};
62
63class puppiValSort : public std::binary_function<int,int,bool> {
64 public:
65
66 puppiValSort(){};
67
68 ~puppiValSort(){};
69
70 bool operator() (const puppiParticle & x, const puppiParticle & y){
71 if(x.fPval_ < y.fPval_ ) return true;
72 return false;
73 }
74};
75
76#endif
Note: See TracBrowser for help on using the repository browser.