CMS 3D CMS Logo

Public Member Functions | Private Attributes

SeedGeneratorFromProtoTracksEDProducer Class Reference

#include <SeedGeneratorFromProtoTracksEDProducer.h>

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

List of all members.

Public Member Functions

virtual void produce (edm::Event &ev, const edm::EventSetup &es)
 SeedGeneratorFromProtoTracksEDProducer (const edm::ParameterSet &cfg)
virtual ~SeedGeneratorFromProtoTracksEDProducer ()

Private Attributes

edm::ParameterSet theConfig
edm::InputTag theInputCollectionTag

Detailed Description

Definition at line 11 of file SeedGeneratorFromProtoTracksEDProducer.h.


Constructor & Destructor Documentation

SeedGeneratorFromProtoTracksEDProducer::SeedGeneratorFromProtoTracksEDProducer ( const edm::ParameterSet cfg)

Definition at line 33 of file SeedGeneratorFromProtoTracksEDProducer.cc.

  : theConfig(cfg), theInputCollectionTag(cfg.getParameter<InputTag>("InputCollection"))
{
  produces<TrajectorySeedCollection>();
}
virtual SeedGeneratorFromProtoTracksEDProducer::~SeedGeneratorFromProtoTracksEDProducer ( ) [inline, virtual]

Definition at line 14 of file SeedGeneratorFromProtoTracksEDProducer.h.

{}

Member Function Documentation

void SeedGeneratorFromProtoTracksEDProducer::produce ( edm::Event ev,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 39 of file SeedGeneratorFromProtoTracksEDProducer.cc.

References edm::EventSetup::get(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), SeedFromProtoTrack::isValid(), reco::TrackBase::momentum(), edm::Handle< T >::product(), edm::Event::put(), reco::Track::recHit(), reco::Track::recHitsSize(), query::result, SeedFromConsecutiveHitsCreator_cfi::SeedFromConsecutiveHitsCreator, python::multivaluedict::sort(), mathSSE::sqrt(), theConfig, theInputCollectionTag, SeedFromProtoTrack::trajectorySeed(), and reco::TrackBase::vertex().

{
  std::auto_ptr<TrajectorySeedCollection> result(new TrajectorySeedCollection());
  Handle<reco::TrackCollection> trks;
  ev.getByLabel(theInputCollectionTag, trks);

  const TrackCollection &protos = *(trks.product());
  
  for (TrackCollection::const_iterator it=protos.begin(); it!= protos.end(); ++it) {
    const Track & proto = (*it);

    if (theConfig.getParameter<bool>("useProtoTrackKinematics")) {
      SeedFromProtoTrack seedFromProtoTrack( proto, es);
      if (seedFromProtoTrack.isValid()) (*result).push_back( seedFromProtoTrack.trajectorySeed() );
    } else {
      edm::ESHandle<TransientTrackingRecHitBuilder> ttrhbESH;
      std::string builderName = theConfig.getParameter<std::string>("TTRHBuilder");
      es.get<TransientRecHitRecord>().get(builderName,ttrhbESH);
      std::vector<Hit> hits;
      for (unsigned int iHit = 0, nHits = proto.recHitsSize(); iHit < nHits; ++iHit) {
        TrackingRecHitRef refHit = proto.recHit(iHit);
        if(refHit->isValid()) hits.push_back(ttrhbESH->build(  &(*refHit) ));
        sort(hits.begin(), hits.end(), HitLessByRadius());
      }
      if (hits.size() >= 2) {
        GlobalPoint vtx(proto.vertex().x(), proto.vertex().y(), proto.vertex().z());
        double mom_perp = sqrt(proto.momentum().x()*proto.momentum().x()+proto.momentum().y()*proto.momentum().y());
        GlobalTrackingRegion region(mom_perp, vtx, 0.2, 0.2);
        SeedFromConsecutiveHitsCreator().trajectorySeed(*result, SeedingHitSet(hits), region, es);
      }
    }
  } 

  ev.put(result);
}

Member Data Documentation

Definition at line 17 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

Definition at line 18 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().