CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Typedefs | Functions
TauDiscriminationAgainstCaloMuon.cc File Reference
#include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/MuonReco/interface/Muon.h"
#include "DataFormats/MuonReco/interface/MuonFwd.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "DataFormats/HcalRecHit/interface/HBHERecHit.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "DataFormats/CaloTowers/interface/CaloTower.h"
#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
#include "TrackingTools/Records/interface/TransientTrackRecord.h"
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateClosestToPoint.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/Math/interface/deltaR.h"
#include <TVector3.h>
#include <TMath.h>
#include <string>
#include "FWCore/Framework/interface/MakerMacros.h"

Go to the source code of this file.

Classes

class  TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >
 
class  TauLeadTrackExtractor< T >
 
class  TauLeadTrackExtractor< reco::PFTau >
 

Typedefs

typedef
TauDiscriminationAgainstCaloMuon
< CaloTau,
CaloTauDiscriminator
CaloRecoTauDiscriminationAgainstCaloMuon
 
typedef
TauDiscriminationAgainstCaloMuon
< PFTau, PFTauDiscriminator
PFRecoTauDiscriminationAgainstCaloMuon
 

Functions

double compEcalEnergySum (const EcalRecHitCollection &ecalRecHits, const CaloSubdetectorGeometry *detGeometry, const reco::TransientTrack &transientTrack, double dR, const GlobalPoint &eventVertexPosition)
 
double compHcalEnergySum (const HBHERecHitCollection &hcalRecHits, const CaloSubdetectorGeometry *hbGeometry, const CaloSubdetectorGeometry *heGeometry, const reco::TransientTrack &transientTrack, double dR, const GlobalPoint &eventVertexPosition)
 
 DEFINE_FWK_MODULE (PFRecoTauDiscriminationAgainstCaloMuon)
 
 DEFINE_FWK_MODULE (CaloRecoTauDiscriminationAgainstCaloMuon)
 

Typedef Documentation

Definition at line 315 of file TauDiscriminationAgainstCaloMuon.cc.

Definition at line 314 of file TauDiscriminationAgainstCaloMuon.cc.

Function Documentation

double compEcalEnergySum ( const EcalRecHitCollection ecalRecHits,
const CaloSubdetectorGeometry detGeometry,
const reco::TransientTrack transientTrack,
double  dR,
const GlobalPoint eventVertexPosition 
)

Definition at line 185 of file TauDiscriminationAgainstCaloMuon.cc.

References edm::SortedCollection< T, SORT >::begin(), deltaR(), dir, EcalRecHitsCustom_cff::ecalRecHit, edm::SortedCollection< T, SORT >::end(), PV3DBase< T, VectorTag, FrameTag >::eta(), reco::TrackBase::eta(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), PV3DBase< T, VectorTag, FrameTag >::phi(), reco::TrackBase::phi(), TrajectoryStateClosestToPoint::position(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), reco::TransientTrack::track(), reco::TransientTrack::trajectoryStateClosestToPoint(), PV3DBase< T, VectorTag, FrameTag >::x(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, VectorTag, FrameTag >::y(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, VectorTag, FrameTag >::z(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::discriminate().

189 {
190  double ecalEnergySum = 0.;
192  ecalRecHit != ecalRecHits.end(); ++ecalRecHit ) {
193  const CaloCellGeometry* cellGeometry = detGeometry->getGeometry(ecalRecHit->detid());
194 
195  if ( !cellGeometry ) {
196  edm::LogError ("compEcalEnergySum")
197  << " Failed to access ECAL geometry for detId = " << ecalRecHit->detid().rawId()
198  << " --> skipping !!";
199  continue;
200  }
201 
202  const GlobalPoint& cellPosition = cellGeometry->getPosition();
203 
204 //--- CV: speed up computation by requiring eta-phi distance
205 // between cell position and track direction to be dR < 0.5
206  Vector3DBase<float, GlobalTag> cellPositionRelVertex = (cellPosition) - eventVertexPosition;
207  if ( deltaR(cellPositionRelVertex.eta(), cellPositionRelVertex.phi(),
208  transientTrack.track().eta(), transientTrack.track().phi()) > 0.5 ) continue;
209 
210  TrajectoryStateClosestToPoint dcaPosition = transientTrack.trajectoryStateClosestToPoint(cellPosition);
211 
212  Vector3DBase<float, GlobalTag> d = (cellPosition - dcaPosition.position());
213 
214  TVector3 d3(d.x(), d.y(), d.z());
215  TVector3 dir(transientTrack.track().px(), transientTrack.track().py(), transientTrack.track().pz());
216 
217  double dPerp = d3.Cross(dir.Unit()).Mag();
218  double dParl = TVector3(cellPosition.x(), cellPosition.y(), cellPosition.z()).Dot(dir.Unit());
219 
220  if ( dPerp < dR && dParl > 100. ) {
221  ecalEnergySum += ecalRecHit->energy();
222  }
223  }
224 
225  return ecalEnergySum;
226 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< EcalRecHit >::const_iterator const_iterator
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:139
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:133
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:137
const_iterator end() const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
const Track & track() const
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
dbl *** dir
Definition: mlp_gen.cc:35
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
const_iterator begin() const
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:135
double compHcalEnergySum ( const HBHERecHitCollection hcalRecHits,
const CaloSubdetectorGeometry hbGeometry,
const CaloSubdetectorGeometry heGeometry,
const reco::TransientTrack transientTrack,
double  dR,
const GlobalPoint eventVertexPosition 
)

Definition at line 228 of file TauDiscriminationAgainstCaloMuon.cc.

References edm::SortedCollection< T, SORT >::begin(), deltaR(), dir, edm::SortedCollection< T, SORT >::end(), PV3DBase< T, VectorTag, FrameTag >::eta(), reco::TrackBase::eta(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), PV3DBase< T, VectorTag, FrameTag >::phi(), reco::TrackBase::phi(), TrajectoryStateClosestToPoint::position(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), reco::TransientTrack::track(), reco::TransientTrack::trajectoryStateClosestToPoint(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, VectorTag, FrameTag >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, VectorTag, FrameTag >::y(), PV3DBase< T, VectorTag, FrameTag >::z(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::discriminate().

232 {
233  double hcalEnergySum = 0.;
234  for ( HBHERecHitCollection::const_iterator hcalRecHit = hcalRecHits.begin();
235  hcalRecHit != hcalRecHits.end(); ++hcalRecHit ) {
236  const CaloCellGeometry* hbCellGeometry = hbGeometry->getGeometry(hcalRecHit->detid());
237  const CaloCellGeometry* heCellGeometry = heGeometry->getGeometry(hcalRecHit->detid());
238 
239  const GlobalPoint* cellPosition = 0;
240  if ( hbCellGeometry ) cellPosition = &(hbCellGeometry->getPosition());
241  if ( heCellGeometry ) cellPosition = &(heCellGeometry->getPosition());
242 
243  if ( !cellPosition ) {
244  edm::LogError ("compHcalEnergySum")
245  << " Failed to access HCAL geometry for detId = " << hcalRecHit->detid().rawId()
246  << " --> skipping !!";
247  continue;
248  }
249 
250 //--- CV: speed up computation by requiring eta-phi distance
251 // between cell position and track direction to be dR < 0.5
252  Vector3DBase<float, GlobalTag> cellPositionRelVertex = (*cellPosition) - eventVertexPosition;
253  if ( deltaR(cellPositionRelVertex.eta(), cellPositionRelVertex.phi(),
254  transientTrack.track().eta(), transientTrack.track().phi()) > 0.5 ) continue;
255 
256  TrajectoryStateClosestToPoint dcaPosition = transientTrack.trajectoryStateClosestToPoint(*cellPosition);
257 
258  Vector3DBase<float, GlobalTag> d = ((*cellPosition) - dcaPosition.position());
259 
260  TVector3 d3(d.x(), d.y(), d.z());
261  TVector3 dir(transientTrack.track().px(), transientTrack.track().py(), transientTrack.track().pz());
262 
263  double dPerp = d3.Cross(dir.Unit()).Mag();
264  double dParl = TVector3(cellPosition->x(), cellPosition->y(), cellPosition->z()).Dot(dir.Unit());
265 
266  if ( dPerp < dR && dParl > 100. ) {
267  hcalEnergySum += hcalRecHit->energy();
268  }
269  }
270 
271  return hcalEnergySum;
272 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< T >::const_iterator const_iterator
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:139
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:133
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:137
const_iterator end() const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
const Track & track() const
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
dbl *** dir
Definition: mlp_gen.cc:35
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
const_iterator begin() const
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:135
DEFINE_FWK_MODULE ( PFRecoTauDiscriminationAgainstCaloMuon  )