17 : monitoredTrackInputTag_(iConfig.getParameter<
edm::
InputTag>(
"monitoredTrack")),
18 referenceTrackInputTag_(iConfig.getParameter<
edm::
InputTag>(
"referenceTrack")),
19 topDirName_(iConfig.getParameter<
std::
string>(
"topDirName")),
20 dRmin_(iConfig.getParameter<double>(
"dRmin")),
21 pTCutForPlateau_(iConfig.getParameter<double>(
"pTCutForPlateau")),
22 dxyCutForPlateau_(iConfig.getParameter<double>(
"dxyCutForPlateau")),
23 dzWRTPvCut_(iConfig.getParameter<double>(
"dzWRTPvCut")),
24 requireValidHLTPaths_(iConfig.getParameter<
bool>(
"requireValidHLTPaths")),
26 iConfig.getParameter<
edm::
ParameterSet>(
"genericTriggerEventPSet"), consumesCollector(), *this))
56 LogDebug(
"TrackToTrackComparisonHists")
76 if (!referenceTracksHandle.
isValid()) {
77 edm::LogError(
"TrackToTrackComparisonHists") <<
"referenceTracksHandle not found, skipping event";
84 if (!referenceBSHandle.
isValid()) {
85 edm::LogError(
"TrackToTrackComparisonHists") <<
"referenceBSHandle not found, skipping event";
92 if (!referencePVHandle.
isValid()) {
93 edm::LogError(
"TrackToTrackComparisonHists") <<
"referencePVHandle not found, skipping event";
96 if (referencePVHandle->empty()) {
97 edm::LogInfo(
"TrackToTrackComparisonHists") <<
"referencePVHandle->size is 0 ";
107 if (!monitoredTracksHandle.
isValid()) {
108 edm::LogError(
"TrackToTrackComparisonHists") <<
"monitoredTracksHandle not found, skipping event";
115 if (!monitoredTracksHandle.
isValid()) {
116 edm::LogError(
"TrackToTrackComparisonHists") <<
"monitoredBSHandle not found, skipping event";
123 if (!monitoredPVHandle.
isValid()) {
124 edm::LogError(
"TrackToTrackComparisonHists") <<
"monitoredPVHandle not found, skipping event";
127 if (monitoredPVHandle->empty()) {
128 edm::LogInfo(
"TrackToTrackComparisonHists") <<
"monitoredPVHandle->size is 0 ";
142 fillMap(monitoredTracks, referenceTracks, monitored2referenceColl,
dRmin_);
145 fillMap(referenceTracks, monitoredTracks, reference2monitoredColl,
dRmin_);
147 unsigned int nReferenceTracks(0);
148 unsigned int nMatchedReferenceTracks(0);
149 unsigned int nMonitoredTracks(0);
150 unsigned int nUnmatchedMonitoredTracks(0);
155 LogDebug(
"TrackToTrackComparisonHists") <<
"\n# of tracks (reference): " << referenceTracks.size() <<
"\n";
156 for (idx2idxByDoubleColl::const_iterator pItr = reference2monitoredColl.begin(), eItr = reference2monitoredColl.end();
160 int trackIdx = pItr->first;
169 std::map<double, int> trackDRmap = pItr->second;
170 if (trackDRmap.empty()) {
176 double dRmin = trackDRmap.begin()->first;
185 nMatchedReferenceTracks++;
190 int matchedTrackIndex = trackDRmap[dRmin];
191 reco::Track matchedTrack = monitoredTracks.at(matchedTrackIndex);
200 LogDebug(
"TrackToTrackComparisonHists") <<
"\n# of tracks (monitored): " << monitoredTracks.size() <<
"\n";
201 for (idx2idxByDoubleColl::const_iterator pItr = monitored2referenceColl.begin(), eItr = monitored2referenceColl.end();
205 int trackIdx = pItr->first;
214 std::map<double, int> trackDRmap = pItr->second;
215 if (trackDRmap.empty()) {
221 double dRmin = trackDRmap.begin()->first;
230 nUnmatchedMonitoredTracks++;
239 <<
"Total reference tracks: " << nReferenceTracks <<
"\n"
240 <<
"Total matched reference tracks: " << nMatchedReferenceTracks <<
"\n"
241 <<
"Total monitored tracks: " << nMonitoredTracks <<
"\n"
242 <<
"Total unMatched monitored tracks: " << nUnmatchedMonitoredTracks <<
"\n";
276 desc.add<
bool>(
"requireValidHLTPaths",
true);
286 desc.add<
std::string>(
"topDirName",
"HLT/Tracking/ValidationWRTOffline");
287 desc.add<
double>(
"dRmin", 0.002);
289 desc.add<
double>(
"pTCutForPlateau", 0.9);
290 desc.add<
double>(
"dxyCutForPlateau", 2.5);
291 desc.add<
double>(
"dzWRTPvCut", 1e6);
312 descriptions.
add(
"trackToTrackComparisonHists",
desc);
323 for (
const auto& track1 : tracks1) {
324 std::map<double, int>
tmp;
326 float smallest_dR = 1e9;
327 int smallest_dR_j = -1;
332 for (
const auto& track2 : tracks2) {
333 double dR =
reco::deltaR(track1.eta(), track1.phi(), track2.eta(), track2.phi());
335 if (
dR < smallest_dR) {
351 tmp[smallest_dR] = smallest_dR_j;
353 map.push_back(std::make_pair(
i,
tmp));
382 (mes.
h_hits) = ibooker.
book1D(
label +
"_hits",
"track number of hits", 35, -0.5, 34.5);
387 "track p_{T} vs #eta",
404 label +
"_hits_vs_hits",
"monitored track # hits vs reference track # hits", 35, -0.5, 34.5, 35, -0.5, 34.5);
406 "monitored track p_{T} vs reference track p_{T}",
414 "monitored track #eta vs reference track #eta",
422 "monitored track #phi vs reference track #phi",
438 "#Delta track transverse dca to primary vertex ",
443 "#Delta track longitudinal dca to primary vertex",
448 (mes.
h_dHits) = ibooker.
book1D(
label +
"_dHits",
"#Delta track number of hits", 39, -19.5, 19.5);
453 float pt = trk->
pt();
456 float dxy = trk->
dxy(
bs->position());
457 float dz = trk->
dz(
bs->position());
458 float dxyWRTpv = trk->
dxy(
pv->position());
459 float dzWRTpv = trk->
dz(
pv->position());
466 if (dxyOnPlateau || !requirePlateau) {
470 if ((pTOnPlateau && dxyOnPlateau) || !requirePlateau) {
479 if (pTOnPlateau || !requirePlateau) {
489 float mon_pt =
mon->pt();
490 float mon_eta =
mon->eta();
491 float mon_phi =
mon->phi();
492 float mon_dxy =
mon->dxy(
bs->position());
493 float mon_dz =
mon->dz(
bs->position());
494 float mon_dxyWRTpv =
mon->dxy(
pv->position());
495 float mon_dzWRTpv =
mon->dz(
pv->position());
496 float mon_charge =
mon->charge();
497 float mon_nhits =
mon->hitPattern().numberOfValidHits();
499 float ref_pt = ref->
pt();
500 float ref_eta = ref->
eta();
501 float ref_phi = ref->
phi();
502 float ref_dxy = ref->
dxy(
bs->position());
503 float ref_dz = ref->
dz(
bs->position());
504 float ref_dxyWRTpv = ref->
dxy(
pv->position());
505 float ref_dzWRTpv = ref->
dz(
pv->position());
506 float ref_charge = ref->
charge();
534 Pt_nbin =
pset.getParameter<
unsigned int>(
"Pt_nbin");
546 Dz_nbin =
pset.getParameter<
unsigned int>(
"Dz_nbin");
570 pset.add<
double>(
"Eta_rangeMin", -2.5);
571 pset.add<
double>(
"Eta_rangeMax", 2.5);
572 pset.add<
unsigned int>(
"Eta_nbin", 50);
574 pset.add<
double>(
"Pt_rangeMin", 0.1);
575 pset.add<
double>(
"Pt_rangeMax", 100.0);
576 pset.add<
unsigned int>(
"Pt_nbin", 1000);
578 pset.add<
double>(
"Phi_rangeMin", -3.1416);
579 pset.add<
double>(
"Phi_rangeMax", 3.1416);
580 pset.add<
unsigned int>(
"Phi_nbin", 36);
582 pset.add<
double>(
"Dxy_rangeMin", -1.0);
583 pset.add<
double>(
"Dxy_rangeMax", 1.0);
584 pset.add<
unsigned int>(
"Dxy_nbin", 300);
586 pset.add<
double>(
"Dz_rangeMin", -30.0);
587 pset.add<
double>(
"Dz_rangeMax", 30.0);
588 pset.add<
unsigned int>(
"Dz_nbin", 60);
590 pset.add<
double>(
"ptRes_rangeMin", -0.1);
591 pset.add<
double>(
"ptRes_rangeMax", 0.1);
592 pset.add<
unsigned int>(
"ptRes_nbin", 100);
594 pset.add<
double>(
"phiRes_rangeMin", -0.01);
595 pset.add<
double>(
"phiRes_rangeMax", 0.01);
596 pset.add<
unsigned int>(
"phiRes_nbin", 300);
598 pset.add<
double>(
"etaRes_rangeMin", -0.01);
599 pset.add<
double>(
"etaRes_rangeMax", 0.01);
600 pset.add<
unsigned int>(
"etaRes_nbin", 300);
602 pset.add<
double>(
"dxyRes_rangeMin", -0.05);
603 pset.add<
double>(
"dxyRes_rangeMax", 0.05);
604 pset.add<
unsigned int>(
"dxyRes_nbin", 500);
606 pset.add<
double>(
"dzRes_rangeMin", -0.05);
607 pset.add<
double>(
"dzRes_rangeMax", 0.05);
608 pset.add<
unsigned int>(
"dzRes_nbin", 150);