97 PFJetRef myPFJet=(*myPFTauTagInfoRef).pfjetRef();
98 PFTau myPFTau(std::numeric_limits<int>::quiet_NaN(),myPFJet->p4());
113 bool myleadPFCand_rectkavailable =
false;
114 double myleadPFCand_rectkDZ = 0.;
118 myPFTau.setleadPFChargedHadrCand(myleadPFChargedCand);
119 TrackRef myleadPFCand_rectk=(*myleadPFChargedCand).trackRef();
121 myleadPFCand_rectkavailable=
true;
122 myleadPFCand_rectkDZ=(*myleadPFCand_rectk).dz(myPV.
position());
125 GlobalVector myPFJetdir((*myPFJet).px(),(*myPFJet).py(),(*myPFJet).pz());
127 myPFTau.setleadPFChargedHadrCandsignedSipt(
144 double jetOpeningAngle = 0.0;
146 iCand != myTmpPFCandsInSignalCone.
end(); iCand++)
150 if (deltaRToSeed > jetOpeningAngle)
151 jetOpeningAngle = deltaRToSeed;
153 tmpLorentzVect+=(**iCand).p4();
157 double energy = tmpLorentzVect.energy();
158 double transverseEnergy = tmpLorentzVect.pt();
159 myPFTau.setP4(tmpLorentzVect);
162 double myTrackerSignalConeSize = myPFTauElementsOperators.computeConeSize(
164 double myTrackerIsolConeSize = myPFTauElementsOperators.computeConeSize(
166 double myECALSignalConeSize = myPFTauElementsOperators.computeConeSize(
168 double myECALIsolConeSize = myPFTauElementsOperators.computeConeSize(
170 double myHCALSignalConeSize = myPFTauElementsOperators.computeConeSize(
172 double myHCALIsolConeSize = myPFTauElementsOperators.computeConeSize(
176 PFCandidateRefVector mySignalPFChargedHadrCands, mySignalPFNeutrHadrCands, mySignalPFGammaCands, mySignalPFCands;
179 mySignalPFChargedHadrCands=myPFTauElementsOperators.PFChargedHadrCandsInCone(tauAxis,
184 mySignalPFChargedHadrCands=myPFTauElementsOperators.PFChargedHadrCandsInCone(tauAxis,
189 myPFTau.setsignalPFChargedHadrCands(mySignalPFChargedHadrCands);
192 mySignalPFNeutrHadrCands=myPFTauElementsOperators.PFNeutrHadrCandsInCone(tauAxis,
195 myPFTau.setsignalPFNeutrHadrCands(mySignalPFNeutrHadrCands);
198 mySignalPFGammaCands=myPFTauElementsOperators.PFGammaCandsInCone(tauAxis,
201 myPFTau.setsignalPFGammaCands(mySignalPFGammaCands);
204 if(mySignalPFChargedHadrCands.
size() != 0) {
205 int mySignalPFChargedHadrCands_qsum=0;
206 for(
size_t i = 0;
i < mySignalPFChargedHadrCands.
size();
i++) {
207 mySignalPFChargedHadrCands_qsum += mySignalPFChargedHadrCands[
i]->charge();
208 mySignalPFCands.
push_back(mySignalPFChargedHadrCands[
i]);
210 myPFTau.setCharge(mySignalPFChargedHadrCands_qsum);
214 for(
size_t i = 0;
i < mySignalPFNeutrHadrCands.
size();
i++) {
215 mySignalPFCands.
push_back(mySignalPFNeutrHadrCands[
i]);
219 double maxSignalGammaPt = 0.;
220 for(
size_t i = 0;
i < mySignalPFGammaCands.
size();
i++) {
221 if(mySignalPFGammaCands[
i]->pt() > maxSignalGammaPt) {
222 myleadPFNeutralCand = mySignalPFGammaCands[
i];
223 maxSignalGammaPt = mySignalPFGammaCands[
i]->pt();
225 mySignalPFCands.
push_back(mySignalPFGammaCands[
i]);
227 myPFTau.setsignalPFCands(mySignalPFCands);
229 myPFTau.setleadPFNeutralCand(myleadPFNeutralCand);
237 myPFTau.setleadPFCand(myleadPFChargedCand);
239 myPFTau.setleadPFCand(myleadPFNeutralCand);
243 PFCandidateRefVector myUnfilteredIsolPFChargedHadrCands, myIsolPFNeutrHadrCands, myIsolPFGammaCands, myIsolPFCands;
247 myUnfilteredIsolPFChargedHadrCands=myPFTauElementsOperators.PFChargedHadrCandsInAnnulus(
251 myUnfilteredIsolPFChargedHadrCands=myPFTauElementsOperators.PFChargedHadrCandsInAnnulus(
262 myPFTau.setisolationPFChargedHadrCands(myIsolPFChargedHadrCands);
265 myIsolPFNeutrHadrCands = myPFTauElementsOperators.PFNeutrHadrCandsInAnnulus(
268 myPFTau.setisolationPFNeutrHadrCands(myIsolPFNeutrHadrCands);
271 myIsolPFGammaCands = myPFTauElementsOperators.PFGammaCandsInAnnulus(
274 myPFTau.setisolationPFGammaCands(myIsolPFGammaCands);
281 rPhi =
Rphi_*myECALSignalConeSize;
285 std::pair<PFCandidateRefVector,PFCandidateRefVector> elementsInOutEllipse =
286 myPFTauElementsOperators.PFGammaCandsInOutEllipse(myIsolPFGammaCands, *myleadPFCand, rPhi, myECALSignalConeSize,
MaxEtInEllipse_);
293 mySignalPFGammaCands.
push_back(*inEllipseIt);
295 myPFTau.setsignalPFCands(mySignalPFCands);
297 myIsolPFGammaCands=elementsOutEllipse;
298 myPFTau.setisolationPFGammaCands(myIsolPFGammaCands);
303 float myIsolPFChargedHadrCands_Ptsum = 0.;
304 float myIsolPFGammaCands_Etsum = 0.;
305 for(
size_t i = 0;
i < myIsolPFChargedHadrCands.
size();
i++) {
306 myIsolPFChargedHadrCands_Ptsum += myIsolPFChargedHadrCands[
i]->pt();
307 myIsolPFCands.
push_back(myIsolPFChargedHadrCands[
i]);
309 myPFTau.setisolationPFChargedHadrCandsPtSum(myIsolPFChargedHadrCands_Ptsum);
312 for(
size_t i = 0;
i < myIsolPFNeutrHadrCands.
size();
i++) {
313 myIsolPFCands.
push_back(myIsolPFNeutrHadrCands[
i]);
316 for(
size_t i = 0;
i < myIsolPFGammaCands.
size();
i++) {
317 myIsolPFGammaCands_Etsum += myIsolPFGammaCands[
i]->et();
318 myIsolPFCands.
push_back(myIsolPFGammaCands[
i]);
320 myPFTau.setisolationPFGammaCandsEtSum(myIsolPFGammaCands_Etsum);
321 myPFTau.setisolationPFCands(myIsolPFCands);
326 iGammaCand != mySignalPFGammaCands.
end(); iGammaCand++) {
327 alternatLorentzVect+=(**iGammaCand).p4();
331 iChargedHadrCand != mySignalPFChargedHadrCands.
end(); iChargedHadrCand++) {
332 alternatLorentzVect+=(**iChargedHadrCand).p4();
335 myPFTau.setalternatLorentzVect(alternatLorentzVect);
340 iNeutralHadrCand != mySignalPFNeutrHadrCands.
end(); iNeutralHadrCand++) {
341 alternatLorentzVect+=(**iNeutralHadrCand).p4();
344 myPFTau.setP4(alternatLorentzVect);
355 myPFTau.setleadTrack(myleadTk);
357 double myleadTkDZ = (*myleadTk).dz(myPV.
position());
365 myPFTau.setisolationTracks(myFilteredTracks);
372 myPFTau.setisolationTracks(myFilteredTracks);
378 double myECALenergy = 0.;
379 double myHCALenergy = 0.;
380 double myHCALenergy3x3 = 0.;
381 double myMaximumHCALPFClusterE = 0.;
382 double myMaximumHCALPFClusterEt = 0.;
383 double myStripClusterE = 0.;
384 double myEmfrac = -1.;
385 double myElectronPreIDOutput = -1111.;
386 bool myElecPreid =
false;
389 typedef std::pair<reco::PFBlockRef, unsigned> ElementInBlock;
390 typedef std::vector< ElementInBlock > ElementsInBlocks;
394 myElectronPreIDOutput = myleadPFChargedCand->mva_e_pi();
396 math::XYZPointF myElecTrkEcalPos = myleadPFChargedCand->positionAtECALEntrance();
397 myElecTrk = myleadPFChargedCand->trackRef();
403 for(
int i=0;
i<(int)myPFCands.
size();
i++){
404 myHCALenergy += myPFCands[
i]->hcalEnergy();
405 myECALenergy += myPFCands[
i]->ecalEnergy();
408 if (myPFCands[
i]->particleId()==1 || myPFCands[
i]->particleId()==2)
409 candPos = myPFCands[
i]->positionAtECALEntrance();
413 double deltaR = ROOT::Math::VectorUtil::DeltaR(myElecTrkEcalPos,candPos);
414 double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(myElecTrkEcalPos,candPos);
416 double deltaPhiOverQ = deltaPhi/(double)myElecTrk->charge();
420 myStripClusterE += myPFCands[
i]->ecalEnergy();
423 myHCALenergy3x3 += myPFCands[
i]->hcalEnergy();
425 if (myPFCands[
i]->hcalEnergy()>myMaximumHCALPFClusterE) {
426 myMaximumHCALPFClusterE = myPFCands[
i]->hcalEnergy();
428 if ((myPFCands[
i]->hcalEnergy()*fabs(
sin(candPos.Theta())))>myMaximumHCALPFClusterEt) {
429 myMaximumHCALPFClusterEt = (myPFCands[
i]->hcalEnergy()*fabs(
sin(candPos.Theta())));
435 std::vector<math::XYZPoint> hcalPosV; hcalPosV.
clear();
436 std::vector<math::XYZPoint> ecalPosV; ecalPosV.clear();
437 for(
int i=0;
i<(int)myPFCands.
size();
i++){
438 const ElementsInBlocks& elts = myPFCands[
i]->elementsInBlocks();
439 for(ElementsInBlocks::const_iterator it=elts.begin(); it!=elts.end(); ++it) {
441 unsigned indexOfElementInBlock = it->second;
443 assert(indexOfElementInBlock<elements.
size());
449 double en = (double)element.clusterRef()->energy();
450 double et = (double)element.clusterRef()->energy()*fabs(
sin(clusPos.Theta()));
451 if (en>myMaximumHCALPFClusterE) {
452 myMaximumHCALPFClusterE = en;
454 if (et>myMaximumHCALPFClusterEt) {
455 myMaximumHCALPFClusterEt = et;
458 hcalPosV.push_back(clusPos);
460 double deltaR = ROOT::Math::VectorUtil::DeltaR(myElecTrkEcalPos,clusPos);
462 myHCALenergy3x3 += en;
466 double en = (double)element.clusterRef()->energy();
469 ecalPosV.push_back(clusPos);
471 double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(myElecTrkEcalPos,clusPos);
472 double deltaEta =
std::abs(myElecTrkEcalPos.eta()-clusPos.eta());
473 double deltaPhiOverQ = deltaPhi/(double)myElecTrk->charge();
475 myStripClusterE += en;
485 if ((myHCALenergy+myECALenergy)>0.)
486 myEmfrac = myECALenergy/(myHCALenergy+myECALenergy);
487 myPFTau.setemFraction((
float)myEmfrac);
492 float myElectronMomentum = (float)myElecTrk->p();
493 if (myElectronMomentum > 0.)
495 myHCALenergy /= myElectronMomentum;
496 myMaximumHCALPFClusterE /= myElectronMomentum;
497 myHCALenergy3x3 /= myElectronMomentum;
498 myStripClusterE /= myElectronMomentum;
501 myPFTau.sethcalTotOverPLead((
float)myHCALenergy);
502 myPFTau.sethcalMaxOverPLead((
float)myMaximumHCALPFClusterE);
503 myPFTau.sethcal3x3OverPLead((
float)myHCALenergy3x3);
504 myPFTau.setecalStripSumEOverPLead((
float)myStripClusterE);
505 myPFTau.setmaximumHCALPFClusterEt(myMaximumHCALPFClusterEt);
506 myPFTau.setelectronPreIDOutput(myElectronPreIDOutput);
508 myPFTau.setelectronPreIDTrack(myElecTrk);
511 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 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.
bool putNeutralHadronsInP4_
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_