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;
83 typedef std::pair<reco::PFBlockRef, unsigned> ElementInBlock;
84 typedef std::vector< ElementInBlock > ElementsInBlocks;
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();
117 double deltaR = ROOT::Math::VectorUtil::DeltaR(myElecTrkEcalPos,candPos);
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);
164 double deltaR = ROOT::Math::VectorUtil::DeltaR(myElecTrkEcalPos,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 &)
const PFCandidateRefVector & isolationPFCands() const
PFCandidates in isolation region.
void setelectronPreIDDecision(const bool &)
Sin< T >::type sin(const T &t)
double EcalStripSumE_deltaPhiOverQ_minValue_
const edm::OwnVector< reco::PFBlockElement > & elements() const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
void sethcal3x3OverPLead(const float &)
const_iterator end() const
Termination of iteration.
void setemFraction(const float &)
const PFCandidateRefVector & signalPFCands() const
PFCandidates in signal region.
const_iterator begin() const
Initialize an iterator over the RefVector.
double deltaR(double eta1, double phi1, double eta2, double phi2)
RecoTauElectronRejectionPlugin(const edm::ParameterSet &pset)
bool isNonnull() const
Checks for non-null.
double EcalStripSumE_minClusEnergy_
double EcalStripSumE_deltaEta_
void reserve(size_type n)
Reserve space for RefVector.
block
Formating index page's pieces.
double deltaPhi(double phi1, double phi2)
void sethcalMaxOverPLead(const float &)
const PFCandidateRef & leadPFChargedHadrCand() const
void clear()
Clear the vector.
XYZPointD XYZPoint
point in space with cartesian internal representation
void setmaximumHCALPFClusterEt(const float &)
void setecalStripSumEOverPLead(const float &)
size_type size() const
Size of the RefVector.
#define DEFINE_EDM_PLUGIN(factory, type, name)
void sethcalTotOverPLead(const float &)
void setelectronPreIDTrack(const reco::TrackRef &)
double maximumForElectrionPreIDOutput_
void operator()(PFTau &) const
double EcalStripSumE_deltaPhiOverQ_maxValue_