CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FastElectronSeedProducer Class Reference

#include <FastElectronSeedProducer.h>

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

List of all members.

Public Member Functions

virtual void beginRun (edm::Run &run, const edm::EventSetup &es)
 FastElectronSeedProducer (const edm::ParameterSet &conf)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~FastElectronSeedProducer ()

Private Member Functions

void filterClusters (const edm::Handle< reco::SuperClusterCollection > &superClusters, reco::SuperClusterRefVector &sclRefs)

Private Attributes

edm::ESHandle< CaloGeometrycaloGeom_
unsigned long long caloGeomCacheId_
edm::InputTag clusters_ [2]
bool fromTrackerSeeds_
EgammaHcalIsolationhcalIso_
edm::InputTag hcalRecHits_
const HBHERecHitCollectionhithbhe_
double hOverEConeSize_
double hOverEHBMinE_
double hOverEHFMinE_
TrajectorySeedCollectioninitialSeedColl_
edm::InputTag initialSeeds_
FastElectronSeedGeneratormatcher_
double maxHOverE_
HBHERecHitMetaCollectionmhbhe_
double SCEtCut_
edm::InputTag simTracks_
edm::InputTag trackerHits_

Detailed Description

Definition at line 33 of file FastElectronSeedProducer.h.


Constructor & Destructor Documentation

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

Description: EDProducer of ElectronGSPixelSeed objects

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

Definition at line 45 of file FastElectronSeedProducer.cc.

References clusters_, fromTrackerSeeds_, edm::ParameterSet::getParameter(), hcalRecHits_, hOverEConeSize_, hOverEHBMinE_, hOverEHFMinE_, initialSeeds_, matcher_, maxHOverE_, MultipleCompare::pset, SCEtCut_, simTracks_, and trackerHits_.

 : matcher_(0), caloGeomCacheId_(0), hcalIso_(0), /*doubleConeSel_(0),*/ mhbhe_(0)
 {
  edm::ParameterSet pset = iConfig.getParameter<edm::ParameterSet>("SeedConfiguration");
  SCEtCut_=pset.getParameter<double>("SCEtCut");
  maxHOverE_=pset.getParameter<double>("maxHOverE");
  hOverEConeSize_=pset.getParameter<double>("hOverEConeSize");
  hOverEHBMinE_=pset.getParameter<double>("hOverEHBMinE");
  hOverEHFMinE_=pset.getParameter<double>("hOverEHFMinE");
  fromTrackerSeeds_=pset.getParameter<bool>("fromTrackerSeeds");
  initialSeeds_=pset.getParameter<edm::InputTag>("initialSeeds");

  matcher_ = new FastElectronSeedGenerator(pset,
                                              iConfig.getParameter<double>("pTMin"),
                                              iConfig.getParameter<edm::InputTag>("beamSpot"));

 //  get labels from config'
  clusters_[0]=iConfig.getParameter<edm::InputTag>("barrelSuperClusters");
  clusters_[1]=iConfig.getParameter<edm::InputTag>("endcapSuperClusters");
  simTracks_=iConfig.getParameter<edm::InputTag>("simTracks");
  trackerHits_=iConfig.getParameter<edm::InputTag>("trackerHits");
  hcalRecHits_= pset.getParameter<edm::InputTag>("hcalRecHits");

  //register your products
  produces<reco::ElectronSeedCollection>();

}
FastElectronSeedProducer::~FastElectronSeedProducer ( ) [virtual]

Definition at line 74 of file FastElectronSeedProducer.cc.

References hcalIso_, matcher_, and mhbhe_.

 {
  // do anything here that needs to be done at desctruction time
  // (e.g. close files, deallocate resources etc.)
  delete matcher_ ;
  delete mhbhe_ ;
  //delete doubleConeSel_ ;
  delete hcalIso_ ;
 }

Member Function Documentation

void FastElectronSeedProducer::beginRun ( edm::Run run,
const edm::EventSetup es 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 85 of file FastElectronSeedProducer.cc.

References edm::eventsetup::EventSetupRecord::cacheIdentifier(), caloGeom_, caloGeomCacheId_, edm::EventSetup::get(), matcher_, and FastElectronSeedGenerator::setupES().

 {
  // get calo geometry
  if (caloGeomCacheId_!=es.get<CaloGeometryRecord>().cacheIdentifier())
   {
        es.get<CaloGeometryRecord>().get(caloGeom_);
        caloGeomCacheId_=es.get<CaloGeometryRecord>().cacheIdentifier();
   }

//  // The H/E calculator
//  calc_=HoECalculator(caloGeom_);

  matcher_->setupES(es) ;

 }
void FastElectronSeedProducer::filterClusters ( const edm::Handle< reco::SuperClusterCollection > &  superClusters,
reco::SuperClusterRefVector sclRefs 
) [private]

Definition at line 168 of file FastElectronSeedProducer.cc.

References reco::CaloCluster::energy(), reco::CaloCluster::eta(), i, LogDebug, edm::RefVector< C, T, F >::push_back(), and edm::RefVector< C, T, F >::size().

Referenced by produce().

 {
  // filter the superclusters
  // - with EtCut
  // - with HoE using calo cone
  for (unsigned int i=0;i<superClusters->size();++i)
   {
    const reco::SuperCluster & scl=(*superClusters)[i] ;
    if (scl.energy()/cosh(scl.eta())>SCEtCut_)
     {
//      //double HoE=calc_(&scl,mhbhe);
//        double HoE = 0. ;
//      double hcalE = 0. ;
//      if (mhbhe_)
//       {
//        math::XYZPoint caloPos = scl.position() ;
//        GlobalPoint pclu(caloPos.x(),caloPos.y(),caloPos.z()) ;
//        std::auto_ptr<CaloRecHitMetaCollectionV> chosen
//         = doubleConeSel_->select(pclu,*mhbhe_) ;
//        CaloRecHitMetaCollectionV::const_iterator i ;
//        for ( i = chosen->begin () ; i != chosen->end () ; ++i )
//         {
//          double hcalHit_E = i->energy() ;
//          if ( i->detid().subdetId()==HcalBarrel && hcalHit_E > hOverEHBMinE_)
//           { hcalE += hcalHit_E ; } //HB case
//          //if ( i->detid().subdetId()==HcalBarrel)
//          // { std::cout << "[ElectronSeedProducer] HcalBarrel: hcalHit_E, hOverEHBMinE_ " << hcalHit_E << " " << hOverEHBMinE_ << std::endl; }
//          if ( i->detid().subdetId()==HcalEndcap && hcalHit_E > hOverEHFMinE_)
//           { hcalE += hcalHit_E ; } //HF case
//          //if ( i->detid().subdetId()==HcalEndcap)
//          // { std::cout << "[ElectronSeedProducer] HcalEndcap: hcalHit_E, hOverEHFMinE_ " << hcalHit_E << " " << hOverEHFMinE_ << std::endl; }
//         }
//       }
//      HoE = hcalE/scl.energy() ;
      //double hcalE = hcalHelper_->hcalESum(scl), HoE = hcalE/scl.energy() ;
      double newHcalE = hcalIso_->getHcalESum(&scl), newHoE = newHcalE/scl.energy() ;
      //std::cout << "[ElectronSeedProducer] HoE, maxHOverE_ " << newHoE << " " << HoE << " " << maxHOverE_ << std::endl ;
      if (newHoE<=maxHOverE_)
       { sclRefs.push_back(edm::Ref<reco::SuperClusterCollection>(superClusters,i)) ; }
     }
   }

  LogDebug("ElectronSeedProducer")<<"Filtered out "
    <<sclRefs.size()<<" superclusters from "<<superClusters->size() ;
 }
void FastElectronSeedProducer::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 102 of file FastElectronSeedProducer.cc.

References caloGeom_, clusters_, filterClusters(), fromTrackerSeeds_, edm::Event::getByLabel(), hcalIso_, hcalRecHits_, hOverEConeSize_, hOverEHBMinE_, hOverEHFMinE_, i, initialSeedColl_, initialSeeds_, LogDebug, matcher_, mhbhe_, edm::Handle< T >::product(), edm::Event::put(), FastElectronSeedGenerator::run(), simTracks_, and trackerHits_.

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

  // get initial TrajectorySeeds if necessary
  if (fromTrackerSeeds_) {

    edm::Handle<TrajectorySeedCollection> hSeeds;
    e.getByLabel(initialSeeds_, hSeeds);
    initialSeedColl_ = const_cast<TrajectorySeedCollection *> (hSeeds.product());

  } else {

    initialSeedColl_=0;// not needed in this case

  }

  reco::ElectronSeedCollection * seeds = new reco::ElectronSeedCollection ;

  // Get the Monte Carlo truth (SimTracks)
  edm::Handle<edm::SimTrackContainer> theSTC;
  e.getByLabel(simTracks_,theSTC);
  const edm::SimTrackContainer* theSimTracks = &(*theSTC);

  // Get the collection of Tracker RecHits
  edm::Handle<SiTrackerGSMatchedRecHit2DCollection> theRHC;
  e.getByLabel(trackerHits_, theRHC);
  const SiTrackerGSMatchedRecHit2DCollection* theGSRecHits = &(*theRHC);

  // get Hcal Rechit collection
  edm::Handle<HBHERecHitCollection> hbhe ;
  delete mhbhe_ ;
  if (e.getByLabel(hcalRecHits_,hbhe))
   { mhbhe_=  new HBHERecHitMetaCollection(*hbhe) ; }
  else
   { mhbhe_ = 0 ; }

  // define cone for H/E
//  delete doubleConeSel_;
//  doubleConeSel_ = new CaloDualConeSelector(0.,hOverEConeSize_,caloGeom_.product(),DetId::Hcal) ;

  // HCAL iso deposits
  delete hcalIso_ ;
  hcalIso_ = new EgammaHcalIsolation(hOverEConeSize_,0.,hOverEHBMinE_,hOverEHFMinE_,0.,0.,caloGeom_,mhbhe_) ;

  // Get the two supercluster collections
  for (unsigned int i=0; i<2; i++) {

    // invoke algorithm
    edm::Handle<reco::SuperClusterCollection> clusters;
    e.getByLabel(clusters_[i],clusters);
    reco::SuperClusterRefVector clusterRefs;
    filterClusters(clusters,/*mhbhe_,*/clusterRefs) ;
    matcher_->run(e,clusterRefs,theGSRecHits,theSimTracks,initialSeedColl_,*seeds);

  }

  // Save event content
  std::auto_ptr<reco::ElectronSeedCollection> pSeeds(seeds) ;
  e.put(pSeeds);

}

Member Data Documentation

Definition at line 73 of file FastElectronSeedProducer.h.

Referenced by beginRun(), and produce().

unsigned long long FastElectronSeedProducer::caloGeomCacheId_ [private]

Definition at line 74 of file FastElectronSeedProducer.h.

Referenced by beginRun().

Definition at line 58 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer(), and produce().

Definition at line 86 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer(), and produce().

Definition at line 75 of file FastElectronSeedProducer.h.

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

Definition at line 61 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer(), and produce().

Definition at line 68 of file FastElectronSeedProducer.h.

Definition at line 81 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer(), and produce().

Definition at line 82 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer(), and produce().

Definition at line 83 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer(), and produce().

Definition at line 69 of file FastElectronSeedProducer.h.

Referenced by produce().

Definition at line 62 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer(), and produce().

Definition at line 80 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer().

Definition at line 77 of file FastElectronSeedProducer.h.

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

Definition at line 84 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer().

Definition at line 59 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer(), and produce().

Definition at line 60 of file FastElectronSeedProducer.h.

Referenced by FastElectronSeedProducer(), and produce().