27 #include <Math/GenVector/VectorUtil.h>
112 #include "TProfile.h"
113 #include "TDirectory.h"
134 double deltaPhi(
double v1,
double v2);
135 double deltaR(
double eta1,
double phi1,
double eta2,
double phi2);
211 std::unique_ptr<std::vector<double> >
t_trkP;
212 std::unique_ptr<std::vector<double> >
t_simP;
213 std::unique_ptr<std::vector<double> >
t_trkPt;
216 std::unique_ptr<std::vector<double> >
t_e3x3;
218 std::unique_ptr<std::vector<std::vector<double> > >
t_v_eDR;
219 std::unique_ptr<std::vector<std::vector<double> > >
t_v_eMipDR;
221 std::unique_ptr<std::vector<double> >
t_h3x3;
222 std::unique_ptr<std::vector<double> >
t_h5x5;
284 std::unique_ptr<std::vector<std::vector<double> > >
t_v_hCone;
323 std::unique_ptr<std::vector<unsigned int> >
t_irun;
324 std::unique_ptr<std::vector<unsigned int> >
t_ievt;
325 std::unique_ptr<std::vector<unsigned int> >
t_ilum;
329 : doMC_(iConfig.getUntrackedParameter<
bool>(
"doMC",
false)),
330 myverbose_(iConfig.getUntrackedParameter<
int>(
"verbosity", 5)),
331 useJetTrigger_(iConfig.getUntrackedParameter<
bool>(
"useJetTrigger",
false)),
332 drLeadJetVeto_(iConfig.getUntrackedParameter<double>(
"drLeadJetVeto", 1.2)),
333 ptMinLeadJet_(iConfig.getUntrackedParameter<double>(
"ptMinLeadJet", 15.0)),
334 debugTrks_(iConfig.getUntrackedParameter<
int>(
"debugTracks")),
335 printTrkHitPattern_(iConfig.getUntrackedParameter<
bool>(
"printTrkHitPattern")),
336 trackerHitAssociatorConfig_(consumesCollector()),
353 minTrackP_(iConfig.getUntrackedParameter<double>(
"minTrackP", 10.0)),
354 maxTrackEta_(iConfig.getUntrackedParameter<double>(
"maxTrackEta", 5.0)),
355 maxNearTrackP_(iConfig.getUntrackedParameter<double>(
"maxNearTrackP", 1.0)),
356 debugEcalSimInfo_(iConfig.getUntrackedParameter<
int>(
"debugEcalSimInfo")),
357 applyEcalIsolation_(iConfig.getUntrackedParameter<
bool>(
"applyEcalIsolation")) {
399 desc_TrackAssoc.
add<
double>(
"muonMaxDistanceSigmaX", 0.0);
400 desc_TrackAssoc.add<
double>(
"muonMaxDistanceSigmaY", 0.0);
402 desc_TrackAssoc.add<
double>(
"dRHcal", 9999.0);
403 desc_TrackAssoc.add<
double>(
"dREcal", 9999.0);
405 desc_TrackAssoc.add<
bool>(
"useEcal",
true);
406 desc_TrackAssoc.add<
double>(
"dREcalPreselection", 0.05);
408 desc_TrackAssoc.add<
double>(
"dRMuon", 9999.0);
409 desc_TrackAssoc.add<
std::string>(
"crossedEnergyType",
"SinglePointAlongTrajectory");
410 desc_TrackAssoc.add<
double>(
"muonMaxDistanceX", 5.0);
411 desc_TrackAssoc.add<
double>(
"muonMaxDistanceY", 5.0);
412 desc_TrackAssoc.add<
bool>(
"useHO",
false);
413 desc_TrackAssoc.add<
bool>(
"accountForTrajectoryChangeCalo",
false);
416 desc_TrackAssoc.add<
double>(
"dRHcalPreselection", 0.2);
417 desc_TrackAssoc.add<
bool>(
"useMuon",
false);
418 desc_TrackAssoc.add<
bool>(
"useCalo",
true);
420 desc_TrackAssoc.add<
double>(
"dRMuonPreselection", 0.2);
421 desc_TrackAssoc.add<
bool>(
"truthMatch",
false);
423 desc_TrackAssoc.add<
bool>(
"useHcal",
true);
424 desc_TrackAssoc.add<
bool>(
"usePreshower",
false);
425 desc_TrackAssoc.add<
double>(
"dRPreshowerPreselection", 0.2);
426 desc_TrackAssoc.add<
double>(
"trajectoryUncertaintyTolerance", 1.0);
428 descriptions.
add(
"isolatedTracksCone", desc);
432 unsigned int irun = (
unsigned int)
iEvent.id().run();
433 unsigned int ilum = (
unsigned int)
iEvent.getLuminosityBlock().luminosityBlock();
434 unsigned int ievt = (
unsigned int)
iEvent.id().event();
446 l1extra::L1JetParticleCollection::const_iterator
itr;
447 for (
itr = l1TauHandle->begin();
itr != l1TauHandle->end(); ++
itr) {
456 for (
itr = l1CenJetHandle->begin();
itr != l1CenJetHandle->end(); ++
itr) {
465 for (
itr = l1FwdJetHandle->begin();
itr != l1FwdJetHandle->end(); ++
itr) {
522 reco::TrackCollection::const_iterator trkItr;
525 edm::LogVerbatim(
"IsoTrack") <<
"Number of Tracks " << trkCollection->size();
559 std::vector<int> v_hlTriggers;
569 int hltL1SingleEG5(-99);
570 int hltZeroBias(-99);
571 int hltMinBiasHcal(-99);
572 int hltMinBiasEcal(-99);
573 int hltMinBiasPixel(-99);
574 int hltSingleIsoTau30_Trk5(-99);
575 int hltDoubleLooseIsoTau15_Trk5(-99);
611 if (
triggerNames.triggerName(
i) ==
"HLT_SingleIsoTau30_Trk5")
613 if (
triggerNames.triggerName(
i) ==
"HLT_DoubleLooseIsoTau15_Trk5")
621 std::unique_ptr<TrackerHitAssociator> associate;
633 for (trkItr = trkCollection->begin(); trkItr != trkCollection->end(); ++trkItr) {
642 bool trkQual = pTrack->
quality(trackQuality_);
647 double phi1 = pTrack->
momentum().phi();
648 double pt1 = pTrack->
pt();
649 double p1 = pTrack->
p();
666 if (!goodEta || !goodPt || !trkQual)
694 int nOuterHits = hitp.stripTOBLayersWithMeasurement() + hitp.stripTECLayersWithMeasurement();
698 edm::SimTrackContainer::const_iterator matchedSimTrk =
700 simP = matchedSimTrk->momentum().P();
725 double drFromLeadJet = 999.0;
729 drFromLeadJet =
sqrt(dphi * dphi + deta * deta);
737 const int a_size = 7;
738 double a_coneR[a_size];
739 double a_charIsoR[a_size];
740 double a_neutIsoR[a_size];
750 for (
int i = 0;
i < a_size;
i++) {
751 a_charIsoR[
i] = a_coneR[
i] + 28.9;
752 a_neutIsoR[
i] = a_charIsoR[
i] * 0.726;
760 double e3x3 = -999.0;
761 double trkEcalEne = -999.0;
765 if (
std::abs(point1.eta()) < 1.479) {
796 const int a_mip_size = 5;
797 double a_mipR[a_mip_size];
804 std::vector<double> v_eDR;
805 for (
int i = 0;
i < a_size;
i++) {
810 geo, barrelRecHitsHandle, endcapRecHitsHandle, hpoint1, point1, a_neutIsoR[
i], trackMomAtEcal, nRH_eDR);
811 v_eDR.push_back(eDR);
814 std::vector<double> v_eMipDR;
815 for (
int i = 0;
i < a_mip_size;
i++) {
818 geo, barrelRecHitsHandle, endcapRecHitsHandle, hpoint1, point1, a_mipR[
i], trackMomAtEcal, nRH_eMipDR);
820 v_eMipDR.push_back(eMipDR);
828 std::vector<double> v_hmaxNearP_goodTrk;
829 std::vector<double> v_hmaxNearP;
830 std::vector<int> v_hnNearTRKs;
831 std::vector<int> v_hnLayers_maxNearP;
832 std::vector<int> v_htrkQual_maxNearP;
834 std::vector<double> v_cone_hmaxNearP_goodTrk;
835 std::vector<double> v_cone_hmaxNearP;
836 std::vector<int> v_cone_hnNearTRKs;
837 std::vector<int> v_cone_hnLayers_maxNearP;
838 std::vector<int> v_cone_htrkQual_maxNearP;
840 for (
int i = 0;
i < a_size;
i++) {
841 double hmaxNearP = -999.0;
843 int hnLayers_maxNearP = 0;
844 int htrkQual_maxNearP = -1;
845 double hmaxNearP_goodTrk = -999.0;
847 double conehmaxNearP = -999.0;
848 int conehnNearTRKs = 0;
849 int conehnLayers_maxNearP = 0;
850 int conehtrkQual_maxNearP = -1;
851 double conehmaxNearP_goodTrk = -999.0;
861 conehnLayers_maxNearP,
862 conehtrkQual_maxNearP,
863 conehmaxNearP_goodTrk,
868 v_hmaxNearP_goodTrk.push_back(hmaxNearP_goodTrk);
869 v_hmaxNearP.push_back(hmaxNearP);
870 v_hnNearTRKs.push_back(hnNearTRKs);
871 v_hnLayers_maxNearP.push_back(hnLayers_maxNearP);
872 v_htrkQual_maxNearP.push_back(htrkQual_maxNearP);
874 v_cone_hmaxNearP_goodTrk.push_back(conehmaxNearP_goodTrk);
875 v_cone_hmaxNearP.push_back(conehmaxNearP);
876 v_cone_hnNearTRKs.push_back(conehnNearTRKs);
877 v_cone_hnLayers_maxNearP.push_back(conehnLayers_maxNearP);
878 v_cone_htrkQual_maxNearP.push_back(conehtrkQual_maxNearP);
881 double h3x3 = -999.0, h5x5 = -999.0;
882 double hsim3x3 = -999.0, hsim5x5 = -999.0, trkHcalEne = -999.0;
883 std::map<std::string, double> hsimInfo3x3, hsimInfo5x5;
884 double distFromHotCell_h3x3 = -99.;
885 int ietaFromHotCell_h3x3 = -99;
886 int iphiFromHotCell_h3x3 = -99;
887 double distFromHotCell_h5x5 = -99.;
888 int ietaFromHotCell_h5x5 = -99;
889 int iphiFromHotCell_h5x5 = -99;
894 int nRH_h3x3(0), nRH_h5x5(0);
909 std::vector<int> v_RH_h3x3_ieta;
910 std::vector<int> v_RH_h3x3_iphi;
911 std::vector<double> v_RH_h3x3_ene;
912 std::vector<int> v_RH_h5x5_ieta;
913 std::vector<int> v_RH_h5x5_iphi;
914 std::vector<double> v_RH_h5x5_ene;
944 std::vector<int> multiplicity3x3;
945 std::vector<int> multiplicity5x5;
951 iEvent, theHBHETopology, ClosestCell, pcalohh, SimTk, SimVtx, pTrack, *associate, 1, 1, multiplicity3x3);
953 iEvent, theHBHETopology, ClosestCell, pcalohh, SimTk, SimVtx, pTrack, *associate, 2, 2, multiplicity5x5);
960 std::vector<double> v_hsimInfoConeMatched;
961 std::vector<double> v_hsimInfoConeRest;
962 std::vector<double> v_hsimInfoConePhoton;
963 std::vector<double> v_hsimInfoConeNeutHad;
964 std::vector<double> v_hsimInfoConeCharHad;
965 std::vector<double> v_hsimInfoConePdgMatched;
966 std::vector<double> v_hsimInfoConeTotal;
968 std::vector<int> v_hsimInfoConeNMatched;
969 std::vector<int> v_hsimInfoConeNTotal;
970 std::vector<int> v_hsimInfoConeNNeutHad;
971 std::vector<int> v_hsimInfoConeNCharHad;
972 std::vector<int> v_hsimInfoConeNPhoton;
973 std::vector<int> v_hsimInfoConeNRest;
975 std::vector<double> v_hsimCone;
976 std::vector<double> v_hCone;
978 std::vector<int> v_nRecHitsCone;
979 std::vector<int> v_nSimHitsCone;
981 std::vector<double> v_distFromHotCell;
982 std::vector<int> v_ietaFromHotCell;
983 std::vector<int> v_iphiFromHotCell;
986 std::vector<int> v_RH_r26_ieta;
987 std::vector<int> v_RH_r26_iphi;
988 std::vector<double> v_RH_r26_ene;
989 std::vector<int> v_RH_r44_ieta;
990 std::vector<int> v_RH_r44_iphi;
991 std::vector<double> v_RH_r44_ene;
993 for (
int i = 0;
i < a_size;
i++) {
994 std::map<std::string, double> hsimInfoCone;
995 double hsimCone = -999.0, hCone = -999.0;
996 double distFromHotCell = -99.0;
997 int ietaFromHotCell = -99;
998 int iphiFromHotCell = -99;
999 int ietaHotCell = -99;
1000 int iphiHotCell = -99;
1001 int nRecHitsCone = -999;
1002 int nSimHitsCone = -999;
1004 std::vector<int> multiplicityCone;
1005 std::vector<DetId> coneRecHitDetIds;
1007 hsimCone =
spr::eCone_hcal(geo, pcalohh, hpoint1, point1, a_coneR[
i], trackMomAtHcal, nSimHitsCone);
1011 bool makeHitmaps =
false;
1012 if (a_coneR[
i] == 26.23 && makeHitmaps) {
1028 }
else if (a_coneR[
i] == 43.72 && makeHitmaps) {
1059 if (ietaHotCell != 99) {
1060 ietaFromHotCell = ietaHotCell - ClosestCell_HcalDetId.ieta();
1061 iphiFromHotCell = iphiHotCell - ClosestCell_HcalDetId.iphi();
1066 hsimInfoCone = spr::eHCALSimInfoCone(
iEvent,
1087 v_hsimInfoConeMatched.push_back(hsimInfoCone[
"eMatched"]);
1088 v_hsimInfoConeRest.push_back(hsimInfoCone[
"eRest"]);
1089 v_hsimInfoConePhoton.push_back(hsimInfoCone[
"eGamma"]);
1090 v_hsimInfoConeNeutHad.push_back(hsimInfoCone[
"eNeutralHad"]);
1091 v_hsimInfoConeCharHad.push_back(hsimInfoCone[
"eChargedHad"]);
1092 v_hsimInfoConePdgMatched.push_back(hsimInfoCone[
"pdgMatched"]);
1093 v_hsimInfoConeTotal.push_back(hsimInfoCone[
"eTotal"]);
1095 v_hsimInfoConeNMatched.push_back(multiplicityCone.at(0));
1097 v_hsimInfoConeNTotal.push_back(multiplicityCone.at(1));
1098 v_hsimInfoConeNNeutHad.push_back(multiplicityCone.at(2));
1099 v_hsimInfoConeNCharHad.push_back(multiplicityCone.at(3));
1100 v_hsimInfoConeNPhoton.push_back(multiplicityCone.at(4));
1101 v_hsimInfoConeNRest.push_back(multiplicityCone.at(5));
1103 v_hsimCone.push_back(hsimCone);
1104 v_nSimHitsCone.push_back(nSimHitsCone);
1106 v_hCone.push_back(hCone);
1107 v_nRecHitsCone.push_back(nRecHitsCone);
1109 v_distFromHotCell.push_back(distFromHotCell);
1110 v_ietaFromHotCell.push_back(ietaFromHotCell);
1111 v_iphiFromHotCell.push_back(iphiFromHotCell);
1272 genPartPBins_ = {{0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
1273 12.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 100.0}};
1277 t_v_hnNearTRKs = std::make_unique<std::vector<std::vector<int> > >();
1281 t_v_hmaxNearP = std::make_unique<std::vector<std::vector<double> > >();
1293 t_trkP = std::make_unique<std::vector<double> >();
1294 t_trkPt = std::make_unique<std::vector<double> >();
1295 t_trkEta = std::make_unique<std::vector<double> >();
1296 t_trkPhi = std::make_unique<std::vector<double> >();
1298 t_e3x3 = std::make_unique<std::vector<double> >();
1299 t_v_eDR = std::make_unique<std::vector<std::vector<double> > >();
1300 t_v_eMipDR = std::make_unique<std::vector<std::vector<double> > >();
1302 t_h3x3 = std::make_unique<std::vector<double> >();
1303 t_h5x5 = std::make_unique<std::vector<double> >();
1305 t_nRH_h3x3 = std::make_unique<std::vector<double> >();
1306 t_nRH_h5x5 = std::make_unique<std::vector<double> >();
1309 t_simP = std::make_unique<std::vector<double> >();
1310 t_hsim3x3 = std::make_unique<std::vector<double> >();
1311 t_hsim5x5 = std::make_unique<std::vector<double> >();
1342 t_trkHcalEne = std::make_unique<std::vector<double> >();
1343 t_trkEcalEne = std::make_unique<std::vector<double> >();
1369 t_v_hsimCone = std::make_unique<std::vector<std::vector<double> > >();
1372 t_v_hCone = std::make_unique<std::vector<std::vector<double> > >();
1382 t_v_RH_h3x3_ene = std::make_unique<std::vector<std::vector<double> > >();
1385 t_v_RH_h5x5_ene = std::make_unique<std::vector<std::vector<double> > >();
1386 t_v_RH_r26_ieta = std::make_unique<std::vector<std::vector<int> > >();
1387 t_v_RH_r26_iphi = std::make_unique<std::vector<std::vector<int> > >();
1388 t_v_RH_r26_ene = std::make_unique<std::vector<std::vector<double> > >();
1389 t_v_RH_r44_ieta = std::make_unique<std::vector<std::vector<int> > >();
1390 t_v_RH_r44_iphi = std::make_unique<std::vector<std::vector<int> > >();
1391 t_v_RH_r44_ene = std::make_unique<std::vector<std::vector<double> > >();
1393 t_v_hlTriggers = std::make_unique<std::vector<std::vector<int> > >();
1395 t_hltHE = std::make_unique<std::vector<int> >();
1396 t_hltHB = std::make_unique<std::vector<int> >();
1398 t_hltJet30 = std::make_unique<std::vector<int> >();
1399 t_hltJet50 = std::make_unique<std::vector<int> >();
1400 t_hltJet80 = std::make_unique<std::vector<int> >();
1401 t_hltJet110 = std::make_unique<std::vector<int> >();
1402 t_hltJet140 = std::make_unique<std::vector<int> >();
1403 t_hltJet180 = std::make_unique<std::vector<int> >();
1412 t_irun = std::make_unique<std::vector<unsigned int> >();
1413 t_ievt = std::make_unique<std::vector<unsigned int> >();
1414 t_ilum = std::make_unique<std::vector<unsigned int> >();
1562 h_RawPt = fs->
make<TH1F>(
"hRawPt",
"hRawPt", 100, 0.0, 100.0);
1563 h_RawP = fs->
make<TH1F>(
"hRawP",
"hRawP", 100, 0.0, 100.0);
1564 h_RawEta = fs->
make<TH1F>(
"hRawEta",
"hRawEta", 15, 0.0, 3.0);
1565 h_RawPhi = fs->
make<TH1F>(
"hRawPhi",
"hRawPhi", 100, -3.2, 3.2);
1567 ntp_ = fs->
make<TTree>(
"ntp",
"ntp");
1570 ntp_->Branch(
"nEVT", &
nEVT,
"nEVT/I");
1574 ntp_->Branch(
"nTRK", &
nTRK,
"nTRK/I");
1598 ntp_->Branch(
"trkP",
"std::vector<double>", &
t_trkP);
1599 ntp_->Branch(
"trkPt",
"std::vector<double>", &
t_trkPt);
1600 ntp_->Branch(
"trkEta",
"std::vector<double>", &
t_trkEta);
1601 ntp_->Branch(
"trkPhi",
"std::vector<double>", &
t_trkPhi);
1602 ntp_->Branch(
"e3x3",
"std::vector<double>", &
t_e3x3);
1604 ntp_->Branch(
"e3x3",
"std::vector<double>", &
t_e3x3);
1605 ntp_->Branch(
"v_eDR",
"std::vector<std::vector<double> >", &
t_v_eDR);
1606 ntp_->Branch(
"v_eMipDR",
"std::vector<std::vector<double> >", &
t_v_eMipDR);
1608 ntp_->Branch(
"h3x3",
"std::vector<double>", &
t_h3x3);
1609 ntp_->Branch(
"h5x5",
"std::vector<double>", &
t_h5x5);
1614 ntp_->Branch(
"simP",
"std::vector<double>", &
t_simP);
1674 ntp_->Branch(
"v_hsimCone",
"std::vector<std::vector<double> >", &
t_v_hsimCone);
1677 ntp_->Branch(
"v_hCone",
"std::vector<std::vector<double> >", &
t_v_hCone);
1699 ntp_->Branch(
"v_hltHB",
"std::vector<int>", &
t_hltHB);
1700 ntp_->Branch(
"v_hltHE",
"std::vector<int>", &
t_hltHE);
1716 ntp_->Branch(
"irun",
"std::vector<unsigned int>", &
t_irun);
1717 ntp_->Branch(
"ievt",
"std::vector<unsigned int>", &
t_ievt);
1718 ntp_->Branch(
"ilum",
"std::vector<unsigned int>", &
t_ilum);
1726 <<
" TrackMmentum " << pTrack->
momentum() <<
" (pt,eta,phi)(" << pTrack->
pt() <<
","
1727 << pTrack->
eta() <<
"," << pTrack->
phi() <<
")"
1728 <<
" p " << pTrack->
p() <<
"\n"
1731 << pTrack->
d0() <<
"\n"
1734 <<
" " << pTrack->
quality(trackQuality_);
1754 double dphi =
deltaPhi(phi1, phi2);
1755 return std::sqrt(deta * deta + dphi * dphi);