CMS 3D CMS Logo

Public Member Functions | Private Attributes

TSGFromL1Muon Class Reference

#include <TSGFromL1Muon.h>

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

List of all members.

Public Member Functions

virtual void beginRun (edm::Run &run, const edm::EventSetup &es)
virtual void produce (edm::Event &ev, const edm::EventSetup &es)
 TSGFromL1Muon (const edm::ParameterSet &cfg)
virtual ~TSGFromL1Muon ()

Private Attributes

edm::ParameterSet theConfig
PixelTrackFiltertheFilter
L1MuonPixelTrackFittertheFitter
OrderedHitsGeneratortheHitGenerator
L1MuonSeedsMergertheMerger
L1MuonRegionProducertheRegionProducer
edm::InputTag theSourceTag

Detailed Description

Description: EDPRoducer to generate L3MuonTracjectorySeed from L1MuonParticles

Author:
Marcin Konecki

Definition at line 22 of file TSGFromL1Muon.h.


Constructor & Destructor Documentation

TSGFromL1Muon::TSGFromL1Muon ( const edm::ParameterSet cfg)

Definition at line 48 of file TSGFromL1Muon.cc.

References edm::ParameterSet::getParameter(), and theSourceTag.

  : theConfig(cfg),theRegionProducer(0),theHitGenerator(0),theFitter(0),theFilter(0),theMerger(0)
{
  produces<L3MuonTrajectorySeedCollection>();
  theSourceTag = cfg.getParameter<edm::InputTag>("L1MuonLabel");
}
TSGFromL1Muon::~TSGFromL1Muon ( ) [virtual]

Definition at line 55 of file TSGFromL1Muon.cc.

References theFilter, theFitter, theHitGenerator, theMerger, and theRegionProducer.

{
  delete theMerger;
  delete theFilter;
  delete theFitter;
  delete theHitGenerator;
  delete theRegionProducer;
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 64 of file TSGFromL1Muon.cc.

References f, reco_skim_cfg_mod::filterName, reco::get(), edm::ParameterSet::getParameter(), AlCaHLTBitMon_ParallelJobs::p, theConfig, theFilter, theFitter, theHitGenerator, theMerger, and theRegionProducer.

{
  edm::ParameterSet regfactoryPSet = theConfig.getParameter<edm::ParameterSet>("RegionFactoryPSet");
  std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName");
  TrackingRegionProducer * p =
    TrackingRegionProducerFactory::get()->create(regfactoryName,regfactoryPSet);
  theRegionProducer = dynamic_cast<L1MuonRegionProducer* >(p);

  edm::ParameterSet hitsfactoryPSet =
      theConfig.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet");
  std::string hitsfactoryName = hitsfactoryPSet.getParameter<std::string>("ComponentName");
  theHitGenerator = OrderedHitsGeneratorFactory::get()->create( hitsfactoryName, hitsfactoryPSet);

  edm::ParameterSet fitterPSet = theConfig.getParameter<edm::ParameterSet>("FitterPSet");
  std::string fitterName = fitterPSet.getParameter<std::string>("ComponentName");
  PixelFitter * f = PixelFitterFactory::get()->create( fitterName, fitterPSet);
  theFitter = dynamic_cast<L1MuonPixelTrackFitter* >(f);

  edm::ParameterSet filterPSet = theConfig.getParameter<edm::ParameterSet>("FilterPSet");
  std::string  filterName = filterPSet.getParameter<std::string>("ComponentName");
  theFilter = PixelTrackFilterFactory::get()->create( filterName, filterPSet);

  edm::ParameterSet cleanerPSet = theConfig.getParameter<edm::ParameterSet>("CleanerPSet");
  std::string  cleanerName = cleanerPSet.getParameter<std::string>("ComponentName");
//  theMerger = PixelTrackCleanerFactory::get()->create( cleanerName, cleanerPSet);
  theMerger = new L1MuonSeedsMerger(cleanerPSet);
}
void TSGFromL1Muon::produce ( edm::Event ev,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 93 of file TSGFromL1Muon.cc.

References edm::Event::getByLabel(), i, SeedFromProtoTrack::isValid(), LogDebug, metsig::muon, edm::Event::put(), L1MuonRegionProducer::regions(), L1MuonSeedsMerger::resolve(), query::result, L1MuonPixelTrackFitter::run(), OrderedHitsGenerator::run(), L1MuonPixelTrackFitter::setL1Constraint(), L1MuonRegionProducer::setL1Constraint(), L1MuonPixelTrackFitter::setPxConstraint(), SeedingHitSet::size(), OrderedSeedingHits::size(), theFilter, theFitter, theHitGenerator, theMerger, theRegionProducer, theSourceTag, testEve_cfg::tracks, and SeedFromProtoTrack::trajectorySeed().

{
  std::auto_ptr<L3MuonTrajectorySeedCollection> result(new L3MuonTrajectorySeedCollection());

  edm::Handle<L1MuonParticleCollection> l1muon;
  ev.getByLabel(theSourceTag, l1muon);

  LogDebug("TSGFromL1Muon")<<l1muon->size()<<" l1 muons to seed from.";

  L1MuonParticleCollection::const_iterator muItr = l1muon->begin(); 
  L1MuonParticleCollection::const_iterator muEnd = l1muon->end(); 
  for  ( size_t iL1 = 0;  muItr < muEnd; ++muItr, ++iL1) {
       
    if (muItr->gmtMuonCand().empty()) continue;

    const L1MuGMTCand & muon = muItr->gmtMuonCand();
    l1extra::L1MuonParticleRef l1Ref(l1muon, iL1);

    theRegionProducer->setL1Constraint(muon);
    theFitter->setL1Constraint(muon);

    typedef std::vector<TrackingRegion * > Regions;
    Regions regions = theRegionProducer->regions(ev,es);
    for (Regions::const_iterator ir=regions.begin(); ir != regions.end(); ++ir) {

      L1MuonSeedsMerger::TracksAndHits tracks;
      const TrackingRegion & region = **ir;
      const OrderedSeedingHits & candidates = theHitGenerator->run(region,ev,es);

      unsigned int nSets = candidates.size();
      for (unsigned int ic= 0; ic <nSets; ic++) {

        const SeedingHitSet & hits =  candidates[ic]; 
        std::vector<const TrackingRecHit *> trh;
        for (unsigned int i= 0, nHits = hits.size(); i< nHits; ++i) trh.push_back( hits[i]->hit() );

        theFitter->setPxConstraint(hits);
        reco::Track* track = theFitter->run(es, trh, region);
        if (!track) continue;

        if (!(*theFilter)(track) ) { delete track; continue; }
        tracks.push_back(L1MuonSeedsMerger::TrackAndHits(track, hits));
      }
  
      if(theMerger) theMerger->resolve(tracks);
      for (L1MuonSeedsMerger::TracksAndHits::const_iterator it = tracks.begin();
        it != tracks.end(); ++it) {

        SeedFromProtoTrack seed( *(it->first), it->second, es);
        if (seed.isValid()) (*result).push_back(L3MuonTrajectorySeed(seed.trajectorySeed(),l1Ref));

//      GlobalError vtxerr( sqr(region->originRBound()), 0, sqr(region->originRBound()),
//                                               0, 0, sqr(region->originZBound()));
//      SeedFromConsecutiveHits seed( candidates[ic],region->origin(), vtxerr, es);
//      if (seed.isValid()) (*result).push_back( seed.TrajSeed() );
        delete it->first;
      }
    }
    for (Regions::const_iterator it=regions.begin(); it != regions.end(); ++it) delete (*it);
  }

  LogDebug("TSGFromL1Muon")<<result->size()<<" seeds to the event.";
  ev.put(result);
}

Member Data Documentation

Definition at line 31 of file TSGFromL1Muon.h.

Referenced by beginRun().

Definition at line 38 of file TSGFromL1Muon.h.

Referenced by beginRun(), produce(), and ~TSGFromL1Muon().

Definition at line 37 of file TSGFromL1Muon.h.

Referenced by beginRun(), produce(), and ~TSGFromL1Muon().

Definition at line 36 of file TSGFromL1Muon.h.

Referenced by beginRun(), produce(), and ~TSGFromL1Muon().

Definition at line 39 of file TSGFromL1Muon.h.

Referenced by beginRun(), produce(), and ~TSGFromL1Muon().

Definition at line 35 of file TSGFromL1Muon.h.

Referenced by beginRun(), produce(), and ~TSGFromL1Muon().

Definition at line 32 of file TSGFromL1Muon.h.

Referenced by produce(), and TSGFromL1Muon().