CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

GlobalMuonProducer Class Reference

#include <GlobalMuonProducer.h>

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

List of all members.

Public Member Functions

 GlobalMuonProducer (const edm::ParameterSet &)
 constructor with config
virtual void produce (edm::Event &, const edm::EventSetup &)
 reconstruct muons
virtual ~GlobalMuonProducer ()
 destructor

Private Member Functions

void setAlias (std::string alias)

Private Attributes

std::string theAlias
MuonServiceProxytheService
 the event setup proxy, it takes care the services update
edm::InputTag theSTACollectionLabel
 STA Label.
MuonTrackFindertheTrackFinder

Detailed Description

Global muon reconstructor: reconstructs muons using DT, CSC, RPC and tracker information,
starting from a standalone reonstructed muon.

Date:
2010/11/19 22:06:12
Revision:
1.36
Author:
R.Bellan - INFN TO

Global muon reconstructor: reconstructs muons using DT, CSC, RPC and tracker information,
starting from a standalone reonstructed muon.

Date:
2007/10/07 17:28:01
Revision:
1.11
Author:
R.Bellan - INFN TO

Definition at line 25 of file GlobalMuonProducer.h.


Constructor & Destructor Documentation

GlobalMuonProducer::GlobalMuonProducer ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 45 of file GlobalMuonProducer.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::getParameter(), LogTrace, and MuonServiceProxy_cff::MuonServiceProxy.

                                                                       {

  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "constructor called" << endl;

  // Parameter set for the Builder
  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("GLBTrajBuilderParameters");
  InputTag trackCollectionTag = parameterSet.getParameter<InputTag>("TrackerCollectionLabel");
  trajectoryBuilderParameters.addParameter<InputTag>("TrackerCollectionLabel",trackCollectionTag);
  
  // STA Muon Collection Label
  theSTACollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");

  // service parameters
  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");

  // TrackLoader parameters
  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
  
  // the services
  theService = new MuonServiceProxy(serviceParameters);
  
  // instantiate the concrete trajectory builder in the Track Finder
  MuonTrackLoader* mtl = new MuonTrackLoader(trackLoaderParameters,theService);
  GlobalMuonTrajectoryBuilder* gmtb = new GlobalMuonTrajectoryBuilder(trajectoryBuilderParameters, theService);

  theTrackFinder = new MuonTrackFinder(gmtb, mtl);

  setAlias(parameterSet.getParameter<std::string>("@module_label"));
  produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
  produces<TrackingRecHitCollection>().setBranchAlias(theAlias + "RecHits");
  produces<reco::TrackExtraCollection>().setBranchAlias(theAlias + "TrackExtras");
  produces<vector<Trajectory> >().setBranchAlias(theAlias + "Trajectories") ;
  produces<TrajTrackAssociationCollection>().setBranchAlias(theAlias + "TrajTrackMap");
  produces<reco::MuonTrackLinksCollection>().setBranchAlias(theAlias + "s");
}
GlobalMuonProducer::~GlobalMuonProducer ( ) [virtual]

destructor

Definition at line 85 of file GlobalMuonProducer.cc.

References LogTrace.

                                        {

  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "destructor called" << endl;
  if (theService) delete theService;
  if (theTrackFinder) delete theTrackFinder;

}

Member Function Documentation

void GlobalMuonProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

reconstruct muons

Implements edm::EDProducer.

Definition at line 97 of file GlobalMuonProducer.cc.

References edm::Event::getByLabel(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), LogTrace, metname, and position.

                                                                           {
  const string metname = "Muon|RecoMuon|GlobalMuonProducer";  
  LogTrace(metname)<<endl<<endl<<endl;
  LogTrace(metname)<<"Global Muon Reconstruction started"<<endl;  

  // Update the services
  theService->update(eventSetup);

  // Take the STA muon container(s)
  Handle<reco::TrackCollection> staMuons;
  event.getByLabel(theSTACollectionLabel,staMuons);

  Handle<vector<Trajectory> > staMuonsTraj;

  LogTrace(metname) << "Taking " << staMuons->size() << " Stand Alone Muons "<<theSTACollectionLabel<<endl;

  vector<MuonTrajectoryBuilder::TrackCand> staTrackCands;

  edm::Handle<TrajTrackAssociationCollection> staAssoMap;

  edm::Handle<reco::TrackToTrackMap> updatedStaAssoMap;

  if( event.getByLabel(theSTACollectionLabel.label(), staMuonsTraj) && event.getByLabel(theSTACollectionLabel.label(),staAssoMap) && event.getByLabel(theSTACollectionLabel.label(),updatedStaAssoMap) ) {    
    
    for(TrajTrackAssociationCollection::const_iterator it = staAssoMap->begin(); it != staAssoMap->end(); ++it){        
      const Ref<vector<Trajectory> > traj = it->key;
      const reco::TrackRef tkRegular  = it->val;
      reco::TrackRef tkUpdated;
      reco::TrackToTrackMap::const_iterator iEnd;
      reco::TrackToTrackMap::const_iterator iii;
      if ( theSTACollectionLabel.instance() == "UpdatedAtVtx") {
        iEnd = updatedStaAssoMap->end();
        iii = updatedStaAssoMap->find(it->val);
        if (iii != iEnd ) tkUpdated = (*updatedStaAssoMap)[it->val] ;
      }
      
      int etaFlip1 = ((tkUpdated.isNonnull() && tkRegular.isNonnull()) && ( (tkUpdated->eta() * tkRegular->eta() ) < 0)) ? -1 : 1; 
      
      const reco::TrackRef tk = ( tkUpdated.isNonnull() && etaFlip1==1 ) ? tkUpdated : tkRegular ;

      MuonTrajectoryBuilder::TrackCand tkCand = MuonTrajectoryBuilder::TrackCand((Trajectory*)(0),tk);
      if( traj->isValid() ) tkCand.first = &*traj ;
      staTrackCands.push_back(tkCand);
    }
  } else {
    for ( unsigned int position = 0; position != staMuons->size(); ++position ) {
      reco::TrackRef staTrackRef(staMuons,position);
      MuonTrajectoryBuilder::TrackCand staCand = MuonTrajectoryBuilder::TrackCand((Trajectory*)(0),staTrackRef);
      staTrackCands.push_back(staCand); 
    }
  }
    
  theTrackFinder->reconstruct(staTrackCands, event);      
  
  
  LogTrace(metname)<<"Event loaded"
                   <<"================================"
                   <<endl<<endl;
    
}
void GlobalMuonProducer::setAlias ( std::string  alias) [inline, private]

Definition at line 50 of file GlobalMuonProducer.h.

References theAlias.

                                  {
    alias.erase( alias.size() - 1, alias.size() );
    theAlias=alias;
  }

Member Data Documentation

std::string GlobalMuonProducer::theAlias [private]

Definition at line 48 of file GlobalMuonProducer.h.

Referenced by setAlias().

the event setup proxy, it takes care the services update

Definition at line 46 of file GlobalMuonProducer.h.

STA Label.

Definition at line 41 of file GlobalMuonProducer.h.

Definition at line 43 of file GlobalMuonProducer.h.