889 edm::LogVerbatim(
"Tracklet") <<
"The specified MyProcess is invalid! Exiting...";
1130 std::vector<l1t::TkJet>::const_iterator jetIter;
1143 std::vector<TTTrack<Ref_Phase2TrackerDigi_> >::const_iterator iterL1Track;
1163 if (GenParticleHandle.
isValid()) {
1164 vector<reco::GenParticle>::const_iterator genpartIter;
1166 float zvtx_gen = -999;
1167 for (genpartIter = GenParticleHandle->begin(); genpartIter != GenParticleHandle->end(); ++genpartIter) {
1168 int status = genpartIter->status();
1171 zvtx_gen = genpartIter->vz();
1178 for (
size_t i = 0;
i < GenParticleHandle->size(); ++
i) {
1182 if ((fabs(
id) == 12 || fabs(
id) == 14 || fabs(
id) == 16))
1184 if ((
isNeutrino ||
id == 1000022) &&
p.status() == 1) {
1185 trueMETx +=
p.pt() *
cos(
p.phi());
1186 trueMETy +=
p.pt() *
sin(
p.phi());
1189 trueMET =
sqrt(trueMETx * trueMETx + trueMETy * trueMETy);
1191 edm::LogWarning(
"DataNotFound") <<
"\nWarning: GenParticleHandle not found in the event" << std::endl;
1198 for (
auto gd = tGeom.
dets().begin(); gd != tGeom.
dets().end(); gd++) {
1199 DetId detid = (*gd)->geographicalId();
1206 if (TTStubHandle->find(stackDetid) == TTStubHandle->end())
1212 const auto* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(det0);
1213 const PixelTopology* topol = dynamic_cast<const PixelTopology*>(&(theGeomDet->specificTopology()));
1216 for (
auto stubIter = stubs.
begin(); stubIter != stubs.
end(); ++stubIter) {
1221 int layer = -999999;
1224 layer = static_cast<int>(tTopo.
layer(detid));
1227 layer = static_cast<int>(tTopo.
layer(detid));
1229 edm::LogVerbatim(
"Tracklet") <<
"WARNING -- neither TOB or TID stub, shouldn't happen...";
1234 if (topol->
nrows() == 960)
1237 MeasurementPoint coords = tempStubPtr->clusterRef(0)->findAverageLocalCoordinatesCentered();
1239 GlobalPoint posStub = theGeomDet->surface().toGlobal(clustlp);
1241 double tmp_stub_x = posStub.
x();
1242 double tmp_stub_y = posStub.
y();
1243 double tmp_stub_z = posStub.
z();
1245 float trigDisplace = tempStubPtr->rawBend();
1246 float trigOffset = tempStubPtr->bendOffset();
1247 float trigPos = tempStubPtr->innerClusterPosition();
1248 float trigBend = tempStubPtr->bendFE();
1264 int myTP_pdgid = -999;
1265 float myTP_pt = -999;
1266 float myTP_eta = -999;
1267 float myTP_phi = -999;
1269 if (my_tp.
isNull() ==
false) {
1271 if (tmp_eventid > 0)
1273 myTP_pdgid = my_tp->
pdgId();
1274 myTP_pt = my_tp->
p4().pt();
1275 myTP_eta = my_tp->
p4().eta();
1276 myTP_phi = my_tp->
p4().phi();
1278 int tmp_stub_genuine = 0;
1279 if (MCTruthTTStubHandle->isGenuine(tempStubPtr))
1280 tmp_stub_genuine = 1;
1300 int this_l1track = 0;
1301 for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) {
1305 float tmp_trk_pt = iterL1Track->momentum().perp();
1306 float tmp_trk_eta = iterL1Track->momentum().eta();
1307 float tmp_trk_phi = iterL1Track->momentum().phi();
1308 float tmp_trk_z0 = iterL1Track->z0();
1309 int tmp_trk_nFitPars = iterL1Track->nFitPars();
1311 float tmp_trk_d0 = -999;
1312 if (tmp_trk_nFitPars == 5) {
1313 float tmp_trk_x0 = iterL1Track->POCA().x();
1314 float tmp_trk_y0 = iterL1Track->POCA().y();
1315 tmp_trk_d0 = -tmp_trk_x0 *
sin(tmp_trk_phi) + tmp_trk_y0 *
cos(tmp_trk_phi);
1319 float tmp_trk_chi2 = iterL1Track->chi2();
1320 float tmp_trk_chi2dof = iterL1Track->chi2Red();
1321 float tmp_trk_chi2rphi = iterL1Track->chi2XY();
1322 float tmp_trk_chi2rz = iterL1Track->chi2Z();
1323 float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency();
1326 stubRefs = iterL1Track->getStubRefs();
1327 int tmp_trk_nstub = (
int)stubRefs.size();
1328 int tmp_trk_seed = 0;
1329 tmp_trk_seed = (
int)iterL1Track->trackSeedType();
1330 int tmp_trk_hitpattern = 0;
1331 tmp_trk_hitpattern = (
int)iterL1Track->hitPattern();
1332 unsigned int tmp_trk_phiSector = iterL1Track->phiSector();
1336 int tmp_trk_dhits = 0;
1337 int tmp_trk_lhits = 0;
1340 for (
int is = 0; is < tmp_trk_nstub; is++) {
1342 DetId detIdStub = tGeom.
idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId();
1343 MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered();
1347 double x = posStub.
x();
1348 double y = posStub.
y();
1349 double z = posStub.
z();
1351 int layer = -999999;
1353 layer = static_cast<int>(tTopo.
layer(detIdStub));
1356 <<
" stub in layer " <<
layer <<
" at position x y z = " <<
x <<
" " <<
y <<
" " <<
z;
1357 tmp_trk_lhits +=
pow(10,
layer - 1);
1359 layer = static_cast<int>(tTopo.
layer(detIdStub));
1362 <<
" stub in disk " <<
layer <<
" at position x y z = " <<
x <<
" " <<
y <<
" " <<
z;
1363 tmp_trk_dhits +=
pow(10,
layer - 1);
1369 int tmp_trk_genuine = 0;
1370 int tmp_trk_loose = 0;
1371 int tmp_trk_unknown = 0;
1372 int tmp_trk_combinatoric = 0;
1373 if (MCTruthTTTrackHandle->isLooselyGenuine(l1track_ptr))
1375 if (MCTruthTTTrackHandle->isGenuine(l1track_ptr))
1376 tmp_trk_genuine = 1;
1377 if (MCTruthTTTrackHandle->isUnknown(l1track_ptr))
1378 tmp_trk_unknown = 1;
1379 if (MCTruthTTTrackHandle->isCombinatoric(l1track_ptr))
1380 tmp_trk_combinatoric = 1;
1384 <<
" pt: " << tmp_trk_pt <<
" eta: " << tmp_trk_eta <<
" phi: " << tmp_trk_phi
1385 <<
" z0: " << tmp_trk_z0 <<
" chi2: " << tmp_trk_chi2
1386 <<
" chi2rphi: " << tmp_trk_chi2rphi <<
" chi2rz: " << tmp_trk_chi2rz
1387 <<
" nstub: " << tmp_trk_nstub;
1388 if (tmp_trk_genuine)
1390 if (tmp_trk_unknown)
1392 if (tmp_trk_combinatoric)
1400 if (tmp_trk_nFitPars == 5)
1426 int myTP_pdgid = -999;
1427 float myTP_pt = -999;
1428 float myTP_eta = -999;
1429 float myTP_phi = -999;
1430 float myTP_z0 = -999;
1431 float myTP_dxy = -999;
1437 if (tmp_eventid > 0)
1442 myTP_pdgid = my_tp->
pdgId();
1443 myTP_pt = my_tp->
p4().pt();
1444 myTP_eta = my_tp->
p4().eta();
1445 myTP_phi = my_tp->
p4().phi();
1446 myTP_z0 = my_tp->
vertex().z();
1448 float myTP_x0 = my_tp->
vertex().x();
1449 float myTP_y0 = my_tp->
vertex().y();
1450 myTP_dxy =
sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0);
1454 <<
" eta = " << my_tp->
momentum().eta() <<
" phi = " << my_tp->
momentum().phi()
1455 <<
" z0 = " << my_tp->
vertex().z() <<
" pdgid = " << my_tp->
pdgId()
1456 <<
" dxy = " << myTP_dxy;
1479 int this_l1track = 0;
1480 for (iterL1Track = TTTrackExtendedHandle->begin(); iterL1Track != TTTrackExtendedHandle->end(); iterL1Track++) {
1484 float tmp_trk_pt = iterL1Track->momentum().perp();
1485 float tmp_trk_eta = iterL1Track->momentum().eta();
1486 float tmp_trk_phi = iterL1Track->momentum().phi();
1487 float tmp_trk_z0 = iterL1Track->z0();
1488 int tmp_trk_nFitPars = iterL1Track->nFitPars();
1490 float tmp_trk_d0 = -999;
1491 if (tmp_trk_nFitPars == 5) {
1492 float tmp_trk_x0 = iterL1Track->POCA().x();
1493 float tmp_trk_y0 = iterL1Track->POCA().y();
1494 tmp_trk_d0 = -tmp_trk_x0 *
sin(tmp_trk_phi) + tmp_trk_y0 *
cos(tmp_trk_phi);
1498 float tmp_trk_chi2 = iterL1Track->chi2();
1499 float tmp_trk_chi2dof = iterL1Track->chi2Red();
1500 float tmp_trk_chi2rphi = iterL1Track->chi2XY();
1501 float tmp_trk_chi2rz = iterL1Track->chi2Z();
1502 float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency();
1505 stubRefs = iterL1Track->getStubRefs();
1506 int tmp_trk_nstub = (
int)stubRefs.size();
1507 int tmp_trk_seed = 0;
1508 tmp_trk_seed = (
int)iterL1Track->trackSeedType();
1509 int tmp_trk_hitpattern = 0;
1510 tmp_trk_hitpattern = (
int)iterL1Track->hitPattern();
1511 unsigned int tmp_trk_phiSector = iterL1Track->phiSector();
1515 int tmp_trk_dhits = 0;
1516 int tmp_trk_lhits = 0;
1519 for (
int is = 0; is < tmp_trk_nstub; is++) {
1521 DetId detIdStub = tGeom.
idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId();
1522 MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered();
1526 double x = posStub.
x();
1527 double y = posStub.
y();
1528 double z = posStub.
z();
1530 int layer = -999999;
1532 layer = static_cast<int>(tTopo.
layer(detIdStub));
1535 <<
" stub in layer " <<
layer <<
" at position x y z = " <<
x <<
" " <<
y <<
" " <<
z;
1536 tmp_trk_lhits +=
pow(10,
layer - 1);
1538 layer = static_cast<int>(tTopo.
layer(detIdStub));
1541 <<
" stub in disk " <<
layer <<
" at position x y z = " <<
x <<
" " <<
y <<
" " <<
z;
1542 tmp_trk_dhits +=
pow(10,
layer - 1);
1548 int tmp_trk_genuine = 0;
1549 int tmp_trk_loose = 0;
1550 int tmp_trk_unknown = 0;
1551 int tmp_trk_combinatoric = 0;
1552 if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(l1track_ptr))
1554 if (MCTruthTTTrackExtendedHandle->isGenuine(l1track_ptr))
1555 tmp_trk_genuine = 1;
1556 if (MCTruthTTTrackExtendedHandle->isUnknown(l1track_ptr))
1557 tmp_trk_unknown = 1;
1558 if (MCTruthTTTrackExtendedHandle->isCombinatoric(l1track_ptr))
1559 tmp_trk_combinatoric = 1;
1563 <<
" pt: " << tmp_trk_pt <<
" eta: " << tmp_trk_eta <<
" phi: " << tmp_trk_phi
1564 <<
" z0: " << tmp_trk_z0 <<
" chi2: " << tmp_trk_chi2
1565 <<
" chi2rphi: " << tmp_trk_chi2rphi <<
" chi2rz: " << tmp_trk_chi2rz
1566 <<
" nstub: " << tmp_trk_nstub;
1567 if (tmp_trk_genuine)
1569 if (tmp_trk_unknown)
1571 if (tmp_trk_combinatoric)
1579 if (tmp_trk_nFitPars == 5)
1605 int myTP_pdgid = -999;
1606 float myTP_pt = -999;
1607 float myTP_eta = -999;
1608 float myTP_phi = -999;
1609 float myTP_z0 = -999;
1610 float myTP_dxy = -999;
1616 if (tmp_eventid > 0)
1621 myTP_pdgid = my_tp->
pdgId();
1622 myTP_pt = my_tp->
p4().pt();
1623 myTP_eta = my_tp->
p4().eta();
1624 myTP_phi = my_tp->
p4().phi();
1625 myTP_z0 = my_tp->
vertex().z();
1627 float myTP_x0 = my_tp->
vertex().x();
1628 float myTP_y0 = my_tp->
vertex().y();
1629 myTP_dxy =
sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0);
1633 <<
" eta = " << my_tp->
momentum().eta() <<
" phi = " << my_tp->
momentum().phi()
1634 <<
" z0 = " << my_tp->
vertex().z() <<
" pdgid = " << my_tp->
pdgId()
1635 <<
" dxy = " << myTP_dxy;
1656 std::vector<TrackingParticle>::const_iterator iterTP;
1657 for (iterTP = TrackingParticleHandle->begin(); iterTP != TrackingParticleHandle->end(); ++iterTP) {
1661 int tmp_eventid = iterTP->eventId().event();
1665 float tmp_tp_pt = iterTP->pt();
1666 float tmp_tp_eta = iterTP->eta();
1667 float tmp_tp_phi = iterTP->phi();
1668 float tmp_tp_vz = iterTP->vz();
1669 float tmp_tp_vx = iterTP->vx();
1670 float tmp_tp_vy = iterTP->vy();
1671 int tmp_tp_pdgid = iterTP->pdgId();
1672 float tmp_tp_z0_prod = tmp_tp_vz;
1673 float tmp_tp_d0_prod = tmp_tp_vx *
sin(tmp_tp_phi) - tmp_tp_vy *
cos(tmp_tp_phi);
1690 float tmp_tp_t =
tan(2.0 * atan(1.0) - 2.0 * atan(
exp(-tmp_tp_eta)));
1691 float delx = -tmp_tp_vx;
1692 float dely = -tmp_tp_vy;
1694 float A = 0.01 * 0.5696;
1695 float Kmagnitude =
A / tmp_tp_pt;
1696 float tmp_tp_charge = tp_ptr->charge();
1697 float K = Kmagnitude * tmp_tp_charge;
1699 float tmp_tp_x0p = delx - (
d + 1. / (2. * K) *
sin(tmp_tp_phi));
1700 float tmp_tp_y0p = dely + (
d + 1. / (2. * K) *
cos(tmp_tp_phi));
1701 float tmp_tp_rp =
sqrt(tmp_tp_x0p * tmp_tp_x0p + tmp_tp_y0p * tmp_tp_y0p);
1702 float tmp_tp_d0 = tmp_tp_charge * tmp_tp_rp - (1. / (2. * K));
1703 tmp_tp_d0 = tmp_tp_d0 * (-1);
1704 const double pi = 4.0 * atan(1.0);
1705 float delphi = tmp_tp_phi - atan2(-K * tmp_tp_x0p, K * tmp_tp_y0p);
1710 float tmp_tp_z0 = tmp_tp_vz + tmp_tp_t * delphi / (2.0 * K);
1717 float dxy =
sqrt(tmp_tp_vx * tmp_tp_vx + tmp_tp_vy * tmp_tp_vy);
1718 float tmp_tp_dxy =
dxy;
1723 edm::LogVerbatim(
"Tracklet") <<
"Tracking particle, pt: " << tmp_tp_pt <<
" eta: " << tmp_tp_eta
1724 <<
" phi: " << tmp_tp_phi <<
" z0: " << tmp_tp_z0 <<
" d0: " << tmp_tp_d0
1725 <<
" z_prod: " << tmp_tp_z0_prod <<
" d_prod: " << tmp_tp_d0_prod
1726 <<
" pdgid: " << tmp_tp_pdgid <<
" eventID: " << iterTP->eventId().event()
1727 <<
" ttclusters " << MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).size()
1728 <<
" ttstubs " << MCTruthTTStubHandle->findTTStubRefs(tp_ptr).size() <<
" tttracks "
1729 << MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr).size();
1733 if (MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty()) {
1735 edm::LogVerbatim(
"Tracklet") <<
"No matching TTClusters for TP, continuing...";
1740 theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr);
1741 int nStubTP = (
int)theStubRefs.size();
1744 int hasStubInLayer[11] = {0};
1745 for (
auto& theStubRef : theStubRefs) {
1746 DetId detid(theStubRef->getDetId());
1750 layer = static_cast<int>(tTopo.
layer(detid)) - 1;
1752 layer = static_cast<int>(tTopo.
layer(detid)) + 5;
1756 if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRef).isNull() && hasStubInLayer[
layer] < 2)
1757 hasStubInLayer[
layer] = 1;
1759 hasStubInLayer[
layer] = 2;
1762 int nStubLayerTP = 0;
1763 int nStubLayerTP_g = 0;
1764 for (
int isum : hasStubInLayer) {
1768 nStubLayerTP_g += 1;
1772 edm::LogVerbatim(
"Tracklet") <<
"TP is associated with " << nStubTP <<
" stubs, and has stubs in " << nStubLayerTP
1773 <<
" different layers/disks, and has GENUINE stubs in " << nStubLayerTP_g
1781 edm::LogVerbatim(
"Tracklet") <<
"TP fails minimum nbr stubs requirement! Continuing...";
1790 edm::LogVerbatim(
"Tracklet") <<
"TP fails stubs in minimum nbr of layers/disks requirement! Continuing...";
1795 m_tp_pt->push_back(tmp_tp_pt);
1799 m_tp_z0->push_back(tmp_tp_z0);
1800 m_tp_d0->push_back(tmp_tp_d0);
1811 std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > > matchedTracks =
1812 MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr);
1816 float i_chi2dof = 99999;
1818 if (!matchedTracks.empty()) {
1819 if (
DebugMode && (matchedTracks.size() > 1))
1820 edm::LogVerbatim(
"Tracklet") <<
"TrackingParticle has more than one matched L1 track!";
1827 for (
int it = 0; it < (
int)matchedTracks.size(); it++) {
1828 bool tmp_trk_genuine =
false;
1829 bool tmp_trk_loosegenuine =
false;
1830 if (MCTruthTTTrackHandle->isGenuine(matchedTracks.at(it)))
1831 tmp_trk_genuine =
true;
1832 if (MCTruthTTTrackHandle->isLooselyGenuine(matchedTracks.at(it)))
1833 tmp_trk_loosegenuine =
true;
1834 if (!tmp_trk_loosegenuine)
1838 if (MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) {
1839 edm::LogVerbatim(
"Tracklet") <<
"track matched to TP is NOT uniquely matched to a TP";
1842 edm::LogVerbatim(
"Tracklet") <<
"TP matched to track matched to TP ... tp pt = " << my_tp->
p4().pt()
1843 <<
" eta = " << my_tp->
momentum().eta()
1844 <<
" phi = " << my_tp->
momentum().phi() <<
" z0 = " << my_tp->
vertex().z();
1847 << matchedTracks.at(it)->momentum().perp()
1848 <<
" eta = " << matchedTracks.at(it)->momentum().eta()
1849 <<
" phi = " << matchedTracks.at(it)->momentum().phi()
1850 <<
" chi2 = " << matchedTracks.at(it)->chi2()
1851 <<
" consistency = " << matchedTracks.at(it)->stubPtConsistency()
1852 <<
" z0 = " << matchedTracks.at(it)->z0()
1853 <<
" nstub = " << matchedTracks.at(it)->getStubRefs().size();
1854 if (tmp_trk_genuine)
1856 if (tmp_trk_loosegenuine)
1861 stubRefs = matchedTracks.at(it)->getStubRefs();
1862 int tmp_trk_nstub = stubRefs.size();
1867 float dmatch_pt = 999;
1868 float dmatch_eta = 999;
1869 float dmatch_phi = 999;
1873 dmatch_pt =
std::abs(my_tp->
p4().pt() - tmp_tp_pt);
1874 dmatch_eta =
std::abs(my_tp->
p4().eta() - tmp_tp_eta);
1875 dmatch_phi =
std::abs(my_tp->
p4().phi() - tmp_tp_phi);
1876 match_id = my_tp->
pdgId();
1877 float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red();
1880 if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) {
1882 if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) {
1884 i_chi2dof = tmp_trk_chi2dof;
1892 float tmp_matchtrk_pt = -999;
1893 float tmp_matchtrk_eta = -999;
1894 float tmp_matchtrk_phi = -999;
1895 float tmp_matchtrk_z0 = -999;
1896 float tmp_matchtrk_d0 = -999;
1897 float tmp_matchtrk_chi2 = -999;
1898 float tmp_matchtrk_chi2dof = -999;
1899 float tmp_matchtrk_chi2rphi = -999;
1900 float tmp_matchtrk_chi2rz = -999;
1901 float tmp_matchtrk_bendchi2 = -999;
1902 int tmp_matchtrk_nstub = -999;
1903 int tmp_matchtrk_dhits = -999;
1904 int tmp_matchtrk_lhits = -999;
1905 int tmp_matchtrk_seed = -999;
1906 int tmp_matchtrk_hitpattern = -999;
1907 int tmp_matchtrk_nFitPars = -999;
1910 edm::LogVerbatim(
"Tracklet") <<
"WARNING *** 2 or more matches to genuine L1 tracks ***";
1913 tmp_matchtrk_pt = matchedTracks.at(i_track)->momentum().perp();
1914 tmp_matchtrk_eta = matchedTracks.at(i_track)->momentum().eta();
1915 tmp_matchtrk_phi = matchedTracks.at(i_track)->momentum().phi();
1916 tmp_matchtrk_z0 = matchedTracks.at(i_track)->z0();
1917 tmp_matchtrk_nFitPars = matchedTracks.at(i_track)->nFitPars();
1919 if (tmp_matchtrk_nFitPars == 5) {
1920 float tmp_matchtrk_x0 = matchedTracks.at(i_track)->POCA().x();
1921 float tmp_matchtrk_y0 = matchedTracks.at(i_track)->POCA().y();
1922 tmp_matchtrk_d0 = -tmp_matchtrk_x0 *
sin(tmp_matchtrk_phi) + tmp_matchtrk_y0 *
cos(tmp_matchtrk_phi);
1926 tmp_matchtrk_chi2 = matchedTracks.at(i_track)->chi2();
1927 tmp_matchtrk_chi2dof = matchedTracks.at(i_track)->chi2Red();
1928 tmp_matchtrk_chi2rphi = matchedTracks.at(i_track)->chi2XY();
1929 tmp_matchtrk_chi2rz = matchedTracks.at(i_track)->chi2Z();
1930 tmp_matchtrk_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency();
1931 tmp_matchtrk_nstub = (
int)matchedTracks.at(i_track)->getStubRefs().size();
1932 tmp_matchtrk_seed = (
int)matchedTracks.at(i_track)->trackSeedType();
1933 tmp_matchtrk_hitpattern = (
int)matchedTracks.at(i_track)->hitPattern();
1936 tmp_matchtrk_dhits = 0;
1937 tmp_matchtrk_lhits = 0;
1940 stubRefs = matchedTracks.at(i_track)->getStubRefs();
1941 int tmp_nstub = stubRefs.size();
1943 for (
int is = 0; is < tmp_nstub; is++) {
1944 DetId detIdStub = tGeom.
idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId();
1945 int layer = -999999;
1947 layer = static_cast<int>(tTopo.
layer(detIdStub));
1948 tmp_matchtrk_lhits +=
pow(10,
layer - 1);
1950 layer = static_cast<int>(tTopo.
layer(detIdStub));
1951 tmp_matchtrk_dhits +=
pow(10,
layer - 1);
1978 std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > > matchedTracks =
1979 MCTruthTTTrackExtendedHandle->findTTTrackPtrs(tp_ptr);
1983 float i_chi2dof = 99999;
1985 if (!matchedTracks.empty()) {
1986 if (
DebugMode && (matchedTracks.size() > 1))
1987 edm::LogVerbatim(
"Tracklet") <<
"TrackingParticle has more than one matched L1 track!";
1994 for (
int it = 0; it < (
int)matchedTracks.size(); it++) {
1995 bool tmp_trk_genuine =
false;
1996 bool tmp_trk_loosegenuine =
false;
1997 if (MCTruthTTTrackExtendedHandle->isGenuine(matchedTracks.at(it)))
1998 tmp_trk_genuine =
true;
1999 if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(matchedTracks.at(it)))
2000 tmp_trk_loosegenuine =
true;
2001 if (!tmp_trk_loosegenuine)
2005 if (MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) {
2006 edm::LogVerbatim(
"Tracklet") <<
"track matched to TP is NOT uniquely matched to a TP";
2009 MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it));
2010 edm::LogVerbatim(
"Tracklet") <<
"TP matched to track matched to TP ... tp pt = " << my_tp->
p4().pt()
2011 <<
" eta = " << my_tp->
momentum().eta()
2012 <<
" phi = " << my_tp->
momentum().phi() <<
" z0 = " << my_tp->
vertex().z();
2015 << matchedTracks.at(it)->momentum().perp()
2016 <<
" eta = " << matchedTracks.at(it)->momentum().eta()
2017 <<
" phi = " << matchedTracks.at(it)->momentum().phi()
2018 <<
" chi2 = " << matchedTracks.at(it)->chi2()
2019 <<
" consistency = " << matchedTracks.at(it)->stubPtConsistency()
2020 <<
" z0 = " << matchedTracks.at(it)->z0()
2021 <<
" nstub = " << matchedTracks.at(it)->getStubRefs().size();
2022 if (tmp_trk_genuine)
2024 if (tmp_trk_loosegenuine)
2029 stubRefs = matchedTracks.at(it)->getStubRefs();
2030 int tmp_trk_nstub = stubRefs.size();
2035 float dmatch_pt = 999;
2036 float dmatch_eta = 999;
2037 float dmatch_phi = 999;
2041 MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it));
2042 dmatch_pt =
std::abs(my_tp->
p4().pt() - tmp_tp_pt);
2043 dmatch_eta =
std::abs(my_tp->
p4().eta() - tmp_tp_eta);
2044 dmatch_phi =
std::abs(my_tp->
p4().phi() - tmp_tp_phi);
2045 match_id = my_tp->
pdgId();
2046 float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red();
2049 if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) {
2051 if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) {
2053 i_chi2dof = tmp_trk_chi2dof;
2061 float tmp_matchtrkExt_pt = -999;
2062 float tmp_matchtrkExt_eta = -999;
2063 float tmp_matchtrkExt_phi = -999;
2064 float tmp_matchtrkExt_z0 = -999;
2065 float tmp_matchtrkExt_d0 = -999;
2066 float tmp_matchtrkExt_chi2 = -999;
2067 float tmp_matchtrkExt_chi2dof = -999;
2068 float tmp_matchtrkExt_chi2rphi = -999;
2069 float tmp_matchtrkExt_chi2rz = -999;
2070 float tmp_matchtrkExt_bendchi2 = -999;
2071 int tmp_matchtrkExt_nstub = -999;
2072 int tmp_matchtrkExt_dhits = -999;
2073 int tmp_matchtrkExt_lhits = -999;
2074 int tmp_matchtrkExt_seed = -999;
2075 int tmp_matchtrkExt_hitpattern = -999;
2076 int tmp_matchtrkExt_nFitPars = -999;
2079 edm::LogVerbatim(
"Tracklet") <<
"WARNING *** 2 or more matches to genuine L1 tracks ***";
2082 tmp_matchtrkExt_pt = matchedTracks.at(i_track)->momentum().perp();
2083 tmp_matchtrkExt_eta = matchedTracks.at(i_track)->momentum().eta();
2084 tmp_matchtrkExt_phi = matchedTracks.at(i_track)->momentum().phi();
2085 tmp_matchtrkExt_z0 = matchedTracks.at(i_track)->z0();
2086 tmp_matchtrkExt_nFitPars = matchedTracks.at(i_track)->nFitPars();
2088 if (tmp_matchtrkExt_nFitPars == 5) {
2089 float tmp_matchtrkExt_x0 = matchedTracks.at(i_track)->POCA().x();
2090 float tmp_matchtrkExt_y0 = matchedTracks.at(i_track)->POCA().y();
2091 tmp_matchtrkExt_d0 =
2092 -tmp_matchtrkExt_x0 *
sin(tmp_matchtrkExt_phi) + tmp_matchtrkExt_y0 *
cos(tmp_matchtrkExt_phi);
2096 tmp_matchtrkExt_chi2 = matchedTracks.at(i_track)->chi2();
2097 tmp_matchtrkExt_chi2dof = matchedTracks.at(i_track)->chi2Red();
2098 tmp_matchtrkExt_chi2rphi = matchedTracks.at(i_track)->chi2XY();
2099 tmp_matchtrkExt_chi2rz = matchedTracks.at(i_track)->chi2Z();
2100 tmp_matchtrkExt_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency();
2101 tmp_matchtrkExt_nstub = (
int)matchedTracks.at(i_track)->getStubRefs().size();
2102 tmp_matchtrkExt_seed = (
int)matchedTracks.at(i_track)->trackSeedType();
2103 tmp_matchtrkExt_hitpattern = (
int)matchedTracks.at(i_track)->hitPattern();
2106 tmp_matchtrkExt_dhits = 0;
2107 tmp_matchtrkExt_lhits = 0;
2110 stubRefs = matchedTracks.at(i_track)->getStubRefs();
2111 int tmp_nstub = stubRefs.size();
2113 for (
int is = 0; is < tmp_nstub; is++) {
2114 DetId detIdStub = tGeom.
idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId();
2115 int layer = -999999;
2117 layer = static_cast<int>(tTopo.
layer(detIdStub));
2118 tmp_matchtrkExt_lhits +=
pow(10,
layer - 1);
2120 layer = static_cast<int>(tTopo.
layer(detIdStub));
2121 tmp_matchtrkExt_dhits +=
pow(10,
layer - 1);
2148 if (L1TkMETHandle.
isValid()) {
2149 trkMET = L1TkMETHandle->begin()->etMiss();
2151 edm::LogWarning(
"DataNotFound") <<
"\nWarning: tkMET handle not found in the event" << std::endl;
2154 if (L1TkMHTHandle.
isValid()) {
2155 trkMHT = L1TkMHTHandle->begin()->EtMiss();
2156 trkHT = L1TkMHTHandle->begin()->etTotal();
2158 edm::LogWarning(
"DataNotFound") <<
"\nWarning: tkMHT handle not found in the event" << std::endl;
2163 if (L1TkMETExtendedHandle.
isValid()) {
2164 trkMETExt = L1TkMETExtendedHandle->begin()->etMiss();
2166 edm::LogWarning(
"DataNotFound") <<
"\nWarning: tkMETExtended handle not found in the event" << std::endl;
2169 if (L1TkMHTExtendedHandle.
isValid()) {
2170 trkMHTExt = L1TkMHTExtendedHandle->begin()->EtMiss();
2171 trkHTExt = L1TkMHTExtendedHandle->begin()->etTotal();
2173 edm::LogWarning(
"DataNotFound") <<
"\nWarning: tkMHTExtended handle not found in the event" << std::endl;
2180 for (jetIter = TrackFastJetsHandle->begin(); jetIter != TrackFastJetsHandle->end(); ++jetIter) {
2190 for (jetIter = TrackFastJetsExtendedHandle->begin(); jetIter != TrackFastJetsExtendedHandle->end(); ++jetIter) {
2200 edm::LogWarning(
"DataNotFound") <<
"\nWarning: TrackJetsHandle not found in the event" << std::endl;
2203 edm::LogWarning(
"DataNotFound") <<
"\nWarning: TrackJetsExtendedHandle not found in the event" << std::endl;
2206 for (jetIter = TrackJetsHandle->begin(); jetIter != TrackJetsHandle->end(); ++jetIter) {
2220 for (jetIter = TrackJetsExtendedHandle->begin(); jetIter != TrackJetsExtendedHandle->end(); ++jetIter) {
2233 if (L1TkPrimaryVertexHandle.
isValid()) {
2234 m_pv_L1reco->push_back(L1TkPrimaryVertexHandle->begin()->zvertex());
2236 edm::LogWarning(
"DataNotFound") <<
"\nWarning: L1TkPrimaryVertexHandle not found in the event" << std::endl;