CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ElectronSeedProducer Class Reference

#include <ElectronSeedProducer.h>

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

List of all members.

Public Member Functions

virtual void beginRun (edm::Run &, edm::EventSetup const &)
 ElectronSeedProducer (const edm::ParameterSet &)
virtual void endRun (edm::Run &, edm::EventSetup const &)
virtual void produce (edm::Event &, const edm::EventSetup &)
virtual ~ElectronSeedProducer ()

Private Member Functions

void filterClusters (const reco::BeamSpot &bs, const edm::Handle< reco::SuperClusterCollection > &superClusters, reco::SuperClusterRefVector &sclRefs, std::vector< float > &hoe1s, std::vector< float > &hoe2s)
void filterSeeds (edm::Event &e, const edm::EventSetup &setup, reco::SuperClusterRefVector &sclRefs)

Private Attributes

bool applyHOverECut_
edm::InputTag beamSpotTag_
edm::ESHandle< CaloGeometrycaloGeom_
unsigned long long caloGeomCacheId_
edm::ESHandle< CaloTopologycaloTopo_
unsigned long long caloTopoCacheId_
edm::ParameterSet conf_
bool fromTrackerSeeds_
ElectronHcalHelperhcalHelper_
edm::InputTag initialSeeds_
ElectronSeedGeneratormatcher_
double maxHBarrel_
double maxHEndcaps_
double maxHOverEBarrel_
double maxHOverEEndcaps_
bool prefilteredSeeds_
double SCEtCut_
SeedFilterseedFilter_
edm::InputTag superClusters_ [2]
TrajectorySeedCollectiontheInitialSeedColl

Detailed Description

Description: MeasurementEstimator for Pixel Barrel, ported from ORCA Class defining the search area in the barrel in the pixel match Implementation: <Notes on="" implementation>="">

Description: MeasurementEstimator for Pixel Barrel, ported from ORCA

Implementation: <Notes on="" implementation>="">

Description: EDProducer of ElectronSeed objects

Implementation: <Notes on="" implementation>="">

Definition at line 40 of file ElectronSeedProducer.h.


Constructor & Destructor Documentation

ElectronSeedProducer::ElectronSeedProducer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 51 of file ElectronSeedProducer.cc.

References applyHOverECut_, beamSpotTag_, conf_, edm::ParameterSet::exists(), fromTrackerSeeds_, edm::ParameterSet::getParameter(), hcalHelper_, ElectronHcalHelper::Configuration::hcalTowers, ElectronHcalHelper::Configuration::hOverEConeSize, ElectronHcalHelper::Configuration::hOverEPtMin, initialSeeds_, matcher_, maxHBarrel_, maxHEndcaps_, maxHOverEBarrel_, maxHOverEEndcaps_, prefilteredSeeds_, SCEtCut_, superClusters_, funct::true, and ElectronHcalHelper::Configuration::useTowers.

 : beamSpotTag_("offlineBeamSpot"),
   //conf_(iConfig),
   seedFilter_(0), applyHOverECut_(true), hcalHelper_(0),
   caloGeom_(0), caloGeomCacheId_(0), caloTopo_(0), caloTopoCacheId_(0)
 {
  conf_ = iConfig.getParameter<edm::ParameterSet>("SeedConfiguration") ;

  initialSeeds_ = conf_.getParameter<edm::InputTag>("initialSeeds") ;
  SCEtCut_ = conf_.getParameter<double>("SCEtCut") ;
  fromTrackerSeeds_ = conf_.getParameter<bool>("fromTrackerSeeds") ;
  prefilteredSeeds_ = conf_.getParameter<bool>("preFilteredSeeds") ;

  // new beamSpot tag
  if (conf_.exists("beamSpot"))
   { beamSpotTag_ = conf_.getParameter<edm::InputTag>("beamSpot") ; }

  // for H/E
//  if (conf_.exists("applyHOverECut"))
//   { applyHOverECut_ = conf_.getParameter<bool>("applyHOverECut") ; }
  applyHOverECut_ = conf_.getParameter<bool>("applyHOverECut") ;
  if (applyHOverECut_)
   {
    ElectronHcalHelper::Configuration hcalCfg ;
    hcalCfg.hOverEConeSize = conf_.getParameter<double>("hOverEConeSize") ;
    if (hcalCfg.hOverEConeSize>0)
     {
      hcalCfg.useTowers = true ;
      hcalCfg.hcalTowers = conf_.getParameter<edm::InputTag>("hcalTowers") ;
      hcalCfg.hOverEPtMin = conf_.getParameter<double>("hOverEPtMin") ;
     }
    hcalHelper_ = new ElectronHcalHelper(hcalCfg) ;
    maxHOverEBarrel_=conf_.getParameter<double>("maxHOverEBarrel") ;
    maxHOverEEndcaps_=conf_.getParameter<double>("maxHOverEEndcaps") ;
    maxHBarrel_=conf_.getParameter<double>("maxHBarrel") ;
    maxHEndcaps_=conf_.getParameter<double>("maxHEndcaps") ;
//    hOverEConeSize_=conf_.getParameter<double>("hOverEConeSize") ;
//    hOverEHBMinE_=conf_.getParameter<double>("hOverEHBMinE") ;
//    hOverEHFMinE_=conf_.getParameter<double>("hOverEHFMinE") ;
   }

  matcher_ = new ElectronSeedGenerator(conf_) ;

  //  get collections from config'
  superClusters_[0]=iConfig.getParameter<edm::InputTag>("barrelSuperClusters") ;
  superClusters_[1]=iConfig.getParameter<edm::InputTag>("endcapSuperClusters") ;

  //register your products
  produces<ElectronSeedCollection>() ;
}
ElectronSeedProducer::~ElectronSeedProducer ( ) [virtual]

Definition at line 117 of file ElectronSeedProducer.cc.

References hcalHelper_, and matcher_.

 {
  delete hcalHelper_ ;
  delete matcher_ ;
 }

Member Function Documentation

void ElectronSeedProducer::beginRun ( edm::Run ,
edm::EventSetup const &   
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 103 of file ElectronSeedProducer.cc.

References conf_, prefilteredSeeds_, and seedFilter_.

 {
  // FIXME: because of a bug presumably in tracker seeding,
  // perhaps in CombinedHitPairGenerator, badly caching some EventSetup product,
  // we must redo the SeedFilter for each run.
  if (prefilteredSeeds_) seedFilter_ = new SeedFilter(conf_) ;
 }
void ElectronSeedProducer::endRun ( edm::Run ,
edm::EventSetup const &   
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 111 of file ElectronSeedProducer.cc.

References seedFilter_.

 {
  delete seedFilter_ ;
  seedFilter_ = 0 ;
 }
void ElectronSeedProducer::filterClusters ( const reco::BeamSpot bs,
const edm::Handle< reco::SuperClusterCollection > &  superClusters,
reco::SuperClusterRefVector sclRefs,
std::vector< float > &  hoe1s,
std::vector< float > &  hoe2s 
) [private]

Definition at line 205 of file ElectronSeedProducer.cc.

References EcalBarrel, EcalEndcap, reco::CaloCluster::energy(), eta, funct::false, i, infinity, LogDebug, reco::CaloCluster::position(), reco::BeamSpot::position(), edm::RefVector< C, T, F >::push_back(), reco::SuperCluster::seed(), and edm::RefVector< C, T, F >::size().

Referenced by produce().

 {
  for (unsigned int i=0;i<superClusters->size();++i)
   {
    const SuperCluster & scl = (*superClusters)[i] ;
    double sclEta = EleRelPoint(scl.position(),bs.position()).eta() ;
    if (scl.energy()/cosh(sclEta)>SCEtCut_)
     {
//      if ((applyHOverECut_==true)&&((hcalHelper_->hcalESum(scl)/scl.energy()) > maxHOverE_))
//       { continue ; }
//      sclRefs.push_back(edm::Ref<reco::SuperClusterCollection>(superClusters,i)) ;
       double had1, had2, had, scle ;
       bool HoeVeto = false ;
       if (applyHOverECut_==true)
        {
         had1 = hcalHelper_->hcalESumDepth1(scl);
         had2 = hcalHelper_->hcalESumDepth2(scl);
         had = had1+had2 ;
         scle = scl.energy() ;
         int detector = scl.seed()->hitsAndFractions()[0].first.subdetId() ;
         if (detector==EcalBarrel && (had<maxHBarrel_ || had/scle<maxHOverEBarrel_)) HoeVeto=true;
         else if (detector==EcalEndcap && (had<maxHEndcaps_ || had/scle<maxHOverEEndcaps_)) HoeVeto=true;
         if (HoeVeto)
          {
           sclRefs.push_back(edm::Ref<reco::SuperClusterCollection>(superClusters,i)) ;
           hoe1s.push_back(had1/scle) ;
           hoe2s.push_back(had2/scle) ;
          }
        }
       else
        {
         sclRefs.push_back(edm::Ref<reco::SuperClusterCollection>(superClusters,i)) ;
         hoe1s.push_back(std::numeric_limits<float>::infinity()) ;
         hoe2s.push_back(std::numeric_limits<float>::infinity()) ;
        }
     }
   }
  LogDebug("ElectronSeedProducer")<<"Filtered out "<<sclRefs.size()<<" superclusters from "<<superClusters->size() ;
 }
void ElectronSeedProducer::filterSeeds ( edm::Event e,
const edm::EventSetup setup,
reco::SuperClusterRefVector sclRefs 
) [private]

Definition at line 249 of file ElectronSeedProducer.cc.

References i, LogDebug, and edm::RefVector< C, T, F >::size().

Referenced by produce().

 {
  for ( unsigned int i=0 ; i<sclRefs.size() ; ++i )
   {
    seedFilter_->seeds(event,setup,sclRefs[i],theInitialSeedColl) ;
    LogDebug("ElectronSeedProducer")<<"Number of Seeds: "<<theInitialSeedColl->size() ;
   }
 }
void ElectronSeedProducer::produce ( edm::Event e,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 123 of file ElectronSeedProducer.cc.

References beamSpotTag_, edm::eventsetup::EventSetupRecord::cacheIdentifier(), caloGeom_, caloGeomCacheId_, caloTopo_, caloTopoCacheId_, edm::RefToBase< T >::castTo(), ElectronHcalHelper::checkSetup(), filterClusters(), filterSeeds(), fromTrackerSeeds_, edm::EventSetup::get(), edm::Event::getByLabel(), hcalHelper_, i, edm::Ref< C, T, F >::id(), initialSeeds_, LogDebug, matcher_, prefilteredSeeds_, edm::Handle< T >::product(), edm::Event::put(), ElectronHcalHelper::readEvent(), ElectronSeedGenerator::run(), ElectronSeedGenerator::setupES(), superClusters_, and theInitialSeedColl.

 {
  LogDebug("ElectronSeedProducer") <<"[ElectronSeedProducer::produce] entering " ;

  edm::Handle<reco::BeamSpot> theBeamSpot ;
  e.getByLabel(beamSpotTag_,theBeamSpot) ;

  if (hcalHelper_)
   {
    hcalHelper_->checkSetup(iSetup) ;
    hcalHelper_->readEvent(e) ;
   }

  // get calo geometry
  if (caloGeomCacheId_!=iSetup.get<CaloGeometryRecord>().cacheIdentifier()) {
    iSetup.get<CaloGeometryRecord>().get(caloGeom_);
    caloGeomCacheId_=iSetup.get<CaloGeometryRecord>().cacheIdentifier();
  }
  if (caloTopoCacheId_!=iSetup.get<CaloTopologyRecord>().cacheIdentifier()){
    caloTopoCacheId_=iSetup.get<CaloTopologyRecord>().cacheIdentifier();
    iSetup.get<CaloTopologyRecord>().get(caloTopo_);
  }

  matcher_->setupES(iSetup);

  // get initial TrajectorySeeds if necessary
  if (fromTrackerSeeds_)
   {
    if (!prefilteredSeeds_)
     {
      edm::Handle<TrajectorySeedCollection> hSeeds;
      e.getByLabel(initialSeeds_, hSeeds);
      theInitialSeedColl = const_cast<TrajectorySeedCollection *> (hSeeds.product());
     }
    else
     { theInitialSeedColl = new TrajectorySeedCollection ; }
   }
  else
   { theInitialSeedColl = 0 ; } // not needed in this case

  ElectronSeedCollection * seeds = new ElectronSeedCollection ;

  // loop over barrel + endcap
  for (unsigned int i=0; i<2; i++)
   {
    edm::Handle<SuperClusterCollection> clusters ;
    if (e.getByLabel(superClusters_[i],clusters))
     {
      SuperClusterRefVector clusterRefs ;
      std::vector<float> hoe1s, hoe2s ;
      filterClusters(*theBeamSpot,clusters,/*mhbhe_,*/clusterRefs,hoe1s,hoe2s) ;
      if ((fromTrackerSeeds_) && (prefilteredSeeds_))
       { filterSeeds(e,iSetup,clusterRefs) ; }
      matcher_->run(e,iSetup,clusterRefs,hoe1s,hoe2s,theInitialSeedColl,*seeds) ;
     }
   }

  // store the accumulated result
  std::auto_ptr<ElectronSeedCollection> pSeeds(seeds) ;
  ElectronSeedCollection::iterator is ;
  for ( is=pSeeds->begin() ; is!=pSeeds->end() ; is++ )
   {
    edm::RefToBase<CaloCluster> caloCluster = is->caloCluster() ;
    SuperClusterRef superCluster = caloCluster.castTo<SuperClusterRef>() ;
    LogDebug("ElectronSeedProducer")<< "new seed with "
      << (*is).nHits() << " hits"
      << ", charge " << (*is).getCharge()
      << " and cluster energy " << superCluster->energy()
      << " PID "<<superCluster.id() ;
   }
  e.put(pSeeds) ;
  if (fromTrackerSeeds_ && prefilteredSeeds_) delete theInitialSeedColl;
 }

Member Data Documentation

Definition at line 76 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer().

Definition at line 64 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer(), and produce().

Definition at line 80 of file ElectronSeedProducer.h.

Referenced by produce().

unsigned long long ElectronSeedProducer::caloGeomCacheId_ [private]

Definition at line 81 of file ElectronSeedProducer.h.

Referenced by produce().

Definition at line 82 of file ElectronSeedProducer.h.

Referenced by produce().

unsigned long long ElectronSeedProducer::caloTopoCacheId_ [private]

Definition at line 83 of file ElectronSeedProducer.h.

Referenced by produce().

Definition at line 66 of file ElectronSeedProducer.h.

Referenced by beginRun(), and ElectronSeedProducer().

Definition at line 100 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer(), and produce().

Definition at line 77 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer(), produce(), and ~ElectronSeedProducer().

Definition at line 63 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer(), and produce().

Definition at line 67 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer(), produce(), and ~ElectronSeedProducer().

Definition at line 90 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer().

Definition at line 91 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer().

Definition at line 88 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer().

Definition at line 89 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer().

Definition at line 101 of file ElectronSeedProducer.h.

Referenced by beginRun(), ElectronSeedProducer(), and produce().

Definition at line 97 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer().

Definition at line 68 of file ElectronSeedProducer.h.

Referenced by beginRun(), and endRun().

Definition at line 62 of file ElectronSeedProducer.h.

Referenced by ElectronSeedProducer(), and produce().

Definition at line 70 of file ElectronSeedProducer.h.

Referenced by produce().