27 #include "TLorentzVector.h" 30 #include <fmt/printf.h> 49 #define CREATE_HIST_1D(varname, nbins, first, last, fs) fs.make<TH1D>(#varname, #varname, nbins, first, last) 51 #define CREATE_HIST_2D(varname, nbins, first, last, fs) \ 52 fs.make<TH2D>(#varname, #varname, nbins, first, last, nbins, first, last) 119 if (
hit.dimension() < 2) {
127 if (dynamic_cast<const SiStripRecHit2D *>(&
hit))
129 else if (dynamic_cast<const SiStripMatchedRecHit2D *>(&
hit))
131 else if (dynamic_cast<const ProjectedSiStripRecHit2D *>(&
hit))
134 edm::LogError(
"UnknownType") <<
"@SUB=CalibrationTrackSelector::isHit2D" 135 <<
"Tracker hit not in pixel and neither SiStripRecHit2D nor " 136 <<
"SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
141 edm::LogWarning(
"DetectorMismatch") <<
"@SUB=CalibrationTrackSelector::isHit2D" 142 <<
"Hit not in tracker with 'official' dimension >=2.";
151 unsigned int nHit2D = 0;
152 for (
auto iHit =
track.recHitsBegin(); iHit !=
track.recHitsEnd(); ++iHit) {
181 h_nhpxb->Fill(
track.hitPattern().numberOfValidPixelBarrelHits());
182 h_nhpxe->Fill(
track.hitPattern().numberOfValidPixelEndcapHits());
183 h_nhTIB->Fill(
track.hitPattern().numberOfValidStripTIBHits());
184 h_nhTID->Fill(
track.hitPattern().numberOfValidStripTIDHits());
185 h_nhTOB->Fill(
track.hitPattern().numberOfValidStripTOBHits());
186 h_nhTEC->Fill(
track.hitPattern().numberOfValidStripTECHits());
269 h2_P->Fill(tk1.
p(), tk2.
p());
319 template <
typename T,
typename... Args>
363 : folderName_(ps.getUntrackedParameter<
std::
string>(
"folderName",
"TrackRefitting")),
365 minTracksEta_(ps.getUntrackedParameter<double>(
"minTracksEtaInput", 0.0)),
366 maxTracksEta_(ps.getUntrackedParameter<double>(
"maxTracksEtaInput", 2.2)),
367 minTracksPt_(ps.getUntrackedParameter<double>(
"minTracksPtInput", 15.0)),
368 maxTracksPt_(ps.getUntrackedParameter<double>(
"maxTracksPtInput", 99999.9)),
369 maxDr_(ps.getUntrackedParameter<double>(
"maxDrInput", 0.01)),
370 tracksTag_(ps.getUntrackedParameter<
edm::
InputTag>(
"tracksInputTag",
edm::
InputTag(
"generalTracks",
"",
"DQM"))),
373 VerticesTag_(ps.getUntrackedParameter<
edm::
InputTag>(
"VerticesTag",
edm::
InputTag(
"offlinePrimaryVertices"))),
374 tracksToken_(consumes<
std::
vector<
reco::Track>>(tracksTag_)),
377 beamspotToken_(consumes<reco::BeamSpot>(BeamSpotTag_)),
378 vertexToken_(consumes<reco::VertexCollection>(VerticesTag_)) {
380 histsPtRatioAll_.clear();
381 histsPtDiffAll_.clear();
382 histsEtaDiffAll_.clear();
383 histsPhiDiffAll_.clear();
384 histsPtRatioVsDeltaRAll_.clear();
385 histsDeltaPtOverPtAll_.clear();
387 histsNhitsAll_.clear();
388 histsDeltaRAll_.clear();
389 comparators_.clear();
391 comparators_.reserve(hitsRemain_.size());
392 for (
unsigned int i = 0;
i < hitsRemain_.size(); ++
i) {
393 comparators_.push_back(
new trackComparator());
398 template <
typename T,
typename... Args>
413 book<TH1F>(ShortTrackResolution,
414 fmt::sprintf(
"trackPtRatio_%s",
hitsRemain_[
i]).c_str(),
415 fmt::sprintf(
"Short Track p_{T} / Full Track p_{T} - %s layers;p_{T}^{short}/p_{T}^{full};n. tracks",
423 ShortTrackResolution,
425 fmt::sprintf(
"Short Track p_{T} - Full Track p_{T} - %s layers;p_{T}^{short} - p_{T}^{full} [GeV];n. tracks",
433 book<TH1F>(ShortTrackResolution,
434 fmt::sprintf(
"trackEtaDiff_%s",
hitsRemain_[
i]).c_str(),
435 fmt::sprintf(
"Short Track #eta - Full Track #eta - %s layers;#eta^{short} - #eta^{full};n. tracks",
443 book<TH1F>(ShortTrackResolution,
444 fmt::sprintf(
"trackPhiDiff_%s",
hitsRemain_[
i]).c_str(),
445 fmt::sprintf(
"Short Track #phi - Full Track #phi - %s layers;#phi^{short} - #phi^{full};n. tracks",
453 book<TH2F>(ShortTrackResolution,
454 fmt::sprintf(
"trackPtRatioVsDeltaR_%s",
hitsRemain_[
i]).c_str(),
455 fmt::sprintf(
"Short Track p_{T} / Full Track p_{T} - %s layers vs " 456 "#DeltaR;#DeltaR(short,full);p_{T}^{short}/p_{T}^{full} [GeV];n. tracks",
467 book<TH1F>(ShortTrackResolution,
468 fmt::sprintf(
"trackDeltaPtOverPt_%s",
hitsRemain_[
i]).c_str(),
469 fmt::sprintf(
"Short Track p_{T} - Full Track p_{T} / Full Track p_{T} - %s layers;p_{T}^{short} - " 470 "p_{T}^{full} / p^{full}_{T};n. tracks",
478 book<TH1F>(TrackQuals,
480 fmt::sprintf(
"Short Track p_{T} - %s layers;p_{T}^{short} [GeV];n. tracks",
hitsRemain_[
i]).c_str(),
486 book<TH1F>(TrackQuals,
488 fmt::sprintf(
"Short Track n. hits - %s layers; n. hits per track;n. tracks",
hitsRemain_[
i]).c_str(),
496 fmt::sprintf(
"Short Track / Long Track #DeltaR %s layers;#DeltaR(short,long);n. tracks",
hitsRemain_[
i]).c_str(),
521 if (beamSpotHandle.
isValid()) {
530 pvtx = (*vertexHandle).at(0);
551 const auto &tracks_rereco =
iEvent.getHandle(
token);
553 for (
const auto &track_rereco : *tracks_rereco) {
554 TLorentzVector trerecovec;
555 trerecovec.SetPtEtaPhiM(track_rereco.pt(), track_rereco.eta(), track_rereco.phi(), 0.0);
556 double deltaR = tvec.DeltaR(trerecovec);
585 desc.addUntracked<std::vector<std::string>>(
"hitsRemainInput", {});
586 desc.addUntracked<
double>(
"minTracksEtaInput", 0.0);
587 desc.addUntracked<
double>(
"maxTracksEtaInput", 2.2);
588 desc.addUntracked<
double>(
"minTracksPtInput", 15.0);
589 desc.addUntracked<
double>(
"maxTracksPtInput", 99999.9);
590 desc.addUntracked<
double>(
"maxDrInput", 0.01);
592 desc.addUntracked<std::vector<edm::InputTag>>(
"tracksRerecoInputTag", {});
static const std::string kSharedResource
double qoverp() const
q / p
const edm::InputTag VerticesTag_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void fill(const reco::Track &tk1, const reco::Track &tk2)
int trackQual(const reco::Track &track)
~trackComparator()=default
double z() const
z coordinate
ShortenedTrackValidation(const edm::ParameterSet &)
unsigned short numberOfValidHits() const
number of valid hits found
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double vx() const
x coordinate of the reference point on track
const std::vector< std::string > hitsRemain_
edm::Service< TFileService > fs_
double p() const
momentum vector magnitude
T * book(const TFileDirectory &dir, const Args &...args) const
std::vector< TH1F * > histsNhitsAll_
void book(const TFileDirectory &fs)
int numberOfValidStripTIBHits() const
int numberOfValidStripTECHits() const
trackingMon originalTrack
Log< level::Error, false > LogError
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
std::vector< TH1F * > histsDeltaPtOverPtAll_
const edm::InputTag tracksTag_
std::vector< TH1F * > histsPhiDiffAll_
static constexpr double muMass
double pt() const
track transverse momentum
TrackAlgorithm originalAlgo() const
std::vector< TH1F * > histsPtRatioAll_
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...
const double minTracksPt_
double vz() const
z coordinate of the reference point on track
int numberOfValidPixelEndcapHits() const
Abs< T >::type abs(const T &t)
int numberOfValidStripTIDHits() const
double phi() const
azimuthal angle of momentum vector
#define DEFINE_FWK_MODULE(type)
std::vector< TH2F * > histsPtRatioVsDeltaRAll_
double x() const
x coordinate
const edm::EDGetTokenT< std::vector< reco::Track > > tracksToken_
double y() const
y coordinate
const double maxTracksEta_
unsigned int count2DHits(const reco::Track &track)
std::vector< TH1F * > histsDeltaRAll_
Log< level::Info, false > LogInfo
double eta() const
pseudorapidity of momentum vector
TrackAlgorithm algo() const
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
const double maxTracksPt_
XYZPointD XYZPoint
point in space with cartesian internal representation
const std::vector< edm::InputTag > tracksRerecoTag_
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
~ShortenedTrackValidation() override=default
#define CREATE_HIST_1D(varname, nbins, first, last, fs)
std::vector< trackComparator * > comparators_
std::vector< TH1F * > histsEtaDiffAll_
const double minTracksEta_
double vy() const
y coordinate of the reference point on track
std::vector< TH1F * > histsPtAll_
int numberOfValidPixelBarrelHits() const
const edm::EDGetTokenT< reco::BeamSpot > beamspotToken_
#define CREATE_HIST_2D(varname, nbins, first, last, fs)
Log< level::Warning, false > LogWarning
const std::vector< edm::EDGetTokenT< std::vector< reco::Track > > > tracksRerecoToken_
const std::string folderName_
const edm::InputTag BeamSpotTag_
const edm::EDGetTokenT< reco::VertexCollection > vertexToken_
void book(const TFileDirectory &fs)
std::vector< TH1F * > histsPtDiffAll_
int numberOfValidStripTOBHits() const
static bool isHit2D(const TrackingRecHit &hit)
void fill(const reco::Track &track, const reco::BeamSpot &beamSpot, const reco::Vertex &pvtx)