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);
301 descriptions.
add(
"trackToTrackComparisonHists",
desc);
312 for (
const auto& track1 : tracks1) {
313 std::map<double, int>
tmp;
315 float smallest_dR = 1e9;
316 int smallest_dR_j = -1;
321 for (
const auto& track2 : tracks2) {
322 double dR =
reco::deltaR(track1.eta(), track1.phi(), track2.eta(), track2.phi());
324 if (
dR < smallest_dR) {
340 tmp[smallest_dR] = smallest_dR_j;
342 map.push_back(std::make_pair(
i,
tmp));
371 (mes.
h_hits) = ibooker.
book1D(
label +
"_hits",
"track number of hits", 35, -0.5, 34.5);
376 "track p_{T} vs #eta",
393 label +
"_hits_vs_hits",
"monitored track # hits vs reference track # hits", 35, -0.5, 34.5, 35, -0.5, 34.5);
395 "monitored track p_{T} vs reference track p_{T}",
403 "monitored track #eta vs reference track #eta",
411 "monitored track #phi vs reference track #phi",
427 "#Delta track transverse dca to primary vertex ",
432 "#Delta track longitudinal dca to primary vertex",
437 (mes.
h_dHits) = ibooker.
book1D(
label +
"_dHits",
"#Delta track number of hits", 39, -19.5, 19.5);
442 float pt = trk->
pt();
445 float dxy = trk->
dxy(
bs->position());
446 float dz = trk->
dz(
bs->position());
447 float dxyWRTpv = trk->
dxy(
pv->position());
448 float dzWRTpv = trk->
dz(
pv->position());
455 if (dxyOnPlateau || !requirePlateau) {
459 if ((pTOnPlateau && dxyOnPlateau) || !requirePlateau) {
468 if (pTOnPlateau || !requirePlateau) {
478 float mon_pt =
mon->pt();
479 float mon_eta =
mon->eta();
480 float mon_phi =
mon->phi();
481 float mon_dxy =
mon->dxy(
bs->position());
482 float mon_dz =
mon->dz(
bs->position());
483 float mon_dxyWRTpv =
mon->dxy(
pv->position());
484 float mon_dzWRTpv =
mon->dz(
pv->position());
485 float mon_charge =
mon->charge();
486 float mon_nhits =
mon->hitPattern().numberOfValidHits();
488 float ref_pt = ref->
pt();
489 float ref_eta = ref->
eta();
490 float ref_phi = ref->
phi();
491 float ref_dxy = ref->
dxy(
bs->position());
492 float ref_dz = ref->
dz(
bs->position());
493 float ref_dxyWRTpv = ref->
dxy(
pv->position());
494 float ref_dzWRTpv = ref->
dz(
pv->position());
495 float ref_charge = ref->
charge();
523 Pt_nbin =
pset.getParameter<
unsigned int>(
"Pt_nbin");
535 Dz_nbin =
pset.getParameter<
unsigned int>(
"Dz_nbin");
559 pset.add<
double>(
"Eta_rangeMin", -2.5);
560 pset.add<
double>(
"Eta_rangeMax", 2.5);
561 pset.add<
unsigned int>(
"Eta_nbin", 50);
563 pset.add<
double>(
"Pt_rangeMin", 0.1);
564 pset.add<
double>(
"Pt_rangeMax", 100.0);
565 pset.add<
unsigned int>(
"Pt_nbin", 1000);
567 pset.add<
double>(
"Phi_rangeMin", -3.1416);
568 pset.add<
double>(
"Phi_rangeMax", 3.1416);
569 pset.add<
unsigned int>(
"Phi_nbin", 36);
571 pset.add<
double>(
"Dxy_rangeMin", -1.0);
572 pset.add<
double>(
"Dxy_rangeMax", 1.0);
573 pset.add<
unsigned int>(
"Dxy_nbin", 300);
575 pset.add<
double>(
"Dz_rangeMin", -30.0);
576 pset.add<
double>(
"Dz_rangeMax", 30.0);
577 pset.add<
unsigned int>(
"Dz_nbin", 60);
579 pset.add<
double>(
"ptRes_rangeMin", -0.1);
580 pset.add<
double>(
"ptRes_rangeMax", 0.1);
581 pset.add<
unsigned int>(
"ptRes_nbin", 100);
583 pset.add<
double>(
"phiRes_rangeMin", -0.01);
584 pset.add<
double>(
"phiRes_rangeMax", 0.01);
585 pset.add<
unsigned int>(
"phiRes_nbin", 300);
587 pset.add<
double>(
"etaRes_rangeMin", -0.01);
588 pset.add<
double>(
"etaRes_rangeMax", 0.01);
589 pset.add<
unsigned int>(
"etaRes_nbin", 300);
591 pset.add<
double>(
"dxyRes_rangeMin", -0.05);
592 pset.add<
double>(
"dxyRes_rangeMax", 0.05);
593 pset.add<
unsigned int>(
"dxyRes_nbin", 500);
595 pset.add<
double>(
"dzRes_rangeMin", -0.05);
596 pset.add<
double>(
"dzRes_rangeMax", 0.05);
597 pset.add<
unsigned int>(
"dzRes_nbin", 150);
edm::EDGetTokenT< reco::TrackCollection > monitoredTrackToken_
generalME monitoredTracksMEs_
T getParameter(std::string const &) const
int numberOfValidHits() const
void beginJob(const edm::EventSetup &iSetup)
edm::EDGetTokenT< reco::BeamSpot > referenceBSToken_
edm::InputTag referenceTrackInputTag_
edm::EDGetTokenT< reco::VertexCollection > monitoredPVToken_
virtual void setCurrentFolder(std::string const &fullpath)
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
generalME matchedReferenceTracksMEs_
MonitorElement * h_dDzWRTpv
MonitorElement * h_pt_vs_pt
const Point & position() const
position
edm::EDGetTokenT< reco::TrackCollection > referenceTrackToken_
std::vector< Track > TrackCollection
collection of Tracks
edm::InputTag monitoredTrackInputTag_
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
Log< level::Error, false > LogError
bool requireValidHLTPaths_
double pt() const
track transverse momentum
MonitorElement * h_phi_vs_phi
MonitorElement * h_charge
int charge() const
track electric charge
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
std::unique_ptr< GenericTriggerEventFlag > genTriggerEventFlag_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void fill_generic_tracks_histos(generalME &mes, reco::Track *trk, reco::BeamSpot *bs, reco::Vertex *pv, bool requirePlateau=true)
MonitorElement * h_pt_vs_eta
double phi() const
azimuthal angle of momentum vector
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
matchingME matchTracksMEs_
static void fillHistoPSetDescription(edm::ParameterSetDescription &pset)
std::vector< std::pair< int, std::map< double, int > > > idx2idxByDoubleColl
MonitorElement * h_dDxyWRTpv
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
MonitorElement * h_dRmin_l
Log< level::Info, false > LogInfo
double eta() const
pseudorapidity of momentum vector
MonitorElement * h_dzWRTpv
MonitorElement * h_dCharge
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
void initialize_parameter(const edm::ParameterSet &iConfig)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void fill_matching_tracks_histos(matchingME &mes, reco::Track *mon, reco::Track *ref, reco::BeamSpot *bs, reco::Vertex *pv)
edm::EDGetTokenT< reco::BeamSpot > monitoredBSToken_
edm::EDGetTokenT< reco::VertexCollection > referencePVToken_
void fillMap(reco::TrackCollection tracks1, reco::TrackCollection tracks2, idx2idxByDoubleColl &map, float dRMin)
MonitorElement * h_eta_vs_eta
generalME unMatchedMonitoredTracksMEs_
void book_matching_tracks_histos(DQMStore::IBooker &ibooker, matchingME &mes, TString label, std::string &dir)
void book_generic_tracks_histos(DQMStore::IBooker &ibooker, generalME &mes, TString label, std::string &dir)
MonitorElement * h_hits_vs_hits
generalME referenceTracksMEs_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
static void fillPSetDescription(edm::ParameterSetDescription &desc)
void bookHistos(DQMStore::IBooker &ibooker, generalME &mes, TString label, std::string &dir)
MonitorElement * h_dxyWRTpv
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
~TrackToTrackComparisonHists() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TrackToTrackComparisonHists(const edm::ParameterSet &)