src
PhysicsTools
JetCharge
interface
JetCharge.h
Go to the documentation of this file.
1
#ifndef RecoJets_JetCharge_JetCharge_H
2
#define RecoJets_JetCharge_JetCharge_H
3
4
#include "
DataFormats/Math/interface/LorentzVector.h
"
5
#include "
DataFormats/Math/interface/Vector.h
"
6
//#include "DataFormats/Candidate/interface/CandidateFwd.h"
7
#include "
DataFormats/TrackReco/interface/Track.h
"
8
#include "
DataFormats/TrackReco/interface/TrackFwd.h
"
9
#include "
DataFormats/Candidate/interface/Candidate.h
"
10
#include "
DataFormats/Candidate/interface/CompositeCandidate.h
"
11
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
12
#include <Math/VectorUtil.h>
13
#include <Math/Rotation3D.h>
14
#include <Math/RotationZ.h>
15
#include <Math/RotationY.h>
16
#include <cmath>
17
18
class
JetCharge
{
19
public
:
20
enum
Variable
{
Pt
,
RelPt
,
RelEta
,
DeltaR
,
Unit
};
21
typedef
reco::Particle::LorentzVector
LorentzVector
;
22
typedef
reco::Particle::Vector
Vector
;
23
24
JetCharge
(
Variable
var
,
double
exponent
= 1.0) :
var_
(
var
),
exp_
(
exponent
) {}
25
JetCharge
(
const
edm::ParameterSet
&iCfg);
26
27
double
charge
(
const
LorentzVector
&lv,
const
reco::TrackCollection
&vec)
const
;
28
double
charge
(
const
LorentzVector
&lv,
const
reco::TrackRefVector
&vec)
const
;
29
double
charge
(
const
LorentzVector
&lv,
const
reco::CandidateCollection
&vec)
const
;
30
double
charge
(
const
reco::Candidate
&
parent
)
const
;
31
//double charge(const LorentzVector &lv, const reco::CandidateRefVector &vec) const ;
32
33
private
:
34
// functions
35
template
<
typename
T,
typename
C>
36
double
chargeFromRef
(
const
LorentzVector
&lv,
const
C
&vec)
const
;
37
template
<
typename
T,
typename
C>
38
double
chargeFromVal
(
const
LorentzVector
&lv,
const
C
&vec)
const
;
39
template
<
typename
T,
typename
IT>
40
double
chargeFromValIterator
(
const
LorentzVector
&lv,
const
IT
&begin,
const
IT
&
end
)
const
;
41
42
template
<
class
T>
43
double
getWeight
(
const
LorentzVector
&lv,
const
T
&
obj
)
const
;
44
45
// data members
46
Variable
var_
;
47
double
exp_
;
48
};
49
template
<
typename
T,
typename
IT>
50
double
JetCharge::chargeFromValIterator
(
const
LorentzVector
&lv,
const
IT
&begin,
const
IT
&
end
)
const
{
51
double
num
= 0.0, den = 0.0;
52
for
(
IT
it
= begin;
it
!=
end
; ++
it
) {
53
const
T
&
obj
= *
it
;
54
double
w
=
getWeight
(lv,
obj
);
55
den +=
w
;
56
num
+=
w
*
obj
.charge();
57
}
58
return
(den > 0.0 ?
num
/ den : 0.0);
59
}
60
61
template
<
typename
T,
typename
C>
62
double
JetCharge::chargeFromVal
(
const
LorentzVector
&lv,
const
C
&vec)
const
{
63
typedef
typename
C::const_iterator
IT
;
64
return
JetCharge::chargeFromValIterator<T, IT>(lv, vec.begin(), vec.end());
65
}
66
67
template
<
typename
T,
typename
C>
68
double
JetCharge::chargeFromRef
(
const
LorentzVector
&lv,
const
C
&vec)
const
{
69
typedef
typename
C::const_iterator
IT
;
70
double
num
= 0.0, den = 0.0;
71
for
(
IT
it
= vec.begin(),
end
= vec.end();
it
!=
end
; ++
it
) {
72
const
T
&
obj
= *
it
;
73
double
w
=
getWeight
(lv, *
obj
);
74
den +=
w
;
75
num
+=
w
*
obj
->charge();
76
}
77
return
(den > 0.0 ?
num
/ den : 0.0);
78
}
79
80
template
<
class
T>
81
double
JetCharge::getWeight
(
const
LorentzVector
&lv,
const
T
&
obj
)
const
{
82
double
ret
;
83
switch
(
var_
) {
84
case
Pt
:
85
ret
=
obj
.pt();
86
break
;
87
case
DeltaR
:
88
ret
=
ROOT::Math::VectorUtil::DeltaR
(lv.Vect(),
obj
.momentum());
89
break
;
90
case
RelPt
:
91
case
RelEta
:
92
ret
= lv.Vect().Dot(
obj
.momentum()) / (lv.P() *
obj
.p());
// cos(theta)
93
ret
= (
var_
==
RelPt
?
std::sqrt
(1 -
ret
*
ret
) *
obj
.p() :
// p * sin(theta) = pt
94
-0.5 *
std::log
((1 -
ret
) / (1 +
ret
)));
// = - log tan theta/2 = eta
95
break
;
96
case
Unit
:
97
default
:
98
ret
= 1.0;
99
}
100
return
(
exp_
== 1.0 ?
ret
: (
ret
> 0 ?
std::pow
(
ret
,
exp_
) : -
std::pow
(
std::abs
(
ret
),
exp_
)));
101
}
102
103
#endif
JetCharge::Pt
Definition:
JetCharge.h:20
electronAnalyzer_cfi.DeltaR
DeltaR
Definition:
electronAnalyzer_cfi.py:33
trigObjTnPSource_cfi.var
var
Definition:
trigObjTnPSource_cfi.py:21
w
T w() const
Definition:
extBasic3DVector.h:225
HLT_2024v14_cff.exponent
exponent
Definition:
HLT_2024v14_cff.py:38492
JetCharge::chargeFromVal
double chargeFromVal(const LorentzVector &lv, const C &vec) const
Definition:
JetCharge.h:62
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition:
runTheMatrix.py:759
Variable
Definition:
SimpleFlatTableProducer.h:39
reco::Candidate
Definition:
Candidate.h:27
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition:
TrackFwd.h:14
TrackFwd.h
JetCharge::JetCharge
JetCharge(Variable var, double exponent=1.0)
Definition:
JetCharge.h:24
CompositeCandidate.h
JetCharge::RelPt
Definition:
JetCharge.h:20
ParameterSet.h
JetCharge::var_
Variable var_
Definition:
JetCharge.h:46
JetCharge::Vector
reco::Particle::Vector Vector
Definition:
JetCharge.h:22
Candidate.h
edm::OwnVector
Definition:
OwnVector.h:24
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:19
JetCharge::exp_
double exp_
Definition:
JetCharge.h:47
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
LorentzVector
math::XYZTLorentzVector LorentzVector
Definition:
HLTMuonMatchAndPlot.h:47
JetCharge::LorentzVector
reco::Particle::LorentzVector LorentzVector
Definition:
JetCharge.h:21
LorentzVector.h
IT
std::vector< LinkConnSpec >::const_iterator IT
Definition:
TriggerBoardSpec.cc:5
correctionTermsCaloMet_cff.C
C
Definition:
correctionTermsCaloMet_cff.py:34
EgammaValidation_cff.num
num
Definition:
EgammaValidation_cff.py:33
JetCharge::charge
double charge(const LorentzVector &lv, const reco::TrackCollection &vec) const
Definition:
JetCharge.cc:7
mps_fire.end
end
Definition:
mps_fire.py:242
Vector.h
JetCharge::RelEta
Definition:
JetCharge.h:20
getGTfromDQMFile.obj
obj
Definition:
getGTfromDQMFile.py:32
edm::RefVector< TrackCollection >
JetCharge::chargeFromValIterator
double chargeFromValIterator(const LorentzVector &lv, const IT &begin, const IT &end) const
Definition:
JetCharge.h:50
JetCharge::chargeFromRef
double chargeFromRef(const LorentzVector &lv, const C &vec) const
Definition:
JetCharge.h:68
ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it
auto & it
Definition:
splitVertices.h:48
reco::Particle::Vector
math::XYZVector Vector
point in the space
Definition:
Particle.h:27
JetCharge
Definition:
JetCharge.h:18
JetCharge::getWeight
double getWeight(const LorentzVector &lv, const T &obj) const
Definition:
JetCharge.h:81
JetCharge::DeltaR
Definition:
JetCharge.h:20
class-composition.parent
parent
Definition:
class-composition.py:99
Track.h
edm::ParameterSet
Definition:
ParameterSet.h:48
dqm-mbProfile.log
log
Definition:
dqm-mbProfile.py:17
JetCharge::Unit
Definition:
JetCharge.h:20
T
long double T
Definition:
Basic3DVectorLD.h:48
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:21
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition:
Power.h:29
Generated for CMSSW Reference Manual by
1.8.14