test
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 edm::EDConsumerBase

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::EDGetTokenT
< reco::TrackCollection
token_tracks
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 20 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().

27 {
28  token_tracks = consumes<TrackCollection>(iConfig.getParameter<InputTag>("TrackLabel"));
29  token_beamSpot = consumes<BeamSpot>(iConfig.getParameter<InputTag>("beamSpotLabel"));
30 }
edm::EDGetTokenT< reco::TrackCollection > token_tracks
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
KVFTrackUpdate::~KVFTrackUpdate ( )

Definition at line 33 of file KVFTrackUpdate.cc.

33  {
34 }

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, cppFunctionSkipper::exception, edm::EventSetup::get(), edm::Event::getByToken(), i, edm::EventBase::id(), and edm::HandleBase::isValid().

49 {
50 
51 
52 
53  try {
54  edm::LogInfo("RecoVertex/KVFTrackUpdate")
55  << "Reconstructing event number: " << iEvent.id() << "\n";
56 
57  // get RECO tracks from the event
58  // `tks` can be used as a ptr to a reco::TrackCollection
60  iEvent.getByToken(token_tracks, tks);
61 
62  edm::LogInfo("RecoVertex/KVFTrackUpdate")
63  << "Found: " << (*tks).size() << " reconstructed tracks" << "\n";
64  std::cout << "got " << (*tks).size() << " tracks " << std::endl;
65 
66  // Transform Track to TransientTrack
67 
68  //get the builder:
70  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
71  //do the conversion:
72  std::vector<TransientTrack> t_tks = (*theB).build(tks);
73 
74  edm::LogInfo("RecoVertex/KVFTrackUpdate")
75  << "Found: " << t_tks.size() << " reconstructed tracks" << "\n";
76 
77  GlobalPoint glbPos(0.,0.,0.);
78 
80  mat[0][0] = (20.e-04)*(20.e-04);
81  mat[1][1] = (20.e-04)*(20.e-04);
82  mat[2][2] = (5.3)*(5.3);
83  GlobalError glbErrPos(mat);
84 
85  reco::BeamSpot vertexBeamSpot;
86  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
87  iEvent.getByToken(token_beamSpot,recoBeamSpotHandle);
88 
89 
91  for (unsigned int i = 0; i<t_tks.size();i++) {
93  stvc.constrain(t_tks[i], glbPos, glbErrPos);
94  std::cout << "Chi2: "<< a.get<2>()<<std::endl;
95  if (recoBeamSpotHandle.isValid()){
97  stvc.constrain(t_tks[i], *recoBeamSpotHandle);
98  std::cout << "Chi2: "<< b.get<2>()<<std::endl;
99  }
100  }
101  }
102 
103 
104  catch (std::exception & err) {
105  edm::LogInfo("RecoVertex/KVFTrackUpdate")
106  << "Exception during event number: " << iEvent.id()
107  << "\n" << err.what() << "\n";
108  }
109 
110 }
edm::EDGetTokenT< reco::TrackCollection > token_tracks
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
bool isValid() const
Definition: HandleBase.h:75
const T & get() const
Definition: EventSetup.h:56
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:59
double a
Definition: hdecay.h:121
boost::tuple< bool, reco::TransientTrack, float > BTFtuple
tuple cout
Definition: gather_cfg.py:145
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
void KVFTrackUpdate::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file KVFTrackUpdate.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 40 of file KVFTrackUpdate.cc.

40  {
41 }

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> KVFTrackUpdate::token_beamSpot
private

Definition at line 33 of file KVFTrackUpdate.h.

edm::EDGetTokenT<reco::TrackCollection> KVFTrackUpdate::token_tracks
private

Definition at line 32 of file KVFTrackUpdate.h.