33 std::map<
long int,std::vector<double>> & goodVrt,
37 std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0);
38 std::vector<const xAOD::TrackParticle*> tracksForFit(2,
nullptr);
39 std::vector<double> impact,impactError;
40 std::vector<double> inpMass(2,
m_massPi);
45 std::vector<Vrt2Tr> all2TrVrt(0);
46 TLorentzVector PSum2T;
49 int NTracks = (
int) (selectedTracks.size());
54 double signifR=0.,signifZ=0.;
55 std::vector<int> nPixHits(NTracks,0);
56 std::vector<double> trackSignif(NTracks),dRdZratio(NTracks);
57 for (
i=0;
i<NTracks;
i++) {
58 m_fitSvc->VKalGetImpact(selectedTracks[
i], primVrt.
position(), 1, impact, impactError);
59 signifR = impact[0]/ sqrt(impactError[0]);
60 signifZ = impact[1]/ sqrt(impactError[2]);
61 trackSignif[
i] = sqrt( signifR*signifR + signifZ*signifZ);
62 dRdZratio[
i] = std::abs(signifR/signifZ);
67 h.m_hb_impactR->Fill( signifR,
m_w_1);
68 h.m_hb_impactZ->Fill( signifZ,
m_w_1);
69 h.m_hb_impactRZ->Fill(signifR, signifZ,
m_w_1);
70 h.m_hb_impact->Fill( trackSignif[
i],
m_w_1);
73 h.m_curTup->pttrk[
i]=selectedTracks[
i]->pt();
74 h.m_curTup->d0trk[
i]=selectedTracks[
i]->d0();
75 h.m_curTup->Sig3D[
i]=trackSignif[
i];
76 h.m_curTup->idHF[
i] =
getIdHF(selectedTracks[
i]);
77 h.m_curTup->dRdZrat[
i] =dRdZratio[
i];
80 h.m_curTup->trkTRT[
i] =TRTHits;
81 h.m_curTup->etatrk[
i] =selectedTracks[
i]->eta();
92 std::vector<std::vector<std::tuple<int,float>>> trkCount(NTracks);
93 std::unique_ptr<Trk::IVKalState> state =
m_fitSvc->makeState();
94 m_fitSvc->setMassInputParticles( inpMass, *state );
95 for (
i=0;
i<NTracks-1;
i++) {
97 for (j=
i+1; j<NTracks; j++) {
99 PSum2T=selectedTracks[
i]->p4()+selectedTracks[j]->p4();
101 if( std::abs(selectedTracks[
i]->eta()-selectedTracks[j]->eta())==0 &&
102 std::abs(selectedTracks[
i]->phi()-selectedTracks[j]->phi())==0 &&
103 std::abs(selectedTracks[
i]->
pt() -selectedTracks[j]->
pt())==0 )
continue;
104 float ihitR = selectedTracks[
i]->radiusOfFirstHit();
105 float jhitR = selectedTracks[j]->radiusOfFirstHit();
106 if(std::abs(ihitR-jhitR)>50.)
continue;
108 tracksForFit[0]=selectedTracks[
i];
109 tracksForFit[1]=selectedTracks[j];
112 if(
sc.isFailure() ) {
116 if( cosMomVrtDir>0. ) iniVrt=tmpVrt.
fitVertex;
119 if(nPixHits[
i]>0 && nPixHits[j]>0){
if(minDZ>
m_fastZSVCut)
continue; }
121 m_fitSvc->setApproximateVertex(iniVrt.x(), iniVrt.y(), iniVrt.z(),*state);
124 if(
sc.isFailure())
continue;
125 double Prob2v=TMath::Prob(tmpVrt.
chi2,1);
130 TLorentzVector SVPV(tmpVrt.
fitVertex.x()-primVrt.
x(),
135 if(Charge==0){
h.m_hb_massPiPi->Fill(tmpVrt.
momentum.M(),1.);}
136 h.m_hb_cosSVMom->Fill(cosSVPV,1.);
137 h.m_hb_etaSV->Fill(SVPV.Eta(),1.);
140 if(tmpVrt.
momentum.Pt()<1000.)
continue;
144 double dstMatSignif=1.e4;
146 if(vrtR<30.){ dstMatSignif=std::abs(vrtR-
m_beampipeR)/vrtRErr;}
153 int jhitIBL =
getIBLHit(selectedTracks[j]);
154 if( (ihitIBL==0&&jhitIBL>0) || (ihitIBL>0&&jhitIBL==0) )
continue;
155 int ihitBL =
getBLHit (selectedTracks[
i]);
156 int jhitBL =
getBLHit (selectedTracks[j]);
159 if( ihitIBL<1 && ihitBL<1)
continue;
160 if( jhitIBL<1 && jhitBL<1)
continue;
162 if( vrtR-
std::min(ihitR,jhitR) > 50.)
continue;
163 if(ihitR-vrtR > 180.+2.*vrtRErr)
continue;
164 if(jhitR-vrtR > 180.+2.*vrtRErr)
continue;
167 if(std::abs(ihitR-jhitR)>12.)
continue;
168 if( ihitR-vrtR > 36.)
continue;
169 if( jhitR-vrtR > 36.)
continue;
170 if( ihitR-vrtR <-2.*vrtRErr)
continue;
171 if( jhitR-vrtR <-2.*vrtRErr)
continue;
175 double minPtT =
std::min(tracksForFit[0]->
pt(),tracksForFit[1]->
pt());
178 double Sig3D=0.,Sig2D=0., Dist2D=0.;
179 int idisk1=0,idisk2=0,idisk3=0,jdisk1=0,jdisk2=0,jdisk3=0;
186 h.m_hb_signif3D->Fill(Sig3D,1.);
187 h.m_curTup->VrtTrkHF [
h.m_curTup->n2Vrt] =
getIdHF(tracksForFit[0])+
getIdHF(tracksForFit[1]);
189 h.m_curTup->VrtCh [
h.m_curTup->n2Vrt] = Charge;
190 h.m_curTup->VrtProb [
h.m_curTup->n2Vrt] = Prob2v;
191 h.m_curTup->VrtSig3D [
h.m_curTup->n2Vrt] = Sig3D;
192 h.m_curTup->VrtSig2D [
h.m_curTup->n2Vrt] = Sig2D;
193 h.m_curTup->VrtDist2D[
h.m_curTup->n2Vrt] = vrtR<20. ? Dist2D : vrtR;
194 h.m_curTup->VrtM [
h.m_curTup->n2Vrt] = tmpVrt.
momentum.M();
195 h.m_curTup->VrtZ [
h.m_curTup->n2Vrt] = tmpVrt.
fitVertex.z();
196 h.m_curTup->VrtPt [
h.m_curTup->n2Vrt] = tmpVrt.
momentum.Pt();
197 h.m_curTup->VrtEta [
h.m_curTup->n2Vrt] = SVPV.Eta();
198 h.m_curTup->VrtIBL [
h.m_curTup->n2Vrt] = sumIBLHits;
199 h.m_curTup->VrtBL [
h.m_curTup->n2Vrt] = sumBLHits;
200 h.m_curTup->VrtCosSPM[
h.m_curTup->n2Vrt] = cosSVPV;
201 h.m_curTup->VMinPtT [
h.m_curTup->n2Vrt] = minPtT;
202 h.m_curTup->VMinS3DT [
h.m_curTup->n2Vrt] =
std::min(trackSignif[
i],trackSignif[j]);
203 h.m_curTup->VMaxS3DT [
h.m_curTup->n2Vrt] =
std::max(trackSignif[
i],trackSignif[j]);
204 h.m_curTup->VrtBDT [
h.m_curTup->n2Vrt] = 1.1;
205 h.m_curTup->VrtHR1 [
h.m_curTup->n2Vrt] = ihitR;
206 h.m_curTup->VrtHR2 [
h.m_curTup->n2Vrt] = jhitR;
207 h.m_curTup->VrtDZ [
h.m_curTup->n2Vrt] = minDZ;
208 h.m_curTup->VrtDisk [
h.m_curTup->n2Vrt] = idisk1+10*idisk2+20*idisk3+30*jdisk1+40*jdisk2+50*jdisk3;
209 h.m_curTup->VSigMat [
h.m_curTup->n2Vrt] = dstMatSignif;
214 std::vector<float> VARS(10);
218 VARS[3]=
log(vrtR<20. ? SVPV.Perp() : vrtR);
222 VARS[7]=sqrt(std::abs(1.-cosSVPV*cosSVPV));
225 float wgtSelect=
m_SV2T_BDT->GetGradBoostMVA(VARS);
228 h.m_curTup->VrtBDT[
h.m_curTup->n2Vrt-1] = wgtSelect;
234 add_edge(
i,j,compatibilityGraph);
236 trkCount[
i].emplace_back(j,wgtSelect); trkCount[j].emplace_back(
i,wgtSelect);
240 for(
int t=0;
t<NTracks;
t++){
241 if(trkCount[
t].
size()==2){
242 i=std::get<0>(trkCount[
t][0]);
243 j=std::get<0>(trkCount[
t][1]);
244 if(trkCount[
i].
size()==1 && trkCount[j].
size()==1 ){
245 if( std::get<1>(trkCount[
t][0]) < std::get<1>(trkCount[
t][1]) ) {
246 remove_edge(
t,
i,compatibilityGraph);
247 if(
t<
i)goodVrt.erase(NTracks*
t+
i);
else goodVrt.erase(NTracks*
i+
t);
249 trkCount[
t].erase(trkCount[
t].
begin()+0);
251 remove_edge(
t,j,compatibilityGraph);
252 if(
t<j)goodVrt.erase(NTracks*
t+j);
else goodVrt.erase(NTracks*j+
t);
254 trkCount[
t].erase(trkCount[
t].
begin()+1);
260 for(
int t=0;
t<NTracks;
t++){
261 if(trkCount[
t].
size()==1){
262 i=std::get<0>(trkCount[
t][0]);
263 if(trkCount[
i].
size()==1){
265 remove_edge(
t,
i,compatibilityGraph);
266 if(
t<
i)goodVrt.erase(NTracks*
t+
i);
else goodVrt.erase(NTracks*
i+
t);