CMS 3D CMS Logo

Multi5x5ClusterProducer Class Reference

#include <RecoEcal/EgammaClusterProducers/interface/Multi5x5ClusterProducer.h>

Inheritance diagram for Multi5x5ClusterProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 Multi5x5ClusterProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~Multi5x5ClusterProducer ()

Private Member Functions

void 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 Multi5x5ClusterAlgo::EcalPart &ecalPart)
bool counterExceeded () const
const EcalRecHitCollectiongetCollection (edm::Event &evt, const std::string &hitProducer_, const std::string &hitCollection_)
void outputValidationInfo (reco::BasicClusterRefVector &clusterRefVector)

Private Attributes

std::string barrelClusterCollection_
std::string barrelClusterShapeAssociation_
std::string barrelHitCollection_
std::string barrelHitProducer_
std::string clustershapecollectionEB_
std::string clustershapecollectionEE_
bool doBarrel_
bool doEndcap_
std::string endcapClusterCollection_
std::string endcapClusterShapeAssociation_
std::string endcapHitCollection_
std::string endcapHitProducer_
Multi5x5ClusterAlgoisland_p
int nEvt_
int nMaxPrintout_
PositionCalc posCalculator_
ClusterShapeAlgo shapeAlgo_
Multi5x5ClusterAlgo::VerbosityLevel verbosity


Detailed Description

Definition at line 25 of file Multi5x5ClusterProducer.h.


Constructor & Destructor Documentation

Multi5x5ClusterProducer::Multi5x5ClusterProducer ( const edm::ParameterSet ps  ) 

Definition at line 40 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, clustershapecollectionEB_, clustershapecollectionEE_, doBarrel_, doEndcap_, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, edm::ParameterSet::getParameter(), island_p, nEvt_, Multi5x5ClusterAlgo::pDEBUG, Multi5x5ClusterAlgo::pERROR, Multi5x5ClusterAlgo::pINFO, posCalculator_, Multi5x5ClusterAlgo::pWARNING, shapeAlgo_, and verbosity.

00041 {
00042   // The verbosity level
00043   std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
00044   if      (verbosityString == "DEBUG")   verbosity = Multi5x5ClusterAlgo::pDEBUG;
00045   else if (verbosityString == "WARNING") verbosity = Multi5x5ClusterAlgo::pWARNING;
00046   else if (verbosityString == "INFO")    verbosity = Multi5x5ClusterAlgo::pINFO;
00047   else                                   verbosity = Multi5x5ClusterAlgo::pERROR;
00048 
00049   // Parameters to identify the hit collections
00050   barrelHitProducer_   = ps.getParameter<std::string>("barrelHitProducer");
00051   endcapHitProducer_   = ps.getParameter<std::string>("endcapHitProducer");
00052   barrelHitCollection_ = ps.getParameter<std::string>("barrelHitCollection");
00053   endcapHitCollection_ = ps.getParameter<std::string>("endcapHitCollection");
00054 
00055   // should cluster algo be run in barrel and endcap?
00056   doEndcap_ = ps.getParameter<bool>("doEndcap");
00057   doBarrel_ = ps.getParameter<bool>("doBarrel");
00058 
00059   // The names of the produced cluster collections
00060   barrelClusterCollection_  = ps.getParameter<std::string>("barrelClusterCollection");
00061   endcapClusterCollection_  = ps.getParameter<std::string>("endcapClusterCollection");
00062 
00063   // Island algorithm parameters
00064   double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr");
00065   double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr");
00066 
00067   // Parameters for the position calculation:
00068   std::map<std::string,double> providedParameters;
00069   providedParameters.insert(std::make_pair("LogWeighted",ps.getParameter<bool>("posCalc_logweight")));
00070   providedParameters.insert(std::make_pair("T0_barl",ps.getParameter<double>("posCalc_t0_barl")));
00071   providedParameters.insert(std::make_pair("T0_endc",ps.getParameter<double>("posCalc_t0_endc")));
00072   providedParameters.insert(std::make_pair("T0_endcPresh",ps.getParameter<double>("posCalc_t0_endcPresh")));
00073   providedParameters.insert(std::make_pair("W0",ps.getParameter<double>("posCalc_w0")));
00074   providedParameters.insert(std::make_pair("X0",ps.getParameter<double>("posCalc_x0")));
00075   posCalculator_ = PositionCalc(providedParameters);
00076   shapeAlgo_ = ClusterShapeAlgo(providedParameters);
00077 
00078   clustershapecollectionEB_ = ps.getParameter<std::string>("clustershapecollectionEB");
00079   clustershapecollectionEE_ = ps.getParameter<std::string>("clustershapecollectionEE");
00080 
00081   //AssociationMap
00082   barrelClusterShapeAssociation_ = ps.getParameter<std::string>("barrelShapeAssociation");
00083   endcapClusterShapeAssociation_ = ps.getParameter<std::string>("endcapShapeAssociation");
00084 
00085   // Produces a collection of barrel and a collection of endcap clusters
00086 
00087   produces< reco::ClusterShapeCollection>(clustershapecollectionEE_);
00088   produces< reco::BasicClusterCollection >(endcapClusterCollection_);
00089   produces< reco::ClusterShapeCollection>(clustershapecollectionEB_);
00090   produces< reco::BasicClusterCollection >(barrelClusterCollection_);
00091   produces< reco::BasicClusterShapeAssociationCollection >(barrelClusterShapeAssociation_);
00092   produces< reco::BasicClusterShapeAssociationCollection >(endcapClusterShapeAssociation_);
00093 
00094   island_p = new Multi5x5ClusterAlgo(barrelSeedThreshold, endcapSeedThreshold, posCalculator_,verbosity);
00095 
00096   nEvt_ = 0;
00097 }

Multi5x5ClusterProducer::~Multi5x5ClusterProducer (  ) 

Definition at line 100 of file Multi5x5ClusterProducer.cc.

References island_p.

00101 {
00102   delete island_p;
00103 }


Member Function Documentation

void Multi5x5ClusterProducer::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 Multi5x5ClusterAlgo::EcalPart ecalPart 
) [private]

Definition at line 143 of file Multi5x5ClusterProducer.cc.

References Multi5x5ClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), i, int, island_p, Multi5x5ClusterAlgo::makeClusters(), edm::Event::put(), and shapeAlgo_.

Referenced by produce().

00149 {
00150   // get the hit collection from the event:
00151   const EcalRecHitCollection *hitCollection_p = getCollection(evt, hitProducer, hitCollection);
00152 
00153   // get the geometry and topology from the event setup:
00154   edm::ESHandle<CaloGeometry> geoHandle;
00155   es.get<CaloGeometryRecord>().get(geoHandle);
00156 
00157   const CaloSubdetectorGeometry *geometry_p;
00158   CaloSubdetectorTopology *topology_p;
00159 
00160   std::string clustershapetag;
00161   if (ecalPart == Multi5x5ClusterAlgo::barrel) 
00162     {
00163       geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
00164       topology_p = new EcalBarrelTopology(geoHandle);
00165     }
00166   else
00167     {
00168       geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
00169       topology_p = new EcalEndcapTopology(geoHandle); 
00170    }
00171 
00172   const CaloSubdetectorGeometry *geometryES_p;
00173   geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
00174 
00175   // Run the clusterization algorithm:
00176   reco::BasicClusterCollection clusters;
00177   clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p, geometryES_p, ecalPart);
00178 
00179   //Create associated ClusterShape objects.
00180   std::vector <reco::ClusterShape> ClusVec;
00181   for (int erg=0;erg<int(clusters.size());++erg){
00182     reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg],hitCollection_p,geometry_p,topology_p);
00183     ClusVec.push_back(TestShape);
00184   }
00185 
00186   //Put clustershapes in event, but retain a Handle on them.
00187   std::auto_ptr< reco::ClusterShapeCollection> clustersshapes_p(new reco::ClusterShapeCollection);
00188   clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
00189   edm::OrphanHandle<reco::ClusterShapeCollection> clusHandle; 
00190   if (ecalPart == Multi5x5ClusterAlgo::barrel) 
00191     clusHandle= evt.put(clustersshapes_p, clustershapecollectionEB_);
00192   else
00193     clusHandle= evt.put(clustersshapes_p, clustershapecollectionEE_);
00194 
00195   // create an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
00196   std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection);
00197   clusters_p->assign(clusters.begin(), clusters.end());
00198   edm::OrphanHandle<reco::BasicClusterCollection> bccHandle;
00199   if (ecalPart == Multi5x5ClusterAlgo::barrel) 
00200     bccHandle = evt.put(clusters_p, barrelClusterCollection_);
00201   else
00202     bccHandle = evt.put(clusters_p, endcapClusterCollection_);
00203 
00204 
00205   // BasicClusterShapeAssociationMap
00206   std::auto_ptr<reco::BasicClusterShapeAssociationCollection> shapeAssocs_p(new reco::BasicClusterShapeAssociationCollection);
00207   for (unsigned int i = 0; i < clusHandle->size(); i++){
00208     shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle,i),edm::Ref<reco::ClusterShapeCollection>(clusHandle,i));
00209   }  
00210   evt.put(shapeAssocs_p,clusterShapeAssociation);
00211 
00212   delete topology_p;
00213 }

bool Multi5x5ClusterProducer::counterExceeded (  )  const [inline, private]

Definition at line 65 of file Multi5x5ClusterProducer.h.

References nEvt_, and nMaxPrintout_.

00065 { return ((nEvt_ > nMaxPrintout_) || (nMaxPrintout_ < 0)); }

const EcalRecHitCollection * Multi5x5ClusterProducer::getCollection ( edm::Event evt,
const std::string &  hitProducer_,
const std::string &  hitCollection_ 
) [private]

Definition at line 120 of file Multi5x5ClusterProducer.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::Event::getByLabel(), edm::Handle< T >::isValid(), and edm::Handle< T >::product().

Referenced by clusterizeECALPart().

00123 {
00124   edm::Handle<EcalRecHitCollection> rhcHandle;
00125   try
00126     {
00127       evt.getByLabel(hitProducer_, hitCollection_, rhcHandle);
00128       if (!(rhcHandle.isValid())) 
00129         {
00130           std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl;
00131           return 0;
00132         }
00133     }
00134   catch ( cms::Exception& ex ) 
00135     {
00136       edm::LogError("Multi5x5ClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ;
00137       return 0;
00138     }
00139   return rhcHandle.product();
00140 }

void Multi5x5ClusterProducer::outputValidationInfo ( reco::BasicClusterRefVector clusterRefVector  )  [private]

void Multi5x5ClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 106 of file Multi5x5ClusterProducer.cc.

References Multi5x5ClusterAlgo::barrel, barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, clusterizeECALPart(), doBarrel_, doEndcap_, Multi5x5ClusterAlgo::endcap, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, and nEvt_.


Member Data Documentation

std::string Multi5x5ClusterProducer::barrelClusterCollection_ [private]

Definition at line 51 of file Multi5x5ClusterProducer.h.

Referenced by clusterizeECALPart(), Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::barrelClusterShapeAssociation_ [private]

Definition at line 58 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::barrelHitCollection_ [private]

Definition at line 48 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::barrelHitProducer_ [private]

Definition at line 46 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::clustershapecollectionEB_ [private]

Definition at line 54 of file Multi5x5ClusterProducer.h.

Referenced by clusterizeECALPart(), and Multi5x5ClusterProducer().

std::string Multi5x5ClusterProducer::clustershapecollectionEE_ [private]

Definition at line 55 of file Multi5x5ClusterProducer.h.

Referenced by clusterizeECALPart(), and Multi5x5ClusterProducer().

bool Multi5x5ClusterProducer::doBarrel_ [private]

Definition at line 41 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

bool Multi5x5ClusterProducer::doEndcap_ [private]

Definition at line 42 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::endcapClusterCollection_ [private]

Definition at line 52 of file Multi5x5ClusterProducer.h.

Referenced by clusterizeECALPart(), Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::endcapClusterShapeAssociation_ [private]

Definition at line 59 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::endcapHitCollection_ [private]

Definition at line 49 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

std::string Multi5x5ClusterProducer::endcapHitProducer_ [private]

Definition at line 47 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

Multi5x5ClusterAlgo* Multi5x5ClusterProducer::island_p [private]

Definition at line 63 of file Multi5x5ClusterProducer.h.

Referenced by clusterizeECALPart(), Multi5x5ClusterProducer(), and ~Multi5x5ClusterProducer().

int Multi5x5ClusterProducer::nEvt_ [private]

Definition at line 38 of file Multi5x5ClusterProducer.h.

Referenced by counterExceeded(), Multi5x5ClusterProducer(), and produce().

int Multi5x5ClusterProducer::nMaxPrintout_ [private]

Definition at line 37 of file Multi5x5ClusterProducer.h.

Referenced by counterExceeded().

PositionCalc Multi5x5ClusterProducer::posCalculator_ [private]

Definition at line 61 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().

ClusterShapeAlgo Multi5x5ClusterProducer::shapeAlgo_ [private]

Definition at line 62 of file Multi5x5ClusterProducer.h.

Referenced by clusterizeECALPart(), and Multi5x5ClusterProducer().

Multi5x5ClusterAlgo::VerbosityLevel Multi5x5ClusterProducer::verbosity [private]

Definition at line 44 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:28:30 2009 for CMSSW by  doxygen 1.5.4