CMS 3D CMS Logo

Public Member Functions | Private Attributes

EgammaHLTRegionalPixelSeedGeneratorProducers Class Reference

#include <EgammaHLTRegionalPixelSeedGeneratorProducers.h>

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

List of all members.

Public Member Functions

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

Private Attributes

edm::InputTag BSProducer_
edm::InputTag candTag_
edm::InputTag candTagEle_
SeedGeneratorFromRegionHitscombinatorialSeedGenerator
edm::ParameterSet conf_
double deltaEta_
double deltaPhi_
double halflength_
double originradius_
double originz_
double ptmin_
bool useZvertex_
double vertexz_

Detailed Description

Definition at line 25 of file EgammaHLTRegionalPixelSeedGeneratorProducers.h.


Constructor & Destructor Documentation

EgammaHLTRegionalPixelSeedGeneratorProducers::EgammaHLTRegionalPixelSeedGeneratorProducers ( const edm::ParameterSet conf) [explicit]

Definition at line 47 of file EgammaHLTRegionalPixelSeedGeneratorProducers.cc.

References BSProducer_, candTag_, candTagEle_, conf_, deltaEta_, deltaPhi_, edm::ParameterSet::getParameter(), halflength_, originradius_, ptmin_, useZvertex_, and vertexz_.

                                                                                                                      :   conf_(conf),combinatorialSeedGenerator(0)
{

  produces<TrajectorySeedCollection>();

  ptmin_       = conf_.getParameter<double>("ptMin");
  vertexz_     = conf_.getParameter<double>("vertexZ");
  originradius_= conf_.getParameter<double>("originRadius");
  halflength_  = conf_.getParameter<double>("originHalfLength");
  deltaEta_    = conf_.getParameter<double>("deltaEtaRegion");
  deltaPhi_    = conf_.getParameter<double>("deltaPhiRegion");
  candTag_     = conf_.getParameter< edm::InputTag > ("candTag");
  candTagEle_  = conf_.getParameter< edm::InputTag > ("candTagEle");
  useZvertex_  = conf_.getParameter<bool>("UseZInVertex");
  BSProducer_ = conf.getParameter<edm::InputTag>("BSProducer");
  // setup orderedhits setup (in order to tell seed generator to use pairs/triplets, which layers)
}
EgammaHLTRegionalPixelSeedGeneratorProducers::~EgammaHLTRegionalPixelSeedGeneratorProducers ( ) [virtual]

Definition at line 66 of file EgammaHLTRegionalPixelSeedGeneratorProducers.cc.

                                                                                            { 
}  

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 76 of file EgammaHLTRegionalPixelSeedGeneratorProducers.cc.

References edm::ParameterSet::addParameter(), combinatorialSeedGenerator, conf_, SurfaceDeformationFactory::create(), reco::get(), and edm::ParameterSet::getParameter().

{
  edm::ParameterSet hitsfactoryPSet =
      conf_.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet");
  std::string hitsfactoryName = hitsfactoryPSet.getParameter<std::string>("ComponentName");

  // get orderd hits generator from factory
  OrderedHitsGenerator*  hitsGenerator =
        OrderedHitsGeneratorFactory::get()->create( hitsfactoryName, hitsfactoryPSet);

  // start seed generator
  // FIXME??
  edm::ParameterSet creatorPSet;
  creatorPSet.addParameter<std::string>("propagator","PropagatorWithMaterial");

  combinatorialSeedGenerator = new SeedGeneratorFromRegionHits( hitsGenerator, 0, 
                                                 SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator", creatorPSet)
                                                              );
}
void EgammaHLTRegionalPixelSeedGeneratorProducers::endRun ( edm::Run run,
const edm::EventSetup es 
) [virtual]
void EgammaHLTRegionalPixelSeedGeneratorProducers::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 97 of file EgammaHLTRegionalPixelSeedGeneratorProducers.cc.

References BSProducer_, candTag_, candTagEle_, combinatorialSeedGenerator, deltaEta_, deltaPhi_, edm::Event::getByLabel(), halflength_, originradius_, convertSQLitetoXML_cfg::output, ptmin_, edm::Event::put(), SeedGeneratorFromRegionHits::run(), and useZvertex_.

{

  // resulting collection
  std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection());    

  // Get the recoEcalCandidates
  edm::Handle<reco::RecoEcalCandidateCollection> recoecalcands;
  iEvent.getByLabel(candTag_,recoecalcands);

  //Get the Beam Spot position
  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
  // iEvent.getByType(recoBeamSpotHandle);
  iEvent.getByLabel(BSProducer_,recoBeamSpotHandle);
  // gets its position
  const BeamSpot::Point& BSPosition = recoBeamSpotHandle->position(); 

  //Get the HLT electrons collection if needed
  edm::Handle<reco::ElectronCollection> electronHandle;
  if(useZvertex_){iEvent.getByLabel(candTagEle_,electronHandle);}

  reco::SuperClusterRef scRef;
  for (reco::RecoEcalCandidateCollection::const_iterator recoecalcand= recoecalcands->begin(); recoecalcand!=recoecalcands->end(); recoecalcand++) {
    scRef = recoecalcand->superCluster();
    float zvertex = 0;
    if( useZvertex_ ){
      reco::SuperClusterRef scRefEle;
      for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){
        //Compare electron SC with EcalCandidate SC
        scRefEle = iElectron->superCluster();
        if(&(*scRef) == &(*scRefEle)){
          if(iElectron->track().isNonnull()) zvertex = iElectron->track()->vz();
          else  zvertex = iElectron->gsfTrack()->vz();
          break;
        }
      }

    }
    GlobalVector dirVector((recoecalcand)->px(),(recoecalcand)->py(),(recoecalcand)->pz());
    RectangularEtaPhiTrackingRegion etaphiRegion( dirVector,
                                                                                           GlobalPoint( BSPosition.x(), BSPosition.y(), zvertex ), 
                                                                                           ptmin_,
                                                                                           originradius_,
                                                                                           halflength_,
                                                                                           deltaEta_,
                                                                                           deltaPhi_);

    // fill Trajectory seed collection
    combinatorialSeedGenerator->run(*output, etaphiRegion, iEvent, iSetup);
    
  }

    iEvent.put(output);
}

Member Data Documentation

Definition at line 41 of file EgammaHLTRegionalPixelSeedGeneratorProducers.h.

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