CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EgammaHLTMulti5x5ClusterProducer Class Reference

#include <EgammaHLTMulti5x5ClusterProducer.h>

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

List of all members.

Public Member Functions

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

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::vector< EcalEtaPhiRegion > &regions, 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_
edm::InputTag barrelHitProducer_
bool doBarrel_
bool doEndcaps_
bool doIsolated_
std::string endcapClusterCollection_
std::string endcapHitCollection_
edm::InputTag endcapHitProducer_
double l1LowerThr_
double l1LowerThrIgnoreIsolation_
edm::InputTag l1TagIsolated_
edm::InputTag l1TagNonIsolated_
double l1UpperThr_
Multi5x5ClusterAlgoMulti5x5_p
int nEvt_
int nMaxPrintout_
PositionCalc posCalculator_
double regionEtaMargin_
double regionPhiMargin_
Multi5x5ClusterAlgo::VerbosityLevel verbosity

Detailed Description

Definition at line 26 of file EgammaHLTMulti5x5ClusterProducer.h.


Constructor & Destructor Documentation

EgammaHLTMulti5x5ClusterProducer::EgammaHLTMulti5x5ClusterProducer ( const edm::ParameterSet ps)

Definition at line 42 of file EgammaHLTMulti5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelHitCollection_, barrelHitProducer_, doBarrel_, doEndcaps_, doIsolated_, endcapClusterCollection_, endcapHitCollection_, endcapHitProducer_, edm::ParameterSet::getParameter(), l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, Multi5x5_p, nEvt_, Multi5x5ClusterAlgo::pDEBUG, Multi5x5ClusterAlgo::pERROR, Multi5x5ClusterAlgo::pINFO, posCalculator_, Multi5x5ClusterAlgo::pWARNING, regionEtaMargin_, regionPhiMargin_, 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;

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

  // Parameters to identify the hit collections
  barrelHitProducer_   = ps.getParameter<edm::InputTag>("barrelHitProducer");
  endcapHitProducer_   = ps.getParameter<edm::InputTag>("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");

  // Multi5x5 algorithm parameters
  double barrelSeedThreshold = ps.getParameter<double>("Multi5x5BarrelSeedThr");
  double endcapSeedThreshold = ps.getParameter<double>("Multi5x5EndcapSeedThr");

  // L1 matching parameters
  l1TagIsolated_ = ps.getParameter< edm::InputTag > ("l1TagIsolated");
  l1TagNonIsolated_ = ps.getParameter< edm::InputTag > ("l1TagNonIsolated");
  l1LowerThr_ = ps.getParameter<double> ("l1LowerThr");
  l1UpperThr_ = ps.getParameter<double> ("l1UpperThr");
  l1LowerThrIgnoreIsolation_ = ps.getParameter<double> ("l1LowerThrIgnoreIsolation");

  regionEtaMargin_   = ps.getParameter<double>("regionEtaMargin");
  regionPhiMargin_   = ps.getParameter<double>("regionPhiMargin");

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

  // exclude recHit flags from seeding
  std::vector<int> v_chstatus = ps.getParameter<std::vector<int> >("RecHitFlagToBeExcluded");

  // Produces a collection of barrel and a collection of endcap clusters

  produces< reco::BasicClusterCollection >(endcapClusterCollection_);
  produces< reco::BasicClusterCollection >(barrelClusterCollection_);

  Multi5x5_p = new Multi5x5ClusterAlgo(barrelSeedThreshold, endcapSeedThreshold, v_chstatus, posCalculator_,verbosity);
  
  /*
  shapeAlgo_ = ClusterShapeAlgo(providedParameters);//new


  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_);//new
  //produces< reco::BasicClusterCollection >(endcapClusterCollection_);
  produces< reco::ClusterShapeCollection>(clustershapecollectionEB_);//new
 // produces< reco::BasicClusterCollection >(barrelClusterCollection_);
  produces< reco::BasicClusterShapeAssociationCollection >(barrelClusterShapeAssociation_);//new
  produces< reco::BasicClusterShapeAssociationCollection >(endcapClusterShapeAssociation_);//new

  */

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

Definition at line 118 of file EgammaHLTMulti5x5ClusterProducer.cc.

References Multi5x5_p.

{
  delete Multi5x5_p;
}

Member Function Documentation

void EgammaHLTMulti5x5ClusterProducer::clusterizeECALPart ( edm::Event evt,
const edm::EventSetup es,
const std::string &  hitProducer,
const std::string &  hitCollection,
const std::string &  clusterCollection,
const std::vector< EcalEtaPhiRegion > &  regions,
const reco::CaloID::Detectors  detector 
) [private]

Definition at line 274 of file EgammaHLTMulti5x5ClusterProducer.cc.

References barrelClusterCollection_, reco::CaloID::DET_ECAL_BARREL, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), Multi5x5ClusterAlgo::makeClusters(), Multi5x5_p, 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 = Multi5x5_p->makeClusters(hitCollection_p, geometry_p, topology_p, geometryES_p, detector, true, regions);

  // 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 EgammaHLTMulti5x5ClusterProducer::counterExceeded ( ) const [inline, private]

Definition at line 76 of file EgammaHLTMulti5x5ClusterProducer.h.

References nEvt_, and nMaxPrintout_.

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

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

Implements edm::EDProducer.

Definition at line 124 of file EgammaHLTMulti5x5ClusterProducer.cc.

References barrelClusterCollection_, barrelHitCollection_, barrelHitProducer_, clusterizeECALPart(), reco::CaloID::DET_ECAL_BARREL, reco::CaloID::DET_ECAL_ENDCAP, doBarrel_, doEndcaps_, doIsolated_, endcapClusterCollection_, endcapHitCollection_, endcapHitProducer_, edm::EventSetup::get(), edm::Event::getByLabel(), l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, edm::InputTag::label(), nEvt_, regionEtaMargin_, and regionPhiMargin_.

{
  //Get the L1 EM Particle Collection
  edm::Handle< l1extra::L1EmParticleCollection > emIsolColl ;
  if(doIsolated_)
    evt.getByLabel(l1TagIsolated_, emIsolColl);
  //Get the L1 EM Particle Collection
  edm::Handle< l1extra::L1EmParticleCollection > emNonIsolColl ;
  evt.getByLabel(l1TagNonIsolated_, emNonIsolColl);
  // Get the CaloGeometry
  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;

  std::vector<EcalEtaPhiRegion> barrelRegions;
  std::vector<EcalEtaPhiRegion> endcapRegions;

  if(doIsolated_) {
    for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end() ;++emItr ){

      if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_) {
        
        // Access the GCT hardware object corresponding to the L1Extra EM object.
        int etaIndex = emItr->gctEmCand()->etaIndex() ;
        
        
        int phiIndex = emItr->gctEmCand()->phiIndex() ;
        // Use the L1CaloGeometry to find the eta, phi bin boundaries.
        double etaLow  = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
        double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
        double phiLow  = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
        double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;

        //Attention isForward does not work
        int isforw=0;
        int isbarl=0;
        if((float)(etaHigh)>1.479 || (float)(etaLow)<-1.479) isforw=1;
        if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) || 
           ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;

        //std::cout<<"Multi5x5 etaindex "<<etaIndex<<" low hig : "<<etaLow<<" "<<etaHigh<<" phi low hig" <<phiLow<<" " << phiHigh<<" isforw "<<emItr->gctEmCand()->regionId().isForward()<<" isforwnew" <<isforw<< std::endl;
        
        etaLow -= regionEtaMargin_;
        etaHigh += regionEtaMargin_;
        phiLow -= regionPhiMargin_;
        phiHigh += regionPhiMargin_;

        //if (emItr->gctEmCand()->regionId().isForward()) {
        if (isforw) {
          if (etaHigh>-1.479 && etaHigh<1.479) etaHigh=-1.479;
          if ( etaLow>-1.479 &&  etaLow<1.479) etaLow=1.479;
          EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
          endcapRegions.push_back(region);
        }
        if (isbarl) {
          if (etaHigh>1.479) etaHigh=1.479;
          if (etaLow<-1.479) etaLow=-1.479;
          EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
          barrelRegions.push_back(region);
        }
        EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
        
      }
    }
  }


  if(!doIsolated_||l1LowerThrIgnoreIsolation_<64) {
    for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end() ;++emItr ){

      if(doIsolated_&&emItr->et()<l1LowerThrIgnoreIsolation_) continue;

      if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_) {
        
        // Access the GCT hardware object corresponding to the L1Extra EM object.
        int etaIndex = emItr->gctEmCand()->etaIndex() ;
        
        
        int phiIndex = emItr->gctEmCand()->phiIndex() ;
        // Use the L1CaloGeometry to find the eta, phi bin boundaries.
        double etaLow  = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
        double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
        double phiLow  = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
        double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;


        int isforw=0;
        int isbarl=0;
        if((float)(etaHigh)>1.479 || (float)(etaLow)<-1.479) isforw=1;
        if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) || 
           ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;

        //std::cout<<"Multi5x5 etaindex "<<etaIndex<<" low hig : "<<etaLow<<" "<<etaHigh<<" phi low hig" <<phiLow<<" " << phiHigh<<" isforw "<<emItr->gctEmCand()->regionId().isForward()<<" isforwnew" <<isforw<< std::endl;
        
        etaLow -= regionEtaMargin_;
        etaHigh += regionEtaMargin_;
        phiLow -= regionPhiMargin_;
        phiHigh += regionPhiMargin_;

        //if (emItr->gctEmCand()->regionId().isForward()) {
        if (isforw) {
          if (etaHigh>-1.479 && etaHigh<1.479) etaHigh=-1.479;
          if ( etaLow>-1.479 &&  etaLow<1.479) etaLow=1.479;
          EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
          endcapRegions.push_back(region);
        }
        if (isbarl) {
          if (etaHigh>1.479) etaHigh=1.479;
          if (etaLow<-1.479) etaLow=-1.479;
          EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
          barrelRegions.push_back(region);
        }
        
      }
    }
  }


  if (doEndcaps_ 
      //&&endcapRegions.size()!=0
      ) {

    clusterizeECALPart(evt, es, endcapHitProducer_.label(), endcapHitCollection_, endcapClusterCollection_, endcapRegions, reco::CaloID::DET_ECAL_ENDCAP);//old
   }
  if (doBarrel_ 
      //&& barrelRegions.size()!=0
      ) {
    clusterizeECALPart(evt, es, barrelHitProducer_.label(), barrelHitCollection_, barrelClusterCollection_, barrelRegions, reco::CaloID::DET_ECAL_BARREL);//old
 
  }
  nEvt_++;
}

Member Data Documentation

Definition at line 49 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 47 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 43 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 44 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 45 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 50 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 48 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 65 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 67 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 63 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 64 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 66 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 38 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by counterExceeded().

Definition at line 72 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer().

Definition at line 69 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 70 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer(), and produce().

Definition at line 41 of file EgammaHLTMulti5x5ClusterProducer.h.

Referenced by EgammaHLTMulti5x5ClusterProducer().