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;
163 float dzWRTpv = track.
dz(referencePV.
position());
169 std::map<double, int> trackDRmap = pItr->second;
170 if (trackDRmap.empty()) {
176 double dRmin = trackDRmap.begin()->first;
180 bool matched =
false;
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;
208 float dzWRTpv = track.
dz(monitoredPV.
position());
214 std::map<double, int> trackDRmap = pItr->second;
215 if (trackDRmap.empty()) {
221 double dRmin = trackDRmap.begin()->first;
225 bool matched =
false;
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);
294 genericTriggerEventPSet.
add<
bool>(
"andOr",
false);
296 genericTriggerEventPSet.add<std::vector<int> >(
"dcsPartitions", {24, 25, 26, 27, 28, 29});
297 genericTriggerEventPSet.add<
bool>(
"andOrDcs",
false);
298 genericTriggerEventPSet.add<
bool>(
"errorReplyDcs",
true);
299 genericTriggerEventPSet.add<
std::string>(
"dbLabel",
"");
300 genericTriggerEventPSet.add<
bool>(
"andOrHlt",
true);
302 genericTriggerEventPSet.add<std::vector<std::string> >(
"hltPaths", {});
303 genericTriggerEventPSet.add<
std::string>(
"hltDBKey",
"");
304 genericTriggerEventPSet.add<
bool>(
"errorReplyHlt",
false);
305 genericTriggerEventPSet.add<
unsigned int>(
"verbosityLevel", 1);
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));
381 (mes.
h_charge) = ibooker.
book1D(label +
"_charge",
"track charge", 5, -2, 2);
382 (mes.
h_hits) = ibooker.
book1D(label +
"_hits",
"track number of hits", 35, -0.5, 34.5);
383 (mes.
h_dRmin) = ibooker.
book1D(label +
"_dRmin",
"track min dR", 100, 0., 0.01);
384 (mes.
h_dRmin_l) = ibooker.
book1D(label +
"_dRmin_l",
"track min dR", 100, 0., 0.4);
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",
447 (mes.
h_dCharge) = ibooker.
book1D(label +
"_dCharge",
"#Delta track charge", 5, -2.5, 2.5);
448 (mes.
h_dHits) = ibooker.
book1D(label +
"_dHits",
"#Delta track number of hits", 39, -19.5, 19.5);
453 float pt = trk->
pt();
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();
496 float mon_charge = mon->
charge();
499 float ref_pt = ref->
pt();
500 float ref_eta = ref->
eta();
501 float ref_phi = ref->
phi();
506 float ref_charge = ref->
charge();
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);
edm::EDGetTokenT< reco::TrackCollection > monitoredTrackToken_
generalME monitoredTracksMEs_
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_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * h_dDzWRTpv
MonitorElement * h_pt_vs_pt
int numberOfValidHits() const
edm::EDGetTokenT< reco::TrackCollection > referenceTrackToken_
std::vector< Track > TrackCollection
collection of Tracks
double phi() const
azimuthal angle of momentum vector
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
const Point & position() const
position
bool requireValidHLTPaths_
MonitorElement * h_phi_vs_phi
MonitorElement * h_charge
double eta() const
pseudorapidity of momentum vector
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)
double pt() const
track transverse momentum
MonitorElement * h_pt_vs_eta
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
matchingME matchTracksMEs_
static void fillHistoPSetDescription(edm::ParameterSetDescription &pset)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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())
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...
MonitorElement * h_dRmin_l
Log< level::Info, false > LogInfo
MonitorElement * h_dzWRTpv
MonitorElement * h_dCharge
void initialize_parameter(const edm::ParameterSet &iConfig)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
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
int charge() const
track electric charge
const Point & position() const
position
generalME referenceTracksMEs_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
void bookHistos(DQMStore::IBooker &ibooker, generalME &mes, TString label, std::string &dir)
MonitorElement * h_dxyWRTpv
~TrackToTrackComparisonHists() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TrackToTrackComparisonHists(const edm::ParameterSet &)