CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HiSuperClusterProducer Class Reference

#include <HiSuperClusterProducer.h>

Inheritance diagram for HiSuperClusterProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Member Functions

bool counterExceeded () const
void getClusterPtrVector (edm::Event &evt, std::string clusterProducer_, std::string clusterCollection_, reco::CaloClusterPtrVector *)
void outputValidationInfo (reco::SuperClusterCollection &superclusterCollection)
void produceSuperclustersForECALPart (edm::Event &evt, std::string clusterProducer, std::string clusterCollection, std::string superclusterColection)

Private Attributes

float barrelBCEnergyThreshold_
std::string barrelClusterCollection_
std::string barrelClusterProducer_
float barrelEtaSearchRoad_
float barrelPhiSearchRoad_
std::string barrelSuperclusterCollection_
HiBremRecoveryClusterAlgobremAlgo_p
bool doBarrel_
bool doEndcaps_
float endcapBCEnergyThreshold_
std::string endcapClusterCollection_
std::string endcapClusterProducer_
float endcapEtaSearchRoad_
float endcapPhiSearchRoad_
std::string endcapSuperclusterCollection_
int nEvt_
int nMaxPrintout_
int noSuperClusters
float seedTransverseEnergyThreshold_
double totalE
HiBremRecoveryClusterAlgo::VerbosityLevel verbosity

Detailed Description

Definition at line 20 of file HiSuperClusterProducer.h.


Constructor & Destructor Documentation

HiSuperClusterProducer::HiSuperClusterProducer ( const edm::ParameterSet ps)

Definition at line 27 of file HiSuperClusterProducer.cc.

References barrelBCEnergyThreshold_, barrelClusterCollection_, barrelClusterProducer_, barrelEtaSearchRoad_, barrelPhiSearchRoad_, barrelSuperclusterCollection_, bremAlgo_p, gather_cfg::cout, doBarrel_, doEndcaps_, endcapBCEnergyThreshold_, endcapClusterCollection_, endcapClusterProducer_, endcapEtaSearchRoad_, endcapPhiSearchRoad_, endcapSuperclusterCollection_, edm::ParameterSet::getParameter(), nEvt_, noSuperClusters, HiBremRecoveryClusterAlgo::pDEBUG, HiBremRecoveryClusterAlgo::pERROR, HiBremRecoveryClusterAlgo::pINFO, HiBremRecoveryClusterAlgo::pWARNING, seedTransverseEnergyThreshold_, totalE, and verbosity.

{
   // The verbosity level
   std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
   if      (verbosityString == "DEBUG")   verbosity = HiBremRecoveryClusterAlgo::pDEBUG;
   else if (verbosityString == "WARNING") verbosity = HiBremRecoveryClusterAlgo::pWARNING;
   else if (verbosityString == "INFO")    verbosity = HiBremRecoveryClusterAlgo::pINFO;
   else                                   verbosity = HiBremRecoveryClusterAlgo::pERROR;

   endcapClusterProducer_ = ps.getParameter<std::string>("endcapClusterProducer");
   barrelClusterProducer_ = ps.getParameter<std::string>("barrelClusterProducer");

   endcapClusterCollection_ = ps.getParameter<std::string>("endcapClusterCollection");
   barrelClusterCollection_ = ps.getParameter<std::string>("barrelClusterCollection");

   endcapSuperclusterCollection_ = ps.getParameter<std::string>("endcapSuperclusterCollection");
   barrelSuperclusterCollection_ = ps.getParameter<std::string>("barrelSuperclusterCollection");

   doBarrel_ = ps.getParameter<bool>("doBarrel");
   doEndcaps_ = ps.getParameter<bool>("doEndcaps");


   barrelEtaSearchRoad_ = ps.getParameter<double>("barrelEtaSearchRoad");
   barrelPhiSearchRoad_ = ps.getParameter<double>("barrelPhiSearchRoad");
   endcapEtaSearchRoad_ = ps.getParameter<double>("endcapEtaSearchRoad");
   endcapPhiSearchRoad_ = ps.getParameter<double>("endcapPhiSearchRoad");
   seedTransverseEnergyThreshold_ = ps.getParameter<double>("seedTransverseEnergyThreshold");
   barrelBCEnergyThreshold_ = ps.getParameter<double>("barrelBCEnergyThreshold");
   endcapBCEnergyThreshold_ = ps.getParameter<double>("endcapBCEnergyThreshold");

   if (verbosityString == "INFO") {
      std::cout <<"Barrel BC Energy threshold = "<<barrelBCEnergyThreshold_<<std::endl;
      std::cout <<"Endcap BC Energy threshold = "<<endcapBCEnergyThreshold_<<std::endl;
   }

   bremAlgo_p = new HiBremRecoveryClusterAlgo(barrelEtaSearchRoad_, barrelPhiSearchRoad_, 
                                              endcapEtaSearchRoad_, endcapPhiSearchRoad_, 
                                              seedTransverseEnergyThreshold_,
                                              barrelBCEnergyThreshold_,
                                              endcapBCEnergyThreshold_,
                                              verbosity);

   produces< reco::SuperClusterCollection >(endcapSuperclusterCollection_);
   produces< reco::SuperClusterCollection >(barrelSuperclusterCollection_);

   totalE = 0;
   noSuperClusters = 0;
   nEvt_ = 0;
}
HiSuperClusterProducer::~HiSuperClusterProducer ( )

Definition at line 78 of file HiSuperClusterProducer.cc.

References bremAlgo_p.

{
   delete bremAlgo_p;
}

Member Function Documentation

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

Definition at line 74 of file HiSuperClusterProducer.h.

References nEvt_, and nMaxPrintout_.

{ return ((nEvt_ > nMaxPrintout_) || (nMaxPrintout_ < 0));}
void HiSuperClusterProducer::endJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 83 of file HiSuperClusterProducer.cc.

References noSuperClusters, and totalE.

                                    {
   double averEnergy = 0.;
   std::ostringstream str;
   str << "HiSuperClusterProducer::endJob()\n"
       << "  total # reconstructed super clusters: " << noSuperClusters << "\n"
       << "  total energy of all clusters: " << totalE << "\n";
   if(noSuperClusters>0) { 
     averEnergy = totalE / noSuperClusters;
     str << "  average SuperCluster energy = " << averEnergy << "\n";
   }
   edm::LogInfo("HiSuperClusterProducerInfo") << str.str() << "\n";
 
}
void HiSuperClusterProducer::getClusterPtrVector ( edm::Event evt,
std::string  clusterProducer_,
std::string  clusterCollection_,
reco::CaloClusterPtrVector clusterPtrVector_p 
) [private]

Definition at line 138 of file HiSuperClusterProducer.cc.

References edm::Event::getByLabel(), i, edm::HandleBase::isValid(), edm::Handle< T >::product(), and edm::PtrVector< T >::push_back().

Referenced by produceSuperclustersForECALPart().

{  
  edm::Handle<reco::BasicClusterCollection> bccHandle;

  evt.getByLabel(clusterProducer_, clusterCollection_, bccHandle);
  if (!(bccHandle.isValid()))
    {
      edm::LogError("HiSuperClusterProducerError") << "could not get a handle on the BasicCluster Collection!";
      edm::LogError("HiSuperClusterProducerError") << "Error! can't get the product " << clusterCollection_.c_str(); 
      clusterPtrVector_p = 0;
    }

  const reco::BasicClusterCollection *clusterCollection_p = bccHandle.product();
  for (unsigned int i = 0; i < clusterCollection_p->size(); i++)
    {
      clusterPtrVector_p->push_back(reco::CaloClusterPtr(bccHandle, i));
    }
}                               
void HiSuperClusterProducer::outputValidationInfo ( reco::SuperClusterCollection superclusterCollection) [private]
void HiSuperClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
) [virtual]
void HiSuperClusterProducer::produceSuperclustersForECALPart ( edm::Event evt,
std::string  clusterProducer,
std::string  clusterCollection,
std::string  superclusterColection 
) [private]

Definition at line 110 of file HiSuperClusterProducer.cc.

References bremAlgo_p, getClusterPtrVector(), HiBremRecoveryClusterAlgo::makeSuperClusters(), noSuperClusters, edm::Event::put(), and totalE.

Referenced by produce().

{
  // get the cluster collection out and turn it to a BasicClusterRefVector:
  reco::CaloClusterPtrVector *clusterPtrVector_p = new reco::CaloClusterPtrVector;
  getClusterPtrVector(evt, clusterProducer, clusterCollection, clusterPtrVector_p);

  // run the brem recovery and get the SC collection
  std::auto_ptr<reco::SuperClusterCollection> 
    superclusters_ap(new reco::SuperClusterCollection(bremAlgo_p->makeSuperClusters(*clusterPtrVector_p)));

  // count the total energy and the number of superclusters
  reco::SuperClusterCollection::iterator it;
  for (it = superclusters_ap->begin(); it != superclusters_ap->end(); it++)
    {
      totalE += it->energy();
      noSuperClusters++;
    }

  // put the SC collection in the event
  evt.put(superclusters_ap, superclusterCollection);

  delete clusterPtrVector_p;
}

Member Data Documentation

Definition at line 53 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

Definition at line 40 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

Definition at line 43 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

Definition at line 48 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

Definition at line 49 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

Definition at line 46 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

Definition at line 56 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

Definition at line 57 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

Definition at line 54 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

Definition at line 39 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

Definition at line 42 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

Definition at line 50 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

Definition at line 51 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

Definition at line 45 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer(), and produce().

Definition at line 35 of file HiSuperClusterProducer.h.

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

Definition at line 34 of file HiSuperClusterProducer.h.

Referenced by counterExceeded().

Definition at line 52 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().

Definition at line 37 of file HiSuperClusterProducer.h.

Referenced by HiSuperClusterProducer().