Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-06-05 01:26:11

0001 // -*- C++ -*-
0002 //
0003 // Package:    DataFormats/Scouting
0004 // Class:      TestReadRun3Scouting
0005 //
0006 /**\class edmtest::TestReadRun3Scouting
0007   Description: Used as part of tests that ensure the run 3 Scouting
0008   data formats can be persistently written and in a subsequent process
0009   read. First, this is done using the current release version for writing
0010   and reading. In addition, the output file of the write process should
0011   be saved permanently each time a run 3 Scouting persistent data
0012   format changes. In unit tests, we read each of those saved files to verify
0013   that the current releases can read older versions of these data formats.
0014 */
0015 // Original Author:  W. David Dagenhart
0016 //         Created:  18 May 2023
0017 
0018 #include "DataFormats/Scouting/interface/Run3ScoutingCaloJet.h"
0019 #include "DataFormats/Scouting/interface/Run3ScoutingElectron.h"
0020 #include "DataFormats/Scouting/interface/Run3ScoutingHitPatternPOD.h"
0021 #include "DataFormats/Scouting/interface/Run3ScoutingMuon.h"
0022 #include "DataFormats/Scouting/interface/Run3ScoutingParticle.h"
0023 #include "DataFormats/Scouting/interface/Run3ScoutingPFJet.h"
0024 #include "DataFormats/Scouting/interface/Run3ScoutingPhoton.h"
0025 #include "DataFormats/Scouting/interface/Run3ScoutingTrack.h"
0026 #include "DataFormats/Scouting/interface/Run3ScoutingVertex.h"
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/Frameworkfwd.h"
0029 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0030 #include "FWCore/Framework/interface/MakerMacros.h"
0031 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0033 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0034 #include "FWCore/Utilities/interface/EDGetToken.h"
0035 #include "FWCore/Utilities/interface/Exception.h"
0036 #include "FWCore/Utilities/interface/InputTag.h"
0037 #include "FWCore/Utilities/interface/StreamID.h"
0038 
0039 #include <vector>
0040 
0041 namespace edmtest {
0042 
0043   class TestReadRun3Scouting : public edm::global::EDAnalyzer<> {
0044   public:
0045     TestReadRun3Scouting(edm::ParameterSet const&);
0046     void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
0047     static void fillDescriptions(edm::ConfigurationDescriptions&);
0048 
0049   private:
0050     void analyzeCaloJets(edm::Event const&) const;
0051     void analyzeElectrons(edm::Event const&) const;
0052     void analyzeMuons(edm::Event const&) const;
0053     void analyzeParticles(edm::Event const&) const;
0054     void analyzePFJets(edm::Event const&) const;
0055     void analyzePhotons(edm::Event const&) const;
0056     void analyzeTracks(edm::Event const&) const;
0057     void analyzeVertexes(edm::Event const&) const;
0058 
0059     void throwWithMessageFromConstructor(const char*) const;
0060     void throwWithMessage(const char*) const;
0061 
0062     // These expected values are meaningless other than we use them
0063     // to check that values read from persistent storage match the values
0064     // we know were written.
0065 
0066     const std::vector<double> expectedCaloJetsValues_;
0067     const edm::EDGetTokenT<std::vector<Run3ScoutingCaloJet>> caloJetsToken_;
0068 
0069     const int inputElectronClassVersion_;
0070     const std::vector<double> expectedElectronFloatingPointValues_;
0071     const std::vector<int> expectedElectronIntegralValues_;
0072     const edm::EDGetTokenT<std::vector<Run3ScoutingElectron>> electronsToken_;
0073 
0074     const std::vector<double> expectedMuonFloatingPointValues_;
0075     const std::vector<int> expectedMuonIntegralValues_;
0076     const edm::EDGetTokenT<std::vector<Run3ScoutingMuon>> muonsToken_;
0077 
0078     const std::vector<double> expectedParticleFloatingPointValues_;
0079     const std::vector<int> expectedParticleIntegralValues_;
0080     const edm::EDGetTokenT<std::vector<Run3ScoutingParticle>> particlesToken_;
0081 
0082     const std::vector<double> expectedPFJetFloatingPointValues_;
0083     const std::vector<int> expectedPFJetIntegralValues_;
0084     const edm::EDGetTokenT<std::vector<Run3ScoutingPFJet>> pfJetsToken_;
0085 
0086     const std::vector<double> expectedPhotonFloatingPointValues_;
0087     const std::vector<int> expectedPhotonIntegralValues_;
0088     const edm::EDGetTokenT<std::vector<Run3ScoutingPhoton>> photonsToken_;
0089 
0090     const std::vector<double> expectedTrackFloatingPointValues_;
0091     const std::vector<int> expectedTrackIntegralValues_;
0092     const edm::EDGetTokenT<std::vector<Run3ScoutingTrack>> tracksToken_;
0093 
0094     const std::vector<double> expectedVertexFloatingPointValues_;
0095     const std::vector<int> expectedVertexIntegralValues_;
0096     const edm::EDGetTokenT<std::vector<Run3ScoutingVertex>> vertexesToken_;
0097   };
0098 
0099   TestReadRun3Scouting::TestReadRun3Scouting(edm::ParameterSet const& iPSet)
0100       : expectedCaloJetsValues_(iPSet.getParameter<std::vector<double>>("expectedCaloJetsValues")),
0101         caloJetsToken_(consumes(iPSet.getParameter<edm::InputTag>("caloJetsTag"))),
0102         inputElectronClassVersion_(iPSet.getParameter<int>("electronClassVersion")),
0103         expectedElectronFloatingPointValues_(
0104             iPSet.getParameter<std::vector<double>>("expectedElectronFloatingPointValues")),
0105         expectedElectronIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedElectronIntegralValues")),
0106         electronsToken_(consumes(iPSet.getParameter<edm::InputTag>("electronsTag"))),
0107         expectedMuonFloatingPointValues_(iPSet.getParameter<std::vector<double>>("expectedMuonFloatingPointValues")),
0108         expectedMuonIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedMuonIntegralValues")),
0109         muonsToken_(consumes(iPSet.getParameter<edm::InputTag>("muonsTag"))),
0110         expectedParticleFloatingPointValues_(
0111             iPSet.getParameter<std::vector<double>>("expectedParticleFloatingPointValues")),
0112         expectedParticleIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedParticleIntegralValues")),
0113         particlesToken_(consumes(iPSet.getParameter<edm::InputTag>("particlesTag"))),
0114         expectedPFJetFloatingPointValues_(iPSet.getParameter<std::vector<double>>("expectedPFJetFloatingPointValues")),
0115         expectedPFJetIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedPFJetIntegralValues")),
0116         pfJetsToken_(consumes(iPSet.getParameter<edm::InputTag>("pfJetsTag"))),
0117         expectedPhotonFloatingPointValues_(
0118             iPSet.getParameter<std::vector<double>>("expectedPhotonFloatingPointValues")),
0119         expectedPhotonIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedPhotonIntegralValues")),
0120         photonsToken_(consumes(iPSet.getParameter<edm::InputTag>("photonsTag"))),
0121         expectedTrackFloatingPointValues_(iPSet.getParameter<std::vector<double>>("expectedTrackFloatingPointValues")),
0122         expectedTrackIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedTrackIntegralValues")),
0123         tracksToken_(consumes(iPSet.getParameter<edm::InputTag>("tracksTag"))),
0124         expectedVertexFloatingPointValues_(
0125             iPSet.getParameter<std::vector<double>>("expectedVertexFloatingPointValues")),
0126         expectedVertexIntegralValues_(iPSet.getParameter<std::vector<int>>("expectedVertexIntegralValues")),
0127         vertexesToken_(consumes(iPSet.getParameter<edm::InputTag>("vertexesTag"))) {
0128     if (expectedCaloJetsValues_.size() != 16) {
0129       throwWithMessageFromConstructor("test configuration error, expectedCaloJetsValues must have size 16");
0130     }
0131     if (expectedElectronFloatingPointValues_.size() != 25) {
0132       throwWithMessageFromConstructor(
0133           "test configuration error, expectedElectronFloatingPointValues must have size 25");
0134     }
0135     if (expectedElectronIntegralValues_.size() != 6) {
0136       throwWithMessageFromConstructor("test configuration error, expectedElectronIntegralValues must have size 6");
0137     }
0138     if (expectedMuonFloatingPointValues_.size() != 37) {
0139       throwWithMessageFromConstructor("test configuration error, expectedMuonFloatingPointValues must have size 37");
0140     }
0141     if (expectedMuonIntegralValues_.size() != 26) {
0142       throwWithMessageFromConstructor("test configuration error, expectedMuonIntegralValues must have size 26");
0143     }
0144     if (expectedParticleFloatingPointValues_.size() != 11) {
0145       throwWithMessageFromConstructor(
0146           "test configuration error, expectedParticleFloatingPointValues must have size 11");
0147     }
0148     if (expectedParticleIntegralValues_.size() != 5) {
0149       throwWithMessageFromConstructor("test configuration error, expectedParticleIntegralValues must have size 5");
0150     }
0151     if (expectedPFJetFloatingPointValues_.size() != 15) {
0152       throwWithMessageFromConstructor("test configuration error, expectedPFJetFloatingPointValues must have size 15");
0153     }
0154     if (expectedPFJetIntegralValues_.size() != 8) {
0155       throwWithMessageFromConstructor("test configuration error, expectedPFJetIntegralValues must have size 8");
0156     }
0157     if (expectedPhotonFloatingPointValues_.size() != 14) {
0158       throwWithMessageFromConstructor("test configuration error, expectedPhotonFloatingPointValues must have size 14");
0159     }
0160     if (expectedPhotonIntegralValues_.size() != 3) {
0161       throwWithMessageFromConstructor("test configuration error, expectedPhotonIntegralValues must have size 3");
0162     }
0163     if (expectedTrackFloatingPointValues_.size() != 29) {
0164       throwWithMessageFromConstructor("test configuration error, expectedTrackFloatingPointValues must have size 29");
0165     }
0166     if (expectedTrackIntegralValues_.size() != 5) {
0167       throwWithMessageFromConstructor("test configuration error, expectedTrackIntegralValues must have size 5");
0168     }
0169     if (expectedVertexFloatingPointValues_.size() != 7) {
0170       throwWithMessageFromConstructor("test configuration error, expectedVertexFloatingPointValues must have size 7");
0171     }
0172     if (expectedVertexIntegralValues_.size() != 3) {
0173       throwWithMessageFromConstructor("test configuration error, expectedVertexIntegralValues must have size 3");
0174     }
0175   }
0176 
0177   void TestReadRun3Scouting::analyze(edm::StreamID, edm::Event const& iEvent, edm::EventSetup const&) const {
0178     analyzeCaloJets(iEvent);
0179     analyzeElectrons(iEvent);
0180     analyzeMuons(iEvent);
0181     analyzeParticles(iEvent);
0182     analyzePFJets(iEvent);
0183     analyzePhotons(iEvent);
0184     analyzeTracks(iEvent);
0185     analyzeVertexes(iEvent);
0186   }
0187 
0188   void TestReadRun3Scouting::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0189     edm::ParameterSetDescription desc;
0190     desc.add<std::vector<double>>("expectedCaloJetsValues");
0191     desc.add<edm::InputTag>("caloJetsTag");
0192     desc.add<int>("electronClassVersion");
0193     desc.add<std::vector<double>>("expectedElectronFloatingPointValues");
0194     desc.add<std::vector<int>>("expectedElectronIntegralValues");
0195     desc.add<edm::InputTag>("electronsTag");
0196     desc.add<std::vector<double>>("expectedMuonFloatingPointValues");
0197     desc.add<std::vector<int>>("expectedMuonIntegralValues");
0198     desc.add<edm::InputTag>("muonsTag");
0199     desc.add<std::vector<double>>("expectedParticleFloatingPointValues");
0200     desc.add<std::vector<int>>("expectedParticleIntegralValues");
0201     desc.add<edm::InputTag>("particlesTag");
0202     desc.add<std::vector<double>>("expectedPFJetFloatingPointValues");
0203     desc.add<std::vector<int>>("expectedPFJetIntegralValues");
0204     desc.add<edm::InputTag>("pfJetsTag");
0205     desc.add<std::vector<double>>("expectedPhotonFloatingPointValues");
0206     desc.add<std::vector<int>>("expectedPhotonIntegralValues");
0207     desc.add<edm::InputTag>("photonsTag");
0208     desc.add<std::vector<double>>("expectedTrackFloatingPointValues");
0209     desc.add<std::vector<int>>("expectedTrackIntegralValues");
0210     desc.add<edm::InputTag>("tracksTag");
0211     desc.add<std::vector<double>>("expectedVertexFloatingPointValues");
0212     desc.add<std::vector<int>>("expectedVertexIntegralValues");
0213     desc.add<edm::InputTag>("vertexesTag");
0214     descriptions.addDefault(desc);
0215   }
0216 
0217   void TestReadRun3Scouting::analyzeCaloJets(edm::Event const& iEvent) const {
0218     auto const& caloJets = iEvent.get(caloJetsToken_);
0219     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0220     if (caloJets.size() != vectorSize) {
0221       throwWithMessage("analyzeCaloJets, caloJets does not have expected size");
0222     }
0223     unsigned int i = 0;
0224     for (auto const& caloJet : caloJets) {
0225       double offset = static_cast<double>(iEvent.id().event() + i);
0226 
0227       if (caloJet.pt() != expectedCaloJetsValues_[0] + offset) {
0228         throwWithMessage("analyzeCaloJets, pt does not equal expected value");
0229       }
0230       if (caloJet.eta() != expectedCaloJetsValues_[1] + offset) {
0231         throwWithMessage("analyzeCaloJets, eta does not equal expected value");
0232       }
0233       if (caloJet.phi() != expectedCaloJetsValues_[2] + offset) {
0234         throwWithMessage("analyzeCaloJets, phi does not equal expected value");
0235       }
0236       if (caloJet.m() != expectedCaloJetsValues_[3] + offset) {
0237         throwWithMessage("analyzeCaloJets, m does not equal expected value");
0238       }
0239       if (caloJet.jetArea() != expectedCaloJetsValues_[4] + offset) {
0240         throwWithMessage("analyzeCaloJets, jetArea does not equal expected value");
0241       }
0242       if (caloJet.maxEInEmTowers() != expectedCaloJetsValues_[5] + offset) {
0243         throwWithMessage("analyzeCaloJets,  maxEInEmTowers() does not equal expected value");
0244       }
0245       if (caloJet.maxEInHadTowers() != expectedCaloJetsValues_[6] + offset) {
0246         throwWithMessage("analyzeCaloJets,  maxEInHadTowers does not equal expected value");
0247       }
0248       if (caloJet.hadEnergyInHB() != expectedCaloJetsValues_[7] + offset) {
0249         throwWithMessage("analyzeCaloJets, hadEnergyInHB does not equal expected value");
0250       }
0251       if (caloJet.hadEnergyInHE() != expectedCaloJetsValues_[8] + offset) {
0252         throwWithMessage("analyzeCaloJets, hadEnergyInHE does not equal expected value");
0253       }
0254       if (caloJet.hadEnergyInHF() != expectedCaloJetsValues_[9] + offset) {
0255         throwWithMessage("analyzeCaloJets, hadEnergyInHF does not equal expected value");
0256       }
0257       if (caloJet.emEnergyInEB() != expectedCaloJetsValues_[10] + offset) {
0258         throwWithMessage("analyzeCaloJets, emEnergyInEB does not equal expected value");
0259       }
0260       if (caloJet.emEnergyInEE() != expectedCaloJetsValues_[11] + offset) {
0261         throwWithMessage("analyzeCaloJets, emEnergyInEE does not equal expected value");
0262       }
0263       if (caloJet.emEnergyInHF() != expectedCaloJetsValues_[12] + offset) {
0264         throwWithMessage("analyzeCaloJets, emEnergyInHF does not equal expected value");
0265       }
0266       if (caloJet.towersArea() != expectedCaloJetsValues_[13] + offset) {
0267         throwWithMessage("analyzeCaloJets, towersArea does not equal expected value");
0268       }
0269       if (caloJet.mvaDiscriminator() != expectedCaloJetsValues_[14] + offset) {
0270         throwWithMessage("analyzeCaloJets,  mvaDiscriminator does not equal expected value");
0271       }
0272       if (caloJet.btagDiscriminator() != expectedCaloJetsValues_[15] + offset) {
0273         throwWithMessage("analyzeCaloJets,  btagDiscriminator does not equal expected value");
0274       }
0275       ++i;
0276     }
0277   }
0278 
0279   void TestReadRun3Scouting::analyzeElectrons(edm::Event const& iEvent) const {
0280     auto const& electrons = iEvent.get(electronsToken_);
0281     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0282     if (electrons.size() != vectorSize) {
0283       throwWithMessage("analyzeElectrons, electrons does not have expected size");
0284     }
0285     unsigned int i = 0;
0286     for (auto const& electron : electrons) {
0287       double offset = static_cast<double>(iEvent.id().event() + i);
0288       int iOffset = static_cast<int>(iEvent.id().event() + i);
0289 
0290       if (electron.pt() != expectedElectronFloatingPointValues_[0] + offset) {
0291         throwWithMessage("analyzeElectrons, pt does not equal expected value");
0292       }
0293       if (electron.eta() != expectedElectronFloatingPointValues_[1] + offset) {
0294         throwWithMessage("analyzeElectrons, eta does not equal expected value");
0295       }
0296       if (electron.phi() != expectedElectronFloatingPointValues_[2] + offset) {
0297         throwWithMessage("analyzeElectrons, phi does not equal expected value");
0298       }
0299       if (electron.m() != expectedElectronFloatingPointValues_[3] + offset) {
0300         throwWithMessage("analyzeElectrons, m does not equal expected value");
0301       }
0302       if (inputElectronClassVersion_ == 5) {
0303         if (electron.trkd0().size() != 1) {
0304           throwWithMessage("analyzeElectrons, trkd0 does not have expected size");
0305         }
0306         if (electron.trkd0()[0] != expectedElectronFloatingPointValues_[4] + offset) {
0307           throwWithMessage("analyzeElectrons, d0 does not equal expected value");
0308         }
0309         if (electron.trkdz().size() != 1) {
0310           throwWithMessage("analyzeElectrons, trkdz does not have expected size");
0311         }
0312         if (electron.trkdz()[0] != expectedElectronFloatingPointValues_[5] + offset) {
0313           throwWithMessage("analyzeElectrons,  dz does not equal expected value");
0314         }
0315       }
0316       if (electron.dEtaIn() != expectedElectronFloatingPointValues_[6] + offset) {
0317         throwWithMessage("analyzeElectrons,  dEtaIn does not equal expected value");
0318       }
0319       if (electron.dPhiIn() != expectedElectronFloatingPointValues_[7] + offset) {
0320         throwWithMessage("analyzeElectrons, dPhiIn does not equal expected value");
0321       }
0322       if (electron.sigmaIetaIeta() != expectedElectronFloatingPointValues_[8] + offset) {
0323         throwWithMessage("analyzeElectrons, sigmaIetaIeta does not equal expected value");
0324       }
0325       if (electron.hOverE() != expectedElectronFloatingPointValues_[9] + offset) {
0326         throwWithMessage("analyzeElectrons, hOverE does not equal expected value");
0327       }
0328       if (electron.ooEMOop() != expectedElectronFloatingPointValues_[10] + offset) {
0329         throwWithMessage("analyzeElectrons, ooEMOop does not equal expected value");
0330       }
0331       if (electron.missingHits() != expectedElectronIntegralValues_[0] + iOffset) {
0332         throwWithMessage("analyzeElectrons, missingHits does not equal expected value");
0333       }
0334       if (inputElectronClassVersion_ == 5) {
0335         if (electron.trkcharge().size() != 1) {
0336           throwWithMessage("analyzeElectrons, trkcharge does not have expected size");
0337         }
0338         if (electron.trkcharge()[0] != expectedElectronIntegralValues_[1] + iOffset) {
0339           throwWithMessage("analyzeElectrons, charge does not equal expected value");
0340         }
0341       }
0342       if (electron.ecalIso() != expectedElectronFloatingPointValues_[11] + offset) {
0343         throwWithMessage("analyzeElectrons, ecalIso does not equal expected value");
0344       }
0345       if (electron.hcalIso() != expectedElectronFloatingPointValues_[12] + offset) {
0346         throwWithMessage("analyzeElectrons, hcalIso does not equal expected value");
0347       }
0348       if (electron.trackIso() != expectedElectronFloatingPointValues_[13] + offset) {
0349         throwWithMessage("analyzeElectrons, trackIso does not equal expected value");
0350       }
0351       if (electron.r9() != expectedElectronFloatingPointValues_[14] + offset) {
0352         throwWithMessage("analyzeElectrons, r9 does not equal expected value");
0353       }
0354       if (electron.sMin() != expectedElectronFloatingPointValues_[15] + offset) {
0355         throwWithMessage("analyzeElectrons, sMin does not equal expected value");
0356       }
0357       if (electron.sMaj() != expectedElectronFloatingPointValues_[16] + offset) {
0358         throwWithMessage("analyzeElectrons, sMaj does not equal expected value");
0359       }
0360       if (electron.seedId() != static_cast<unsigned int>(expectedElectronIntegralValues_[2] + iOffset)) {
0361         throwWithMessage("analyzeElectrons, seedId does not equal expected value");
0362       }
0363       if (electron.energyMatrix().size() != vectorSize) {
0364         throwWithMessage("analyzeElectrons, energyMatrix does not have expected size");
0365       }
0366       unsigned int j = 0;
0367       for (auto const& val : electron.energyMatrix()) {
0368         if (val != expectedElectronFloatingPointValues_[17] + offset + 10 * j) {
0369           throwWithMessage("analyzeElectrons, energyMatrix does not contain expected value");
0370         }
0371         ++j;
0372       }
0373       if (electron.detIds().size() != vectorSize) {
0374         throwWithMessage("analyzeElectrons, detIds does not have expected size");
0375       }
0376       j = 0;
0377       for (auto const& val : electron.detIds()) {
0378         if (val != expectedElectronIntegralValues_[3] + iOffset + 10 * j) {
0379           throwWithMessage("analyzeElectrons, detIds does not contain expected value");
0380         }
0381         ++j;
0382       }
0383       if (electron.timingMatrix().size() != vectorSize) {
0384         throwWithMessage("analyzeElectrons, timingMatrix does not have expected size");
0385       }
0386       j = 0;
0387       for (auto const& val : electron.timingMatrix()) {
0388         if (val != expectedElectronFloatingPointValues_[18] + offset + 10 * j) {
0389           throwWithMessage("analyzeElectrons, timingMatrix does not contain expected value");
0390         }
0391         ++j;
0392       }
0393       if (electron.rechitZeroSuppression() != static_cast<bool>((expectedElectronIntegralValues_[4] + iOffset) % 2)) {
0394         throwWithMessage("analyzeElectrons, rechitZeroSuppression does not equal expected value");
0395       }
0396       if (inputElectronClassVersion_ == 6) {
0397         if (electron.trkd0().size() != vectorSize) {
0398           throwWithMessage("analyzeElectrons, trkd0 does not have expected size");
0399         }
0400         j = 0;
0401         for (auto const& val : electron.trkd0()) {
0402           if (val != expectedElectronFloatingPointValues_[19] + offset + 10 * j) {
0403             throwWithMessage("analyzeElectrons, trkd0 does not contain expected value");
0404           }
0405           ++j;
0406         }
0407         if (electron.trkdz().size() != vectorSize) {
0408           throwWithMessage("analyzeElectrons, trkdz does not have expected size");
0409         }
0410         j = 0;
0411         for (auto const& val : electron.trkdz()) {
0412           if (val != expectedElectronFloatingPointValues_[20] + offset + 10 * j) {
0413             throwWithMessage("analyzeElectrons, trkdz does not contain expected value");
0414           }
0415           ++j;
0416         }
0417         if (electron.trkpt().size() != vectorSize) {
0418           throwWithMessage("analyzeElectrons, trkpt does not have expected size");
0419         }
0420         j = 0;
0421         for (auto const& val : electron.trkpt()) {
0422           if (val != expectedElectronFloatingPointValues_[21] + offset + 10 * j) {
0423             throwWithMessage("analyzeElectrons, trkpt does not contain expected value");
0424           }
0425           ++j;
0426         }
0427         if (electron.trketa().size() != vectorSize) {
0428           throwWithMessage("analyzeElectrons, trketa does not have expected size");
0429         }
0430         j = 0;
0431         for (auto const& val : electron.trketa()) {
0432           if (val != expectedElectronFloatingPointValues_[22] + offset + 10 * j) {
0433             throwWithMessage("analyzeElectrons, trketa does not contain expected value");
0434           }
0435           ++j;
0436         }
0437         if (electron.trkphi().size() != vectorSize) {
0438           throwWithMessage("analyzeElectrons, trkphi does not have expected size");
0439         }
0440         j = 0;
0441         for (auto const& val : electron.trkphi()) {
0442           if (val != expectedElectronFloatingPointValues_[23] + offset + 10 * j) {
0443             throwWithMessage("analyzeElectrons, trkphi does not contain expected value");
0444           }
0445           ++j;
0446         }
0447         if (electron.trkchi2overndf().size() != vectorSize) {
0448           throwWithMessage("analyzeElectrons, trkchi2overndf does not have expected size");
0449         }
0450         j = 0;
0451         for (auto const& val : electron.trkchi2overndf()) {
0452           if (val != expectedElectronFloatingPointValues_[24] + offset + 10 * j) {
0453             throwWithMessage("analyzeElectrons, trkchi2overndf does not contain expected value");
0454           }
0455           ++j;
0456         }
0457         if (electron.trkcharge().size() != vectorSize) {
0458           throwWithMessage("analyzeElectrons, trkcharge does not have expected size");
0459         }
0460         j = 0;
0461         for (auto const& val : electron.trkcharge()) {
0462           if (val != static_cast<int>(expectedElectronIntegralValues_[5] + iOffset + 10 * j)) {
0463             throwWithMessage("analyzeElectrons, trkcharge does not contain expected value");
0464           }
0465           ++j;
0466         }
0467       }
0468       ++i;
0469     }
0470   }
0471 
0472   void TestReadRun3Scouting::analyzeMuons(edm::Event const& iEvent) const {
0473     auto const& muons = iEvent.get(muonsToken_);
0474     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0475     if (muons.size() != vectorSize) {
0476       throwWithMessage("analyzeMuons, muons does not have expected size");
0477     }
0478     unsigned int i = 0;
0479     for (auto const& muon : muons) {
0480       double offset = static_cast<double>(iEvent.id().event() + i);
0481       int iOffset = static_cast<int>(iEvent.id().event() + i);
0482 
0483       if (muon.pt() != expectedMuonFloatingPointValues_[0] + offset) {
0484         throwWithMessage("analyzeMuons, pt does not equal expected value");
0485       }
0486       if (muon.eta() != expectedMuonFloatingPointValues_[1] + offset) {
0487         throwWithMessage("analyzeMuons, eta does not equal expected value");
0488       }
0489       if (muon.phi() != expectedMuonFloatingPointValues_[2] + offset) {
0490         throwWithMessage("analyzeMuons, phi does not equal expected value");
0491       }
0492       if (muon.m() != expectedMuonFloatingPointValues_[3] + offset) {
0493         throwWithMessage("analyzeMuons, m does not equal expected value");
0494       }
0495       if (muon.type() != static_cast<unsigned int>(expectedMuonIntegralValues_[0] + iOffset)) {
0496         throwWithMessage("analyzeMuons, type does not equal expected value");
0497       }
0498       if (muon.charge() != expectedMuonIntegralValues_[1] + iOffset) {
0499         throwWithMessage("analyzeMuons, charge does not equal expected value");
0500       }
0501       if (muon.normalizedChi2() != expectedMuonFloatingPointValues_[4] + offset) {
0502         throwWithMessage("analyzeMuons,  normalizedChi2 does not equal expected value");
0503       }
0504       if (muon.ecalIso() != expectedMuonFloatingPointValues_[5] + offset) {
0505         throwWithMessage("analyzeMuons, ecalIso does not equal expected value");
0506       }
0507       if (muon.hcalIso() != expectedMuonFloatingPointValues_[6] + offset) {
0508         throwWithMessage("analyzeMuons, hcalIso does not equal expected value");
0509       }
0510       if (muon.trackIso() != expectedMuonFloatingPointValues_[7] + offset) {
0511         throwWithMessage("analyzeMuons, trackIso does not equal expected value");
0512       }
0513       if (muon.nValidStandAloneMuonHits() != expectedMuonIntegralValues_[2] + iOffset) {
0514         throwWithMessage("analyzeMuons, nValidStandAloneMuonHits does not equal expected value");
0515       }
0516       if (muon.nStandAloneMuonMatchedStations() != expectedMuonIntegralValues_[3] + iOffset) {
0517         throwWithMessage("analyzeMuons, nStandAloneMuonMatchedStations does not equal expected value");
0518       }
0519       if (muon.nValidRecoMuonHits() != expectedMuonIntegralValues_[4] + iOffset) {
0520         throwWithMessage("analyzeMuons, nValidRecoMuonHits does not equal expected value");
0521       }
0522       if (muon.nRecoMuonChambers() != expectedMuonIntegralValues_[5] + iOffset) {
0523         throwWithMessage("analyzeMuons, nRecoMuonChambers does not equal expected value");
0524       }
0525       if (muon.nRecoMuonChambersCSCorDT() != expectedMuonIntegralValues_[6] + iOffset) {
0526         throwWithMessage("analyzeMuons, nRecoMuonChambersCSCorDT does not equal expected value");
0527       }
0528       if (muon.nRecoMuonMatches() != expectedMuonIntegralValues_[7] + iOffset) {
0529         throwWithMessage("analyzeMuons, nRecoMuonMatches does not equal expected value");
0530       }
0531       if (muon.nRecoMuonMatchedStations() != expectedMuonIntegralValues_[8] + iOffset) {
0532         throwWithMessage("analyzeMuons, nRecoMuonMatchedStations does not equal expected value");
0533       }
0534       if (muon.nRecoMuonExpectedMatchedStations() !=
0535           static_cast<unsigned int>(expectedMuonIntegralValues_[9] + iOffset)) {
0536         throwWithMessage("analyzeMuons, nRecoMuonExpectedMatchedStations does not equal expected value");
0537       }
0538       if (muon.recoMuonStationMask() != static_cast<unsigned int>(expectedMuonIntegralValues_[10] + iOffset)) {
0539         throwWithMessage("analyzeMuons, recoMuonStationMask does not equal expected value");
0540       }
0541       if (muon.nRecoMuonMatchedRPCLayers() != expectedMuonIntegralValues_[11] + iOffset) {
0542         throwWithMessage("analyzeMuons, nRecoMuonMatchedRPCLayers does not equal expected value");
0543       }
0544       if (muon.recoMuonRPClayerMask() != static_cast<unsigned int>(expectedMuonIntegralValues_[12] + iOffset)) {
0545         throwWithMessage("analyzeMuons, recoMuonRPClayerMask does not equal expected value");
0546       }
0547       if (muon.nValidPixelHits() != expectedMuonIntegralValues_[13] + iOffset) {
0548         throwWithMessage("analyzeMuons, nValidPixelHits does not equal expected value");
0549       }
0550       if (muon.nValidStripHits() != expectedMuonIntegralValues_[14] + iOffset) {
0551         throwWithMessage("analyzeMuons, nValidStripHits does not equal expected value");
0552       }
0553       if (muon.nPixelLayersWithMeasurement() != expectedMuonIntegralValues_[15] + iOffset) {
0554         throwWithMessage("analyzeMuons, nPixelLayersWithMeasurement does not equal expected value");
0555       }
0556       if (muon.nTrackerLayersWithMeasurement() != expectedMuonIntegralValues_[16] + iOffset) {
0557         throwWithMessage("analyzeMuons, nTrackerLayersWithMeasurement does not equal expected value");
0558       }
0559       if (muon.trk_chi2() != expectedMuonFloatingPointValues_[8] + offset) {
0560         throwWithMessage("analyzeMuons, trk_chi2  does not equal expected value");
0561       }
0562       if (muon.trk_ndof() != expectedMuonFloatingPointValues_[9] + offset) {
0563         throwWithMessage("analyzeMuons, trk_ndof does not equal expected value");
0564       }
0565       if (muon.trk_dxy() != expectedMuonFloatingPointValues_[10] + offset) {
0566         throwWithMessage("analyzeMuons, trk_dxy does not equal expected value");
0567       }
0568       if (muon.trk_dz() != expectedMuonFloatingPointValues_[11] + offset) {
0569         throwWithMessage("analyzeMuons, trk_dz does not equal expected value");
0570       }
0571       if (muon.trk_qoverp() != expectedMuonFloatingPointValues_[12] + offset) {
0572         throwWithMessage("analyzeMuons, trk_qoverp does not equal expected value");
0573       }
0574       if (muon.trk_lambda() != expectedMuonFloatingPointValues_[13] + offset) {
0575         throwWithMessage("analyzeMuons, trk_lambda does not equal expected value");
0576       }
0577       if (muon.trk_pt() != expectedMuonFloatingPointValues_[14] + offset) {
0578         throwWithMessage("analyzeMuons, trk_pt does not equal expected value");
0579       }
0580       if (muon.trk_phi() != expectedMuonFloatingPointValues_[15] + offset) {
0581         throwWithMessage("analyzeMuons, trk_phi does not equal expected value");
0582       }
0583       if (muon.trk_eta() != expectedMuonFloatingPointValues_[16] + offset) {
0584         throwWithMessage("analyzeMuons, trk_eta does not equal expected value");
0585       }
0586       if (muon.trk_dxyError() != expectedMuonFloatingPointValues_[17] + offset) {
0587         throwWithMessage("analyzeMuons, trk_dxyError does not equal expected value");
0588       }
0589       if (muon.trk_dzError() != expectedMuonFloatingPointValues_[18] + offset) {
0590         throwWithMessage("analyzeMuons, trk_dzError does not equal expected value");
0591       }
0592       if (muon.trk_qoverpError() != expectedMuonFloatingPointValues_[19] + offset) {
0593         throwWithMessage("analyzeMuons, trk_qoverpError does not equal expected value");
0594       }
0595       if (muon.trk_lambdaError() != expectedMuonFloatingPointValues_[20] + offset) {
0596         throwWithMessage("analyzeMuons, trk_lambdaError does not equal expected value");
0597       }
0598       if (muon.trk_phiError() != expectedMuonFloatingPointValues_[21] + offset) {
0599         throwWithMessage("analyzeMuons, trk_phiError does not equal expected value");
0600       }
0601       if (muon.trk_dsz() != expectedMuonFloatingPointValues_[22] + offset) {
0602         throwWithMessage("analyzeMuons, trk_dsz does not equal expected value");
0603       }
0604       if (muon.trk_dszError() != expectedMuonFloatingPointValues_[23] + offset) {
0605         throwWithMessage("analyzeMuons, trk_dszError does not equal expected value");
0606       }
0607       if (muon.trk_qoverp_lambda_cov() != expectedMuonFloatingPointValues_[24] + offset) {
0608         throwWithMessage("analyzeMuons, trk_qoverp_lambda_cov does not equal expected value");
0609       }
0610       if (muon.trk_qoverp_phi_cov() != expectedMuonFloatingPointValues_[25] + offset) {
0611         throwWithMessage("analyzeMuons, trk_qoverp_phi_cov does not equal expected value");
0612       }
0613       if (muon.trk_qoverp_dxy_cov() != expectedMuonFloatingPointValues_[26] + offset) {
0614         throwWithMessage("analyzeMuons, trk_qoverp_dxy_cov does not equal expected value");
0615       }
0616       if (muon.trk_qoverp_dsz_cov() != expectedMuonFloatingPointValues_[27] + offset) {
0617         throwWithMessage("analyzeMuons, trk_qoverp_dsz_cov does not equal expected value");
0618       }
0619       if (muon.trk_lambda_phi_cov() != expectedMuonFloatingPointValues_[28] + offset) {
0620         throwWithMessage("analyzeMuons, trk_lambda_phi_cov does not equal expected value");
0621       }
0622       if (muon.trk_lambda_dxy_cov() != expectedMuonFloatingPointValues_[29] + offset) {
0623         throwWithMessage("analyzeMuons, trk_lambda_dxy_cov  does not equal expected value");
0624       }
0625       if (muon.trk_lambda_dsz_cov() != expectedMuonFloatingPointValues_[30] + offset) {
0626         throwWithMessage("analyzeMuons, trk_lambda_dsz_cov  does not equal expected value");
0627       }
0628       if (muon.trk_phi_dxy_cov() != expectedMuonFloatingPointValues_[31] + offset) {
0629         throwWithMessage("analyzeMuons, trk_phi_dxy_cov does not equal expected value");
0630       }
0631       if (muon.trk_phi_dsz_cov() != expectedMuonFloatingPointValues_[32] + offset) {
0632         throwWithMessage("analyzeMuons, trk_phi_dsz_cov does not equal expected value");
0633       }
0634       if (muon.trk_dxy_dsz_cov() != expectedMuonFloatingPointValues_[33] + offset) {
0635         throwWithMessage("analyzeMuons, trk_dxy_dsz_cov does not equal expected value");
0636       }
0637       if (muon.trk_vx() != expectedMuonFloatingPointValues_[34] + offset) {
0638         throwWithMessage("analyzeMuons, trk_vx does not equal expected value");
0639       }
0640       if (muon.trk_vy() != expectedMuonFloatingPointValues_[35] + offset) {
0641         throwWithMessage("analyzeMuons, trk_vy does not equal expected value");
0642       }
0643       if (muon.trk_vz() != expectedMuonFloatingPointValues_[36] + offset) {
0644         throwWithMessage("analyzeMuons, trk_vz does not equal expected value");
0645       }
0646       int j = 0;
0647       for (auto const& val : muon.vtxIndx()) {
0648         if (val != expectedMuonIntegralValues_[17] + iOffset + 10 * j) {
0649           throwWithMessage("analyzeMuons, vtxIndx does not contain expected value");
0650         }
0651         ++j;
0652       }
0653       if (muon.trk_hitPattern().hitCount != static_cast<uint8_t>(expectedMuonIntegralValues_[18] + iOffset)) {
0654         throwWithMessage("analyzeMuons, hitCount does not equal expected value");
0655       }
0656       if (muon.trk_hitPattern().beginTrackHits != static_cast<uint8_t>(expectedMuonIntegralValues_[19] + iOffset)) {
0657         throwWithMessage("analyzeMuons, beginTrackHits does not equal expected value");
0658       }
0659       if (muon.trk_hitPattern().endTrackHits != static_cast<uint8_t>(expectedMuonIntegralValues_[20] + iOffset)) {
0660         throwWithMessage("analyzeMuons, endTrackHits does not equal expected value");
0661       }
0662       if (muon.trk_hitPattern().beginInner != static_cast<uint8_t>(expectedMuonIntegralValues_[21] + iOffset)) {
0663         throwWithMessage("analyzeMuons, beginInner does not equal expected value");
0664       }
0665       if (muon.trk_hitPattern().endInner != static_cast<uint8_t>(expectedMuonIntegralValues_[22] + iOffset)) {
0666         throwWithMessage("analyzeMuons, endInner does not equal expected value");
0667       }
0668       if (muon.trk_hitPattern().beginOuter != static_cast<uint8_t>(expectedMuonIntegralValues_[23] + iOffset)) {
0669         throwWithMessage("analyzeMuons, beginOuter does not equal expected value");
0670       }
0671       if (muon.trk_hitPattern().endOuter != static_cast<uint8_t>(expectedMuonIntegralValues_[24] + iOffset)) {
0672         throwWithMessage("analyzeMuons, endOuter does not equal expected value");
0673       }
0674       j = 0;
0675       for (auto const& val : muon.trk_hitPattern().hitPattern) {
0676         if (val != static_cast<uint16_t>(expectedMuonIntegralValues_[25] + iOffset + 10 * j)) {
0677           throwWithMessage("analyzeMuons, hitPattern does not contain expected value");
0678         }
0679         ++j;
0680       }
0681       ++i;
0682     }
0683   }
0684 
0685   void TestReadRun3Scouting::analyzeParticles(edm::Event const& iEvent) const {
0686     auto const& particles = iEvent.get(particlesToken_);
0687     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0688     if (particles.size() != vectorSize) {
0689       throwWithMessage("analyzeParticles, particles does not have expected size");
0690     }
0691     unsigned int i = 0;
0692     for (auto const& particle : particles) {
0693       double offset = static_cast<double>(iEvent.id().event() + i);
0694       int iOffset = static_cast<int>(iEvent.id().event() + i);
0695 
0696       if (particle.pt() != expectedParticleFloatingPointValues_[0] + offset) {
0697         throwWithMessage("analyzeParticles, pt does not equal expected value");
0698       }
0699       if (particle.eta() != expectedParticleFloatingPointValues_[1] + offset) {
0700         throwWithMessage("analyzeParticles, eta does not equal expected value");
0701       }
0702       if (particle.phi() != expectedParticleFloatingPointValues_[2] + offset) {
0703         throwWithMessage("analyzeParticles, phi does not equal expected value");
0704       }
0705       if (particle.pdgId() != expectedParticleIntegralValues_[0] + iOffset) {
0706         throwWithMessage("analyzeParticles, pdgId does not equal expected value");
0707       }
0708       if (particle.vertex() != expectedParticleIntegralValues_[1] + iOffset) {
0709         throwWithMessage("analyzeParticles, vertex does not equal expected value");
0710       }
0711       if (particle.normchi2() != expectedParticleFloatingPointValues_[3] + offset) {
0712         throwWithMessage("analyzeParticles, normchi2 does not equal expected value");
0713       }
0714       if (particle.dz() != expectedParticleFloatingPointValues_[4] + offset) {
0715         throwWithMessage("analyzeParticles, dz does not equal expected value");
0716       }
0717       if (particle.dxy() != expectedParticleFloatingPointValues_[5] + offset) {
0718         throwWithMessage("analyzeParticles, dxy does not equal expected value");
0719       }
0720       if (particle.dzsig() != expectedParticleFloatingPointValues_[6] + offset) {
0721         throwWithMessage("analyzeParticles, dzsig does not equal expected value");
0722       }
0723       if (particle.dxysig() != expectedParticleFloatingPointValues_[7] + offset) {
0724         throwWithMessage("analyzeParticles, dxysig does not equal expected value");
0725       }
0726       if (particle.lostInnerHits() != static_cast<uint8_t>(expectedParticleIntegralValues_[2] + iOffset)) {
0727         throwWithMessage("analyzeParticles, lostInnerHits does not equal expected value");
0728       }
0729       if (particle.quality() != static_cast<uint8_t>(expectedParticleIntegralValues_[3] + iOffset)) {
0730         throwWithMessage("analyzeParticles, quality does not equal expected value");
0731       }
0732       if (particle.trk_pt() != expectedParticleFloatingPointValues_[8] + offset) {
0733         throwWithMessage("analyzeParticles, trk_pt does not equal expected value");
0734       }
0735       if (particle.trk_eta() != expectedParticleFloatingPointValues_[9] + offset) {
0736         throwWithMessage("analyzeParticles, trk_eta does not equal expected value");
0737       }
0738       if (particle.trk_phi() != expectedParticleFloatingPointValues_[10] + offset) {
0739         throwWithMessage("analyzeParticles, trk_phi does not equal expected value");
0740       }
0741       if (particle.relative_trk_vars() != static_cast<bool>((expectedParticleIntegralValues_[4] + iOffset) % 2)) {
0742         throwWithMessage("analyzeParticles, relative_trk_vars does not equal expected value");
0743       }
0744       ++i;
0745     }
0746   }
0747 
0748   void TestReadRun3Scouting::analyzePFJets(edm::Event const& iEvent) const {
0749     auto const& pfJets = iEvent.get(pfJetsToken_);
0750     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0751     if (pfJets.size() != vectorSize) {
0752       throwWithMessage("analyzePFJets, pfJets does not have expected size");
0753     }
0754     unsigned int i = 0;
0755     for (auto const& pfJet : pfJets) {
0756       double offset = static_cast<double>(iEvent.id().event() + i);
0757       int iOffset = static_cast<int>(iEvent.id().event() + i);
0758 
0759       if (pfJet.pt() != expectedPFJetFloatingPointValues_[0] + offset) {
0760         throwWithMessage("analyzePFJets, pt does not equal expected value");
0761       }
0762       if (pfJet.eta() != expectedPFJetFloatingPointValues_[1] + offset) {
0763         throwWithMessage("analyzePFJets, eta does not equal expected value");
0764       }
0765       if (pfJet.phi() != expectedPFJetFloatingPointValues_[2] + offset) {
0766         throwWithMessage("analyzePFJets, phi does not equal expected value");
0767       }
0768       if (pfJet.m() != expectedPFJetFloatingPointValues_[3] + offset) {
0769         throwWithMessage("analyzePFJets, m does not equal expected value");
0770       }
0771       if (pfJet.jetArea() != expectedPFJetFloatingPointValues_[4] + offset) {
0772         throwWithMessage("analyzePFJets, jetArea does not equal expected value");
0773       }
0774       if (pfJet.chargedHadronEnergy() != expectedPFJetFloatingPointValues_[5] + offset) {
0775         throwWithMessage("analyzePFJets, chargedHadronEnergy does not equal expected value");
0776       }
0777       if (pfJet.neutralHadronEnergy() != expectedPFJetFloatingPointValues_[6] + offset) {
0778         throwWithMessage("analyzePFJets, neutralHadronEnergy does not equal expected value");
0779       }
0780       if (pfJet.photonEnergy() != expectedPFJetFloatingPointValues_[7] + offset) {
0781         throwWithMessage("analyzePFJets, photonEnergy does not equal expected value");
0782       }
0783       if (pfJet.electronEnergy() != expectedPFJetFloatingPointValues_[8] + offset) {
0784         throwWithMessage("analyzePFJets, electronEnergy does not equal expected value");
0785       }
0786       if (pfJet.muonEnergy() != expectedPFJetFloatingPointValues_[9] + offset) {
0787         throwWithMessage("analyzePFJets, muonEnergy does not equal expected value");
0788       }
0789       if (pfJet.HFHadronEnergy() != expectedPFJetFloatingPointValues_[10] + offset) {
0790         throwWithMessage("analyzePFJets, HFHadronEnergy does not equal expected value");
0791       }
0792       if (pfJet.HFEMEnergy() != expectedPFJetFloatingPointValues_[11] + offset) {
0793         throwWithMessage("analyzePFJets, HFEMEnergy does not equal expected value");
0794       }
0795       if (pfJet.chargedHadronMultiplicity() != expectedPFJetIntegralValues_[0] + iOffset) {
0796         throwWithMessage("analyzePFJets, chargedHadronMultiplicity does not equal expected value");
0797       }
0798       if (pfJet.neutralHadronMultiplicity() != expectedPFJetIntegralValues_[1] + iOffset) {
0799         throwWithMessage("analyzePFJets, neutralHadronMultiplicity does not equal expected value");
0800       }
0801       if (pfJet.photonMultiplicity() != expectedPFJetIntegralValues_[2] + iOffset) {
0802         throwWithMessage("analyzePFJets, photonMultiplicity does not equal expected value");
0803       }
0804       if (pfJet.electronMultiplicity() != expectedPFJetIntegralValues_[3] + iOffset) {
0805         throwWithMessage("analyzePFJets, electronMultiplicity does not equal expected value");
0806       }
0807       if (pfJet.muonMultiplicity() != expectedPFJetIntegralValues_[4] + iOffset) {
0808         throwWithMessage("analyzePFJets, muonMultiplicity does not equal expected value");
0809       }
0810       if (pfJet.HFHadronMultiplicity() != expectedPFJetIntegralValues_[5] + iOffset) {
0811         throwWithMessage("analyzePFJets, HFHadronMultiplicity does not equal expected value");
0812       }
0813       if (pfJet.HFEMMultiplicity() != expectedPFJetIntegralValues_[6] + iOffset) {
0814         throwWithMessage("analyzePFJets, HFEMMultiplicity does not equal expected value");
0815       }
0816       if (pfJet.HOEnergy() != expectedPFJetFloatingPointValues_[12] + offset) {
0817         throwWithMessage("analyzePFJets, HOEnergy does not equal expected value");
0818       }
0819       if (pfJet.csv() != expectedPFJetFloatingPointValues_[13] + offset) {
0820         throwWithMessage("analyzePFJets, csv does not equal expected value");
0821       }
0822       if (pfJet.mvaDiscriminator() != expectedPFJetFloatingPointValues_[14] + offset) {
0823         throwWithMessage("analyzePFJets, mvaDiscriminator does not equal expected value");
0824       }
0825       int j = 0;
0826       for (auto const& val : pfJet.constituents()) {
0827         if (val != expectedPFJetIntegralValues_[7] + iOffset + 10 * j) {
0828           throwWithMessage("analyzePFJets, constituents does not contain expected value");
0829         }
0830         ++j;
0831       }
0832       ++i;
0833     }
0834   }
0835 
0836   void TestReadRun3Scouting::analyzePhotons(edm::Event const& iEvent) const {
0837     auto const& photons = iEvent.get(photonsToken_);
0838     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0839     if (photons.size() != vectorSize) {
0840       throwWithMessage("analyzePhotons, photons does not have expected size");
0841     }
0842     unsigned int i = 0;
0843     for (auto const& photon : photons) {
0844       double offset = static_cast<double>(iEvent.id().event() + i);
0845       int iOffset = static_cast<int>(iEvent.id().event() + i);
0846 
0847       if (photon.pt() != expectedPhotonFloatingPointValues_[0] + offset) {
0848         throwWithMessage("analyzePhotons, pt does not equal expected value");
0849       }
0850       if (photon.eta() != expectedPhotonFloatingPointValues_[1] + offset) {
0851         throwWithMessage("analyzePhotons, eta does not equal expected value");
0852       }
0853       if (photon.phi() != expectedPhotonFloatingPointValues_[2] + offset) {
0854         throwWithMessage("analyzePhotons, phi does not equal expected value");
0855       }
0856       if (photon.m() != expectedPhotonFloatingPointValues_[3] + offset) {
0857         throwWithMessage("analyzePhotons, m does not equal expected value");
0858       }
0859       if (photon.sigmaIetaIeta() != expectedPhotonFloatingPointValues_[4] + offset) {
0860         throwWithMessage("analyzePhotons, sigmaIetaIeta does not equal expected value");
0861       }
0862       if (photon.hOverE() != expectedPhotonFloatingPointValues_[5] + offset) {
0863         throwWithMessage("analyzePhotons, hOverE does not equal expected value");
0864       }
0865       if (photon.ecalIso() != expectedPhotonFloatingPointValues_[6] + offset) {
0866         throwWithMessage("analyzePhotons, ecalIso does not equal expected value");
0867       }
0868       if (photon.hcalIso() != expectedPhotonFloatingPointValues_[7] + offset) {
0869         throwWithMessage("analyzePhotons, hcalIso does not equal expected value");
0870       }
0871       if (photon.trkIso() != expectedPhotonFloatingPointValues_[8] + offset) {
0872         throwWithMessage("analyzePhotons, trkIso does not equal expected value");
0873       }
0874       if (photon.r9() != expectedPhotonFloatingPointValues_[9] + offset) {
0875         throwWithMessage("analyzePhotons, r9 does not equal expected value");
0876       }
0877       if (photon.sMin() != expectedPhotonFloatingPointValues_[10] + offset) {
0878         throwWithMessage("analyzePhotons, sMin does not equal expected value");
0879       }
0880       if (photon.sMaj() != expectedPhotonFloatingPointValues_[11] + offset) {
0881         throwWithMessage("analyzePhotons, sMaj does not equal expected value");
0882       }
0883       if (photon.seedId() != static_cast<unsigned int>(expectedPhotonIntegralValues_[0] + iOffset)) {
0884         throwWithMessage("analyzePhotons, seedId does not equal expected value");
0885       }
0886 
0887       if (photon.energyMatrix().size() != vectorSize) {
0888         throwWithMessage("analyzePhotons, energyMatrix does not have expected size");
0889       }
0890       unsigned int j = 0;
0891       for (auto const& val : photon.energyMatrix()) {
0892         if (val != expectedPhotonFloatingPointValues_[12] + offset + 10 * j) {
0893           throwWithMessage("analyzePhotons, energyMatrix does not contain expected value");
0894         }
0895         ++j;
0896       }
0897       if (photon.detIds().size() != vectorSize) {
0898         throwWithMessage("analyzePhotons, detIds does not have expected size");
0899       }
0900       j = 0;
0901       for (auto const& val : photon.detIds()) {
0902         if (val != static_cast<uint32_t>(expectedPhotonIntegralValues_[1] + iOffset + 10 * j)) {
0903           throwWithMessage("analyzePhotons, detIds does not contain expected value");
0904         }
0905         ++j;
0906       }
0907       if (photon.timingMatrix().size() != vectorSize) {
0908         throwWithMessage("analyzePhotons, timingMatrix does not have expected size");
0909       }
0910       j = 0;
0911       for (auto const& val : photon.timingMatrix()) {
0912         if (val != expectedPhotonFloatingPointValues_[13] + offset + 10 * j) {
0913           throwWithMessage("analyzePhotons, timingMatrix does not contain expected value");
0914         }
0915         ++j;
0916       }
0917       if (photon.rechitZeroSuppression() != static_cast<bool>((expectedPhotonIntegralValues_[2] + iOffset) % 2)) {
0918         throwWithMessage("analyzePhotons, rechitZeroSuppression does not equal expected value");
0919       }
0920       ++i;
0921     }
0922   }
0923 
0924   void TestReadRun3Scouting::analyzeTracks(edm::Event const& iEvent) const {
0925     auto const& tracks = iEvent.get(tracksToken_);
0926     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0927     if (tracks.size() != vectorSize) {
0928       throwWithMessage("analyzeTracks, tracks does not have expected size");
0929     }
0930     unsigned int i = 0;
0931     for (auto const& track : tracks) {
0932       double offset = static_cast<double>(iEvent.id().event() + i);
0933       int iOffset = static_cast<int>(iEvent.id().event() + i);
0934 
0935       if (track.tk_pt() != expectedTrackFloatingPointValues_[0] + offset) {
0936         throwWithMessage("analyzeTracks, tk_pt does not equal expected value");
0937       }
0938       if (track.tk_eta() != expectedTrackFloatingPointValues_[1] + offset) {
0939         throwWithMessage("analyzeTracks, tk_eta does not equal expected value");
0940       }
0941       if (track.tk_phi() != expectedTrackFloatingPointValues_[2] + offset) {
0942         throwWithMessage("analyzeTracks, tk_phi does not equal expected value");
0943       }
0944       if (track.tk_chi2() != expectedTrackFloatingPointValues_[3] + offset) {
0945         throwWithMessage("analyzeTracks, tk_chi2 does not equal expected value");
0946       }
0947       if (track.tk_ndof() != expectedTrackFloatingPointValues_[4] + offset) {
0948         throwWithMessage("analyzeTracks, tk_ndof does not equal expected value");
0949       }
0950       if (track.tk_charge() != expectedTrackIntegralValues_[0] + iOffset) {
0951         throwWithMessage("analyzeTracks, tk_charge does not equal expected value");
0952       }
0953       if (track.tk_dxy() != expectedTrackFloatingPointValues_[5] + offset) {
0954         throwWithMessage("analyzeTracks, tk_dxy does not equal expected value");
0955       }
0956       if (track.tk_dz() != expectedTrackFloatingPointValues_[6] + offset) {
0957         throwWithMessage("analyzeTracks, tk_dz does not equal expected value");
0958       }
0959       if (track.tk_nValidPixelHits() != expectedTrackIntegralValues_[1] + iOffset) {
0960         throwWithMessage("analyzeTracks, tk_nValidPixelHits does not equal expected value");
0961       }
0962       if (track.tk_nTrackerLayersWithMeasurement() != expectedTrackIntegralValues_[2] + iOffset) {
0963         throwWithMessage("analyzeTracks, tk_nTrackerLayersWithMeasurement does not equal expected value");
0964       }
0965       if (track.tk_nValidStripHits() != expectedTrackIntegralValues_[3] + iOffset) {
0966         throwWithMessage("analyzeTracks, tk_nValidStripHits does not equal expected value");
0967       }
0968       if (track.tk_qoverp() != expectedTrackFloatingPointValues_[7] + offset) {
0969         throwWithMessage("analyzeTracks, tk_qoverp does not equal expected value");
0970       }
0971       if (track.tk_lambda() != expectedTrackFloatingPointValues_[8] + offset) {
0972         throwWithMessage("analyzeTracks, tk_lambda does not equal expected value");
0973       }
0974       if (track.tk_dxy_Error() != expectedTrackFloatingPointValues_[9] + offset) {
0975         throwWithMessage("analyzeTracks, tk_dxy_Error does not equal expected value");
0976       }
0977       if (track.tk_dz_Error() != expectedTrackFloatingPointValues_[10] + offset) {
0978         throwWithMessage("analyzeTracks, tk_dz_Error does not equal expected value");
0979       }
0980       if (track.tk_qoverp_Error() != expectedTrackFloatingPointValues_[11] + offset) {
0981         throwWithMessage("analyzeTracks, tk_qoverp_Error does not equal expected value");
0982       }
0983       if (track.tk_lambda_Error() != expectedTrackFloatingPointValues_[12] + offset) {
0984         throwWithMessage("analyzeTracks, tk_lambda_Error does not equal expected value");
0985       }
0986       if (track.tk_phi_Error() != expectedTrackFloatingPointValues_[13] + offset) {
0987         throwWithMessage("analyzeTracks, tk_phi_Error does not equal expected value");
0988       }
0989       if (track.tk_dsz() != expectedTrackFloatingPointValues_[14] + offset) {
0990         throwWithMessage("analyzeTracks, tk_dsz does not equal expected value");
0991       }
0992       if (track.tk_dsz_Error() != expectedTrackFloatingPointValues_[15] + offset) {
0993         throwWithMessage("analyzeTracks, tk_dsz_Error does not equal expected value");
0994       }
0995       if (track.tk_qoverp_lambda_cov() != expectedTrackFloatingPointValues_[16] + offset) {
0996         throwWithMessage("analyzeTracks, tk_qoverp_lambda_cov does not equal expected value");
0997       }
0998       if (track.tk_qoverp_phi_cov() != expectedTrackFloatingPointValues_[17] + offset) {
0999         throwWithMessage("analyzeTracks, tk_qoverp_phi_cov does not equal expected value");
1000       }
1001       if (track.tk_qoverp_dxy_cov() != expectedTrackFloatingPointValues_[18] + offset) {
1002         throwWithMessage("analyzeTracks, tk_qoverp_dxy_cov does not equal expected value");
1003       }
1004       if (track.tk_qoverp_dsz_cov() != expectedTrackFloatingPointValues_[19] + offset) {
1005         throwWithMessage("analyzeTracks, tk_qoverp_dsz_cov does not equal expected value");
1006       }
1007       if (track.tk_lambda_phi_cov() != expectedTrackFloatingPointValues_[20] + offset) {
1008         throwWithMessage("analyzeTracks, tk_lambda_phi_cov does not equal expected value");
1009       }
1010       if (track.tk_lambda_dxy_cov() != expectedTrackFloatingPointValues_[21] + offset) {
1011         throwWithMessage("analyzeTracks, tk_lambda_dxy_cov does not equal expected value");
1012       }
1013       if (track.tk_lambda_dsz_cov() != expectedTrackFloatingPointValues_[22] + offset) {
1014         throwWithMessage("analyzeTracks, tk_lambda_dsz_cov does not equal expected value");
1015       }
1016       if (track.tk_phi_dxy_cov() != expectedTrackFloatingPointValues_[23] + offset) {
1017         throwWithMessage("analyzeTracks, tk_phi_dxy_cov does not equal expected value");
1018       }
1019       if (track.tk_phi_dsz_cov() != expectedTrackFloatingPointValues_[24] + offset) {
1020         throwWithMessage("analyzeTracks, tk_phi_dsz_cov does not equal expected value");
1021       }
1022       if (track.tk_dxy_dsz_cov() != expectedTrackFloatingPointValues_[25] + offset) {
1023         throwWithMessage("analyzeTracks, tk_dxy_dsz_cov does not equal expected value");
1024       }
1025       if (track.tk_vtxInd() != expectedTrackIntegralValues_[4] + iOffset) {
1026         throwWithMessage("analyzeTracks, tk_vtxInd does not equal expected value");
1027       }
1028       if (track.tk_vx() != expectedTrackFloatingPointValues_[26] + offset) {
1029         throwWithMessage("analyzeTracks, tk_vx does not equal expected value");
1030       }
1031       if (track.tk_vy() != expectedTrackFloatingPointValues_[27] + offset) {
1032         throwWithMessage("analyzeTracks, tk_vy does not equal expected value");
1033       }
1034       if (track.tk_vz() != expectedTrackFloatingPointValues_[28] + offset) {
1035         throwWithMessage("analyzeTracks, float tk_vz does not equal expected value");
1036       }
1037       ++i;
1038     }
1039   }
1040 
1041   void TestReadRun3Scouting::analyzeVertexes(edm::Event const& iEvent) const {
1042     auto const& vertexes = iEvent.get(vertexesToken_);
1043     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
1044     if (vertexes.size() != vectorSize) {
1045       throwWithMessage("analyzeVertexes, vertexes does not have expected size");
1046     }
1047     unsigned int i = 0;
1048     for (auto const& vertex : vertexes) {
1049       double offset = static_cast<double>(iEvent.id().event() + i);
1050       int iOffset = static_cast<int>(iEvent.id().event() + i);
1051 
1052       if (vertex.x() != expectedVertexFloatingPointValues_[0] + offset) {
1053         throwWithMessage("analyzeVertexes, x does not equal expected value");
1054       }
1055       if (vertex.y() != expectedVertexFloatingPointValues_[1] + offset) {
1056         throwWithMessage("analyzeVertexes, y does not equal expected value");
1057       }
1058       if (vertex.z() != expectedVertexFloatingPointValues_[2] + offset) {
1059         throwWithMessage("analyzeVertexes, z does not equal expected value");
1060       }
1061       if (vertex.zError() != expectedVertexFloatingPointValues_[3] + offset) {
1062         throwWithMessage("analyzeVertexes, zError does not equal expected value");
1063       }
1064       if (vertex.xError() != expectedVertexFloatingPointValues_[4] + offset) {
1065         throwWithMessage("analyzeVertexes, xError does not equal expected value");
1066       }
1067       if (vertex.yError() != expectedVertexFloatingPointValues_[5] + offset) {
1068         throwWithMessage("analyzeVertexes, yError does not equal expected value");
1069       }
1070       if (vertex.tracksSize() != expectedVertexIntegralValues_[0] + iOffset) {
1071         throwWithMessage("analyzeVertexes, tracksSize does not equal expected value");
1072       }
1073       if (vertex.chi2() != expectedVertexFloatingPointValues_[6] + offset) {
1074         throwWithMessage("analyzeVertexes, chi2 does not equal expected value");
1075       }
1076       if (vertex.ndof() != expectedVertexIntegralValues_[1] + iOffset) {
1077         throwWithMessage("analyzeVertexes, ndof does not equal expected value");
1078       }
1079       if (vertex.isValidVtx() != static_cast<bool>((expectedVertexIntegralValues_[2] + iOffset) % 2)) {
1080         throwWithMessage("analyzeVertexes, isValidVtx does not equal expected value");
1081       }
1082       ++i;
1083     }
1084   }
1085 
1086   void TestReadRun3Scouting::throwWithMessageFromConstructor(const char* msg) const {
1087     throw cms::Exception("TestFailure") << "TestReadRun3Scouting constructor, " << msg;
1088   }
1089 
1090   void TestReadRun3Scouting::throwWithMessage(const char* msg) const {
1091     throw cms::Exception("TestFailure") << "TestReadRun3Scouting::analyze, " << msg;
1092   }
1093 
1094 }  // namespace edmtest
1095 
1096 using edmtest::TestReadRun3Scouting;
1097 DEFINE_FWK_MODULE(TestReadRun3Scouting);