TestReadRun3Scouting

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192
// -*- C++ -*-
//
// Package:    DataFormats/Scouting
// Class:      TestReadRun3Scouting
//
/**\class edmtest::TestReadRun3Scouting
  Description: Used as part of tests that ensure the run 3 Scouting
  data formats can be persistently written and in a subsequent process
  read. First, this is done using the current release version for writing
  and reading. In addition, the output file of the write process should
  be saved permanently each time a run 3 Scouting persistent data
  format changes. In unit tests, we read each of those saved files to verify
  that the current releases can read older versions of these data formats.
*/
// Original Author:  W. David Dagenhart
//         Created:  18 May 2023

#include "DataFormats/Scouting/interface/Run3ScoutingCaloJet.h"
#include "DataFormats/Scouting/interface/Run3ScoutingElectron.h"
#include "DataFormats/Scouting/interface/Run3ScoutingHitPatternPOD.h"
#include "DataFormats/Scouting/interface/Run3ScoutingMuon.h"
#include "DataFormats/Scouting/interface/Run3ScoutingParticle.h"
#include "DataFormats/Scouting/interface/Run3ScoutingPFJet.h"
#include "DataFormats/Scouting/interface/Run3ScoutingPhoton.h"
#include "DataFormats/Scouting/interface/Run3ScoutingTrack.h"
#include "DataFormats/Scouting/interface/Run3ScoutingVertex.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/StreamID.h"

#include <vector>

namespace edmtest {

  class TestReadRun3Scouting : public edm::global::EDAnalyzer<> {
  public:
    TestReadRun3Scouting(edm::ParameterSet const&);
    void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
    static void fillDescriptions(edm::ConfigurationDescriptions&);

  private:
    void analyzeCaloJets(edm::Event const&) const;
    void analyzeElectrons(edm::Event const&) const;
    void analyzeMuons(edm::Event const&) const;
    void analyzeParticles(edm::Event const&) const;
    void analyzePFJets(edm::Event const&) const;
    void analyzePhotons(edm::Event const&) const;
    void analyzeTracks(edm::Event const&) const;
    void analyzeVertexes(edm::Event const&) const;

    void throwWithMessageFromConstructor(const char*) const;
    void throwWithMessage(const char*) const;

    // These expected values are meaningless other than we use them
    // to check that values read from persistent storage match the values
    // we know were written.

    const std::vector<double> expectedCaloJetsValues_;
    const edm::EDGetTokenT<std::vector<Run3ScoutingCaloJet>> caloJetsToken_;

    const int inputElectronClassVersion_;
    const std::vector<double> expectedElectronFloatingPointValues_;
    const std::vector<int> expectedElectronIntegralValues_;
    const edm::EDGetTokenT<std::vector<Run3ScoutingElectron>> electronsToken_;

    const std::vector<double> expectedMuonFloatingPointValues_;
    const std::vector<int> expectedMuonIntegralValues_;
    const edm::EDGetTokenT<std::vector<Run3ScoutingMuon>> muonsToken_;

    const std::vector<double> expectedParticleFloatingPointValues_;
    const std::vector<int> expectedParticleIntegralValues_;
    const edm::EDGetTokenT<std::vector<Run3ScoutingParticle>> particlesToken_;

    const std::vector<double> expectedPFJetFloatingPointValues_;
    const std::vector<int> expectedPFJetIntegralValues_;
    const edm::EDGetTokenT<std::vector<Run3ScoutingPFJet>> pfJetsToken_;

    const int inputPhotonClassVersion_;
    const std::vector<double> expectedPhotonFloatingPointValues_;
    const std::vector<int> expectedPhotonIntegralValues_;
    const edm::EDGetTokenT<std::vector<Run3ScoutingPhoton>> photonsToken_;

    const std::vector<double> expectedTrackFloatingPointValues_;
    const std::vector<int> expectedTrackIntegralValues_;
    const edm::EDGetTokenT<std::vector<Run3ScoutingTrack>> tracksToken_;

    const int inputVertexClassVersion_;
    const std::vector<double> expectedVertexFloatingPointValues_;
    const std::vector<int> expectedVertexIntegralValues_;
    const edm::EDGetTokenT<std::vector<Run3ScoutingVertex>> vertexesToken_;
  };

  TestReadRun3Scouting::TestReadRun3Scouting(edm::ParameterSet const& iPSet)
      : expectedCaloJetsValues_(iPSet.getParameter<std::vector<double>>("expectedCaloJetsValues")),
        caloJetsToken_(consumes(iPSet.getParameter<edm::InputTag>("caloJetsTag"))),
        inputElectronClassVersion_(iPSet.getParameter<int>("electronClassVersion")),
        expectedElectronFloatingPointValues_(
            iPSet.getParameter<std::vector<double>>("expectedElectronFloatingPointValues")),
        expectedElectronIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedElectronIntegralValues")),
        electronsToken_(consumes(iPSet.getParameter<edm::InputTag>("electronsTag"))),
        expectedMuonFloatingPointValues_(iPSet.getParameter<std::vector<double>>("expectedMuonFloatingPointValues")),
        expectedMuonIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedMuonIntegralValues")),
        muonsToken_(consumes(iPSet.getParameter<edm::InputTag>("muonsTag"))),
        expectedParticleFloatingPointValues_(
            iPSet.getParameter<std::vector<double>>("expectedParticleFloatingPointValues")),
        expectedParticleIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedParticleIntegralValues")),
        particlesToken_(consumes(iPSet.getParameter<edm::InputTag>("particlesTag"))),
        expectedPFJetFloatingPointValues_(iPSet.getParameter<std::vector<double>>("expectedPFJetFloatingPointValues")),
        expectedPFJetIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedPFJetIntegralValues")),
        pfJetsToken_(consumes(iPSet.getParameter<edm::InputTag>("pfJetsTag"))),
        inputPhotonClassVersion_(iPSet.getParameter<int>("photonClassVersion")),
        expectedPhotonFloatingPointValues_(
            iPSet.getParameter<std::vector<double>>("expectedPhotonFloatingPointValues")),
        expectedPhotonIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedPhotonIntegralValues")),
        photonsToken_(consumes(iPSet.getParameter<edm::InputTag>("photonsTag"))),
        expectedTrackFloatingPointValues_(iPSet.getParameter<std::vector<double>>("expectedTrackFloatingPointValues")),
        expectedTrackIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedTrackIntegralValues")),
        tracksToken_(consumes(iPSet.getParameter<edm::InputTag>("tracksTag"))),
        inputVertexClassVersion_(iPSet.getParameter<int>("vertexClassVersion")),
        expectedVertexFloatingPointValues_(
            iPSet.getParameter<std::vector<double>>("expectedVertexFloatingPointValues")),
        expectedVertexIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedVertexIntegralValues")),
        vertexesToken_(consumes(iPSet.getParameter<edm::InputTag>("vertexesTag"))) {
    if (expectedCaloJetsValues_.size() != 16) {
      throwWithMessageFromConstructor("test configuration error, expectedCaloJetsValues must have size 16");
    }
    if (expectedElectronFloatingPointValues_.size() != 33) {
      throwWithMessageFromConstructor(
          "test configuration error, expectedElectronFloatingPointValues must have size 33");
    }
    if (expectedElectronIntegralValues_.size() != 8) {
      throwWithMessageFromConstructor("test configuration error, expectedElectronIntegralValues must have size 8");
    }
    if (expectedMuonFloatingPointValues_.size() != 37) {
      throwWithMessageFromConstructor("test configuration error, expectedMuonFloatingPointValues must have size 37");
    }
    if (expectedMuonIntegralValues_.size() != 26) {
      throwWithMessageFromConstructor("test configuration error, expectedMuonIntegralValues must have size 26");
    }
    if (expectedParticleFloatingPointValues_.size() != 11) {
      throwWithMessageFromConstructor(
          "test configuration error, expectedParticleFloatingPointValues must have size 11");
    }
    if (expectedParticleIntegralValues_.size() != 5) {
      throwWithMessageFromConstructor("test configuration error, expectedParticleIntegralValues must have size 5");
    }
    if (expectedPFJetFloatingPointValues_.size() != 15) {
      throwWithMessageFromConstructor("test configuration error, expectedPFJetFloatingPointValues must have size 15");
    }
    if (expectedPFJetIntegralValues_.size() != 8) {
      throwWithMessageFromConstructor("test configuration error, expectedPFJetIntegralValues must have size 8");
    }
    if (expectedPhotonFloatingPointValues_.size() != 17) {
      throwWithMessageFromConstructor("test configuration error, expectedPhotonFloatingPointValues must have size 17");
    }
    if (expectedPhotonIntegralValues_.size() != 5) {
      throwWithMessageFromConstructor("test configuration error, expectedPhotonIntegralValues must have size 5");
    }
    if (expectedTrackFloatingPointValues_.size() != 29) {
      throwWithMessageFromConstructor("test configuration error, expectedTrackFloatingPointValues must have size 29");
    }
    if (expectedTrackIntegralValues_.size() != 5) {
      throwWithMessageFromConstructor("test configuration error, expectedTrackIntegralValues must have size 5");
    }
    if (expectedVertexFloatingPointValues_.size() != 10) {
      throwWithMessageFromConstructor("test configuration error, expectedVertexFloatingPointValues must have size 10");
    }
    if (expectedVertexIntegralValues_.size() != 3) {
      throwWithMessageFromConstructor("test configuration error, expectedVertexIntegralValues must have size 3");
    }
  }

  void TestReadRun3Scouting::analyze(edm::StreamID, edm::Event const& iEvent, edm::EventSetup const&) const {
    analyzeCaloJets(iEvent);
    analyzeElectrons(iEvent);
    analyzeMuons(iEvent);
    analyzeParticles(iEvent);
    analyzePFJets(iEvent);
    analyzePhotons(iEvent);
    analyzeTracks(iEvent);
    analyzeVertexes(iEvent);
  }

  void TestReadRun3Scouting::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
    edm::ParameterSetDescription desc;
    desc.add<std::vector<double>>("expectedCaloJetsValues");
    desc.add<edm::InputTag>("caloJetsTag");
    desc.add<int>("electronClassVersion");
    desc.add<std::vector<double>>("expectedElectronFloatingPointValues");
    desc.add<std::vector<int>>("expectedElectronIntegralValues");
    desc.add<edm::InputTag>("electronsTag");
    desc.add<std::vector<double>>("expectedMuonFloatingPointValues");
    desc.add<std::vector<int>>("expectedMuonIntegralValues");
    desc.add<edm::InputTag>("muonsTag");
    desc.add<std::vector<double>>("expectedParticleFloatingPointValues");
    desc.add<std::vector<int>>("expectedParticleIntegralValues");
    desc.add<edm::InputTag>("particlesTag");
    desc.add<std::vector<double>>("expectedPFJetFloatingPointValues");
    desc.add<std::vector<int>>("expectedPFJetIntegralValues");
    desc.add<edm::InputTag>("pfJetsTag");
    desc.add<int>("photonClassVersion");
    desc.add<std::vector<double>>("expectedPhotonFloatingPointValues");
    desc.add<std::vector<int>>("expectedPhotonIntegralValues");
    desc.add<edm::InputTag>("photonsTag");
    desc.add<std::vector<double>>("expectedTrackFloatingPointValues");
    desc.add<std::vector<int>>("expectedTrackIntegralValues");
    desc.add<edm::InputTag>("tracksTag");
    desc.add<int>("vertexClassVersion");
    desc.add<std::vector<double>>("expectedVertexFloatingPointValues");
    desc.add<std::vector<int>>("expectedVertexIntegralValues");
    desc.add<edm::InputTag>("vertexesTag");
    descriptions.addDefault(desc);
  }

  void TestReadRun3Scouting::analyzeCaloJets(edm::Event const& iEvent) const {
    auto const& caloJets = iEvent.get(caloJetsToken_);
    unsigned int vectorSize = 2 + iEvent.id().event() % 4;
    if (caloJets.size() != vectorSize) {
      throwWithMessage("analyzeCaloJets, caloJets does not have expected size");
    }
    unsigned int i = 0;
    for (auto const& caloJet : caloJets) {
      double offset = static_cast<double>(iEvent.id().event() + i);

      if (caloJet.pt() != expectedCaloJetsValues_[0] + offset) {
        throwWithMessage("analyzeCaloJets, pt does not equal expected value");
      }
      if (caloJet.eta() != expectedCaloJetsValues_[1] + offset) {
        throwWithMessage("analyzeCaloJets, eta does not equal expected value");
      }
      if (caloJet.phi() != expectedCaloJetsValues_[2] + offset) {
        throwWithMessage("analyzeCaloJets, phi does not equal expected value");
      }
      if (caloJet.m() != expectedCaloJetsValues_[3] + offset) {
        throwWithMessage("analyzeCaloJets, m does not equal expected value");
      }
      if (caloJet.jetArea() != expectedCaloJetsValues_[4] + offset) {
        throwWithMessage("analyzeCaloJets, jetArea does not equal expected value");
      }
      if (caloJet.maxEInEmTowers() != expectedCaloJetsValues_[5] + offset) {
        throwWithMessage("analyzeCaloJets,  maxEInEmTowers() does not equal expected value");
      }
      if (caloJet.maxEInHadTowers() != expectedCaloJetsValues_[6] + offset) {
        throwWithMessage("analyzeCaloJets,  maxEInHadTowers does not equal expected value");
      }
      if (caloJet.hadEnergyInHB() != expectedCaloJetsValues_[7] + offset) {
        throwWithMessage("analyzeCaloJets, hadEnergyInHB does not equal expected value");
      }
      if (caloJet.hadEnergyInHE() != expectedCaloJetsValues_[8] + offset) {
        throwWithMessage("analyzeCaloJets, hadEnergyInHE does not equal expected value");
      }
      if (caloJet.hadEnergyInHF() != expectedCaloJetsValues_[9] + offset) {
        throwWithMessage("analyzeCaloJets, hadEnergyInHF does not equal expected value");
      }
      if (caloJet.emEnergyInEB() != expectedCaloJetsValues_[10] + offset) {
        throwWithMessage("analyzeCaloJets, emEnergyInEB does not equal expected value");
      }
      if (caloJet.emEnergyInEE() != expectedCaloJetsValues_[11] + offset) {
        throwWithMessage("analyzeCaloJets, emEnergyInEE does not equal expected value");
      }
      if (caloJet.emEnergyInHF() != expectedCaloJetsValues_[12] + offset) {
        throwWithMessage("analyzeCaloJets, emEnergyInHF does not equal expected value");
      }
      if (caloJet.towersArea() != expectedCaloJetsValues_[13] + offset) {
        throwWithMessage("analyzeCaloJets, towersArea does not equal expected value");
      }
      if (caloJet.mvaDiscriminator() != expectedCaloJetsValues_[14] + offset) {
        throwWithMessage("analyzeCaloJets,  mvaDiscriminator does not equal expected value");
      }
      if (caloJet.btagDiscriminator() != expectedCaloJetsValues_[15] + offset) {
        throwWithMessage("analyzeCaloJets,  btagDiscriminator does not equal expected value");
      }
      ++i;
    }
  }

  void TestReadRun3Scouting::analyzeElectrons(edm::Event const& iEvent) const {
    auto const& electrons = iEvent.get(electronsToken_);
    unsigned int vectorSize = 2 + iEvent.id().event() % 4;
    if (electrons.size() != vectorSize) {
      throwWithMessage("analyzeElectrons, electrons does not have expected size");
    }
    unsigned int i = 0;
    for (auto const& electron : electrons) {
      double offset = static_cast<double>(iEvent.id().event() + i);
      int iOffset = static_cast<int>(iEvent.id().event() + i);

      if (electron.pt() != expectedElectronFloatingPointValues_[0] + offset) {
        throwWithMessage("analyzeElectrons, pt does not equal expected value");
      }
      if (electron.eta() != expectedElectronFloatingPointValues_[1] + offset) {
        throwWithMessage("analyzeElectrons, eta does not equal expected value");
      }
      if (electron.phi() != expectedElectronFloatingPointValues_[2] + offset) {
        throwWithMessage("analyzeElectrons, phi does not equal expected value");
      }
      if (electron.m() != expectedElectronFloatingPointValues_[3] + offset) {
        throwWithMessage("analyzeElectrons, m does not equal expected value");
      }
      if (inputElectronClassVersion_ == 5) {
        if (electron.trkd0().size() != 1) {
          throwWithMessage("analyzeElectrons, trkd0 does not have expected size");
        }
        if (electron.trkd0()[0] != expectedElectronFloatingPointValues_[4] + offset) {
          throwWithMessage("analyzeElectrons, d0 does not equal expected value");
        }
        if (electron.trkdz().size() != 1) {
          throwWithMessage("analyzeElectrons, trkdz does not have expected size");
        }
        if (electron.trkdz()[0] != expectedElectronFloatingPointValues_[5] + offset) {
          throwWithMessage("analyzeElectrons,  dz does not equal expected value");
        }
      }
      if (electron.dEtaIn() != expectedElectronFloatingPointValues_[6] + offset) {
        throwWithMessage("analyzeElectrons,  dEtaIn does not equal expected value");
      }
      if (electron.dPhiIn() != expectedElectronFloatingPointValues_[7] + offset) {
        throwWithMessage("analyzeElectrons, dPhiIn does not equal expected value");
      }
      if (electron.sigmaIetaIeta() != expectedElectronFloatingPointValues_[8] + offset) {
        throwWithMessage("analyzeElectrons, sigmaIetaIeta does not equal expected value");
      }
      if (electron.hOverE() != expectedElectronFloatingPointValues_[9] + offset) {
        throwWithMessage("analyzeElectrons, hOverE does not equal expected value");
      }
      if (electron.ooEMOop() != expectedElectronFloatingPointValues_[10] + offset) {
        throwWithMessage("analyzeElectrons, ooEMOop does not equal expected value");
      }
      if (electron.missingHits() != expectedElectronIntegralValues_[0] + iOffset) {
        throwWithMessage("analyzeElectrons, missingHits does not equal expected value");
      }
      if (inputElectronClassVersion_ == 5) {
        if (electron.trkcharge().size() != 1) {
          throwWithMessage("analyzeElectrons, trkcharge does not have expected size");
        }
        if (electron.trkcharge()[0] != expectedElectronIntegralValues_[1] + iOffset) {
          throwWithMessage("analyzeElectrons, charge does not equal expected value");
        }
      }
      if (electron.ecalIso() != expectedElectronFloatingPointValues_[11] + offset) {
        throwWithMessage("analyzeElectrons, ecalIso does not equal expected value");
      }
      if (electron.hcalIso() != expectedElectronFloatingPointValues_[12] + offset) {
        throwWithMessage("analyzeElectrons, hcalIso does not equal expected value");
      }
      if (electron.trackIso() != expectedElectronFloatingPointValues_[13] + offset) {
        throwWithMessage("analyzeElectrons, trackIso does not equal expected value");
      }
      if (electron.r9() != expectedElectronFloatingPointValues_[14] + offset) {
        throwWithMessage("analyzeElectrons, r9 does not equal expected value");
      }
      if (electron.sMin() != expectedElectronFloatingPointValues_[15] + offset) {
        throwWithMessage("analyzeElectrons, sMin does not equal expected value");
      }
      if (electron.sMaj() != expectedElectronFloatingPointValues_[16] + offset) {
        throwWithMessage("analyzeElectrons, sMaj does not equal expected value");
      }
      if (electron.seedId() != static_cast<unsigned int>(expectedElectronIntegralValues_[2] + iOffset)) {
        throwWithMessage("analyzeElectrons, seedId does not equal expected value");
      }
      if (electron.energyMatrix().size() != vectorSize) {
        throwWithMessage("analyzeElectrons, energyMatrix does not have expected size");
      }
      unsigned int j = 0;
      for (auto const& val : electron.energyMatrix()) {
        if (val != expectedElectronFloatingPointValues_[17] + offset + 10 * j) {
          throwWithMessage("analyzeElectrons, energyMatrix does not contain expected value");
        }
        ++j;
      }
      if (electron.detIds().size() != vectorSize) {
        throwWithMessage("analyzeElectrons, detIds does not have expected size");
      }
      j = 0;
      for (auto const& val : electron.detIds()) {
        if (val != expectedElectronIntegralValues_[3] + iOffset + 10 * j) {
          throwWithMessage("analyzeElectrons, detIds does not contain expected value");
        }
        ++j;
      }
      if (electron.timingMatrix().size() != vectorSize) {
        throwWithMessage("analyzeElectrons, timingMatrix does not have expected size");
      }
      j = 0;
      for (auto const& val : electron.timingMatrix()) {
        if (val != expectedElectronFloatingPointValues_[18] + offset + 10 * j) {
          throwWithMessage("analyzeElectrons, timingMatrix does not contain expected value");
        }
        ++j;
      }
      if (electron.rechitZeroSuppression() != static_cast<bool>((expectedElectronIntegralValues_[4] + iOffset) % 2)) {
        throwWithMessage("analyzeElectrons, rechitZeroSuppression does not equal expected value");
      }
      if (inputElectronClassVersion_ == 6 || inputElectronClassVersion_ == 7) {
        if (electron.trkd0().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trkd0 does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trkd0()) {
          if (val != expectedElectronFloatingPointValues_[19] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trkd0 does not contain expected value");
          }
          ++j;
        }
        if (electron.trkdz().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trkdz does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trkdz()) {
          if (val != expectedElectronFloatingPointValues_[20] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trkdz does not contain expected value");
          }
          ++j;
        }
        if (electron.trkpt().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trkpt does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trkpt()) {
          if (val != expectedElectronFloatingPointValues_[21] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trkpt does not contain expected value");
          }
          ++j;
        }
        if (electron.trketa().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trketa does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trketa()) {
          if (val != expectedElectronFloatingPointValues_[22] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trketa does not contain expected value");
          }
          ++j;
        }
        if (electron.trkphi().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trkphi does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trkphi()) {
          if (val != expectedElectronFloatingPointValues_[23] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trkphi does not contain expected value");
          }
          ++j;
        }
        if (electron.trkchi2overndf().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trkchi2overndf does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trkchi2overndf()) {
          if (val != expectedElectronFloatingPointValues_[24] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trkchi2overndf does not contain expected value");
          }
          ++j;
        }
        if (electron.trkcharge().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trkcharge does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trkcharge()) {
          if (val != static_cast<int>(expectedElectronIntegralValues_[5] + iOffset + 10 * j)) {
            throwWithMessage("analyzeElectrons, trkcharge does not contain expected value");
          }
          ++j;
        }
      }
      if (inputElectronClassVersion_ == 7) {
        if (electron.rawEnergy() != expectedElectronFloatingPointValues_[25] + offset) {
          throwWithMessage("analyzeElectrons, rawEnergy does not equal expected value");
        }
        if (electron.preshowerEnergy() != expectedElectronFloatingPointValues_[26] + offset) {
          throwWithMessage("analyzeElectrons, preshowerEnergy does not equal expected value");
        }
        if (electron.corrEcalEnergyError() != expectedElectronFloatingPointValues_[27] + offset) {
          throwWithMessage("analyzeElectrons, corrEcalEnergyError does not equal expected value");
        }
        if (electron.trkpMode().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trkpMode does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trkpMode()) {
          if (val != expectedElectronFloatingPointValues_[28] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trkpMode does not contain expected value");
          }
          ++j;
        }
        if (electron.trketaMode().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trketaMode does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trketaMode()) {
          if (val != expectedElectronFloatingPointValues_[29] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trketaMode does not contain expected value");
          }
          ++j;
        }
        if (electron.trkphiMode().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trkphiMode does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trkphiMode()) {
          if (val != expectedElectronFloatingPointValues_[30] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trkphiMode does not contain expected value");
          }
          ++j;
        }
        if (electron.trkqoverpModeError().size() != vectorSize) {
          throwWithMessage("analyzeElectrons, trkqoverpModeError does not have expected size");
        }
        j = 0;
        for (auto const& val : electron.trkqoverpModeError()) {
          if (val != expectedElectronFloatingPointValues_[31] + offset + 10 * j) {
            throwWithMessage("analyzeElectrons, trkqoverpModeError does not contain expected value");
          }
          ++j;
        }
        if (electron.trackfbrem() != expectedElectronFloatingPointValues_[32] + offset) {
          throwWithMessage("analyzeElectrons, trackfbrem does not equal expected value");
        }
        if (electron.nClusters() != static_cast<unsigned int>(expectedElectronIntegralValues_[6] + iOffset)) {
          throwWithMessage("analyzeElectrons, nClusters does not equal expected value");
        }
        if (electron.nCrystals() != static_cast<unsigned int>(expectedElectronIntegralValues_[7] + iOffset)) {
          throwWithMessage("analyzeElectrons, nCrystals does not equal expected value");
        }
      }
      ++i;
    }
  }

  void TestReadRun3Scouting::analyzeMuons(edm::Event const& iEvent) const {
    auto const& muons = iEvent.get(muonsToken_);
    unsigned int vectorSize = 2 + iEvent.id().event() % 4;
    if (muons.size() != vectorSize) {
      throwWithMessage("analyzeMuons, muons does not have expected size");
    }
    unsigned int i = 0;
    for (auto const& muon : muons) {
      double offset = static_cast<double>(iEvent.id().event() + i);
      int iOffset = static_cast<int>(iEvent.id().event() + i);

      if (muon.pt() != expectedMuonFloatingPointValues_[0] + offset) {
        throwWithMessage("analyzeMuons, pt does not equal expected value");
      }
      if (muon.eta() != expectedMuonFloatingPointValues_[1] + offset) {
        throwWithMessage("analyzeMuons, eta does not equal expected value");
      }
      if (muon.phi() != expectedMuonFloatingPointValues_[2] + offset) {
        throwWithMessage("analyzeMuons, phi does not equal expected value");
      }
      if (muon.m() != expectedMuonFloatingPointValues_[3] + offset) {
        throwWithMessage("analyzeMuons, m does not equal expected value");
      }
      if (muon.type() != static_cast<unsigned int>(expectedMuonIntegralValues_[0] + iOffset)) {
        throwWithMessage("analyzeMuons, type does not equal expected value");
      }
      if (muon.charge() != expectedMuonIntegralValues_[1] + iOffset) {
        throwWithMessage("analyzeMuons, charge does not equal expected value");
      }
      if (muon.normalizedChi2() != expectedMuonFloatingPointValues_[4] + offset) {
        throwWithMessage("analyzeMuons,  normalizedChi2 does not equal expected value");
      }
      if (muon.ecalIso() != expectedMuonFloatingPointValues_[5] + offset) {
        throwWithMessage("analyzeMuons, ecalIso does not equal expected value");
      }
      if (muon.hcalIso() != expectedMuonFloatingPointValues_[6] + offset) {
        throwWithMessage("analyzeMuons, hcalIso does not equal expected value");
      }
      if (muon.trackIso() != expectedMuonFloatingPointValues_[7] + offset) {
        throwWithMessage("analyzeMuons, trackIso does not equal expected value");
      }
      if (muon.nValidStandAloneMuonHits() != expectedMuonIntegralValues_[2] + iOffset) {
        throwWithMessage("analyzeMuons, nValidStandAloneMuonHits does not equal expected value");
      }
      if (muon.nStandAloneMuonMatchedStations() != expectedMuonIntegralValues_[3] + iOffset) {
        throwWithMessage("analyzeMuons, nStandAloneMuonMatchedStations does not equal expected value");
      }
      if (muon.nValidRecoMuonHits() != expectedMuonIntegralValues_[4] + iOffset) {
        throwWithMessage("analyzeMuons, nValidRecoMuonHits does not equal expected value");
      }
      if (muon.nRecoMuonChambers() != expectedMuonIntegralValues_[5] + iOffset) {
        throwWithMessage("analyzeMuons, nRecoMuonChambers does not equal expected value");
      }
      if (muon.nRecoMuonChambersCSCorDT() != expectedMuonIntegralValues_[6] + iOffset) {
        throwWithMessage("analyzeMuons, nRecoMuonChambersCSCorDT does not equal expected value");
      }
      if (muon.nRecoMuonMatches() != expectedMuonIntegralValues_[7] + iOffset) {
        throwWithMessage("analyzeMuons, nRecoMuonMatches does not equal expected value");
      }
      if (muon.nRecoMuonMatchedStations() != expectedMuonIntegralValues_[8] + iOffset) {
        throwWithMessage("analyzeMuons, nRecoMuonMatchedStations does not equal expected value");
      }
      if (muon.nRecoMuonExpectedMatchedStations() !=
          static_cast<unsigned int>(expectedMuonIntegralValues_[9] + iOffset)) {
        throwWithMessage("analyzeMuons, nRecoMuonExpectedMatchedStations does not equal expected value");
      }
      if (muon.recoMuonStationMask() != static_cast<unsigned int>(expectedMuonIntegralValues_[10] + iOffset)) {
        throwWithMessage("analyzeMuons, recoMuonStationMask does not equal expected value");
      }
      if (muon.nRecoMuonMatchedRPCLayers() != expectedMuonIntegralValues_[11] + iOffset) {
        throwWithMessage("analyzeMuons, nRecoMuonMatchedRPCLayers does not equal expected value");
      }
      if (muon.recoMuonRPClayerMask() != static_cast<unsigned int>(expectedMuonIntegralValues_[12] + iOffset)) {
        throwWithMessage("analyzeMuons, recoMuonRPClayerMask does not equal expected value");
      }
      if (muon.nValidPixelHits() != expectedMuonIntegralValues_[13] + iOffset) {
        throwWithMessage("analyzeMuons, nValidPixelHits does not equal expected value");
      }
      if (muon.nValidStripHits() != expectedMuonIntegralValues_[14] + iOffset) {
        throwWithMessage("analyzeMuons, nValidStripHits does not equal expected value");
      }
      if (muon.nPixelLayersWithMeasurement() != expectedMuonIntegralValues_[15] + iOffset) {
        throwWithMessage("analyzeMuons, nPixelLayersWithMeasurement does not equal expected value");
      }
      if (muon.nTrackerLayersWithMeasurement() != expectedMuonIntegralValues_[16] + iOffset) {
        throwWithMessage("analyzeMuons, nTrackerLayersWithMeasurement does not equal expected value");
      }
      if (muon.trk_chi2() != expectedMuonFloatingPointValues_[8] + offset) {
        throwWithMessage("analyzeMuons, trk_chi2  does not equal expected value");
      }
      if (muon.trk_ndof() != expectedMuonFloatingPointValues_[9] + offset) {
        throwWithMessage("analyzeMuons, trk_ndof does not equal expected value");
      }
      if (muon.trk_dxy() != expectedMuonFloatingPointValues_[10] + offset) {
        throwWithMessage("analyzeMuons, trk_dxy does not equal expected value");
      }
      if (muon.trk_dz() != expectedMuonFloatingPointValues_[11] + offset) {
        throwWithMessage("analyzeMuons, trk_dz does not equal expected value");
      }
      if (muon.trk_qoverp() != expectedMuonFloatingPointValues_[12] + offset) {
        throwWithMessage("analyzeMuons, trk_qoverp does not equal expected value");
      }
      if (muon.trk_lambda() != expectedMuonFloatingPointValues_[13] + offset) {
        throwWithMessage("analyzeMuons, trk_lambda does not equal expected value");
      }
      if (muon.trk_pt() != expectedMuonFloatingPointValues_[14] + offset) {
        throwWithMessage("analyzeMuons, trk_pt does not equal expected value");
      }
      if (muon.trk_phi() != expectedMuonFloatingPointValues_[15] + offset) {
        throwWithMessage("analyzeMuons, trk_phi does not equal expected value");
      }
      if (muon.trk_eta() != expectedMuonFloatingPointValues_[16] + offset) {
        throwWithMessage("analyzeMuons, trk_eta does not equal expected value");
      }
      if (muon.trk_dxyError() != expectedMuonFloatingPointValues_[17] + offset) {
        throwWithMessage("analyzeMuons, trk_dxyError does not equal expected value");
      }
      if (muon.trk_dzError() != expectedMuonFloatingPointValues_[18] + offset) {
        throwWithMessage("analyzeMuons, trk_dzError does not equal expected value");
      }
      if (muon.trk_qoverpError() != expectedMuonFloatingPointValues_[19] + offset) {
        throwWithMessage("analyzeMuons, trk_qoverpError does not equal expected value");
      }
      if (muon.trk_lambdaError() != expectedMuonFloatingPointValues_[20] + offset) {
        throwWithMessage("analyzeMuons, trk_lambdaError does not equal expected value");
      }
      if (muon.trk_phiError() != expectedMuonFloatingPointValues_[21] + offset) {
        throwWithMessage("analyzeMuons, trk_phiError does not equal expected value");
      }
      if (muon.trk_dsz() != expectedMuonFloatingPointValues_[22] + offset) {
        throwWithMessage("analyzeMuons, trk_dsz does not equal expected value");
      }
      if (muon.trk_dszError() != expectedMuonFloatingPointValues_[23] + offset) {
        throwWithMessage("analyzeMuons, trk_dszError does not equal expected value");
      }
      if (muon.trk_qoverp_lambda_cov() != expectedMuonFloatingPointValues_[24] + offset) {
        throwWithMessage("analyzeMuons, trk_qoverp_lambda_cov does not equal expected value");
      }
      if (muon.trk_qoverp_phi_cov() != expectedMuonFloatingPointValues_[25] + offset) {
        throwWithMessage("analyzeMuons, trk_qoverp_phi_cov does not equal expected value");
      }
      if (muon.trk_qoverp_dxy_cov() != expectedMuonFloatingPointValues_[26] + offset) {
        throwWithMessage("analyzeMuons, trk_qoverp_dxy_cov does not equal expected value");
      }
      if (muon.trk_qoverp_dsz_cov() != expectedMuonFloatingPointValues_[27] + offset) {
        throwWithMessage("analyzeMuons, trk_qoverp_dsz_cov does not equal expected value");
      }
      if (muon.trk_lambda_phi_cov() != expectedMuonFloatingPointValues_[28] + offset) {
        throwWithMessage("analyzeMuons, trk_lambda_phi_cov does not equal expected value");
      }
      if (muon.trk_lambda_dxy_cov() != expectedMuonFloatingPointValues_[29] + offset) {
        throwWithMessage("analyzeMuons, trk_lambda_dxy_cov  does not equal expected value");
      }
      if (muon.trk_lambda_dsz_cov() != expectedMuonFloatingPointValues_[30] + offset) {
        throwWithMessage("analyzeMuons, trk_lambda_dsz_cov  does not equal expected value");
      }
      if (muon.trk_phi_dxy_cov() != expectedMuonFloatingPointValues_[31] + offset) {
        throwWithMessage("analyzeMuons, trk_phi_dxy_cov does not equal expected value");
      }
      if (muon.trk_phi_dsz_cov() != expectedMuonFloatingPointValues_[32] + offset) {
        throwWithMessage("analyzeMuons, trk_phi_dsz_cov does not equal expected value");
      }
      if (muon.trk_dxy_dsz_cov() != expectedMuonFloatingPointValues_[33] + offset) {
        throwWithMessage("analyzeMuons, trk_dxy_dsz_cov does not equal expected value");
      }
      if (muon.trk_vx() != expectedMuonFloatingPointValues_[34] + offset) {
        throwWithMessage("analyzeMuons, trk_vx does not equal expected value");
      }
      if (muon.trk_vy() != expectedMuonFloatingPointValues_[35] + offset) {
        throwWithMessage("analyzeMuons, trk_vy does not equal expected value");
      }
      if (muon.trk_vz() != expectedMuonFloatingPointValues_[36] + offset) {
        throwWithMessage("analyzeMuons, trk_vz does not equal expected value");
      }
      int j = 0;
      for (auto const& val : muon.vtxIndx()) {
        if (val != expectedMuonIntegralValues_[17] + iOffset + 10 * j) {
          throwWithMessage("analyzeMuons, vtxIndx does not contain expected value");
        }
        ++j;
      }
      if (muon.trk_hitPattern().hitCount != static_cast<uint8_t>(expectedMuonIntegralValues_[18] + iOffset)) {
        throwWithMessage("analyzeMuons, hitCount does not equal expected value");
      }
      if (muon.trk_hitPattern().beginTrackHits != static_cast<uint8_t>(expectedMuonIntegralValues_[19] + iOffset)) {
        throwWithMessage("analyzeMuons, beginTrackHits does not equal expected value");
      }
      if (muon.trk_hitPattern().endTrackHits != static_cast<uint8_t>(expectedMuonIntegralValues_[20] + iOffset)) {
        throwWithMessage("analyzeMuons, endTrackHits does not equal expected value");
      }
      if (muon.trk_hitPattern().beginInner != static_cast<uint8_t>(expectedMuonIntegralValues_[21] + iOffset)) {
        throwWithMessage("analyzeMuons, beginInner does not equal expected value");
      }
      if (muon.trk_hitPattern().endInner != static_cast<uint8_t>(expectedMuonIntegralValues_[22] + iOffset)) {
        throwWithMessage("analyzeMuons, endInner does not equal expected value");
      }
      if (muon.trk_hitPattern().beginOuter != static_cast<uint8_t>(expectedMuonIntegralValues_[23] + iOffset)) {
        throwWithMessage("analyzeMuons, beginOuter does not equal expected value");
      }
      if (muon.trk_hitPattern().endOuter != static_cast<uint8_t>(expectedMuonIntegralValues_[24] + iOffset)) {
        throwWithMessage("analyzeMuons, endOuter does not equal expected value");
      }
      j = 0;
      for (auto const& val : muon.trk_hitPattern().hitPattern) {
        if (val != static_cast<uint16_t>(expectedMuonIntegralValues_[25] + iOffset + 10 * j)) {
          throwWithMessage("analyzeMuons, hitPattern does not contain expected value");
        }
        ++j;
      }
      ++i;
    }
  }

  void TestReadRun3Scouting::analyzeParticles(edm::Event const& iEvent) const {
    auto const& particles = iEvent.get(particlesToken_);
    unsigned int vectorSize = 2 + iEvent.id().event() % 4;
    if (particles.size() != vectorSize) {
      throwWithMessage("analyzeParticles, particles does not have expected size");
    }
    unsigned int i = 0;
    for (auto const& particle : particles) {
      double offset = static_cast<double>(iEvent.id().event() + i);
      int iOffset = static_cast<int>(iEvent.id().event() + i);

      if (particle.pt() != expectedParticleFloatingPointValues_[0] + offset) {
        throwWithMessage("analyzeParticles, pt does not equal expected value");
      }
      if (particle.eta() != expectedParticleFloatingPointValues_[1] + offset) {
        throwWithMessage("analyzeParticles, eta does not equal expected value");
      }
      if (particle.phi() != expectedParticleFloatingPointValues_[2] + offset) {
        throwWithMessage("analyzeParticles, phi does not equal expected value");
      }
      if (particle.pdgId() != expectedParticleIntegralValues_[0] + iOffset) {
        throwWithMessage("analyzeParticles, pdgId does not equal expected value");
      }
      if (particle.vertex() != expectedParticleIntegralValues_[1] + iOffset) {
        throwWithMessage("analyzeParticles, vertex does not equal expected value");
      }
      if (particle.normchi2() != expectedParticleFloatingPointValues_[3] + offset) {
        throwWithMessage("analyzeParticles, normchi2 does not equal expected value");
      }
      if (particle.dz() != expectedParticleFloatingPointValues_[4] + offset) {
        throwWithMessage("analyzeParticles, dz does not equal expected value");
      }
      if (particle.dxy() != expectedParticleFloatingPointValues_[5] + offset) {
        throwWithMessage("analyzeParticles, dxy does not equal expected value");
      }
      if (particle.dzsig() != expectedParticleFloatingPointValues_[6] + offset) {
        throwWithMessage("analyzeParticles, dzsig does not equal expected value");
      }
      if (particle.dxysig() != expectedParticleFloatingPointValues_[7] + offset) {
        throwWithMessage("analyzeParticles, dxysig does not equal expected value");
      }
      if (particle.lostInnerHits() != static_cast<uint8_t>(expectedParticleIntegralValues_[2] + iOffset)) {
        throwWithMessage("analyzeParticles, lostInnerHits does not equal expected value");
      }
      if (particle.quality() != static_cast<uint8_t>(expectedParticleIntegralValues_[3] + iOffset)) {
        throwWithMessage("analyzeParticles, quality does not equal expected value");
      }
      if (particle.trk_pt() != expectedParticleFloatingPointValues_[8] + offset) {
        throwWithMessage("analyzeParticles, trk_pt does not equal expected value");
      }
      if (particle.trk_eta() != expectedParticleFloatingPointValues_[9] + offset) {
        throwWithMessage("analyzeParticles, trk_eta does not equal expected value");
      }
      if (particle.trk_phi() != expectedParticleFloatingPointValues_[10] + offset) {
        throwWithMessage("analyzeParticles, trk_phi does not equal expected value");
      }
      if (particle.relative_trk_vars() != static_cast<bool>((expectedParticleIntegralValues_[4] + iOffset) % 2)) {
        throwWithMessage("analyzeParticles, relative_trk_vars does not equal expected value");
      }
      ++i;
    }
  }

  void TestReadRun3Scouting::analyzePFJets(edm::Event const& iEvent) const {
    auto const& pfJets = iEvent.get(pfJetsToken_);
    unsigned int vectorSize = 2 + iEvent.id().event() % 4;
    if (pfJets.size() != vectorSize) {
      throwWithMessage("analyzePFJets, pfJets does not have expected size");
    }
    unsigned int i = 0;
    for (auto const& pfJet : pfJets) {
      double offset = static_cast<double>(iEvent.id().event() + i);
      int iOffset = static_cast<int>(iEvent.id().event() + i);

      if (pfJet.pt() != expectedPFJetFloatingPointValues_[0] + offset) {
        throwWithMessage("analyzePFJets, pt does not equal expected value");
      }
      if (pfJet.eta() != expectedPFJetFloatingPointValues_[1] + offset) {
        throwWithMessage("analyzePFJets, eta does not equal expected value");
      }
      if (pfJet.phi() != expectedPFJetFloatingPointValues_[2] + offset) {
        throwWithMessage("analyzePFJets, phi does not equal expected value");
      }
      if (pfJet.m() != expectedPFJetFloatingPointValues_[3] + offset) {
        throwWithMessage("analyzePFJets, m does not equal expected value");
      }
      if (pfJet.jetArea() != expectedPFJetFloatingPointValues_[4] + offset) {
        throwWithMessage("analyzePFJets, jetArea does not equal expected value");
      }
      if (pfJet.chargedHadronEnergy() != expectedPFJetFloatingPointValues_[5] + offset) {
        throwWithMessage("analyzePFJets, chargedHadronEnergy does not equal expected value");
      }
      if (pfJet.neutralHadronEnergy() != expectedPFJetFloatingPointValues_[6] + offset) {
        throwWithMessage("analyzePFJets, neutralHadronEnergy does not equal expected value");
      }
      if (pfJet.photonEnergy() != expectedPFJetFloatingPointValues_[7] + offset) {
        throwWithMessage("analyzePFJets, photonEnergy does not equal expected value");
      }
      if (pfJet.electronEnergy() != expectedPFJetFloatingPointValues_[8] + offset) {
        throwWithMessage("analyzePFJets, electronEnergy does not equal expected value");
      }
      if (pfJet.muonEnergy() != expectedPFJetFloatingPointValues_[9] + offset) {
        throwWithMessage("analyzePFJets, muonEnergy does not equal expected value");
      }
      if (pfJet.HFHadronEnergy() != expectedPFJetFloatingPointValues_[10] + offset) {
        throwWithMessage("analyzePFJets, HFHadronEnergy does not equal expected value");
      }
      if (pfJet.HFEMEnergy() != expectedPFJetFloatingPointValues_[11] + offset) {
        throwWithMessage("analyzePFJets, HFEMEnergy does not equal expected value");
      }
      if (pfJet.chargedHadronMultiplicity() != expectedPFJetIntegralValues_[0] + iOffset) {
        throwWithMessage("analyzePFJets, chargedHadronMultiplicity does not equal expected value");
      }
      if (pfJet.neutralHadronMultiplicity() != expectedPFJetIntegralValues_[1] + iOffset) {
        throwWithMessage("analyzePFJets, neutralHadronMultiplicity does not equal expected value");
      }
      if (pfJet.photonMultiplicity() != expectedPFJetIntegralValues_[2] + iOffset) {
        throwWithMessage("analyzePFJets, photonMultiplicity does not equal expected value");
      }
      if (pfJet.electronMultiplicity() != expectedPFJetIntegralValues_[3] + iOffset) {
        throwWithMessage("analyzePFJets, electronMultiplicity does not equal expected value");
      }
      if (pfJet.muonMultiplicity() != expectedPFJetIntegralValues_[4] + iOffset) {
        throwWithMessage("analyzePFJets, muonMultiplicity does not equal expected value");
      }
      if (pfJet.HFHadronMultiplicity() != expectedPFJetIntegralValues_[5] + iOffset) {
        throwWithMessage("analyzePFJets, HFHadronMultiplicity does not equal expected value");
      }
      if (pfJet.HFEMMultiplicity() != expectedPFJetIntegralValues_[6] + iOffset) {
        throwWithMessage("analyzePFJets, HFEMMultiplicity does not equal expected value");
      }
      if (pfJet.HOEnergy() != expectedPFJetFloatingPointValues_[12] + offset) {
        throwWithMessage("analyzePFJets, HOEnergy does not equal expected value");
      }
      if (pfJet.csv() != expectedPFJetFloatingPointValues_[13] + offset) {
        throwWithMessage("analyzePFJets, csv does not equal expected value");
      }
      if (pfJet.mvaDiscriminator() != expectedPFJetFloatingPointValues_[14] + offset) {
        throwWithMessage("analyzePFJets, mvaDiscriminator does not equal expected value");
      }
      int j = 0;
      for (auto const& val : pfJet.constituents()) {
        if (val != expectedPFJetIntegralValues_[7] + iOffset + 10 * j) {
          throwWithMessage("analyzePFJets, constituents does not contain expected value");
        }
        ++j;
      }
      ++i;
    }
  }

  void TestReadRun3Scouting::analyzePhotons(edm::Event const& iEvent) const {
    auto const& photons = iEvent.get(photonsToken_);
    unsigned int vectorSize = 2 + iEvent.id().event() % 4;
    if (photons.size() != vectorSize) {
      throwWithMessage("analyzePhotons, photons does not have expected size");
    }
    unsigned int i = 0;
    for (auto const& photon : photons) {
      double offset = static_cast<double>(iEvent.id().event() + i);
      int iOffset = static_cast<int>(iEvent.id().event() + i);

      if (photon.pt() != expectedPhotonFloatingPointValues_[0] + offset) {
        throwWithMessage("analyzePhotons, pt does not equal expected value");
      }
      if (photon.eta() != expectedPhotonFloatingPointValues_[1] + offset) {
        throwWithMessage("analyzePhotons, eta does not equal expected value");
      }
      if (photon.phi() != expectedPhotonFloatingPointValues_[2] + offset) {
        throwWithMessage("analyzePhotons, phi does not equal expected value");
      }
      if (photon.m() != expectedPhotonFloatingPointValues_[3] + offset) {
        throwWithMessage("analyzePhotons, m does not equal expected value");
      }
      if (photon.sigmaIetaIeta() != expectedPhotonFloatingPointValues_[4] + offset) {
        throwWithMessage("analyzePhotons, sigmaIetaIeta does not equal expected value");
      }
      if (photon.hOverE() != expectedPhotonFloatingPointValues_[5] + offset) {
        throwWithMessage("analyzePhotons, hOverE does not equal expected value");
      }
      if (photon.ecalIso() != expectedPhotonFloatingPointValues_[6] + offset) {
        throwWithMessage("analyzePhotons, ecalIso does not equal expected value");
      }
      if (photon.hcalIso() != expectedPhotonFloatingPointValues_[7] + offset) {
        throwWithMessage("analyzePhotons, hcalIso does not equal expected value");
      }
      if (photon.trkIso() != expectedPhotonFloatingPointValues_[8] + offset) {
        throwWithMessage("analyzePhotons, trkIso does not equal expected value");
      }
      if (photon.r9() != expectedPhotonFloatingPointValues_[9] + offset) {
        throwWithMessage("analyzePhotons, r9 does not equal expected value");
      }
      if (photon.sMin() != expectedPhotonFloatingPointValues_[10] + offset) {
        throwWithMessage("analyzePhotons, sMin does not equal expected value");
      }
      if (photon.sMaj() != expectedPhotonFloatingPointValues_[11] + offset) {
        throwWithMessage("analyzePhotons, sMaj does not equal expected value");
      }
      if (photon.seedId() != static_cast<unsigned int>(expectedPhotonIntegralValues_[0] + iOffset)) {
        throwWithMessage("analyzePhotons, seedId does not equal expected value");
      }

      if (photon.energyMatrix().size() != vectorSize) {
        throwWithMessage("analyzePhotons, energyMatrix does not have expected size");
      }
      unsigned int j = 0;
      for (auto const& val : photon.energyMatrix()) {
        if (val != expectedPhotonFloatingPointValues_[12] + offset + 10 * j) {
          throwWithMessage("analyzePhotons, energyMatrix does not contain expected value");
        }
        ++j;
      }
      if (photon.detIds().size() != vectorSize) {
        throwWithMessage("analyzePhotons, detIds does not have expected size");
      }
      j = 0;
      for (auto const& val : photon.detIds()) {
        if (val != static_cast<uint32_t>(expectedPhotonIntegralValues_[1] + iOffset + 10 * j)) {
          throwWithMessage("analyzePhotons, detIds does not contain expected value");
        }
        ++j;
      }
      if (photon.timingMatrix().size() != vectorSize) {
        throwWithMessage("analyzePhotons, timingMatrix does not have expected size");
      }
      j = 0;
      for (auto const& val : photon.timingMatrix()) {
        if (val != expectedPhotonFloatingPointValues_[13] + offset + 10 * j) {
          throwWithMessage("analyzePhotons, timingMatrix does not contain expected value");
        }
        ++j;
      }
      if (photon.rechitZeroSuppression() != static_cast<bool>((expectedPhotonIntegralValues_[2] + iOffset) % 2)) {
        throwWithMessage("analyzePhotons, rechitZeroSuppression does not equal expected value");
      }
      if (inputPhotonClassVersion_ == 6) {
        if (photon.rawEnergy() != expectedPhotonFloatingPointValues_[14] + offset) {
          throwWithMessage("analyzePhotons, rawEnergy does not equal expected value");
        }
        if (photon.preshowerEnergy() != expectedPhotonFloatingPointValues_[15] + offset) {
          throwWithMessage("analyzePhotons, preshowerEnergy does not equal expected value");
        }
        if (photon.corrEcalEnergyError() != expectedPhotonFloatingPointValues_[16] + offset) {
          throwWithMessage("analyzePhotons, corrEcalEnergyError does not equal expected value");
        }
        if (photon.nClusters() != static_cast<unsigned int>(expectedPhotonIntegralValues_[3] + iOffset)) {
          throwWithMessage("analyzePhotons, nClusters does not equal expected value");
        }
        if (photon.nCrystals() != static_cast<unsigned int>(expectedPhotonIntegralValues_[4] + iOffset)) {
          throwWithMessage("analyzePhotons, nCrystals does not equal expected value");
        }
      }
      ++i;
    }
  }

  void TestReadRun3Scouting::analyzeTracks(edm::Event const& iEvent) const {
    auto const& tracks = iEvent.get(tracksToken_);
    unsigned int vectorSize = 2 + iEvent.id().event() % 4;
    if (tracks.size() != vectorSize) {
      throwWithMessage("analyzeTracks, tracks does not have expected size");
    }
    unsigned int i = 0;
    for (auto const& track : tracks) {
      double offset = static_cast<double>(iEvent.id().event() + i);
      int iOffset = static_cast<int>(iEvent.id().event() + i);

      if (track.tk_pt() != expectedTrackFloatingPointValues_[0] + offset) {
        throwWithMessage("analyzeTracks, tk_pt does not equal expected value");
      }
      if (track.tk_eta() != expectedTrackFloatingPointValues_[1] + offset) {
        throwWithMessage("analyzeTracks, tk_eta does not equal expected value");
      }
      if (track.tk_phi() != expectedTrackFloatingPointValues_[2] + offset) {
        throwWithMessage("analyzeTracks, tk_phi does not equal expected value");
      }
      if (track.tk_chi2() != expectedTrackFloatingPointValues_[3] + offset) {
        throwWithMessage("analyzeTracks, tk_chi2 does not equal expected value");
      }
      if (track.tk_ndof() != expectedTrackFloatingPointValues_[4] + offset) {
        throwWithMessage("analyzeTracks, tk_ndof does not equal expected value");
      }
      if (track.tk_charge() != expectedTrackIntegralValues_[0] + iOffset) {
        throwWithMessage("analyzeTracks, tk_charge does not equal expected value");
      }
      if (track.tk_dxy() != expectedTrackFloatingPointValues_[5] + offset) {
        throwWithMessage("analyzeTracks, tk_dxy does not equal expected value");
      }
      if (track.tk_dz() != expectedTrackFloatingPointValues_[6] + offset) {
        throwWithMessage("analyzeTracks, tk_dz does not equal expected value");
      }
      if (track.tk_nValidPixelHits() != expectedTrackIntegralValues_[1] + iOffset) {
        throwWithMessage("analyzeTracks, tk_nValidPixelHits does not equal expected value");
      }
      if (track.tk_nTrackerLayersWithMeasurement() != expectedTrackIntegralValues_[2] + iOffset) {
        throwWithMessage("analyzeTracks, tk_nTrackerLayersWithMeasurement does not equal expected value");
      }
      if (track.tk_nValidStripHits() != expectedTrackIntegralValues_[3] + iOffset) {
        throwWithMessage("analyzeTracks, tk_nValidStripHits does not equal expected value");
      }
      if (track.tk_qoverp() != expectedTrackFloatingPointValues_[7] + offset) {
        throwWithMessage("analyzeTracks, tk_qoverp does not equal expected value");
      }
      if (track.tk_lambda() != expectedTrackFloatingPointValues_[8] + offset) {
        throwWithMessage("analyzeTracks, tk_lambda does not equal expected value");
      }
      if (track.tk_dxy_Error() != expectedTrackFloatingPointValues_[9] + offset) {
        throwWithMessage("analyzeTracks, tk_dxy_Error does not equal expected value");
      }
      if (track.tk_dz_Error() != expectedTrackFloatingPointValues_[10] + offset) {
        throwWithMessage("analyzeTracks, tk_dz_Error does not equal expected value");
      }
      if (track.tk_qoverp_Error() != expectedTrackFloatingPointValues_[11] + offset) {
        throwWithMessage("analyzeTracks, tk_qoverp_Error does not equal expected value");
      }
      if (track.tk_lambda_Error() != expectedTrackFloatingPointValues_[12] + offset) {
        throwWithMessage("analyzeTracks, tk_lambda_Error does not equal expected value");
      }
      if (track.tk_phi_Error() != expectedTrackFloatingPointValues_[13] + offset) {
        throwWithMessage("analyzeTracks, tk_phi_Error does not equal expected value");
      }
      if (track.tk_dsz() != expectedTrackFloatingPointValues_[14] + offset) {
        throwWithMessage("analyzeTracks, tk_dsz does not equal expected value");
      }
      if (track.tk_dsz_Error() != expectedTrackFloatingPointValues_[15] + offset) {
        throwWithMessage("analyzeTracks, tk_dsz_Error does not equal expected value");
      }
      if (track.tk_qoverp_lambda_cov() != expectedTrackFloatingPointValues_[16] + offset) {
        throwWithMessage("analyzeTracks, tk_qoverp_lambda_cov does not equal expected value");
      }
      if (track.tk_qoverp_phi_cov() != expectedTrackFloatingPointValues_[17] + offset) {
        throwWithMessage("analyzeTracks, tk_qoverp_phi_cov does not equal expected value");
      }
      if (track.tk_qoverp_dxy_cov() != expectedTrackFloatingPointValues_[18] + offset) {
        throwWithMessage("analyzeTracks, tk_qoverp_dxy_cov does not equal expected value");
      }
      if (track.tk_qoverp_dsz_cov() != expectedTrackFloatingPointValues_[19] + offset) {
        throwWithMessage("analyzeTracks, tk_qoverp_dsz_cov does not equal expected value");
      }
      if (track.tk_lambda_phi_cov() != expectedTrackFloatingPointValues_[20] + offset) {
        throwWithMessage("analyzeTracks, tk_lambda_phi_cov does not equal expected value");
      }
      if (track.tk_lambda_dxy_cov() != expectedTrackFloatingPointValues_[21] + offset) {
        throwWithMessage("analyzeTracks, tk_lambda_dxy_cov does not equal expected value");
      }
      if (track.tk_lambda_dsz_cov() != expectedTrackFloatingPointValues_[22] + offset) {
        throwWithMessage("analyzeTracks, tk_lambda_dsz_cov does not equal expected value");
      }
      if (track.tk_phi_dxy_cov() != expectedTrackFloatingPointValues_[23] + offset) {
        throwWithMessage("analyzeTracks, tk_phi_dxy_cov does not equal expected value");
      }
      if (track.tk_phi_dsz_cov() != expectedTrackFloatingPointValues_[24] + offset) {
        throwWithMessage("analyzeTracks, tk_phi_dsz_cov does not equal expected value");
      }
      if (track.tk_dxy_dsz_cov() != expectedTrackFloatingPointValues_[25] + offset) {
        throwWithMessage("analyzeTracks, tk_dxy_dsz_cov does not equal expected value");
      }
      if (track.tk_vtxInd() != expectedTrackIntegralValues_[4] + iOffset) {
        throwWithMessage("analyzeTracks, tk_vtxInd does not equal expected value");
      }
      if (track.tk_vx() != expectedTrackFloatingPointValues_[26] + offset) {
        throwWithMessage("analyzeTracks, tk_vx does not equal expected value");
      }
      if (track.tk_vy() != expectedTrackFloatingPointValues_[27] + offset) {
        throwWithMessage("analyzeTracks, tk_vy does not equal expected value");
      }
      if (track.tk_vz() != expectedTrackFloatingPointValues_[28] + offset) {
        throwWithMessage("analyzeTracks, float tk_vz does not equal expected value");
      }
      ++i;
    }
  }

  void TestReadRun3Scouting::analyzeVertexes(edm::Event const& iEvent) const {
    auto const& vertexes = iEvent.get(vertexesToken_);
    unsigned int vectorSize = 2 + iEvent.id().event() % 4;
    if (vertexes.size() != vectorSize) {
      throwWithMessage("analyzeVertexes, vertexes does not have expected size");
    }
    unsigned int i = 0;
    for (auto const& vertex : vertexes) {
      double offset = static_cast<double>(iEvent.id().event() + i);
      int iOffset = static_cast<int>(iEvent.id().event() + i);

      if (vertex.x() != expectedVertexFloatingPointValues_[0] + offset) {
        throwWithMessage("analyzeVertexes, x does not equal expected value");
      }
      if (vertex.y() != expectedVertexFloatingPointValues_[1] + offset) {
        throwWithMessage("analyzeVertexes, y does not equal expected value");
      }
      if (vertex.z() != expectedVertexFloatingPointValues_[2] + offset) {
        throwWithMessage("analyzeVertexes, z does not equal expected value");
      }
      if (vertex.zError() != expectedVertexFloatingPointValues_[3] + offset) {
        throwWithMessage("analyzeVertexes, zError does not equal expected value");
      }
      if (vertex.xError() != expectedVertexFloatingPointValues_[4] + offset) {
        throwWithMessage("analyzeVertexes, xError does not equal expected value");
      }
      if (vertex.yError() != expectedVertexFloatingPointValues_[5] + offset) {
        throwWithMessage("analyzeVertexes, yError does not equal expected value");
      }
      if (vertex.tracksSize() != expectedVertexIntegralValues_[0] + iOffset) {
        throwWithMessage("analyzeVertexes, tracksSize does not equal expected value");
      }
      if (vertex.chi2() != expectedVertexFloatingPointValues_[6] + offset) {
        throwWithMessage("analyzeVertexes, chi2 does not equal expected value");
      }
      if (vertex.ndof() != expectedVertexIntegralValues_[1] + iOffset) {
        throwWithMessage("analyzeVertexes, ndof does not equal expected value");
      }
      if (vertex.isValidVtx() != static_cast<bool>((expectedVertexIntegralValues_[2] + iOffset) % 2)) {
        throwWithMessage("analyzeVertexes, isValidVtx does not equal expected value");
      }

      if (inputVertexClassVersion_ == 4) {
        if (vertex.xyCov() != expectedVertexFloatingPointValues_[7] + offset) {
          throwWithMessage("analyzeVertexes, xy cov. does not equal expected value");
        }
        if (vertex.xzCov() != expectedVertexFloatingPointValues_[8] + offset) {
          throwWithMessage("analyzeVertexes, xz cov. does not equal expected value");
        }
        if (vertex.yzCov() != expectedVertexFloatingPointValues_[9] + offset) {
          throwWithMessage("analyzeVertexes, yz cov. does not equal expected value");
        }
      }
      ++i;
    }
  }

  void TestReadRun3Scouting::throwWithMessageFromConstructor(const char* msg) const {
    throw cms::Exception("TestFailure") << "TestReadRun3Scouting constructor, " << msg;
  }

  void TestReadRun3Scouting::throwWithMessage(const char* msg) const {
    throw cms::Exception("TestFailure") << "TestReadRun3Scouting::analyze, " << msg;
  }

}  // namespace edmtest

using edmtest::TestReadRun3Scouting;
DEFINE_FWK_MODULE(TestReadRun3Scouting);