CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator > Class Template Reference

Inheritance diagram for TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef std::vector< TauType > TauCollection
typedef edm::Ref< TauCollectionTauRef

Public Member Functions

void beginEvent (const edm::Event &, const edm::EventSetup &)
double discriminate (const TauRef &)
 TauDiscriminationAgainstCaloMuon (const edm::ParameterSet &)
 ~TauDiscriminationAgainstCaloMuon ()

Private Attributes

const CaloGeometrycaloGeometry_
double drEcal_
double drHcal_
edm::Handle< EcalRecHitCollectionebRecHits_
edm::Handle< EcalRecHitCollectioneeRecHits_
GlobalPoint eventVertexPosition_
edm::Handle< HBHERecHitCollectionhbheRecHits_
TauLeadTrackExtractor< TauType > leadTrackExtractor_
double maxEnEcal_
double maxEnHcal_
double maxEnToTrackRatio_
double minLeadTrackPt_
double minLeadTrackPtFraction_
edm::InputTag srcEcalRecHitsBarrel_
edm::InputTag srcEcalRecHitsEndcap_
edm::InputTag srcHcalRecHits_
edm::InputTag srcVertex_
const TransientTrackBuildertrackBuilder_

Detailed Description

template<class TauType, class TauDiscriminator>
class TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >

Definition at line 88 of file TauDiscriminationAgainstCaloMuon.cc.


Member Typedef Documentation

template<class TauType , class TauDiscriminator >
typedef std::vector<TauType> TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::TauCollection
template<class TauType , class TauDiscriminator >
typedef edm::Ref<TauCollection> TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::TauRef

Constructor & Destructor Documentation

template<class TauType , class TauDiscriminator >
TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::TauDiscriminationAgainstCaloMuon ( const edm::ParameterSet cfg) [explicit]

Definition at line 132 of file TauDiscriminationAgainstCaloMuon.cc.

References TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::drEcal_, TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::drHcal_, edm::ParameterSet::getParameter(), TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::maxEnEcal_, TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::maxEnHcal_, TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::maxEnToTrackRatio_, TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::minLeadTrackPt_, TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::minLeadTrackPtFraction_, TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::srcEcalRecHitsBarrel_, TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::srcEcalRecHitsEndcap_, TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::srcHcalRecHits_, and TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::srcVertex_.

  : TauDiscriminationProducerBase<TauType, TauDiscriminator>(cfg) 
{
  srcEcalRecHitsBarrel_ = cfg.getParameter<edm::InputTag>("srcEcalRecHitsBarrel");
  srcEcalRecHitsEndcap_ = cfg.getParameter<edm::InputTag>("srcEcalRecHitsEndcap");
  srcHcalRecHits_ = cfg.getParameter<edm::InputTag>("srcHcalRecHits");

  srcVertex_ = cfg.getParameter<edm::InputTag>("srcVertex");

  minLeadTrackPt_ = cfg.getParameter<double>("minLeadTrackPt");
  minLeadTrackPtFraction_ = cfg.getParameter<double>("minLeadTrackPtFraction");

  drEcal_ = cfg.getParameter<double>("dRecal");
  drHcal_ = cfg.getParameter<double>("dRhcal");

  maxEnEcal_ = cfg.getParameter<double>("maxEnEcal");
  maxEnHcal_ = cfg.getParameter<double>("maxEnHcal");

  maxEnToTrackRatio_ = cfg.getParameter<double>("maxEnToTrackRatio");
}
template<class TauType , class TauDiscriminator >
TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::~TauDiscriminationAgainstCaloMuon ( ) [inline]

Definition at line 96 of file TauDiscriminationAgainstCaloMuon.cc.

{} 

Member Function Documentation

template<class TauType , class TauDiscriminator >
void TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::beginEvent ( const edm::Event evt,
const edm::EventSetup evtSetup 
) [virtual]

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 154 of file TauDiscriminationAgainstCaloMuon.cc.

References edm::EventSetup::get(), edm::Event::getByLabel(), edm::ESHandle< T >::product(), reco::Vertex::x(), reco::Vertex::y(), and reco::Vertex::z().

{
  evt.getByLabel(srcEcalRecHitsBarrel_, ebRecHits_);
  evt.getByLabel(srcEcalRecHitsEndcap_, eeRecHits_);
  evt.getByLabel(srcHcalRecHits_, hbheRecHits_);
  
  edm::ESHandle<TransientTrackBuilder> trackBuilderHandle;
  evtSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilderHandle);
  trackBuilder_ = trackBuilderHandle.product();
  if ( !trackBuilder_ ) {
    edm::LogError ("TauDiscriminationAgainstCaloMuon::discriminate")
      << " Failed to access TransientTrackBuilder !!";
  }

  edm::ESHandle<CaloGeometry> caloGeometryHandle;
  evtSetup.get<CaloGeometryRecord>().get(caloGeometryHandle);
  caloGeometry_ = caloGeometryHandle.product();
  if ( !caloGeometry_ ) {
    edm::LogError ("TauDiscriminationAgainstCaloMuon::discriminate")
      << " Failed to access CaloGeometry !!";
  }

  edm::Handle<reco::VertexCollection> vertices;
  evt.getByLabel(srcVertex_, vertices);
  eventVertexPosition_ = GlobalPoint(0., 0., 0.);
  if ( vertices->size() >= 1 ) {
    const reco::Vertex& thePrimaryEventVertex = (*vertices->begin());
    eventVertexPosition_ = GlobalPoint(thePrimaryEventVertex.x(), thePrimaryEventVertex.y(), thePrimaryEventVertex.z());
  }
}               
template<class TauType , class TauDiscriminator >
double TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::discriminate ( const TauRef tau) [virtual]

Implements TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 275 of file TauDiscriminationAgainstCaloMuon.cc.

References compEcalEnergySum(), compHcalEnergySum(), DetId::Ecal, EcalBarrel, EcalEndcap, DetId::Hcal, HcalBarrel, HcalEndcap, edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), and edm::Ref< C, T, F >::isTransient().

{
  if ( !(trackBuilder_ && caloGeometry_) ) return 0.;

  const CaloSubdetectorGeometry* ebGeometry = caloGeometry_->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
  const CaloSubdetectorGeometry* eeGeometry = caloGeometry_->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
  const CaloSubdetectorGeometry* hbGeometry = caloGeometry_->getSubdetectorGeometry(DetId::Hcal, HcalBarrel);
  const CaloSubdetectorGeometry* heGeometry = caloGeometry_->getSubdetectorGeometry(DetId::Hcal, HcalEndcap);

  TrackRef leadTrackRef = leadTrackExtractor_.getLeadTrack(*tau);

  if ( (leadTrackRef.isAvailable() || leadTrackRef.isTransient()) && leadTrackRef.isNonnull() ) {
    double leadTrackPt = leadTrackRef->pt();
    double trackPtSum = leadTrackExtractor_.getTrackPtSum(*tau);
    
    double leadTrackPtFraction = ( trackPtSum > 0. ) ? (leadTrackPt/trackPtSum) : -1.;
    
    if ( leadTrackPt > minLeadTrackPt_ && leadTrackPtFraction > minLeadTrackPtFraction_ ) {
      reco::TransientTrack transientTrack = trackBuilder_->build(leadTrackRef);

      double ebEnergySum = compEcalEnergySum(*ebRecHits_, ebGeometry, transientTrack, drEcal_, eventVertexPosition_);
      double eeEnergySum = compEcalEnergySum(*eeRecHits_, eeGeometry, transientTrack, drEcal_, eventVertexPosition_);
      double ecalEnergySum = ebEnergySum + eeEnergySum;
      
      double hbheEnergySum = compHcalEnergySum(*hbheRecHits_, hbGeometry, heGeometry, transientTrack, drHcal_, eventVertexPosition_);
      
      double caloEnergySum = ecalEnergySum + hbheEnergySum;

      if ( ecalEnergySum <  maxEnEcal_ &&
           hbheEnergySum <  maxEnHcal_ &&
           caloEnergySum < (maxEnToTrackRatio_*leadTrackPt) ) return 0.;
    }
  }

  return 1.;
}

Member Data Documentation

template<class TauType , class TauDiscriminator >
const CaloGeometry* TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::caloGeometry_ [private]

Definition at line 115 of file TauDiscriminationAgainstCaloMuon.cc.

template<class TauType , class TauDiscriminator >
double TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::drEcal_ [private]
template<class TauType , class TauDiscriminator >
double TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::drHcal_ [private]
template<class TauType , class TauDiscriminator >
edm::Handle<EcalRecHitCollection> TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::ebRecHits_ [private]

Definition at line 105 of file TauDiscriminationAgainstCaloMuon.cc.

template<class TauType , class TauDiscriminator >
edm::Handle<EcalRecHitCollection> TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::eeRecHits_ [private]

Definition at line 107 of file TauDiscriminationAgainstCaloMuon.cc.

template<class TauType , class TauDiscriminator >
GlobalPoint TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::eventVertexPosition_ [private]

Definition at line 112 of file TauDiscriminationAgainstCaloMuon.cc.

template<class TauType , class TauDiscriminator >
edm::Handle<HBHERecHitCollection> TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::hbheRecHits_ [private]

Definition at line 109 of file TauDiscriminationAgainstCaloMuon.cc.

template<class TauType , class TauDiscriminator >
TauLeadTrackExtractor<TauType> TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::leadTrackExtractor_ [private]

Definition at line 117 of file TauDiscriminationAgainstCaloMuon.cc.

template<class TauType , class TauDiscriminator >
double TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::maxEnEcal_ [private]
template<class TauType , class TauDiscriminator >
double TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::maxEnHcal_ [private]
template<class TauType , class TauDiscriminator >
double TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::maxEnToTrackRatio_ [private]
template<class TauType , class TauDiscriminator >
double TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::minLeadTrackPt_ [private]
template<class TauType , class TauDiscriminator >
double TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::minLeadTrackPtFraction_ [private]
template<class TauType , class TauDiscriminator >
edm::InputTag TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::srcEcalRecHitsBarrel_ [private]
template<class TauType , class TauDiscriminator >
edm::InputTag TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::srcEcalRecHitsEndcap_ [private]
template<class TauType , class TauDiscriminator >
edm::InputTag TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::srcHcalRecHits_ [private]
template<class TauType , class TauDiscriminator >
edm::InputTag TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::srcVertex_ [private]
template<class TauType , class TauDiscriminator >
const TransientTrackBuilder* TauDiscriminationAgainstCaloMuon< TauType, TauDiscriminator >::trackBuilder_ [private]

Definition at line 114 of file TauDiscriminationAgainstCaloMuon.cc.