38 |
|
#include "DataFormats/TrackReco/interface/Track.h" |
39 |
|
#include "DataFormats/TrackReco/interface/TrackFwd.h" |
40 |
|
#include "FWCore/ServiceRegistry/interface/Service.h" |
41 |
< |
#include "PhysicsTools/UtilAlgos/interface/TFileService.h" |
41 |
> |
#include "CommonTools/UtilAlgos/interface/TFileService.h" |
42 |
|
#include "UserCode/PVStudy/interface/PVStudy.h" |
43 |
|
// |
44 |
|
#include "DataFormats/VertexReco/interface/Vertex.h" |
86 |
|
nTrkMin_ = iConfig.getUntrackedParameter<int>("nTrkMin"); |
87 |
|
nTrkMax_ = iConfig.getUntrackedParameter<int>("nTrkMax"); |
88 |
|
zsigncut_ = iConfig.getUntrackedParameter<int>("zsigncut"); |
89 |
+ |
fHighPuritycut_ = iConfig.getUntrackedParameter<double>("fHighPuritycut"); |
90 |
+ |
useHWTrk_ = iConfig.getUntrackedParameter<bool>("useHWTrk",false); |
91 |
|
bsSrc = iConfig.getParameter< edm::InputTag >("beamSpot"); |
92 |
|
|
93 |
|
//now do what ever initialization is needed |
659 |
|
if(verbose_) |
660 |
|
cout<<"fraction of HighPurity track is "<<fHighPurity<<endl; |
661 |
|
|
662 |
< |
if( (fHighPurity<0.2 && nTracks>10) || vertexColl->begin()->isFake()) { |
663 |
< |
glob_runno_ = iEvent.id().run(); |
664 |
< |
glob_evtno_ = iEvent.id().event(); |
665 |
< |
glob_ls_ = iEvent.luminosityBlock(); |
666 |
< |
glob_bx_ = iEvent.bunchCrossing(); |
667 |
< |
return; |
668 |
< |
} |
667 |
< |
|
662 |
> |
if( (fHighPurity<fHighPuritycut_ && nTracks>10) || vertexColl->begin()->isFake()) return; |
663 |
> |
|
664 |
> |
glob_runno_ = iEvent.id().run(); |
665 |
> |
glob_evtno_ = iEvent.id().event(); |
666 |
> |
glob_ls_ = iEvent.luminosityBlock(); |
667 |
> |
glob_bx_ = iEvent.bunchCrossing(); |
668 |
> |
|
669 |
|
//======================================================================== |
670 |
|
// Step 2: Fill histograms for the splitting consistency checks |
671 |
|
//======================================================================== |
803 |
|
if(matchVertex(recvtx1, recvtx2, zsigncut_)) { |
804 |
|
edm::LogInfo("Debug")<<"[PVStudy] The two splitted vertices match in Z. "<<endl; |
805 |
|
|
806 |
< |
int nTrkPV1 = recvtx1->tracksSize(); |
807 |
< |
int nTrkPV2 = recvtx2->tracksSize(); |
806 |
> |
int nTrkPV1, nTrkPV2; |
807 |
> |
if(useHWTrk_) { |
808 |
> |
nTrkPV1 = nHWTrkRecVtx(*recvtx1); |
809 |
> |
nTrkPV2 = nHWTrkRecVtx(*recvtx2); |
810 |
> |
} |
811 |
> |
else { |
812 |
> |
nTrkPV1 = recvtx1->tracksSize(); |
813 |
> |
nTrkPV2 = recvtx2->tracksSize(); |
814 |
> |
} |
815 |
|
double ntrkreldiff = double(nTrkPV1-nTrkPV2)/double(nTrkPV1+nTrkPV2); |
816 |
|
h_misc->Fill1d("nTrkPVDiff", nTrkPV1-nTrkPV2); |
817 |
|
h_misc->Fill1d("nTrkPVRelDiff", ntrkreldiff); |
898 |
|
ferror_[0] = sqrt(pow(v1->xError(),2)+pow(v2->xError(),2))/sqrt(2); |
899 |
|
ferror_[1] = sqrt(pow(v1->yError(),2)+pow(v2->yError(),2))/sqrt(2); |
900 |
|
ferror_[2] = sqrt(pow(v1->zError(),2)+pow(v2->zError(),2))/sqrt(2); |
893 |
– |
fntrk_ = (v1->tracksSize()+v2->tracksSize())/2; |
901 |
|
|
902 |
+ |
int nTrkPV1, nTrkPV2; |
903 |
+ |
if(useHWTrk_) { |
904 |
+ |
nTrkPV1 = nHWTrkRecVtx(*v1); |
905 |
+ |
nTrkPV2 = nHWTrkRecVtx(*v2); |
906 |
+ |
} |
907 |
+ |
else { |
908 |
+ |
nTrkPV1 = v1->tracksSize(); |
909 |
+ |
nTrkPV2 = v2->tracksSize(); |
910 |
+ |
} |
911 |
+ |
|
912 |
+ |
fntrk_ = (nTrkPV1 + nTrkPV2)/2; |
913 |
+ |
|
914 |
|
h_summary->Fill1d("deltax", fres_[0] ); |
915 |
|
h_summary->Fill1d("deltay", fres_[1] ); |
916 |
|
h_summary->Fill1d("deltaz", fres_[2] ); |
942 |
|
|
943 |
|
|
944 |
|
//SplittedVertex |
945 |
< |
|
927 |
< |
nTrkPV1_spl_twovtx_[nrecPV_twovtx_] = v1->tracksSize(); |
945 |
> |
nTrkPV1_spl_twovtx_[nrecPV_twovtx_] = nTrkPV1; |
946 |
|
ndofPV1_spl_twovtx_[nrecPV_twovtx_] = v1->ndof(); |
947 |
|
normchi2PV1_spl_twovtx_[nrecPV_twovtx_] = v1->normalizedChi2(); |
948 |
|
avgPtPV1_spl_twovtx_[nrecPV_twovtx_] = avgPtRecVtx(*v1); |
949 |
|
errx1_spl_twovtx_[nrecPV_twovtx_] = v1->xError(); |
950 |
|
erry1_spl_twovtx_[nrecPV_twovtx_] = v1->yError(); |
951 |
|
errz1_spl_twovtx_[nrecPV_twovtx_] = v1->zError(); |
952 |
< |
|
953 |
< |
nTrkPV2_spl_twovtx_[nrecPV_twovtx_] = v2->tracksSize(); |
952 |
> |
|
953 |
> |
nTrkPV2_spl_twovtx_[nrecPV_twovtx_] = nTrkPV2; |
954 |
|
ndofPV2_spl_twovtx_[nrecPV_twovtx_] = v2->ndof(); |
955 |
|
normchi2PV2_spl_twovtx_[nrecPV_twovtx_] = v2->normalizedChi2(); |
956 |
|
avgPtPV2_spl_twovtx_[nrecPV_twovtx_] = avgPtRecVtx(*v2); |
959 |
|
errz2_spl_twovtx_[nrecPV_twovtx_] = v2->zError(); |
960 |
|
|
961 |
|
nrecPV_twovtx_++; |
944 |
– |
|
945 |
– |
|
962 |
|
|
963 |
|
// Print some information of the two tracks events |
964 |
|
if(verbose_ && fntrk_ < 4) { |
1307 |
|
v!=vertexColl->end(); ++v, ++ivtx) { |
1308 |
|
if(!v->isFake()) { |
1309 |
|
h_pvtrk->Fill1d("nTrkPV"+suffix, vertexColl->begin()->tracksSize()); |
1310 |
< |
h_pvtrk->Fill1d("ndofPV"+suffix, vertexColl->begin()->ndof()); |
1311 |
< |
int nHWTrkPV_ = 0; |
1310 |
> |
h_pvtrk->Fill1d("ndofPV"+suffix, vertexColl->begin()->ndof()); |
1311 |
> |
h_pvtrk->Fill1d("nHWTrkPV"+suffix, nHWTrkRecVtx(*v)); |
1312 |
|
try { |
1313 |
|
for(reco::Vertex::trackRef_iterator t = vertexColl->begin()->tracks_begin(); |
1314 |
|
t!=vertexColl->begin()->tracks_end(); t++) { |
1323 |
|
h_pvtrk->Fill1d("trkDzPV"+suffix, (**t).dz()); |
1324 |
|
h_pvtrk->Fill1d("trkEtaPV"+suffix, (**t).eta()); |
1325 |
|
h_pvtrk->Fill1d("trkPhiPV"+suffix, (**t).phi()); |
1310 |
– |
if(vertexColl->begin()->trackWeight(*t) > 0.5) |
1311 |
– |
nHWTrkPV_++; |
1326 |
|
} |
1327 |
|
} |
1328 |
|
} |
1330 |
|
// exception thrown when trying to use linked track |
1331 |
|
// h_pvtrk->Fill1d("trkPtPV", 0.); |
1332 |
|
} |
1319 |
– |
h_pvtrk->Fill1d("nHWTrkPV"+suffix, nHWTrkPV_); |
1333 |
|
} |
1334 |
|
} |
1335 |
|
} |
1350 |
|
suffix = "_mct"; |
1351 |
|
nrecPV_mct_ = 0; |
1352 |
|
} |
1353 |
< |
|
1353 |
> |
|
1354 |
|
//======================================================== |
1355 |
< |
// look for a matching reconstructed vertex in vertexColl |
1356 |
< |
//======================================================== |
1357 |
< |
|
1355 |
> |
// For each simulated vertex, look for a match in the vertexColl |
1356 |
> |
// If more than 1 recVtx is found, use the one with closest in Z |
1357 |
> |
//======================================================== |
1358 |
> |
|
1359 |
> |
// === look for a matching reconstructed vertex in vertexColl |
1360 |
|
for(reco::VertexCollection::const_iterator vrec=vtxColl->begin(); |
1361 |
|
vrec!=vtxColl->end(); ++vrec){ |
1362 |
|
vsim->recVtx=NULL; |
1363 |
|
edm::LogInfo("Debug") << "[fillMCHisto] sim primary vertex x = " << vsim->x << "; y = " << vsim->y << "; z = " << vsim->z << endl; |
1364 |
|
edm::LogInfo("Debug") << "[fillMCHisto] Is matched? " << (matchVertex(*vsim,*vrec)?"Yes":"No") << endl; |
1365 |
< |
|
1365 |
> |
|
1366 |
|
if ( matchVertex(*vsim,*vrec) ) { |
1367 |
|
vsim->recVtx=&(*vrec); |
1368 |
< |
|
1354 |
< |
// if the matching critera are fulfilled, accept the rec-vertex that is closest in z |
1368 |
> |
//if the matching critera are fulfilled, accept the rec-vertex that is closest in z |
1369 |
|
//if( ((vsim->recVtx) && (fabs(vsim->recVtx->position().z()-vsim->z)>fabs(vrec->z()-vsim->z))) |
1370 |
|
//|| (!vsim->recVtx) ) |
1371 |
|
//vsim->recVtx=&(*vrec); |
1358 |
– |
//} |
1359 |
– |
edm::LogInfo("Debug") <<"[fillMCHisto] primary matched in vertexColl" << vsim->x << " " << vsim->y << " " << vsim->z << endl; |
1360 |
– |
|
1361 |
– |
double fres_mct[3]; |
1362 |
– |
double ferror_mct[3]; |
1363 |
– |
int nrectrk = int(vsim->recVtx->tracksSize()); |
1364 |
– |
double ndofPV = vsim->recVtx->ndof(); |
1365 |
– |
double normchi2PV = vsim->recVtx->normalizedChi2(); |
1366 |
– |
double avgPtPV = avgPtRecVtx(*(vsim->recVtx)); |
1367 |
– |
|
1368 |
– |
fres_mct[0] = vsim->recVtx->x()-vsim->x; |
1369 |
– |
fres_mct[1] = vsim->recVtx->y()-vsim->y; |
1370 |
– |
fres_mct[2] = vsim->recVtx->z()-vsim->z; |
1371 |
– |
ferror_mct[0] = vsim->recVtx->xError(); |
1372 |
– |
ferror_mct[1] = vsim->recVtx->yError(); |
1373 |
– |
ferror_mct[2] = vsim->recVtx->zError(); |
1374 |
– |
|
1375 |
– |
h_summary->Fill1d("deltax"+suffix, fres_mct[0] ); |
1376 |
– |
h_summary->Fill1d("deltay"+suffix, fres_mct[1] ); |
1377 |
– |
h_summary->Fill1d("deltaz"+suffix, fres_mct[2] ); |
1378 |
– |
h_summary->Fill1d("pullx"+suffix, fres_mct[0]/ferror_mct[0] ); |
1379 |
– |
h_summary->Fill1d("pully"+suffix, fres_mct[1]/ferror_mct[1] ); |
1380 |
– |
h_summary->Fill1d("pullz"+suffix, fres_mct[2]/ferror_mct[2] ); |
1381 |
– |
h_summary->Fill1d("errPVx"+suffix, ferror_mct[0] ); |
1382 |
– |
h_summary->Fill1d("errPVy"+suffix, ferror_mct[1] ); |
1383 |
– |
h_summary->Fill1d("errPVz"+suffix, ferror_mct[2] ); |
1384 |
– |
pvinfo.push_back(PVStudy::PVInfo(res(fres_mct[0], fres_mct[1], fres_mct[2]), |
1385 |
– |
error(ferror_mct[0], ferror_mct[1], ferror_mct[2]), |
1386 |
– |
nrectrk)); |
1387 |
– |
// Fill histo according to its track multiplicity |
1388 |
– |
fillHisto(res(fres_mct[0], fres_mct[1], fres_mct[2]), |
1389 |
– |
error(ferror_mct[0], ferror_mct[1], ferror_mct[2]), |
1390 |
– |
nrectrk, datatype); |
1391 |
– |
|
1392 |
– |
if(saventuple_) { |
1393 |
– |
//Fill the values for variables in pvtxtree_ |
1394 |
– |
if(datatype == 1) { |
1395 |
– |
nTrkPV_spl1_mct_[nrecPV_spl1_mct_] = nrectrk; |
1396 |
– |
ndofPV_spl1_mct_[nrecPV_spl1_mct_] = ndofPV; |
1397 |
– |
normchi2PV_spl1_mct_[nrecPV_spl1_mct_] = normchi2PV; |
1398 |
– |
avgPtPV_spl1_mct_[nrecPV_spl1_mct_] = avgPtPV; |
1399 |
– |
deltax_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[0]; |
1400 |
– |
deltay_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[1]; |
1401 |
– |
deltaz_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[2]; |
1402 |
– |
pullx_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[0]/ferror_mct[0]; |
1403 |
– |
pully_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[1]/ferror_mct[1]; |
1404 |
– |
pullz_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[2]/ferror_mct[2]; |
1405 |
– |
errx_spl1_mct_[nrecPV_spl1_mct_] = ferror_mct[0]; |
1406 |
– |
erry_spl1_mct_[nrecPV_spl1_mct_] = ferror_mct[1]; |
1407 |
– |
errz_spl1_mct_[nrecPV_spl1_mct_] = ferror_mct[2]; |
1408 |
– |
nrecPV_spl1_mct_++; |
1409 |
– |
} |
1410 |
– |
if(datatype == 2) { |
1411 |
– |
nTrkPV_spl2_mct_[nrecPV_spl2_mct_] = nrectrk; |
1412 |
– |
ndofPV_spl2_mct_[nrecPV_spl2_mct_] = ndofPV; |
1413 |
– |
normchi2PV_spl2_mct_[nrecPV_spl2_mct_] = normchi2PV; |
1414 |
– |
avgPtPV_spl2_mct_[nrecPV_spl2_mct_] = avgPtPV; |
1415 |
– |
deltax_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[0]; |
1416 |
– |
deltay_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[1]; |
1417 |
– |
deltaz_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[2]; |
1418 |
– |
pullx_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[0]/ferror_mct[0]; |
1419 |
– |
pully_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[1]/ferror_mct[1]; |
1420 |
– |
pullz_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[2]/ferror_mct[2]; |
1421 |
– |
errx_spl2_mct_[nrecPV_spl2_mct_] = ferror_mct[0]; |
1422 |
– |
erry_spl2_mct_[nrecPV_spl2_mct_] = ferror_mct[1]; |
1423 |
– |
errz_spl2_mct_[nrecPV_spl2_mct_] = ferror_mct[2]; |
1424 |
– |
nrecPV_spl2_mct_++; |
1425 |
– |
} |
1426 |
– |
if(datatype == 3) { |
1427 |
– |
nTrkPV_mct_[nrecPV_mct_] = nrectrk; |
1428 |
– |
ndofPV_mct_[nrecPV_mct_] = ndofPV; |
1429 |
– |
normchi2PV_mct_[nrecPV_mct_] = normchi2PV; |
1430 |
– |
avgPtPV_mct_[nrecPV_mct_] = avgPtPV; |
1431 |
– |
deltax_mct_[nrecPV_mct_] = fres_mct[0]; |
1432 |
– |
deltay_mct_[nrecPV_mct_] = fres_mct[0]; |
1433 |
– |
deltaz_mct_[nrecPV_mct_] = fres_mct[0]; |
1434 |
– |
pullx_mct_[nrecPV_mct_] = fres_mct[0]/ferror_mct[0]; |
1435 |
– |
pully_mct_[nrecPV_mct_] = fres_mct[1]/ferror_mct[1]; |
1436 |
– |
pullz_mct_[nrecPV_mct_] = fres_mct[2]/ferror_mct[2]; |
1437 |
– |
errx_mct_[nrecPV_mct_] = ferror_mct[0]; |
1438 |
– |
erry_mct_[nrecPV_mct_] = ferror_mct[1]; |
1439 |
– |
errz_mct_[nrecPV_mct_] = ferror_mct[2]; |
1440 |
– |
nrecPV_mct_++; |
1441 |
– |
} |
1442 |
– |
} // End of if(saventuple_) { |
1443 |
– |
} // if ( matchVertex(*vsim,*vrec) ) { |
1444 |
– |
else { // no rec vertex found for this simvertex |
1445 |
– |
edm::LogInfo("Debug") <<"[fillMCHisto] primary not found " << vsim->x << " " << vsim->y << " " << vsim->z << " nGenTrk=" << vsim->nGenTrk << endl; |
1372 |
|
} |
1373 |
|
} |
1374 |
+ |
|
1375 |
+ |
// === If match found fill the residual and pulls |
1376 |
+ |
if(vsim->recVtx) { |
1377 |
+ |
edm::LogInfo("Debug") <<"[fillMCHisto] primary matched in vertexColl" << vsim->x << " " << vsim->y << " " << vsim->z << endl; |
1378 |
+ |
// if study the resolution/pull for all tracks in the PVtx |
1379 |
+ |
int nrectrk; |
1380 |
+ |
|
1381 |
+ |
if(useHWTrk_) |
1382 |
+ |
nrectrk=nHWTrkRecVtx(*(vsim->recVtx)); |
1383 |
+ |
else |
1384 |
+ |
nrectrk = int(vsim->recVtx->tracksSize()); |
1385 |
+ |
|
1386 |
+ |
double fres_mct[3]; |
1387 |
+ |
double ferror_mct[3]; |
1388 |
+ |
|
1389 |
+ |
double ndofPV = vsim->recVtx->ndof(); |
1390 |
+ |
double normchi2PV = vsim->recVtx->normalizedChi2(); |
1391 |
+ |
double avgPtPV = avgPtRecVtx(*(vsim->recVtx)); |
1392 |
+ |
|
1393 |
+ |
fres_mct[0] = vsim->recVtx->x()-vsim->x; |
1394 |
+ |
fres_mct[1] = vsim->recVtx->y()-vsim->y; |
1395 |
+ |
fres_mct[2] = vsim->recVtx->z()-vsim->z; |
1396 |
+ |
ferror_mct[0] = vsim->recVtx->xError(); |
1397 |
+ |
ferror_mct[1] = vsim->recVtx->yError(); |
1398 |
+ |
ferror_mct[2] = vsim->recVtx->zError(); |
1399 |
+ |
|
1400 |
+ |
h_summary->Fill1d("deltax"+suffix, fres_mct[0] ); |
1401 |
+ |
h_summary->Fill1d("deltay"+suffix, fres_mct[1] ); |
1402 |
+ |
h_summary->Fill1d("deltaz"+suffix, fres_mct[2] ); |
1403 |
+ |
h_summary->Fill1d("pullx"+suffix, fres_mct[0]/ferror_mct[0] ); |
1404 |
+ |
h_summary->Fill1d("pully"+suffix, fres_mct[1]/ferror_mct[1] ); |
1405 |
+ |
h_summary->Fill1d("pullz"+suffix, fres_mct[2]/ferror_mct[2] ); |
1406 |
+ |
h_summary->Fill1d("errPVx"+suffix, ferror_mct[0] ); |
1407 |
+ |
h_summary->Fill1d("errPVy"+suffix, ferror_mct[1] ); |
1408 |
+ |
h_summary->Fill1d("errPVz"+suffix, ferror_mct[2] ); |
1409 |
+ |
pvinfo.push_back(PVStudy::PVInfo(res(fres_mct[0], fres_mct[1], fres_mct[2]), |
1410 |
+ |
error(ferror_mct[0], ferror_mct[1], ferror_mct[2]), |
1411 |
+ |
nrectrk)); |
1412 |
+ |
// Fill histo according to its track multiplicity |
1413 |
+ |
fillHisto(res(fres_mct[0], fres_mct[1], fres_mct[2]), |
1414 |
+ |
error(ferror_mct[0], ferror_mct[1], ferror_mct[2]), |
1415 |
+ |
nrectrk, datatype); |
1416 |
+ |
|
1417 |
+ |
if(saventuple_) { |
1418 |
+ |
//Fill the values for variables in pvtxtree_ |
1419 |
+ |
if(datatype == 1) { |
1420 |
+ |
nTrkPV_spl1_mct_[nrecPV_spl1_mct_] = nrectrk; |
1421 |
+ |
ndofPV_spl1_mct_[nrecPV_spl1_mct_] = ndofPV; |
1422 |
+ |
normchi2PV_spl1_mct_[nrecPV_spl1_mct_] = normchi2PV; |
1423 |
+ |
avgPtPV_spl1_mct_[nrecPV_spl1_mct_] = avgPtPV; |
1424 |
+ |
deltax_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[0]; |
1425 |
+ |
deltay_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[1]; |
1426 |
+ |
deltaz_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[2]; |
1427 |
+ |
pullx_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[0]/ferror_mct[0]; |
1428 |
+ |
pully_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[1]/ferror_mct[1]; |
1429 |
+ |
pullz_spl1_mct_[nrecPV_spl1_mct_] = fres_mct[2]/ferror_mct[2]; |
1430 |
+ |
errx_spl1_mct_[nrecPV_spl1_mct_] = ferror_mct[0]; |
1431 |
+ |
erry_spl1_mct_[nrecPV_spl1_mct_] = ferror_mct[1]; |
1432 |
+ |
errz_spl1_mct_[nrecPV_spl1_mct_] = ferror_mct[2]; |
1433 |
+ |
nrecPV_spl1_mct_++; |
1434 |
+ |
} |
1435 |
+ |
if(datatype == 2) { |
1436 |
+ |
nTrkPV_spl2_mct_[nrecPV_spl2_mct_] = nrectrk; |
1437 |
+ |
ndofPV_spl2_mct_[nrecPV_spl2_mct_] = ndofPV; |
1438 |
+ |
normchi2PV_spl2_mct_[nrecPV_spl2_mct_] = normchi2PV; |
1439 |
+ |
avgPtPV_spl2_mct_[nrecPV_spl2_mct_] = avgPtPV; |
1440 |
+ |
deltax_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[0]; |
1441 |
+ |
deltay_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[1]; |
1442 |
+ |
deltaz_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[2]; |
1443 |
+ |
pullx_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[0]/ferror_mct[0]; |
1444 |
+ |
pully_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[1]/ferror_mct[1]; |
1445 |
+ |
pullz_spl2_mct_[nrecPV_spl2_mct_] = fres_mct[2]/ferror_mct[2]; |
1446 |
+ |
errx_spl2_mct_[nrecPV_spl2_mct_] = ferror_mct[0]; |
1447 |
+ |
erry_spl2_mct_[nrecPV_spl2_mct_] = ferror_mct[1]; |
1448 |
+ |
errz_spl2_mct_[nrecPV_spl2_mct_] = ferror_mct[2]; |
1449 |
+ |
nrecPV_spl2_mct_++; |
1450 |
+ |
} |
1451 |
+ |
if(datatype == 3) { |
1452 |
+ |
nTrkPV_mct_[nrecPV_mct_] = nrectrk; |
1453 |
+ |
ndofPV_mct_[nrecPV_mct_] = ndofPV; |
1454 |
+ |
normchi2PV_mct_[nrecPV_mct_] = normchi2PV; |
1455 |
+ |
avgPtPV_mct_[nrecPV_mct_] = avgPtPV; |
1456 |
+ |
deltax_mct_[nrecPV_mct_] = fres_mct[0]; |
1457 |
+ |
deltay_mct_[nrecPV_mct_] = fres_mct[0]; |
1458 |
+ |
deltaz_mct_[nrecPV_mct_] = fres_mct[0]; |
1459 |
+ |
pullx_mct_[nrecPV_mct_] = fres_mct[0]/ferror_mct[0]; |
1460 |
+ |
pully_mct_[nrecPV_mct_] = fres_mct[1]/ferror_mct[1]; |
1461 |
+ |
pullz_mct_[nrecPV_mct_] = fres_mct[2]/ferror_mct[2]; |
1462 |
+ |
errx_mct_[nrecPV_mct_] = ferror_mct[0]; |
1463 |
+ |
erry_mct_[nrecPV_mct_] = ferror_mct[1]; |
1464 |
+ |
errz_mct_[nrecPV_mct_] = ferror_mct[2]; |
1465 |
+ |
nrecPV_mct_++; |
1466 |
+ |
} |
1467 |
+ |
} // End of if(saventuple_) { |
1468 |
+ |
} // if ( matchVertex(*vsim,*vrec) ) { |
1469 |
+ |
else { // no rec vertex found for this simvertex |
1470 |
+ |
edm::LogInfo("Debug") <<"[fillMCHisto] primary not found " << vsim->x << " " << vsim->y << " " << vsim->z << " nGenTrk=" << vsim->nGenTrk << endl; |
1471 |
+ |
} |
1472 |
|
} |
1473 |
|
|
1474 |
+ |
|
1475 |
|
void PVStudy::SetVarToZero() { |
1476 |
|
fntrk_ = 0; |
1477 |
|
//pvtx position (x,y,z) residual and error |
1601 |
|
|
1602 |
|
if(v.isFake() || !v.isValid() || v.tracksSize()==0 ) return 0; |
1603 |
|
else { |
1604 |
+ |
int nHWTrk = 0; |
1605 |
|
double sumpT = 0.; |
1606 |
|
for (reco::Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) { |
1607 |
< |
sumpT += (**it).pt(); |
1607 |
> |
if(v.trackWeight(*it) > 0.5 ) { |
1608 |
> |
sumpT += (**it).pt(); |
1609 |
> |
nHWTrk++; |
1610 |
> |
} |
1611 |
|
} |
1612 |
< |
return sumpT/double(v.tracksSize()); |
1612 |
> |
if(nHWTrk > 0) |
1613 |
> |
return sumpT/double(nHWTrk); |
1614 |
> |
else |
1615 |
> |
return 0; |
1616 |
|
} |
1617 |
|
} |
1618 |
|
|
1619 |
< |
|
1620 |
< |
|
1619 |
> |
int PVStudy::nHWTrkRecVtx(const reco::Vertex & v) { |
1620 |
> |
int nHWTrkPV = 0; |
1621 |
> |
for (reco::Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) { |
1622 |
> |
if(v.trackWeight(*it) > 0.5) |
1623 |
> |
nHWTrkPV++; |
1624 |
> |
} |
1625 |
> |
return nHWTrkPV; |
1626 |
> |
} |