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;
89 myPFCands.reserve(
tau.isolationPFCands().size()+
tau.signalPFCands().size());
92 std::back_inserter(myPFCands));
94 std::back_inserter(myPFCands));
97 if(myleadPFChargedCand.isNonnull()){
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);
191 tau.setemFraction((
float)myEmfrac);
196 float myElectronMomentum = (float)myElecTrk->p();
197 if (myElectronMomentum > 0.)
199 myHCALenergy /= myElectronMomentum;
200 myMaximumHCALPFClusterE /= myElectronMomentum;
201 myHCALenergy3x3 /= myElectronMomentum;
202 myStripClusterE /= myElectronMomentum;
205 tau.sethcalTotOverPLead((
float)myHCALenergy);
206 tau.sethcalMaxOverPLead((
float)myMaximumHCALPFClusterE);
207 tau.sethcal3x3OverPLead((
float)myHCALenergy3x3);
208 tau.setecalStripSumEOverPLead((
float)myStripClusterE);
209 tau.setmaximumHCALPFClusterEt(myMaximumHCALPFClusterEt);
210 tau.setelectronPreIDOutput(myElectronPreIDOutput);
212 tau.setelectronPreIDTrack(myElecTrk);
215 tau.setelectronPreIDDecision(myElecPreid);
Abstract base class for a PFBlock element (track, cluster...)
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
bool isNonnull() const
Checks for non-null.
Abs< T >::type abs(const T &t)
double EcalStripSumE_minClusEnergy_
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
double EcalStripSumE_deltaEta_
double deltaPhi(double phi1, double phi2)
std::vector< ElementInBlock > ElementsInBlocks
XYZPointD XYZPoint
point in space with cartesian internal representation
std::pair< reco::PFBlockRef, unsigned > ElementInBlock
edm::Ptr< PFCandidate > PFCandidatePtr
persistent Ptr to a PFCandidate
double maximumForElectrionPreIDOutput_
double EcalStripSumE_deltaPhiOverQ_maxValue_