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, TrackAssociatorByChi2 *associator=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

TrackAssociatorByChi2associatorForParamAtPca
 
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]
 
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 24 of file VertexFitterResult.h.

Member Typedef Documentation

Definition at line 28 of file VertexFitterResult.h.

Constructor & Destructor Documentation

VertexFitterResult::VertexFitterResult ( const int  maxTracks = 100,
TrackAssociatorByChi2 associator = 0 
)

Definition at line 9 of file VertexFitterResult.cc.

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

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

Definition at line 38 of file VertexFitterResult.cc.

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

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

Member Function Documentation

const float* VertexFitterResult::chi2Information ( ) const
inline

Definition at line 46 of file VertexFitterResult.h.

References chi.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 55 of file VertexFitterResult.cc.

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

Referenced by SimpleVertexTree::fill().

58 {
59  TTrackCont recTrackV;
60  if (recVertex.isValid()) recTrackV = recVertex.originalTracks();
61  fill(recVertex, recTrackV, simv, recSimColl, time);
62 }
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 64 of file VertexFitterResult.cc.

References associatorForParamAtPca, 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(), TrackAssociatorByChi2::parametersAtClosestApproach(), TrajectoryStateClosestToPoint::perigeeError(), TrackingVertex::position(), TransientVertex::position(), TransientVertex::positionError(), recErr, recErrs, recIndex, recPars, recPos, simIndex, simPars, simPos, mathSSE::sqrt(), theMaxTracks, time(), TransientVertex::totalChiSquared(), reco::TrackTransientTrack::trackBaseRef(), tracks, vertex, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

Referenced by fill().

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

Definition at line 192 of file VertexFitterResult.cc.

References PerigeeTrajectoryParameters::vector().

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

Definition at line 51 of file VertexFitterResult.h.

References numberOfRecTracks.

Referenced by SimpleVertexTree::SimpleVertexTree().

const int* VertexFitterResult::numberSimTracks ( )
inline

Definition at line 50 of file VertexFitterResult.h.

References numberOfSimTracks.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 72 of file VertexFitterResult.h.

References i, and recErrs.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 57 of file VertexFitterResult.h.

References i, and recPars.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 55 of file VertexFitterResult.h.

References simIndex.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 56 of file VertexFitterResult.h.

References trackWeight.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 44 of file VertexFitterResult.h.

References recErr.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 43 of file VertexFitterResult.h.

References recPos.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 77 of file VertexFitterResult.h.

References i, and refErrs.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 62 of file VertexFitterResult.h.

References i, and refPars.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 213 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().

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

Definition at line 67 of file VertexFitterResult.h.

References i, and simPars.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 53 of file VertexFitterResult.h.

References recIndex.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 42 of file VertexFitterResult.h.

References simPos.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 48 of file VertexFitterResult.h.

References fitTime.

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

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

Definition at line 45 of file VertexFitterResult.h.

References tracks.

Referenced by SimpleVertexTree::SimpleVertexTree().

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

Definition at line 47 of file VertexFitterResult.h.

References vertex.

Referenced by SimpleVertexTree::SimpleVertexTree().

47 {return &vertex;}

Member Data Documentation

TrackAssociatorByChi2* VertexFitterResult::associatorForParamAtPca
private

Definition at line 114 of file VertexFitterResult.h.

Referenced by fill(), and VertexFitterResult().

float VertexFitterResult::chi[3]
private

Definition at line 119 of file VertexFitterResult.h.

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

float VertexFitterResult::fitTime
private

Definition at line 122 of file VertexFitterResult.h.

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

int VertexFitterResult::numberOfRecTracks
private

Definition at line 130 of file VertexFitterResult.h.

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

int VertexFitterResult::numberOfSimTracks
private

Definition at line 130 of file VertexFitterResult.h.

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

float VertexFitterResult::recErr[3]
private

Definition at line 118 of file VertexFitterResult.h.

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

float* VertexFitterResult::recErrs[5]
private

Definition at line 128 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 117 of file VertexFitterResult.h.

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

float* VertexFitterResult::refErrs[5]
private

Definition at line 129 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 116 of file VertexFitterResult.h.

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

int VertexFitterResult::theMaxTracks
private

Definition at line 124 of file VertexFitterResult.h.

Referenced by fill(), and VertexFitterResult().

int VertexFitterResult::tracks[3]
private

Definition at line 120 of file VertexFitterResult.h.

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

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

Definition at line 121 of file VertexFitterResult.h.

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