19 #include <Math/VectorUtil.h>
22 namespace reco {
namespace tau {
45 pset.
getParameter<
double>(
"EcalStripSumE_minClusEnergy");
49 pset.
getParameter<
double>(
"EcalStripSumE_deltaPhiOverQ_minValue");
51 pset.
getParameter<
double>(
"EcalStripSumE_deltaPhiOverQ_maxValue");
53 pset.
getParameter<
double>(
"maximumForElectrionPreIDOutput");
58 bool checkPos(std::vector<math::XYZPoint> CalPos,
math::XYZPoint CandPos) {
60 for (
unsigned int i=0;
i<CalPos.size();
i++) {
61 if (CalPos[
i] == CandPos) {
72 double myECALenergy = 0.;
73 double myHCALenergy = 0.;
74 double myHCALenergy3x3 = 0.;
75 double myMaximumHCALPFClusterE = 0.;
76 double myMaximumHCALPFClusterEt = 0.;
77 double myStripClusterE = 0.;
78 double myEmfrac = -1.;
79 double myElectronPreIDOutput = -1111.;
80 bool myElecPreid =
false;
88 std::vector<PFCandidatePtr> myPFCands;
92 std::back_inserter(myPFCands));
94 std::back_inserter(myPFCands));
98 myElectronPreIDOutput = myleadPFChargedCand->mva_e_pi();
100 math::XYZPointF myElecTrkEcalPos = myleadPFChargedCand->positionAtECALEntrance();
101 myElecTrk = myleadPFChargedCand->trackRef();
107 for(
int i=0;
i<(int)myPFCands.size();
i++){
108 myHCALenergy += myPFCands[
i]->hcalEnergy();
109 myECALenergy += myPFCands[
i]->ecalEnergy();
112 if (myPFCands[
i]->particleId()==1 || myPFCands[
i]->particleId()==2)
113 candPos = myPFCands[
i]->positionAtECALEntrance();
118 double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(myElecTrkEcalPos,candPos);
119 double deltaEta =
abs(myElecTrkEcalPos.eta()-candPos.eta());
120 double deltaPhiOverQ = deltaPhi/(double)myElecTrk->charge();
124 myStripClusterE += myPFCands[
i]->ecalEnergy();
127 myHCALenergy3x3 += myPFCands[
i]->hcalEnergy();
129 if (myPFCands[
i]->hcalEnergy()>myMaximumHCALPFClusterE) {
130 myMaximumHCALPFClusterE = myPFCands[
i]->hcalEnergy();
132 if ((myPFCands[
i]->hcalEnergy()*fabs(
sin(candPos.Theta())))>myMaximumHCALPFClusterEt) {
133 myMaximumHCALPFClusterEt = (myPFCands[
i]->hcalEnergy()*fabs(
sin(candPos.Theta())));
139 std::vector<math::XYZPoint> hcalPosV; hcalPosV.clear();
140 std::vector<math::XYZPoint> ecalPosV; ecalPosV.clear();
141 for(
int i=0;
i<(int)myPFCands.size();
i++){
142 const ElementsInBlocks& elts = myPFCands[
i]->elementsInBlocks();
143 for(ElementsInBlocks::const_iterator it=elts.begin(); it!=elts.end(); ++it) {
145 unsigned indexOfElementInBlock = it->second;
147 assert(indexOfElementInBlock<elements.
size());
153 double en = (double)element.clusterRef()->energy();
154 double et = (double)element.clusterRef()->energy()*fabs(
sin(clusPos.Theta()));
155 if (en>myMaximumHCALPFClusterE) {
156 myMaximumHCALPFClusterE = en;
158 if (et>myMaximumHCALPFClusterEt) {
159 myMaximumHCALPFClusterEt = et;
161 if (!checkPos(hcalPosV,clusPos)) {
162 hcalPosV.push_back(clusPos);
166 myHCALenergy3x3 += en;
170 double en = (double)element.clusterRef()->energy();
172 if (!checkPos(ecalPosV,clusPos)) {
173 ecalPosV.push_back(clusPos);
175 double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(myElecTrkEcalPos,clusPos);
176 double deltaEta =
abs(myElecTrkEcalPos.eta()-clusPos.eta());
177 double deltaPhiOverQ = deltaPhi/(double)myElecTrk->charge();
179 myStripClusterE += en;
189 if ((myHCALenergy+myECALenergy)>0.)
190 myEmfrac = myECALenergy/(myHCALenergy+myECALenergy);
196 float myElectronMomentum = (float)myElecTrk->p();
197 if (myElectronMomentum > 0.)
199 myHCALenergy /= myElectronMomentum;
200 myMaximumHCALPFClusterE /= myElectronMomentum;
201 myHCALenergy3x3 /= myElectronMomentum;
202 myStripClusterE /= myElectronMomentum;
226 "RecoTauElectronRejectionPlugin");
T getParameter(std::string const &) const
Abstract base class for a PFBlock element (track, cluster...)
virtual ~RecoTauElectronRejectionPlugin()
double ElecPreIDLeadTkMatch_maxDR_
void setelectronPreIDOutput(const float &)
bool isNonnull() const
Checks for non-null.
const std::vector< reco::PFCandidatePtr > & isolationPFCands() const
PFCandidates in isolation region.
const PFCandidatePtr & leadPFChargedHadrCand() const
void setelectronPreIDDecision(const bool &)
Sin< T >::type sin(const T &t)
double EcalStripSumE_deltaPhiOverQ_minValue_
const edm::OwnVector< reco::PFBlockElement > & elements() const
double deltaR(const T1 &t1, const T2 &t2)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
void sethcal3x3OverPLead(const float &)
void setemFraction(const float &)
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
PFCandidates in signal region.
Abs< T >::type abs(const T &t)
double EcalStripSumE_minClusEnergy_
double EcalStripSumE_deltaEta_
bool isNonnull() const
Checks for non-null.
double deltaPhi(double phi1, double phi2)
void sethcalMaxOverPLead(const float &)
std::vector< ElementInBlock > ElementsInBlocks
XYZPointD XYZPoint
point in space with cartesian internal representation
std::pair< reco::PFBlockRef, unsigned > ElementInBlock
RecoTauElectronRejectionPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
void setmaximumHCALPFClusterEt(const float &)
void setecalStripSumEOverPLead(const float &)
#define DEFINE_EDM_PLUGIN(factory, type, name)
void sethcalTotOverPLead(const float &)
void setelectronPreIDTrack(const reco::TrackRef &)
double maximumForElectrionPreIDOutput_
void operator()(PFTau &) const override
double EcalStripSumE_deltaPhiOverQ_maxValue_