18 : monitoredTrackInputTag_(iConfig.getParameter<
edm::
InputTag>(
"monitoredTrack")),
19 referenceTrackInputTag_(iConfig.getParameter<
edm::
InputTag>(
"referenceTrack")),
20 topDirName_(iConfig.getParameter<
std::
string>(
"topDirName")),
21 dRmin_(iConfig.getParameter<double>(
"dRmin")),
22 pTCutForPlateau_(iConfig.getParameter<double>(
"pTCutForPlateau")),
23 dxyCutForPlateau_(iConfig.getParameter<double>(
"dxyCutForPlateau")),
24 dzWRTPvCut_(iConfig.getParameter<double>(
"dzWRTPvCut")),
25 requireValidHLTPaths_(iConfig.getParameter<
bool>(
"requireValidHLTPaths")),
27 iConfig.getParameter<
edm::
ParameterSet>(
"genericTriggerEventPSet"), consumesCollector(), *this))
60 LogDebug(
"TrackToTrackComparisonHists")
79 unsigned int ls =
iEvent.id().luminosityBlock();
81 double onlinelumi = -1.f;
87 if (onlineMetaDataDigisHandle.isValid()) {
88 onlinelumi = onlineMetaDataDigisHandle->instLumi();
89 PU = onlineMetaDataDigisHandle->avgPileUp();
90 }
else if (lumiScalersHandle.isValid() and not lumiScalersHandle->empty()) {
91 edm::LogError(
"TrackToTrackComparisonHists") <<
"onlineMetaDataDigisHandle not found, trying SCAL";
92 auto const scalit = lumiScalersHandle->begin();
93 onlinelumi = scalit->instantLumi();
94 PU = scalit->pileup();
96 edm::LogError(
"TrackToTrackComparisonHists") <<
"lumiScalersHandle not found or empty, skipping event";
105 if (!referenceTracksHandle.
isValid()) {
106 edm::LogError(
"TrackToTrackComparisonHists") <<
"referenceTracksHandle not found, skipping event";
113 if (!referenceBSHandle.
isValid()) {
114 edm::LogError(
"TrackToTrackComparisonHists") <<
"referenceBSHandle not found, skipping event";
121 if (!referencePVHandle.
isValid()) {
122 edm::LogError(
"TrackToTrackComparisonHists") <<
"referencePVHandle not found, skipping event";
125 if (referencePVHandle->empty()) {
126 edm::LogInfo(
"TrackToTrackComparisonHists") <<
"referencePVHandle->size is 0 ";
136 if (!monitoredTracksHandle.
isValid()) {
137 edm::LogError(
"TrackToTrackComparisonHists") <<
"monitoredTracksHandle not found, skipping event";
144 if (!monitoredTracksHandle.
isValid()) {
145 edm::LogError(
"TrackToTrackComparisonHists") <<
"monitoredBSHandle not found, skipping event";
152 if (!monitoredPVHandle.
isValid()) {
153 edm::LogError(
"TrackToTrackComparisonHists") <<
"monitoredPVHandle not found, skipping event";
156 if (monitoredPVHandle->empty()) {
157 edm::LogInfo(
"TrackToTrackComparisonHists") <<
"monitoredPVHandle->size is 0 ";
171 fillMap(monitoredTracks, referenceTracks, monitored2referenceColl,
dRmin_);
174 fillMap(referenceTracks, monitoredTracks, reference2monitoredColl,
dRmin_);
176 unsigned int nReferenceTracks(0);
177 unsigned int nMatchedReferenceTracks(0);
178 unsigned int nMonitoredTracks(0);
179 unsigned int nUnmatchedMonitoredTracks(0);
184 LogDebug(
"TrackToTrackComparisonHists") <<
"\n# of tracks (reference): " << referenceTracks.size() <<
"\n";
185 for (idx2idxByDoubleColl::const_iterator pItr = reference2monitoredColl.begin(), eItr = reference2monitoredColl.end();
189 int trackIdx = pItr->first;
198 std::map<double, int> trackDRmap = pItr->second;
199 if (trackDRmap.empty()) {
205 double dRmin = trackDRmap.begin()->first;
214 nMatchedReferenceTracks++;
219 int matchedTrackIndex = trackDRmap[
dRmin];
220 reco::Track matchedTrack = monitoredTracks.at(matchedTrackIndex);
229 LogDebug(
"TrackToTrackComparisonHists") <<
"\n# of tracks (monitored): " << monitoredTracks.size() <<
"\n";
230 for (idx2idxByDoubleColl::const_iterator pItr = monitored2referenceColl.begin(), eItr = monitored2referenceColl.end();
234 int trackIdx = pItr->first;
243 std::map<double, int> trackDRmap = pItr->second;
244 if (trackDRmap.empty()) {
250 double dRmin = trackDRmap.begin()->first;
259 nUnmatchedMonitoredTracks++;
269 <<
"Total reference tracks: " << nReferenceTracks <<
"\n" 270 <<
"Total matched reference tracks: " << nMatchedReferenceTracks <<
"\n" 271 <<
"Total monitored tracks: " << nMonitoredTracks <<
"\n" 272 <<
"Total unMatched monitored tracks: " << nUnmatchedMonitoredTracks <<
"\n";
306 desc.add<
bool>(
"requireValidHLTPaths",
true);
318 desc.add<
std::string>(
"topDirName",
"HLT/Tracking/ValidationWRTOffline");
319 desc.add<
double>(
"dRmin", 0.002);
321 desc.add<
double>(
"pTCutForPlateau", 0.9);
322 desc.add<
double>(
"dxyCutForPlateau", 2.5);
323 desc.add<
double>(
"dzWRTPvCut", 1e6);
333 descriptions.
add(
"trackToTrackComparisonHists",
desc);
344 for (
const auto& track1 : tracks1) {
345 std::map<double, int>
tmp;
347 float smallest_dR = 1e9;
348 int smallest_dR_j = -1;
353 for (
const auto& track2 : tracks2) {
354 double dR =
reco::deltaR(track1.eta(), track1.phi(), track2.eta(), track2.phi());
356 if (
dR < smallest_dR) {
372 tmp[smallest_dR] = smallest_dR_j;
374 map.push_back(std::make_pair(
i,
tmp));
403 (mes.
h_hits) = ibooker.
book1D(
label +
"_hits",
"track number of hits", 35, -0.5, 34.5);
408 "track p_{T} vs #eta",
420 "number of tracks vs onlinelumi",
436 label +
"_hits_vs_hits",
"monitored track # hits vs reference track # hits", 35, -0.5, 34.5, 35, -0.5, 34.5);
438 "monitored track p_{T} vs reference track p_{T}",
446 "monitored track #eta vs reference track #eta",
454 "monitored track #phi vs reference track #phi",
470 "#Delta track transverse dca to primary vertex ",
475 "#Delta track longitudinal dca to primary vertex",
480 (mes.
h_dHits) = ibooker.
book1D(
label +
"_dHits",
"#Delta track number of hits", 39, -19.5, 19.5);
490 bool requirePlateau) {
491 float pt = trk->
pt();
494 float dxy = trk->
dxy(
bs->position());
495 float dz = trk->
dz(
bs->position());
496 float dxyWRTpv = trk->
dxy(
pv->position());
497 float dzWRTpv = trk->
dz(
pv->position());
504 if (dxyOnPlateau || !requirePlateau) {
508 if ((pTOnPlateau && dxyOnPlateau) || !requirePlateau) {
520 if (pTOnPlateau || !requirePlateau) {
530 float mon_pt =
mon->pt();
531 float mon_eta =
mon->eta();
532 float mon_phi =
mon->phi();
533 float mon_dxy =
mon->dxy(
bs->position());
534 float mon_dz =
mon->dz(
bs->position());
535 float mon_dxyWRTpv =
mon->dxy(
pv->position());
536 float mon_dzWRTpv =
mon->dz(
pv->position());
537 float mon_charge =
mon->charge();
538 float mon_nhits =
mon->hitPattern().numberOfValidHits();
540 float ref_pt = ref->
pt();
541 float ref_eta = ref->
eta();
542 float ref_phi = ref->
phi();
543 float ref_dxy = ref->
dxy(
bs->position());
544 float ref_dz = ref->
dz(
bs->position());
545 float ref_dxyWRTpv = ref->
dxy(
pv->position());
546 float ref_dzWRTpv = ref->
dz(
pv->position());
547 float ref_charge = ref->
charge();
575 Pt_nbin =
pset.getParameter<
unsigned int>(
"Pt_nbin");
587 Dz_nbin =
pset.getParameter<
unsigned int>(
"Dz_nbin");
611 ls_nbin =
pset.getParameter<
unsigned int>(
"ls_nbin");
619 PU_nbin =
pset.getParameter<
unsigned int>(
"PU_nbin");
623 pset.add<
double>(
"Eta_rangeMin", -2.5);
624 pset.add<
double>(
"Eta_rangeMax", 2.5);
625 pset.add<
unsigned int>(
"Eta_nbin", 50);
627 pset.add<
double>(
"Pt_rangeMin", 0.1);
628 pset.add<
double>(
"Pt_rangeMax", 100.0);
629 pset.add<
unsigned int>(
"Pt_nbin", 1000);
631 pset.add<
double>(
"Phi_rangeMin", -3.1416);
632 pset.add<
double>(
"Phi_rangeMax", 3.1416);
633 pset.add<
unsigned int>(
"Phi_nbin", 36);
635 pset.add<
double>(
"Dxy_rangeMin", -1.0);
636 pset.add<
double>(
"Dxy_rangeMax", 1.0);
637 pset.add<
unsigned int>(
"Dxy_nbin", 300);
639 pset.add<
double>(
"Dz_rangeMin", -30.0);
640 pset.add<
double>(
"Dz_rangeMax", 30.0);
641 pset.add<
unsigned int>(
"Dz_nbin", 60);
643 pset.add<
double>(
"ptRes_rangeMin", -0.1);
644 pset.add<
double>(
"ptRes_rangeMax", 0.1);
645 pset.add<
unsigned int>(
"ptRes_nbin", 100);
647 pset.add<
double>(
"phiRes_rangeMin", -0.01);
648 pset.add<
double>(
"phiRes_rangeMax", 0.01);
649 pset.add<
unsigned int>(
"phiRes_nbin", 300);
651 pset.add<
double>(
"etaRes_rangeMin", -0.01);
652 pset.add<
double>(
"etaRes_rangeMax", 0.01);
653 pset.add<
unsigned int>(
"etaRes_nbin", 300);
655 pset.add<
double>(
"dxyRes_rangeMin", -0.05);
656 pset.add<
double>(
"dxyRes_rangeMax", 0.05);
657 pset.add<
unsigned int>(
"dxyRes_nbin", 500);
659 pset.add<
double>(
"dzRes_rangeMin", -0.05);
660 pset.add<
double>(
"dzRes_rangeMax", 0.05);
661 pset.add<
unsigned int>(
"dzRes_nbin", 150);
663 pset.add<
unsigned int>(
"ls_rangeMin", 0);
664 pset.add<
unsigned int>(
"ls_rangeMax", 3000);
665 pset.add<
unsigned int>(
"ls_nbin", 300);
667 pset.add<
double>(
"onlinelumi_rangeMin", 0.0);
668 pset.add<
double>(
"onlinelumi_rangeMax", 20000.0);
669 pset.add<
unsigned int>(
"onlinelumi_nbin", 200);
671 pset.add<
double>(
"PU_rangeMin", 0.0);
672 pset.add<
double>(
"PU_rangeMax", 120.0);
673 pset.add<
unsigned int>(
"PU_nbin", 120);
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
double onlinelumi_rangeMin
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
double onlinelumi_rangeMax
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)
MonitorElement * h_pt_vs_eta
edm::EDGetTokenT< OnlineLuminosityRecord > onlineMetaDataDigisToken_
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)
unsigned int onlinelumi_nbin
std::vector< std::pair< int, std::map< double, int > > > idx2idxByDoubleColl
MonitorElement * h_dDxyWRTpv
void fill_generic_tracks_histos(generalME &mes, reco::Track *trk, reco::BeamSpot *bs, reco::Vertex *pv, unsigned int ls, double onlinelumi, double PU, bool requirePlateau=true)
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
edm::EDGetTokenT< LumiScalersCollection > lumiScalersToken_
MonitorElement * h_dCharge
MonitorElement * h_onlinelumi
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 &)