CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
HPSPFRecoTauAlgorithm Class Reference

#include <HPSPFRecoTauAlgorithm.h>

Inheritance diagram for HPSPFRecoTauAlgorithm:
PFRecoTauAlgorithmBase

Classes

class  HPSTauIsolationSorter
 
class  HPSTauPtSorter
 

Public Member Functions

reco::PFTau buildPFTau (const reco::PFTauTagInfoRef &, const reco::Vertex &)
 
 HPSPFRecoTauAlgorithm ()
 
 HPSPFRecoTauAlgorithm (const edm::ParameterSet &)
 
 ~HPSPFRecoTauAlgorithm ()
 
- Public Member Functions inherited from PFRecoTauAlgorithmBase
 PFRecoTauAlgorithmBase ()
 
 PFRecoTauAlgorithmBase (const edm::ParameterSet &)
 
void setTransientTrackBuilder (const TransientTrackBuilder *)
 
virtual ~PFRecoTauAlgorithmBase ()
 

Private Member Functions

void applyElectronRejection (reco::PFTau &, double)
 
void applyMassConstraint (math::XYZTLorentzVector &, double)
 
void applyMuonRejection (reco::PFTau &)
 
void associateIsolationCandidates (reco::PFTau &, double)
 
void buildOneProng (const reco::PFTauTagInfoRef &, const reco::PFCandidateRefVector &)
 
void buildOneProngStrip (const reco::PFTauTagInfoRef &, const std::vector< reco::PFCandidateRefVector > &, const reco::PFCandidateRefVector &)
 
void buildOneProngTwoStrips (const reco::PFTauTagInfoRef &, const std::vector< reco::PFCandidateRefVector > &, const reco::PFCandidateRefVector &)
 
void buildThreeProngs (const reco::PFTauTagInfoRef &, const reco::PFCandidateRefVector &)
 
void configure (const edm::ParameterSet &)
 
math::XYZTLorentzVector createMergedLorentzVector (const reco::PFCandidateRefVector &)
 
reco::PFTau getBestTauCandidate (reco::PFTauCollection &)
 
bool isNarrowTau (const reco::PFTau &, double)
 
bool refitThreeProng (reco::PFTau &)
 
void removeCandidateFromRefVector (const reco::PFCandidateRef &, reco::PFCandidateRefVector &)
 

Private Attributes

PFCandidateMergerBasecandidateMerger_
 
double chargeIsolationCone_
 
std::string coneMetric_
 
TFormula coneSizeFormula
 
std::string coneSizeFormula_
 
bool doOneProngs_
 
bool doOneProngStrips_
 
bool doOneProngTwoStrips_
 
bool doThreeProngs_
 
std::string emMerger_
 
double gammaIsolationCone_
 
double leadPionThreshold_
 
double matchingCone_
 
double maxSignalCone_
 
double minSignalCone_
 
double neutrHadrIsolationCone_
 
std::vector< double > oneProngStripMassWindow_
 
std::vector< double > oneProngTwoStripsMassWindow_
 
std::vector< double > oneProngTwoStripsPi0MassWindow_
 
std::string overlapCriterion_
 
reco::PFTauCollection pfTaus_
 
double stripPtThreshold_
 
double tauThreshold_
 
std::vector< double > threeProngMassWindow_
 
bool useIsolationAnnulus_
 

Additional Inherited Members

- Protected Attributes inherited from PFRecoTauAlgorithmBase
const TransientTrackBuilderTransientTrackBuilder_
 

Detailed Description

Definition at line 25 of file HPSPFRecoTauAlgorithm.h.

Constructor & Destructor Documentation

HPSPFRecoTauAlgorithm::HPSPFRecoTauAlgorithm ( )

Definition at line 5 of file HPSPFRecoTauAlgorithm.cc.

HPSPFRecoTauAlgorithm::HPSPFRecoTauAlgorithm ( const edm::ParameterSet config)

Definition at line 10 of file HPSPFRecoTauAlgorithm.cc.

References configure().

10  :
12 {
13  configure(config);
14 }
void configure(const edm::ParameterSet &)
HPSPFRecoTauAlgorithm::~HPSPFRecoTauAlgorithm ( )

Definition at line 16 of file HPSPFRecoTauAlgorithm.cc.

References candidateMerger_.

17 {
18  if(candidateMerger_ !=0 ) delete candidateMerger_;
19 }
PFCandidateMergerBase * candidateMerger_

Member Function Documentation

void HPSPFRecoTauAlgorithm::applyElectronRejection ( reco::PFTau tau,
double  stripEnergy 
)
private

Definition at line 584 of file HPSPFRecoTauAlgorithm.cc.

References abs, edm::Ref< C, T, F >::isNonnull(), reco::PFTau::leadPFChargedHadrCand(), reco::PFTau::setbremsRecoveryEOverPLead(), reco::PFTau::setecalStripSumEOverPLead(), reco::PFTau::setelectronPreIDDecision(), reco::PFTau::setelectronPreIDOutput(), reco::PFTau::setelectronPreIDTrack(), reco::PFTau::setemFraction(), reco::PFTau::sethcal3x3OverPLead(), reco::PFTau::sethcalMaxOverPLead(), reco::PFTau::sethcalTotOverPLead(), reco::PFTau::setmaximumHCALPFClusterEt(), and funct::sin().

Referenced by buildOneProng(), buildOneProngStrip(), buildOneProngTwoStrips(), and buildThreeProngs().

585 {
586  //Here we apply the common electron rejection variables.
587  //The only not common is the E/P that is applied in the decay mode
588  //construction
589 
590 
591  if(tau.leadPFChargedHadrCand().isNonnull()) {
592  PFCandidateRef leadCharged = tau.leadPFChargedHadrCand();
593  math::XYZVector caloDir(leadCharged->positionAtECALEntrance().x(),
594  leadCharged->positionAtECALEntrance().y(),
595  leadCharged->positionAtECALEntrance().z());
596 
597  tau.setmaximumHCALPFClusterEt(leadCharged->hcalEnergy()*sin(caloDir.theta()));
598 
599 
600 
601  if(leadCharged->trackRef().isNonnull()) {
602  TrackRef track = leadCharged->trackRef();
603  tau.setemFraction(leadCharged->ecalEnergy()/(leadCharged->ecalEnergy()+leadCharged->hcalEnergy()));
604  //For H/P trust particle Flow ! :Just take HCAL energy of the candidate
605  //end of story
606  tau.sethcalTotOverPLead(leadCharged->hcalEnergy()/track->p());
607  tau.sethcalMaxOverPLead(leadCharged->hcalEnergy()/track->p());
608  tau.sethcal3x3OverPLead(leadCharged->hcalEnergy()/track->p());
609  tau.setelectronPreIDTrack(track);
610  tau.setelectronPreIDOutput(leadCharged->mva_e_pi());
611  //Since PF uses brem recovery we will store the default ecal energy here
612  tau.setbremsRecoveryEOverPLead(leadCharged->ecalEnergy()/track->p());
613  tau.setecalStripSumEOverPLead((leadCharged->ecalEnergy()-stripEnergy)/track->p());
614  bool electronDecision;
615  if(std::abs(leadCharged->pdgId())==11)
616  electronDecision=true;
617  else
618  electronDecision=false;
619  tau.setelectronPreIDDecision(electronDecision);
620  }
621  }
622 }
void setelectronPreIDOutput(const float &)
Definition: PFTau.cc:175
void setelectronPreIDDecision(const bool &)
Definition: PFTau.cc:176
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define abs(x)
Definition: mlp_lapack.h:159
void sethcal3x3OverPLead(const float &)
Definition: PFTau.cc:171
void setemFraction(const float &)
Definition: PFTau.cc:168
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
void setbremsRecoveryEOverPLead(const float &)
Definition: PFTau.cc:173
void sethcalMaxOverPLead(const float &)
Definition: PFTau.cc:170
const PFCandidateRef & leadPFChargedHadrCand() const
Definition: PFTau.cc:62
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
void setmaximumHCALPFClusterEt(const float &)
Definition: PFTau.cc:155
void setecalStripSumEOverPLead(const float &)
Definition: PFTau.cc:172
void sethcalTotOverPLead(const float &)
Definition: PFTau.cc:169
void setelectronPreIDTrack(const reco::TrackRef &)
Definition: PFTau.cc:174
void HPSPFRecoTauAlgorithm::applyMassConstraint ( math::XYZTLorentzVector vec,
double  mass 
)
private

Definition at line 699 of file HPSPFRecoTauAlgorithm.cc.

References scaleCards::mass, and mathSSE::sqrt().

Referenced by buildOneProngStrip(), and buildOneProngTwoStrips().

700 {
701  double factor = sqrt(vec.energy()*vec.energy()-mass*mass)/vec.P();
702  vec.SetCoordinates(vec.px()*factor,vec.py()*factor,vec.pz()*factor,vec.energy());
703 }
T sqrt(T t)
Definition: SSEVec.h:46
tuple mass
Definition: scaleCards.py:27
void HPSPFRecoTauAlgorithm::applyMuonRejection ( reco::PFTau tau)
private

Definition at line 552 of file HPSPFRecoTauAlgorithm.cc.

References edm::Ref< C, T, F >::isNonnull(), reco::PFTau::leadPFChargedHadrCand(), RPCpg::mu, reco::PFTau::setCaloComp(), reco::PFTau::setMuonDecision(), and reco::PFTau::setSegComp().

Referenced by buildOneProng(), buildOneProngStrip(), buildOneProngTwoStrips(), and buildThreeProngs().

553 {
554 
555  // Require that no signal track has segment matches
556 
557  //Also:
558  //The segment compatibility is the number of matched Muon Segments
559  //the old available does not exist in the muons anymore so i will fill the data format with that
560  bool decision=true;
561  float caloComp=0.0;
562  float segComp=0.0;
563 
564  if(tau.leadPFChargedHadrCand().isNonnull()) {
565  MuonRef mu =tau.leadPFChargedHadrCand()->muonRef();
566  if(mu.isNonnull()){
567  segComp=(float)(mu->matches().size());
568  if(mu->caloCompatibility()>caloComp)
569  caloComp = mu->caloCompatibility();
570 
571  if(segComp<1.0)
572  decision=false;
573 
574  tau.setCaloComp(caloComp);
575  tau.setSegComp(segComp);
576  tau.setMuonDecision(decision);
577  }
578 
579  }
580 }
void setMuonDecision(const bool &)
Definition: PFTau.cc:194
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
void setCaloComp(const float &)
Definition: PFTau.cc:192
const int mu
Definition: Constants.h:23
const PFCandidateRef & leadPFChargedHadrCand() const
Definition: PFTau.cc:62
void setSegComp(const float &)
Definition: PFTau.cc:193
void HPSPFRecoTauAlgorithm::associateIsolationCandidates ( reco::PFTau tau,
double  tauCone 
)
private

Definition at line 446 of file HPSPFRecoTauAlgorithm.cc.

References edm::RefVector< C, T, F >::begin(), chargeIsolationCone_, edm::RefVector< C, T, F >::end(), gammaIsolationCone_, i, edm::Ref< C, T, F >::isNull(), neutrHadrIsolationCone_, reco::LeafCandidate::p4(), reco::PFTau::pfTauTagInfoRef(), edm::RefVector< C, T, F >::push_back(), dt_dqm_sourceclient_common_cff::reco, removeCandidateFromRefVector(), reco::PFTau::setisolationPFCands(), reco::PFTau::setisolationPFChargedHadrCands(), reco::PFTau::setisolationPFChargedHadrCandsPtSum(), reco::PFTau::setisolationPFGammaCands(), reco::PFTau::setisolationPFGammaCandsEtSum(), reco::PFTau::setisolationPFNeutrHadrCands(), reco::PFTau::signalPFChargedHadrCands(), reco::PFTau::signalPFGammaCands(), and useIsolationAnnulus_.

Referenced by buildOneProng(), buildOneProngStrip(), buildOneProngTwoStrips(), and buildThreeProngs().

448 {
449 
450 
451  using namespace reco;
452 
453  //Information to get filled
454  double sumPT=0;
455  double sumET=0;
456 
457  if(tau.pfTauTagInfoRef().isNull()) return;
458 
459  PFCandidateRefVector hadrons;
460  PFCandidateRefVector gammas;
461  PFCandidateRefVector neutral;
462 
463  //Remove candidates outside the cones
465  {
466 
467  for(unsigned int i=0;i<tau.pfTauTagInfoRef()->PFChargedHadrCands().size();++i) {
468  double DR = ROOT::Math::VectorUtil::DeltaR(tau.p4(),tau.pfTauTagInfoRef()->PFChargedHadrCands().at(i)->p4());
469 
470  if(DR>tauCone && DR<chargeIsolationCone_)
471  hadrons.push_back(tau.pfTauTagInfoRef()->PFChargedHadrCands().at(i));
472  }
473 
474  for(unsigned int i=0;i<tau.pfTauTagInfoRef()->PFGammaCands().size();++i) {
475  double DR = ROOT::Math::VectorUtil::DeltaR(tau.p4(),tau.pfTauTagInfoRef()->PFGammaCands().at(i)->p4());
476 
477  if(DR>tauCone && DR<gammaIsolationCone_)
478  gammas.push_back(tau.pfTauTagInfoRef()->PFGammaCands().at(i));
479  }
480  for(unsigned int i=0;i<tau.pfTauTagInfoRef()->PFNeutrHadrCands().size();++i) {
481  double DR = ROOT::Math::VectorUtil::DeltaR(tau.p4(),tau.pfTauTagInfoRef()->PFNeutrHadrCands().at(i)->p4());
482  if(DR>tauCone && DR <neutrHadrIsolationCone_)
483  neutral.push_back(tau.pfTauTagInfoRef()->PFNeutrHadrCands().at(i));
484  }
485  }
486  else
487  {
488 
489  for(unsigned int i=0;i<tau.pfTauTagInfoRef()->PFChargedHadrCands().size();++i) {
490  double DR = ROOT::Math::VectorUtil::DeltaR(tau.p4(),tau.pfTauTagInfoRef()->PFChargedHadrCands().at(i)->p4());
491 
492  if(DR<chargeIsolationCone_)
493  hadrons.push_back(tau.pfTauTagInfoRef()->PFChargedHadrCands().at(i));
494  }
495 
496  for(unsigned int i=0;i<tau.pfTauTagInfoRef()->PFGammaCands().size();++i) {
497  double DR = ROOT::Math::VectorUtil::DeltaR(tau.p4(),tau.pfTauTagInfoRef()->PFGammaCands().at(i)->p4());
498 
499  if(DR<gammaIsolationCone_)
500  gammas.push_back(tau.pfTauTagInfoRef()->PFGammaCands().at(i));
501  }
502  for(unsigned int i=0;i<tau.pfTauTagInfoRef()->PFNeutrHadrCands().size();++i) {
503  double DR = ROOT::Math::VectorUtil::DeltaR(tau.p4(),tau.pfTauTagInfoRef()->PFNeutrHadrCands().at(i)->p4());
505  neutral.push_back(tau.pfTauTagInfoRef()->PFNeutrHadrCands().at(i));
506  }
507 
508  }
509 
510  //remove the signal Constituents from the collections
512  {
514  }
515 
517  {
519  removeCandidateFromRefVector(*i,hadrons);//special case where we included a hadron if the strip!
520  }
521 
522 
523  //calculate isolation deposits
524  for(unsigned int i=0;i<hadrons.size();++i)
525  {
526  sumPT+=hadrons.at(i)->pt();
527  }
528 
529  for(unsigned int i=0;i<gammas.size();++i)
530  {
531  sumET+=gammas.at(i)->pt();
532  }
533 
534 
537  tau.setisolationPFChargedHadrCands(hadrons);
538  tau.setisolationPFNeutrHadrCands(neutral);
539  tau.setisolationPFGammaCands(gammas);
540 
541  PFCandidateRefVector isoAll = hadrons;
542  for(unsigned int i=0;i<gammas.size();++i)
543  isoAll.push_back(gammas.at(i));
544 
545  for(unsigned int i=0;i<neutral.size();++i)
546  isoAll.push_back(neutral.at(i));
547 
548  tau.setisolationPFCands(isoAll);
549 }
void setisolationPFGammaCands(const PFCandidateRefVector &)
Definition: PFTau.cc:89
int i
Definition: DBlmapReader.cc:9
void setisolationPFChargedHadrCands(const PFCandidateRefVector &)
Definition: PFTau.cc:85
void setisolationPFNeutrHadrCands(const PFCandidateRefVector &)
Definition: PFTau.cc:87
void removeCandidateFromRefVector(const reco::PFCandidateRef &, reco::PFCandidateRefVector &)
const PFCandidateRefVector & signalPFChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:75
void setisolationPFGammaCandsEtSum(const float &)
Definition: PFTau.cc:152
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
void setisolationPFCands(const PFCandidateRefVector &)
Definition: PFTau.cc:83
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
bool isNull() const
Checks for null.
Definition: Ref.h:247
void setisolationPFChargedHadrCandsPtSum(const float &)
Definition: PFTau.cc:149
const PFTauTagInfoRef & pfTauTagInfoRef() const
Definition: PFTau.cc:53
const PFCandidateRefVector & signalPFGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:79
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
void HPSPFRecoTauAlgorithm::buildOneProng ( const reco::PFTauTagInfoRef tagInfo,
const reco::PFCandidateRefVector hadrons 
)
private

Definition at line 87 of file HPSPFRecoTauAlgorithm.cc.

References applyElectronRejection(), applyMuonRejection(), associateIsolationCandidates(), edm::RefVector< C, T, F >::at(), getBestTauCandidate(), h, leadPionThreshold_, matchingCone_, RecoPFTauTag_cff::PFTau, pfTaus_, edm::RefVector< C, T, F >::push_back(), reco::PFTau::setleadPFCand(), reco::PFTau::setleadPFChargedHadrCand(), reco::PFTau::setpfTauTagInfoRef(), reco::PFTau::setsignalPFCands(), reco::PFTau::setsignalPFChargedHadrCands(), edm::RefVector< C, T, F >::size(), metsig::tau, and tauThreshold_.

Referenced by buildPFTau().

88 {
89  PFTauCollection taus;
90 
91  if(hadrons.size()>0)
92  for(unsigned int h=0;h<hadrons.size();++h) {
93  PFCandidateRef hadron = hadrons.at(h);
94 
95  //In the one prong case the lead Track pt should be above the tau Threshold!
96  //since all the tau is just one track!
97  if(hadron->pt()>tauThreshold_)
98  if(hadron->pt()>leadPionThreshold_)
99  //The track should be within the matching cone
100  if(ROOT::Math::VectorUtil::DeltaR(hadron->p4(),tagInfo->pfjetRef()->p4())<matchingCone_) {
101  //OK Lets create a Particle Flow Tau!
102  PFTau tau = PFTau(hadron->charge(),hadron->p4(),hadron->vertex());
103 
104  //Associate the Tag Info to the tau
105  tau.setpfTauTagInfoRef(tagInfo);
106 
107  //Put the Hadron in the signal Constituents
108  PFCandidateRefVector signal;
109  signal.push_back(hadron);
110 
111  //Set The signal candidates of the PF Tau
112  tau.setsignalPFChargedHadrCands(signal);
113  tau.setsignalPFCands(signal);
114  tau.setleadPFChargedHadrCand(hadron);
115  tau.setleadPFCand(hadron);
116 
117  //Fill isolation variables
119 
120  //Apply Muon rejection algorithms
121  applyMuonRejection(tau);
122  applyElectronRejection(tau,0.0);
123 
124  //Save this candidate
125  taus.push_back(tau);
126  }
127  }
128  if(taus.size()>0) {
129  pfTaus_.push_back(getBestTauCandidate(taus));
130  }
131 
132 }
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
reco::PFTauCollection pfTaus_
reco::PFTau getBestTauCandidate(reco::PFTauCollection &)
void applyElectronRejection(reco::PFTau &, double)
void setsignalPFChargedHadrCands(const PFCandidateRefVector &)
Definition: PFTau.cc:76
void setleadPFChargedHadrCand(const PFCandidateRef &)
Definition: PFTau.cc:66
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:76
void setsignalPFCands(const PFCandidateRefVector &)
Definition: PFTau.cc:74
void applyMuonRejection(reco::PFTau &)
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
void setleadPFCand(const PFCandidateRef &)
Definition: PFTau.cc:68
void associateIsolationCandidates(reco::PFTau &, double)
void setpfTauTagInfoRef(const PFTauTagInfoRef)
Definition: PFTau.cc:60
void HPSPFRecoTauAlgorithm::buildOneProngStrip ( const reco::PFTauTagInfoRef tagInfo,
const std::vector< reco::PFCandidateRefVector > &  strips,
const reco::PFCandidateRefVector hadrons 
)
private

Definition at line 137 of file HPSPFRecoTauAlgorithm.cc.

References applyElectronRejection(), applyMassConstraint(), applyMuonRejection(), associateIsolationCandidates(), edm::RefVector< C, T, F >::at(), edm::RefVector< C, T, F >::begin(), coneMetric_, createMergedLorentzVector(), edm::RefVector< C, T, F >::end(), getBestTauCandidate(), isNarrowTau(), j, matchingCone_, max(), oneProngStripMassWindow_, pfTaus_, edm::RefVector< C, T, F >::push_back(), removeCandidateFromRefVector(), edm::RefVector< C, T, F >::size(), strip(), stripPtThreshold_, metsig::tau, and tauThreshold_.

Referenced by buildPFTau().

139 {
140  //Create output Collection
141  PFTauCollection taus;
142 
143 
144 
145 
146  //make taus like this only if there is at least one hadron+ 1 strip
147  if(hadrons.size()>0&&strips.size()>0){
148  //Combinatorics between strips and clusters
149  for(std::vector<PFCandidateRefVector>::const_iterator candVector=strips.begin();candVector!=strips.end();++candVector)
150  for(PFCandidateRefVector::const_iterator hadron=hadrons.begin();hadron!=hadrons.end();++hadron) {
151 
152  //First Cross cleaning ! If you asked to clusterize the candidates
153  //with tracks too then you should not double count the track
154  PFCandidateRefVector emConstituents = *candVector;
155  removeCandidateFromRefVector(*hadron,emConstituents);
156 
157  //Create a LorentzVector for the strip
159 
160  //TEST: Apply Strip Constraint
161  applyMassConstraint(strip,0.1349);
162 
163  //create the Particle Flow Tau: Hadron plus Strip
164  PFTau tau((*hadron)->charge(),
165  (*hadron)->p4()+strip,
166  (*hadron)->vertex());
167 
168  //Check tau threshold, mass, Matching Cone window
169  if(tau.pt()>tauThreshold_&&strip.pt()>stripPtThreshold_)
170  if(tau.mass()>oneProngStripMassWindow_.at(0)&&tau.mass()<oneProngStripMassWindow_.at(1))//Apply mass window
171  if(ROOT::Math::VectorUtil::DeltaR(tau.p4(),tagInfo->pfjetRef()->p4())<matchingCone_) { //Apply matching cone
172  //Set The Tag Infor ref
173  tau.setpfTauTagInfoRef(tagInfo);
174 
175  //Create the signal vectors
176  PFCandidateRefVector signal;
177  PFCandidateRefVector signalH;
178  PFCandidateRefVector signalG;
179 
180  //Store the hadron in the PFTau
181  signalH.push_back(*hadron);
182  signal.push_back(*hadron);
183 
184  //calculate the cone size : For the strip use it as one candidate !
185  double tauCone=0.0;
186  if(coneMetric_ =="angle")
187  tauCone=std::max(fabs(ROOT::Math::VectorUtil::Angle(tau.p4(),(*hadron)->p4())),
188  fabs(ROOT::Math::VectorUtil::Angle(tau.p4(),strip)));
189  else if(coneMetric_ == "DR")
190  tauCone=std::max(ROOT::Math::VectorUtil::DeltaR(tau.p4(),(*hadron)->p4()),
191  ROOT::Math::VectorUtil::DeltaR(tau.p4(),strip));
192 
193  if(emConstituents.size()>0)
194  for(PFCandidateRefVector::const_iterator j=emConstituents.begin();j!=emConstituents.end();++j) {
195  signal.push_back(*j);
196  signalG.push_back(*j);
197  }
198 
199  //Set the PFTau
200  tau.setsignalPFChargedHadrCands(signalH);
201  tau.setsignalPFGammaCands(signalG);
202  tau.setsignalPFCands(signal);
203  tau.setleadPFChargedHadrCand(*hadron);
204  tau.setleadPFNeutralCand(emConstituents.at(0));
205 
206  //Set the lead Candidate->Can be the hadron or the leading PFGamma(When we clear the Dataformat we will put the strip)
207  if((*hadron)->pt()>emConstituents.at(0)->pt())
208  tau.setleadPFCand(*hadron);
209  else
210  tau.setleadPFCand(emConstituents.at(0));
211 
212  //Apply the signal cone size formula
213  if(isNarrowTau(tau,tauCone)) {
214  //calculate the isolation Deposits
216  //Set Muon Rejection
218  applyElectronRejection(tau,strip.energy());
219 
220  taus.push_back(tau);
221  }
222  }
223  }
224  }
225 
226  if(taus.size()>0) {
227  pfTaus_.push_back(getBestTauCandidate(taus));
228  }
229 
230 }
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
void removeCandidateFromRefVector(const reco::PFCandidateRef &, reco::PFCandidateRefVector &)
reco::PFTauCollection pfTaus_
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
reco::PFTau getBestTauCandidate(reco::PFTauCollection &)
const T & max(const T &a, const T &b)
void applyElectronRejection(reco::PFTau &, double)
math::XYZTLorentzVector createMergedLorentzVector(const reco::PFCandidateRefVector &)
int j
Definition: DBlmapReader.cc:9
std::vector< double > oneProngStripMassWindow_
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:76
void applyMuonRejection(reco::PFTau &)
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
void applyMassConstraint(math::XYZTLorentzVector &, double)
bool isNarrowTau(const reco::PFTau &, double)
void associateIsolationCandidates(reco::PFTau &, double)
void HPSPFRecoTauAlgorithm::buildOneProngTwoStrips ( const reco::PFTauTagInfoRef tagInfo,
const std::vector< reco::PFCandidateRefVector > &  strips,
const reco::PFCandidateRefVector hadrons 
)
private

Definition at line 233 of file HPSPFRecoTauAlgorithm.cc.

References applyElectronRejection(), applyMassConstraint(), applyMuonRejection(), associateIsolationCandidates(), edm::RefVector< C, T, F >::at(), edm::RefVector< C, T, F >::begin(), coneMetric_, createMergedLorentzVector(), edm::RefVector< C, T, F >::end(), getBestTauCandidate(), isNarrowTau(), j, matchingCone_, max(), oneProngTwoStripsMassWindow_, oneProngTwoStripsPi0MassWindow_, pfTaus_, edm::RefVector< C, T, F >::push_back(), removeCandidateFromRefVector(), edm::RefVector< C, T, F >::size(), stripPtThreshold_, metsig::tau, and tauThreshold_.

Referenced by buildPFTau().

234 {
235 
236 
237  PFTauCollection taus;
238 
239  //make taus like this only if there is at least one hadron+ 2 strips
240  if(hadrons.size()>0&&strips.size()>1){
241  //Combinatorics between strips and clusters
242  for(unsigned int Nstrip1=0;Nstrip1<strips.size()-1;++Nstrip1)
243  for(unsigned int Nstrip2=Nstrip1+1;Nstrip2<strips.size();++Nstrip2)
244  for(PFCandidateRefVector::const_iterator hadron=hadrons.begin();hadron!=hadrons.end();++hadron) {
245 
246 
247 
248  //Create the strips and the vectors .Again cross clean the track if associated
249  PFCandidateRefVector emConstituents1 = strips.at(Nstrip1);
250  PFCandidateRefVector emConstituents2 = strips.at(Nstrip2);
251  removeCandidateFromRefVector(*hadron,emConstituents1);
252  removeCandidateFromRefVector(*hadron,emConstituents2);
253 
254 
255  //Create a LorentzVector for the strip
256  math::XYZTLorentzVector strip1 = createMergedLorentzVector(emConstituents1);
257  math::XYZTLorentzVector strip2 = createMergedLorentzVector(emConstituents2);
258 
259 
260 
261  //Apply Mass Constraints
262  applyMassConstraint(strip1,0.0);
263  applyMassConstraint(strip2,0.0);
264 
265 
266  PFTau tau((*hadron)->charge(),
267  (*hadron)->p4()+strip1+strip2,
268  (*hadron)->vertex());
269 
270 
271  if(tau.pt()>tauThreshold_&&strip1.pt()>stripPtThreshold_&&strip2.pt()>stripPtThreshold_)
272  if((strip1+strip2).M() >oneProngTwoStripsPi0MassWindow_.at(0) &&(strip1+strip2).M() <oneProngTwoStripsPi0MassWindow_.at(1) )//pi0 conmstraint for two strips
273  if(tau.mass()>oneProngTwoStripsMassWindow_.at(0)&&tau.mass()<oneProngTwoStripsMassWindow_.at(1))//Apply mass window
274  if(ROOT::Math::VectorUtil::DeltaR(tau.p4(),tagInfo->pfjetRef()->p4())<matchingCone_) { //Apply matching cone
275  //create the PFTau
276  tau.setpfTauTagInfoRef(tagInfo);
277 
278 
279  //Create the signal vectors
280  PFCandidateRefVector signal;
281  PFCandidateRefVector signalH;
282  PFCandidateRefVector signalG;
283 
284  //Store the hadron in the PFTau
285  signalH.push_back(*hadron);
286  signal.push_back(*hadron);
287 
288  //calculate the cone size from the reconstructed Objects
289  double tauCone=1000.0;
290  if(coneMetric_ =="angle") {
291  tauCone=std::max(std::max(fabs(ROOT::Math::VectorUtil::Angle(tau.p4(),(*hadron)->p4())),
292  fabs(ROOT::Math::VectorUtil::Angle(tau.p4(),strip1))),
293  fabs(ROOT::Math::VectorUtil::Angle(tau.p4(),strip2)));
294  }
295  else if(coneMetric_ =="DR") {
296  tauCone=std::max(std::max((ROOT::Math::VectorUtil::DeltaR(tau.p4(),(*hadron)->p4())),
297  (ROOT::Math::VectorUtil::DeltaR(tau.p4(),strip1))),
298  (ROOT::Math::VectorUtil::DeltaR(tau.p4(),strip2)));
299 
300  }
301 
302  for(PFCandidateRefVector::const_iterator j=emConstituents1.begin();j!=emConstituents1.end();++j) {
303  signal.push_back(*j);
304  signalG.push_back(*j);
305  }
306 
307  for(PFCandidateRefVector::const_iterator j=emConstituents2.begin();j!=emConstituents2.end();++j) {
308  signal.push_back(*j);
309  signalG.push_back(*j);
310  }
311 
312  //Set the PFTau
313  tau.setsignalPFChargedHadrCands(signalH);
314  tau.setsignalPFGammaCands(signalG);
315  tau.setsignalPFCands(signal);
316  tau.setleadPFChargedHadrCand(*hadron);
317 
318  //Set the lead Candidate->Can be the hadron or the leading PFGamma(When we clear the Dataformat we will put the strip)
319  if((*hadron)->pt()>emConstituents1.at(0)->pt())
320  tau.setleadPFCand(*hadron);
321  else
322  tau.setleadPFCand(emConstituents1.at(0));
323 
324  //Apply the cone size formula
325  if(isNarrowTau(tau,tauCone)) {
326 
327  //calculate the isolation Deposits
329 
331 
332  //For two strips take the nearest strip to the track
333  if(ROOT::Math::VectorUtil::DeltaR(strip1,(*hadron)->p4())<
334  ROOT::Math::VectorUtil::DeltaR(strip2,(*hadron)->p4()))
335  applyElectronRejection(tau,strip1.energy());
336  else
337  applyElectronRejection(tau,strip2.energy());
338 
339  taus.push_back(tau);
340  }
341  }
342  }
343  }
344 
345  if(taus.size()>0) {
346  pfTaus_.push_back(getBestTauCandidate(taus));
347  }
348 }
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
void removeCandidateFromRefVector(const reco::PFCandidateRef &, reco::PFCandidateRefVector &)
reco::PFTauCollection pfTaus_
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
reco::PFTau getBestTauCandidate(reco::PFTauCollection &)
const T & max(const T &a, const T &b)
void applyElectronRejection(reco::PFTau &, double)
math::XYZTLorentzVector createMergedLorentzVector(const reco::PFCandidateRefVector &)
int j
Definition: DBlmapReader.cc:9
std::vector< double > oneProngTwoStripsMassWindow_
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:76
void applyMuonRejection(reco::PFTau &)
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
std::vector< double > oneProngTwoStripsPi0MassWindow_
void applyMassConstraint(math::XYZTLorentzVector &, double)
bool isNarrowTau(const reco::PFTau &, double)
void associateIsolationCandidates(reco::PFTau &, double)
PFTau HPSPFRecoTauAlgorithm::buildPFTau ( const reco::PFTauTagInfoRef tagInfo,
const reco::Vertex vertex 
)
virtual

Implements PFRecoTauAlgorithmBase.

Definition at line 22 of file HPSPFRecoTauAlgorithm.cc.

References TransientTrackBuilder::build(), buildOneProng(), buildOneProngStrip(), buildOneProngTwoStrips(), buildThreeProngs(), candidateMerger_, doOneProngs_, doOneProngStrips_, doOneProngTwoStrips_, doThreeProngs_, getBestTauCandidate(), edm::Ref< C, T, F >::isNonnull(), metsig::jet, reco::PFTau::leadPFChargedHadrCand(), singlePfTauSkim_cff::leadTrack, PFCandidateMergerBase::mergeCandidates(), pfTaus_, reco::PFTau::pfTauTagInfoRef(), reco::PFTau::setleadPFChargedHadrCandsignedSipt(), reco::LeafCandidate::setP4(), reco::PFTau::setpfTauTagInfoRef(), IPTools::signedTransverseImpactParameter(), edm::RefVector< C, T, F >::size(), TauTagTools::sortRefVectorByPt(), RecoTauPiZeroBuilderPlugins_cfi::strips, and PFRecoTauAlgorithmBase::TransientTrackBuilder_.

23 {
24  PFTau pfTau;
25 
26  pfTaus_.clear();
27  //make the strips globally.
28  std::vector<PFCandidateRefVector> strips = candidateMerger_->mergeCandidates(tagInfo->PFCands());
29 
30 
31  //Sort the hadrons globally and once!
32  PFCandidateRefVector hadrons = tagInfo->PFChargedHadrCands();
33  if(hadrons.size()>1)
35 
36 
37  //OK For this Tau Tag Info we should create all the possible taus
38 
39  //One Prongs
40  if(doOneProngs_)
41  buildOneProng(tagInfo,hadrons);
42 
43  //One Prong Strips
45  buildOneProngStrip(tagInfo,strips,hadrons);
46 
47  //One Prong TwoStrips
49  buildOneProngTwoStrips(tagInfo,strips,hadrons);
50 
51  //Three Prong
52  if(doThreeProngs_)
53  buildThreeProngs(tagInfo,hadrons);
54 
55 
56  //Lets see if we created any taus
57  if(pfTaus_.size()>0) {
58 
60 
61  //Set the IP for the leading track
62  if(TransientTrackBuilder_!=0 &&pfTau.leadPFChargedHadrCand()->trackRef().isNonnull()) {
64  if(pfTau.pfTauTagInfoRef().isNonnull())
65  if(pfTau.pfTauTagInfoRef()->pfjetRef().isNonnull()) {
66  PFJetRef jet = pfTau.pfTauTagInfoRef()->pfjetRef();
67  GlobalVector jetDir(jet->px(),jet->py(),jet->pz());
68  if(IPTools::signedTransverseImpactParameter(leadTrack,jetDir,vertex).first)
69  pfTau.setleadPFChargedHadrCandsignedSipt(IPTools::signedTransverseImpactParameter(leadTrack,jetDir,vertex).second.significance());
70  }
71  }
72  }
73  else { //null PFTau
74  //Simone asked that in case there is no tau returned make a tau
75  //without refs and the LV of the jet
76  pfTau.setpfTauTagInfoRef(tagInfo);
77  pfTau.setP4(tagInfo->pfjetRef()->p4());
78  }
79 
80  return pfTau;
81 }
void sortRefVectorByPt(reco::PFCandidateRefVector &)
Definition: TauTagTools.cc:242
const TransientTrackBuilder * TransientTrackBuilder_
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:50
reco::TransientTrack build(const reco::Track *p) const
virtual void setP4(const LorentzVector &p4)
set 4-momentum
reco::PFTauCollection pfTaus_
void buildOneProng(const reco::PFTauTagInfoRef &, const reco::PFCandidateRefVector &)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
reco::PFTau getBestTauCandidate(reco::PFTauCollection &)
void buildOneProngTwoStrips(const reco::PFTauTagInfoRef &, const std::vector< reco::PFCandidateRefVector > &, const reco::PFCandidateRefVector &)
void setleadPFChargedHadrCandsignedSipt(const float &)
Definition: PFTau.cc:71
const PFTauTagInfoRef & pfTauTagInfoRef() const
Definition: PFTau.cc:53
const PFCandidateRef & leadPFChargedHadrCand() const
Definition: PFTau.cc:62
void buildThreeProngs(const reco::PFTauTagInfoRef &, const reco::PFCandidateRefVector &)
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
virtual std::vector< reco::PFCandidateRefVector > mergeCandidates(const reco::PFCandidateRefVector &)=0
PFCandidateMergerBase * candidateMerger_
void buildOneProngStrip(const reco::PFTauTagInfoRef &, const std::vector< reco::PFCandidateRefVector > &, const reco::PFCandidateRefVector &)
void setpfTauTagInfoRef(const PFTauTagInfoRef)
Definition: PFTau.cc:60
void HPSPFRecoTauAlgorithm::buildThreeProngs ( const reco::PFTauTagInfoRef tagInfo,
const reco::PFCandidateRefVector hadrons 
)
private

Definition at line 353 of file HPSPFRecoTauAlgorithm.cc.

References a, abs, applyElectronRejection(), applyMuonRejection(), associateIsolationCandidates(), edm::RefVector< C, T, F >::at(), b, trackerHits::c, DeDxDiscriminatorTools::charge(), coneMetric_, getBestTauCandidate(), isNarrowTau(), leadPionThreshold_, reco::LeafCandidate::mass(), matchingCone_, max(), reco::LeafCandidate::p4(), RecoPFTauTag_cff::PFTau, pfTaus_, reco::LeafCandidate::pt(), edm::RefVector< C, T, F >::push_back(), refitThreeProng(), reco::PFTau::setleadPFCand(), reco::PFTau::setleadPFChargedHadrCand(), reco::PFTau::setpfTauTagInfoRef(), reco::PFTau::setsignalPFCands(), reco::PFTau::setsignalPFChargedHadrCands(), edm::RefVector< C, T, F >::size(), metsig::tau, tauThreshold_, and threeProngMassWindow_.

Referenced by buildPFTau().

354 {
355  PFTauCollection taus;
356  //get Hadrons
357 
358 
359  //Require at least three hadrons
360  if(hadrons.size()>2)
361  for(unsigned int a=0;a<hadrons.size()-2;++a)
362  for(unsigned int b=a+1;b<hadrons.size()-1;++b)
363  for(unsigned int c=b+1;c<hadrons.size();++c) {
364 
365  PFCandidateRef h1 = hadrons.at(a);
366  PFCandidateRef h2 = hadrons.at(b);
367  PFCandidateRef h3 = hadrons.at(c);
368 
369  //check charge Compatibility and lead track
370  int charge=h1->charge()+h2->charge()+h3->charge();
371  if(std::abs(charge)==1 && h1->pt()>leadPionThreshold_)
372  //check the track refs
373  if(h1->trackRef()!=h2->trackRef()&&h1->trackRef()!=h3->trackRef()&&h2->trackRef()!=h3->trackRef())
374  {
375 
376  //create the tau
377  PFTau tau = PFTau(charge,h1->p4()+h2->p4()+h3->p4(),h1->vertex());
378  tau.setpfTauTagInfoRef(tagInfo);
379 
380  if(tau.pt()>tauThreshold_)//Threshold
381  if(ROOT::Math::VectorUtil::DeltaR(tau.p4(),tagInfo->pfjetRef()->p4())<matchingCone_) {//Matching Cone
382 
383  PFCandidateRefVector signal;
384  signal.push_back(h1);
385  signal.push_back(h2);
386  signal.push_back(h3);
387  //calculate the tau cone by getting the maximum distance
388  double tauCone = 10000.0;
389  if(coneMetric_=="DR")
390  {
391  tauCone = std::max(ROOT::Math::VectorUtil::DeltaR(tau.p4(),h1->p4()),
392  std::max(ROOT::Math::VectorUtil::DeltaR(tau.p4(),h2->p4()),
393  ROOT::Math::VectorUtil::DeltaR(tau.p4(),h3->p4())));
394  }
395  else if(coneMetric_=="angle")
396  {
397  tauCone =std::max(fabs(ROOT::Math::VectorUtil::Angle(tau.p4(),h1->p4())),
398  std::max(fabs(ROOT::Math::VectorUtil::Angle(tau.p4(),h2->p4())),
399  fabs(ROOT::Math::VectorUtil::Angle(tau.p4(),h3->p4()))));
400  }
401 
402  //Set The PFTau
403  tau.setsignalPFChargedHadrCands(signal);
404  tau.setsignalPFCands(signal);
405  tau.setleadPFChargedHadrCand(h1);
406  tau.setleadPFCand(h1);
407 
408  if(isNarrowTau(tau,tauCone)) {
409  //calculate the isolation Deposits
410  associateIsolationCandidates(tau,tauCone);
411  applyMuonRejection(tau);
412  applyElectronRejection(tau,0.0);
413  taus.push_back(tau);
414 
415  }
416  }
417  }
418  }
419 
420  if(taus.size()>0) {
421  PFTau bestTau = getBestTauCandidate(taus);
422  if(refitThreeProng(bestTau))
423  //Apply mass constraint
424  if(bestTau.mass()>threeProngMassWindow_.at(0)&&bestTau.mass()<threeProngMassWindow_.at(1))//MassWindow
425  pfTaus_.push_back(bestTau);
426  }
427 
428 }
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< double > threeProngMassWindow_
reco::PFTauCollection pfTaus_
double charge(const std::vector< uint8_t > &Ampls)
virtual double mass() const
mass
reco::PFTau getBestTauCandidate(reco::PFTauCollection &)
const T & max(const T &a, const T &b)
void applyElectronRejection(reco::PFTau &, double)
void setsignalPFChargedHadrCands(const PFCandidateRefVector &)
Definition: PFTau.cc:76
void setleadPFChargedHadrCand(const PFCandidateRef &)
Definition: PFTau.cc:66
virtual double pt() const
transverse momentum
double b
Definition: hdecay.h:120
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:76
void setsignalPFCands(const PFCandidateRefVector &)
Definition: PFTau.cc:74
double a
Definition: hdecay.h:121
void applyMuonRejection(reco::PFTau &)
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
bool refitThreeProng(reco::PFTau &)
void setleadPFCand(const PFCandidateRef &)
Definition: PFTau.cc:68
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
bool isNarrowTau(const reco::PFTau &, double)
void associateIsolationCandidates(reco::PFTau &, double)
void setpfTauTagInfoRef(const PFTauTagInfoRef)
Definition: PFTau.cc:60
void HPSPFRecoTauAlgorithm::configure ( const edm::ParameterSet p)
private

Definition at line 628 of file HPSPFRecoTauAlgorithm.cc.

References candidateMerger_, chargeIsolationCone_, TauTagTools::computeConeSizeTFormula(), coneMetric_, coneSizeFormula, coneSizeFormula_, doOneProngs_, doOneProngStrips_, doOneProngTwoStrips_, doThreeProngs_, emMerger_, edm::hlt::Exception, gammaIsolationCone_, edm::ParameterSet::getParameter(), leadPionThreshold_, matchingCone_, maxSignalCone_, minSignalCone_, neutrHadrIsolationCone_, oneProngStripMassWindow_, oneProngTwoStripsMassWindow_, oneProngTwoStripsPi0MassWindow_, overlapCriterion_, stripPtThreshold_, tauThreshold_, threeProngMassWindow_, and useIsolationAnnulus_.

Referenced by HPSPFRecoTauAlgorithm().

629 {
630  emMerger_ = p.getParameter<std::string>("emMergingAlgorithm");
631  overlapCriterion_ = p.getParameter<std::string>("candOverlapCriterion");
632  doOneProngs_ = p.getParameter<bool>("doOneProng");
633  doOneProngStrips_ = p.getParameter<bool>("doOneProngStrip");
634  doOneProngTwoStrips_ = p.getParameter<bool>("doOneProngTwoStrips");
635  doThreeProngs_ = p.getParameter<bool>("doThreeProng");
636  tauThreshold_ = p.getParameter<double>("tauPtThreshold");
637  leadPionThreshold_ = p.getParameter<double>("leadPionThreshold");
638  stripPtThreshold_ = p.getParameter<double>("stripPtThreshold");
639  chargeIsolationCone_ = p.getParameter<double>("chargeHadrIsolationConeSize");
640  gammaIsolationCone_ = p.getParameter<double>("gammaIsolationConeSize");
641  neutrHadrIsolationCone_ = p.getParameter<double>("neutrHadrIsolationConeSize");
642  useIsolationAnnulus_ = p.getParameter<bool>("useIsolationAnnulus");
643  oneProngStripMassWindow_ = p.getParameter<std::vector<double> >("oneProngStripMassWindow");
644  oneProngTwoStripsMassWindow_ = p.getParameter<std::vector<double> >("oneProngTwoStripsMassWindow");
645  oneProngTwoStripsPi0MassWindow_= p.getParameter<std::vector<double> >("oneProngTwoStripsPi0MassWindow");
646  threeProngMassWindow_ = p.getParameter<std::vector<double> >("threeProngMassWindow");
647  matchingCone_ = p.getParameter<double>("matchingCone");
648  coneMetric_ = p.getParameter<std::string>("coneMetric");
649  coneSizeFormula_ = p.getParameter<std::string>("coneSizeFormula");
650  minSignalCone_ = p.getParameter<double>("minimumSignalCone");
651  maxSignalCone_ = p.getParameter<double>("maximumSignalCone");
652 
653 
654 
655  //Initialize The Merging Algorithm!
656  if(emMerger_ =="StripBased")
658  //Add the Pi0 Merger from Evan here
659 
660 
661  if(oneProngStripMassWindow_.size()!=2)
662  throw cms::Exception("") << "OneProngStripMassWindow must be a vector of size 2 [min,max] " << std::endl;
663  if(oneProngTwoStripsMassWindow_.size()!=2)
664  throw cms::Exception("") << "OneProngTwoStripsMassWindow must be a vector of size 2 [min,max] " << std::endl;
665  if(threeProngMassWindow_.size()!=2)
666  throw cms::Exception("") << "ThreeProngMassWindow must be a vector of size 2 [min,max] " << std::endl;
667  if(coneMetric_!= "angle" && coneMetric_ != "DR")
668  throw cms::Exception("") << "Cone Metric should be angle or DR " << std::endl;
669 
670  coneSizeFormula = TauTagTools::computeConeSizeTFormula(coneSizeFormula_,"Signal cone size Formula");
671 
672 
673 }
T getParameter(std::string const &) const
std::vector< double > threeProngMassWindow_
TFormula computeConeSizeTFormula(const std::string &ConeSizeFormula, const char *errorMessage)
std::vector< double > oneProngTwoStripsMassWindow_
std::vector< double > oneProngStripMassWindow_
std::vector< double > oneProngTwoStripsPi0MassWindow_
PFCandidateMergerBase * candidateMerger_
math::XYZTLorentzVector HPSPFRecoTauAlgorithm::createMergedLorentzVector ( const reco::PFCandidateRefVector cands)
private

Definition at line 678 of file HPSPFRecoTauAlgorithm.cc.

References edm::RefVector< C, T, F >::at(), i, and edm::RefVector< C, T, F >::size().

Referenced by buildOneProngStrip(), and buildOneProngTwoStrips().

679 {
681  for(unsigned int i=0;i<cands.size();++i) {
682  sum+=cands.at(i)->p4();
683  }
684  return sum;
685 }
int i
Definition: DBlmapReader.cc:9
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:76
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
reco::PFTau HPSPFRecoTauAlgorithm::getBestTauCandidate ( reco::PFTauCollection taus)
private

Definition at line 763 of file HPSPFRecoTauAlgorithm.cc.

References overlapCriterion_, and MCScenario_CRAFT1_22X::sorter().

Referenced by buildOneProng(), buildOneProngStrip(), buildOneProngTwoStrips(), buildPFTau(), and buildThreeProngs().

764 {
765  reco::PFTauCollection::iterator it;
766  if(overlapCriterion_ =="Isolation"){
767  HPSTauIsolationSorter sorter;
768  it = std::min_element(taus.begin(),taus.end(),sorter);
769 
770  }
771  else if(overlapCriterion_ =="Pt"){
772  HPSTauPtSorter sorter;
773  it = std::min_element(taus.begin(),taus.end(),sorter);
774  }
775 
776  return *it;
777 }
bool HPSPFRecoTauAlgorithm::isNarrowTau ( const reco::PFTau tau,
double  cone 
)
private

Definition at line 432 of file HPSPFRecoTauAlgorithm.cc.

References coneSizeFormula, reco::LeafCandidate::energy(), reco::LeafCandidate::et(), maxSignalCone_, and minSignalCone_.

Referenced by buildOneProngStrip(), buildOneProngTwoStrips(), and buildThreeProngs().

433 {
434  double allowedConeSize=coneSizeFormula.Eval(tau.energy(),tau.et());
435  if (allowedConeSize<minSignalCone_) allowedConeSize=minSignalCone_;
436  if (allowedConeSize>maxSignalCone_) allowedConeSize=maxSignalCone_;
437 
438  if(cone<allowedConeSize)
439  return true;
440  else
441  return false;
442 }
virtual double et() const
transverse energy
virtual double energy() const
energy
bool HPSPFRecoTauAlgorithm::refitThreeProng ( reco::PFTau tau)
private

Definition at line 709 of file HPSPFRecoTauAlgorithm.cc.

References edm::RefVector< C, T, F >::at(), TransientTrackBuilder::build(), TransientVertex::hasRefittedTracks(), TransientVertex::isValid(), p1, p2, p3, TransientVertex::position(), TransientVertex::refittedTracks(), reco::LeafCandidate::setP4(), reco::LeafCandidate::setVertex(), reco::PFTau::signalPFChargedHadrCands(), mathSSE::sqrt(), PFRecoTauAlgorithmBase::TransientTrackBuilder_, KalmanVertexFitter::vertex(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by buildThreeProngs().

710 {
711  bool response=false;
712  //Get Hadrons
714  PFCandidateRef h1 = hadrons.at(0);
715  PFCandidateRef h2 = hadrons.at(1);
716  PFCandidateRef h3 = hadrons.at(2);
717 
718  //Make transient tracks
719  std::vector<TransientTrack> transientTracks;
720  transientTracks.push_back(TransientTrackBuilder_->build(h1->trackRef()));
721  transientTracks.push_back(TransientTrackBuilder_->build(h2->trackRef()));
722  transientTracks.push_back(TransientTrackBuilder_->build(h3->trackRef()));
723 
724  //Apply the Vertex Fit
725  KalmanVertexFitter fitter(true);
726  TransientVertex myVertex = fitter.vertex(transientTracks);
727 
728  //Just require a valid vertex+ 3 refitted tracks
729  if(myVertex.isValid()&&
730  myVertex.hasRefittedTracks()&&
731  myVertex.refittedTracks().size()==3) {
732 
733  response=true;
734  math::XYZPoint vtx(myVertex.position().x(),myVertex.position().y(),myVertex.position().z());
735 
736  //Create a LV for each refitted track
737  math::XYZTLorentzVector p1(myVertex.refittedTracks().at(0).track().px(),
738  myVertex.refittedTracks().at(0).track().py(),
739  myVertex.refittedTracks().at(0).track().pz(),
740  sqrt(myVertex.refittedTracks().at(0).track().momentum().mag2() +0.139*0.139));
741 
742  math::XYZTLorentzVector p2(myVertex.refittedTracks().at(1).track().px(),
743  myVertex.refittedTracks().at(1).track().py(),
744  myVertex.refittedTracks().at(1).track().pz(),
745  sqrt(myVertex.refittedTracks().at(1).track().momentum().mag2() +0.139*0.139));
746 
747  math::XYZTLorentzVector p3(myVertex.refittedTracks().at(2).track().px(),
748  myVertex.refittedTracks().at(2).track().py(),
749  myVertex.refittedTracks().at(2).track().pz(),
750  sqrt(myVertex.refittedTracks().at(2).track().momentum().mag2() +0.139*0.139));
751 
752  //Update the tau p4
753  tau.setP4(p1+p2+p3);
754  //Update the vertex
755  tau.setVertex(vtx);
756  }
757  return response;
758 
759 }
const TransientTrackBuilder * TransientTrackBuilder_
reco::TransientTrack build(const reco::Track *p) const
T y() const
Definition: PV3DBase.h:62
std::pair< double, double > response
Definition: HCALResponse.h:20
virtual void setP4(const LorentzVector &p4)
set 4-momentum
bool hasRefittedTracks() const
const PFCandidateRefVector & signalPFChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:75
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
T sqrt(T t)
Definition: SSEVec.h:46
GlobalPoint position() const
T z() const
Definition: PV3DBase.h:63
double p2[4]
Definition: TauolaWrapper.h:90
virtual void setVertex(const Point &vertex)
set vertex
std::vector< reco::TransientTrack > refittedTracks() const
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:76
double p1[4]
Definition: TauolaWrapper.h:89
T x() const
Definition: PV3DBase.h:61
bool isValid() const
double p3[4]
Definition: TauolaWrapper.h:91
void HPSPFRecoTauAlgorithm::removeCandidateFromRefVector ( const reco::PFCandidateRef cand,
reco::PFCandidateRefVector vec 
)
private

Definition at line 688 of file HPSPFRecoTauAlgorithm.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), edm::RefVector< C, T, F >::erase(), and spr::find().

Referenced by associateIsolationCandidates(), buildOneProngStrip(), and buildOneProngTwoStrips().

689 {
690  PFCandidateRefVector newVec;
691 
693  it = std::find(vec.begin(),vec.end(),cand);
694  if(it!=vec.end())
695  vec.erase(it);
696 }
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
iterator erase(iterator const &pos)
Erase an element from the vector.
Definition: RefVector.h:234

Member Data Documentation

PFCandidateMergerBase* HPSPFRecoTauAlgorithm::candidateMerger_
private

Definition at line 39 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildPFTau(), configure(), and ~HPSPFRecoTauAlgorithm().

double HPSPFRecoTauAlgorithm::chargeIsolationCone_
private

Definition at line 98 of file HPSPFRecoTauAlgorithm.h.

Referenced by associateIsolationCandidates(), and configure().

std::string HPSPFRecoTauAlgorithm::coneMetric_
private
TFormula HPSPFRecoTauAlgorithm::coneSizeFormula
private

Definition at line 123 of file HPSPFRecoTauAlgorithm.h.

Referenced by configure(), and isNarrowTau().

std::string HPSPFRecoTauAlgorithm::coneSizeFormula_
private

Definition at line 117 of file HPSPFRecoTauAlgorithm.h.

Referenced by configure().

bool HPSPFRecoTauAlgorithm::doOneProngs_
private

Definition at line 84 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildPFTau(), and configure().

bool HPSPFRecoTauAlgorithm::doOneProngStrips_
private

Definition at line 85 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildPFTau(), and configure().

bool HPSPFRecoTauAlgorithm::doOneProngTwoStrips_
private

Definition at line 86 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildPFTau(), and configure().

bool HPSPFRecoTauAlgorithm::doThreeProngs_
private

Definition at line 87 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildPFTau(), and configure().

std::string HPSPFRecoTauAlgorithm::emMerger_
private

Definition at line 78 of file HPSPFRecoTauAlgorithm.h.

Referenced by configure().

double HPSPFRecoTauAlgorithm::gammaIsolationCone_
private

Definition at line 99 of file HPSPFRecoTauAlgorithm.h.

Referenced by associateIsolationCandidates(), and configure().

double HPSPFRecoTauAlgorithm::leadPionThreshold_
private

Definition at line 93 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildOneProng(), buildThreeProngs(), and configure().

double HPSPFRecoTauAlgorithm::matchingCone_
private
double HPSPFRecoTauAlgorithm::maxSignalCone_
private

Definition at line 120 of file HPSPFRecoTauAlgorithm.h.

Referenced by configure(), and isNarrowTau().

double HPSPFRecoTauAlgorithm::minSignalCone_
private

Definition at line 119 of file HPSPFRecoTauAlgorithm.h.

Referenced by configure(), and isNarrowTau().

double HPSPFRecoTauAlgorithm::neutrHadrIsolationCone_
private

Definition at line 100 of file HPSPFRecoTauAlgorithm.h.

Referenced by associateIsolationCandidates(), and configure().

std::vector<double> HPSPFRecoTauAlgorithm::oneProngStripMassWindow_
private

Definition at line 106 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildOneProngStrip(), and configure().

std::vector<double> HPSPFRecoTauAlgorithm::oneProngTwoStripsMassWindow_
private

Definition at line 107 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildOneProngTwoStrips(), and configure().

std::vector<double> HPSPFRecoTauAlgorithm::oneProngTwoStripsPi0MassWindow_
private

Definition at line 108 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildOneProngTwoStrips(), and configure().

std::string HPSPFRecoTauAlgorithm::overlapCriterion_
private

Definition at line 81 of file HPSPFRecoTauAlgorithm.h.

Referenced by configure(), and getBestTauCandidate().

reco::PFTauCollection HPSPFRecoTauAlgorithm::pfTaus_
private
double HPSPFRecoTauAlgorithm::stripPtThreshold_
private

Definition at line 96 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildOneProngStrip(), buildOneProngTwoStrips(), and configure().

double HPSPFRecoTauAlgorithm::tauThreshold_
private
std::vector<double> HPSPFRecoTauAlgorithm::threeProngMassWindow_
private

Definition at line 109 of file HPSPFRecoTauAlgorithm.h.

Referenced by buildThreeProngs(), and configure().

bool HPSPFRecoTauAlgorithm::useIsolationAnnulus_
private

Definition at line 103 of file HPSPFRecoTauAlgorithm.h.

Referenced by associateIsolationCandidates(), and configure().