CMS 3D CMS Logo

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

#include <TrackAssociatorByChi2.h>

Inheritance diagram for TrackAssociatorByChi2:
TrackAssociatorBase

Public Types

typedef std::map< double,
SimTrack
Chi2SimMap
 
typedef std::pair< reco::Track,
Chi2SimMap
RecoToSimPair
 
typedef std::vector
< RecoToSimPair
RecoToSimPairAssociation
 

Public Member Functions

double associateRecoToSim (reco::TrackCollection::const_iterator, TrackingParticleCollection::const_iterator, const reco::BeamSpot &) const
 compare reco::TrackCollection and TrackingParticleCollection iterators: returns the chi2 More...
 
reco::RecoToSimCollection associateRecoToSim (const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 Association Reco To Sim with Collections. More...
 
reco::RecoToSimCollection associateRecoToSim (edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 compare reco to sim the handle of reco::Track and TrackingParticle collections More...
 
reco::SimToRecoCollection associateSimToReco (const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 Association Sim To Reco with Collections. More...
 
reco::SimToRecoCollection associateSimToReco (edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 compare reco to sim the handle of reco::Track and TrackingParticle collections More...
 
double compareTracksParam (reco::TrackCollection::const_iterator, edm::SimTrackContainer::const_iterator, const math::XYZTLorentzVectorD, GlobalVector, reco::TrackBase::CovarianceMatrix, const reco::BeamSpot &) const
 compare reco::TrackCollection and edm::SimTrackContainer iterators: returns the chi2 More...
 
RecoToSimPairAssociation compareTracksParam (const reco::TrackCollection &, const edm::SimTrackContainer &, const edm::SimVertexContainer &, const reco::BeamSpot &) const
 compare collections reco to sim More...
 
std::pair< bool,
reco::TrackBase::ParameterVector
parametersAtClosestApproach (Basic3DVector< double >, Basic3DVector< double >, float, const reco::BeamSpot &) const
 propagate the track parameters of TrackinParticle from production vertex to the point of closest approach to the beam line. More...
 
 TrackAssociatorByChi2 (const edm::ESHandle< MagneticField > mF, edm::ParameterSet conf)
 Constructor with PSet. More...
 
 TrackAssociatorByChi2 (const edm::ESHandle< MagneticField > mF, double chi2Cut, bool onlyDiag, edm::InputTag beamspotSrc)
 Constructor with magnetic field, double, bool and InputTag. More...
 
 ~TrackAssociatorByChi2 ()
 Destructor. More...
 
- Public Member Functions inherited from TrackAssociatorBase
virtual
reco::RecoToSimCollectionSeed 
associateRecoToSim (const edm::Handle< edm::View< TrajectorySeed > > &, const edm::Handle< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 
virtual
reco::RecoToSimCollectionTCandidate 
associateRecoToSim (const edm::Handle< TrackCandidateCollection > &, const edm::Handle< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 
virtual
reco::SimToRecoCollectionSeed 
associateSimToReco (const edm::Handle< edm::View< TrajectorySeed > > &, const edm::Handle< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 
virtual
reco::SimToRecoCollectionTCandidate 
associateSimToReco (const edm::Handle< TrackCandidateCollection > &, const edm::Handle< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 
 TrackAssociatorBase ()
 Constructor. More...
 
virtual ~TrackAssociatorBase ()
 Destructor. More...
 

Private Attributes

edm::InputTag bsSrc
 
double chi2cut
 
bool onlyDiagonal
 
edm::ESHandle< MagneticFieldtheMF
 

Detailed Description

Class that performs the association of reco::Tracks and TrackingParticles evaluating the chi2 of reco tracks parameters and sim tracks parameters. The cut can be tuned from the config file: see data/TrackAssociatorByChi2.cfi. Note that the Association Map is filled with -ch2 and not chi2 because it is ordered using std::greater: the track with the lowest association chi2 will be the first in the output map.It is possible to use only diagonal terms (associator by pulls) seeting onlyDiagonal = true in the PSet

Date:
2010/05/18 15:40:39
Revision:
1.27
Author
cerati, magni

Definition at line 30 of file TrackAssociatorByChi2.h.

Member Typedef Documentation

typedef std::map<double, SimTrack> TrackAssociatorByChi2::Chi2SimMap

Definition at line 33 of file TrackAssociatorByChi2.h.

Definition at line 34 of file TrackAssociatorByChi2.h.

Definition at line 35 of file TrackAssociatorByChi2.h.

Constructor & Destructor Documentation

TrackAssociatorByChi2::TrackAssociatorByChi2 ( const edm::ESHandle< MagneticField mF,
edm::ParameterSet  conf 
)
inline

Constructor with PSet.

Definition at line 38 of file TrackAssociatorByChi2.h.

References onlyDiagonal, and theMF.

38  :
39  chi2cut(conf.getParameter<double>("chi2cut")),
40  onlyDiagonal(conf.getParameter<bool>("onlyDiagonal")),
41  bsSrc(conf.getParameter<edm::InputTag>("beamSpot")) {
42  theMF=mF;
43  if (onlyDiagonal)
44  edm::LogInfo("TrackAssociator") << " ---- Using Off Diagonal Covariance Terms = 0 ---- " << "\n";
45  else
46  edm::LogInfo("TrackAssociator") << " ---- Using Off Diagonal Covariance Terms != 0 ---- " << "\n";
47  }
T getParameter(std::string const &) const
edm::ESHandle< MagneticField > theMF
TrackAssociatorByChi2::TrackAssociatorByChi2 ( const edm::ESHandle< MagneticField mF,
double  chi2Cut,
bool  onlyDiag,
edm::InputTag  beamspotSrc 
)
inline

Constructor with magnetic field, double, bool and InputTag.

Definition at line 50 of file TrackAssociatorByChi2.h.

References bsSrc, chi2cut, onlyDiagonal, and theMF.

50  {
51  chi2cut=chi2Cut;
52  onlyDiagonal=onlyDiag;
53  theMF=mF;
54  bsSrc = beamspotSrc;
55  }
edm::ESHandle< MagneticField > theMF
TrackAssociatorByChi2::~TrackAssociatorByChi2 ( )
inline

Destructor.

Definition at line 58 of file TrackAssociatorByChi2.h.

58 {}

Member Function Documentation

double TrackAssociatorByChi2::associateRecoToSim ( reco::TrackCollection::const_iterator  ,
TrackingParticleCollection::const_iterator  ,
const reco::BeamSpot  
) const

compare reco::TrackCollection and TrackingParticleCollection iterators: returns the chi2

Referenced by KVFTest::analyze().

RecoToSimCollection TrackAssociatorByChi2::associateRecoToSim ( const edm::RefToBaseVector< reco::Track > &  tC,
const edm::RefVector< TrackingParticleCollection > &  tPCH,
const edm::Event event = 0,
const edm::EventSetup setup = 0 
) const
virtual

Association Reco To Sim with Collections.

Implements TrackAssociatorBase.

Definition at line 164 of file TrackAssociatorByChi2.cc.

References edm::RefToBaseVector< T >::begin(), reco::deltaPhi(), edm::RefToBaseVector< T >::end(), f, edm::Event::getByLabel(), i, edm::AssociationMap< Tag >::insert(), j, LogDebug, LogTrace, reco::BeamSpot::position(), edm::AssociationMap< Tag >::post_insert(), edm::RefVector< C, T, F >::product(), and edm::RefVector< C, T, F >::size().

167  {
168  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
169  e->getByLabel(bsSrc,recoBeamSpotHandle);
170  reco::BeamSpot bs = *recoBeamSpotHandle;
171 
172  RecoToSimCollection outputCollection;
173  double chi2;
174 
176  if (tPCH.size()!=0) tPC = *tPCH.product();
177 
178  int tindex=0;
179  for (RefToBaseVector<reco::Track>::const_iterator rt=tC.begin(); rt!=tC.end(); rt++, tindex++){
180 
181  LogDebug("TrackAssociator") << "=========LOOKING FOR ASSOCIATION===========" << "\n"
182  << "rec::Track #"<<tindex<<" with pt=" << (*rt)->pt() << "\n"
183  << "===========================================" << "\n";
184 
185  TrackBase::ParameterVector rParameters = (*rt)->parameters();
186 
187  TrackBase::CovarianceMatrix recoTrackCovMatrix = (*rt)->covariance();
188  if (onlyDiagonal){
189  for (unsigned int i=0;i<5;i++){
190  for (unsigned int j=0;j<5;j++){
191  if (i!=j) recoTrackCovMatrix(i,j)=0;
192  }
193  }
194  }
195 
196  recoTrackCovMatrix.Invert();
197 
198  int tpindex =0;
199  for (TrackingParticleCollection::const_iterator tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
200 
201  //skip tps with a very small pt
202  //if (sqrt(tp->momentum().perp2())<0.5) continue;
203  Basic3DVector<double> momAtVtx(tp->momentum().x(),tp->momentum().y(),tp->momentum().z());
204  Basic3DVector<double> vert=(Basic3DVector<double>) tp->vertex();
205 
206  std::pair<bool,reco::TrackBase::ParameterVector> params = parametersAtClosestApproach(vert, momAtVtx, tp->charge(), bs);
207  if (params.first){
208  TrackBase::ParameterVector sParameters=params.second;
209 
210  TrackBase::ParameterVector diffParameters = rParameters - sParameters;
211  diffParameters[2] = reco::deltaPhi(diffParameters[2],0.f);
212 
213  chi2 = ROOT::Math::Similarity(diffParameters, recoTrackCovMatrix);
214  chi2 /= 5;
215 
216  LogTrace("TrackAssociator") << "====TP index=" << tpindex << " RECO TRACK index="<<tindex<<" WITH PT=" << (*rt)->pt() << "====\n"
217  << "qoverp sim: " << sParameters[0] << "\n"
218  << "lambda sim: " << sParameters[1] << "\n"
219  << "phi sim: " << sParameters[2] << "\n"
220  << "dxy sim: " << sParameters[3] << "\n"
221  << "dsz sim: " << sParameters[4] << "\n"
222  << ": " /*<< */ << "\n"
223  << "qoverp rec: " << (*rt)->qoverp() << " err: " << (*rt)->error(0) << "\n"
224  << "lambda rec: " << (*rt)->lambda() << " err: " << (*rt)->error(1) << "\n"
225  << "phi rec: " << (*rt)->phi() << " err: " << (*rt)->error(2) << "\n"
226  << "dxy rec: " << (*rt)->dxy(bs.position()) << " err: " << (*rt)->error(3) << "\n"
227  << "dsz rec: " << (*rt)->dsz(bs.position()) << " err: " << (*rt)->error(4) << "\n"
228  << ": " /*<< */ << "\n"
229  << "chi2: " << chi2 << "\n";
230 
231  if (chi2<chi2cut) {
232  outputCollection.insert(tC[tindex],
233  std::make_pair(edm::Ref<TrackingParticleCollection>(tPCH, tpindex),
234  -chi2));//-chi2 because the Association Map is ordered using std::greater
235  }
236  }
237  }
238  }
239  outputCollection.post_insert();
240  return outputCollection;
241 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< TrackingParticle > TrackingParticleCollection
C const * product() const
Accessor for product collection.
Definition: RefVector.h:272
const_iterator end() const
std::pair< bool, reco::TrackBase::ParameterVector > parametersAtClosestApproach(Basic3DVector< double >, Basic3DVector< double >, float, const reco::BeamSpot &) const
propagate the track parameters of TrackinParticle from production vertex to the point of closest appr...
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:70
void post_insert()
post insert action
int j
Definition: DBlmapReader.cc:9
double f[11][100]
#define LogTrace(id)
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
void insert(const key_type &k, const data_type &v)
insert an association
const_iterator begin() const
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
const Point & position() const
position
Definition: BeamSpot.h:63
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:72
reco::RecoToSimCollection TrackAssociatorByChi2::associateRecoToSim ( edm::Handle< edm::View< reco::Track > > &  tCH,
edm::Handle< TrackingParticleCollection > &  tPCH,
const edm::Event event = 0,
const edm::EventSetup setup = 0 
) const
inlinevirtual

compare reco to sim the handle of reco::Track and TrackingParticle collections

Reimplemented from TrackAssociatorBase.

Definition at line 96 of file TrackAssociatorByChi2.h.

References TrackAssociatorBase::associateRecoToSim(), event(), and HcalObjRepresent::setup().

99  {
100  return TrackAssociatorBase::associateRecoToSim(tCH,tPCH,event,setup);
101  }
virtual reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
SimToRecoCollection TrackAssociatorByChi2::associateSimToReco ( const edm::RefToBaseVector< reco::Track > &  tC,
const edm::RefVector< TrackingParticleCollection > &  tPCH,
const edm::Event event = 0,
const edm::EventSetup setup = 0 
) const
virtual

Association Sim To Reco with Collections.

Implements TrackAssociatorBase.

Definition at line 245 of file TrackAssociatorByChi2.cc.

References edm::RefToBaseVector< T >::begin(), reco::deltaPhi(), edm::RefToBaseVector< T >::end(), f, edm::Event::getByLabel(), i, edm::AssociationMap< Tag >::insert(), j, LogDebug, LogTrace, reco::BeamSpot::position(), edm::AssociationMap< Tag >::post_insert(), edm::RefVector< C, T, F >::product(), edm::RefVector< C, T, F >::size(), and mathSSE::sqrt().

248  {
249  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
250  e->getByLabel(bsSrc,recoBeamSpotHandle);
251  reco::BeamSpot bs = *recoBeamSpotHandle;
252 
253  SimToRecoCollection outputCollection;
254  double chi2;
255 
257  if (tPCH.size()!=0) tPC = *tPCH.product();
258 
259  int tpindex =0;
260  for (TrackingParticleCollection::const_iterator tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
261 
262  //skip tps with a very small pt
263  //if (sqrt(tp->momentum().perp2())<0.5) continue;
264 
265  LogDebug("TrackAssociator") << "=========LOOKING FOR ASSOCIATION===========" << "\n"
266  << "TrackingParticle #"<<tpindex<<" with pt=" << sqrt(tp->momentum().perp2()) << "\n"
267  << "===========================================" << "\n";
268 
269  Basic3DVector<double> momAtVtx(tp->momentum().x(),tp->momentum().y(),tp->momentum().z());
270  Basic3DVector<double> vert(tp->vertex().x(),tp->vertex().y(),tp->vertex().z());
271 
272  std::pair<bool,reco::TrackBase::ParameterVector> params = parametersAtClosestApproach(vert, momAtVtx, tp->charge(), bs);
273  if (params.first){
274  TrackBase::ParameterVector sParameters=params.second;
275 
276  int tindex=0;
277  for (RefToBaseVector<reco::Track>::const_iterator rt=tC.begin(); rt!=tC.end(); rt++, tindex++){
278 
279  TrackBase::ParameterVector rParameters = (*rt)->parameters();
280 
281  TrackBase::CovarianceMatrix recoTrackCovMatrix = (*rt)->covariance();
282  if (onlyDiagonal) {
283  for (unsigned int i=0;i<5;i++){
284  for (unsigned int j=0;j<5;j++){
285  if (i!=j) recoTrackCovMatrix(i,j)=0;
286  }
287  }
288  }
289 
290  recoTrackCovMatrix.Invert();
291 
292  TrackBase::ParameterVector diffParameters = rParameters - sParameters;
293  diffParameters[2] = reco::deltaPhi(diffParameters[2],0.f);
294 
295  chi2 = ROOT::Math::Similarity(recoTrackCovMatrix, diffParameters);
296  chi2 /= 5;
297 
298  LogTrace("TrackAssociator") << "====TP index=" << tpindex << " RECO TRACK index="<<tindex<<" WITH PT=" << (*rt)->pt() << "====\n"
299  << "qoverp sim: " << sParameters[0] << "\n"
300  << "lambda sim: " << sParameters[1] << "\n"
301  << "phi sim: " << sParameters[2] << "\n"
302  << "dxy sim: " << sParameters[3] << "\n"
303  << "dsz sim: " << sParameters[4] << "\n"
304  << ": " /*<< */ << "\n"
305  << "qoverp rec: " << (*rt)->qoverp() << " err: " << (*rt)->error(0) << "\n"
306  << "lambda rec: " << (*rt)->lambda() << " err: " << (*rt)->error(1) << "\n"
307  << "phi rec: " << (*rt)->phi() << " err: " << (*rt)->error(2) << "\n"
308  << "dxy rec: " << (*rt)->dxy(bs.position()) << " err: " << (*rt)->error(3) << "\n"
309  << "dsz rec: " << (*rt)->dsz(bs.position()) << " err: " << (*rt)->error(4) << "\n"
310  << ": " /*<< */ << "\n"
311  << "chi2: " << chi2 << "\n";
312 
313  if (chi2<chi2cut) {
314  outputCollection.insert(edm::Ref<TrackingParticleCollection>(tPCH, tpindex),
315  std::make_pair(tC[tindex],
316  -chi2));//-chi2 because the Association Map is ordered using std::greater
317  }
318  }
319  }
320  }
321  outputCollection.post_insert();
322  return outputCollection;
323 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< TrackingParticle > TrackingParticleCollection
C const * product() const
Accessor for product collection.
Definition: RefVector.h:272
const_iterator end() const
std::pair< bool, reco::TrackBase::ParameterVector > parametersAtClosestApproach(Basic3DVector< double >, Basic3DVector< double >, float, const reco::BeamSpot &) const
propagate the track parameters of TrackinParticle from production vertex to the point of closest appr...
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:70
void post_insert()
post insert action
T sqrt(T t)
Definition: SSEVec.h:46
int j
Definition: DBlmapReader.cc:9
double f[11][100]
#define LogTrace(id)
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
void insert(const key_type &k, const data_type &v)
insert an association
const_iterator begin() const
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
const Point & position() const
position
Definition: BeamSpot.h:63
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:72
reco::SimToRecoCollection TrackAssociatorByChi2::associateSimToReco ( edm::Handle< edm::View< reco::Track > > &  tCH,
edm::Handle< TrackingParticleCollection > &  tPCH,
const edm::Event event = 0,
const edm::EventSetup setup = 0 
) const
inlinevirtual

compare reco to sim the handle of reco::Track and TrackingParticle collections

Reimplemented from TrackAssociatorBase.

Definition at line 104 of file TrackAssociatorByChi2.h.

References TrackAssociatorBase::associateSimToReco(), event(), and HcalObjRepresent::setup().

107  {
108  return TrackAssociatorBase::associateSimToReco(tCH,tPCH,event,setup);
109  }
virtual reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
double TrackAssociatorByChi2::compareTracksParam ( reco::TrackCollection::const_iterator  ,
edm::SimTrackContainer::const_iterator  ,
const math::XYZTLorentzVectorD  ,
GlobalVector  ,
reco::TrackBase::CovarianceMatrix  ,
const reco::BeamSpot  
) const

compare reco::TrackCollection and edm::SimTrackContainer iterators: returns the chi2

TrackAssociatorByChi2::RecoToSimPairAssociation TrackAssociatorByChi2::compareTracksParam ( const reco::TrackCollection rtColl,
const edm::SimTrackContainer stColl,
const edm::SimVertexContainer svColl,
const reco::BeamSpot bs 
) const

compare collections reco to sim

Definition at line 40 of file TrackAssociatorByChi2.cc.

References reco::deltaPhi(), f, i, and j.

43  {
44 
45  RecoToSimPairAssociation outputVec;
46 
47  for (TrackCollection::const_iterator track=rtColl.begin(); track!=rtColl.end(); track++){
48  Chi2SimMap outMap;
49 
50  TrackBase::ParameterVector rParameters = track->parameters();
51 
52  TrackBase::CovarianceMatrix recoTrackCovMatrix = track->covariance();
53  if (onlyDiagonal){
54  for (unsigned int i=0;i<5;i++){
55  for (unsigned int j=0;j<5;j++){
56  if (i!=j) recoTrackCovMatrix(i,j)=0;
57  }
58  }
59  }
60  recoTrackCovMatrix.Invert();
61 
62  for (SimTrackContainer::const_iterator st=stColl.begin(); st!=stColl.end(); st++){
63 
64  Basic3DVector<double> momAtVtx(st->momentum().x(),st->momentum().y(),st->momentum().z());
65  Basic3DVector<double> vert = (Basic3DVector<double>) svColl[st->vertIndex()].position();
66 
67  std::pair<bool,reco::TrackBase::ParameterVector> params = parametersAtClosestApproach(vert, momAtVtx, st->charge(), bs);
68  if (params.first){
69  TrackBase::ParameterVector sParameters = params.second;
70 
71  TrackBase::ParameterVector diffParameters = rParameters - sParameters;
72  diffParameters[2] = reco::deltaPhi(diffParameters[2],0.f);
73  double chi2 = ROOT::Math::Dot(diffParameters * recoTrackCovMatrix, diffParameters);
74  chi2/=5;
75  if (chi2<chi2cut) outMap[chi2]=*st;
76  }
77  }
78  outputVec.push_back(RecoToSimPair(*track,outMap));
79  }
80  return outputVec;
81 }
int i
Definition: DBlmapReader.cc:9
std::pair< bool, reco::TrackBase::ParameterVector > parametersAtClosestApproach(Basic3DVector< double >, Basic3DVector< double >, float, const reco::BeamSpot &) const
propagate the track parameters of TrackinParticle from production vertex to the point of closest appr...
std::pair< reco::Track, Chi2SimMap > RecoToSimPair
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:70
int j
Definition: DBlmapReader.cc:9
double f[11][100]
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
std::map< double, SimTrack > Chi2SimMap
std::vector< RecoToSimPair > RecoToSimPairAssociation
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:72
pair< bool, TrackBase::ParameterVector > TrackAssociatorByChi2::parametersAtClosestApproach ( Basic3DVector< double >  vertex,
Basic3DVector< double >  momAtVtx,
float  charge,
const reco::BeamSpot bs 
) const

propagate the track parameters of TrackinParticle from production vertex to the point of closest approach to the beam line.

Definition at line 136 of file TrackAssociatorByChi2.cc.

References FreeTrajectoryState::charge(), funct::cos(), Geom::halfPi(), PV3DBase< T, PVType, FrameType >::mag(), FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), FreeTrajectoryState::position(), funct::sin(), PV3DBase< T, PVType, FrameType >::theta(), TrajectoryStateClosestToBeamLine::trackStateAtPCA(), v, PV3DBase< T, PVType, FrameType >::x(), Basic3DVector< T >::x(), PV3DBase< T, PVType, FrameType >::y(), Basic3DVector< T >::y(), PV3DBase< T, PVType, FrameType >::z(), and Basic3DVector< T >::z().

Referenced by VertexFitterResult::fill().

139  {
140 
141  TrackBase::ParameterVector sParameters;
142  try {
143  FreeTrajectoryState ftsAtProduction(GlobalPoint(vertex.x(),vertex.y(),vertex.z()),
144  GlobalVector(momAtVtx.x(),momAtVtx.y(),momAtVtx.z()),
146  theMF.product());
147  TSCBLBuilderNoMaterial tscblBuilder;
148  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,bs);//as in TrackProducerAlgorithm
149 
150  GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position();
151  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
152  sParameters[0] = tsAtClosestApproach.trackStateAtPCA().charge()/p.mag();
153  sParameters[1] = Geom::halfPi() - p.theta();
154  sParameters[2] = p.phi();
155  sParameters[3] = (-v.x()*sin(p.phi())+v.y()*cos(p.phi()));
156  sParameters[4] = v.z()*p.perp()/p.mag() - (v.x()*p.x()+v.y()*p.y())/p.perp() * p.z()/p.mag();
157 
158  return pair<bool,TrackBase::ParameterVector>(true,sParameters);
159  } catch ( ... ) {
160  return pair<bool,TrackBase::ParameterVector>(false,sParameters);
161  }
162 }
T y() const
Cartesian y coordinate.
T perp() const
Definition: PV3DBase.h:71
T x() const
Cartesian x coordinate.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:62
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:70
TrackCharge charge() const
double charge(const std::vector< uint8_t > &Ampls)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
int TrackCharge
Definition: TrackCharge.h:4
T mag() const
Definition: PV3DBase.h:66
T z() const
Cartesian z coordinate.
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double halfPi()
Definition: Pi.h:33
GlobalVector momentum() const
edm::ESHandle< MagneticField > theMF
GlobalPoint position() const
T const * product() const
Definition: ESHandle.h:62
T x() const
Definition: PV3DBase.h:61
mathSSE::Vec4< T > v
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

edm::InputTag TrackAssociatorByChi2::bsSrc
private

Definition at line 114 of file TrackAssociatorByChi2.h.

Referenced by TrackAssociatorByChi2().

double TrackAssociatorByChi2::chi2cut
private

Definition at line 112 of file TrackAssociatorByChi2.h.

Referenced by TrackAssociatorByChi2().

bool TrackAssociatorByChi2::onlyDiagonal
private

Definition at line 113 of file TrackAssociatorByChi2.h.

Referenced by TrackAssociatorByChi2().

edm::ESHandle<MagneticField> TrackAssociatorByChi2::theMF
private

Definition at line 111 of file TrackAssociatorByChi2.h.

Referenced by TrackAssociatorByChi2().