CMS 3D CMS Logo

KVFTrackUpdate.cc
Go to the documentation of this file.
2 
15 
16 #include <iostream>
17 
18 using namespace reco;
19 using namespace edm;
20 using namespace std;
21 
23  : estoken_TTB(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))) {
24  token_tracks = consumes<TrackCollection>(iConfig.getParameter<InputTag>("TrackLabel"));
25  token_beamSpot = consumes<BeamSpot>(iConfig.getParameter<InputTag>("beamSpotLabel"));
26 }
27 
29 
31 
33 
34 //
35 // member functions
36 //
37 
39  try {
40  edm::LogInfo("RecoVertex/KVFTrackUpdate") << "Reconstructing event number: " << iEvent.id() << "\n";
41 
42  // get RECO tracks from the event
43  // `tks` can be used as a ptr to a reco::TrackCollection
45  iEvent.getByToken(token_tracks, tks);
46 
47  edm::LogInfo("RecoVertex/KVFTrackUpdate") << "Found: " << (*tks).size() << " reconstructed tracks"
48  << "\n";
49  edm::LogPrint("RecoVertex/KVFTrackUpdate") << "got " << (*tks).size() << " tracks " << std::endl;
50 
51  // Transform Track to TransientTrack
52 
53  //get the builder:
54  const auto& theB = &iSetup.getData(estoken_TTB);
55  //do the conversion:
56  std::vector<TransientTrack> t_tks = theB->build(tks);
57 
58  edm::LogInfo("RecoVertex/KVFTrackUpdate") << "Found: " << t_tks.size() << " reconstructed tracks"
59  << "\n";
60 
61  GlobalPoint glbPos(0., 0., 0.);
62 
64  mat[0][0] = (20.e-04) * (20.e-04);
65  mat[1][1] = (20.e-04) * (20.e-04);
66  mat[2][2] = (5.3) * (5.3);
67  GlobalError glbErrPos(mat);
68 
69  reco::BeamSpot vertexBeamSpot;
70  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
71  iEvent.getByToken(token_beamSpot, recoBeamSpotHandle);
72 
74  for (unsigned int i = 0; i < t_tks.size(); i++) {
75  SingleTrackVertexConstraint::BTFtuple a = stvc.constrain(t_tks[i], glbPos, glbErrPos);
76  edm::LogPrint("RecoVertex/KVFTrackUpdate") << "Chi2: " << std::get<2>(a) << std::endl;
77  if (recoBeamSpotHandle.isValid()) {
78  SingleTrackVertexConstraint::BTFtuple b = stvc.constrain(t_tks[i], *recoBeamSpotHandle);
79  edm::LogPrint("RecoVertex/KVFTrackUpdate") << "Chi2: " << std::get<2>(b) << std::endl;
80  }
81  }
82  }
83 
84  catch (std::exception& err) {
85  edm::LogInfo("RecoVertex/KVFTrackUpdate") << "Exception during event number: " << iEvent.id() << "\n"
86  << err.what() << "\n";
87  }
88 }
89 
Handle.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
edm::ESInputTag
Definition: ESInputTag.h:87
MessageLogger.h
KalmanVertexFitter.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
KVFTrackUpdate::beginJob
void beginJob() override
Definition: KVFTrackUpdate.cc:30
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
TransientTrack.h
edm::Handle< reco::TrackCollection >
KVFTrackUpdate::token_tracks
edm::EDGetTokenT< reco::TrackCollection > token_tracks
Definition: KVFTrackUpdate.h:34
MakerMacros.h
SingleTrackVertexConstraint.h
Track.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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
SingleTrackVertexConstraint::BTFtuple
std::tuple< bool, reco::TransientTrack, float > BTFtuple
Definition: SingleTrackVertexConstraint.h:23
KVFTrackUpdate::estoken_TTB
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > estoken_TTB
Definition: KVFTrackUpdate.h:33
Point3DBase< float, GlobalTag >
b
double b
Definition: hdecay.h:118
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
KVFTrackUpdate.h
KVFTrackUpdate::endJob
void endJob() override
Definition: KVFTrackUpdate.cc:32
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
KVFTrackUpdate
Definition: KVFTrackUpdate.h:22
iEvent
int iEvent
Definition: GenABIO.cc:224
GlobalErrorBase< double, ErrorMatrixTag >
edm::EventSetup
Definition: EventSetup.h:58
TrackAssociatorRecord.h
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
InputTag.h
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
VertexFwd.h
TransientVertex.h
std
Definition: JetResolutionObject.h:76
KVFTrackUpdate::token_beamSpot
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
Definition: KVFTrackUpdate.h:35
Vertex.h
KVFTrackUpdate::~KVFTrackUpdate
~KVFTrackUpdate() override
Definition: KVFTrackUpdate.cc:28
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
KVFTrackUpdate::KVFTrackUpdate
KVFTrackUpdate(const edm::ParameterSet &)
Definition: KVFTrackUpdate.cc:22
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
KVFTrackUpdate::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: KVFTrackUpdate.cc:38
SingleTrackVertexConstraint
Definition: SingleTrackVertexConstraint.h:20
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37