#include <HybridClusterProducer.h>
Public Member Functions | |
HybridClusterProducer (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~HybridClusterProducer () | |
Private Member Functions | |
bool | counterExceeded () const |
Private Attributes | |
std::string | basicclusterCollection_ |
HybridClusterAlgo::DebugLevel | debugL |
std::string | hitcollection_ |
std::string | hitproducer_ |
HybridClusterAlgo * | hybrid_p |
int | nEvt_ |
int | nMaxPrintout_ |
PositionCalc | posCalculator_ |
std::string | superclusterCollection_ |
Definition at line 19 of file HybridClusterProducer.h.
HybridClusterProducer::HybridClusterProducer | ( | const edm::ParameterSet & | ps | ) |
Definition at line 39 of file HybridClusterProducer.cc.
References basicclusterCollection_, debugL, edm::ParameterSet::getParameter(), hitcollection_, hitproducer_, hybrid_p, nEvt_, HybridClusterAlgo::pDEBUG, HybridClusterAlgo::pERROR, HybridClusterAlgo::pINFO, posCalculator_, HybridClusterAlgo::setDynamicPhiRoad(), and superclusterCollection_.
{ // The debug level std::string debugString = ps.getParameter<std::string>("debugLevel"); if (debugString == "DEBUG") debugL = HybridClusterAlgo::pDEBUG; else if (debugString == "INFO") debugL = HybridClusterAlgo::pINFO; else debugL = HybridClusterAlgo::pERROR; basicclusterCollection_ = ps.getParameter<std::string>("basicclusterCollection"); superclusterCollection_ = ps.getParameter<std::string>("superclusterCollection"); hitproducer_ = ps.getParameter<std::string>("ecalhitproducer"); hitcollection_ =ps.getParameter<std::string>("ecalhitcollection"); //Setup for core tools objects. edm::ParameterSet posCalcParameters = ps.getParameter<edm::ParameterSet>("posCalcParameters"); posCalculator_ = PositionCalc(posCalcParameters); hybrid_p = new HybridClusterAlgo(ps.getParameter<double>("HybridBarrelSeedThr"), ps.getParameter<int>("step"), ps.getParameter<double>("ethresh"), ps.getParameter<double>("eseed"), ps.getParameter<double>("ewing"), ps.getParameter<std::vector<int> >("RecHitFlagToBeExcluded"), posCalculator_, debugL, ps.getParameter<bool>("dynamicEThresh"), ps.getParameter<double>("eThreshA"), ps.getParameter<double>("eThreshB"), ps.getParameter<std::vector<int> >("RecHitSeverityToBeExcluded"), //ps.getParameter<double>("severityRecHitThreshold"), //ps.getParameter<int>("severitySpikeId"), //ps.getParameter<double>("severitySpikeThreshold"), ps.getParameter<bool>("excludeFlagged") ); //bremRecoveryPset, // get brem recovery parameters 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; }
HybridClusterProducer::~HybridClusterProducer | ( | ) |
bool HybridClusterProducer::counterExceeded | ( | ) | const [inline, private] |
Definition at line 44 of file HybridClusterProducer.h.
References nEvt_, and nMaxPrintout_.
{ return ((nEvt_ > nMaxPrintout_) || (nMaxPrintout_ < 0));}
void HybridClusterProducer::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 97 of file HybridClusterProducer.cc.
References basicclusterCollection_, gather_cfg::cout, debugL, 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(), HybridClusterAlgo::makeClusters(), HybridClusterAlgo::makeSuperClusters(), nEvt_, HybridClusterAlgo::pDEBUG, HybridClusterAlgo::pINFO, edm::ESHandle< T >::product(), edm::Handle< T >::product(), edm::PtrVector< T >::push_back(), edm::Event::put(), and superclusterCollection_.
{ // get the hit collection from the event: edm::Handle<EcalRecHitCollection> rhcHandle; // evt.getByType(rhcHandle); evt.getByLabel(hitproducer_, hitcollection_, rhcHandle); if (!(rhcHandle.isValid())) { if (debugL <= HybridClusterAlgo::pINFO) std::cout << "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<EcalSeverityLevelAlgo> sevLv; es.get<EcalSeverityLevelAlgoRcd>().get(sevLv); if (debugL == HybridClusterAlgo::pDEBUG) std::cout << "\n\n\n" << hitcollection_ << "\n\n" << std::endl; 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")); // make the Basic clusters! reco::BasicClusterCollection basicClusters; hybrid_p->makeClusters(hit_collection, geometry_p, basicClusters, sevLv.product(),false, std::vector<EcalEtaPhiRegion>()); if (debugL == HybridClusterAlgo::pDEBUG) std::cout << "Finished clustering - BasicClusterCollection returned to producer..." << std::endl; // 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. if (debugL == HybridClusterAlgo::pDEBUG) std::cout << "Basic Clusters now put into event." << std::endl; //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())) { if (debugL <= HybridClusterAlgo::pINFO) std::cout << "could not get a handle on the BasicClusterCollection!" << std::endl; return; } reco::BasicClusterCollection clusterCollection = *bccHandle; if (debugL == HybridClusterAlgo::pDEBUG) std::cout << "Got the BasicClusterCollection" << std::endl; reco::CaloClusterPtrVector clusterPtrVector; for (unsigned int i = 0; i < clusterCollection.size(); i++){ clusterPtrVector.push_back(reco::CaloClusterPtr(bccHandle, i)); } reco::SuperClusterCollection superClusters = hybrid_p->makeSuperClusters(clusterPtrVector); if (debugL == HybridClusterAlgo::pDEBUG) std::cout << "Found: " << superClusters.size() << " superclusters." << std::endl; std::auto_ptr< reco::SuperClusterCollection > superclusters_p(new reco::SuperClusterCollection); superclusters_p->assign(superClusters.begin(), superClusters.end()); evt.put(superclusters_p, superclusterCollection_); if (debugL == HybridClusterAlgo::pDEBUG) std::cout << "Hybrid Clusters (Basic/Super) added to the Event! :-)" << std::endl; nEvt_++; }
std::string HybridClusterProducer::basicclusterCollection_ [private] |
Definition at line 34 of file HybridClusterProducer.h.
Referenced by HybridClusterProducer(), and produce().
Definition at line 39 of file HybridClusterProducer.h.
Referenced by HybridClusterProducer(), and produce().
std::string HybridClusterProducer::hitcollection_ [private] |
Definition at line 37 of file HybridClusterProducer.h.
Referenced by HybridClusterProducer(), and produce().
std::string HybridClusterProducer::hitproducer_ [private] |
Definition at line 36 of file HybridClusterProducer.h.
Referenced by HybridClusterProducer(), and produce().
HybridClusterAlgo* HybridClusterProducer::hybrid_p [private] |
Definition at line 41 of file HybridClusterProducer.h.
Referenced by HybridClusterProducer(), produce(), and ~HybridClusterProducer().
int HybridClusterProducer::nEvt_ [private] |
Definition at line 32 of file HybridClusterProducer.h.
Referenced by counterExceeded(), HybridClusterProducer(), and produce().
int HybridClusterProducer::nMaxPrintout_ [private] |
Definition at line 31 of file HybridClusterProducer.h.
Referenced by counterExceeded().
Definition at line 42 of file HybridClusterProducer.h.
Referenced by HybridClusterProducer().
std::string HybridClusterProducer::superclusterCollection_ [private] |
Definition at line 35 of file HybridClusterProducer.h.
Referenced by HybridClusterProducer(), and produce().