38 #include "HepMC/GenRanges.h" 39 #include "CLHEP/Units/PhysicalConstants.h" 67 static constexpr
double pTcut_ = 0.7;
137 trackMinPt_(iConfig.getParameter<double>(
"trackMinimumPt")),
138 trackMaxBtlEta_(iConfig.getParameter<double>(
"trackMaximumBtlEta")),
139 trackMinEtlEta_(iConfig.getParameter<double>(
"trackMinimumEtlEta")),
140 trackMaxEtlEta_(iConfig.getParameter<double>(
"trackMaximumEtlEta")) {
169 const MTDTopology* topology = topologyHandle.product();
171 bool topo1Dis =
false;
172 bool topo2Dis =
false;
195 unsigned int index = 0;
197 for (
const auto& trackGen : *GenRecTrackHandle) {
201 if (trackAssoc[trackref] == -1) {
202 LogInfo(
"mtdTracks") <<
"Extended track not associated";
213 if (std::round(SigmatMtd[trackref] - Sigmat0Pid[trackref]) != 0) {
214 LogWarning(
"mtdTracks") <<
"TimeError associated to refitted track is different from TimeError stored in tofPID " 215 "sigmat0 ValueMap: this should not happen";
236 int numMTDBtlvalidhits = 0;
237 for (
const auto hit :
track.recHits()) {
238 if (
hit->isValid() ==
false)
241 if ((
Hit.det() == 6) && (
Hit.subdetId() == 1) && (
Hit.mtdSubDetector() == 1)) {
243 numMTDBtlvalidhits++;
249 if (MTDBtl ==
true) {
272 bool MTDEtlZnegD1 =
false;
273 bool MTDEtlZnegD2 =
false;
274 bool MTDEtlZposD1 =
false;
275 bool MTDEtlZposD2 =
false;
276 int numMTDEtlvalidhits = 0;
277 for (
const auto hit :
track.recHits()) {
278 if (
hit->isValid() ==
false)
281 if ((
Hit.det() == 6) && (
Hit.subdetId() == 1) && (
Hit.mtdSubDetector() == 2)) {
285 if ((ETLHit.
zside() == -1) && (ETLHit.
nDisc() == 1)) {
289 numMTDEtlvalidhits++;
291 if ((ETLHit.
zside() == -1) && (ETLHit.
nDisc() == 2)) {
295 numMTDEtlvalidhits++;
297 if ((ETLHit.
zside() == 1) && (ETLHit.
nDisc() == 1)) {
301 numMTDEtlvalidhits++;
303 if ((ETLHit.
zside() == 1) && (ETLHit.
nDisc() == 2)) {
307 numMTDEtlvalidhits++;
312 if (ETLHit.
zside() == -1) {
315 numMTDEtlvalidhits++;
317 if (ETLHit.
zside() == 1) {
320 numMTDEtlvalidhits++;
329 if ((MTDEtlZnegD1 ==
true) || (MTDEtlZnegD2 ==
true)) {
336 if ((MTDEtlZposD1 ==
true) || (MTDEtlZposD2 ==
true)) {
345 const auto& primRecoVtx = *(RecVertexHandle.product()->begin());
350 double zsim =
convertMmToCm((*(
mc->vertices_begin()))->position().z());
351 double tsim = (*(
mc->vertices_begin()))->position().t() * CLHEP::mm / CLHEP::c_light;
359 for (
const auto& trackGen : *GenRecTrackHandle) {
365 if (trackAssoc[trackref] == -1) {
372 if (
mvaRecSel(trackGen, primRecoVtx, t0Safe[trackref], Sigmat0Safe[trackref])) {
378 double dZ = trackGen.vz() - zsim;
380 double pullT(-9999.);
381 if (Sigmat0Safe[trackref] != -1.) {
382 dT = t0Safe[trackref] - tsim;
383 pullT = dT / Sigmat0Safe[trackref];
385 for (
const auto& genP :
mc->particle_range()) {
398 if (pullT > -9999.) {
423 ibook.
book1D(
"TrackBTLEffPhiTot",
"Track efficiency vs phi (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2);
427 ibook.
book1D(
"TrackBTLEffPhiMtd",
"Track efficiency vs phi (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2);
430 ibook.
book1D(
"TrackBTLPtRes",
"Track pT resolution ;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
433 ibook.
book1D(
"TrackETLEffEtaTotZneg",
"Track efficiency vs eta (Tot) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
435 ibook.
book1D(
"TrackETLEffEtaTotZpos",
"Track efficiency vs eta (Tot) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
437 ibook.
book1D(
"TrackETLEffPhiTotZneg",
"Track efficiency vs phi (Tot) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
439 ibook.
book1D(
"TrackETLEffPhiTotZpos",
"Track efficiency vs phi (Tot) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
441 ibook.
book1D(
"TrackETLEffPtTotZneg",
"Track efficiency vs pt (Tot) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
443 ibook.
book1D(
"TrackETLEffPtTotZpos",
"Track efficiency vs pt (Tot) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
445 ibook.
book1D(
"TrackETLEffEtaMtdZneg",
"Track efficiency vs eta (Mtd) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
447 ibook.
book1D(
"TrackETLEffEtaMtdZpos",
"Track efficiency vs eta (Mtd) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
449 ibook.
book1D(
"TrackETLEffPhiMtdZneg",
"Track efficiency vs phi (Mtd) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
451 ibook.
book1D(
"TrackETLEffPhiMtdZpos",
"Track efficiency vs phi (Mtd) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
453 ibook.
book1D(
"TrackETLEffPtMtdZneg",
"Track efficiency vs pt (Mtd) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
455 ibook.
book1D(
"TrackETLEffPtMtdZpos",
"Track efficiency vs pt (Mtd) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
457 ibook.
book1D(
"TrackETLPtRes",
"Track pT resolution;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
459 meTracktmtd_ = ibook.
book1D(
"Tracktmtd",
"Track time from TrackExtenderWithMTD;tmtd [ns]", 150, 1, 16);
460 meTrackt0Src_ = ibook.
book1D(
"Trackt0Src",
"Track time from TrackExtenderWithMTD;t0Src [ns]", 100, -1.5, 1.5);
462 ibook.
book1D(
"TrackSigmat0Src",
"Time Error from TrackExtenderWithMTD; #sigma_{t0Src} [ns]", 100, 0, 0.1);
464 meTrackt0Pid_ = ibook.
book1D(
"Trackt0Pid",
"Track t0 as stored in TofPid;t0 [ns]", 100, -1, 1);
468 ibook.
book1D(
"TrackSigmat0SafePID",
"Sigmat0 Safe as stored in TofPid; #sigma_{t0} [ns]", 100, 0, 0.1);
469 meTrackNumHits_ = ibook.
book1D(
"TrackNumHits",
"Number of valid MTD hits per track ; Number of hits", 10, -5, 5);
470 meTrackMVAQual_ = ibook.
book1D(
"TrackMVAQual",
"Track MVA Quality as stored in Value Map ; MVAQual", 100, 0, 1);
472 "TrackPathLenghtvsEta",
"MTD Track pathlength vs MTD track Eta;|#eta|;Pathlength", 100, 0, 3.2, 100.0, 400.0,
"S");
475 ibook.
book1D(
"MVAMatchedEffPtTot",
"Pt of tracks associated to LV matched to GEN; track pt [GeV] ", 110, 0., 11.);
477 "MVAMatchedEffPtMtd",
"Pt of tracks associated to LV matched to GEN with time; track pt [GeV] ", 110, 0., 11.);
480 ibook.
book1D(
"MVAMatchedEffEtaTot",
"Pt of tracks associated to LV matched to GEN; track eta ", 66, 0., 3.3);
482 "MVAMatchedEffEtaMtd",
"Pt of tracks associated to LV matched to GEN with time; track eta ", 66, 0., 3.3);
484 "MVATrackRes",
"t_{rec} - t_{sim} for LV associated tracks; t_{rec} - t_{sim} [ns] ", 120, -0.15, 0.15);
486 ibook.
book1D(
"MVATrackPull",
"Pull for associated tracks; (t_{rec}-t_{sim})/#sigma_{t}", 50, -5., 5.);
488 "MVATrackZposResTot",
"Z_{PCA} - Z_{sim} for associated tracks;Z_{PCA} - Z_{sim} [cm] ", 100, -0.1, 0.1);
506 ->setComment(
"Association between General and MTD Extended tracks");
513 desc.add<
double>(
"trackMinimumPt", 0.7);
514 desc.add<
double>(
"trackMaximumBtlEta", 1.5);
515 desc.add<
double>(
"trackMinimumEtlEta", 1.6);
516 desc.add<
double>(
"trackMaximumEtlEta", 3.);
518 descriptions.
add(
"mtdTracksValid",
desc);
523 if (
gp.status() != 1) {
547 double genPT = genP.momentum().perp();
MonitorElement * meETLTrackEffEtaTot_[2]
edm::EDGetTokenT< edm::ValueMap< int > > trackAssocToken_
static constexpr double etacutGEN_
MonitorElement * meBTLTrackEffPhiMtd_
int getMTDTopologyMode() const
edm::EDGetTokenT< edm::ValueMap< float > > trackMVAQualToken_
edm::EDGetTokenT< edm::ValueMap< float > > pathLengthToken_
T getParameter(std::string const &) const
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 float trackMaxEtlEta_
const float trackMaxBtlEta_
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]
double pt() const
track transverse momentum
edm::EDGetTokenT< reco::TrackCollection > RecTrackToken_
MonitorElement * meBTLTrackEffPhiTot_
MonitorElement * meBTLTrackRPTime_
double vz() const
z coordinate of the reference point on track
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_
static constexpr double deltaZcut_
Abs< T >::type abs(const T &t)
MonitorElement * meMVATrackMatchedEffEtaTot_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::ValueMap< float > > t0PidToken_
MonitorElement * meTrackMVAQual_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
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 eta() const
pseudorapidity of momentum vector
const float trackMinEtlEta_
constexpr NumType convertMmToCm(NumType millimeters)
MonitorElement * meMVATrackPullTot_
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * meTrackSigmat0SafePid_
MonitorElement * meETLTrackEffEtaMtd_[2]
const Vector & momentum() const
track momentum vector
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
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
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_
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0SafePidToken_
MtdTracksValidation(const edm::ParameterSet &)
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > particleTableToken_