CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
KVFTrackUpdate Class Reference

#include <KVFTrackUpdate.h>

Inheritance diagram for KVFTrackUpdate:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 KVFTrackUpdate (const edm::ParameterSet &)
 
 ~KVFTrackUpdate ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

edm::InputTag beamSpotLabel
 
edm::InputTag trackLabel_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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 27 of file KVFTrackUpdate.cc.

References edm::ParameterSet::getParameter().

28 {
29  trackLabel_ = iConfig.getParameter<edm::InputTag>("TrackLabel");
30  beamSpotLabel = iConfig.getParameter<edm::InputTag>("beamSpotLabel");
31 }
T getParameter(std::string const &) const
edm::InputTag beamSpotLabel
edm::InputTag trackLabel_
KVFTrackUpdate::~KVFTrackUpdate ( )

Definition at line 34 of file KVFTrackUpdate.cc.

34  {
35 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 49 of file KVFTrackUpdate.cc.

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

50 {
51 
52 
53 
54  try {
55  edm::LogInfo("RecoVertex/KVFTrackUpdate")
56  << "Reconstructing event number: " << iEvent.id() << "\n";
57 
58  // get RECO tracks from the event
59  // `tks` can be used as a ptr to a reco::TrackCollection
61  iEvent.getByLabel(trackLabel_, tks);
62 
63  edm::LogInfo("RecoVertex/KVFTrackUpdate")
64  << "Found: " << (*tks).size() << " reconstructed tracks" << "\n";
65  std::cout << "got " << (*tks).size() << " tracks " << std::endl;
66 
67  // Transform Track to TransientTrack
68 
69  //get the builder:
71  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
72  //do the conversion:
73  std::vector<TransientTrack> t_tks = (*theB).build(tks);
74 
75  edm::LogInfo("RecoVertex/KVFTrackUpdate")
76  << "Found: " << t_tks.size() << " reconstructed tracks" << "\n";
77 
78  GlobalPoint glbPos(0.,0.,0.);
79 
80  AlgebraicSymMatrix mat(3,0);
81  mat[0][0] = (20.e-04)*(20.e-04);
82  mat[1][1] = (20.e-04)*(20.e-04);
83  mat[2][2] = (5.3)*(5.3);
84  GlobalError glbErrPos(mat);
85 
86  reco::BeamSpot vertexBeamSpot;
87  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
88  iEvent.getByLabel(beamSpotLabel,recoBeamSpotHandle);
89 
90 
92  for (unsigned int i = 0; i<t_tks.size();i++) {
94  stvc.constrain(t_tks[i], glbPos, glbErrPos);
95  std::cout << "Chi2: "<< a.get<2>()<<std::endl;
96  if (recoBeamSpotHandle.isValid()){
98  stvc.constrain(t_tks[i], *recoBeamSpotHandle);
99  std::cout << "Chi2: "<< b.get<2>()<<std::endl;
100  }
101  }
102  }
103 
104 
105  catch (std::exception & err) {
106  edm::LogInfo("RecoVertex/KVFTrackUpdate")
107  << "Exception during event number: " << iEvent.id()
108  << "\n" << err.what() << "\n";
109  }
110 
111 }
int i
Definition: DBlmapReader.cc:9
edm::InputTag beamSpotLabel
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
const T & get() const
Definition: EventSetup.h:55
double b
Definition: hdecay.h:120
BTFtuple constrain(const reco::TransientTrack &track, const GlobalPoint &priorPos, const GlobalError &priorError) const
edm::EventID id() const
Definition: EventBase.h:56
double a
Definition: hdecay.h:121
CLHEP::HepSymMatrix AlgebraicSymMatrix
boost::tuple< bool, reco::TransientTrack, float > BTFtuple
tuple cout
Definition: gather_cfg.py:41
edm::InputTag trackLabel_
void KVFTrackUpdate::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 37 of file KVFTrackUpdate.cc.

37  {
38 }
void KVFTrackUpdate::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 41 of file KVFTrackUpdate.cc.

41  {
42 }

Member Data Documentation

edm::InputTag KVFTrackUpdate::beamSpotLabel
private

Definition at line 31 of file KVFTrackUpdate.h.

edm::InputTag KVFTrackUpdate::trackLabel_
private

Definition at line 31 of file KVFTrackUpdate.h.