14 AddTvTrack::AddTvTrack( vector<TransientVertex> *PrimaryVertices, vector<TransientVertex> *SecondaryVertices,
double maxSigOnDistTrackToB)
16 thePrimaryVertices = PrimaryVertices;
17 theSecondaryVertices = SecondaryVertices;
19 MaxSigOnDistTrackToB = maxSigOnDistTrackToB;
22 MaxSigOnDistTrackToB = 10.0;
35 theTrackInfoVector.clear();
43 vector<TransientTrack> unusedTrackswithIPSig;
44 for( vector<TransientTrack>::const_iterator itT = unusedTracks.begin() ;
45 itT != unusedTracks.end() ; itT++ ) {
53 if (
debug)
cout <<
"[AddTvTrack] tip val,err"<<val<<
","<<error<<endl;
59 if(
abs(val/err)>theIPSig ) unusedTrackswithIPSig.push_back(*itT);
62 if (
debug)
cout<<
"[AddTvTrack] tracks surviving IPSig cut: "
63 <<unusedTrackswithIPSig.size()<<endl;
66 if( unusedTrackswithIPSig.empty() )
return *theSecondaryVertices;
70 double px = (*theSecondaryVertices)[0].position().x()
71 - (*thePrimaryVertices)[0].position().x();
72 double py = (*theSecondaryVertices)[0].position().y()
73 - (*thePrimaryVertices)[0].position().y();
74 double pz = (*theSecondaryVertices)[0].position().z()
75 - (*thePrimaryVertices)[0].position().z();
77 Line bFlightLine( PVposition , bVector);
81 (*theSecondaryVertices)[0].
position(),
82 (*thePrimaryVertices)[0].positionError(),
83 (*theSecondaryVertices)[0].positionError() );
86 vector<TransientTrack> TracksToAdd;
89 for( vector<TransientTrack>::const_iterator itT =
90 unusedTrackswithIPSig.begin() ; itT != unusedTrackswithIPSig.end() ;
114 if (cptl.isValid()) {
120 -cptl.globalPosition();
122 -cptl.globalPosition();
128 MyTransientTrackTrajectory=cptl2;
131 MyTransientTrackTrajectory=cptl;
135 GlobalPoint GlobalPoint2 = MyTransientTrackTrajectory.globalPosition();
140 double X = GlobalPoint2.
x() + VecDistTrackbFlightLine.
x();
141 double Y = GlobalPoint2.
y() + VecDistTrackbFlightLine.
y();
142 double Z = GlobalPoint2.
z() + VecDistTrackbFlightLine.
z();
146 pair<GlobalPoint,GlobalPoint> TheTwoPoints(GlobalPoint1, GlobalPoint2);
152 MyLineCovMatrix.
GetMatrix( TheTwoPoints.first );
155 vector<TransientTrack> emptyVectorTracks;
157 VertexState theState1 (TheTwoPoints.first , ErrOnBFlightTraj );
159 VertexState theState2 ( TheTwoPoints.second,
160 MyTransientTrackTrajectory.cartesianError().position() );
169 bool HemisphereOk =
false;
171 - (*theSecondaryVertices)[0].
position().
x() ) >
173 - (*theSecondaryVertices)[0].
position().
y() ) ) {
174 if ( (*thePrimaryVertices)[0].
position().
x()
175 < (*theSecondaryVertices)[0].
position().
x() &&
177 < TheTwoPoints.first.x() ) HemisphereOk =
true;
178 if ( (*thePrimaryVertices)[0].position().x()
179 > (*theSecondaryVertices)[0].position().x() &&
180 (*thePrimaryVertices)[0].position().x()
181 > TheTwoPoints.first.x() ) HemisphereOk =
true;
184 if ( (*thePrimaryVertices)[0].position().y()
185 < (*theSecondaryVertices)[0].position().y() &&
186 (*thePrimaryVertices)[0].position().y()
187 < TheTwoPoints.first.y() ) HemisphereOk =
true;
188 if ( (*thePrimaryVertices)[0].position().y()
189 > (*theSecondaryVertices)[0].position().y() &&
190 (*thePrimaryVertices)[0].position().y()
191 > TheTwoPoints.first.y() ) HemisphereOk =
true;
194 double HemisOK = 0.0;
195 if( HemisphereOk ) HemisOK = 1.0;
203 double Dist_X=TheTwoPoints.second.x()
204 -(*thePrimaryVertices)[0].position().x();
205 double Dist_Y=TheTwoPoints.second.y()
206 -(*thePrimaryVertices)[0].position().y();
207 double Dist_Z=TheTwoPoints.second.z()
208 -(*thePrimaryVertices)[0].position().z();
209 double Dist_to_PV =
sqrt(Dist_X*Dist_X + Dist_Y*Dist_Y + Dist_Z*Dist_Z);
216 Dist_X = TheTwoPoints.second.x();
217 Dist_Y = TheTwoPoints.second.y();
218 double Dist_to_Beam =
sqrt(Dist_X*Dist_X + Dist_Y*Dist_Y);
219 if( Dist_to_Beam < 0.01 || Dist_to_Beam > 2.5 ) HemisphereOk =
false;
223 if(Sig<MaxSigOnDistTrackToB && HemisphereOk) TracksToAdd.push_back(*itT);
235 double IPSig = IP/err;
239 InfArray[1] = Dist_to_Beam;
240 InfArray[2] = Dist_to_PV;
241 InfArray[3] = HemisOK;
244 if (Sig > 10.0) Sig = 10.0 ;
245 if ( HemisphereOk ) InfArray[6]=Sig;
246 else InfArray[6]=-Sig;
248 theTrackInfoVector.push_back(
TrackInfo(&*itT,InfArray));
272 if (
debug)
cout <<
"[AddTvTrack] tracks to add: "<<TracksToAdd.size()<<endl;
274 if( ! TracksToAdd.empty() ) {
277 vector<TransientVertex> NewSecondaryVertices = *theSecondaryVertices;
278 vector<TransientTrack> VertexTracks =
279 NewSecondaryVertices[0].originalTracks();
281 VertexState theState ( NewSecondaryVertices[0].
position(),
282 NewSecondaryVertices[0].positionError() );
288 if( NewSecondaryVertices[0].hasTrackWeight() ) {
289 TrackWeightMap = NewSecondaryVertices[0].weightMap() ;
291 TransientTrackToFloatMap::iterator itMapEnd = TrackWeightMap.end();
292 for(vector<TransientTrack>::const_iterator itT = TracksToAdd.begin();
293 itT != TracksToAdd.end(); itT++) {
296 pair< TransientTrack , float > TrackMapPair( (*itT) , 0.0);
297 itMapEnd = TrackWeightMap.insert( itMapEnd, TrackMapPair );
303 TransientTrackToFloatMap::iterator itMapEnd = TrackWeightMap.end();
304 for(vector<TransientTrack>::const_iterator itT = VertexTracks.begin();
305 itT != VertexTracks.end(); itT++) {
308 pair< TransientTrack , float > TrackMapPair( (*itT) , 1.0);
309 itMapEnd = TrackWeightMap.insert( itMapEnd, TrackMapPair );
311 for(vector<TransientTrack>::const_iterator itT = TracksToAdd.begin();
312 itT != TracksToAdd.end(); itT++) {
315 pair< TransientTrack , float > TrackMapPair( (*itT) , 0.0);
316 itMapEnd = TrackWeightMap.insert( itMapEnd, TrackMapPair );
320 for(vector<TransientTrack>::const_iterator itT = TracksToAdd.begin();
321 itT!=TracksToAdd.end(); itT++)
322 VertexTracks.push_back(*itT);
329 NewSecondaryVertices[0].totalChiSquared(),
330 NewSecondaryVertices[0].degreesOfFreedom());
335 NewSecondaryVertices[0] = NewVertex;
336 return NewSecondaryVertices;
339 return *theSecondaryVertices;
const double Z[kNumberCalorimeter]
virtual Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const
const PerigeeTrajectoryError & perigeeError() const
const GlobalTrajectoryParameters & parameters() const
std::map< reco::TransientTrack, float > TransientTrackToFloatMap
GlobalPoint globalPosition() const
const MagneticField * field() const
static int position[TOTALCHAMBERS][3]
GlobalVector distance(const Line &aLine) const
std::vector< TransientVertex > * getSecondaryVertices() const
TrajectoryStateOnSurface innermostMeasurementState() const
const PerigeeTrajectoryParameters & perigeeParameters() const
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
double transverseImpactParameter() const
FreeTrajectoryState const * freeState(bool withErrors=true) const
Abs< T >::type abs(const T &t)
TrajectoryStateOnSurface outermostMeasurementState() const
const AlgebraicSymMatrix55 & covarianceMatrix() const
AddTvTrack(std::vector< TransientVertex > *, std::vector< TransientVertex > *, double)
double significance() const
GlobalError GetMatrix(GlobalPoint)
TrajectoryStateOnSurface impactPointState() const
TransientTrackToFloatMap weightMap() const
Power< A, B >::type pow(const A &a, const B &b)