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 Member Functions | Private Attributes
VertexFitterResult Class Reference

#include <VertexFitterResult.h>

Public Types

typedef std::vector
< reco::TransientTrack
TTrackCont
 

Public Member Functions

const float * chi2Information () const
 
void fill (const TransientVertex &recv, const TrackingVertex *simv=0, reco::RecoToSimCollection *recSimColl=0, const float &time=0)
 
void fill (const TransientVertex &recVertex, const TTrackCont &recTrackV, const TrackingVertex *simv=0, reco::RecoToSimCollection *recSimColl=0, const float &time=0)
 
const int * numberRecTracks ()
 
const int * numberSimTracks ()
 
const float * recErrors (const int i) const
 
const float * recParameters (const int i) const
 
const int * recTrack_simIndex ()
 
const float * recTrackWeight ()
 
const float * recVertexErr () const
 
const float * recVertexPos () const
 
const float * refErrors (const int i) const
 
const float * refParameters (const int i) const
 
void reset ()
 
const float * simParameters (const int i) const
 
const int * simTrack_recIndex ()
 
const float * simVertexPos () const
 
const float * time () const
 
const int * trackInformation () const
 
 VertexFitterResult (const int maxTracks=100, const MagneticField *=0)
 
const int * vertexPresent () const
 
 ~VertexFitterResult ()
 

Private Member Functions

void fillErrors (const PerigeeTrajectoryError &pte, float *errors[5], int trackNumber)
 
void fillParameters (const reco::TrackBase::ParameterVector &perigee, float *params[5], int trackNumber)
 
void fillParameters (const PerigeeTrajectoryParameters &ptp, float *params[5], int trackNumber)
 

Private Attributes

float chi [3]
 
float fitTime
 
int numberOfRecTracks
 
int numberOfSimTracks
 
float recErr [3]
 
float * recErrs [5]
 
int * recIndex
 
float * recPars [5]
 
float recPos [3]
 
float * refErrs [5]
 
float * refPars [5]
 
int * simIndex
 
float * simPars [5]
 
float simPos [3]
 
const MagneticFieldtheMagField
 
int theMaxTracks
 
int tracks [3]
 
float * trackWeight
 
int vertex
 

Detailed Description

Very basic class containing only the positions of the simulated and reconstructed vertices, total chi**2, chi**2 probability and number of degrees of freedom. The only thing to be done is to call the method fill for each vertex.

Definition at line 25 of file VertexFitterResult.h.

Member Typedef Documentation

Definition at line 29 of file VertexFitterResult.h.

Constructor & Destructor Documentation

VertexFitterResult::VertexFitterResult ( const int  maxTracks = 100,
const MagneticField magField = 0 
)

Definition at line 10 of file VertexFitterResult.cc.

References i, numberOfRecTracks, numberOfSimTracks, recErrs, recIndex, recPars, refErrs, refPars, reset(), simIndex, simPars, theMagField, theMaxTracks, and trackWeight.

11  : theMagField(magField)
12 {
13  theMaxTracks = maxTracks;
14  if (theMagField==nullptr) theMaxTracks=0;
15  for ( int i=0; i<5; i++ ) {
16  if ( maxTracks>0 ) {
17  simPars[i] = new float[maxTracks];
18  recPars[i] = new float[maxTracks];
19  refPars[i] = new float[maxTracks];
20  recErrs[i] = new float[maxTracks];
21  refErrs[i] = new float[maxTracks];
22  }
23  else {
24  simPars[i] = 0;
25  recPars[i] = 0;
26  refPars[i] = 0;
27  recErrs[i] = 0;
28  refErrs[i] = 0;
29  }
30  }
31  trackWeight = new float[maxTracks];
32  simIndex = new int[maxTracks];
33  recIndex = new int[maxTracks];
36  reset();
37 }
int i
Definition: DBlmapReader.cc:9
const MagneticField * theMagField
VertexFitterResult::~VertexFitterResult ( )

Definition at line 39 of file VertexFitterResult.cc.

References i, recErrs, recIndex, recPars, refErrs, refPars, simIndex, simPars, and trackWeight.

40 {
41  //
42  // delete arrays
43  //
44  for ( int i=0; i<5; i++ ) {
45  delete [] simPars[i];
46  delete [] recPars[i];
47  delete [] refPars[i];
48  delete [] recErrs[i];
49  delete [] refErrs[i];
50  }
51  delete trackWeight;
52  delete simIndex;
53  delete recIndex;
54 }
int i
Definition: DBlmapReader.cc:9

Member Function Documentation

const float* VertexFitterResult::chi2Information ( ) const
inline

Definition at line 47 of file VertexFitterResult.h.

References chi.

Referenced by SimpleVertexTree::SimpleVertexTree().

47 {return chi;}
void VertexFitterResult::fill ( const TransientVertex recv,
const TrackingVertex simv = 0,
reco::RecoToSimCollection recSimColl = 0,
const float &  time = 0 
)

Definition at line 56 of file VertexFitterResult.cc.

References TransientVertex::isValid(), and TransientVertex::originalTracks().

Referenced by SimpleVertexTree::fill().

59 {
60  TTrackCont recTrackV;
61  if (recVertex.isValid()) recTrackV = recVertex.originalTracks();
62  fill(recVertex, recTrackV, simv, recSimColl, time);
63 }
std::vector< reco::TransientTrack > TTrackCont
void fill(const TransientVertex &recv, const TrackingVertex *simv=0, reco::RecoToSimCollection *recSimColl=0, const float &time=0)
const float * time() const
void VertexFitterResult::fill ( const TransientVertex recVertex,
const TTrackCont recTrackV,
const TrackingVertex simv = 0,
reco::RecoToSimCollection recSimColl = 0,
const float &  time = 0 
)

Definition at line 65 of file VertexFitterResult.cc.

References edm::RefVector< C, T, F >::begin(), chi, ChiSquaredProbability(), GlobalErrorBase< T, ErrorWeightType >::cxx(), GlobalErrorBase< T, ErrorWeightType >::cyy(), GlobalErrorBase< T, ErrorWeightType >::czz(), TrackingVertex::daughterTracks(), TrackingVertex::daughterTracks_begin(), TrackingVertex::daughterTracks_end(), TransientVertex::degreesOfFreedom(), alignCSCRings::e, edm::RefVector< C, T, F >::end(), fillErrors(), fillParameters(), spr::find(), fitTime, TransientVertex::isValid(), numberOfRecTracks, numberOfSimTracks, TransientVertex::originalTracks(), TrajectoryStateClosestToPoint::perigeeError(), TrackingVertex::position(), TransientVertex::position(), TransientVertex::positionError(), recErr, recErrs, recIndex, recPars, recPos, simIndex, simPars, simPos, mathSSE::sqrt(), theMagField, theMaxTracks, time(), TransientVertex::totalChiSquared(), reco::TrackTransientTrack::trackBaseRef(), reco::trackingParametersAtClosestApproachToBeamSpot(), tracks, vertex, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

68 {
69  TrackingParticleRefVector simTrackV;
70 
72  if (recVertex.isValid()) {
73  recPos[0] = recVertex.position().x();
74  recPos[1] = recVertex.position().y();
75  recPos[2] = recVertex.position().z();
76 
77  recErr[0] = sqrt(recVertex.positionError().cxx());
78  recErr[1] = sqrt(recVertex.positionError().cyy());
79  recErr[2] = sqrt(recVertex.positionError().czz());
80  vert = (Basic3DVector<double>) recVertex.position();
81 
82  chi[0] = recVertex.totalChiSquared();
83  chi[1] = recVertex.degreesOfFreedom();
84  chi[2] = ChiSquaredProbability(recVertex.totalChiSquared(),
85  recVertex.degreesOfFreedom());
86  vertex = 2;
87  fitTime = time;
88  tracks[1] = recVertex.originalTracks().size();
89  }
90 
91  if (simv!=0) {
92  simPos[0] = simv->position().x();
93  simPos[1] = simv->position().y();
94  simPos[2] = simv->position().z();
95 
96  simTrackV = simv->daughterTracks();
97  vertex += 1;
99  (simTrack != simv->daughterTracks_end() && (numberOfSimTracks<theMaxTracks));
100  simTrack++) {
101 
102  Basic3DVector<double> momAtVtx((**simTrack).momentum());
103 
104  std::pair<bool, reco::TrackBase::ParameterVector> paramPair =
106  (float) (**simTrack).charge(),
107  *theMagField,
108  recTrackV.front().stateAtBeamLine().beamSpot());
109  if (paramPair.first) {
110  fillParameters(paramPair.second, simPars, numberOfSimTracks);
113  }
114  }
116  }
117 
118 
119  // now store all the recTrack...
120 
121  for(TTrackCont::const_iterator recTrack =recTrackV.begin();
122  (recTrack != recTrackV.end()
124  recTrack++) {
125  // std::cout << "Input; 1/Pt " << 1./(*recTrack).momentumAtVertex().transverse() << std::endl;
126 
127  //looking for sim tracks corresponding to our reconstructed tracks:
129 
130  std::vector<std::pair<TrackingParticleRef, double> > simFound;
131  try {
132  const TrackTransientTrack* ttt = dynamic_cast<const TrackTransientTrack*>(recTrack->basicTransientTrack());
133  if ((ttt!=0) && (recSimColl!=0)) simFound = (*recSimColl)[ttt->trackBaseRef()];
134 // if (recSimColl!=0) simFound = (*recSimColl)[recTrack->persistentTrackRef()];
135 // if (recSimColl!=0) simFound = (*recSimColl)[recTrack];
136 
137  } catch (cms::Exception e) {
138 // LogDebug("TrackValidator") << "reco::Track #" << rT << " with pt=" << track->pt()
139 // << " NOT associated to any TrackingParticle" << "\n";
140 // edm::LogError("TrackValidator") << e.what() << "\n";
141  }
142 
143  if(simFound.size() != 0) {
144  //OK, it was associated, so get the state on the same surface as the 'SimState'
146  find(simTrackV.begin(), simTrackV.end(), simFound[0].first);
147  if (simTrackI!=simTrackV.end()) ++tracks[2];
148  int simTrackIndex = simTrackI-simTrackV.begin();
149  if (simTrackIndex<numberOfSimTracks) {
150  simIndex[numberOfRecTracks] = simTrackIndex;
151  recIndex[simTrackIndex] = numberOfRecTracks;
152  // cout << "Assoc; 1/Pt " << 1./(*recTrack).momentumAtVertex().transverse() << std::endl;
153  }
154  }
155 
156  TrajectoryStateClosestToPoint tscp = recTrack->trajectoryStateClosestToPoint(recVertex.position());
157  fillParameters(recTrack->track().parameters(), recPars, numberOfRecTracks);
159 // trackWeight[numberOfRecTracks] = recVertex.trackWeight(*recTrack);
160 //
161 // if ((recVertex.isValid())&&(recVertex.hasRefittedTracks())) {
162 // //looking for corresponding refitted tracks:
163 // TrajectoryStateOnSurface refip;
164 // RecTrackCont::iterator refTrackI =
165 // find_if(refTracks.begin(), refTracks.end(), RecTrackMatch(*recTrack));
166 // if (refTrackI!=refTracks.end()) {
167 // // If it was not found, it would mean that it was not used in the fit,
168 // // or with a low weight such that the track was then discarded.
169 // if(simFound.size() != 0) {
170 // refip = refTrackI->stateOnSurface(simFound[0]->impactPointStateOnSurface().surface());
171 // } else {
172 // refip = refTrackI->innermostState();
173 // }
174 //
175 // fillParameters(refip, refPars, numberOfRecTracks);
176 // fillErrors(refip, refErrs, numberOfRecTracks);
177 // }
178 // }
179 //
181  }
182 
183 }
GlobalError positionError() const
tp_iterator daughterTracks_begin() const
const MagneticField * theMagField
void fillErrors(const PerigeeTrajectoryError &pte, float *errors[5], int trackNumber)
const PerigeeTrajectoryError & perigeeError() const
float totalChiSquared() const
T y() const
Definition: PV3DBase.h:63
void fillParameters(const reco::TrackBase::ParameterVector &perigee, float *params[5], int trackNumber)
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
TrackBaseRef trackBaseRef() const
std::vector< reco::TransientTrack > const & originalTracks() const
float degreesOfFreedom() const
T sqrt(T t)
Definition: SSEVec.h:48
GlobalPoint position() const
T z() const
Definition: PV3DBase.h:64
float ChiSquaredProbability(double chiSquared, double nrDOF)
tp_iterator daughterTracks_end() const
std::pair< bool, reco::TrackBase::ParameterVector > trackingParametersAtClosestApproachToBeamSpot(const Basic3DVector< double > &vertex, const Basic3DVector< double > &momAtVtx, float charge, const MagneticField &magField, const BeamSpot &bs)
const TrackingParticleRefVector & daughterTracks() const
const float * time() const
T x() const
Definition: PV3DBase.h:62
bool isValid() const
const LorentzVector & position() const
void VertexFitterResult::fillErrors ( const PerigeeTrajectoryError pte,
float *  errors[5],
int  trackNumber 
)
private
void VertexFitterResult::fillParameters ( const reco::TrackBase::ParameterVector perigee,
float *  params[5],
int  trackNumber 
)
private

Definition at line 185 of file VertexFitterResult.cc.

Referenced by fill().

187 {
188  params[0][trackNumber] = perigee[0];
189  params[1][trackNumber] = perigee[1];
190  params[2][trackNumber] = perigee[2];
191  params[3][trackNumber] = perigee[3];
192  params[4][trackNumber] = perigee[4];
193 }
void VertexFitterResult::fillParameters ( const PerigeeTrajectoryParameters ptp,
float *  params[5],
int  trackNumber 
)
private

Definition at line 195 of file VertexFitterResult.cc.

References PerigeeTrajectoryParameters::vector().

197 {
198  const AlgebraicVector5 & perigee = ptp.vector();
199  params[0][trackNumber] = perigee[0];
200  params[1][trackNumber] = perigee[1];
201  params[2][trackNumber] = perigee[2];
202  params[3][trackNumber] = perigee[3];
203  params[4][trackNumber] = perigee[4];
204 }
const AlgebraicVector5 & vector() const
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const int* VertexFitterResult::numberRecTracks ( )
inline

Definition at line 52 of file VertexFitterResult.h.

References numberOfRecTracks.

Referenced by SimpleVertexTree::SimpleVertexTree().

const int* VertexFitterResult::numberSimTracks ( )
inline

Definition at line 51 of file VertexFitterResult.h.

References numberOfSimTracks.

Referenced by SimpleVertexTree::SimpleVertexTree().

const float* VertexFitterResult::recErrors ( const int  i) const
inline

Definition at line 73 of file VertexFitterResult.h.

References i, and recErrs.

Referenced by SimpleVertexTree::SimpleVertexTree().

74  {
75  if ( i<0 || i>=5 ) return 0;
76  return recErrs[i];
77  }
int i
Definition: DBlmapReader.cc:9
const float* VertexFitterResult::recParameters ( const int  i) const
inline

Definition at line 58 of file VertexFitterResult.h.

References i, and recPars.

Referenced by SimpleVertexTree::SimpleVertexTree().

59  {
60  if ( i<0 || i>=5 ) return 0;
61  return recPars[i];
62  }
int i
Definition: DBlmapReader.cc:9
const int* VertexFitterResult::recTrack_simIndex ( )
inline

Definition at line 56 of file VertexFitterResult.h.

References simIndex.

Referenced by SimpleVertexTree::SimpleVertexTree().

56 {return simIndex;}
const float* VertexFitterResult::recTrackWeight ( )
inline

Definition at line 57 of file VertexFitterResult.h.

References trackWeight.

Referenced by SimpleVertexTree::SimpleVertexTree().

57 {return trackWeight;}
const float* VertexFitterResult::recVertexErr ( ) const
inline

Definition at line 45 of file VertexFitterResult.h.

References recErr.

Referenced by SimpleVertexTree::SimpleVertexTree().

45 {return recErr;}
const float* VertexFitterResult::recVertexPos ( ) const
inline

Definition at line 44 of file VertexFitterResult.h.

References recPos.

Referenced by SimpleVertexTree::SimpleVertexTree().

44 {return recPos;}
const float* VertexFitterResult::refErrors ( const int  i) const
inline

Definition at line 78 of file VertexFitterResult.h.

References i, and refErrs.

Referenced by SimpleVertexTree::SimpleVertexTree().

79  {
80  if ( i<0 || i>=5 ) return 0;
81  return refErrs[i];
82  }
int i
Definition: DBlmapReader.cc:9
const float* VertexFitterResult::refParameters ( const int  i) const
inline

Definition at line 63 of file VertexFitterResult.h.

References i, and refPars.

Referenced by SimpleVertexTree::SimpleVertexTree().

64  {
65  if ( i<0 || i>=5 ) return 0;
66  return refPars[i];
67  }
int i
Definition: DBlmapReader.cc:9
void VertexFitterResult::reset ( void  )

Definition at line 216 of file VertexFitterResult.cc.

References chi, fitTime, i, j, numberOfRecTracks, numberOfSimTracks, recErr, recErrs, recIndex, recPars, recPos, refErrs, refPars, simIndex, simPars, simPos, tracks, trackWeight, and vertex.

Referenced by SimpleVertexTree::fill(), and VertexFitterResult().

217 {
218  for ( int i=0; i<3; ++i ) {
219  simPos[i] = 0.;
220  recPos[i] = 0.;
221  recErr[i] = 0.;
222  chi[i] = 0.;
223  tracks[i] = 0;
224  }
225  vertex =0;
226  fitTime = 0;
227 
228  for ( int j=0; j<numberOfRecTracks; ++j ) {
229  for ( int i=0; i<5; ++i ) {
230  recPars[i][j] = 0;
231  refPars[i][j] = 0;
232  recErrs[i][j] = 0;
233  refErrs[i][j] = 0;
234  }
235  trackWeight[j] = 0;
236  simIndex[j] = -1;
237  }
238  for ( int j=0; j<numberOfSimTracks; ++j ) {
239  for ( int i=0; i<5; ++i ) {
240  simPars[i][j] = 0;
241  }
242  recIndex[j] = -1;
243  }
244 
245  numberOfRecTracks=0;
246  numberOfSimTracks=0;
247 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
const float* VertexFitterResult::simParameters ( const int  i) const
inline

Definition at line 68 of file VertexFitterResult.h.

References i, and simPars.

Referenced by SimpleVertexTree::SimpleVertexTree().

69  {
70  if ( i<0 || i>=5 ) return 0;
71  return simPars[i];
72  }
int i
Definition: DBlmapReader.cc:9
const int* VertexFitterResult::simTrack_recIndex ( )
inline

Definition at line 54 of file VertexFitterResult.h.

References recIndex.

Referenced by SimpleVertexTree::SimpleVertexTree().

54 {return recIndex;}
const float* VertexFitterResult::simVertexPos ( ) const
inline

Definition at line 43 of file VertexFitterResult.h.

References simPos.

Referenced by SimpleVertexTree::SimpleVertexTree().

43 {return simPos;}
const float* VertexFitterResult::time ( ) const
inline

Definition at line 49 of file VertexFitterResult.h.

References fitTime.

Referenced by fill(), and SimpleVertexTree::SimpleVertexTree().

49 {return &fitTime;}
const int* VertexFitterResult::trackInformation ( ) const
inline

Definition at line 46 of file VertexFitterResult.h.

References tracks.

Referenced by SimpleVertexTree::SimpleVertexTree().

46 {return tracks;}
const int* VertexFitterResult::vertexPresent ( ) const
inline

Definition at line 48 of file VertexFitterResult.h.

References vertex.

Referenced by SimpleVertexTree::SimpleVertexTree().

48 {return &vertex;}

Member Data Documentation

float VertexFitterResult::chi[3]
private

Definition at line 120 of file VertexFitterResult.h.

Referenced by chi2Information(), fill(), and reset().

float VertexFitterResult::fitTime
private

Definition at line 123 of file VertexFitterResult.h.

Referenced by fill(), reset(), and time().

int VertexFitterResult::numberOfRecTracks
private

Definition at line 131 of file VertexFitterResult.h.

Referenced by fill(), numberRecTracks(), reset(), and VertexFitterResult().

int VertexFitterResult::numberOfSimTracks
private

Definition at line 131 of file VertexFitterResult.h.

Referenced by fill(), numberSimTracks(), reset(), and VertexFitterResult().

float VertexFitterResult::recErr[3]
private

Definition at line 119 of file VertexFitterResult.h.

Referenced by fill(), recVertexErr(), and reset().

float* VertexFitterResult::recErrs[5]
private

Definition at line 129 of file VertexFitterResult.h.

Referenced by fill(), recErrors(), reset(), VertexFitterResult(), and ~VertexFitterResult().

int * VertexFitterResult::recIndex
private
float* VertexFitterResult::recPars[5]
private
float VertexFitterResult::recPos[3]
private

Definition at line 118 of file VertexFitterResult.h.

Referenced by fill(), recVertexPos(), and reset().

float* VertexFitterResult::refErrs[5]
private

Definition at line 130 of file VertexFitterResult.h.

Referenced by refErrors(), reset(), VertexFitterResult(), and ~VertexFitterResult().

float* VertexFitterResult::refPars[5]
private
int* VertexFitterResult::simIndex
private
float* VertexFitterResult::simPars[5]
private
float VertexFitterResult::simPos[3]
private

Definition at line 117 of file VertexFitterResult.h.

Referenced by fill(), reset(), and simVertexPos().

const MagneticField* VertexFitterResult::theMagField
private

Definition at line 115 of file VertexFitterResult.h.

Referenced by fill(), and VertexFitterResult().

int VertexFitterResult::theMaxTracks
private

Definition at line 125 of file VertexFitterResult.h.

Referenced by fill(), and VertexFitterResult().

int VertexFitterResult::tracks[3]
private

Definition at line 121 of file VertexFitterResult.h.

Referenced by fill(), reset(), and trackInformation().

float* VertexFitterResult::trackWeight
private
int VertexFitterResult::vertex
private

Definition at line 122 of file VertexFitterResult.h.

Referenced by Tau.Tau::dxy(), fill(), reset(), and vertexPresent().