CMS 3D CMS Logo

Public Member Functions | Private Attributes

KVFTrackUpdate Class Reference

#include <KVFTrackUpdate.h>

Inheritance diagram for KVFTrackUpdate:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void endJob ()
 KVFTrackUpdate (const edm::ParameterSet &)
 ~KVFTrackUpdate ()

Private Attributes

edm::InputTag beamSpotLabel
edm::InputTag trackLabel_

Detailed Description

This is a very simple test analyzer to test the update of a track with a vertex constraint with the Kalman filter.

Definition at line 19 of file KVFTrackUpdate.h.


Constructor & Destructor Documentation

KVFTrackUpdate::KVFTrackUpdate ( const edm::ParameterSet iConfig) [explicit]

Definition at line 26 of file KVFTrackUpdate.cc.

References edm::ParameterSet::getParameter().

{
  trackLabel_ = iConfig.getParameter<edm::InputTag>("TrackLabel");
  beamSpotLabel = iConfig.getParameter<edm::InputTag>("beamSpotLabel");
}
KVFTrackUpdate::~KVFTrackUpdate ( )

Definition at line 33 of file KVFTrackUpdate.cc.

                                {
}

Member Function Documentation

void KVFTrackUpdate::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 48 of file KVFTrackUpdate.cc.

References a, b, SingleTrackVertexConstraint::constrain(), gather_cfg::cout, alignCSCRings::e, exception, edm::EventSetup::get(), edm::Event::getByLabel(), i, edm::EventBase::id(), and edm::HandleBase::isValid().

{



  try {
    edm::LogInfo("RecoVertex/KVFTrackUpdate") 
      << "Reconstructing event number: " << iEvent.id() << "\n";
    
    // get RECO tracks from the event
    // `tks` can be used as a ptr to a reco::TrackCollection
    edm::Handle<reco::TrackCollection> tks;
    iEvent.getByLabel(trackLabel_, tks);

    edm::LogInfo("RecoVertex/KVFTrackUpdate") 
      << "Found: " << (*tks).size() << " reconstructed tracks" << "\n";
    std::cout << "got " << (*tks).size() << " tracks " << std::endl;

    // Transform Track to TransientTrack

    //get the builder:
    edm::ESHandle<TransientTrackBuilder> theB;
    iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
    //do the conversion:
    std::vector<TransientTrack> t_tks = (*theB).build(tks);

    edm::LogInfo("RecoVertex/KVFTrackUpdate") 
      << "Found: " << t_tks.size() << " reconstructed tracks" << "\n";
    
    GlobalPoint glbPos(0.,0.,0.);

    AlgebraicSymMatrix33 mat;
    mat[0][0] = (20.e-04)*(20.e-04);
    mat[1][1] = (20.e-04)*(20.e-04);
    mat[2][2] = (5.3)*(5.3);
    GlobalError glbErrPos(mat);

    reco::BeamSpot vertexBeamSpot;
    edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
    iEvent.getByLabel(beamSpotLabel,recoBeamSpotHandle);


    SingleTrackVertexConstraint stvc;
    for (unsigned int i = 0; i<t_tks.size();i++) {
      SingleTrackVertexConstraint::BTFtuple a = 
        stvc.constrain(t_tks[i], glbPos, glbErrPos);
      std::cout << "Chi2: "<< a.get<2>()<<std::endl;
      if (recoBeamSpotHandle.isValid()){
        SingleTrackVertexConstraint::BTFtuple b =
          stvc.constrain(t_tks[i], *recoBeamSpotHandle);
        std::cout << "Chi2: "<< b.get<2>()<<std::endl;
      }
    }
  }


  catch (std::exception & err) {
    edm::LogInfo("RecoVertex/KVFTrackUpdate") 
      << "Exception during event number: " << iEvent.id() 
      << "\n" << err.what() << "\n";
  }

}
void KVFTrackUpdate::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file KVFTrackUpdate.cc.

                             {
}
void KVFTrackUpdate::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 40 of file KVFTrackUpdate.cc.

                            {
}

Member Data Documentation

Definition at line 31 of file KVFTrackUpdate.h.

Definition at line 31 of file KVFTrackUpdate.h.