19 #include <Math/VectorUtil.h>
55 bool checkPos(std::vector<math::XYZPoint> CalPos,
math::XYZPoint CandPos) {
57 for (
unsigned int i = 0;
i < CalPos.size();
i++) {
58 if (CalPos[
i] == CandPos) {
69 double myECALenergy = 0.;
70 double myHCALenergy = 0.;
71 double myHCALenergy3x3 = 0.;
72 double myMaximumHCALPFClusterE = 0.;
73 double myMaximumHCALPFClusterEt = 0.;
74 double myStripClusterE = 0.;
75 double myEmfrac = -1.;
76 double myElectronPreIDOutput = -1111.;
77 bool myElecPreid =
false;
85 std::vector<PFCandidatePtr> myPFCands;
93 myElectronPreIDOutput = myleadPFChargedCand->mva_e_pi();
95 math::XYZPointF myElecTrkEcalPos = myleadPFChargedCand->positionAtECALEntrance();
96 myElecTrk = myleadPFChargedCand->trackRef();
102 for (
int i = 0;
i < (int)myPFCands.size();
i++) {
103 myHCALenergy += myPFCands[
i]->hcalEnergy();
104 myECALenergy += myPFCands[
i]->ecalEnergy();
107 if (myPFCands[
i]->particleId() == 1 || myPFCands[
i]->particleId() == 2)
108 candPos = myPFCands[
i]->positionAtECALEntrance();
110 candPos =
math::XYZPointF(myPFCands[
i]->px(), myPFCands[
i]->py(), myPFCands[
i]->pz());
115 double deltaPhiOverQ = deltaPhi / (double)myElecTrk->charge();
120 myStripClusterE += myPFCands[
i]->ecalEnergy();
122 if (deltaR < 0.184) {
123 myHCALenergy3x3 += myPFCands[
i]->hcalEnergy();
125 if (myPFCands[
i]->hcalEnergy() > myMaximumHCALPFClusterE) {
126 myMaximumHCALPFClusterE = myPFCands[
i]->hcalEnergy();
128 if ((myPFCands[
i]->hcalEnergy() * fabs(
sin(candPos.Theta()))) > myMaximumHCALPFClusterEt) {
129 myMaximumHCALPFClusterEt = (myPFCands[
i]->hcalEnergy() * fabs(
sin(candPos.Theta())));
135 std::vector<math::XYZPoint> hcalPosV;
137 std::vector<math::XYZPoint> ecalPosV;
139 for (
int i = 0;
i < (int)myPFCands.size();
i++) {
140 const ElementsInBlocks& elts = myPFCands[
i]->elementsInBlocks();
141 for (ElementsInBlocks::const_iterator it = elts.begin(); it != elts.end(); ++it) {
143 unsigned indexOfElementInBlock = it->second;
145 assert(indexOfElementInBlock < elements.
size());
151 double en = (double)element.clusterRef()->energy();
152 double et = (double)element.clusterRef()->energy() * fabs(
sin(clusPos.Theta()));
153 if (en > myMaximumHCALPFClusterE) {
154 myMaximumHCALPFClusterE = en;
156 if (et > myMaximumHCALPFClusterEt) {
157 myMaximumHCALPFClusterEt = et;
159 if (!checkPos(hcalPosV, clusPos)) {
160 hcalPosV.push_back(clusPos);
163 if (deltaR < 0.184) {
164 myHCALenergy3x3 += en;
168 double en = (double)element.clusterRef()->energy();
170 if (!checkPos(ecalPosV, clusPos)) {
171 ecalPosV.push_back(clusPos);
175 double deltaPhiOverQ = deltaPhi / (double)myElecTrk->charge();
179 myStripClusterE += en;
189 if ((myHCALenergy + myECALenergy) > 0.)
190 myEmfrac = myECALenergy / (myHCALenergy + myECALenergy);
195 float myElectronMomentum = (float)myElecTrk->p();
196 if (myElectronMomentum > 0.) {
197 myHCALenergy /= myElectronMomentum;
198 myMaximumHCALPFClusterE /= myElectronMomentum;
199 myHCALenergy3x3 /= myElectronMomentum;
200 myStripClusterE /= myElectronMomentum;
225 "RecoTauElectronRejectionPlugin");
constexpr double deltaPhi(double phi1, double phi2)
Abstract base class for a PFBlock element (track, cluster...)
double ElecPreIDLeadTkMatch_maxDR_
const std::vector< reco::PFCandidatePtr > & isolationPFCands() const
void setelectronPreIDOutput(const float &)
bool isNonnull() const
Checks for non-null.
void setelectronPreIDDecision(const bool &)
Sin< T >::type sin(const T &t)
double EcalStripSumE_deltaPhiOverQ_minValue_
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
void sethcal3x3OverPLead(const float &)
void setemFraction(const float &)
static const double deltaEta
std::vector< ElementInBlock > ElementsInBlocks
Abs< T >::type abs(const T &t)
double EcalStripSumE_minClusEnergy_
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
double EcalStripSumE_deltaEta_
bool isNonnull() const
Checks for non-null.
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
~RecoTauElectronRejectionPlugin() override
void sethcalMaxOverPLead(const float &)
XYZPointD XYZPoint
point in space with cartesian internal representation
T getParameter(std::string const &) const
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 &)
const PFCandidatePtr leadPFChargedHadrCand() const
Getters for different PFCandidates for PFTaus made from PFCandidates.
const edm::OwnVector< reco::PFBlockElement > & elements() const
void setelectronPreIDTrack(const reco::TrackRef &)
double maximumForElectrionPreIDOutput_
void operator()(PFTau &) const override
double EcalStripSumE_deltaPhiOverQ_maxValue_