79 #include <TLorentzVector.h>
417 if (Displaced ==
"Prompt" || Displaced ==
"Both") {
433 if (Displaced ==
"Displaced" || Displaced ==
"Both") {
544 m_tp_pt =
new std::vector<float>;
548 m_tp_d0 =
new std::vector<float>;
549 m_tp_z0 =
new std::vector<float>;
618 m_pv_MC =
new std::vector<float>;
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) {
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())
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) {
1270 int tmp_eventid = my_tp->eventId().event();
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;
1436 int tmp_eventid = my_tp->eventId().event();
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);
1453 edm::LogVerbatim(
"Tracklet") <<
"TP matched to track has pt = " << my_tp->p4().pt()
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;
1615 int tmp_eventid = my_tp->eventId().event();
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);
1632 edm::LogVerbatim(
"Tracklet") <<
"TP matched to track has pt = " << my_tp->p4().pt()
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;
std::vector< float > * m_matchtrkExt_eta
std::vector< float > * m_matchtrkExt_d0
std::vector< float > * m_trkjetExt_tp_sumpt
Log< level::Info, true > LogVerbatim
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
std::vector< float > * m_trkExt_matchtp_phi
edm::EDGetTokenT< TTTrackAssociationMap< Ref_Phase2TrackerDigi_ > > ttTrackMCTruthToken_
std::vector< float > * m_2ltrkjet_phi
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::vector< float > * m_trk_chi2rphi
std::vector< float > * m_trkjet_p
std::vector< int > * m_2ltrkjetExt_ntracks
std::vector< float > * m_matchtrkExt_bendchi2
edm::InputTag TrackingVertexInputTag
std::vector< int > * m_trkExt_fake
edm::InputTag TrackJetsExtendedInputTag
std::vector< float > * m_trk_pt
std::vector< int > * m_matchtrk_dhits
std::vector< int > * m_2ltrkjetExt_nTightDisplaced
std::vector< float > * m_matchtrkExt_z0
std::vector< int > * m_tp_nstub
std::vector< float > * m_trk_phi
~L1TrackObjectNtupleMaker() override
std::vector< int > * m_trkExt_matchtp_pdgid
std::vector< float > * m_matchtrk_chi2dof
std::vector< int > * m_trk_lhits
std::vector< int > * m_trkExt_unknown
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
double pt() const final
transverse momentum
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
std::vector< int > * m_matchtrkExt_seed
std::vector< float > * m_allstub_trigOffset
std::vector< float > * m_trk_matchtp_dxy
std::vector< float > * m_trkjet_truetp_sumpt
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken_
std::vector< float > * m_2ltrkjetExt_pt
L1TrackObjectNtupleMaker(const edm::ParameterSet &iConfig)
std::vector< float > * m_trkExt_chi2
std::vector< float > * m_tp_pt
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< float > * m_trkjetExt_truetp_sumpt
edm::InputTag L1TrackExtendedInputTag
virtual const Topology & topology() const
std::vector< float > * m_tp_phi
std::vector< int > * m_tp_nmatch
edm::InputTag L1StubInputTag
#define DEFINE_FWK_MODULE(type)
std::vector< float > * m_matchtrk_z0
std::vector< int > * m_tp_charge
std::vector< int > * m_trk_nstub
std::vector< float > * m_trk_matchtp_phi
Sin< T >::type sin(const T &t)
edm::EDGetTokenT< l1t::TkHTMissCollection > TrackMHTExtendedToken_
std::vector< float > * m_trkjet_pt
std::vector< int > * m_2ltrkjet_nTightDisplaced
edm::EDGetTokenT< std::vector< TrackingParticle > > TrackingParticleToken_
edm::InputTag L1TrackInputTag
virtual int nrows() const =0
std::vector< float > * m_allstub_matchTP_pt
edm::InputTag TrackMETExtendedInputTag
std::vector< int > * m_trkExt_nstub
edm::EDGetTokenT< l1t::TkJetCollection > TrackJetsToken_
int status() const final
status word
edm::InputTag MCTruthStubInputTag
std::vector< int > * m_trkjet_ntracks
T * make(const Args &...args) const
make new ROOT object
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
std::vector< int > * m_trk_genuine
Exp< T >::type exp(const T &t)
std::vector< float > * m_2ltrkjetExt_eta
edm::EDGetTokenT< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > ttTrackExtendedToken_
std::vector< float > * m_trkExt_d0
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
std::vector< float > * m_matchtrkExt_chi2
const Plane & surface() const
The nominal surface of the GeomDet.
edm::InputTag GenParticleInputTag
std::vector< unsigned int > * m_trk_phiSector
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< int > * m_allstub_matchTP_pdgid
std::vector< float > * m_trk_chi2
std::vector< float > * m_matchtrkExt_pt
std::vector< float > * m_trk_chi2rz
std::vector< int > * m_tp_pdgid
std::vector< float > * m_allstub_trigDisplace
constexpr std::array< uint8_t, layerIndexSize > layer
edm::EDGetTokenT< std::vector< l1t::TkEtMiss > > TrackMETToken_
std::vector< float > * m_trkExt_eta
int pdgId() const final
PDG identifier.
bool isLower(const DetId &id) const
bool getData(T &iHolder) const
std::vector< float > * m_trkjet_tp_sumpt
std::vector< float > * m_trkjetExt_p
std::vector< float > * m_allstub_matchTP_phi
std::vector< float > * m_2ltrkjet_p
edm::InputTag TrackMHTInputTag
std::vector< float > * m_tp_eta
std::vector< float > * m_tp_dxy
std::vector< float > * m_matchtrkExt_chi2dof
edm::EDGetTokenT< std::vector< l1t::TkJet > > TrackFastJetsExtendedToken_
std::vector< int > * m_2ltrkjet_ntdtrk
std::vector< float > * m_matchtrk_eta
bool isNeutrino(const Candidate &part)
std::vector< int > * m_2ltrkjetExt_ntdtrk
edm::InputTag TrackFastJetsExtendedInputTag
std::vector< float > * m_pv_MC
std::vector< int > * m_trk_hitpattern
std::vector< int > * m_trk_seed
std::vector< int > * m_allstub_genuine
std::vector< int > * m_trkExt_hitpattern
std::vector< int > * m_trk_fake
std::vector< float > * m_tp_z0_prod
std::vector< float > * m_trkExt_chi2rz
std::vector< float > * m_tp_d0
std::vector< int > * m_trkExt_dhits
edm::InputTag GenJetInputTag
std::vector< float > * m_trk_matchtp_z0
std::vector< float > * m_2ltrkjetExt_p
Cos< T >::type cos(const T &t)
std::vector< int > * m_trk_loose
edm::EDGetTokenT< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > ttTrackToken_
bool isNull() const
Checks for null.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< float > * m_trkjet_phi
std::vector< float > * m_trkjetExt_vz
Tan< T >::type tan(const T &t)
std::vector< float > * m_trk_bendchi2
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ > > > ttStubToken_
edm::EDGetTokenT< TTClusterAssociationMap< Ref_Phase2TrackerDigi_ > > ttClusterMCTruthToken_
std::vector< float > * m_allstub_x
std::vector< int > * m_2ltrkjet_ntracks
std::vector< float > * m_allstub_trigBend
std::vector< float > * m_trkjetExt_phi
std::vector< unsigned int > * m_trkExt_phiSector
std::vector< float > * m_trkExt_phi
std::vector< float > * m_trk_matchtp_eta
std::vector< int > * m_MC_lep
std::vector< float > * m_2ltrkjetExt_phi
std::vector< float > * m_trkExt_matchtp_eta
std::vector< int > * m_matchtrkExt_lhits
std::vector< float > * m_pv_L1reco
std::vector< float > * m_trkExt_matchtp_dxy
static constexpr auto TOB
std::vector< float > * m_matchtrk_chi2rz
Class to store the L1 Track Trigger stubs.
std::vector< float > * m_allstub_z
edm::EDGetTokenT< l1t::TkPrimaryVertexCollection > L1VertexToken_
std::vector< float > * m_trk_chi2dof
const TrackerGeomDet * idToDet(DetId) const override
std::vector< float > * m_2ltrkjetExt_vz
edm::InputTag TrackMETInputTag
std::vector< int > * m_trkjetExt_ntracks
std::vector< float > * m_trkjet_eta
std::vector< int > * m_allstub_isBarrel
std::vector< float > * m_trkExt_matchtp_pt
std::vector< float > * m_matchtrk_bendchi2
std::vector< float > * m_trkExt_matchtp_z0
std::vector< int > * m_allstub_isPSmodule
std::vector< int > * m_trkExt_lhits
std::vector< float > * m_trkExt_chi2dof
std::vector< int > * m_trkExt_seed
std::vector< float > * m_matchtrk_phi
edm::InputTag TrackingParticleInputTag
std::vector< int > * m_trkExt_loose
edm::EDGetTokenT< std::vector< reco::GenJet > > GenJetToken_
std::vector< float > * m_tp_d0_prod
std::vector< float > * m_allstub_matchTP_eta
std::vector< int > * m_2ltrkjetExt_nDisplaced
std::vector< int > * m_trk_matchtp_pdgid
edm::EDGetTokenT< TTStubAssociationMap< Ref_Phase2TrackerDigi_ > > ttStubMCTruthToken_
uint32_t stack(const DetId &id) const
std::vector< int > * m_2ltrkjet_nDisplaced
std::vector< int > * m_trkExt_combinatoric
std::vector< float > * m_matchtrkExt_phi
std::vector< float > * m_trkjetExt_eta
edm::EDGetTokenT< edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > > > ttClusterToken_
std::vector< int > * m_matchtrk_hitpattern
edm::EDGetTokenT< std::vector< l1t::TkEtMiss > > TrackMETExtendedToken_
T getParameter(std::string const &) const
std::vector< float > * m_matchtrk_chi2rphi
std::vector< int > * m_trkExt_genuine
std::vector< float > * m_allstub_trigPos
std::vector< float > * m_trk_eta
edm::InputTag TrackMHTExtendedInputTag
std::vector< int > * m_matchtrkExt_dhits
std::vector< float > * m_trk_z0
unsigned int layer(const DetId &id) const
std::vector< float > * m_2ltrkjet_pt
std::vector< float > * m_trkjet_vz
tuple config
parse the configuration file
edm::EDGetTokenT< std::vector< reco::GenParticle > > GenParticleToken_
std::vector< float > * m_tp_z0
std::vector< float > * m_trkExt_z0
std::vector< float > * m_matchtrk_d0
std::vector< float > * m_trkExt_chi2rphi
std::vector< float > * m_trk_matchtp_pt
edm::InputTag MCTruthTrackExtendedInputTag
std::vector< int > * m_trk_combinatoric
std::vector< float > * m_2ltrkjet_vz
std::vector< float > * m_allstub_y
edm::InputTag TrackFastJetsInputTag
std::vector< float > * m_trk_d0
std::vector< int > * m_matchtrk_lhits
edm::InputTag RecoVertexInputTag
std::vector< float > * m_trkExt_bendchi2
std::vector< int > * m_matchtrkExt_hitpattern
std::vector< float > * m_trkjetExt_pt
std::vector< float > * m_matchtrkExt_chi2rphi
std::vector< int > * m_2ltrkjet_nTight
Log< level::Warning, false > LogWarning
edm::InputTag MCTruthClusterInputTag
std::vector< int > * m_matchtrk_nstub
edm::EDGetTokenT< std::vector< l1t::TkJet > > TrackFastJetsToken_
std::vector< int > * m_trk_dhits
double phi() const final
momentum azimuthal angle
edm::EDGetTokenT< l1t::TkJetCollection > TrackJetsExtendedToken_
std::vector< float > * m_2ltrkjet_eta
static constexpr auto TID
std::vector< float > * m_matchtrk_chi2
edm::EDGetTokenT< TTTrackAssociationMap< Ref_Phase2TrackerDigi_ > > ttTrackMCTruthExtendedToken_
edm::InputTag TrackJetsInputTag
std::vector< int > * m_tp_eventid
edm::EDGetTokenT< std::vector< TrackingVertex > > TrackingVertexToken_
std::vector< int > * m_matchtrk_seed
std::vector< float > * m_matchtrkExt_chi2rz
Power< A, B >::type pow(const A &a, const B &b)
std::vector< int > * m_trk_unknown
std::vector< int > * m_allstub_layer
std::vector< float > * m_trkExt_pt
edm::EDGetTokenT< l1t::TkHTMissCollection > TrackMHTToken_
std::vector< float > * m_matchtrk_pt
std::vector< int > * m_matchtrkExt_nstub
std::vector< int > * m_2ltrkjetExt_nTight
edm::InputTag MCTruthTrackInputTag