CMS 3D CMS Logo

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

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 KVFTrackUpdate (const edm::ParameterSet &)
 
 ~KVFTrackUpdate () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::EDGetTokenT< reco::TrackCollectiontoken_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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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().

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

Definition at line 31 of file KVFTrackUpdate.cc.

31 {}

Member Function Documentation

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

Definition at line 41 of file KVFTrackUpdate.cc.

References a, b, SingleTrackVertexConstraint::constrain(), gather_cfg::cout, DEFINE_FWK_MODULE, MillePedeFileConverter_cfg::e, runTheMatrix::err, cppFunctionSkipper::exception, edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, edm::EventBase::id(), and edm::HandleBase::isValid().

41  {
42  try {
43  edm::LogInfo("RecoVertex/KVFTrackUpdate") << "Reconstructing event number: " << iEvent.id() << "\n";
44 
45  // get RECO tracks from the event
46  // `tks` can be used as a ptr to a reco::TrackCollection
48  iEvent.getByToken(token_tracks, tks);
49 
50  edm::LogInfo("RecoVertex/KVFTrackUpdate") << "Found: " << (*tks).size() << " reconstructed tracks"
51  << "\n";
52  std::cout << "got " << (*tks).size() << " tracks " << std::endl;
53 
54  // Transform Track to TransientTrack
55 
56  //get the builder:
58  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", theB);
59  //do the conversion:
60  std::vector<TransientTrack> t_tks = (*theB).build(tks);
61 
62  edm::LogInfo("RecoVertex/KVFTrackUpdate") << "Found: " << t_tks.size() << " reconstructed tracks"
63  << "\n";
64 
65  GlobalPoint glbPos(0., 0., 0.);
66 
68  mat[0][0] = (20.e-04) * (20.e-04);
69  mat[1][1] = (20.e-04) * (20.e-04);
70  mat[2][2] = (5.3) * (5.3);
71  GlobalError glbErrPos(mat);
72 
73  reco::BeamSpot vertexBeamSpot;
74  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
75  iEvent.getByToken(token_beamSpot, recoBeamSpotHandle);
76 
78  for (unsigned int i = 0; i < t_tks.size(); i++) {
79  SingleTrackVertexConstraint::BTFtuple a = stvc.constrain(t_tks[i], glbPos, glbErrPos);
80  std::cout << "Chi2: " << a.get<2>() << std::endl;
81  if (recoBeamSpotHandle.isValid()) {
82  SingleTrackVertexConstraint::BTFtuple b = stvc.constrain(t_tks[i], *recoBeamSpotHandle);
83  std::cout << "Chi2: " << b.get<2>() << std::endl;
84  }
85  }
86  }
87 
88  catch (std::exception& err) {
89  edm::LogInfo("RecoVertex/KVFTrackUpdate") << "Exception during event number: " << iEvent.id() << "\n"
90  << err.what() << "\n";
91  }
92 }
edm::EDGetTokenT< reco::TrackCollection > token_tracks
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
bool isValid() const
Definition: HandleBase.h:70
double b
Definition: hdecay.h:118
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:119
T get() const
Definition: EventSetup.h:73
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
boost::tuple< bool, reco::TransientTrack, float > BTFtuple
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
void KVFTrackUpdate::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 33 of file KVFTrackUpdate.cc.

33 {}
void KVFTrackUpdate::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 35 of file KVFTrackUpdate.cc.

35 {}

Member Data Documentation

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

Definition at line 32 of file KVFTrackUpdate.h.

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

Definition at line 31 of file KVFTrackUpdate.h.