38 #include "HepMC/GenRanges.h"
39 #include "CLHEP/Units/PhysicalConstants.h"
66 static constexpr
double pTcut_ = 0.7;
136 trackMinPt_(iConfig.getParameter<double>(
"trackMinimumPt")),
137 trackMinEta_(iConfig.getParameter<double>(
"trackMinimumEta")),
138 trackMaxEta_(iConfig.getParameter<double>(
"trackMaximumEta")) {
163 using namespace geant_units::operators;
167 const MTDTopology* topology = topologyHandle.product();
169 bool topo1Dis =
false;
170 bool topo2Dis =
false;
193 unsigned int index = 0;
195 for (
const auto& trackGen : *GenRecTrackHandle) {
199 if (trackAssoc[trackref] == -1) {
200 LogInfo(
"mtdTracks") <<
"Extended track not associated";
211 if (std::round(SigmatMtd[trackref] - Sigmat0Pid[trackref]) != 0) {
212 LogWarning(
"mtdTracks") <<
"TimeError associated to refitted track is different from TimeError stored in tofPID "
213 "sigmat0 ValueMap: this should not happen";
234 int numMTDBtlvalidhits = 0;
235 for (
const auto hit : track.recHits()) {
236 if (
hit->isValid() ==
false)
241 numMTDBtlvalidhits++;
247 if (MTDBtl ==
true) {
270 bool MTDEtlZnegD1 =
false;
271 bool MTDEtlZnegD2 =
false;
272 bool MTDEtlZposD1 =
false;
273 bool MTDEtlZposD2 =
false;
274 int numMTDEtlvalidhits = 0;
275 for (
const auto hit : track.recHits()) {
276 if (
hit->isValid() ==
false)
283 if ((ETLHit.
zside() == -1) && (ETLHit.
nDisc() == 1)) {
287 numMTDEtlvalidhits++;
289 if ((ETLHit.
zside() == -1) && (ETLHit.
nDisc() == 2)) {
293 numMTDEtlvalidhits++;
295 if ((ETLHit.
zside() == 1) && (ETLHit.
nDisc() == 1)) {
299 numMTDEtlvalidhits++;
301 if ((ETLHit.
zside() == 1) && (ETLHit.
nDisc() == 2)) {
305 numMTDEtlvalidhits++;
310 if (ETLHit.
zside() == -1) {
313 numMTDEtlvalidhits++;
315 if (ETLHit.
zside() == 1) {
318 numMTDEtlvalidhits++;
327 if ((MTDEtlZnegD1 ==
true) || (MTDEtlZnegD2 ==
true)) {
334 if ((MTDEtlZposD1 ==
true) || (MTDEtlZposD2 ==
true)) {
344 const auto& primRecoVtx = *(RecVertexHandle.product()->begin());
348 double zsim =
convertMmToCm((*(mc->vertices_begin()))->position().z());
349 double tsim = (*(mc->vertices_begin()))->position().t() * CLHEP::mm / CLHEP::c_light;
357 for (
const auto& trackGen : *GenRecTrackHandle) {
363 if (trackAssoc[trackref] == -1) {
367 if (
mvaRecSel(trackGen, primRecoVtx, t0Safe[trackref], Sigmat0Safe[trackref])) {
371 double dZ = trackGen.vz() - zsim;
373 double pullT(-9999.);
374 if (Sigmat0Safe[trackref] != -1.) {
375 dT = t0Safe[trackref] - tsim;
376 pullT = dT / Sigmat0Safe[trackref];
378 for (
const auto& genP : mc->particle_range()) {
381 float charge = pdTable->particle(HepPDT::ParticleID(genP->pdg_id())) !=
nullptr
382 ? pdTable->particle(HepPDT::ParticleID(genP->pdg_id()))->charge()
389 if (pullT > -9999.) {
412 ibook.
book1D(
"TrackBTLEffPhiTot",
"Track efficiency vs phi (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2);
416 ibook.
book1D(
"TrackBTLEffPhiMtd",
"Track efficiency vs phi (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2);
419 ibook.
book1D(
"TrackBTLPtRes",
"Track pT resolution ;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
422 ibook.
book1D(
"TrackETLEffEtaTotZneg",
"Track efficiency vs eta (Tot) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
424 ibook.
book1D(
"TrackETLEffEtaTotZpos",
"Track efficiency vs eta (Tot) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
426 ibook.
book1D(
"TrackETLEffPhiTotZneg",
"Track efficiency vs phi (Tot) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
428 ibook.
book1D(
"TrackETLEffPhiTotZpos",
"Track efficiency vs phi (Tot) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
430 ibook.
book1D(
"TrackETLEffPtTotZneg",
"Track efficiency vs pt (Tot) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
432 ibook.
book1D(
"TrackETLEffPtTotZpos",
"Track efficiency vs pt (Tot) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
434 ibook.
book1D(
"TrackETLEffEtaMtdZneg",
"Track efficiency vs eta (Mtd) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
436 ibook.
book1D(
"TrackETLEffEtaMtdZpos",
"Track efficiency vs eta (Mtd) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
438 ibook.
book1D(
"TrackETLEffPhiMtdZneg",
"Track efficiency vs phi (Mtd) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
440 ibook.
book1D(
"TrackETLEffPhiMtdZpos",
"Track efficiency vs phi (Mtd) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
442 ibook.
book1D(
"TrackETLEffPtMtdZneg",
"Track efficiency vs pt (Mtd) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
444 ibook.
book1D(
"TrackETLEffPtMtdZpos",
"Track efficiency vs pt (Mtd) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
446 ibook.
book1D(
"TrackETLPtRes",
"Track pT resolution;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
448 meTracktmtd_ = ibook.
book1D(
"Tracktmtd",
"Track time from TrackExtenderWithMTD;tmtd [ns]", 150, 1, 16);
449 meTrackt0Src_ = ibook.
book1D(
"Trackt0Src",
"Track time from TrackExtenderWithMTD;t0Src [ns]", 100, -1.5, 1.5);
451 ibook.
book1D(
"TrackSigmat0Src",
"Time Error from TrackExtenderWithMTD; #sigma_{t0Src} [ns]", 100, 0, 0.1);
453 meTrackt0Pid_ = ibook.
book1D(
"Trackt0Pid",
"Track t0 as stored in TofPid;t0 [ns]", 100, -1, 1);
457 ibook.
book1D(
"TrackSigmat0SafePID",
"Sigmat0 Safe as stored in TofPid; #sigma_{t0} [ns]", 100, 0, 0.1);
458 meTrackNumHits_ = ibook.
book1D(
"TrackNumHits",
"Number of valid MTD hits per track ; Number of hits", 10, -5, 5);
459 meTrackMVAQual_ = ibook.
book1D(
"TrackMVAQual",
"Track MVA Quality as stored in Value Map ; MVAQual", 100, 0, 1);
461 "TrackPathLenghtvsEta",
"MTD Track pathlength vs MTD track Eta;|#eta|;Pathlength", 100, 0, 3.2, 100.0, 400.0,
"S");
464 ibook.
book1D(
"MVAMatchedEffPtTot",
"Pt of tracks associated to LV matched to GEN; track pt [GeV] ", 110, 0., 11.);
466 "MVAMatchedEffPtMtd",
"Pt of tracks associated to LV matched to GEN with time; track pt [GeV] ", 110, 0., 11.);
469 ibook.
book1D(
"MVAMatchedEffEtaTot",
"Pt of tracks associated to LV matched to GEN; track eta ", 66, 0., 3.3);
471 "MVAMatchedEffEtaMtd",
"Pt of tracks associated to LV matched to GEN with time; track eta ", 66, 0., 3.3);
473 "MVATrackRes",
"t_{rec} - t_{sim} for LV associated tracks; t_{rec} - t_{sim} [ns] ", 120, -0.15, 0.15);
475 ibook.
book1D(
"MVATrackPull",
"Pull for associated tracks; (t_{rec}-t_{sim})/#sigma_{t}", 50, -5., 5.);
477 "MVATrackZposResTot",
"Z_{PCA} - Z_{sim} for associated tracks;Z_{PCA} - Z_{sim} [cm] ", 100, -0.1, 0.1);
495 ->setComment(
"Association between General and MTD Extended tracks");
502 desc.
add<
double>(
"trackMinimumPt", 1.0);
503 desc.
add<
double>(
"trackMinimumEta", 1.5);
504 desc.
add<
double>(
"trackMaximumEta", 3.2);
506 descriptions.
add(
"mtdTracks", desc);
511 if (gp.status() != 1) {
525 match = match &&
std::abs(t0 - vtx.
t()) < 3. * st0;
535 double genPT = genP.momentum().perp();
MonitorElement * meETLTrackEffEtaTot_[2]
edm::EDGetTokenT< edm::ValueMap< int > > trackAssocToken_
static constexpr double etacutGEN_
MonitorElement * meBTLTrackEffPhiMtd_
edm::EDGetTokenT< edm::ValueMap< float > > trackMVAQualToken_
edm::EDGetTokenT< edm::ValueMap< float > > pathLengthToken_
MonitorElement * meMVATrackResTot_
MonitorElement * meTrackNumHits_
MonitorElement * meTrackt0Pid_
static constexpr double pTcut_
MonitorElement * meETLTrackRPTime_
edm::EDGetTokenT< edm::ValueMap< float > > t0SafePidToken_
edm::EDGetTokenT< edm::ValueMap< float > > t0SrcToken_
edm::ESGetToken< MTDTopology, MTDTopologyRcd > mtdtopoToken_
virtual void setCurrentFolder(std::string const &fullpath)
const std::string folder_
edm::EDGetTokenT< edm::HepMCProduct > HepMCProductToken_
HepPDT::ParticleDataTable ParticleDataTable
MonitorElement * meMVATrackMatchedEffEtaMtd_
const bool mvaRecSel(const reco::TrackBase &, const reco::Vertex &, const double &, const double &)
#define DEFINE_FWK_MODULE(type)
static constexpr double etacutREC_
static constexpr double deltaPTcut_
MonitorElement * meBTLTrackPtRes_
edm::EDGetTokenT< std::vector< reco::Vertex > > RecVertexToken_
MonitorElement * meETLTrackEffPtTot_[2]
MonitorElement * meBTLTrackEffEtaMtd_
edm::EDGetTokenT< edm::ValueMap< float > > tmtdToken_
MonitorElement * meMVATrackMatchedEffPtTot_
MonitorElement * meMVATrackEffPtTot_
MonitorElement * meMVATrackEffEtaTot_
const Vector & momentum() const
track momentum vector
const bool mvaGenSel(const HepMC::GenParticle &, const float &)
Detector identifier base class for the MIP Timing Layer.
edm::EDGetTokenT< reco::TrackCollection > GenRecTrackToken_
MonitorElement * meETLTrackEffPhiMtd_[2]
edm::EDGetTokenT< reco::TrackCollection > RecTrackToken_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
MonitorElement * meBTLTrackEffPhiTot_
double eta() const
pseudorapidity of momentum vector
MonitorElement * meBTLTrackRPTime_
MonitorElement * meETLTrackPtRes_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
MonitorElement * meTrackt0SafePid_
MonitorElement * meBTLTrackEffEtaTot_
double pt() const
track transverse momentum
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
static constexpr double deltaZcut_
Abs< T >::type abs(const T &t)
double z() const
z coordinate
bool get(ProductID const &oid, Handle< PROD > &result) const
MonitorElement * meMVATrackMatchedEffEtaTot_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::ValueMap< float > > t0PidToken_
MonitorElement * meTrackMVAQual_
MonitorElement * meETLTrackEffPhiTot_[2]
edm::EDGetTokenT< edm::ValueMap< float > > SigmatmtdToken_
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Info, false > LogInfo
double vz() const
z coordinate of the reference point on track
MonitorElement * meMVATrackPullTot_
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * meTrackSigmat0SafePid_
MonitorElement * meETLTrackEffEtaMtd_[2]
MonitorElement * meTrackSigmat0Pid_
MonitorElement * meBTLTrackEffPtMtd_
MonitorElement * meTrackt0Src_
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0PidToken_
static constexpr double deltaDRcut_
MonitorElement * meTracktmtd_
MonitorElement * meBTLTrackEffPtTot_
MonitorElement * meTrackPathLenghtvsEta_
Detector identifier class for the Endcap Timing Layer.
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
int mtdSubDetector() const
constexpr NumType convertMmToCm(NumType millimeters)
const bool mvaGenRecMatch(const HepMC::GenParticle &, const double &, const reco::TrackBase &)
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0SrcToken_
MonitorElement * meETLTrackEffPtMtd_[2]
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
~MtdTracksValidation() override
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
MonitorElement * meMVATrackZposResTot_
Log< level::Warning, false > LogWarning
auto makeValid(const U &iOtherHandleType) noexcept(false)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * meMVATrackMatchedEffPtMtd_
MonitorElement * meTrackSigmat0Src_
double t() const
t coordinate
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0SafePidToken_
MtdTracksValidation(const edm::ParameterSet &)
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > particleTableToken_
constexpr Detector det() const
get the detector field from this detid