177 return clu1.
id() == clu2.
id() && clu1.
size() == clu2.
size() && clu1.
x() == clu2.
x() && clu1.
y() == clu2.
y() &&
184 hitMinEnergy_(iConfig.getParameter<double>(
"HitMinimumEnergy")),
185 LocalPosDebug_(iConfig.getParameter<
bool>(
"LocalPositionDebug")),
186 uncalibRecHitsPlots_(iConfig.getParameter<
bool>(
"UncalibRecHitsPlots")),
187 hitMinAmplitude_(iConfig.getParameter<double>(
"HitMinimumAmplitude")) {
196 mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>();
212 const MTDTopology* topology = topologyHandle.product();
221 std::unordered_map<uint32_t, MTDHit> m_btlSimHits;
222 for (
auto const&
simHit : btlSimHits) {
229 auto simHitIt = m_btlSimHits.emplace(
id.rawId(),
MTDHit()).first;
235 if ((simHitIt->second).time == 0 ||
simHit.tof() < (simHitIt->second).
time) {
238 auto hit_pos =
simHit.entryPoint();
239 (simHitIt->second).x_local = hit_pos.x();
240 (simHitIt->second).y_local = hit_pos.y();
241 (simHitIt->second).z_local = hit_pos.z();
247 unsigned int n_reco_btl = 0;
248 for (
const auto&
recHit : *btlRecHitsHandle) {
252 if (thedet ==
nullptr)
253 throw cms::Exception(
"BtlLocalRecoValidation") <<
"GeographicalID: " << std::hex << geoId.
rawId() <<
" (" 254 << detId.
rawId() <<
") is invalid!" <<
std::dec << std::endl;
260 const auto& global_point = thedet->
toGlobal(local_point);
293 float time_res =
recHit.time() - m_btlSimHits[detId.
rawId()].time;
294 float energy_res =
recHit.energy() - m_btlSimHits[detId.
rawId()].energy;
301 const auto& global_point_sim = thedet->
toGlobal(local_point_sim);
322 for (
const auto& DetSetClu : *btlRecCluHandle) {
323 for (
const auto& cluster : DetSetClu) {
327 DetId detIdObject(cluId);
328 const auto& genericDet =
geom->idToDetUnit(detIdObject);
329 if (genericDet ==
nullptr) {
331 <<
"GeographicalID: " << std::hex << cluId <<
" is invalid!" <<
std::dec << std::endl;
339 const auto& global_point = genericDet->toGlobal(local_point);
352 double cluEneSIM = 0.;
353 double cluTimeSIM = 0.;
354 double cluLocXSIM = 0.;
355 double cluLocYSIM = 0.;
356 double cluLocZSIM = 0.;
358 for (
int ihit = 0; ihit < cluster.size(); ++ihit) {
359 int hit_row = cluster.minHitRow() + cluster.hitOffset()[ihit * 2];
360 int hit_col = cluster.minHitCol() + cluster.hitOffset()[ihit * 2 + 1];
363 for (
const auto&
recHit : *btlRecHitsHandle) {
366 if (m_btlSimHits.count(hitId.rawId()) == 0)
370 if (hitId.mtdSide() != cluId.
mtdSide() || hitId.mtdRR() != cluId.
mtdRR() ||
recHit.row() != hit_row ||
371 recHit.column() != hit_col)
375 if (
recHit.energy() != cluster.hitENERGY()[ihit] ||
recHit.time() != cluster.hitTIME()[ihit])
386 cluLocXSIM += local_point_sim.
x() * m_btlSimHits[
recHit.id().rawId()].energy;
387 cluLocYSIM += local_point_sim.
y() * m_btlSimHits[
recHit.id().rawId()].energy;
388 cluLocZSIM += local_point_sim.
z() * m_btlSimHits[
recHit.id().rawId()].energy;
391 cluEneSIM += m_btlSimHits[
recHit.id().rawId()].energy;
392 cluTimeSIM += m_btlSimHits[
recHit.id().rawId()].time * m_btlSimHits[
recHit.id().rawId()].energy;
400 bool matchClu =
false;
401 const auto& trkHits = (*mtdTrkHitHandle)[detIdObject];
402 for (
const auto& trkHit : trkHits) {
404 comp = trkHit.clone();
411 <<
"No valid TrackingRecHit corresponding to cluster, detId = " << detIdObject.
rawId();
415 if (cluTimeSIM > 0. && cluEneSIM > 0.) {
416 cluTimeSIM /= cluEneSIM;
418 Local3DPoint cluLocalPosSIM(cluLocXSIM / cluEneSIM, cluLocYSIM / cluEneSIM, cluLocZSIM / cluEneSIM);
419 const auto& cluGlobalPosSIM = genericDet->toGlobal(cluLocalPosSIM);
421 float time_res = cluster.time() - cluTimeSIM;
422 float energy_res = cluster.energy() - cluEneSIM;
426 float rho_res = global_point.perp() - cluGlobalPosSIM.perp();
427 float phi_res = global_point.phi() - cluGlobalPosSIM.phi();
432 float xlocal_res = local_point.
x() - cluLocalPosSIM.
x();
433 float ylocal_res = local_point.
y() - cluLocalPosSIM.
y();
434 float z_res = global_point.z() - cluGlobalPosSIM.z();
439 if (matchClu &&
comp !=
nullptr) {
475 for (
const auto& uRecHit : *btlUncalibRecHitsHandle) {
479 if (m_btlSimHits.count(detId.
rawId()) != 1)
484 if (thedet ==
nullptr)
485 throw cms::Exception(
"BtlLocalRecoValidation") <<
"GeographicalID: " << std::hex << geoId.
rawId() <<
" (" 486 << detId.
rawId() <<
") is invalid!" <<
std::dec << std::endl;
492 const auto& global_point = thedet->
toGlobal(local_point);
497 float hit_amplitude = 0.;
501 if (uRecHit.amplitude().first > 0.) {
502 hit_amplitude += uRecHit.amplitude().first;
503 hit_time += uRecHit.time().first;
507 if (uRecHit.amplitude().second > 0.) {
508 hit_amplitude += uRecHit.amplitude().second;
509 hit_time += uRecHit.time().second;
513 hit_amplitude /=
nHits;
521 float time_res = hit_time - m_btlSimHits[detId.
rawId()].time;
533 if (fabs(global_point.eta()) >=
binsQEta_[ibin] && fabs(global_point.eta()) <
binsQEta_[ibin + 1])
565 meNhits_ = ibook.
book1D(
"BtlNhits",
"Number of BTL RECO hits;log_{10}(N_{RECO})", 100, 0., 5.25);
567 meHitEnergy_ = ibook.
book1D(
"BtlHitEnergy",
"BTL RECO hits energy;E_{RECO} [MeV]", 100, 0., 20.);
568 meHitTime_ = ibook.
book1D(
"BtlHitTime",
"BTL RECO hits ToA;ToA_{RECO} [ns]", 100, 0., 25.);
569 meHitTimeError_ = ibook.
book1D(
"BtlHitTimeError",
"BTL RECO hits ToA error;#sigma^{ToA}_{RECO} [ns]", 50, 0., 0.1);
571 "BtlOccupancy",
"BTL RECO hits occupancy;Z_{RECO} [cm]; #phi_{RECO} [rad]", 65, -260., 260., 126, -3.2, 3.2);
574 "BtlLocalOccupancy",
"BTL RECO hits local occupancy;X_{RECO} [cm]; Y_{RECO} [cm]", 100, 10., 10., 60, -3., 3.);
575 meHitXlocal_ = ibook.
book1D(
"BtlHitXlocal",
"BTL RECO local X;X_{RECO}^{LOC} [cm]", 100, -10., 10.);
576 meHitYlocal_ = ibook.
book1D(
"BtlHitYlocal",
"BTL RECO local Y;Y_{RECO}^{LOC} [cm]", 60, -3, 3);
577 meHitZlocal_ = ibook.
book1D(
"BtlHitZlocal",
"BTL RECO local z;z_{RECO}^{LOC} [cm]", 10, -1, 1);
579 meHitX_ = ibook.
book1D(
"BtlHitX",
"BTL RECO hits X;X_{RECO} [cm]", 60, -120., 120.);
580 meHitY_ = ibook.
book1D(
"BtlHitY",
"BTL RECO hits Y;Y_{RECO} [cm]", 60, -120., 120.);
581 meHitZ_ = ibook.
book1D(
"BtlHitZ",
"BTL RECO hits Z;Z_{RECO} [cm]", 100, -260., 260.);
582 meHitPhi_ = ibook.
book1D(
"BtlHitPhi",
"BTL RECO hits #phi;#phi_{RECO} [rad]", 126, -3.2, 3.2);
583 meHitEta_ = ibook.
book1D(
"BtlHitEta",
"BTL RECO hits #eta;#eta_{RECO}", 100, -1.55, 1.55);
585 ibook.
bookProfile(
"BtlHitTvsE",
"BTL RECO ToA vs energy;E_{RECO} [MeV];ToA_{RECO} [ns]", 50, 0., 20., 0., 100.);
587 "BtlHitEvsPhi",
"BTL RECO energy vs #phi;#phi_{RECO} [rad];E_{RECO} [MeV]", 50, -3.2, 3.2, 0., 100.);
589 "BtlHitEvsEta",
"BTL RECO energy vs #eta;#eta_{RECO};E_{RECO} [MeV]", 50, -1.55, 1.55, 0., 100.);
591 ibook.
bookProfile(
"BtlHitEvsZ",
"BTL RECO energy vs Z;Z_{RECO} [cm];E_{RECO} [MeV]", 50, -260., 260., 0., 100.);
593 "BtlHitTvsPhi",
"BTL RECO ToA vs #phi;#phi_{RECO} [rad];ToA_{RECO} [ns]", 50, -3.2, 3.2, 0., 100.);
595 ibook.
bookProfile(
"BtlHitTvsEta",
"BTL RECO ToA vs #eta;#eta_{RECO};ToA_{RECO} [ns]", 50, -1.6, 1.6, 0., 100.);
597 ibook.
bookProfile(
"BtlHitTvsZ",
"BTL RECO ToA vs Z;Z_{RECO} [cm];ToA_{RECO} [ns]", 50, -260., 260., 0., 100.);
598 meHitLongPos_ = ibook.
book1D(
"BtlLongPos",
"BTL RECO hits longitudinal position;long. pos._{RECO}", 100, -10, 10);
600 ibook.
book1D(
"BtlLongPosErr",
"BTL RECO hits longitudinal position error; long. pos. error_{RECO}", 100, -1, 1);
601 meTimeRes_ = ibook.
book1D(
"BtlTimeRes",
"BTL time resolution;T_{RECO}-T_{SIM}", 100, -0.5, 0.5);
602 meEnergyRes_ = ibook.
book1D(
"BtlEnergyRes",
"BTL energy resolution;E_{RECO}-E_{SIM}", 100, -0.5, 0.5);
604 "BTL longitudinal position pull;X^{loc}_{RECO}-X^{loc}_{SIM}/#sigma_{xloc_{RECO}}",
610 "BTL longitudinal position pull vs E;E_{SIM} [MeV];X^{loc}_{RECO}-X^{loc}_{SIM}/#sigma_{xloc_{RECO}}",
618 "BtlLongposPullvsEta",
619 "BTL longitudinal position pull vs #eta;|#eta_{RECO}|;X^{loc}_{RECO}-X^{loc}_{SIM}/#sigma_{xloc_{RECO}}",
627 "BtlTPullvsE",
"BTL time pull vs E;E_{SIM} [MeV];(T_{RECO}-T_{SIM})/#sigma_{T_{RECO}}", 20, 0., 20., -5., 5.,
"S");
629 "BTL time pull vs #eta;|#eta_{RECO}|;(T_{RECO}-T_{SIM})/#sigma_{T_{RECO}}",
636 meCluTime_ = ibook.
book1D(
"BtlCluTime",
"BTL cluster time ToA;ToA [ns]", 250, 0, 25);
637 meCluTimeError_ = ibook.
book1D(
"BtlCluTimeError",
"BTL cluster time error;#sigma_{t} [ns]", 100, 0, 0.1);
638 meCluEnergy_ = ibook.
book1D(
"BtlCluEnergy",
"BTL cluster energy;E_{RECO} [MeV]", 100, 0, 20);
639 meCluPhi_ = ibook.
book1D(
"BtlCluPhi",
"BTL cluster #phi;#phi_{RECO} [rad]", 144, -3.2, 3.2);
640 meCluEta_ = ibook.
book1D(
"BtlCluEta",
"BTL cluster #eta;#eta_{RECO}", 100, -1.55, 1.55);
641 meCluHits_ = ibook.
book1D(
"BtlCluHitNumber",
"BTL hits per cluster; Cluster size", 10, 0, 10);
643 "BtlOccupancy",
"BTL cluster Z vs #phi;Z_{RECO} [cm]; #phi_{RECO} [rad]", 144, -260., 260., 50, -3.2, 3.2);
645 "BtlCluEnergyVsEta",
"BTL cluster energy vs #eta; |#eta_{RECO}|; E_{RECO} [cm]", 30, 0., 1.55, 0., 20.,
"S");
647 "BtlCluHitsVsEta",
"BTL hits per cluster vs #eta; |#eta_{RECO}|;Cluster size", 30, 0., 1.55, 0., 10.,
"S");
649 meCluTimeRes_ = ibook.
book1D(
"BtlCluTimeRes",
"BTL cluster time resolution;T_{RECO}-T_{SIM} [ns]", 100, -0.5, 0.5);
651 ibook.
book1D(
"BtlCluEnergyRes",
"BTL cluster energy resolution;E_{RECO}-E_{SIM} [MeV]", 100, -0.5, 0.5);
653 "BTL cluster time resolution vs E;E_{SIM} [MeV];(T_{RECO}-T_{SIM}) [ns]",
661 "BTL cluster time resolution vs #eta;|#eta_{RECO}|;(T_{RECO}-T_{SIM}) [ns]",
669 "BTL cluster time pull vs E;E_{SIM} [MeV];(T_{RECO}-T_{SIM})/#sigma_{T_{RECO}}",
678 "BTL cluster time pull vs #eta;|#eta_{RECO}|;(T_{RECO}-T_{SIM})/#sigma_{T_{RECO}}",
686 ibook.
book1D(
"BtlCluRhoRes",
"BTL cluster #rho resolution;#rho_{RECO}-#rho_{SIM} [cm]", 100, -0.5, 0.5);
688 ibook.
book1D(
"BtlCluPhiRes",
"BTL cluster #phi resolution;#phi_{RECO}-#phi_{SIM} [rad]", 100, -0.03, 0.03);
689 meCluZRes_ = ibook.
book1D(
"BtlCluZRes",
"BTL cluster Z resolution;Z_{RECO}-Z_{SIM} [cm]", 100, -0.2, 0.2);
692 ibook.
book1D(
"BtlCluLocalXRes",
"BTL cluster local X resolution;X_{RECO}-X_{SIM} [cm]", 100, -3.1, 3.1);
694 ibook.
book1D(
"BtlCluLocalYRes",
"BTL cluster local Y resolution;Y_{RECO}-Y_{SIM} [cm]", 100, -3.1, 3.1);
696 ibook.
book1D(
"BtlCluLocalXPull",
"BTL cluster local X pull;X_{RECO}-X_{SIM}/sigmaX_[RECO]", 100, -5., 5.);
698 ibook.
book1D(
"BtlCluLocalYPull",
"BTL cluster local Y pull;Y_{RECO}-Y_{SIM}/sigmaY_[RECO]", 100, -5., 5.);
699 meCluZPull_ = ibook.
book1D(
"BtlCluZPull",
"BTL cluster Z pull;Z_{RECO}-Z_{SIM}/sigmaZ_[RECO]", 100, -5., 5.);
701 "BTL cluster local Y vs X;X^{local}_{RECO} [cm];Y^{local}_{RECO} [cm]",
709 "BTL cluster local Y vs X;X^{local}_{SIM} [cm];Y^{local}_{SIM} [cm]",
716 meCluXLocalErr_ = ibook.
book1D(
"BtlCluXLocalErr",
"BTL cluster X local error;sigmaX_{RECO,loc} [cm]", 30, 0., 3.);
717 meCluYLocalErr_ = ibook.
book1D(
"BtlCluYLocalErr",
"BTL cluster Y local error;sigmaY_{RECO,loc} [cm]", 30, 0., 0.9);
720 ibook.
book1D(
"BtlUnmatchedCluEnergy",
"BTL unmatched cluster log10(energy);log10(E_{RECO} [MeV])", 5, -3, 2);
725 for (
unsigned int ihistoQ = 0; ihistoQ <
nBinsQ_; ++ihistoQ) {
727 std::string htitle = Form(
"BTL time resolution (Q bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoQ);
730 for (
unsigned int ihistoEta = 0; ihistoEta <
nBinsQEta_; ++ihistoEta) {
731 hname = Form(
"TimeResQvsEta_%d_%d", ihistoQ, ihistoEta);
732 htitle = Form(
"BTL time resolution (Q bin = %d, |#eta| bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoQ, ihistoEta);
739 for (
unsigned int ihistoEta = 0; ihistoEta <
nBinsEta_; ++ihistoEta) {
740 std::string hname = Form(
"TimeResEta_%d", ihistoEta);
741 std::string htitle = Form(
"BTL time resolution (|#eta| bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoEta);
744 for (
unsigned int ihistoQ = 0; ihistoQ <
nBinsEtaQ_; ++ihistoQ) {
745 hname = Form(
"TimeResEtavsQ_%d_%d", ihistoEta, ihistoQ);
746 htitle = Form(
"BTL time resolution (|#eta| bin = %d, Q bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoEta, ihistoQ);
765 desc.add<
double>(
"HitMinimumEnergy", 1.);
766 desc.add<
bool>(
"LocalPositionDebug",
false);
767 desc.add<
bool>(
"UncalibRecHitsPlots",
false);
768 desc.add<
double>(
"HitMinimumAmplitude", 30.);
770 descriptions.
add(
"btlLocalRecoValid",
desc);
MonitorElement * meHitXlocal_
MonitorElement * meCluHitsvsEta_
int getMTDTopologyMode() const
MonitorElement * meHitYlocal_
T getParameter(std::string const &) const
MonitorElement * meCluTPullvsE_
edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > mtdgeoToken_
MonitorElement * meHitLongPos_
MonitorElement * meLongPosPull_
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * meNhits_
MonitorElement * meHitEnergy_
virtual const Topology & topology() const
#define DEFINE_FWK_MODULE(type)
MonitorElement * meCluZRes_
virtual const PixelTopology & specificTopology() const
MonitorElement * meCluEnergyvsEta_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * meCluLocalXRes_
MonitorElement * meCluYLocalErr_
const double hitMinEnergy_
int row(unsigned nrows=16) const
MonitorElement * meCluEta_
MonitorElement * meCluZvsPhi_
MonitorElement * meCluPhi_
static constexpr float binWidthQ_
MonitorElement * meCluZPull_
MonitorElement * meTPullvsEta_
MonitorElement * meHitTvsPhi_
MonitorElement * meUnmatchedCluEnergy_
static constexpr int nBinsEtaQ_
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
edm::EDGetTokenT< MTDTrackingDetSetVector > mtdTrackingHitToken_
MonitorElement * meLongPosPullvsEta_
MonitorElement * meCluTimeRes_
constexpr NumType convertUnitsTo(double desiredUnits, NumType val)
MonitorElement * meCluYXLocal_
bool isSameCluster(const FTLCluster &, const FTLCluster &)
MonitorElement * meTimeRes_
int column(unsigned nrows=16) const
MonitorElement * meHitLongPosErr_
MonitorElement * meCluTime_
MonitorElement * meCluXLocalErr_
MonitorElement * meCluLocalYRes_
MonitorElement * meLongPosPullvsE_
float localX(const float mpX) const override
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 * meCluHits_
MonitorElement * meHitTimeError_
MonitorElement * meCluYXLocalSim_
static constexpr float binWidthEta_
~BtlLocalRecoValidation() override
edm::EDGetTokenT< FTLClusterCollection > btlRecCluToken_
static constexpr float binsQEta_[nBinsQEta_+1]
Abs< T >::type abs(const T &t)
MonitorElement * meHitTime_
static constexpr int nBinsQEta_
int nrows() const override
MonitorElement * meCluLocalYPull_
MonitorElement * meEnergyRes_
const double hitMinAmplitude_
edm::ESGetToken< MTDTopology, MTDTopologyRcd > mtdtopoToken_
MonitorElement * meHitEta_
MonitorElement * meLocalOccupancy_
MonitorElement * meTimeResEta_[nBinsEta_]
MonitorElement * meCluRhoRes_
float localY(const float mpY) const override
BtlLocalRecoValidation(const edm::ParameterSet &)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
edm::EDGetTokenT< FTLUncalibratedRecHitCollection > btlUncalibRecHitsToken_
MonitorElement * meCluTimeError_
MonitorElement * meHitTvsEta_
constexpr NumType convertMmToCm(NumType millimeters)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * meHitZlocal_
constexpr uint32_t rawId() const
get the raw id
MonitorElement * meCluTPullvsEta_
edm::EDGetTokenT< FTLRecHitCollection > btlRecHitsToken_
MonitorElement * meCluEnergy_
A 2D TrackerRecHit with time and time error information.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * meHitEvsZ_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * meCluLocalXPull_
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
MonitorElement * meCluPhiRes_
void analyze(const edm::Event &, const edm::EventSetup &) override
static constexpr int nBinsQ_
MonitorElement * meTimeResQvsEta_[nBinsQ_][nBinsQEta_]
MonitorElement * meHitEvsPhi_
static constexpr float binsEtaQ_[nBinsEtaQ_+1]
const std::string folder_
MonitorElement * meTimeResEtavsQ_[nBinsEta_][nBinsEtaQ_]
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
static constexpr int nBinsEta_
MonitorElement * meCluTResvsEta_
BTLDetId::CrysLayout crysLayoutFromTopoMode(const int &topoMode)
const bool LocalPosDebug_
MonitorElement * meHitEvsEta_
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 * meHitTvsZ_
MonitorElement * meHitTvsE_
edm::EDGetTokenT< CrossingFrame< PSimHit > > btlSimHitsToken_
MonitorElement * meOccupancy_
MonitorElement * meTimeResQ_[nBinsQ_]
MonitorElement * meCluTResvsE_
MonitorElement * meCluEnergyRes_
int etaBin(const l1t::HGCalMulticluster *cl)
BTLDetId geographicalId(CrysLayout lay) const
MonitorElement * meTPullvsE_
const bool uncalibRecHitsPlots_
MonitorElement * meHitPhi_