29 int NTrk=V.
selTrk.size(), SelT=-1;
33 for(
int i=0;
i<NTrk;
i++){
34 TSum += AllTracks.at(V.
selTrk[
i])->p4();
37 for(
int i=0;
i<NTrk;
i++){
38 TLorentzVector TSum_m1 = TSum - AllTracks[V.
selTrk[
i]]->p4();
39 if(TSum_m1.M()<massMin){massMin=TSum_m1.M(); SelT=
i;}
51 int nTrk_V1 = (*wrkVrtSet).at(V1).selTrk.size();
if( nTrk_V1< 2)
return 0;
52 int nTrk_V2 = (*wrkVrtSet).at(V2).selTrk.size();
if( nTrk_V2< 2)
return 0;
54 if(nTrk_V1 < nTrk_V2){
55 for(
int i=0;
i<nTrk_V1;
i++){
56 int trk=(*wrkVrtSet)[V1].selTrk[
i];
57 for(
int j=0; j<nTrk_V2; j++){
if( trk==(*wrkVrtSet)[V2].selTrk[j]){ nTrkCom++;
break;} }
60 for(
int i=0;
i<nTrk_V2;
i++){
61 int trk=(*wrkVrtSet)[V2].selTrk[
i];
62 for(
int j=0; j<nTrk_V1; j++){
if( trk==(*wrkVrtSet)[V1].selTrk[j]){ nTrkCom++;
break;} }
74 double foundMinVrtDst=1000000.;
76 for(
int iv=0; iv<(
int)wrkVrtSet->size()-1; iv++) {
77 if( (*wrkVrtSet)[iv].selTrk.size()< 2)
continue;
78 if(!(*wrkVrtSet)[iv].Good )
continue;
79 for(
int jv=iv+1; jv<(
int)wrkVrtSet->size(); jv++) {
80 if( (*wrkVrtSet)[jv].selTrk.size()< 2)
continue;
81 if(!(*wrkVrtSet)[jv].Good )
continue;
82 double tmp= std::abs((*wrkVrtSet)[iv].
vertex.x()-(*wrkVrtSet)[jv].vertex.x())
83 +std::abs((*wrkVrtSet)[iv].
vertex.y()-(*wrkVrtSet)[jv].vertex.y())
84 +std::abs((*wrkVrtSet)[iv].
vertex.z()-(*wrkVrtSet)[jv].vertex.z());
86 double tmpDst =
vrtVrtDist((*wrkVrtSet)[iv].
vertex,(*wrkVrtSet)[iv].vertexCov,
87 (*wrkVrtSet)[jv].
vertex,(*wrkVrtSet)[jv].vertexCov);
88 if(
std::find(checked.begin(),checked.end(),tmpDst) != checked.end())
continue;
89 if( tmpDst < foundMinVrtDst){foundMinVrtDst = tmpDst; V1=iv; V2=jv;}
92 return foundMinVrtDst;
101 std::vector<const xAOD::TrackParticle*> & allTrackList,
105 if(!v1.
Good || !
v2.Good)
return -1.;
107 int ntv1=v1.
selTrk.size();
108 int ntv2=
v2.selTrk.size();
109 if( ntv1<2 || ntv2<2 )
return -1.;
110 double prb_v1=TMath::Prob( v1.
chi2, 2*ntv1-3);
111 double prb_v2=TMath::Prob(
v2.chi2, 2*ntv2-3);
116 if(prb_v1>0.01&&prb_v2>0.01){
117 if( ntv1==ntv2 ) {
if(prb_v1>prb_v2)
swap=
true;}
118 else {
if(ntv1>ntv2)
swap=
true;}
120 if(prb_v1<0.01&&prb_v2<0.01){
121 if(prb_v1>prb_v2)
swap=
true;
123 if(prb_v1>0.01&&prb_v2<0.01){
124 if(prb_v1>prb_v2)
swap=
true;
126 if(
swap) {badV =&
v2; goodV =&v1;}
127 int badVNtrk=(*badV).
selTrk.size();
130 while(
it<(*badV).selTrk.size() ){
131 int trk=(*badV).selTrk[
it];
132 if(
std::find((*goodV).selTrk.begin(),(*goodV).selTrk.end(),trk) != (*goodV).selTrk.end()){
133 (*badV).selTrk.erase((*badV).selTrk.begin()+
it);
134 (*badV).detachedTrack=trk;
137 if((*badV).selTrk.size()<2){
140 (*badV).vertexCharge=allTrackList[(*badV).selTrk.at(0)]->charge();
141 (*badV).vertexMom=allTrackList[(*badV).selTrk.at(0)]->p4();
142 if( badVNtrk>=2 && TMath::Prob((*badV).chi2,2*badVNtrk-3)>0.1 ) (*badV).Good=
true;
146 return refitVertex((*badV),allTrackList, istate,
false);
152 std::vector<const xAOD::TrackParticle*> & AllTrackList,
156 if(!v1.
Good)
return -1.;
157 if(!
v2.Good)
return -1.;
158 std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0);
160 int nTrk_V1=v1.
selTrk.size();
161 int nTrk_V2=
v2.selTrk.size();
162 newvrt.
selTrk.resize(nTrk_V1+nTrk_V2);
168 TransfEnd = unique( newvrt.
selTrk.begin(), newvrt.
selTrk.end() );
170 std::vector<const xAOD::TrackParticle*> fitTrackList(0);
176 m_fitSvc->setRobustness(robKey,istate);
182 if(
sc.isFailure() )
return -1.;
183 if( newvrt.
chi2>500. )
return -1.;
188 return TMath::Prob( newvrt.
chi2, 2*newvrt.
selTrk.size()-3);
201 int nTrk=
vertex.selTrk.size();
202 if( nTrk<2 )
return 0.;
203 double prob=TMath::Prob(
vertex.chi2, 2*nTrk-3);
207 nTrk=
vertex.selTrk.size();
208 if(nTrk==2)
return prob;
210 for(
int i=0;
i<nTrk;
i++){
if(
vertex.chi2PerTrk[
i]>
vertex.chi2PerTrk[selT]) selT=
i; }
214 if(
prob<0.)
return 0.;
222 std::vector<const xAOD::TrackParticle*> & selectedTracks,
227 int nth = vrt.
selTrk.size();
229 if(nth<2)
return -1.;
231 std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0);
232 std::vector<const xAOD::TrackParticle*> listTracks(0);
235 listTracks.push_back( selectedTracks[j] );
245 if(
sc.isSuccess())vrt.
Good =
true;
246 else {vrt.
Good =
false;
return -1.;}
248 return TMath::Prob( vrt.
chi2, 2*nth-1);
255 for (
long int trk :
test)
264 return (
vv.x()*Mom.X()+
vv.y()*Mom.Y()+
vv.z()*Mom.Z() )/ Mom.P();