54 return tau.leadTrack();
58 double trackPtSum = 0.;
60 signalTrack != tau.signalTracks().end(); ++signalTrack ) {
61 trackPtSum += (*signalTrack)->pt();
78 double trackPtSum = 0.;
81 trackPtSum += (*signalTrack)->pt();
87 template<
class TauType,
class TauDiscriminator>
101 double discriminate(
const TauRef&);
131 template<
class TauType,
class TauDiscriminator>
153 template<
class TauType,
class TauDiscriminator>
156 evt.
getByLabel(srcEcalRecHitsBarrel_, ebRecHits_);
157 evt.
getByLabel(srcEcalRecHitsEndcap_, eeRecHits_);
158 evt.
getByLabel(srcHcalRecHits_, hbheRecHits_);
162 trackBuilder_ = trackBuilderHandle.
product();
163 if ( !trackBuilder_ ) {
164 edm::LogError (
"TauDiscriminationAgainstCaloMuon::discriminate")
165 <<
" Failed to access TransientTrackBuilder !!";
170 caloGeometry_ = caloGeometryHandle.
product();
171 if ( !caloGeometry_ ) {
172 edm::LogError (
"TauDiscriminationAgainstCaloMuon::discriminate")
173 <<
" Failed to access CaloGeometry !!";
179 if ( vertices->size() >= 1 ) {
180 const reco::Vertex& thePrimaryEventVertex = (*vertices->begin());
181 eventVertexPosition_ =
GlobalPoint(thePrimaryEventVertex.
x(), thePrimaryEventVertex.
y(), thePrimaryEventVertex.
z());
190 double ecalEnergySum = 0.;
195 if ( !cellGeometry ) {
197 <<
" Failed to access ECAL geometry for detId = " <<
ecalRecHit->detid().rawId()
198 <<
" --> skipping !!";
207 if (
deltaR(cellPositionRelVertex.
eta(), cellPositionRelVertex.
phi(),
208 transientTrack.
track().
eta(), transientTrack.
track().
phi()) > 0.5 )
continue;
214 TVector3 d3(d.
x(), d.
y(), d.
z());
217 double dPerp = d3.Cross(
dir.Unit()).Mag();
218 double dParl = TVector3(cellPosition.
x(), cellPosition.
y(), cellPosition.
z()).Dot(
dir.Unit());
220 if ( dPerp < dR && dParl > 100. ) {
225 return ecalEnergySum;
233 double hcalEnergySum = 0.;
235 hcalRecHit != hcalRecHits.
end(); ++hcalRecHit ) {
240 if ( hbCellGeometry ) cellPosition = &(hbCellGeometry->
getPosition());
241 if ( heCellGeometry ) cellPosition = &(heCellGeometry->
getPosition());
243 if ( !cellPosition ) {
245 <<
" Failed to access HCAL geometry for detId = " << hcalRecHit->detid().rawId()
246 <<
" --> skipping !!";
253 if (
deltaR(cellPositionRelVertex.
eta(), cellPositionRelVertex.
phi(),
254 transientTrack.
track().
eta(), transientTrack.
track().
phi()) > 0.5 )
continue;
260 TVector3 d3(d.
x(), d.
y(), d.
z());
263 double dPerp = d3.Cross(
dir.Unit()).Mag();
264 double dParl = TVector3(cellPosition->
x(), cellPosition->
y(), cellPosition->
z()).Dot(
dir.Unit());
266 if ( dPerp < dR && dParl > 100. ) {
267 hcalEnergySum += hcalRecHit->energy();
271 return hcalEnergySum;
274 template<
class TauType,
class TauDiscriminator>
277 if ( !(trackBuilder_ && caloGeometry_) )
return 0.;
284 TrackRef leadTrackRef = leadTrackExtractor_.getLeadTrack(*tau);
287 double leadTrackPt = leadTrackRef->pt();
288 double trackPtSum = leadTrackExtractor_.getTrackPtSum(*tau);
290 double leadTrackPtFraction = ( trackPtSum > 0. ) ? (leadTrackPt/trackPtSum) : -1.;
292 if ( leadTrackPt > minLeadTrackPt_ && leadTrackPtFraction > minLeadTrackPtFraction_ ) {
295 double ebEnergySum =
compEcalEnergySum(*ebRecHits_, ebGeometry, transientTrack, drEcal_, eventVertexPosition_);
296 double eeEnergySum =
compEcalEnergySum(*eeRecHits_, eeGeometry, transientTrack, drEcal_, eventVertexPosition_);
297 double ecalEnergySum = ebEnergySum + eeEnergySum;
299 double hbheEnergySum =
compHcalEnergySum(*hbheRecHits_, hbGeometry, heGeometry, transientTrack, drHcal_, eventVertexPosition_);
301 double caloEnergySum = ecalEnergySum + hbheEnergySum;
303 if ( ecalEnergySum < maxEnEcal_ &&
304 hbheEnergySum < maxEnHcal_ &&
305 caloEnergySum < (maxEnToTrackRatio_*leadTrackPt) )
return 0.;
T getParameter(std::string const &) const
TauLeadTrackExtractor< TauType > leadTrackExtractor_
GlobalPoint position() const
TauDiscriminationAgainstCaloMuon(const edm::ParameterSet &)
double minLeadTrackPtFraction_
const CaloGeometry * caloGeometry_
edm::Handle< HBHERecHitCollection > hbheRecHits_
#define DEFINE_FWK_MODULE(type)
double y() const
y coordinate
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
std::vector< EcalRecHit >::const_iterator const_iterator
double phi() const
azimuthal angle of momentum vector
edm::InputTag srcEcalRecHitsBarrel_
edm::Ref< TauCollection > TauRef
const PFCandidateRefVector & signalPFChargedHadrCands() const
Charged hadrons in signal region.
double px() const
x coordinate of momentum vector
const_iterator end() const
Termination of iteration.
const_iterator begin() const
Initialize an iterator over the RefVector.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
double compHcalEnergySum(const HBHERecHitCollection &hcalRecHits, const CaloSubdetectorGeometry *hbGeometry, const CaloSubdetectorGeometry *heGeometry, const reco::TransientTrack &transientTrack, double dR, const GlobalPoint &eventVertexPosition)
const TransientTrackBuilder * trackBuilder_
bool isNonnull() const
Checks for non-null.
TauDiscriminationAgainstCaloMuon< PFTau, PFTauDiscriminator > PFRecoTauDiscriminationAgainstCaloMuon
std::vector< TauType > TauCollection
double eta() const
pseudorapidity of momentum vector
GlobalPoint eventVertexPosition_
double z() const
y coordinate
double compEcalEnergySum(const EcalRecHitCollection &ecalRecHits, const CaloSubdetectorGeometry *detGeometry, const reco::TransientTrack &transientTrack, double dR, const GlobalPoint &eventVertexPosition)
TauDiscriminationAgainstCaloMuon< CaloTau, CaloTauDiscriminator > CaloRecoTauDiscriminationAgainstCaloMuon
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double pz() const
z coordinate of momentum vector
void beginEvent(const edm::Event &, const edm::EventSetup &)
const_iterator end() const
double deltaR(double eta1, double eta2, double phi1, double phi2)
edm::InputTag srcEcalRecHitsEndcap_
double x() const
x coordinate
const PFCandidateRef & leadPFChargedHadrCand() const
~TauDiscriminationAgainstCaloMuon()
edm::Handle< EcalRecHitCollection > eeRecHits_
const Track & track() const
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
T const * product() const
edm::Ref< TauCollection > TauRef
edm::Handle< EcalRecHitCollection > ebRecHits_
double maxEnToTrackRatio_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
double discriminate(const TauRef &)
edm::InputTag srcHcalRecHits_
bool isTransient() const
Checks if this ref is transient (i.e. not persistable).
const_iterator begin() const
double py() const
y coordinate of momentum vector