CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/RecoTauTag/HLTProducers/src/DQMTauProducer.cc

Go to the documentation of this file.
00001 #include "RecoTauTag/HLTProducers/interface/DQMTauProducer.h"
00002 #include "DataFormats/TrackReco/interface/Track.h"
00003 //
00004 // class decleration
00005 //
00006 
00007 
00008 DQMTauProducer::DQMTauProducer(const edm::ParameterSet& iConfig)
00009 {
00010   trackIsolatedJets_ = iConfig.getParameter<edm::InputTag>("TrackIsoJets");
00011   matchingCone_ = iConfig.getParameter<double>("MatchingCone");
00012   signalCone_ = iConfig.getParameter<double>("SignalCone");
00013   ptMin_ = iConfig.getParameter<double>("MinPtTracks");
00014   
00015   isolationCone_ = iConfig.getParameter<double>("IsolationCone");
00016   produces<reco::HLTTauCollection>();
00017 }
00018 
00019 DQMTauProducer::~DQMTauProducer(){ }
00020 
00021 void DQMTauProducer::produce(edm::Event& iEvent, const edm::EventSetup& iES)
00022 {
00023 
00024   using namespace reco;
00025   using namespace edm;
00026   using namespace std;
00027   
00028 
00029   HLTTauCollection * jetCollection = new HLTTauCollection;
00030  
00031 
00032   edm::Handle<IsolatedTauTagInfoCollection> tauL25Jets;
00033   iEvent.getByLabel(trackIsolatedJets_, tauL25Jets );
00034   
00035 
00036   IsolatedTauTagInfoCollection tau = *(tauL25Jets.product());
00037 
00038   
00039     float eta_, phi_, pt_;
00040     float ptLeadTk=0.;
00041   int trackIsolation=1000.;  
00042   int nTracks=1000.;
00043 
00044  for(unsigned int i=0; i<tau.size();i++)
00045    {
00046      JetTracksAssociationRef jetTracks = tau[i].jtaRef();
00047      math::XYZVector jetDir(jetTracks->first->px(),jetTracks->first->py(),jetTracks->first->pz());   
00048      eta_ = jetDir.eta();
00049      phi_ = jetDir.phi();
00050      pt_ = jetTracks->first->pt();
00051      
00052      const TrackRef leadTk = tau[i].leadingSignalTrack(jetDir,matchingCone_, 1.);
00053      if(!leadTk) 
00054        {}else{
00055          trackIsolation = (int)tau[i].discriminator(jetDir,matchingCone_, signalCone_, isolationCone_,1.,1.,0);
00056          ptLeadTk = (*leadTk).pt();
00057          nTracks = (tau[i].tracksInCone((*leadTk).momentum(), isolationCone_,   ptMin_ )).size() - (tau[i].tracksInCone((*leadTk).momentum(), signalCone_, ptMin_ )).size();
00058        }
00059      HLTTau pippo(eta_,phi_,pt_,-1,trackIsolation,ptLeadTk,trackIsolation,ptLeadTk);
00060      pippo.setNL25TrackIsolation(nTracks);
00061      pippo.setNL3TrackIsolation(nTracks);
00062      jetCollection->push_back(pippo);
00063      
00064    }
00065  
00066    
00067   auto_ptr<reco::HLTTauCollection> selectedTaus(jetCollection);
00068   
00069   iEvent.put(selectedTaus);
00070   
00071 
00072 
00073 
00074 }