Go to the documentation of this file.00001
00002
00003
00004
00005 #include <cmath>
00006 #include "DataFormats/RecoCandidate/interface/RecoCaloTowerCandidate.h"
00007 #include "DataFormats/CaloTowers/interface/CaloTower.h"
00008 #include "DataFormats/Common/interface/Handle.h"
00009 #include "FWCore/Framework/interface/Event.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 #include "RecoTauTag/HLTProducers/interface/CaloTowerCreatorForTauHLT.h"
00012 #include "DataFormats/L1Trigger/interface/L1JetParticle.h"
00013 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
00014
00015 #include "Math/GenVector/VectorUtil.h"
00016 #include <cmath>
00017
00018 using namespace edm;
00019 using namespace reco;
00020 using namespace std;
00021 using namespace l1extra ;
00022
00023 CaloTowerCreatorForTauHLT::CaloTowerCreatorForTauHLT( const ParameterSet & p )
00024 :
00025 mVerbose (p.getUntrackedParameter<int> ("verbose", 0)),
00026 mtowers (p.getParameter<InputTag> ("towers")),
00027 mCone (p.getParameter<double> ("UseTowersInCone")),
00028 mTauTrigger (p.getParameter<InputTag> ("TauTrigger")),
00029
00030 mEtThreshold (p.getParameter<double> ("minimumEt")),
00031 mEThreshold (p.getParameter<double> ("minimumE")),
00032 mTauId (p.getParameter<int> ("TauId"))
00033 {
00034 produces<CaloTowerCollection>();
00035 }
00036
00037 CaloTowerCreatorForTauHLT::~CaloTowerCreatorForTauHLT() {
00038 }
00039
00040 void CaloTowerCreatorForTauHLT::produce( Event& evt, const EventSetup& ) {
00041 edm::Handle<CaloTowerCollection> caloTowers;
00042 evt.getByLabel( mtowers, caloTowers );
00043
00044
00045 edm::Handle<L1JetParticleCollection> jetsgen;
00046 evt.getByLabel(mTauTrigger, jetsgen);
00047 std::auto_ptr<CaloTowerCollection> cands( new CaloTowerCollection );
00048 cands->reserve( caloTowers->size() );
00049
00050 int idTau =0;
00051 L1JetParticleCollection::const_iterator myL1Jet = jetsgen->begin();
00052 for(;myL1Jet != jetsgen->end();myL1Jet++)
00053 {
00054 if(idTau == mTauId)
00055 {
00056 double Sum08 = 0.;
00057
00058 unsigned idx = 0;
00059 for (; idx < caloTowers->size(); idx++) {
00060 const CaloTower* cal = &((*caloTowers) [idx]);
00061 if (mVerbose == 2) {
00062 std::cout << "CaloTowerCreatorForTauHLT::produce-> " << idx << " tower et/eta/phi/e: "
00063 << cal->et() << '/' << cal->eta() << '/' << cal->phi() << '/' << cal->energy() << " is...";
00064 }
00065 if (cal->et() >= mEtThreshold && cal->energy() >= mEThreshold ) {
00066 math::PtEtaPhiELorentzVector p( cal->et(), cal->eta(), cal->phi(), cal->energy() );
00067 double delta = ROOT::Math::VectorUtil::DeltaR((*myL1Jet).p4().Vect(), p);
00068
00069 if(delta < mCone) {
00070 Sum08 += cal->et();
00071 cands->push_back( *cal );
00072 }
00073 }
00074 else {
00075 if (mVerbose == 2) std::cout << "rejected " << std::endl;
00076 }
00077 }
00078
00079 }
00080 idTau++;
00081 }
00082
00083 evt.put( cands );
00084
00085 }