#include <L2TauIsolationProducer.h>
Public Member Functions | |
L2TauIsolationProducer (const edm::ParameterSet &) | |
~L2TauIsolationProducer () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
math::PtEtaPhiELorentzVectorCollection | getECALHits (const reco::CaloJet &, const edm::Event &, const edm::EventSetup &iSetup) |
math::PtEtaPhiELorentzVectorCollection | getHCALHits (const reco::CaloJet &) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
double | crystalThreshold_ |
edm::InputTag | EBRecHits_ |
double | ECALClustering_clusterRadius_ |
bool | ECALClustering_run_ |
double | ECALIsolation_innerCone_ |
double | ECALIsolation_outerCone_ |
bool | ECALIsolation_run_ |
edm::InputTag | EERecHits_ |
edm::InputTag | l2CaloJets_ |
double | TowerIsolation_innerCone_ |
double | TowerIsolation_outerCone_ |
bool | TowerIsolation_run_ |
double | towerThreshold_ |
Definition at line 53 of file L2TauIsolationProducer.h.
L2TauIsolationProducer::L2TauIsolationProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 8 of file L2TauIsolationProducer.cc.
References ECALClustering_clusterRadius_, ECALClustering_run_, ECALIsolation_innerCone_, ECALIsolation_outerCone_, ECALIsolation_run_, edm::ParameterSet::getParameter(), TowerIsolation_innerCone_, TowerIsolation_outerCone_, and TowerIsolation_run_.
: l2CaloJets_(iConfig.getParameter<edm::InputTag>("L2TauJetCollection")), EBRecHits_(iConfig.getParameter<edm::InputTag>("EBRecHits")), EERecHits_(iConfig.getParameter<edm::InputTag>("EERecHits")), crystalThreshold_(iConfig.getParameter<double>("crystalThreshold")), towerThreshold_(iConfig.getParameter<double>("towerThreshold")) { //ECAL Isolation edm::ParameterSet ECALIsolParams = iConfig.getParameter<edm::ParameterSet>("ECALIsolation") ; ECALIsolation_innerCone_ = ECALIsolParams.getParameter<double>( "innerCone" ); ECALIsolation_outerCone_ = ECALIsolParams.getParameter<double>( "outerCone" ); ECALIsolation_run_ = ECALIsolParams.getParameter<bool>( "runAlgorithm" ); //ECAL Clustering edm::ParameterSet ECALClusterParams = iConfig.getParameter<edm::ParameterSet>("ECALClustering") ; ECALClustering_run_ = ECALClusterParams.getParameter<bool>( "runAlgorithm" ); ECALClustering_clusterRadius_ = ECALClusterParams.getParameter<double>( "clusterRadius" ); //Tower Isolation edm::ParameterSet TowerIsolParams = iConfig.getParameter<edm::ParameterSet>("TowerIsolation") ; TowerIsolation_innerCone_ = TowerIsolParams.getParameter<double>( "innerCone" ); TowerIsolation_outerCone_ = TowerIsolParams.getParameter<double>( "outerCone" ); TowerIsolation_run_ = TowerIsolParams.getParameter<bool>( "runAlgorithm" ); //Add the products produces<L2TauInfoAssociation>(); }
L2TauIsolationProducer::~L2TauIsolationProducer | ( | ) |
Definition at line 44 of file L2TauIsolationProducer.cc.
{
//Destruction
}
void L2TauIsolationProducer::beginJob | ( | void | ) | [private, virtual] |
void L2TauIsolationProducer::endJob | ( | void | ) | [private, virtual] |
math::PtEtaPhiELorentzVectorCollection L2TauIsolationProducer::getECALHits | ( | const reco::CaloJet & | jet, |
const edm::Event & | iEvent, | ||
const edm::EventSetup & | iSetup | ||
) | [private] |
Definition at line 154 of file L2TauIsolationProducer.cc.
References prof2calltree::count, crystalThreshold_, DetId::det(), egHLT::errCodes::EBRecHits, EBRecHits_, DetId::Ecal, EcalBarrel, EcalEndcap, egHLT::errCodes::EERecHits, EERecHits_, relval_parameters_module::energy, eta(), PV3DBase< T, PVType, FrameType >::eta(), geometry, edm::EventSetup::get(), edm::Event::getByLabel(), reco::CaloJet::getCaloConstituents(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), j, M_PI, AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::phi(), phi, funct::sin(), DetId::subdetId(), std::swap(), theta(), and PV3DBase< T, PVType, FrameType >::theta().
Referenced by produce().
{ //Init Geometry edm::ESHandle<CaloGeometry> geometry; iSetup.get<CaloGeometryRecord>().get(geometry); //Create ECAL Geometry const CaloSubdetectorGeometry* EB = geometry->getSubdetectorGeometry(DetId::Ecal,EcalBarrel); const CaloSubdetectorGeometry* EE = geometry->getSubdetectorGeometry(DetId::Ecal,EcalEndcap); //Handle To the ECAL edm::Handle<EBRecHitCollection> EBRecHits; edm::Handle<EERecHitCollection> EERecHits; //Read From File iEvent.getByLabel( EBRecHits_, EBRecHits ); iEvent.getByLabel( EERecHits_, EERecHits ); //Create a container for the hits math::PtEtaPhiELorentzVectorCollection jetRecHits; //Create the Machinery to put the highest et crystal at the begining double ref_pt = 0.;//max et int ref_id=0; //id of the max element int count=0; //counter //Code Copied from JetCrystalsAssociator const std::vector<CaloTowerPtr> myTowers=jet.getCaloConstituents(); for (unsigned int iTower = 0; iTower < myTowers.size(); iTower++) { CaloTowerPtr theTower = myTowers[iTower]; size_t numRecHits = theTower->constituentsSize(); // access CaloRecHits for (size_t j = 0; j < numRecHits; j++) { DetId RecHitDetID=theTower->constituent(j); DetId::Detector DetNum=RecHitDetID.det(); if( DetNum == DetId::Ecal ){ int EcalNum = RecHitDetID.subdetId(); if( EcalNum == 1 ){ EBDetId EcalID = RecHitDetID; EBRecHitCollection::const_iterator theRecHit=EBRecHits->find(EcalID); if(theRecHit != EBRecHits->end()){ DetId id = theRecHit->detid(); const CaloCellGeometry* this_cell = EB->getGeometry(id); if (this_cell) { GlobalPoint posi = this_cell->getPosition(); double energy = theRecHit->energy(); double eta = posi.eta(); double phi = posi.phi(); double theta = posi.theta(); if(theta > M_PI) theta = 2 * M_PI- theta; double et = energy * sin(theta); //Apply Thresholds Here math::PtEtaPhiELorentzVector p(et, eta, phi, energy); if(p.pt()>crystalThreshold_) { if(p.pt()>ref_pt) { ref_id=count; ref_pt = p.pt(); } jetRecHits.push_back(p); count++; } } } } else if ( EcalNum == 2 ) { EEDetId EcalID = RecHitDetID; EERecHitCollection::const_iterator theRecHit=EERecHits->find(EcalID); if(theRecHit != EBRecHits->end()){ DetId id = theRecHit->detid(); const CaloCellGeometry* this_cell = EE->getGeometry(id); if (this_cell) { GlobalPoint posi = this_cell->getPosition(); double energy = theRecHit->energy(); double eta = posi.eta(); double phi = posi.phi(); double theta = posi.theta(); if (theta > M_PI) theta = 2 * M_PI - theta; double et = energy * sin(theta); // std::cout <<"Et "<<et<<std::endl; math::PtEtaPhiELorentzVector p(et, eta, phi, energy); if(p.pt()>crystalThreshold_) { if(p.pt()>ref_pt) { ref_id=count; ref_pt = p.pt(); } jetRecHits.push_back(p); count++; } } } } } } } //bring it to the front if(jetRecHits.size()>0) std::swap(jetRecHits[ref_id],jetRecHits[0]); return jetRecHits; }
math::PtEtaPhiELorentzVectorCollection L2TauIsolationProducer::getHCALHits | ( | const reco::CaloJet & | jet | ) | [private] |
Definition at line 134 of file L2TauIsolationProducer.cc.
References relval_parameters_module::energy, reco::CaloJet::getCaloConstituents(), i, and towerThreshold_.
Referenced by produce().
{ std::vector<CaloTowerPtr> towers = jet.getCaloConstituents(); math::PtEtaPhiELorentzVectorCollection towers2; for(size_t i=0;i<towers.size();++i) if(towers[i]->energy()>towerThreshold_) towers2.push_back(math::PtEtaPhiELorentzVector(towers[i]->et(),towers[i]->eta(),towers[i]->phi(),towers[i]->energy())); return towers2; }
void L2TauIsolationProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 53 of file L2TauIsolationProducer.cc.
References L2TauSimpleClustering::clusterize(), L2TauIsolationAlgs::clusterShape(), ECALClustering_clusterRadius_, ECALClustering_run_, ECALIsolation_innerCone_, ECALIsolation_outerCone_, ECALIsolation_run_, edm::Event::getByLabel(), getECALHits(), getHCALHits(), spr::hitsHCAL(), info, L2TauIsolationAlgs::isolatedEt(), l2CaloJets_, edm::Event::put(), reco::L2TauIsolationInfo::setEcalClusterShape(), reco::L2TauIsolationInfo::setEcalIsolEt(), reco::L2TauIsolationInfo::setHcalIsolEt(), reco::L2TauIsolationInfo::setNEcalHits(), reco::L2TauIsolationInfo::setSeedEcalHitEt(), reco::L2TauIsolationInfo::setSeedHcalHitEt(), TowerIsolation_innerCone_, TowerIsolation_outerCone_, and TowerIsolation_run_.
{ edm::Handle<CaloJetCollection> l2CaloJets; //Handle to the input (L2TauCaloJets); iEvent.getByLabel(l2CaloJets_ ,l2CaloJets);//get the handle //Create the Association std::auto_ptr<L2TauInfoAssociation> l2InfoAssoc( new L2TauInfoAssociation); //If the JetCrystalsAssociation exists -> RUN The Producer if(l2CaloJets->size()>0) { CaloJetCollection::const_iterator jcStart = l2CaloJets->begin(); //Loop on Jets for(CaloJetCollection::const_iterator jc = jcStart ;jc!=l2CaloJets->end();++jc) { //Create Algorithm Object L2TauIsolationAlgs alg; //Create Info Object L2TauIsolationInfo info; //get Hits math::PtEtaPhiELorentzVectorCollection hitsECAL = getECALHits(*jc,iEvent,iSetup); math::PtEtaPhiELorentzVectorCollection hitsHCAL = getHCALHits(*jc); //Run ECALIsolation if(ECALIsolation_run_) { info.setEcalIsolEt( alg.isolatedEt(hitsECAL , jc->p4().Vect(), ECALIsolation_innerCone_,ECALIsolation_outerCone_) ); if(hitsECAL.size()>0) info.setSeedEcalHitEt(hitsECAL[0].pt()); } //Run ECALClustering if(ECALClustering_run_) { //load simple clustering algorithm L2TauSimpleClustering clustering(ECALClustering_clusterRadius_); math::PtEtaPhiELorentzVectorCollection clusters = clustering.clusterize(hitsECAL); info.setEcalClusterShape(alg.clusterShape(clusters,jc->p4().Vect(),0,0.5) ); info.setNEcalHits(clusters.size()); } //Run CaloTower Isolation if(TowerIsolation_run_) { info.setHcalIsolEt( alg.isolatedEt(hitsHCAL , jc->p4().Vect(), TowerIsolation_innerCone_,TowerIsolation_outerCone_) ); if(hitsHCAL.size()>0) info.setSeedHcalHitEt(hitsHCAL[0].pt()); } //Store the info Class edm::Ref<CaloJetCollection> jcRef(l2CaloJets,jc-jcStart); l2InfoAssoc->insert(jcRef, info); } } //end of if(*jetCrystalsObj) iEvent.put(l2InfoAssoc); }
double L2TauIsolationProducer::crystalThreshold_ [private] |
Definition at line 74 of file L2TauIsolationProducer.h.
Referenced by getECALHits().
Definition at line 69 of file L2TauIsolationProducer.h.
Referenced by getECALHits().
double L2TauIsolationProducer::ECALClustering_clusterRadius_ [private] |
Definition at line 94 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
bool L2TauIsolationProducer::ECALClustering_run_ [private] |
Definition at line 93 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
double L2TauIsolationProducer::ECALIsolation_innerCone_ [private] |
Definition at line 83 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
double L2TauIsolationProducer::ECALIsolation_outerCone_ [private] |
Definition at line 84 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
bool L2TauIsolationProducer::ECALIsolation_run_ [private] |
Definition at line 81 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
Definition at line 70 of file L2TauIsolationProducer.h.
Referenced by getECALHits().
Definition at line 68 of file L2TauIsolationProducer.h.
Referenced by produce().
double L2TauIsolationProducer::TowerIsolation_innerCone_ [private] |
Definition at line 89 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
double L2TauIsolationProducer::TowerIsolation_outerCone_ [private] |
Definition at line 90 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
bool L2TauIsolationProducer::TowerIsolation_run_ [private] |
Definition at line 87 of file L2TauIsolationProducer.h.
Referenced by L2TauIsolationProducer(), and produce().
double L2TauIsolationProducer::towerThreshold_ [private] |
Definition at line 75 of file L2TauIsolationProducer.h.
Referenced by getHCALHits().