00001 #include "RecoTauTag/HLTProducers/interface/L2TauJetsMerger.h" 00002 #include "Math/GenVector/VectorUtil.h" 00003 #include "DataFormats/L1Trigger/interface/L1JetParticle.h" 00004 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" 00005 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" 00006 #include "FWCore/Utilities/interface/EDMException.h" 00007 // 00008 // class decleration 00009 // 00010 using namespace reco; 00011 using namespace std; 00012 using namespace edm; 00013 using namespace l1extra; 00014 00015 L2TauJetsMerger::L2TauJetsMerger(const edm::ParameterSet& iConfig) 00016 { 00017 jetSrc = iConfig.getParameter<vtag>("JetSrc"); 00018 //l1ParticlesTau = iConfig.getParameter<InputTag>("L1ParticlesTau"); 00019 //l1ParticlesJet = iConfig.getParameter<InputTag>("L1ParticlesJet"); 00020 //tauTrigger = iConfig.getParameter<InputTag>("L1TauTrigger"); 00021 mEt_Min = iConfig.getParameter<double>("EtMin"); 00022 00023 produces<CaloJetCollection>(); 00024 } 00025 00026 L2TauJetsMerger::~L2TauJetsMerger(){ } 00027 00028 void L2TauJetsMerger::produce(edm::Event& iEvent, const edm::EventSetup& iES) 00029 { 00030 00031 using namespace edm; 00032 using namespace std; 00033 using namespace reco; 00034 00035 //Getting all the L1Seeds 00036 00037 00038 //Getting the Collections of L2ReconstructedJets from L1Seeds 00039 //and removing the collinear jets 00040 myL2L1JetsMap.clear(); 00041 int iL1Jet = 0; 00042 for( vtag::const_iterator s = jetSrc.begin(); s != jetSrc.end(); ++ s ) { 00043 edm::Handle<CaloJetCollection> tauJets; 00044 iEvent.getByLabel( * s, tauJets ); 00045 CaloJetCollection::const_iterator iTau = tauJets->begin(); 00046 if(iTau != tauJets->end()){ 00047 //Create a Map to associate to every Jet its L1SeedId, i.e. 0,1,2 or 3 00048 if(iTau->et() > mEt_Min) 00049 myL2L1JetsMap.insert(pair<int, const CaloJet>(iL1Jet, *(iTau))); 00050 } 00051 iL1Jet++; 00052 } 00053 00054 auto_ptr<CaloJetCollection> tauL2jets(new CaloJetCollection); 00055 //Removing the collinear jets 00056 for(int iJet =0;iJet<iL1Jet;iJet++) 00057 { 00058 map<int, const reco::CaloJet>::const_iterator myL2itr = myL2L1JetsMap.find(iJet); 00059 if(myL2itr!=myL2L1JetsMap.end()){ 00060 00061 const CaloJet my1stJet = myL2itr->second; 00062 for(int i2Jet = iJet+1;i2Jet<iL1Jet;i2Jet++) 00063 { 00064 map<int, const reco::CaloJet>::const_iterator my2L2itr = myL2L1JetsMap.find(i2Jet); 00065 if(my2L2itr!=myL2L1JetsMap.end()){ 00066 const CaloJet my2ndJet = my2L2itr->second; 00067 00068 double deltaR = ROOT::Math::VectorUtil::DeltaR(my1stJet.p4().Vect(), my2ndJet.p4().Vect()); 00069 if(deltaR < 0.1) 00070 { 00071 // cout <<"Collinear jets "<<deltaR<<endl; 00072 myL2L1JetsMap.erase(my2L2itr->first); 00073 } 00074 } 00075 } 00076 } 00077 } 00078 for(int iJet =0;iJet<iL1Jet;iJet++) 00079 { 00080 map<int, const reco::CaloJet>::const_iterator myL2itr = myL2L1JetsMap.find(iJet); 00081 if(myL2itr!=myL2L1JetsMap.end()){ 00082 00083 const CaloJet my1stJet = myL2itr->second; 00084 tauL2jets->push_back(my1stJet); 00085 } 00086 } 00087 00088 00089 // cout <<"Size of L2 jets "<<tauL2jets->size()<<endl; 00090 00091 iEvent.put(tauL2jets); 00092 00093 }