5 #include <boost/regex.hpp> 8 namespace reco {
namespace isodeposit {
15 virtual bool veto(
double eta,
double phi,
float value)
const override {
16 return (fabs(eta) < 1.479) == (
barrel_) ?
veto_->veto(eta,phi,value) :
false;
19 veto_->centerOn(eta,phi);
29 virtual bool veto(
double eta,
double phi,
float value)
const override {
30 if( fabs(vetoDir_.eta()) < 1.479) {
31 return ( vetoDir_.deltaR(
Direction(eta,phi)) < 0.0174*iR_ );
33 return ( vetoDir_.deltaR(
Direction(eta,phi)) < 0.00864*fabs(sinh(eta))*iR_ );
44 vetoDir_(dir.
eta(),dir.phi()),
48 vetoDir_(dir.
eta(),dir.phi()),
51 virtual bool veto(
double eta,
double phi,
float value)
const override {
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_) );
59 return ( (fabs(dEta) < 0.00864*fabs(sinh(eta))*iEta_) &&
60 (fabs(dPhi) < 0.00864*fabs(sinh(eta))*iPhi_) );
75 std::unique_ptr<reco::isodeposit::AbsVeto> ret(
make(
string,evdep, iC));
77 throw cms::Exception(
"Configuration") <<
"The resulting AbsVeto depends on the edm::Event.\n" 78 <<
"Please use the two-arguments IsoDepositVetoFactory::make.\n";
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*)$");
108 if (regex_match(
string, match, ecalSwitch)) {
110 }
else if (regex_match(
string, match,
threshold)) {
112 }
else if (regex_match(
string, match, thresholdtransverse)) {
114 }
else if (regex_match(
string, match, absthreshold)) {
116 }
else if (regex_match(
string, match, absthresholdtransverse)) {
118 }
else if (regex_match(
string, match, cone)) {
120 }
else if (regex_match(
string, match, number)) {
122 }
else if (regex_match(
string, match, angleCone)) {
124 }
else if (regex_match(
string, match, angleVeto)) {
126 }
else if (regex_match(
string, match, rectangularEtaPhiVeto)) {
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)) {
132 }
else if (regex_match(
string, match, numCrystalEtaPhi)) {
134 }
else if (regex_match(
string, match, otherCandidatesDR)) {
136 atof(match[2].
first),
140 }
else if (regex_match(
string, match, otherJetConstituentsDR)) {
147 }
else if (regex_match(
string, match, otherCand)) {
153 throw cms::Exception(
"Not Implemented") <<
"Veto " <<
string <<
" not implemented yet...";
static reco::isodeposit::AbsVeto * make(const char *string, edm::ConsumesCollector &iC)
S make(const edm::ParameterSet &cfg)
std::unique_ptr< AbsVeto > veto_
NumCrystalEtaPhiVeto(const math::XYZVectorD &dir, double iEta, double iPhi)
virtual bool veto(double eta, double phi, float value) const override
Return "true" if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
virtual void centerOn(double eta, double phi) override
double dPhi(double phi1, double phi2)
virtual bool veto(double eta, double phi, float value) const override
Return "true" if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
virtual bool veto(double eta, double phi, float value) const override
Return "true" if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
NumCrystalEtaPhiVeto(Direction dir, double iEta, double iPhi)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
virtual void centerOn(double eta, double phi) override
NumCrystalVeto(Direction dir, double iR)
SwitchingEcalVeto(AbsVeto *veto, bool isBarrel)
virtual void centerOn(double eta, double phi) override