CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

MuonMillepedeTrackRefitter Class Reference

#include <MuonMillepedeTrackRefitter.h>

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

List of all members.

Public Types

typedef
AlignmentAlgorithmBase::ConstTrajTrackPair 
ConstTrajTrackPair
typedef
AlignmentAlgorithmBase::ConstTrajTrackPairCollection 
ConstTrajTrackPairCollection

Public Member Functions

 MuonMillepedeTrackRefitter (const edm::ParameterSet &pset)
 Constructor.
virtual void produce (edm::Event &event, const edm::EventSetup &eventSetup)
virtual ~MuonMillepedeTrackRefitter ()
 Destructor.

Private Attributes

edm::InputTag SACollectionTag

Detailed Description

Date:
2010/03/29 13:18:43
Revision:
1.4
Author:
P. Martinez Ruiz del Arbol, IFCA (CSIC-UC) <Pablo.Martinez@cern.ch>

This class produces a collection of TrackForAlignment using as input Tracks and 4DSegments from AlcaReco. Calculation of predicted states is performed here.

Date:
2010/02/24 09:09:10
Revision:
1.3
Author:
P. Martinez Ruiz del Arbol, IFCA (CSIC-UC) <Pablo.Martinez@cern.ch>

Definition at line 40 of file MuonMillepedeTrackRefitter.h.


Member Typedef Documentation

Definition at line 43 of file MuonMillepedeTrackRefitter.h.

Definition at line 44 of file MuonMillepedeTrackRefitter.h.


Constructor & Destructor Documentation

MuonMillepedeTrackRefitter::MuonMillepedeTrackRefitter ( const edm::ParameterSet pset)

Constructor.

Definition at line 53 of file MuonMillepedeTrackRefitter.cc.

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

{
  
  SACollectionTag = pset.getParameter<edm::InputTag>( "SATrackCollectionTag" );
  
  //Products
  produces<std::vector<Trajectory> >();
  produces<TrajTrackAssociationCollection>();

}
MuonMillepedeTrackRefitter::~MuonMillepedeTrackRefitter ( ) [virtual]

Destructor.

Definition at line 65 of file MuonMillepedeTrackRefitter.cc.

{
}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 70 of file MuonMillepedeTrackRefitter.cc.

References TrackingRecHit::clone(), edm::EventSetup::get(), reco::TransientTrack::innermostMeasurementState(), Trajectory::push(), reco::TransientTrack::recHitsBegin(), reco::TransientTrack::recHitsEnd(), SACollectionTag, and MuonTransientTrackingRecHit::specificBuild().

{
 
  //Get collections from the event

  edm::Handle<reco::TrackCollection> tracksSA;
  event.getByLabel( SACollectionTag, tracksSA );

  edm::ESHandle<MagneticField> theMGField;
  eventSetup.get<IdealMagneticFieldRecord>().get( theMGField );

  edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
  eventSetup.get<GlobalTrackingGeometryRecord>().get( theTrackingGeometry );

  edm::RefProd<std::vector<Trajectory> > trajectoryCollectionRefProd 
    = event.getRefBeforePut<std::vector<Trajectory> >();

  //Allocate collection of tracks
  std::auto_ptr<std::vector<Trajectory> > trajectoryCollection( new std::vector<Trajectory> );
  // Association map between Trajectory and Track
  std::auto_ptr<TrajTrackAssociationCollection> trajTrackMap( new TrajTrackAssociationCollection );
 

  //Create the propagator
 
  std::map<edm::Ref<std::vector<Trajectory> >::key_type, edm::Ref<reco::TrackCollection>::key_type> trajToTrack_map;
  
  edm::Ref<std::vector<Trajectory> >::key_type trajectoryIndex = 0;
     
  reco::TrackRef::key_type trackIndex = 0;

  for (reco::TrackCollection::const_iterator trackSA = tracksSA->begin();  trackSA != tracksSA->end();  ++trackSA ) {
   
    reco::TransientTrack tTrackSA( *trackSA, &*theMGField, theTrackingGeometry );

    //Create an empty trajectory
    Trajectory myTraj;

    TrajectoryStateOnSurface innerTSOS = tTrackSA.innermostMeasurementState();
    

    for(trackingRecHit_iterator theHit = tTrackSA.recHitsBegin(); theHit != tTrackSA.recHitsEnd(); ++theHit) {
  
      TrackingRecHit *myClone = (*theHit)->clone(); 
      const GeomDet* myDet = theTrackingGeometry->idToDet( (*theHit)->geographicalId() );
      TrajectoryMeasurement myMeas(innerTSOS, &* MuonTransientTrackingRecHit::specificBuild(myDet, (TrackingRecHit *) &*myClone));
      myTraj.push(myMeas);

    }
 
    trajectoryCollection->push_back(myTraj);
    trajToTrack_map[trajectoryIndex] = trackIndex;          
    ++trajectoryIndex;
    ++trackIndex;
  } 

  edm::OrphanHandle<std::vector<Trajectory> > trajsRef = event.put(trajectoryCollection);
  
  for( trajectoryIndex = 0; trajectoryIndex < tracksSA->size(); ++trajectoryIndex) 
  {      
    edm::Ref<reco::TrackCollection>::key_type trackCounter = trajToTrack_map[trajectoryIndex];
    trajTrackMap->insert(edm::Ref<std::vector<Trajectory> >(trajsRef, trajectoryIndex), edm::Ref<reco::TrackCollection>(tracksSA, trackCounter));
  }
  
  event.put(trajTrackMap);
 
}

Member Data Documentation

Definition at line 61 of file MuonMillepedeTrackRefitter.h.

Referenced by MuonMillepedeTrackRefitter(), and produce().