CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FastL3MuonTrajectoryBuilder Class Reference

#include <FastL3MuonTrajectoryBuilder.h>

Inheritance diagram for FastL3MuonTrajectoryBuilder:
GlobalTrajectoryBuilderBase MuonTrajectoryBuilder

List of all members.

Public Member Functions

void clear ()
 clear memory
 FastL3MuonTrajectoryBuilder (const edm::ParameterSet &, const MuonServiceProxy *)
 constructor with Parameter Set and MuonServiceProxy
virtual void setEvent (const edm::Event &)
 pass the Event to the algo at each event
MuonTrajectoryBuilder::CandidateContainer trajectories (const TrackCand &)
 reconstruct trajectories from standalone and tracker only Tracks
 ~FastL3MuonTrajectoryBuilder ()
 destructor

Private Member Functions

std::vector< TrackCandmakeTkCandCollection (const TrackCand &)
 make a TrackCand collection using tracker Track, Trajectory information
TC makeTrajsFromSeeds (const std::vector< TrajectorySeed > &) const
 build a tracker Trajectory from a seed

Private Attributes

TrackCand dummyStaCand
std::vector< TrackCandregionalTkTracks
const edm::EventtheEvent
bool theFirstEvent
edm::InputTag theSimModule
edm::ESHandle< TrajectoryBuildertheTkBuilder
std::string theTkBuilderName
TrackerSeedGeneratortheTkSeedGenerator
bool theTkTrajsAvailableFlag
edm::InputTag theTrackerTrajectoryCollection
TrajectoryCleanertheTrajectoryCleaner

Detailed Description

class to build muon trajectory from STA L2 muons and tracker tracks

Date:
2008/05/14 17:43:23
Revision:
1.6
Author:
Patrick Janot - CERN

Definition at line 41 of file FastL3MuonTrajectoryBuilder.h.


Constructor & Destructor Documentation

FastL3MuonTrajectoryBuilder::FastL3MuonTrajectoryBuilder ( const edm::ParameterSet par,
const MuonServiceProxy service 
)

constructor with Parameter Set and MuonServiceProxy

Class: FastL3MuonTrajectoryBuilder

Description: Reconstruct muons starting from a muon track reconstructed in the standalone muon system (with DT, CSC and RPC information) and from already reconstructed tracker tracks. It performs matching between the reconstructed tracks in the muon system and the tracker.

Date:
2008/12/17 07:04:58
Revision:
1.10

Authors : Patrick Janot - CERN

Definition at line 50 of file FastL3MuonTrajectoryBuilder.cc.

References edm::ParameterSet::getParameter(), cmsCodeRules::cppFunctionSkipper::operator, refitMuons_cfi::refitMuons, theFirstEvent, and theTrackerTrajectoryCollection.

: 
  GlobalTrajectoryBuilderBase(par, service), 
  theTkSeedGenerator(0), theTrajectoryCleaner(0) 
{

  theFirstEvent = true;
  
  theTrackerTrajectoryCollection = par.getParameter<edm::InputTag>("TrackerTrajectories");

#ifdef FAMOS_DEBUG
  dbe = edm::Service<DQMStore>().operator->();
  matchMuons = dbe->book1D("MatchMuons", "Eta distribution (match)",100,-2.5,2.5);
  refitMuons = dbe->book1D("RefitMuons", "Eta distribution (refit)",100,-2.5,2.5);
#endif

}
FastL3MuonTrajectoryBuilder::~FastL3MuonTrajectoryBuilder ( )

destructor

Definition at line 74 of file FastL3MuonTrajectoryBuilder.cc.

References theTrajectoryCleaner.

                                                          {
  if (theTrajectoryCleaner) delete theTrajectoryCleaner;
#ifdef FAMOS_DEBUG
  dbe->save("test.root");
#endif
}

Member Function Documentation

void FastL3MuonTrajectoryBuilder::clear ( void  )

clear memory

Definition at line 220 of file FastL3MuonTrajectoryBuilder.cc.

References regionalTkTracks.

                                   { 
  std::vector<TrackCand>::const_iterator is = regionalTkTracks.begin();
  std::vector<TrackCand>::const_iterator il = regionalTkTracks.end();
  for ( ; is != il; ++is) {
    delete (*is).first;   
  }
}
std::vector< FastL3MuonTrajectoryBuilder::TrackCand > FastL3MuonTrajectoryBuilder::makeTkCandCollection ( const TrackCand staCand) [private, virtual]

make a TrackCand collection using tracker Track, Trajectory information

Implements GlobalTrajectoryBuilderBase.

Definition at line 173 of file FastL3MuonTrajectoryBuilder.cc.

References edm::Event::getByLabel(), theEvent, and theTrackerTrajectoryCollection.

Referenced by setEvent().

                                                                          {

  // const std::string category = "Muon|RecoMuon|FastL3MuonTrajectoryBuilder|makeTkCandCollection";

  std::vector<TrackCand> tkCandColl;  

  // Get the tracker tracks
  edm:: Handle<std::vector<Trajectory> > theTrajectories;
  edm::Handle<TrajTrackAssociationCollection> theAssoMap;  
  theEvent->getByLabel(theTrackerTrajectoryCollection,theTrajectories);
  theEvent->getByLabel(theTrackerTrajectoryCollection,theAssoMap);
  
  TrajTrackAssociationCollection::const_iterator anAssociation;  
  TrajTrackAssociationCollection::const_iterator firstAssociation;  
  TrajTrackAssociationCollection::const_iterator lastAssociation;
  firstAssociation = theAssoMap->begin();
  lastAssociation = theAssoMap->end();

  // Loop on muon tracks seeded by L2 muons
  for ( anAssociation = firstAssociation; anAssociation != lastAssociation; ++anAssociation ) { 
    edm::Ref<std::vector<Trajectory> > aTrajectoryRef = anAssociation->key;
    reco::TrackRef aTrackRef = anAssociation->val;
    tkCandColl.push_back(TrackCand(new Trajectory((*aTrajectoryRef)),reco::TrackRef()));
  }
        
  // LogTrace(category) << "Found " << tkCandColl.size() << " tkCands from seeds";
  // std::cout << "Found " << tkCandColl.size() << " tkCands from seeds" << std::endl;

  return tkCandColl;

}
std::vector< Trajectory > FastL3MuonTrajectoryBuilder::makeTrajsFromSeeds ( const std::vector< TrajectorySeed > &  tkSeeds) const [private]

build a tracker Trajectory from a seed

Definition at line 210 of file FastL3MuonTrajectoryBuilder.cc.

References query::result.

                                                                                              {

  // const std::string category = "Muon|RecoMuon|FastL3MuonTrajectoryBuilder|makeTrajsFromSeeds";
  std::vector<Trajectory> result;
  // edm::LogInfo(category) << "Trajectories from all seeds " << result.size();
  return result;

}
void FastL3MuonTrajectoryBuilder::setEvent ( const edm::Event event) [virtual]

pass the Event to the algo at each event

Reimplemented from GlobalTrajectoryBuilderBase.

Definition at line 84 of file FastL3MuonTrajectoryBuilder.cc.

References dummyStaCand, event(), makeTkCandCollection(), regionalTkTracks, and theEvent.

                                                                {
  
  // const std::string category = "Muon|RecoMuon|FastL3MuonTrajectoryBuilder|setEvent";
    
  GlobalTrajectoryBuilderBase::setEvent(event);
  theEvent = &event;
    
  // Retrieve tracker tracks for muons
  regionalTkTracks = makeTkCandCollection(dummyStaCand);
  // edm::LogInfo(category) << "Found " << regionalTkTracks.size() << " tracker tracks from Muons";  

}
MuonCandidate::CandidateContainer FastL3MuonTrajectoryBuilder::trajectories ( const TrackCand staCandIn) [virtual]

reconstruct trajectories from standalone and tracker only Tracks

Implements MuonTrajectoryBuilder.

Definition at line 101 of file FastL3MuonTrajectoryBuilder.cc.

References GlobalTrajectoryBuilderBase::addTraj(), GlobalTrajectoryBuilderBase::build(), GlobalMuonTrackMatcher::match(), MuonCandidate::muonTrack(), refitMuons_cfi::refitMuons, regionalTkTracks, query::result, edm::second(), GlobalTrajectoryBuilderBase::thePtCut, and GlobalTrajectoryBuilderBase::trackMatcher().

                                                                    {

  // static const std::string category = "FastL3MuonTrajectoryBuilder";

  // cut on muons with low momenta
  if ( (staCandIn).second->pt() < thePtCut || 
       (staCandIn).second->innerMomentum().Rho() < thePtCut || 
       (staCandIn).second->innerMomentum().R() < 2.5 ) return CandidateContainer();

  // convert the STA track into a Trajectory if Trajectory not already present
  TrackCand staCand(staCandIn);
  addTraj(staCand);
  
  // match tracker tracks to muon track
  std::vector<TrackCand> trackerTracks = trackMatcher()->match(staCand, regionalTkTracks);

  // edm::LogInfo(category) << "Found " << trackerTracks.size() << " matching tracker tracks within region of interest";
  if ( trackerTracks.empty() ) return CandidateContainer();
  
  // build a combined tracker-muon MuonCandidate
  //
  // turn tkMatchedTracks into MuonCandidates
  //
  //edm::LogInfo(category) << "turn tkMatchedTracks into MuonCandidates";
  CandidateContainer tkTrajs;
  for (std::vector<TrackCand>::const_iterator tkt = trackerTracks.begin(); tkt != trackerTracks.end(); tkt++) {
    if ((*tkt).first != 0 && (*tkt).first->isValid()) {

      MuonCandidate* muonCand = new MuonCandidate(0,staCand.second,(*tkt).second,new Trajectory(*(*tkt).first));      
      tkTrajs.push_back(muonCand);
#ifdef FAMOS_DEBUG
      if ( muonCand->muonTrack()->innerMomentum().Perp2() > 400. ) 
        matchMuons->Fill(muonCand->muonTrack()->innerMomentum().Eta());
#endif
      // LogTrace(category) << "tpush";

    }
  }
  
  if ( tkTrajs.empty() )  {
    // edm::LogInfo(category) << "tkTrajs empty";
    return CandidateContainer();
  }
  
  CandidateContainer result = build(staCand, tkTrajs);  
#ifdef FAMOS_DEBUG
  if ( result.size() > 0 ) { 
    CandidateContainer::const_iterator muonIt = result.begin();
    if ((*muonIt)->muonTrack()->innerMomentum().Perp2() > 400. ) 
      refitMuons->Fill((*muonIt)->muonTrack()->innerMomentum().Eta());
  }
#endif
  // edm::LogInfo(category) << "Found "<< result.size() << " L3Muons from one L2Cand";

  // free memory
  if ( staCandIn.first == 0) delete staCand.first;

  for( CandidateContainer::const_iterator it = tkTrajs.begin(); it != tkTrajs.end(); ++it) {
    if ( (*it)->trajectory() ) delete (*it)->trajectory();
    if ( (*it)->trackerTrajectory() ) delete (*it)->trackerTrajectory();
    if ( *it ) delete (*it);
  }
  tkTrajs.clear();  

  return result;
  
}

Member Data Documentation

Definition at line 71 of file FastL3MuonTrajectoryBuilder.h.

Referenced by setEvent().

Definition at line 70 of file FastL3MuonTrajectoryBuilder.h.

Referenced by clear(), setEvent(), and trajectories().

Reimplemented from GlobalTrajectoryBuilderBase.

Definition at line 84 of file FastL3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().

Definition at line 74 of file FastL3MuonTrajectoryBuilder.h.

Referenced by FastL3MuonTrajectoryBuilder().

Definition at line 83 of file FastL3MuonTrajectoryBuilder.h.

Definition at line 80 of file FastL3MuonTrajectoryBuilder.h.

Definition at line 79 of file FastL3MuonTrajectoryBuilder.h.

Definition at line 76 of file FastL3MuonTrajectoryBuilder.h.

Definition at line 73 of file FastL3MuonTrajectoryBuilder.h.

Definition at line 77 of file FastL3MuonTrajectoryBuilder.h.

Referenced by ~FastL3MuonTrajectoryBuilder().