CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

Multi5x5ClusterProducer Class Reference

#include <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 reco::CaloID::Detectors detector)
bool counterExceeded () const
const EcalRecHitCollectiongetCollection (edm::Event &evt, const std::string &hitProducer_, const std::string &hitCollection_)
void outputValidationInfo (reco::CaloClusterPtrVector &clusterPtrVector)

Private Attributes

std::string barrelClusterCollection_
std::string barrelHitCollection_
std::string barrelHitProducer_
bool doBarrel_
bool doEndcap_
std::string endcapClusterCollection_
std::string endcapHitCollection_
std::string endcapHitProducer_
Multi5x5ClusterAlgoisland_p
int nEvt_
int nMaxPrintout_
PositionCalc posCalculator_
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 37 of file Multi5x5ClusterProducer.cc.

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

{
  // The verbosity level
  std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
  if      (verbosityString == "DEBUG")   verbosity = Multi5x5ClusterAlgo::pDEBUG;
  else if (verbosityString == "WARNING") verbosity = Multi5x5ClusterAlgo::pWARNING;
  else if (verbosityString == "INFO")    verbosity = Multi5x5ClusterAlgo::pINFO;
  else                                   verbosity = Multi5x5ClusterAlgo::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");

  // should cluster algo be run in barrel and endcap?
  doEndcap_ = ps.getParameter<bool>("doEndcap");
  doBarrel_ = ps.getParameter<bool>("doBarrel");

  // 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");

  std::vector<int> v_chstatus = ps.getParameter<std::vector<int> >("RecHitFlagToBeExcluded");

  // Parameters for the position calculation:
  edm::ParameterSet posCalcParameters = 
    ps.getParameter<edm::ParameterSet>("posCalcParameters");
  posCalculator_ = PositionCalc(posCalcParameters);

  // Produces a collection of barrel and a collection of endcap clusters
  produces< reco::BasicClusterCollection >(endcapClusterCollection_);
  produces< reco::BasicClusterCollection >(barrelClusterCollection_);

  island_p = new Multi5x5ClusterAlgo(barrelSeedThreshold, endcapSeedThreshold,  v_chstatus, posCalculator_,verbosity);

  nEvt_ = 0;
}
Multi5x5ClusterProducer::~Multi5x5ClusterProducer ( )

Definition at line 81 of file Multi5x5ClusterProducer.cc.

References island_p.

{
  delete island_p;
}

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 reco::CaloID::Detectors  detector 
) [private]

Definition at line 124 of file Multi5x5ClusterProducer.cc.

References barrelClusterCollection_, reco::CaloID::DET_ECAL_BARREL, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), island_p, Multi5x5ClusterAlgo::makeClusters(), and edm::Event::put().

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;

  if (detector == reco::CaloID::DET_ECAL_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, detector);

  // 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 (detector == reco::CaloID::DET_ECAL_BARREL) 
    bccHandle = evt.put(clusters_p, barrelClusterCollection_);
  else
    bccHandle = evt.put(clusters_p, endcapClusterCollection_);

  delete topology_p;
}
bool Multi5x5ClusterProducer::counterExceeded ( ) const [inline, private]

Definition at line 57 of file Multi5x5ClusterProducer.h.

References nEvt_, and nMaxPrintout_.

{ return ((nEvt_ > nMaxPrintout_) || (nMaxPrintout_ < 0)); }
const EcalRecHitCollection * Multi5x5ClusterProducer::getCollection ( edm::Event evt,
const std::string &  hitProducer_,
const std::string &  hitCollection_ 
) [private]

Definition at line 101 of file Multi5x5ClusterProducer.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("Multi5x5ClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ;
      return 0;
    }
  return rhcHandle.product();
}
void Multi5x5ClusterProducer::outputValidationInfo ( reco::CaloClusterPtrVector clusterPtrVector) [private]
void Multi5x5ClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
) [virtual]

Member Data Documentation

Definition at line 51 of file Multi5x5ClusterProducer.h.

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

Definition at line 48 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

Definition at line 46 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

Definition at line 41 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

Definition at line 42 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

Definition at line 52 of file Multi5x5ClusterProducer.h.

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

Definition at line 49 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

Definition at line 47 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer(), and produce().

Definition at line 38 of file Multi5x5ClusterProducer.h.

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

Definition at line 37 of file Multi5x5ClusterProducer.h.

Referenced by counterExceeded().

Definition at line 54 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().

Definition at line 44 of file Multi5x5ClusterProducer.h.

Referenced by Multi5x5ClusterProducer().