#include <EgammaHLTHybridClusterProducer.h>
Public Member Functions | |
EgammaHLTHybridClusterProducer (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~EgammaHLTHybridClusterProducer () | |
Private Member Functions | |
bool | counterExceeded () const |
Private Attributes | |
std::string | basicclusterCollection_ |
bool | doIsolated_ |
std::string | hitcollection_ |
edm::InputTag | hitproducer_ |
HybridClusterAlgo * | hybrid_p |
double | l1LowerThr_ |
double | l1LowerThrIgnoreIsolation_ |
edm::InputTag | l1TagIsolated_ |
edm::InputTag | l1TagNonIsolated_ |
double | l1UpperThr_ |
int | nEvt_ |
int | nMaxPrintout_ |
PositionCalc | posCalculator_ |
double | regionEtaMargin_ |
double | regionPhiMargin_ |
std::string | superclusterCollection_ |
Definition at line 19 of file EgammaHLTHybridClusterProducer.h.
EgammaHLTHybridClusterProducer::EgammaHLTHybridClusterProducer | ( | const edm::ParameterSet & | ps | ) |
Definition at line 50 of file EgammaHLTHybridClusterProducer.cc.
References basicclusterCollection_, doIsolated_, edm::ParameterSet::getParameter(), hitcollection_, hitproducer_, hybrid_p, l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, nEvt_, posCalculator_, regionEtaMargin_, regionPhiMargin_, and superclusterCollection_.
{ basicclusterCollection_ = ps.getParameter<std::string>("basicclusterCollection"); superclusterCollection_ = ps.getParameter<std::string>("superclusterCollection"); hitproducer_ = ps.getParameter<edm::InputTag>("ecalhitproducer"); hitcollection_ =ps.getParameter<std::string>("ecalhitcollection"); // L1 matching parameters l1TagIsolated_ = ps.getParameter< edm::InputTag > ("l1TagIsolated"); l1TagNonIsolated_ = ps.getParameter< edm::InputTag > ("l1TagNonIsolated"); doIsolated_ = ps.getParameter<bool>("doIsolated"); l1LowerThr_ = ps.getParameter<double> ("l1LowerThr"); l1UpperThr_ = ps.getParameter<double> ("l1UpperThr"); l1LowerThrIgnoreIsolation_ = ps.getParameter<double> ("l1LowerThrIgnoreIsolation"); regionEtaMargin_ = ps.getParameter<double>("regionEtaMargin"); regionPhiMargin_ = ps.getParameter<double>("regionPhiMargin"); // Parameters for the position calculation: posCalculator_ = PositionCalc( ps.getParameter<edm::ParameterSet>("posCalcParameters") ); const std::vector<std::string> flagnames = ps.getParameter<std::vector<std::string> >("RecHitFlagToBeExcluded"); const std::vector<int> flagsexcl= StringToEnumValue<EcalRecHit::Flags>(flagnames); const std::vector<std::string> severitynames = ps.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcluded"); const std::vector<int> severitiesexcl= StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynames); hybrid_p = new HybridClusterAlgo(ps.getParameter<double>("HybridBarrelSeedThr"), ps.getParameter<int>("step"), ps.getParameter<double>("ethresh"), ps.getParameter<double>("eseed"), ps.getParameter<double>("xi"), ps.getParameter<bool>("useEtForXi"), ps.getParameter<double>("ewing"), flagsexcl, posCalculator_, ps.getParameter<bool>("dynamicEThresh"), ps.getParameter<double>("eThreshA"), ps.getParameter<double>("eThreshB"), severitiesexcl, ps.getParameter<bool>("excludeFlagged") ); bool dynamicPhiRoad = ps.getParameter<bool>("dynamicPhiRoad"); if (dynamicPhiRoad) { edm::ParameterSet bremRecoveryPset = ps.getParameter<edm::ParameterSet>("bremRecoveryPset"); hybrid_p->setDynamicPhiRoad(bremRecoveryPset); } produces< reco::BasicClusterCollection >(basicclusterCollection_); produces< reco::SuperClusterCollection >(superclusterCollection_); nEvt_ = 0; }
EgammaHLTHybridClusterProducer::~EgammaHLTHybridClusterProducer | ( | ) |
Definition at line 119 of file EgammaHLTHybridClusterProducer.cc.
References hybrid_p.
{ delete hybrid_p; }
bool EgammaHLTHybridClusterProducer::counterExceeded | ( | ) | const [inline, private] |
Definition at line 56 of file EgammaHLTHybridClusterProducer.h.
References nEvt_, and nMaxPrintout_.
{ return ((nEvt_ > nMaxPrintout_) || (nMaxPrintout_ < 0));}
void EgammaHLTHybridClusterProducer::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
emItr->gctEmCand()->regionId().isForward()
emItr->gctEmCand()->regionId().isForward()
Implements edm::EDProducer.
Definition at line 125 of file EgammaHLTHybridClusterProducer.cc.
References basicclusterCollection_, doIsolated_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, geometry, edm::EventSetup::get(), edm::Event::getByLabel(), CaloGeometry::getSubdetectorGeometry(), hitcollection_, hitproducer_, hybrid_p, i, edm::HandleBase::isValid(), edm::OrphanHandleBase::isValid(), l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, edm::InputTag::label(), HybridClusterAlgo::makeClusters(), HybridClusterAlgo::makeSuperClusters(), nEvt_, edm::ESHandle< T >::product(), edm::Handle< T >::product(), edm::PtrVector< T >::push_back(), edm::Event::put(), regionEtaMargin_, regionPhiMargin_, and superclusterCollection_.
{ // get the hit collection from the event: edm::Handle<EcalRecHitCollection> rhcHandle; // evt.getByType(rhcHandle); evt.getByLabel(hitproducer_.label(), hitcollection_, rhcHandle); if (!(rhcHandle.isValid())) { edm::LogError("ProductNotFound")<< "could not get a handle on the EcalRecHitCollection!" << std::endl; return; } const EcalRecHitCollection *hit_collection = rhcHandle.product(); // get the collection geometry: edm::ESHandle<CaloGeometry> geoHandle; es.get<CaloGeometryRecord>().get(geoHandle); const CaloGeometry& geometry = *geoHandle; const CaloSubdetectorGeometry *geometry_p; std::auto_ptr<const CaloSubdetectorTopology> topology; //edm::ESHandle<EcalChannelStatus> chStatus; //es.get<EcalChannelStatusRcd>().get(chStatus); //const EcalChannelStatus* theEcalChStatus = chStatus.product(); edm::ESHandle<EcalSeverityLevelAlgo> sevlv; es.get<EcalSeverityLevelAlgoRcd>().get(sevlv); const EcalSeverityLevelAlgo* sevLevel = sevlv.product(); if(hitcollection_ == "EcalRecHitsEB") { geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); topology.reset(new EcalBarrelTopology(geoHandle)); } else if(hitcollection_ == "EcalRecHitsEE") { geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap); topology.reset(new EcalEndcapTopology(geoHandle)); } else if(hitcollection_ == "EcalRecHitsPS") { geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower); topology.reset(new EcalPreshowerTopology (geoHandle)); } else throw(std::runtime_error("\n\nHybrid Cluster Producer encountered invalied ecalhitcollection type.\n\n")); //Get the L1 EM Particle Collection //Get the L1 EM Particle Collection edm::Handle< l1extra::L1EmParticleCollection > emIsolColl ; if(doIsolated_) evt.getByLabel(l1TagIsolated_, emIsolColl); //Get the L1 EM Particle Collection edm::Handle< l1extra::L1EmParticleCollection > emNonIsolColl ; evt.getByLabel(l1TagNonIsolated_, emNonIsolColl); // Get the CaloGeometry edm::ESHandle<L1CaloGeometry> l1CaloGeom ; es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ; std::vector<EcalEtaPhiRegion> regions; if(doIsolated_) { for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end() ;++emItr ){ if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_ //&& ) { //bool isolated = emItr->gctEmCand()->isolated(); //if ((l1Isolated_ &&isolated) || (!l1Isolated_ &&!isolated)) { // Access the GCT hardware object corresponding to the L1Extra EM object. int etaIndex = emItr->gctEmCand()->etaIndex() ; int phiIndex = emItr->gctEmCand()->phiIndex() ; // Use the L1CaloGeometry to find the eta, phi bin boundaries. double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ; double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ; double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ; double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ; int isbarl=0; //Part of the region is in the barel if either the upper or lower //edge of the region is within the barrel if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) || ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1; etaLow -= regionEtaMargin_; etaHigh += regionEtaMargin_; phiLow -= regionPhiMargin_; phiHigh += regionPhiMargin_; if (etaHigh>1.479) etaHigh=1.479; if (etaLow<-1.479) etaLow=-1.479; if(isbarl) regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh)); } } } if(!doIsolated_||l1LowerThrIgnoreIsolation_<64) { for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end() ;++emItr ){ if(doIsolated_&&emItr->et()<l1LowerThrIgnoreIsolation_) continue; if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_ //&& ) { //bool isolated = emItr->gctEmCand()->isolated(); //if ((l1Isolated_ &&isolated) || (!l1Isolated_ &&!isolated)) { // Access the GCT hardware object corresponding to the L1Extra EM object. int etaIndex = emItr->gctEmCand()->etaIndex() ; int phiIndex = emItr->gctEmCand()->phiIndex() ; // Use the L1CaloGeometry to find the eta, phi bin boundaries. double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ; double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ; double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ; double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ; int isbarl=0; //Part of the region is in the barel if either the upper or lower //edge of the region is within the barrel if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) || ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1; etaLow -= regionEtaMargin_; etaHigh += regionEtaMargin_; phiLow -= regionPhiMargin_; phiHigh += regionPhiMargin_; if (etaHigh>1.479) etaHigh=1.479; if (etaLow<-1.479) etaLow=-1.479; if(isbarl) regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh)); } } } // make the Basic clusters! reco::BasicClusterCollection basicClusters; hybrid_p->makeClusters(hit_collection, geometry_p, basicClusters, sevLevel, true, regions); // create an auto_ptr to a BasicClusterCollection, copy the clusters into it and put in the Event: std::auto_ptr< reco::BasicClusterCollection > basicclusters_p(new reco::BasicClusterCollection); basicclusters_p->assign(basicClusters.begin(), basicClusters.end()); edm::OrphanHandle<reco::BasicClusterCollection> bccHandle = evt.put(basicclusters_p, basicclusterCollection_); //Basic clusters now in the event. //Weird though it is, get the BasicClusters back out of the event. We need the //edm::Ref to these guys to make our superclusters for Hybrid. // edm::Handle<reco::BasicClusterCollection> bccHandle; // evt.getByLabel("clusterproducer",basicclusterCollection_, bccHandle); if (!(bccHandle.isValid())) { return; } reco::BasicClusterCollection clusterCollection = *bccHandle; reco::CaloClusterPtrVector clusterRefVector; for (unsigned int i = 0; i < clusterCollection.size(); i++){ clusterRefVector.push_back(reco::CaloClusterPtr(bccHandle, i)); } reco::SuperClusterCollection superClusters = hybrid_p->makeSuperClusters(clusterRefVector); std::auto_ptr< reco::SuperClusterCollection > superclusters_p(new reco::SuperClusterCollection); superclusters_p->assign(superClusters.begin(), superClusters.end()); evt.put(superclusters_p, superclusterCollection_); nEvt_++; }
std::string EgammaHLTHybridClusterProducer::basicclusterCollection_ [private] |
Definition at line 37 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
bool EgammaHLTHybridClusterProducer::doIsolated_ [private] |
Definition at line 35 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
std::string EgammaHLTHybridClusterProducer::hitcollection_ [private] |
Definition at line 40 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
Definition at line 39 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
Definition at line 53 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), produce(), and ~EgammaHLTHybridClusterProducer().
double EgammaHLTHybridClusterProducer::l1LowerThr_ [private] |
Definition at line 45 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
double EgammaHLTHybridClusterProducer::l1LowerThrIgnoreIsolation_ [private] |
Definition at line 47 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
Definition at line 42 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
Definition at line 43 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
double EgammaHLTHybridClusterProducer::l1UpperThr_ [private] |
Definition at line 46 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
int EgammaHLTHybridClusterProducer::nEvt_ [private] |
Definition at line 33 of file EgammaHLTHybridClusterProducer.h.
Referenced by counterExceeded(), EgammaHLTHybridClusterProducer(), and produce().
int EgammaHLTHybridClusterProducer::nMaxPrintout_ [private] |
Definition at line 32 of file EgammaHLTHybridClusterProducer.h.
Referenced by counterExceeded().
Definition at line 54 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer().
double EgammaHLTHybridClusterProducer::regionEtaMargin_ [private] |
Definition at line 49 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
double EgammaHLTHybridClusterProducer::regionPhiMargin_ [private] |
Definition at line 50 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().
std::string EgammaHLTHybridClusterProducer::superclusterCollection_ [private] |
Definition at line 38 of file EgammaHLTHybridClusterProducer.h.
Referenced by EgammaHLTHybridClusterProducer(), and produce().