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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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::KVFTrackUpdate ( const edm::ParameterSet iConfig)
explicit

Definition at line 26 of file KVFTrackUpdate.cc.

26  {
27  token_tracks = consumes<TrackCollection>(iConfig.getParameter<InputTag>("TrackLabel"));
28  token_beamSpot = consumes<BeamSpot>(iConfig.getParameter<InputTag>("beamSpotLabel"));
29 }

References edm::ParameterSet::getParameter().

◆ ~KVFTrackUpdate()

KVFTrackUpdate::~KVFTrackUpdate ( )
override

Definition at line 31 of file KVFTrackUpdate.cc.

31 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 41 of file KVFTrackUpdate.cc.

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: " << std::get<2>(a) << std::endl;
81  if (recoBeamSpotHandle.isValid()) {
82  SingleTrackVertexConstraint::BTFtuple b = stvc.constrain(t_tks[i], *recoBeamSpotHandle);
83  std::cout << "Chi2: " << std::get<2>(b) << 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 }

References a, b, SingleTrackVertexConstraint::constrain(), gather_cfg::cout, MillePedeFileConverter_cfg::e, submitPVResolutionJobs::err, cppFunctionSkipper::exception, reco::get(), edm::EventSetup::get(), mps_fire::i, iEvent, and edm::HandleBase::isValid().

◆ beginJob()

void KVFTrackUpdate::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 33 of file KVFTrackUpdate.cc.

33 {}

◆ endJob()

void KVFTrackUpdate::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 35 of file KVFTrackUpdate.cc.

35 {}

Member Data Documentation

◆ token_beamSpot

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

Definition at line 32 of file KVFTrackUpdate.h.

◆ token_tracks

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

Definition at line 31 of file KVFTrackUpdate.h.

AlgebraicSymMatrix33
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Definition: AlgebraicROOTObjects.h:21
mps_fire.i
i
Definition: mps_fire.py:428
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle< reco::TrackCollection >
KVFTrackUpdate::token_tracks
edm::EDGetTokenT< reco::TrackCollection > token_tracks
Definition: KVFTrackUpdate.h:31
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
SingleTrackVertexConstraint::constrain
BTFtuple constrain(const reco::TransientTrack &track, const GlobalPoint &priorPos, const GlobalError &priorError) const
Definition: SingleTrackVertexConstraint.cc:21
reco::BeamSpot
Definition: BeamSpot.h:21
TransientTrackRecord
Definition: TransientTrackRecord.h:11
edm::ESHandle< TransientTrackBuilder >
SingleTrackVertexConstraint::BTFtuple
std::tuple< bool, reco::TransientTrack, float > BTFtuple
Definition: SingleTrackVertexConstraint.h:23
Point3DBase< float, GlobalTag >
b
double b
Definition: hdecay.h:118
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
a
double a
Definition: hdecay.h:119
iEvent
int iEvent
Definition: GenABIO.cc:224
GlobalErrorBase< double, ErrorMatrixTag >
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
get
#define get
KVFTrackUpdate::token_beamSpot
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
Definition: KVFTrackUpdate.h:32
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
SingleTrackVertexConstraint
Definition: SingleTrackVertexConstraint.h:20
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37