#include <IslandClusterProducer.h>
Definition at line 26 of file IslandClusterProducer.h.
IslandClusterProducer::IslandClusterProducer | ( | const edm::ParameterSet & | ps | ) |
Definition at line 40 of file IslandClusterProducer.cc.
References barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, clustershapecollectionEB_, clustershapecollectionEE_, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, edm::ParameterSet::getParameter(), island_p, nEvt_, IslandClusterAlgo::pDEBUG, IslandClusterAlgo::pERROR, IslandClusterAlgo::pINFO, posCalculator_, IslandClusterAlgo::pWARNING, shapeAlgo_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.
{ // The verbosity level std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel"); if (verbosityString == "DEBUG") verbosity = IslandClusterAlgo::pDEBUG; else if (verbosityString == "WARNING") verbosity = IslandClusterAlgo::pWARNING; else if (verbosityString == "INFO") verbosity = IslandClusterAlgo::pINFO; else verbosity = IslandClusterAlgo::pERROR; // Parameters to identify the hit collections barrelHitProducer_ = ps.getParameter<std::string>("barrelHitProducer"); endcapHitProducer_ = ps.getParameter<std::string>("endcapHitProducer"); barrelHitCollection_ = ps.getParameter<std::string>("barrelHitCollection"); endcapHitCollection_ = ps.getParameter<std::string>("endcapHitCollection"); // The names of the produced cluster collections barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection"); endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection"); // Island algorithm parameters double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr"); double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr"); // Parameters for the position calculation: edm::ParameterSet posCalcParameters = ps.getParameter<edm::ParameterSet>("posCalcParameters"); posCalculator_ = PositionCalc(posCalcParameters); shapeAlgo_ = ClusterShapeAlgo(posCalcParameters); clustershapecollectionEB_ = ps.getParameter<std::string>("clustershapecollectionEB"); clustershapecollectionEE_ = ps.getParameter<std::string>("clustershapecollectionEE"); //AssociationMap barrelClusterShapeAssociation_ = ps.getParameter<std::string>("barrelShapeAssociation"); endcapClusterShapeAssociation_ = ps.getParameter<std::string>("endcapShapeAssociation"); // Produces a collection of barrel and a collection of endcap clusters produces< reco::ClusterShapeCollection>(clustershapecollectionEE_); produces< reco::BasicClusterCollection >(endcapClusterCollection_); produces< reco::ClusterShapeCollection>(clustershapecollectionEB_); produces< reco::BasicClusterCollection >(barrelClusterCollection_); produces< reco::BasicClusterShapeAssociationCollection >(barrelClusterShapeAssociation_); produces< reco::BasicClusterShapeAssociationCollection >(endcapClusterShapeAssociation_); island_p = new IslandClusterAlgo(barrelSeedThreshold, endcapSeedThreshold, posCalculator_,verbosity); nEvt_ = 0; }
IslandClusterProducer::~IslandClusterProducer | ( | ) |
void IslandClusterProducer::clusterizeECALPart | ( | edm::Event & | evt, |
const edm::EventSetup & | es, | ||
const std::string & | hitProducer, | ||
const std::string & | hitCollection, | ||
const std::string & | clusterCollection, | ||
const std::string & | clusterShapeAssociation, | ||
const IslandClusterAlgo::EcalPart & | ecalPart | ||
) | [private] |
Definition at line 121 of file IslandClusterProducer.cc.
References IslandClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), i, island_p, IslandClusterAlgo::makeClusters(), edm::Event::put(), shapeAlgo_, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by produce().
{ // get the hit collection from the event: const EcalRecHitCollection *hitCollection_p = getCollection(evt, hitProducer, hitCollection); // get the geometry and topology from the event setup: edm::ESHandle<CaloGeometry> geoHandle; es.get<CaloGeometryRecord>().get(geoHandle); const CaloSubdetectorGeometry *geometry_p; CaloSubdetectorTopology *topology_p; std::string clustershapetag; if (ecalPart == IslandClusterAlgo::barrel) { geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); topology_p = new EcalBarrelTopology(geoHandle); } else { geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap); topology_p = new EcalEndcapTopology(geoHandle); } const CaloSubdetectorGeometry *geometryES_p; geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); // Run the clusterization algorithm: reco::BasicClusterCollection clusters; clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p, geometryES_p, ecalPart); //Create associated ClusterShape objects. std::vector <reco::ClusterShape> ClusVec; for (int erg=0;erg<int(clusters.size());++erg){ reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg],hitCollection_p,geometry_p,topology_p); ClusVec.push_back(TestShape); } //Put clustershapes in event, but retain a Handle on them. std::auto_ptr< reco::ClusterShapeCollection> clustersshapes_p(new reco::ClusterShapeCollection); clustersshapes_p->assign(ClusVec.begin(), ClusVec.end()); edm::OrphanHandle<reco::ClusterShapeCollection> clusHandle; if (ecalPart == IslandClusterAlgo::barrel) clusHandle= evt.put(clustersshapes_p, clustershapecollectionEB_); else clusHandle= evt.put(clustersshapes_p, clustershapecollectionEE_); // create an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event: std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection); clusters_p->assign(clusters.begin(), clusters.end()); edm::OrphanHandle<reco::BasicClusterCollection> bccHandle; if (ecalPart == IslandClusterAlgo::barrel) bccHandle = evt.put(clusters_p, barrelClusterCollection_); else bccHandle = evt.put(clusters_p, endcapClusterCollection_); // BasicClusterShapeAssociationMap std::auto_ptr<reco::BasicClusterShapeAssociationCollection> shapeAssocs_p(new reco::BasicClusterShapeAssociationCollection); for (unsigned int i = 0; i < clusHandle->size(); i++){ shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle,i),edm::Ref<reco::ClusterShapeCollection>(clusHandle,i)); } evt.put(shapeAssocs_p,clusterShapeAssociation); delete topology_p; }
bool IslandClusterProducer::counterExceeded | ( | ) | const [inline, private] |
Definition at line 62 of file IslandClusterProducer.h.
References nEvt_, and nMaxPrintout_.
{ return ((nEvt_ > nMaxPrintout_) || (nMaxPrintout_ < 0)); }
const EcalRecHitCollection * IslandClusterProducer::getCollection | ( | edm::Event & | evt, |
const std::string & | hitProducer_, | ||
const std::string & | hitCollection_ | ||
) | [private] |
Definition at line 105 of file IslandClusterProducer.cc.
References gather_cfg::cout, edm::Event::getByLabel(), edm::HandleBase::isValid(), and edm::Handle< T >::product().
Referenced by clusterizeECALPart().
{ edm::Handle<EcalRecHitCollection> rhcHandle; evt.getByLabel(hitProducer_, hitCollection_, rhcHandle); if (!(rhcHandle.isValid())) { std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl; edm::LogError("IslandClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ; return 0; } else { return rhcHandle.product(); } }
void IslandClusterProducer::outputValidationInfo | ( | reco::CaloClusterPtrVector & | clusterPtrVector | ) | [private] |
void IslandClusterProducer::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 97 of file IslandClusterProducer.cc.
References IslandClusterAlgo::barrel, barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, clusterizeECALPart(), IslandClusterAlgo::endcap, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, and nEvt_.
{ clusterizeECALPart(evt, es, endcapHitProducer_, endcapHitCollection_, endcapClusterCollection_, endcapClusterShapeAssociation_, IslandClusterAlgo::endcap); clusterizeECALPart(evt, es, barrelHitProducer_, barrelHitCollection_, barrelClusterCollection_, barrelClusterShapeAssociation_, IslandClusterAlgo::barrel); nEvt_++; }
std::string IslandClusterProducer::barrelClusterCollection_ [private] |
Definition at line 48 of file IslandClusterProducer.h.
Referenced by clusterizeECALPart(), IslandClusterProducer(), and produce().
std::string IslandClusterProducer::barrelClusterShapeAssociation_ [private] |
Definition at line 55 of file IslandClusterProducer.h.
Referenced by IslandClusterProducer(), and produce().
std::string IslandClusterProducer::barrelHitCollection_ [private] |
Definition at line 45 of file IslandClusterProducer.h.
Referenced by IslandClusterProducer(), and produce().
std::string IslandClusterProducer::barrelHitProducer_ [private] |
Definition at line 43 of file IslandClusterProducer.h.
Referenced by IslandClusterProducer(), and produce().
std::string IslandClusterProducer::clustershapecollectionEB_ [private] |
Definition at line 51 of file IslandClusterProducer.h.
Referenced by clusterizeECALPart(), and IslandClusterProducer().
std::string IslandClusterProducer::clustershapecollectionEE_ [private] |
Definition at line 52 of file IslandClusterProducer.h.
Referenced by clusterizeECALPart(), and IslandClusterProducer().
std::string IslandClusterProducer::endcapClusterCollection_ [private] |
Definition at line 49 of file IslandClusterProducer.h.
Referenced by clusterizeECALPart(), IslandClusterProducer(), and produce().
std::string IslandClusterProducer::endcapClusterShapeAssociation_ [private] |
Definition at line 56 of file IslandClusterProducer.h.
Referenced by IslandClusterProducer(), and produce().
std::string IslandClusterProducer::endcapHitCollection_ [private] |
Definition at line 46 of file IslandClusterProducer.h.
Referenced by IslandClusterProducer(), and produce().
std::string IslandClusterProducer::endcapHitProducer_ [private] |
Definition at line 44 of file IslandClusterProducer.h.
Referenced by IslandClusterProducer(), and produce().
IslandClusterAlgo* IslandClusterProducer::island_p [private] |
Definition at line 60 of file IslandClusterProducer.h.
Referenced by clusterizeECALPart(), IslandClusterProducer(), and ~IslandClusterProducer().
int IslandClusterProducer::nEvt_ [private] |
Definition at line 39 of file IslandClusterProducer.h.
Referenced by counterExceeded(), IslandClusterProducer(), and produce().
int IslandClusterProducer::nMaxPrintout_ [private] |
Definition at line 38 of file IslandClusterProducer.h.
Referenced by counterExceeded().
Definition at line 58 of file IslandClusterProducer.h.
Referenced by IslandClusterProducer().
Definition at line 59 of file IslandClusterProducer.h.
Referenced by clusterizeECALPart(), and IslandClusterProducer().
Definition at line 41 of file IslandClusterProducer.h.
Referenced by IslandClusterProducer().