Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
PhysicsTools
IsolationAlgos
src
IsoDepositVetoFactory.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/IsolationAlgos/interface/IsoDepositVetoFactory.h
"
2
3
#include "
DataFormats/RecoCandidate/interface/IsoDepositVetos.h
"
4
#include "
PhysicsTools/IsolationAlgos/interface/EventDependentAbsVetos.h
"
5
#include <boost/regex.hpp>
6
7
// ---------- FIRST DEFINE NEW VETOS ------------
8
namespace
reco
{
namespace
isodeposit {
9
10
class
SwitchingEcalVeto
:
public
AbsVeto
{
11
public
:
12
// creates SwitchingEcalVeto from another AbsVeto (which becomes owned by this veto)
13
SwitchingEcalVeto
(
AbsVeto
*
veto
,
bool
isBarrel) :
14
veto_
(veto),
barrel_
(isBarrel) {}
15
virtual
bool
veto
(
double
eta
,
double
phi
,
float
value
)
const
{
16
return
(fabs(eta) < 1.479) == (
barrel_
) ?
veto_
->veto(eta,phi,value) :
false
;
17
}
18
virtual
void
centerOn
(
double
eta
,
double
phi
) {
19
veto_
->centerOn(eta,phi);
20
}
21
private
:
22
std::auto_ptr<AbsVeto>
veto_
;
23
bool
barrel_
;
24
};
25
26
class
NumCrystalVeto
:
public
AbsVeto
{
27
public
:
28
NumCrystalVeto
(
Direction
dir
,
double
iR) :
vetoDir_
(dir),
iR_
(iR) {}
29
virtual
bool
veto
(
double
eta
,
double
phi
,
float
value
)
const
{
30
if
( fabs(
vetoDir_
.
eta
()) < 1.479) {
31
return
(
vetoDir_
.
deltaR
(
Direction
(eta,phi)) < 0.0174*
iR_
);
32
}
else
{
33
return
(
vetoDir_
.
deltaR
(
Direction
(eta,phi)) < 0.00864*fabs(sinh(eta))*
iR_
);
34
}
35
}
36
virtual
void
centerOn
(
double
eta
,
double
phi
) {
vetoDir_
=
Direction
(eta,phi); }
37
private
:
38
Direction
vetoDir_
;
float
iR_
;
39
};
40
41
class
NumCrystalEtaPhiVeto
:
public
AbsVeto
{
42
public
:
43
NumCrystalEtaPhiVeto
(
math::XYZVectorD
dir
,
double
iEta,
double
iPhi) :
44
vetoDir_
(dir.
eta
(),dir.
phi
()),
45
iEta_
(iEta),
46
iPhi_
(iPhi) {}
47
NumCrystalEtaPhiVeto
(
Direction
dir
,
double
iEta,
double
iPhi) :
48
vetoDir_
(dir.
eta
(),dir.
phi
()),
49
iEta_
(iEta),
50
iPhi_
(iPhi) {}
51
virtual
bool
veto
(
double
eta
,
double
phi
,
float
value
)
const
{
52
double
dPhi
= phi -
vetoDir_
.
phi
();
53
double
dEta = eta -
vetoDir_
.
eta
();
54
while
( dPhi < -
M_PI
) dPhi += 2*
M_PI
;
55
while
( dPhi >=
M_PI
) dPhi -= 2*
M_PI
;
56
if
( fabs(
vetoDir_
.
eta
()) < 1.479) {
57
return
( (fabs(dEta) < 0.0174*
iEta_
) && (fabs(dPhi) < 0.0174*
iPhi_
) );
58
}
else
{
59
return
( (fabs(dEta) < 0.00864*fabs(sinh(eta))*
iEta_
) &&
60
(fabs(dPhi) < 0.00864*fabs(sinh(eta))*
iPhi_
) );
61
}
62
}
63
virtual
void
centerOn
(
double
eta
,
double
phi
) {
vetoDir_
=
Direction
(eta,phi); }
64
private
:
65
Direction
vetoDir_
;
66
double
iEta_
,
iPhi_
;
67
};
68
69
} }
70
71
// ---------- THEN THE ACTUAL FACTORY CODE ------------
72
reco::isodeposit::AbsVeto
*
73
IsoDepositVetoFactory::make
(
const
char
*
string
) {
74
reco::isodeposit::EventDependentAbsVeto
* evdep = 0;
75
std::auto_ptr<reco::isodeposit::AbsVeto>
ret
(
make
(
string
,evdep));
76
if
(evdep != 0) {
77
throw
cms::Exception
(
"Configuration"
) <<
"The resulting AbsVeto depends on the edm::Event.\n"
78
<<
"Please use the two-arguments IsoDepositVetoFactory::make.\n"
;
79
}
80
return
ret.release();
81
}
82
83
reco::isodeposit::AbsVeto
*
84
IsoDepositVetoFactory::make
(
const
char
*
string
,
reco::isodeposit::EventDependentAbsVeto
*&evdep) {
85
using namespace
reco::isodeposit;
86
static
boost::regex
87
ecalSwitch(
"^Ecal(Barrel|Endcaps):(.*)"
),
88
threshold
(
"Threshold\\((\\d+\\.\\d+)\\)"
),
89
thresholdtransverse(
"ThresholdFromTransverse\\((\\d+\\.\\d+)\\)"
),
90
absthreshold(
"AbsThreshold\\((\\d+\\.\\d+)\\)"
),
91
absthresholdtransverse(
"AbsThresholdFromTransverse\\((\\d+\\.\\d+)\\)"
),
92
cone(
"ConeVeto\\((\\d+\\.\\d+)\\)"
),
93
angleCone(
"AngleCone\\((\\d+\\.\\d+)\\)"
),
94
angleVeto(
"AngleVeto\\((\\d+\\.\\d+)\\)"
),
95
rectangularEtaPhiVeto(
"RectangularEtaPhiVeto\\(([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+),([+-]?\\d+\\.\\d+)\\)"
),
96
numCrystal(
"NumCrystalVeto\\((\\d+\\.\\d+)\\)"
),
97
numCrystalEtaPhi(
"NumCrystalEtaPhiVeto\\((\\d+\\.\\d+),(\\d+\\.\\d+)\\)"
),
98
otherCandidatesDR(
"OtherCandidatesByDR\\((\\w+:?\\w*:?\\w*),\\s*(\\d+\\.?|\\d*\\.\\d*)\\)"
),
99
otherJetConstituentsDR(
"OtherJetConstituentsDeltaRVeto\\((\\w+:?\\w*:?\\w*),\\s*(\\d+\\.?|\\d*\\.\\d*),\\s*(\\w+:?\\w*:?\\w*),\\s*(\\d+\\.?|\\d*\\.\\d*)\\)"
),
100
otherCand(
"^(.*?):(.*)"
),
101
number(
"^(\\d+\\.?|\\d*\\.\\d*)$"
);
102
boost::cmatch
match
;
103
104
//std::cout << "<IsoDepositVetoFactory::make>:" << std::endl;
105
//std::cout << " string = " << string << std::endl;
106
107
evdep = 0;
// by default it does not depend on this
108
if
(regex_match(
string
,
match
, ecalSwitch)) {
109
return
new
SwitchingEcalVeto
(
make
(
match
[2].
first
), (
match
[1] ==
"Barrel"
) );
110
}
else
if
(regex_match(
string
,
match
,
threshold
)) {
111
return
new
ThresholdVeto
(atof(
match
[1].
first
));
112
}
else
if
(regex_match(
string
,
match
, thresholdtransverse)) {
113
return
new
ThresholdVetoFromTransverse
(atof(((std::string)
match
[1]).c_str()));
114
}
else
if
(regex_match(
string
,
match
, absthreshold)) {
115
return
new
AbsThresholdVeto
(atof(
match
[1].
first
));
116
}
else
if
(regex_match(
string
,
match
, absthresholdtransverse)) {
117
return
new
AbsThresholdVetoFromTransverse
(atof(((std::string)
match
[1]).c_str()));
118
}
else
if
(regex_match(
string
,
match
, cone)) {
119
return
new
ConeVeto
(
Direction
(), atof(
match
[1].
first
));
120
}
else
if
(regex_match(
string
,
match
, number)) {
121
return
new
ConeVeto
(
Direction
(), atof(
match
[1].
first
));
122
}
else
if
(regex_match(
string
,
match
, angleCone)) {
123
return
new
AngleCone
(
Direction
(), atof(
match
[1].
first
));
124
}
else
if
(regex_match(
string
,
match
, angleVeto)) {
125
return
new
AngleConeVeto
(
Direction
(), atof(
match
[1].
first
));
126
}
else
if
(regex_match(
string
,
match
, rectangularEtaPhiVeto)) {
127
return
new
RectangularEtaPhiVeto
(
Direction
(),
128
atof(
match
[1].
first
), atof(
match
[2].first),
129
atof(
match
[3].first), atof(
match
[4].first));
130
}
else
if
(regex_match(
string
,
match
, numCrystal)) {
131
return
new
NumCrystalVeto
(
Direction
(), atof(
match
[1].
first
));
132
}
else
if
(regex_match(
string
,
match
, numCrystalEtaPhi)) {
133
return
new
NumCrystalEtaPhiVeto
(
Direction
(),atof(
match
[1].
first
),atof(
match
[2].first));
134
}
else
if
(regex_match(
string
,
match
, otherCandidatesDR)) {
135
OtherCandidatesDeltaRVeto
*
ret
=
new
OtherCandidatesDeltaRVeto
(
edm::InputTag
(
match
[1]),
136
atof(
match
[2].
first
));
137
evdep =
ret
;
138
return
ret
;
139
}
else
if
(regex_match(
string
,
match
, otherJetConstituentsDR)) {
140
OtherJetConstituentsDeltaRVeto
*
ret
=
new
OtherJetConstituentsDeltaRVeto
(
Direction
(),
141
edm::InputTag
(
match
[1]), atof(
match
[2].
first
),
142
edm::InputTag
(
match
[3]), atof(
match
[4].first));
143
evdep =
ret
;
144
return
ret
;
145
}
else
if
(regex_match(
string
,
match
, otherCand)) {
146
OtherCandVeto
*
ret
=
new
OtherCandVeto
(
edm::InputTag
(
match
[1]),
147
make
(
match
[2].
first
));
148
evdep =
ret
;
149
return
ret
;
150
}
else
{
151
throw
cms::Exception
(
"Not Implemented"
) <<
"Veto "
<<
string
<<
" not implemented yet..."
;
152
}
153
}
reco::isodeposit::EventDependentAbsVeto
Definition:
EventDependentAbsVeto.h:10
reco::isodeposit::NumCrystalEtaPhiVeto::vetoDir_
Direction vetoDir_
Definition:
IsoDepositVetoFactory.cc:65
reco::isodeposit::AbsThresholdVeto
Definition:
IsoDepositVetos.h:37
reco::isodeposit::AngleCone
Definition:
IsoDepositVetos.h:74
reco::isodeposit::SwitchingEcalVeto::barrel_
bool barrel_
Definition:
IsoDepositVetoFactory.cc:23
reco::isodeposit::Direction::phi
double phi() const
Definition:
IsoDepositDirection.h:34
reco::isodeposit::SwitchingEcalVeto::centerOn
virtual void centerOn(double eta, double phi)
Definition:
IsoDepositVetoFactory.cc:18
reco::isodeposit::AbsVeto
Definition:
IsoDeposit.h:29
reco::isodeposit::SwitchingEcalVeto::veto
virtual bool veto(double eta, double phi, float value) const
Return "true" if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
Definition:
IsoDepositVetoFactory.cc:15
relativeConstraints.value
tuple value
Definition:
relativeConstraints.py:54
run_regression.ret
int ret
Definition:
run_regression.py:388
reco::isodeposit::NumCrystalVeto::centerOn
virtual void centerOn(double eta, double phi)
Definition:
IsoDepositVetoFactory.cc:36
reco::isodeposit::NumCrystalEtaPhiVeto::NumCrystalEtaPhiVeto
NumCrystalEtaPhiVeto(math::XYZVectorD dir, double iEta, double iPhi)
Definition:
IsoDepositVetoFactory.cc:43
reco::isodeposit::NumCrystalEtaPhiVeto::iEta_
double iEta_
Definition:
IsoDepositVetoFactory.cc:66
IsoDepositVetos.h
eta
T eta() const
Definition:
Basic3DVectorLD.h:172
dt_dqm_sourceclient_common_cff.reco
tuple reco
Definition:
dt_dqm_sourceclient_common_cff.py:105
IsoDepositVetoFactory.h
reco::isodeposit::SwitchingEcalVeto::veto_
std::auto_ptr< AbsVeto > veto_
Definition:
IsoDepositVetoFactory.cc:22
reco::isodeposit::NumCrystalEtaPhiVeto::centerOn
virtual void centerOn(double eta, double phi)
Definition:
IsoDepositVetoFactory.cc:63
reco::isodeposit::Direction::eta
double eta() const
Definition:
IsoDepositDirection.h:33
math::XYZVectorD
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition:
Vector3D.h:9
dPhi
double dPhi(double phi1, double phi2)
Definition:
JetUtil.h:30
reco::isodeposit::NumCrystalEtaPhiVeto::veto
virtual bool veto(double eta, double phi, float value) const
Return "true" if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
Definition:
IsoDepositVetoFactory.cc:51
reco::isodeposit::Direction
Definition:
IsoDepositDirection.h:19
EventDependentAbsVetos.h
dtDQMClient_cfg.threshold
tuple threshold
Definition:
dtDQMClient_cfg.py:16
reco::isodeposit::OtherCandVeto
Definition:
EventDependentAbsVetos.h:34
first
bool first
Definition:
L1TdeRCT.cc:94
reco::isodeposit::ThresholdVeto
Definition:
IsoDepositVetos.h:19
reco::isodeposit::ConeVeto
Definition:
IsoDepositVetos.h:9
reco::isodeposit::NumCrystalVeto::vetoDir_
Direction vetoDir_
Definition:
IsoDepositVetoFactory.cc:38
reco::isodeposit::AngleConeVeto
Definition:
IsoDepositVetos.h:64
reco::isodeposit::SwitchingEcalVeto
Definition:
IsoDepositVetoFactory.cc:10
reco::isodeposit::NumCrystalEtaPhiVeto::NumCrystalEtaPhiVeto
NumCrystalEtaPhiVeto(Direction dir, double iEta, double iPhi)
Definition:
IsoDepositVetoFactory.cc:47
reco::isodeposit::OtherCandidatesDeltaRVeto
Definition:
EventDependentAbsVetos.h:9
reco::isodeposit::NumCrystalVeto::veto
virtual bool veto(double eta, double phi, float value) const
Return "true" if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
Definition:
IsoDepositVetoFactory.cc:29
reco::isodeposit::RectangularEtaPhiVeto
Definition:
IsoDepositVetos.h:84
edm::hlt::Exception
error
Definition:
HLTenums.h:24
M_PI
#define M_PI
Definition:
BFit3D.cc:3
reco::isodeposit::ThresholdVetoFromTransverse
Definition:
IsoDepositVetos.h:28
reco::isodeposit::AbsThresholdVetoFromTransverse
Definition:
IsoDepositVetos.h:46
IsoDepositVetoFactory::make
static reco::isodeposit::AbsVeto * make(const char *string)
Definition:
IsoDepositVetoFactory.cc:73
edm::InputTag
Definition:
InputTag.h:12
reco::isodeposit::OtherJetConstituentsDeltaRVeto
Definition:
EventDependentAbsVetos.h:59
reco::isodeposit::NumCrystalEtaPhiVeto::iPhi_
double iPhi_
Definition:
IsoDepositVetoFactory.cc:66
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:6
reco::isodeposit::NumCrystalEtaPhiVeto
Definition:
IsoDepositVetoFactory.cc:41
dir
dbl *** dir
Definition:
mlp_gen.cc:35
reco::isodeposit::NumCrystalVeto
Definition:
IsoDepositVetoFactory.cc:26
reco::isodeposit::NumCrystalVeto::NumCrystalVeto
NumCrystalVeto(Direction dir, double iR)
Definition:
IsoDepositVetoFactory.cc:28
reco::isodeposit::SwitchingEcalVeto::SwitchingEcalVeto
SwitchingEcalVeto(AbsVeto *veto, bool isBarrel)
Definition:
IsoDepositVetoFactory.cc:13
reco::isodeposit::NumCrystalVeto::iR_
float iR_
Definition:
IsoDepositVetoFactory.cc:38
reco::isodeposit::Direction::deltaR
double deltaR(const Direction &dir2) const
Definition:
IsoDepositDirection.h:46
phi
Definition:
DDAxes.h:10
Generated for CMSSW Reference Manual by
1.8.5