Go to the documentation of this file.00001 #include "RecoTauTag/HLTProducers/interface/TauJetSelectorForHLTTrackSeeding.h"
00002
00003 #include "DataFormats/Math/interface/deltaPhi.h"
00004 #include "DataFormats/JetReco/interface/CaloJet.h"
00005 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00006 #include "DataFormats/JetReco/interface/TrackJet.h"
00007 #include "DataFormats/JetReco/interface/TrackJetCollection.h"
00008 #include "DataFormats/TrackReco/interface/Track.h"
00009 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00010
00011
00012 TauJetSelectorForHLTTrackSeeding::TauJetSelectorForHLTTrackSeeding(const edm::ParameterSet& iConfig):
00013 inputTrackJetTag_(iConfig.getParameter< edm::InputTag > ("inputTrackJetTag")),
00014 inputCaloJetTag_(iConfig.getParameter< edm::InputTag > ("inputCaloJetTag")),
00015 inputTrackTag_(iConfig.getParameter< edm::InputTag > ("inputTrackTag")),
00016 ptMinCaloJet_(iConfig.getParameter< double > ("ptMinCaloJet")),
00017 etaMinCaloJet_(iConfig.getParameter< double > ("etaMinCaloJet")),
00018 etaMaxCaloJet_(iConfig.getParameter< double > ("etaMaxCaloJet")),
00019 tauConeSize_(iConfig.getParameter< double > ("tauConeSize")),
00020 isolationConeSize_(iConfig.getParameter< double > ("isolationConeSize")),
00021 fractionMinCaloInTauCone_(iConfig.getParameter< double > ("fractionMinCaloInTauCone")),
00022 fractionMaxChargedPUInCaloCone_(iConfig.getParameter< double > ("fractionMaxChargedPUInCaloCone")),
00023 ptTrkMaxInCaloCone_(iConfig.getParameter< double > ("ptTrkMaxInCaloCone")),
00024 nTrkMaxInCaloCone_(iConfig.getParameter< int > ("nTrkMaxInCaloCone"))
00025 {
00026
00027 produces<reco::TrackJetCollection>();
00028 }
00029
00030
00031 TauJetSelectorForHLTTrackSeeding::~TauJetSelectorForHLTTrackSeeding()
00032 {
00033
00034
00035
00036
00037 }
00038
00039
00040
00041
00042
00043
00044
00045 void
00046 TauJetSelectorForHLTTrackSeeding::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00047 {
00048 std::auto_ptr< reco::TrackJetCollection > augmentedTrackJets (new reco::TrackJetCollection);
00049
00050 edm::Handle<reco::TrackJetCollection> trackjets;
00051 iEvent.getByLabel(inputTrackJetTag_, trackjets);
00052
00053 for (reco::TrackJetCollection::const_iterator trackjet = trackjets->begin();
00054 trackjet != trackjets->end(); trackjet++) {
00055 augmentedTrackJets->push_back(*trackjet);
00056 }
00057
00058 edm::Handle<reco::TrackCollection> tracks;
00059 iEvent.getByLabel(inputTrackTag_,tracks);
00060
00061 edm::Handle<reco::CaloJetCollection> calojets;
00062 iEvent.getByLabel(inputCaloJetTag_,calojets);
00063
00064 const double tauConeSize2 = tauConeSize_ * tauConeSize_;
00065 const double isolationConeSize2 = isolationConeSize_ * isolationConeSize_;
00066
00067 for (reco::CaloJetCollection::const_iterator calojet = calojets->begin();
00068 calojet != calojets->end(); calojet++) {
00069
00070 if ( calojet->pt() < ptMinCaloJet_ ) continue;
00071 double etaJet = calojet->eta();
00072 double phiJet = calojet->phi();
00073 if ( etaJet < etaMinCaloJet_ ) continue;
00074 if ( etaJet > etaMaxCaloJet_ ) continue;
00075
00076 std::vector <CaloTowerPtr> const & theTowers = calojet->getCaloConstituents();
00077 double ptIn = 0.;
00078 double ptOut = 0.;
00079 for ( unsigned int itwr = 0; itwr < theTowers.size(); ++itwr ) {
00080 double etaTwr = theTowers[itwr]->eta() - etaJet;
00081 double phiTwr = deltaPhi(theTowers[itwr]->phi(), phiJet);
00082 double deltaR2 = etaTwr*etaTwr + phiTwr*phiTwr;
00083
00084 if ( deltaR2 < tauConeSize2 ) {
00085 ptIn += theTowers[itwr]->pt();
00086 } else if ( deltaR2 < isolationConeSize2 ) {
00087 ptOut += theTowers[itwr]->pt();
00088 }
00089 }
00090 double ptTot = ptIn+ptOut;
00091 double fracIn = ptIn/ptTot;
00092
00093
00094 if ( fracIn < fractionMinCaloInTauCone_) continue;
00095
00096 int ntrk = 0;
00097 double ptTrk = 0.;
00098
00099 for (reco::TrackJetCollection::const_iterator trackjet = trackjets->begin();
00100 trackjet != trackjets->end(); trackjet++) {
00101 for (unsigned itr=0; itr<trackjet->numberOfTracks(); ++itr) {
00102 edm::Ptr<reco::Track> track = trackjet->track(itr);
00103 double trackEta = track->eta() - etaJet;
00104 double trackPhi = deltaPhi(track->phi(), phiJet);
00105 double deltaR2 = trackEta*trackEta + trackPhi*trackPhi;
00106 if ( deltaR2 < isolationConeSize2 ) {
00107 ntrk++;
00108 ptTrk += track->pt();
00109 }
00110 }
00111 }
00112
00113 if ( ntrk > nTrkMaxInCaloCone_ ) continue;
00114 if ( ptTrk > ptTrkMaxInCaloCone_ ) continue;
00115
00116 int ntrk2 = 0;
00117 double ptTrk2 = 0.;
00118
00119 for (reco::TrackCollection::const_iterator track = tracks->begin();
00120 track != tracks->end(); track++) {
00121 double trackEta = track->eta() - etaJet;
00122 double trackPhi = deltaPhi(track->phi(), phiJet);
00123 double deltaR2 = trackEta*trackEta + trackPhi*trackPhi;
00124 if ( deltaR2 < isolationConeSize2 ) {
00125 ntrk2++;
00126 ptTrk2 += track->pt();
00127 }
00128 }
00129
00130 double fractionChargedPU = ptTrk2/calojet->pt();
00131 if ( fractionChargedPU > fractionMaxChargedPUInCaloCone_ ) continue;
00132
00133
00134
00135
00136
00137
00138
00139 math::XYZTLorentzVector p4(calojet->p4());
00140 math::XYZPoint vertex(calojet->vertex());
00141 augmentedTrackJets->push_back(reco::TrackJet(p4,vertex));
00142 }
00143
00144 iEvent.put(augmentedTrackJets);
00145 }
00146
00147
00148 void
00149 TauJetSelectorForHLTTrackSeeding::beginJob() {}
00150
00151
00152 void
00153 TauJetSelectorForHLTTrackSeeding::endJob() {}
00154
00155
00156 void
00157 TauJetSelectorForHLTTrackSeeding::beginRun(edm::Run&, edm::EventSetup const&) {}
00158
00159
00160 void
00161 TauJetSelectorForHLTTrackSeeding::endRun(edm::Run&, edm::EventSetup const&) {}
00162