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()) {
114 if (!referenceBSHandle.
isValid()) {
115 edm::LogError(
"TrackToTrackComparisonHists") <<
"referenceBSHandle not found, skipping event";
122 if (!referencePVHandle.
isValid()) {
123 edm::LogError(
"TrackToTrackComparisonHists") <<
"referencePVHandle not found, skipping event";
126 if (referencePVHandle->empty()) {
127 edm::LogInfo(
"TrackToTrackComparisonHists") <<
"referencePVHandle->size is 0 ";
137 if (!monitoredTracksHandle.
isValid()) {
146 if (!monitoredTracksHandle.
isValid()) {
147 edm::LogError(
"TrackToTrackComparisonHists") <<
"monitoredBSHandle not found, skipping event";
154 if (!monitoredPVHandle.
isValid()) {
155 edm::LogError(
"TrackToTrackComparisonHists") <<
"monitoredPVHandle not found, skipping event";
158 if (monitoredPVHandle->empty()) {
159 edm::LogInfo(
"TrackToTrackComparisonHists") <<
"monitoredPVHandle->size is 0 ";
173 fillMap(monitoredTracks, referenceTracks, monitored2referenceColl,
dRmin_);
176 fillMap(referenceTracks, monitoredTracks, reference2monitoredColl,
dRmin_);
178 unsigned int nReferenceTracks(0);
179 unsigned int nMatchedReferenceTracks(0);
180 unsigned int nMonitoredTracks(0);
181 unsigned int nUnmatchedMonitoredTracks(0);
186 LogDebug(
"TrackToTrackComparisonHists") <<
"\n# of tracks (reference): " << referenceTracks.
size() <<
"\n";
187 for (idx2idxByDoubleColl::const_iterator pItr = reference2monitoredColl.begin(), eItr = reference2monitoredColl.end();
191 int trackIdx = pItr->first;
200 std::map<double, int> trackDRmap = pItr->second;
201 if (trackDRmap.empty()) {
207 double dRmin = trackDRmap.begin()->first;
216 nMatchedReferenceTracks++;
221 int matchedTrackIndex = trackDRmap[
dRmin];
222 reco::Track matchedTrack = monitoredTracks.
at(matchedTrackIndex);
231 LogDebug(
"TrackToTrackComparisonHists") <<
"\n# of tracks (monitored): " << monitoredTracks.
size() <<
"\n";
232 for (idx2idxByDoubleColl::const_iterator pItr = monitored2referenceColl.begin(), eItr = monitored2referenceColl.end();
236 int trackIdx = pItr->first;
245 std::map<double, int> trackDRmap = pItr->second;
246 if (trackDRmap.empty()) {
252 double dRmin = trackDRmap.begin()->first;
261 nUnmatchedMonitoredTracks++;
271 <<
"Total reference tracks: " << nReferenceTracks <<
"\n" 272 <<
"Total matched reference tracks: " << nMatchedReferenceTracks <<
"\n" 273 <<
"Total monitored tracks: " << nMonitoredTracks <<
"\n" 274 <<
"Total unMatched monitored tracks: " << nUnmatchedMonitoredTracks <<
"\n";
308 desc.add<
bool>(
"requireValidHLTPaths",
true);
320 desc.add<
std::string>(
"topDirName",
"HLT/Tracking/ValidationWRTOffline");
321 desc.add<
double>(
"dRmin", 0.002);
323 desc.add<
double>(
"pTCutForPlateau", 0.9);
324 desc.add<
double>(
"dxyCutForPlateau", 2.5);
325 desc.add<
double>(
"dzWRTPvCut", 1e6);
335 descriptions.
add(
"trackToTrackComparisonHists",
desc);
346 for (
const auto& track1 : tracks1) {
347 std::map<double, int>
tmp;
349 float smallest_dR = 1e9;
350 int smallest_dR_j = -1;
355 for (
const auto& track2 : tracks2) {
356 double dR =
reco::deltaR(track1.eta(), track1.phi(), track2.eta(), track2.phi());
358 if (
dR < smallest_dR) {
374 tmp[smallest_dR] = smallest_dR_j;
376 map.push_back(std::make_pair(
i,
tmp));
405 (mes.
h_hits) = ibooker.
book1D(
label +
"_hits",
"track number of hits", 35, -0.5, 34.5);
410 "track p_{T} vs #eta",
422 "number of tracks vs onlinelumi",
438 label +
"_hits_vs_hits",
"monitored track # hits vs reference track # hits", 35, -0.5, 34.5, 35, -0.5, 34.5);
440 "monitored track p_{T} vs reference track p_{T}",
448 "monitored track #eta vs reference track #eta",
456 "monitored track #phi vs reference track #phi",
472 "#Delta track transverse dca to primary vertex ",
477 "#Delta track longitudinal dca to primary vertex",
482 (mes.
h_dHits) = ibooker.
book1D(
label +
"_dHits",
"#Delta track number of hits", 39, -19.5, 19.5);
492 bool requirePlateau) {
493 float pt = trk->
pt();
496 float dxy = trk->
dxy(
bs->position());
497 float dz = trk->
dz(
bs->position());
498 float dxyWRTpv = trk->
dxy(
pv->position());
499 float dzWRTpv = trk->
dz(
pv->position());
506 if (dxyOnPlateau || !requirePlateau) {
510 if ((pTOnPlateau && dxyOnPlateau) || !requirePlateau) {
522 if (pTOnPlateau || !requirePlateau) {
532 float mon_pt =
mon->pt();
533 float mon_eta =
mon->eta();
534 float mon_phi =
mon->phi();
535 float mon_dxy =
mon->dxy(
bs->position());
536 float mon_dz =
mon->dz(
bs->position());
537 float mon_dxyWRTpv =
mon->dxy(
pv->position());
538 float mon_dzWRTpv =
mon->dz(
pv->position());
539 float mon_charge =
mon->charge();
540 float mon_nhits =
mon->hitPattern().numberOfValidHits();
542 float ref_pt = ref->
pt();
543 float ref_eta = ref->
eta();
544 float ref_phi = ref->
phi();
545 float ref_dxy = ref->
dxy(
bs->position());
546 float ref_dz = ref->
dz(
bs->position());
547 float ref_dxyWRTpv = ref->
dxy(
pv->position());
548 float ref_dzWRTpv = ref->
dz(
pv->position());
549 float ref_charge = ref->
charge();
577 Pt_nbin =
pset.getParameter<
unsigned int>(
"Pt_nbin");
589 Dz_nbin =
pset.getParameter<
unsigned int>(
"Dz_nbin");
613 ls_nbin =
pset.getParameter<
unsigned int>(
"ls_nbin");
621 PU_nbin =
pset.getParameter<
unsigned int>(
"PU_nbin");
625 pset.add<
double>(
"Eta_rangeMin", -2.5);
626 pset.add<
double>(
"Eta_rangeMax", 2.5);
627 pset.add<
unsigned int>(
"Eta_nbin", 50);
629 pset.add<
double>(
"Pt_rangeMin", 0.1);
630 pset.add<
double>(
"Pt_rangeMax", 100.0);
631 pset.add<
unsigned int>(
"Pt_nbin", 1000);
633 pset.add<
double>(
"Phi_rangeMin", -3.1416);
634 pset.add<
double>(
"Phi_rangeMax", 3.1416);
635 pset.add<
unsigned int>(
"Phi_nbin", 36);
637 pset.add<
double>(
"Dxy_rangeMin", -1.0);
638 pset.add<
double>(
"Dxy_rangeMax", 1.0);
639 pset.add<
unsigned int>(
"Dxy_nbin", 300);
641 pset.add<
double>(
"Dz_rangeMin", -30.0);
642 pset.add<
double>(
"Dz_rangeMax", 30.0);
643 pset.add<
unsigned int>(
"Dz_nbin", 60);
645 pset.add<
double>(
"ptRes_rangeMin", -0.1);
646 pset.add<
double>(
"ptRes_rangeMax", 0.1);
647 pset.add<
unsigned int>(
"ptRes_nbin", 100);
649 pset.add<
double>(
"phiRes_rangeMin", -0.01);
650 pset.add<
double>(
"phiRes_rangeMax", 0.01);
651 pset.add<
unsigned int>(
"phiRes_nbin", 300);
653 pset.add<
double>(
"etaRes_rangeMin", -0.01);
654 pset.add<
double>(
"etaRes_rangeMax", 0.01);
655 pset.add<
unsigned int>(
"etaRes_nbin", 300);
657 pset.add<
double>(
"dxyRes_rangeMin", -0.05);
658 pset.add<
double>(
"dxyRes_rangeMax", 0.05);
659 pset.add<
unsigned int>(
"dxyRes_nbin", 500);
661 pset.add<
double>(
"dzRes_rangeMin", -0.05);
662 pset.add<
double>(
"dzRes_rangeMax", 0.05);
663 pset.add<
unsigned int>(
"dzRes_nbin", 150);
665 pset.add<
unsigned int>(
"ls_rangeMin", 0);
666 pset.add<
unsigned int>(
"ls_rangeMax", 3000);
667 pset.add<
unsigned int>(
"ls_nbin", 300);
669 pset.add<
double>(
"onlinelumi_rangeMin", 0.0);
670 pset.add<
double>(
"onlinelumi_rangeMax", 20000.0);
671 pset.add<
unsigned int>(
"onlinelumi_nbin", 200);
673 pset.add<
double>(
"PU_rangeMin", 0.0);
674 pset.add<
double>(
"PU_rangeMax", 120.0);
675 pset.add<
unsigned int>(
"PU_nbin", 120);
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
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_
void fillMap(const edm::View< reco::Track > &tracks1, const edm::View< reco::Track > &tracks2, idx2idxByDoubleColl &map, float dRMin)
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
const_reference at(size_type pos) const
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_
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
edm::EDGetTokenT< edm::View< reco::Track > > referenceTrackToken_
generalME referenceTracksMEs_
edm::EDGetTokenT< edm::View< reco::Track > > monitoredTrackToken_
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 &)