-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
TxCalculator.h
71 lines (51 loc) · 2.09 KB
/
TxCalculator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef TxCalculator_h
#define TxCalculator_h
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/EgammaCandidates/interface/Photon.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#define PI 3.141592653
namespace CLHEP {
class HepRandomEngine;
}
class TxCalculator
{
public:
TxCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::InputTag& trackLabel) ;
double getTx(const reco::Photon& clus, double i,double threshold, double innerDR=0,double effRatio=2);
double getCTx(const reco::Photon& clus, double i,double threshold, double innerDR=0, double effRatio=2);
double getMPT(double ptCut=0, double etaCut=1000);
double getJurassicArea( double r1, double r2, double width) ;
double getJt(const reco::Photon& cluster, double r1=0.4, double r2=0.04, double jWidth=0.015, double threshold=2);
double getJct(const reco::Photon& cluster, double r1=0.4, double r2=0.04, double jWidth=0.015, double threshold=2);
private:
edm::Handle<reco::TrackCollection> recCollection;
CLHEP::HepRandomEngine *theDice;
double dRDistance(double eta1,double phi1,double eta2,double phi2)
{
double deta = eta1 - eta2;
double dphi = (calcDphi(phi1, phi2));
return sqrt(deta * deta + dphi * dphi);
}
double calcDphi(double phi1_,double phi2_)
{
double dphi=phi1_-phi2_;
if (dphi>0){
while (dphi>2*PI) dphi-=2*PI;
if (dphi>PI) dphi=2*PI-dphi;
} else {
while (dphi<-2*PI) dphi+=2*PI;
if (dphi<-PI) dphi=-2*PI-dphi;
}
return dphi;
}
};
#endif