CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TauJetSelectorForHLTTrackSeeding Class Reference

#include <TauJetSelectorForHLTTrackSeeding.h>

Inheritance diagram for TauJetSelectorForHLTTrackSeeding:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 TauJetSelectorForHLTTrackSeeding (const edm::ParameterSet &)
 ~TauJetSelectorForHLTTrackSeeding ()

Private Member Functions

virtual void beginJob ()
virtual void beginRun (edm::Run &, edm::EventSetup const &)
virtual void endJob ()
virtual void endRun (edm::Run &, edm::EventSetup const &)
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

const double etaMaxCaloJet_
const double etaMinCaloJet_
const double fractionMaxChargedPUInCaloCone_
const double fractionMinCaloInTauCone_
const edm::InputTag inputCaloJetTag_
const edm::InputTag inputTrackJetTag_
const edm::InputTag inputTrackTag_
const double isolationConeSize_
const int nTrkMaxInCaloCone_
const double ptMinCaloJet_
const double ptTrkMaxInCaloCone_
const double tauConeSize_

Detailed Description

Definition at line 17 of file TauJetSelectorForHLTTrackSeeding.h.


Constructor & Destructor Documentation

TauJetSelectorForHLTTrackSeeding::TauJetSelectorForHLTTrackSeeding ( const edm::ParameterSet iConfig) [explicit]

Definition at line 12 of file TauJetSelectorForHLTTrackSeeding.cc.

                                                                                                :
  inputTrackJetTag_(iConfig.getParameter< edm::InputTag > ("inputTrackJetTag")),
  inputCaloJetTag_(iConfig.getParameter< edm::InputTag > ("inputCaloJetTag")),
  inputTrackTag_(iConfig.getParameter< edm::InputTag > ("inputTrackTag")),
  ptMinCaloJet_(iConfig.getParameter< double > ("ptMinCaloJet")),
  etaMinCaloJet_(iConfig.getParameter< double > ("etaMinCaloJet")),
  etaMaxCaloJet_(iConfig.getParameter< double > ("etaMaxCaloJet")),
  tauConeSize_(iConfig.getParameter< double > ("tauConeSize")),
  isolationConeSize_(iConfig.getParameter< double > ("isolationConeSize")),
  fractionMinCaloInTauCone_(iConfig.getParameter< double > ("fractionMinCaloInTauCone")),
  fractionMaxChargedPUInCaloCone_(iConfig.getParameter< double > ("fractionMaxChargedPUInCaloCone")),
  ptTrkMaxInCaloCone_(iConfig.getParameter< double > ("ptTrkMaxInCaloCone")),
  nTrkMaxInCaloCone_(iConfig.getParameter< int > ("nTrkMaxInCaloCone"))
{
   //now do what ever initialization is needed
  produces<reco::TrackJetCollection>();
}
TauJetSelectorForHLTTrackSeeding::~TauJetSelectorForHLTTrackSeeding ( )

Definition at line 31 of file TauJetSelectorForHLTTrackSeeding.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void TauJetSelectorForHLTTrackSeeding::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 149 of file TauJetSelectorForHLTTrackSeeding.cc.

{}
void TauJetSelectorForHLTTrackSeeding::beginRun ( edm::Run ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 157 of file TauJetSelectorForHLTTrackSeeding.cc.

{}
void TauJetSelectorForHLTTrackSeeding::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 153 of file TauJetSelectorForHLTTrackSeeding.cc.

{}
void TauJetSelectorForHLTTrackSeeding::endRun ( edm::Run ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 161 of file TauJetSelectorForHLTTrackSeeding.cc.

{}
void TauJetSelectorForHLTTrackSeeding::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 46 of file TauJetSelectorForHLTTrackSeeding.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, Geom::deltaR2(), etaMaxCaloJet_, etaMinCaloJet_, fractionMaxChargedPUInCaloCone_, fractionMinCaloInTauCone_, edm::Event::getByLabel(), inputCaloJetTag_, inputTrackJetTag_, inputTrackTag_, isolationConeSize_, nTrkMaxInCaloCone_, p4, phi, ptMinCaloJet_, ptTrkMaxInCaloCone_, edm::Event::put(), tauConeSize_, reco::btau::trackEta, reco::btau::trackPhi, and testEve_cfg::tracks.

{
   std::auto_ptr< reco::TrackJetCollection > augmentedTrackJets (new reco::TrackJetCollection);

   edm::Handle<reco::TrackJetCollection> trackjets;
   iEvent.getByLabel(inputTrackJetTag_, trackjets);

   for (reco::TrackJetCollection::const_iterator trackjet = trackjets->begin();
          trackjet != trackjets->end(); trackjet++) {
     augmentedTrackJets->push_back(*trackjet);
   }

   edm::Handle<reco::TrackCollection> tracks;
   iEvent.getByLabel(inputTrackTag_,tracks);

   edm::Handle<reco::CaloJetCollection> calojets;
   iEvent.getByLabel(inputCaloJetTag_,calojets);

   const double tauConeSize2       = tauConeSize_ * tauConeSize_;
   const double isolationConeSize2 = isolationConeSize_ * isolationConeSize_;

   for (reco::CaloJetCollection::const_iterator calojet = calojets->begin();
          calojet != calojets->end(); calojet++) {

     if ( calojet->pt() < ptMinCaloJet_ ) continue;
     double etaJet = calojet->eta();
     double phiJet = calojet->phi();
     if ( etaJet < etaMinCaloJet_ ) continue;
     if ( etaJet > etaMaxCaloJet_ ) continue;

     std::vector <CaloTowerPtr> const & theTowers = calojet->getCaloConstituents();
     double ptIn = 0.;
     double ptOut = 0.;
     for ( unsigned int itwr = 0; itwr < theTowers.size(); ++itwr ) { 
       double etaTwr = theTowers[itwr]->eta() - etaJet;
       double phiTwr = deltaPhi(theTowers[itwr]->phi(), phiJet);
       double deltaR2 = etaTwr*etaTwr + phiTwr*phiTwr;
       //std::cout << "Tower eta/phi/et : " << etaTwr << " " << phiTwr << " " << theTowers[itwr]->pt() << std::endl;
       if ( deltaR2 < tauConeSize2 ) { 
         ptIn += theTowers[itwr]->pt(); 
       } else if ( deltaR2 < isolationConeSize2 ) { 
         ptOut += theTowers[itwr]->pt(); 
       }
     }
     double ptTot = ptIn+ptOut;
     double fracIn = ptIn/ptTot;

     // We are looking for isolated tracks
     if ( fracIn < fractionMinCaloInTauCone_) continue;

     int ntrk = 0;
     double ptTrk = 0.;

     for (reco::TrackJetCollection::const_iterator trackjet = trackjets->begin();
          trackjet != trackjets->end(); trackjet++) {
       for (unsigned itr=0; itr<trackjet->numberOfTracks(); ++itr) { 
         edm::Ptr<reco::Track> track = trackjet->track(itr);
         double trackEta = track->eta() - etaJet;
         double trackPhi = deltaPhi(track->phi(), phiJet);
         double deltaR2 = trackEta*trackEta + trackPhi*trackPhi;
         if ( deltaR2 < isolationConeSize2 ) { 
           ntrk++; 
           ptTrk += track->pt();
         }
       }
     }
     // We are looking for calojets without signal tracks already in
     if ( ntrk > nTrkMaxInCaloCone_ ) continue;
     if ( ptTrk > ptTrkMaxInCaloCone_ ) continue;

     int ntrk2 = 0;
     double ptTrk2 = 0.;

     for (reco::TrackCollection::const_iterator track = tracks->begin();
          track != tracks->end(); track++) {
       double trackEta = track->eta() - etaJet;
       double trackPhi = deltaPhi(track->phi(), phiJet);
       double deltaR2 = trackEta*trackEta + trackPhi*trackPhi;
       if ( deltaR2 < isolationConeSize2 ) { 
         ntrk2++; 
         ptTrk2 += track->pt();
       }
     }
     // We are looking for signal jets, not PU jets
     double fractionChargedPU = ptTrk2/calojet->pt(); 
     if ( fractionChargedPU > fractionMaxChargedPUInCaloCone_ ) continue;
     /*
     std::cout << "Calo Jet " << calojet->pt() << " " << calojet->eta() 
               << " " << ptIn << " " << ptOut << " " << fracIn
               << " " << ptTrk << " " << ntrk 
               << " " << fractionChargedPU
               << std::endl;
     */
     math::XYZTLorentzVector p4(calojet->p4());
     math::XYZPoint vertex(calojet->vertex());
     augmentedTrackJets->push_back(reco::TrackJet(p4,vertex));
   }

   iEvent.put(augmentedTrackJets);
}

Member Data Documentation

Definition at line 38 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 37 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 42 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 41 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 34 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 33 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 35 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 40 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 44 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 36 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 43 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().

Definition at line 39 of file TauJetSelectorForHLTTrackSeeding.h.

Referenced by produce().