00001 #include "RecoTauTag/HLTProducers/interface/IsolatedTauJetsSelector.h" 00002 #include "DataFormats/VertexReco/interface/Vertex.h" 00003 #include "DataFormats/VertexReco/interface/VertexFwd.h" 00004 #include "Math/GenVector/VectorUtil.h" 00005 // 00006 // class decleration 00007 // 00008 00009 00010 IsolatedTauJetsSelector::IsolatedTauJetsSelector(const edm::ParameterSet& iConfig) 00011 { 00012 00013 jetSrc = iConfig.getParameter<vtag>("JetSrc"); 00014 pt_min_leadTrack = iConfig.getParameter<double>("MinimumTransverseMomentumLeadingTrack"); 00015 useIsolationDiscriminator = iConfig.getParameter<bool>("UseIsolationDiscriminator"); 00016 useInHLTOpen = iConfig.getParameter<bool>("UseInHLTOpen"); 00017 00018 produces<reco::CaloJetCollection>(); 00019 // produces<reco::IsolatedTauTagInfoCollection>(); 00020 } 00021 00022 IsolatedTauJetsSelector::~IsolatedTauJetsSelector(){ } 00023 00024 void IsolatedTauJetsSelector::produce(edm::Event& iEvent, const edm::EventSetup& iES) 00025 { 00026 00027 using namespace reco; 00028 using namespace edm; 00029 using namespace std; 00030 00031 CaloJetCollection * jetCollectionTmp = new CaloJetCollection; 00032 // IsolatedTauTagInfoCollection * extendedCollection = new IsolatedTauTagInfoCollection; 00033 00034 for( vtag::const_iterator s = jetSrc.begin(); s != jetSrc.end(); ++ s ) { 00035 edm::Handle<IsolatedTauTagInfoCollection> tauJets; 00036 iEvent.getByLabel( * s, tauJets ); 00037 IsolatedTauTagInfoCollection::const_iterator i = tauJets->begin(); 00038 for(;i !=tauJets->end(); i++ ) { 00039 00040 if(useInHLTOpen) { 00041 const CaloJet* pippo = dynamic_cast<const CaloJet*>((i->jet().get())); 00042 CaloJet* mioPippo = const_cast<CaloJet*>(pippo); 00043 mioPippo->setPdgId(15); 00044 if(mioPippo) 00045 jetCollectionTmp->push_back(*mioPippo); 00046 // extendedCollection->push_back(*(i)); //to be used later 00047 // delete pippo; 00048 }else{ 00049 const TrackRef leadTk = i->leadingSignalTrack(); 00050 if( !leadTk ) 00051 {}else{ 00052 if(leadTk->pt() > pt_min_leadTrack) { 00053 float discriminator = i->discriminator(); 00054 const CaloJet* pippo = dynamic_cast<const CaloJet*>((i->jet().get())); 00055 CaloJet* mioPippo = const_cast<CaloJet*>(pippo); 00056 mioPippo->setPdgId(15); 00057 if(useIsolationDiscriminator && (discriminator > 0) ) { 00058 if(mioPippo) 00059 jetCollectionTmp->push_back(*mioPippo); 00060 // delete pippo; 00061 }else if(!useIsolationDiscriminator){ 00062 if(mioPippo) 00063 jetCollectionTmp->push_back(*mioPippo); 00064 } 00065 } 00066 } 00067 } 00068 } 00069 } 00070 00071 00072 00073 auto_ptr<reco::CaloJetCollection> selectedTaus(jetCollectionTmp); 00074 00075 iEvent.put(selectedTaus); 00076 00077 00078 }