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/02/11 00:15:08
Revision:
1.26
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 160 of file TrackAssociatorByChi2.cc.

References edm::RefToBaseVector< T >::begin(), edm::RefToBaseVector< T >::end(), 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().

163  {
164  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
165  e->getByLabel(bsSrc,recoBeamSpotHandle);
166  reco::BeamSpot bs = *recoBeamSpotHandle;
167 
168  RecoToSimCollection outputCollection;
169  double chi2;
170 
172  if (tPCH.size()!=0) tPC = *tPCH.product();
173 
174  int tindex=0;
175  for (RefToBaseVector<reco::Track>::const_iterator rt=tC.begin(); rt!=tC.end(); rt++, tindex++){
176 
177  LogDebug("TrackAssociator") << "=========LOOKING FOR ASSOCIATION===========" << "\n"
178  << "rec::Track #"<<tindex<<" with pt=" << (*rt)->pt() << "\n"
179  << "===========================================" << "\n";
180 
181  TrackBase::ParameterVector rParameters = (*rt)->parameters();
182 
183  TrackBase::CovarianceMatrix recoTrackCovMatrix = (*rt)->covariance();
184  if (onlyDiagonal){
185  for (unsigned int i=0;i<5;i++){
186  for (unsigned int j=0;j<5;j++){
187  if (i!=j) recoTrackCovMatrix(i,j)=0;
188  }
189  }
190  }
191 
192  recoTrackCovMatrix.Invert();
193 
194  int tpindex =0;
195  for (TrackingParticleCollection::const_iterator tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
196 
197  //skip tps with a very small pt
198  //if (sqrt(tp->momentum().perp2())<0.5) continue;
199  Basic3DVector<double> momAtVtx(tp->momentum().x(),tp->momentum().y(),tp->momentum().z());
200  Basic3DVector<double> vert=(Basic3DVector<double>) tp->vertex();
201 
202  std::pair<bool,reco::TrackBase::ParameterVector> params = parametersAtClosestApproach(vert, momAtVtx, tp->charge(), bs);
203  if (params.first){
204  TrackBase::ParameterVector sParameters=params.second;
205 
206  TrackBase::ParameterVector diffParameters = rParameters - sParameters;
207 
208  chi2 = ROOT::Math::Similarity(diffParameters, recoTrackCovMatrix);
209  chi2 /= 5;
210 
211  LogTrace("TrackAssociator") << "====TP index=" << tpindex << " RECO TRACK index="<<tindex<<" WITH PT=" << (*rt)->pt() << "====\n"
212  << "qoverp sim: " << sParameters[0] << "\n"
213  << "lambda sim: " << sParameters[1] << "\n"
214  << "phi sim: " << sParameters[2] << "\n"
215  << "dxy sim: " << sParameters[3] << "\n"
216  << "dsz sim: " << sParameters[4] << "\n"
217  << ": " /*<< */ << "\n"
218  << "qoverp rec: " << (*rt)->qoverp() << " err: " << (*rt)->error(0) << "\n"
219  << "lambda rec: " << (*rt)->lambda() << " err: " << (*rt)->error(1) << "\n"
220  << "phi rec: " << (*rt)->phi() << " err: " << (*rt)->error(2) << "\n"
221  << "dxy rec: " << (*rt)->dxy(bs.position()) << " err: " << (*rt)->error(3) << "\n"
222  << "dsz rec: " << (*rt)->dsz(bs.position()) << " err: " << (*rt)->error(4) << "\n"
223  << ": " /*<< */ << "\n"
224  << "chi2: " << chi2 << "\n";
225 
226  if (chi2<chi2cut) {
227  outputCollection.insert(tC[tindex],
228  std::make_pair(edm::Ref<TrackingParticleCollection>(tPCH, tpindex),
229  -chi2));//-chi2 because the Association Map is ordered using std::greater
230  }
231  }
232  }
233  }
234  outputCollection.post_insert();
235  return outputCollection;
236 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
C const * product() const
Accessor for product collection.
Definition: RefVector.h:269
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
#define LogTrace(id)
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:84
const Point & position() const
position
Definition: BeamSpot.h:63
std::vector< TrackingParticle > TrackingParticleCollection
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 240 of file TrackAssociatorByChi2.cc.

References edm::RefToBaseVector< T >::begin(), edm::RefToBaseVector< T >::end(), 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().

243  {
244  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
245  e->getByLabel(bsSrc,recoBeamSpotHandle);
246  reco::BeamSpot bs = *recoBeamSpotHandle;
247 
248  SimToRecoCollection outputCollection;
249  double chi2;
250 
252  if (tPCH.size()!=0) tPC = *tPCH.product();
253 
254  int tpindex =0;
255  for (TrackingParticleCollection::const_iterator tp=tPC.begin(); tp!=tPC.end(); tp++, ++tpindex){
256 
257  //skip tps with a very small pt
258  //if (sqrt(tp->momentum().perp2())<0.5) continue;
259 
260  LogDebug("TrackAssociator") << "=========LOOKING FOR ASSOCIATION===========" << "\n"
261  << "TrackingParticle #"<<tpindex<<" with pt=" << sqrt(tp->momentum().perp2()) << "\n"
262  << "===========================================" << "\n";
263 
264  Basic3DVector<double> momAtVtx(tp->momentum().x(),tp->momentum().y(),tp->momentum().z());
265  Basic3DVector<double> vert(tp->vertex().x(),tp->vertex().y(),tp->vertex().z());
266 
267  std::pair<bool,reco::TrackBase::ParameterVector> params = parametersAtClosestApproach(vert, momAtVtx, tp->charge(), bs);
268  if (params.first){
269  TrackBase::ParameterVector sParameters=params.second;
270 
271  int tindex=0;
272  for (RefToBaseVector<reco::Track>::const_iterator rt=tC.begin(); rt!=tC.end(); rt++, tindex++){
273 
274  TrackBase::ParameterVector rParameters = (*rt)->parameters();
275 
276  TrackBase::CovarianceMatrix recoTrackCovMatrix = (*rt)->covariance();
277  if (onlyDiagonal) {
278  for (unsigned int i=0;i<5;i++){
279  for (unsigned int j=0;j<5;j++){
280  if (i!=j) recoTrackCovMatrix(i,j)=0;
281  }
282  }
283  }
284 
285  recoTrackCovMatrix.Invert();
286 
287  TrackBase::ParameterVector diffParameters = rParameters - sParameters;
288 
289  chi2 = ROOT::Math::Similarity(recoTrackCovMatrix, diffParameters);
290  chi2 /= 5;
291 
292  LogTrace("TrackAssociator") << "====TP index=" << tpindex << " RECO TRACK index="<<tindex<<" WITH PT=" << (*rt)->pt() << "====\n"
293  << "qoverp sim: " << sParameters[0] << "\n"
294  << "lambda sim: " << sParameters[1] << "\n"
295  << "phi sim: " << sParameters[2] << "\n"
296  << "dxy sim: " << sParameters[3] << "\n"
297  << "dsz sim: " << sParameters[4] << "\n"
298  << ": " /*<< */ << "\n"
299  << "qoverp rec: " << (*rt)->qoverp() << " err: " << (*rt)->error(0) << "\n"
300  << "lambda rec: " << (*rt)->lambda() << " err: " << (*rt)->error(1) << "\n"
301  << "phi rec: " << (*rt)->phi() << " err: " << (*rt)->error(2) << "\n"
302  << "dxy rec: " << (*rt)->dxy(bs.position()) << " err: " << (*rt)->error(3) << "\n"
303  << "dsz rec: " << (*rt)->dsz(bs.position()) << " err: " << (*rt)->error(4) << "\n"
304  << ": " /*<< */ << "\n"
305  << "chi2: " << chi2 << "\n";
306 
307  if (chi2<chi2cut) {
308  outputCollection.insert(edm::Ref<TrackingParticleCollection>(tPCH, tpindex),
309  std::make_pair(tC[tindex],
310  -chi2));//-chi2 because the Association Map is ordered using std::greater
311  }
312  }
313  }
314  }
315  outputCollection.post_insert();
316  return outputCollection;
317 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
C const * product() const
Accessor for product collection.
Definition: RefVector.h:269
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:28
int j
Definition: DBlmapReader.cc:9
#define LogTrace(id)
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:84
const Point & position() const
position
Definition: BeamSpot.h:63
std::vector< TrackingParticle > TrackingParticleCollection
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 38 of file TrackAssociatorByChi2.cc.

References i, and j.

41  {
42 
43  RecoToSimPairAssociation outputVec;
44 
45  for (TrackCollection::const_iterator track=rtColl.begin(); track!=rtColl.end(); track++){
46  Chi2SimMap outMap;
47 
48  TrackBase::ParameterVector rParameters = track->parameters();
49 
50  TrackBase::CovarianceMatrix recoTrackCovMatrix = track->covariance();
51  if (onlyDiagonal){
52  for (unsigned int i=0;i<5;i++){
53  for (unsigned int j=0;j<5;j++){
54  if (i!=j) recoTrackCovMatrix(i,j)=0;
55  }
56  }
57  }
58  recoTrackCovMatrix.Invert();
59 
60  for (SimTrackContainer::const_iterator st=stColl.begin(); st!=stColl.end(); st++){
61 
62  Basic3DVector<double> momAtVtx(st->momentum().x(),st->momentum().y(),st->momentum().z());
63  Basic3DVector<double> vert = (Basic3DVector<double>) svColl[st->vertIndex()].position();
64 
65  std::pair<bool,reco::TrackBase::ParameterVector> params = parametersAtClosestApproach(vert, momAtVtx, st->charge(), bs);
66  if (params.first){
67  TrackBase::ParameterVector sParameters = params.second;
68 
69  TrackBase::ParameterVector diffParameters = rParameters - sParameters;
70  double chi2 = ROOT::Math::Dot(diffParameters * recoTrackCovMatrix, diffParameters);
71  chi2/=5;
72  if (chi2<chi2cut) outMap[chi2]=*st;
73  }
74  }
75  outputVec.push_back(RecoToSimPair(*track,outMap));
76  }
77  return outputVec;
78 }
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
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 132 of file TrackAssociatorByChi2.cc.

References FreeTrajectoryState::charge(), funct::cos(), Geom::halfPi(), PV3DBase< T, PVType, FrameType >::mag(), FreeTrajectoryState::momentum(), L1TEmulatorMonitor_cff::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().

135  {
136 
137  TrackBase::ParameterVector sParameters;
138  try {
139  FreeTrajectoryState ftsAtProduction(GlobalPoint(vertex.x(),vertex.y(),vertex.z()),
140  GlobalVector(momAtVtx.x(),momAtVtx.y(),momAtVtx.z()),
142  theMF.product());
143  TSCBLBuilderNoMaterial tscblBuilder;
144  TrajectoryStateClosestToBeamLine tsAtClosestApproach = tscblBuilder(ftsAtProduction,bs);//as in TrackProducerAlgorithm
145 
146  GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position();
147  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
148  sParameters[0] = tsAtClosestApproach.trackStateAtPCA().charge()/p.mag();
149  sParameters[1] = Geom::halfPi() - p.theta();
150  sParameters[2] = p.phi();
151  sParameters[3] = (-v.x()*sin(p.phi())+v.y()*cos(p.phi()));
152  sParameters[4] = v.z()*p.perp()/p.mag() - (v.x()*p.x()+v.y()*p.y())/p.perp() * p.z()/p.mag();
153 
154  return pair<bool,TrackBase::ParameterVector>(true,sParameters);
155  } catch ( ... ) {
156  return pair<bool,TrackBase::ParameterVector>(false,sParameters);
157  }
158 }
T y() const
Cartesian y coordinate.
T perp() const
Definition: PV3DBase.h:66
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:63
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:57
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:69
int TrackCharge
Definition: TrackCharge.h:4
T mag() const
Definition: PV3DBase.h:61
T z() const
Cartesian z coordinate.
T z() const
Definition: PV3DBase.h:58
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:56
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().