#include <CosmicClusterProducer.h>
Public Member Functions | |
CosmicClusterProducer (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~CosmicClusterProducer () | |
Private Member Functions | |
void | clusterizeECALPart (edm::Event &evt, const edm::EventSetup &es, const std::string &hitProducer, const std::string &hitCollection, const std::string &uhitProducer, const std::string &uhitCollection, const std::string &clusterCollection, const std::string &clusterShapeAssociation, const CosmicClusterAlgo::EcalPart &ecalPart) |
bool | counterExceeded () const |
const EcalRecHitCollection * | getCollection (edm::Event &evt, const std::string &hitProducer_, const std::string &hitCollection_) |
const EcalUncalibratedRecHitCollection * | getUCollection (edm::Event &evt, const std::string &hitProducer_, const std::string &hitCollection_) |
void | outputValidationInfo (reco::CaloClusterPtrVector &clusterPtrVector) |
Private Attributes | |
std::string | barrelClusterCollection_ |
std::string | barrelClusterShapeAssociation_ |
std::string | barrelHitCollection_ |
std::string | barrelHitProducer_ |
std::string | barrelUHitCollection_ |
std::string | barrelUHitProducer_ |
std::string | clustershapecollectionEB_ |
std::string | clustershapecollectionEE_ |
std::string | endcapClusterCollection_ |
std::string | endcapClusterShapeAssociation_ |
std::string | endcapHitCollection_ |
std::string | endcapHitProducer_ |
std::string | endcapUHitCollection_ |
std::string | endcapUHitProducer_ |
CosmicClusterAlgo * | island_p |
int | nEvt_ |
int | nMaxPrintout_ |
PositionCalc | posCalculator_ |
ClusterShapeAlgo | shapeAlgo_ |
CosmicClusterAlgo::VerbosityLevel | verbosity |
Definition at line 27 of file CosmicClusterProducer.h.
CosmicClusterProducer::CosmicClusterProducer | ( | const edm::ParameterSet & | ps | ) |
Definition at line 39 of file CosmicClusterProducer.cc.
References barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, barrelUHitCollection_, barrelUHitProducer_, clustershapecollectionEB_, clustershapecollectionEE_, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, endcapUHitCollection_, endcapUHitProducer_, edm::ParameterSet::getParameter(), island_p, nEvt_, CosmicClusterAlgo::pDEBUG, CosmicClusterAlgo::pERROR, CosmicClusterAlgo::pINFO, posCalculator_, CosmicClusterAlgo::pWARNING, shapeAlgo_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.
{ // The verbosity level std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel"); if (verbosityString == "DEBUG") verbosity = CosmicClusterAlgo::pDEBUG; else if (verbosityString == "WARNING") verbosity = CosmicClusterAlgo::pWARNING; else if (verbosityString == "INFO") verbosity = CosmicClusterAlgo::pINFO; else verbosity = CosmicClusterAlgo::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"); barrelUHitProducer_ = ps.getParameter<std::string>("barrelUnHitProducer"); endcapUHitProducer_ = ps.getParameter<std::string>("endcapUnHitProducer"); barrelUHitCollection_ = ps.getParameter<std::string>("barrelUnHitCollection"); endcapUHitCollection_ = ps.getParameter<std::string>("endcapUnHitCollection"); // 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>("BarrelSeedThr"); double barrelSingleThreshold = ps.getParameter<double>("BarrelSingleThr"); double barrelSecondThreshold = ps.getParameter<double>("BarrelSecondThr"); double barrelSupThreshold = ps.getParameter<double>("BarrelSupThr"); double endcapSeedThreshold = ps.getParameter<double>("EndcapSeedThr"); double endcapSingleThreshold = ps.getParameter<double>("EndcapSingleThr"); double endcapSecondThreshold = ps.getParameter<double>("EndcapSecondThr"); double endcapSupThreshold = ps.getParameter<double>("EndcapSupThr"); // 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 CosmicClusterAlgo(barrelSeedThreshold, barrelSingleThreshold, barrelSecondThreshold, barrelSupThreshold, endcapSeedThreshold, endcapSingleThreshold, endcapSecondThreshold, endcapSupThreshold, posCalculator_,verbosity); nEvt_ = 0; }
CosmicClusterProducer::~CosmicClusterProducer | ( | ) |
void CosmicClusterProducer::clusterizeECALPart | ( | edm::Event & | evt, |
const edm::EventSetup & | es, | ||
const std::string & | hitProducer, | ||
const std::string & | hitCollection, | ||
const std::string & | uhitProducer, | ||
const std::string & | uhitCollection, | ||
const std::string & | clusterCollection, | ||
const std::string & | clusterShapeAssociation, | ||
const CosmicClusterAlgo::EcalPart & | ecalPart | ||
) | [private] |
Definition at line 161 of file CosmicClusterProducer.cc.
References CosmicClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), getUCollection(), i, island_p, CosmicClusterAlgo::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); const EcalUncalibratedRecHitCollection *uhitCollection_p = getUCollection(evt, uhitProducer, uhitCollection); // 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 == CosmicClusterAlgo::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, uhitCollection_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 == CosmicClusterAlgo::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 == CosmicClusterAlgo::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 CosmicClusterProducer::counterExceeded | ( | ) | const [inline, private] |
Definition at line 68 of file CosmicClusterProducer.h.
References nEvt_, and nMaxPrintout_.
{ return ((nEvt_ > nMaxPrintout_) || (nMaxPrintout_ < 0)); }
const EcalRecHitCollection * CosmicClusterProducer::getCollection | ( | edm::Event & | evt, |
const std::string & | hitProducer_, | ||
const std::string & | hitCollection_ | ||
) | [private] |
Definition at line 116 of file CosmicClusterProducer.cc.
References gather_cfg::cout, edm::Event::getByLabel(), edm::HandleBase::isValid(), and edm::Handle< T >::product().
Referenced by clusterizeECALPart().
{ edm::Handle<EcalRecHitCollection> rhcHandle; try { evt.getByLabel(hitProducer_, hitCollection_, rhcHandle); if (!(rhcHandle.isValid())) { std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl; return 0; } } catch ( cms::Exception& ex ) { edm::LogError("CosmicClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ; return 0; } return rhcHandle.product(); }
const EcalUncalibratedRecHitCollection * CosmicClusterProducer::getUCollection | ( | edm::Event & | evt, |
const std::string & | hitProducer_, | ||
const std::string & | hitCollection_ | ||
) | [private] |
Definition at line 138 of file CosmicClusterProducer.cc.
References gather_cfg::cout, edm::Event::getByLabel(), edm::HandleBase::isValid(), and edm::Handle< T >::product().
Referenced by clusterizeECALPart().
{ edm::Handle<EcalUncalibratedRecHitCollection> rhcHandle; try { evt.getByLabel(hitProducer_, hitCollection_, rhcHandle); if (!(rhcHandle.isValid())) { std::cout << "could not get a handle on the EcalUncalibratedRecHitCollection!" << std::endl; return 0; } } catch ( cms::Exception& ex ) { edm::LogError("CosmicClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ; return 0; } return rhcHandle.product(); }
void CosmicClusterProducer::outputValidationInfo | ( | reco::CaloClusterPtrVector & | clusterPtrVector | ) | [private] |
void CosmicClusterProducer::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 108 of file CosmicClusterProducer.cc.
References CosmicClusterAlgo::barrel, barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, barrelUHitCollection_, barrelUHitProducer_, clusterizeECALPart(), CosmicClusterAlgo::endcap, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, endcapUHitCollection_, endcapUHitProducer_, and nEvt_.
{ clusterizeECALPart(evt, es, endcapHitProducer_, endcapHitCollection_, endcapUHitProducer_, endcapUHitCollection_, endcapClusterCollection_, endcapClusterShapeAssociation_, CosmicClusterAlgo::endcap); clusterizeECALPart(evt, es, barrelHitProducer_, barrelHitCollection_, barrelUHitProducer_, barrelUHitCollection_, barrelClusterCollection_, barrelClusterShapeAssociation_, CosmicClusterAlgo::barrel); nEvt_++; }
std::string CosmicClusterProducer::barrelClusterCollection_ [private] |
Definition at line 54 of file CosmicClusterProducer.h.
Referenced by clusterizeECALPart(), CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::barrelClusterShapeAssociation_ [private] |
Definition at line 61 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::barrelHitCollection_ [private] |
Definition at line 46 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::barrelHitProducer_ [private] |
Definition at line 44 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::barrelUHitCollection_ [private] |
Definition at line 51 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::barrelUHitProducer_ [private] |
Definition at line 49 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::clustershapecollectionEB_ [private] |
Definition at line 57 of file CosmicClusterProducer.h.
Referenced by clusterizeECALPart(), and CosmicClusterProducer().
std::string CosmicClusterProducer::clustershapecollectionEE_ [private] |
Definition at line 58 of file CosmicClusterProducer.h.
Referenced by clusterizeECALPart(), and CosmicClusterProducer().
std::string CosmicClusterProducer::endcapClusterCollection_ [private] |
Definition at line 55 of file CosmicClusterProducer.h.
Referenced by clusterizeECALPart(), CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::endcapClusterShapeAssociation_ [private] |
Definition at line 62 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::endcapHitCollection_ [private] |
Definition at line 47 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::endcapHitProducer_ [private] |
Definition at line 45 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::endcapUHitCollection_ [private] |
Definition at line 52 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
std::string CosmicClusterProducer::endcapUHitProducer_ [private] |
Definition at line 50 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), and produce().
CosmicClusterAlgo* CosmicClusterProducer::island_p [private] |
Definition at line 66 of file CosmicClusterProducer.h.
Referenced by clusterizeECALPart(), CosmicClusterProducer(), and ~CosmicClusterProducer().
int CosmicClusterProducer::nEvt_ [private] |
Definition at line 40 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer(), counterExceeded(), and produce().
int CosmicClusterProducer::nMaxPrintout_ [private] |
Definition at line 39 of file CosmicClusterProducer.h.
Referenced by counterExceeded().
Definition at line 64 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer().
Definition at line 65 of file CosmicClusterProducer.h.
Referenced by clusterizeECALPart(), and CosmicClusterProducer().
Definition at line 42 of file CosmicClusterProducer.h.
Referenced by CosmicClusterProducer().