94 PFJetRef myPFJet=(*myPFTauTagInfoRef).pfjetRef();
95 PFTau myPFTau(std::numeric_limits<int>::quiet_NaN(),myPFJet->p4());
110 bool myleadPFCand_rectkavailable =
false;
111 double myleadPFCand_rectkDZ = 0.;
115 myPFTau.setleadPFChargedHadrCand(myleadPFChargedCand);
116 TrackRef myleadPFCand_rectk=(*myleadPFChargedCand).trackRef();
118 myleadPFCand_rectkavailable=
true;
119 myleadPFCand_rectkDZ=(*myleadPFCand_rectk).dz(myPV.
position());
122 GlobalVector myPFJetdir((*myPFJet).px(),(*myPFJet).py(),(*myPFJet).pz());
124 myPFTau.setleadPFChargedHadrCandsignedSipt(
141 double jetOpeningAngle = 0.0;
143 iCand != myTmpPFCandsInSignalCone.
end(); iCand++)
147 if (deltaRToSeed > jetOpeningAngle)
148 jetOpeningAngle = deltaRToSeed;
150 tmpLorentzVect+=(**iCand).p4();
154 double energy = tmpLorentzVect.energy();
155 double transverseEnergy = tmpLorentzVect.pt();
156 myPFTau.setP4(tmpLorentzVect);
159 double myTrackerSignalConeSize = myPFTauElementsOperators.computeConeSize(
161 double myTrackerIsolConeSize = myPFTauElementsOperators.computeConeSize(
163 double myECALSignalConeSize = myPFTauElementsOperators.computeConeSize(
165 double myECALIsolConeSize = myPFTauElementsOperators.computeConeSize(
167 double myHCALSignalConeSize = myPFTauElementsOperators.computeConeSize(
169 double myHCALIsolConeSize = myPFTauElementsOperators.computeConeSize(
173 PFCandidateRefVector mySignalPFChargedHadrCands, mySignalPFNeutrHadrCands, mySignalPFGammaCands, mySignalPFCands;
176 mySignalPFChargedHadrCands=myPFTauElementsOperators.PFChargedHadrCandsInCone(tauAxis,
181 mySignalPFChargedHadrCands=myPFTauElementsOperators.PFChargedHadrCandsInCone(tauAxis,
186 myPFTau.setsignalPFChargedHadrCands(mySignalPFChargedHadrCands);
189 mySignalPFNeutrHadrCands=myPFTauElementsOperators.PFNeutrHadrCandsInCone(tauAxis,
192 myPFTau.setsignalPFNeutrHadrCands(mySignalPFNeutrHadrCands);
195 mySignalPFGammaCands=myPFTauElementsOperators.PFGammaCandsInCone(tauAxis,
198 myPFTau.setsignalPFGammaCands(mySignalPFGammaCands);
201 if(mySignalPFChargedHadrCands.
size() != 0) {
202 int mySignalPFChargedHadrCands_qsum=0;
203 for(
size_t i = 0;
i < mySignalPFChargedHadrCands.
size();
i++) {
204 mySignalPFChargedHadrCands_qsum += mySignalPFChargedHadrCands[
i]->charge();
205 mySignalPFCands.
push_back(mySignalPFChargedHadrCands[
i]);
207 myPFTau.setCharge(mySignalPFChargedHadrCands_qsum);
211 for(
size_t i = 0;
i < mySignalPFNeutrHadrCands.
size();
i++) {
212 mySignalPFCands.
push_back(mySignalPFNeutrHadrCands[
i]);
216 double maxSignalGammaPt = 0.;
217 for(
size_t i = 0;
i < mySignalPFGammaCands.
size();
i++) {
218 if(mySignalPFGammaCands[
i]->pt() > maxSignalGammaPt) {
219 myleadPFNeutralCand = mySignalPFGammaCands[
i];
220 maxSignalGammaPt = mySignalPFGammaCands[
i]->pt();
222 mySignalPFCands.
push_back(mySignalPFGammaCands[
i]);
224 myPFTau.setsignalPFCands(mySignalPFCands);
226 myPFTau.setleadPFNeutralCand(myleadPFNeutralCand);
234 myPFTau.setleadPFCand(myleadPFChargedCand);
236 myPFTau.setleadPFCand(myleadPFNeutralCand);
240 PFCandidateRefVector myUnfilteredIsolPFChargedHadrCands, myIsolPFNeutrHadrCands, myIsolPFGammaCands, myIsolPFCands;
244 myUnfilteredIsolPFChargedHadrCands=myPFTauElementsOperators.PFChargedHadrCandsInAnnulus(
248 myUnfilteredIsolPFChargedHadrCands=myPFTauElementsOperators.PFChargedHadrCandsInAnnulus(
259 myPFTau.setisolationPFChargedHadrCands(myIsolPFChargedHadrCands);
262 myIsolPFNeutrHadrCands = myPFTauElementsOperators.PFNeutrHadrCandsInAnnulus(
265 myPFTau.setisolationPFNeutrHadrCands(myIsolPFNeutrHadrCands);
268 myIsolPFGammaCands = myPFTauElementsOperators.PFGammaCandsInAnnulus(
271 myPFTau.setisolationPFGammaCands(myIsolPFGammaCands);
278 rPhi =
Rphi_*myECALSignalConeSize;
282 std::pair<PFCandidateRefVector,PFCandidateRefVector> elementsInOutEllipse =
283 myPFTauElementsOperators.PFGammaCandsInOutEllipse(myIsolPFGammaCands, *myleadPFCand, rPhi, myECALSignalConeSize,
MaxEtInEllipse_);
290 mySignalPFGammaCands.
push_back(*inEllipseIt);
292 myPFTau.setsignalPFCands(mySignalPFCands);
294 myIsolPFGammaCands=elementsOutEllipse;
295 myPFTau.setisolationPFGammaCands(myIsolPFGammaCands);
300 float myIsolPFChargedHadrCands_Ptsum = 0.;
301 float myIsolPFGammaCands_Etsum = 0.;
302 for(
size_t i = 0;
i < myIsolPFChargedHadrCands.
size();
i++) {
303 myIsolPFChargedHadrCands_Ptsum += myIsolPFChargedHadrCands[
i]->pt();
304 myIsolPFCands.
push_back(myIsolPFChargedHadrCands[
i]);
306 myPFTau.setisolationPFChargedHadrCandsPtSum(myIsolPFChargedHadrCands_Ptsum);
309 for(
size_t i = 0;
i < myIsolPFNeutrHadrCands.
size();
i++) {
310 myIsolPFCands.
push_back(myIsolPFNeutrHadrCands[
i]);
313 for(
size_t i = 0;
i < myIsolPFGammaCands.
size();
i++) {
314 myIsolPFGammaCands_Etsum += myIsolPFGammaCands[
i]->et();
315 myIsolPFCands.
push_back(myIsolPFGammaCands[
i]);
317 myPFTau.setisolationPFGammaCandsEtSum(myIsolPFGammaCands_Etsum);
318 myPFTau.setisolationPFCands(myIsolPFCands);
323 iGammaCand != mySignalPFGammaCands.
end(); iGammaCand++) {
324 alternatLorentzVect+=(**iGammaCand).p4();
328 iChargedHadrCand != mySignalPFChargedHadrCands.
end(); iChargedHadrCand++) {
329 alternatLorentzVect+=(**iChargedHadrCand).p4();
331 myPFTau.setalternatLorentzVect(alternatLorentzVect);
332 myPFTau.setP4(alternatLorentzVect);
343 myPFTau.setleadTrack(myleadTk);
345 double myleadTkDZ = (*myleadTk).dz(myPV.
position());
353 myPFTau.setisolationTracks(myFilteredTracks);
360 myPFTau.setisolationTracks(myFilteredTracks);
366 double myECALenergy = 0.;
367 double myHCALenergy = 0.;
368 double myHCALenergy3x3 = 0.;
369 double myMaximumHCALPFClusterE = 0.;
370 double myMaximumHCALPFClusterEt = 0.;
371 double myStripClusterE = 0.;
372 double myEmfrac = -1.;
373 double myElectronPreIDOutput = -1111.;
374 bool myElecPreid =
false;
377 typedef std::pair<reco::PFBlockRef, unsigned> ElementInBlock;
378 typedef std::vector< ElementInBlock > ElementsInBlocks;
382 myElectronPreIDOutput = myleadPFChargedCand->mva_e_pi();
384 math::XYZPointF myElecTrkEcalPos = myleadPFChargedCand->positionAtECALEntrance();
385 myElecTrk = myleadPFChargedCand->trackRef();
391 for(
int i=0;
i<(int)myPFCands.
size();
i++){
392 myHCALenergy += myPFCands[
i]->hcalEnergy();
393 myECALenergy += myPFCands[
i]->ecalEnergy();
396 if (myPFCands[
i]->particleId()==1 || myPFCands[
i]->particleId()==2)
397 candPos = myPFCands[
i]->positionAtECALEntrance();
401 double deltaR = ROOT::Math::VectorUtil::DeltaR(myElecTrkEcalPos,candPos);
402 double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(myElecTrkEcalPos,candPos);
403 double deltaEta =
std::abs(myElecTrkEcalPos.eta()-candPos.eta());
404 double deltaPhiOverQ = deltaPhi/(double)myElecTrk->charge();
408 myStripClusterE += myPFCands[
i]->ecalEnergy();
411 myHCALenergy3x3 += myPFCands[
i]->hcalEnergy();
413 if (myPFCands[
i]->hcalEnergy()>myMaximumHCALPFClusterE) {
414 myMaximumHCALPFClusterE = myPFCands[
i]->hcalEnergy();
416 if ((myPFCands[
i]->hcalEnergy()*fabs(
sin(candPos.Theta())))>myMaximumHCALPFClusterEt) {
417 myMaximumHCALPFClusterEt = (myPFCands[
i]->hcalEnergy()*fabs(
sin(candPos.Theta())));
423 std::vector<math::XYZPoint> hcalPosV; hcalPosV.
clear();
424 std::vector<math::XYZPoint> ecalPosV; ecalPosV.clear();
425 for(
int i=0;
i<(int)myPFCands.
size();
i++){
426 const ElementsInBlocks& elts = myPFCands[
i]->elementsInBlocks();
427 for(ElementsInBlocks::const_iterator it=elts.begin(); it!=elts.end(); ++it) {
429 unsigned indexOfElementInBlock = it->second;
431 assert(indexOfElementInBlock<elements.
size());
437 double en = (double)element.clusterRef()->energy();
438 double et = (double)element.clusterRef()->energy()*fabs(
sin(clusPos.Theta()));
439 if (en>myMaximumHCALPFClusterE) {
440 myMaximumHCALPFClusterE = en;
442 if (et>myMaximumHCALPFClusterEt) {
443 myMaximumHCALPFClusterEt = et;
446 hcalPosV.push_back(clusPos);
448 double deltaR = ROOT::Math::VectorUtil::DeltaR(myElecTrkEcalPos,clusPos);
450 myHCALenergy3x3 += en;
454 double en = (double)element.clusterRef()->energy();
457 ecalPosV.push_back(clusPos);
459 double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(myElecTrkEcalPos,clusPos);
460 double deltaEta =
std::abs(myElecTrkEcalPos.eta()-clusPos.eta());
461 double deltaPhiOverQ = deltaPhi/(double)myElecTrk->charge();
463 myStripClusterE += en;
473 if ((myHCALenergy+myECALenergy)>0.)
474 myEmfrac = myECALenergy/(myHCALenergy+myECALenergy);
475 myPFTau.setemFraction((
float)myEmfrac);
480 float myElectronMomentum = (float)myElecTrk->p();
481 if (myElectronMomentum > 0.)
483 myHCALenergy /= myElectronMomentum;
484 myMaximumHCALPFClusterE /= myElectronMomentum;
485 myHCALenergy3x3 /= myElectronMomentum;
486 myStripClusterE /= myElectronMomentum;
489 myPFTau.sethcalTotOverPLead((
float)myHCALenergy);
490 myPFTau.sethcalMaxOverPLead((
float)myMaximumHCALPFClusterE);
491 myPFTau.sethcal3x3OverPLead((
float)myHCALenergy3x3);
492 myPFTau.setecalStripSumEOverPLead((
float)myStripClusterE);
493 myPFTau.setmaximumHCALPFClusterEt(myMaximumHCALPFClusterEt);
494 myPFTau.setelectronPreIDOutput(myElectronPreIDOutput);
496 myPFTau.setelectronPreIDTrack(myElecTrk);
499 myPFTau.setelectronPreIDDecision(myElecPreid);
Abstract base class for a PFBlock element (track, cluster...)
#define PFTauAlgo_ChargedHadrCand_minPt_
bool checkPos(std::vector< math::XYZPoint >, math::XYZPoint) const
double maximumForElectrionPreIDOutput_
double deltaPhi(float phi1, float phi2)
double HCALIsolConeSize_min_
const TransientTrackBuilder * TransientTrackBuilder_
double ECALSignalConeSize_max_
double y() const
y coordinate
uint32_t ChargedHadrCand_IsolAnnulus_minNhits_
Sin< T >::type sin(const T &t)
#define PFTauAlgo_Track_minPt_
bool UseTrackLeadTrackDZconstraint_
reco::TransientTrack build(const reco::Track *p) const
bool UseChargedHadrCandLeadChargedHadrCand_tksDZconstraint_
const edm::OwnVector< reco::PFBlockElement > & elements() const
double EcalStripSumE_deltaPhiOverQ_minValue_
TFormula myHCALSignalConeSizeTFormula
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
double HCALSignalConeSize_max_
const_iterator end() const
Termination of iteration.
const Point & position() const
position
const_iterator begin() const
Initialize an iterator over the RefVector.
double ChargedHadrCandLeadChargedHadrCand_tksmaxDZ_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double ECALSignalConeSize_min_
bool isNonnull() const
Checks for non-null.
double TrackerIsolConeSize_min_
#define PFTauAlgo_NeutrHadrCand_minPt_
double TrackerSignalConeSize_max_
double MatchingConeSize_min_
TFormula myTrackerSignalConeSizeTFormula
std::string ECALSignalConeMetric_
double z() const
y coordinate
TFormula myECALSignalConeSizeTFormula
uint32_t Track_IsolAnnulus_minNhits_
double ECALIsolConeSize_max_
std::string ECALIsolConeMetric_
double TrackerIsolConeSize_max_
std::string TrackerSignalConeMetric_
double deltaR(double eta1, double eta2, double phi1, double phi2)
double HCALSignalConeSize_min_
double x() const
x coordinate
TFormula myMatchingConeSizeTFormula
double HCALIsolConeSize_max_
double EcalStripSumE_deltaPhiOverQ_maxValue_
TFormula myHCALIsolConeSizeTFormula
void clear()
Clear the vector.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
TFormula myTrackerIsolConeSizeTFormula
double MatchingConeSize_max_
double EcalStripSumE_deltaEta_
#define PFTauAlgo_GammaCand_minPt_
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
double EcalStripSumE_minClusEnergy_
size_type size() const
Size of the RefVector.
std::string MatchingConeMetric_
double ECALIsolConeSize_min_
double TrackLeadTrack_maxDZ_
std::string TrackerIsolConeMetric_
std::string HCALSignalConeMetric_
TFormula myECALIsolConeSizeTFormula
#define PFTauAlgo_PFCand_minPt_
double TrackerSignalConeSize_min_
void setpfTauTagInfoRef(const PFTauTagInfoRef)
std::string HCALIsolConeMetric_