CMS 3D CMS Logo

Public Member Functions | Private Attributes

TSGFromL2Muon Class Reference

#include <TSGFromL2Muon.h>

Inheritance diagram for TSGFromL2Muon:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Attributes

edm::ParameterSet theConfig
edm::InputTag theL2CollectionLabel
double thePCut
double thePtCut
MuonTrackingRegionBuildertheRegionBuilder
TrackerSeedCleanertheSeedCleaner
MuonServiceProxytheService
TrackerSeedGeneratortheTkSeedGenerator

Detailed Description

Definition at line 20 of file TSGFromL2Muon.h.


Constructor & Destructor Documentation

TSGFromL2Muon::TSGFromL2Muon ( const edm::ParameterSet cfg)

Definition at line 25 of file TSGFromL2Muon.cc.

References edm::ParameterSet::empty(), reco::get(), edm::ParameterSet::getParameter(), MuonServiceProxy_cff::MuonServiceProxy, AlCaHLTBitMon_QueryRunRegistry::string, theConfig, theL2CollectionLabel, thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, and theTkSeedGenerator.

  : theConfig(cfg), theService(0), theRegionBuilder(0), theTkSeedGenerator(0), theSeedCleaner(0)
{
  produces<L3MuonTrajectorySeedCollection>();

  edm::ParameterSet serviceParameters = cfg.getParameter<edm::ParameterSet>("ServiceParameters");
  theService = new MuonServiceProxy(serviceParameters);

  thePtCut = cfg.getParameter<double>("PtCut");
  thePCut = cfg.getParameter<double>("PCut");

  theL2CollectionLabel = cfg.getParameter<edm::InputTag>("MuonCollectionLabel");

  //region builder
  edm::ParameterSet regionBuilderPSet = theConfig.getParameter<edm::ParameterSet>("MuonTrackingRegionBuilder");
  //ability to no define a region
  if (!regionBuilderPSet.empty()){
    theRegionBuilder = new MuonTrackingRegionBuilder(regionBuilderPSet);
  }

  //seed generator
  //std::string seedGenPSetLabel = theConfig.getParameter<std::string>("tkSeedGenerator");
  //edm::ParameterSet seedGenPSet = theConfig.getParameter<edm::ParameterSet>(seedGenPSetLabel);
  edm::ParameterSet seedGenPSet = theConfig.getParameter<edm::ParameterSet>("TkSeedGenerator");
  std::string seedGenName = seedGenPSet.getParameter<std::string>("ComponentName");

  theTkSeedGenerator = TrackerSeedGeneratorFactory::get()->create(seedGenName, seedGenPSet);  
  
  //seed cleaner
  edm::ParameterSet trackerSeedCleanerPSet = theConfig.getParameter<edm::ParameterSet>("TrackerSeedCleaner");
  //to activate or not the cleaner
  if (!trackerSeedCleanerPSet.empty()){
    theSeedCleaner = new TrackerSeedCleaner(trackerSeedCleanerPSet);
  }

}
TSGFromL2Muon::~TSGFromL2Muon ( ) [virtual]

Member Function Documentation

void TSGFromL2Muon::beginRun ( const edm::Run run,
const edm::EventSetup es 
) [override, virtual]
void TSGFromL2Muon::produce ( edm::Event ev,
const edm::EventSetup es 
) [override, virtual]

Implements edm::EDProducer.

Definition at line 81 of file TSGFromL2Muon.cc.

References TrackerSeedCleaner::clean(), edm::EventSetup::get(), edm::Event::getByLabel(), LogDebug, edm::ESHandle< T >::product(), edm::Event::put(), MuonTrackingRegionBuilder::region(), query::result, MuonTrackingRegionBuilder::setEvent(), TrackerSeedGenerator::setEvent(), TrackerSeedCleaner::setEvent(), theL2CollectionLabel, thePCut, thePtCut, theRegionBuilder, theSeedCleaner, theService, theTkSeedGenerator, TrackerSeedGenerator::trackerSeeds(), and MuonServiceProxy::update().

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

  //Retrieve tracker topology from geometry
  edm::ESHandle<TrackerTopology> tTopoHand;
  es.get<IdealGeometryRecord>().get(tTopoHand);
  const TrackerTopology *tTopo=tTopoHand.product();


  //intialize tools
  theService->update(es);
  theTkSeedGenerator->setEvent(ev);
  if (theRegionBuilder)  theRegionBuilder->setEvent(ev);
  if (theSeedCleaner) theSeedCleaner->setEvent(ev);

  //retrieve L2 track collection
  edm::Handle<reco::TrackCollection> l2muonH;
  ev.getByLabel(theL2CollectionLabel ,l2muonH); 

  // produce trajectoryseed collection
  unsigned int imu=0;
  unsigned int imuMax=l2muonH->size();
  LogDebug("TSGFromL2Muon")<<imuMax<<" l2 tracks.";

  for (;imu!=imuMax;++imu){
    //make a ref to l2 muon
    reco::TrackRef muRef(l2muonH, imu);
    
    // cut on muons with low momenta
    if ( muRef->pt() < thePtCut 
         || muRef->innerMomentum().Rho() < thePtCut 
         || muRef->innerMomentum().R() < thePCut ) continue;
    
    //define the region of interest
    std::unique_ptr<RectangularEtaPhiTrackingRegion> region;
    if(theRegionBuilder){
      region.reset(theRegionBuilder->region(muRef));
    }
    
    //get the seeds
    std::vector<TrajectorySeed> tkSeeds;
    //make this stupid TrackCand
    std::pair<const Trajectory*,reco::TrackRef> staCand((Trajectory*)(0), muRef);
    theTkSeedGenerator->trackerSeeds(staCand, *region, tTopo,tkSeeds);

    //Seed Cleaner From Direction
    //clean them internatly
    if(theSeedCleaner){
       theSeedCleaner->clean(muRef,*region,tkSeeds);
       LogDebug("TSGFromL2Muon") << tkSeeds.size() << " seeds for this L2 afther cleaning.";
    }

    unsigned int is=0;
    unsigned int isMax=tkSeeds.size();
    LogDebug("TSGFromL2Muon")<<isMax<<" seeds for this L2.";
    for (;is!=isMax;++is){
      result->push_back( L3MuonTrajectorySeed(tkSeeds[is], muRef));
    }//tkseed loop
    
  }//l2muon loop
  

  //ADDME
  //remove seed duplicate, keeping the ref to L2

  LogDebug("TSGFromL2Muon")<<result->size()<<" trajectory seeds to the events";

  //put in the event
  ev.put(result);
}

Member Data Documentation

Definition at line 28 of file TSGFromL2Muon.h.

Referenced by TSGFromL2Muon().

Definition at line 29 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

double TSGFromL2Muon::thePCut [private]

Definition at line 32 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

double TSGFromL2Muon::thePtCut [private]

Definition at line 32 of file TSGFromL2Muon.h.

Referenced by produce(), and TSGFromL2Muon().

Definition at line 33 of file TSGFromL2Muon.h.

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

Definition at line 35 of file TSGFromL2Muon.h.

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

Definition at line 31 of file TSGFromL2Muon.h.

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

Definition at line 34 of file TSGFromL2Muon.h.

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