Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:11

0001 // -*- C++ -*-
0002 //
0003 // Package:    DataFormats/Scouting
0004 // Class:      TestWriteRun2Scouting
0005 //
0006 /**\class edmtest::TestWriteRun2Scouting
0007   Description: Used as part of tests that ensure the Run 2 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 2 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 the data format.
0014 */
0015 // Original Author:  W. David Dagenhart
0016 //         Created:  2 June 2023
0017 
0018 #include "DataFormats/Scouting/interface/ScoutingCaloJet.h"
0019 #include "DataFormats/Scouting/interface/ScoutingElectron.h"
0020 #include "DataFormats/Scouting/interface/ScoutingMuon.h"
0021 #include "DataFormats/Scouting/interface/ScoutingParticle.h"
0022 #include "DataFormats/Scouting/interface/ScoutingPFJet.h"
0023 #include "DataFormats/Scouting/interface/ScoutingPhoton.h"
0024 #include "DataFormats/Scouting/interface/ScoutingTrack.h"
0025 #include "DataFormats/Scouting/interface/ScoutingVertex.h"
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/Frameworkfwd.h"
0028 #include "FWCore/Framework/interface/global/EDProducer.h"
0029 #include "FWCore/Framework/interface/MakerMacros.h"
0030 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0032 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0033 #include "FWCore/Utilities/interface/EDPutToken.h"
0034 #include "FWCore/Utilities/interface/Exception.h"
0035 #include "FWCore/Utilities/interface/StreamID.h"
0036 
0037 #include <memory>
0038 #include <utility>
0039 #include <vector>
0040 
0041 namespace edmtest {
0042 
0043   class TestWriteRun2Scouting : public edm::global::EDProducer<> {
0044   public:
0045     TestWriteRun2Scouting(edm::ParameterSet const&);
0046     void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;
0047     static void fillDescriptions(edm::ConfigurationDescriptions&);
0048 
0049   private:
0050     void produceCaloJets(edm::Event&) const;
0051     void produceElectrons(edm::Event&) const;
0052     void produceMuons(edm::Event&) const;
0053     void produceParticles(edm::Event&) const;
0054     void producePFJets(edm::Event&) const;
0055     void producePhotons(edm::Event&) const;
0056     void produceTracks(edm::Event&) const;
0057     void produceVertexes(edm::Event&) const;
0058 
0059     void throwWithMessage(const char*) const;
0060 
0061     const std::vector<double> caloJetsValues_;
0062     const edm::EDPutTokenT<std::vector<ScoutingCaloJet>> caloJetsPutToken_;
0063 
0064     const std::vector<double> electronsFloatingPointValues_;
0065     const std::vector<int> electronsIntegralValues_;
0066     const edm::EDPutTokenT<std::vector<ScoutingElectron>> electronsPutToken_;
0067 
0068     const std::vector<double> muonsFloatingPointValues_;
0069     const std::vector<int> muonsIntegralValues_;
0070     const edm::EDPutTokenT<std::vector<ScoutingMuon>> muonsPutToken_;
0071 
0072     const std::vector<double> particlesFloatingPointValues_;
0073     const std::vector<int> particlesIntegralValues_;
0074     const edm::EDPutTokenT<std::vector<ScoutingParticle>> particlesPutToken_;
0075 
0076     const std::vector<double> pfJetsFloatingPointValues_;
0077     const std::vector<int> pfJetsIntegralValues_;
0078     const edm::EDPutTokenT<std::vector<ScoutingPFJet>> pfJetsPutToken_;
0079 
0080     const std::vector<double> photonsFloatingPointValues_;
0081     const edm::EDPutTokenT<std::vector<ScoutingPhoton>> photonsPutToken_;
0082 
0083     const std::vector<double> tracksFloatingPointValues_;
0084     const std::vector<int> tracksIntegralValues_;
0085     const edm::EDPutTokenT<std::vector<ScoutingTrack>> tracksPutToken_;
0086 
0087     const std::vector<double> vertexesFloatingPointValues_;
0088     const std::vector<int> vertexesIntegralValues_;
0089     const edm::EDPutTokenT<std::vector<ScoutingVertex>> vertexesPutToken_;
0090   };
0091 
0092   TestWriteRun2Scouting::TestWriteRun2Scouting(edm::ParameterSet const& iPSet)
0093       : caloJetsValues_(iPSet.getParameter<std::vector<double>>("caloJetsValues")),
0094         caloJetsPutToken_(produces()),
0095         electronsFloatingPointValues_(iPSet.getParameter<std::vector<double>>("electronsFloatingPointValues")),
0096         electronsIntegralValues_(iPSet.getParameter<std::vector<int>>("electronsIntegralValues")),
0097         electronsPutToken_(produces()),
0098         muonsFloatingPointValues_(iPSet.getParameter<std::vector<double>>("muonsFloatingPointValues")),
0099         muonsIntegralValues_(iPSet.getParameter<std::vector<int>>("muonsIntegralValues")),
0100         muonsPutToken_(produces()),
0101         particlesFloatingPointValues_(iPSet.getParameter<std::vector<double>>("particlesFloatingPointValues")),
0102         particlesIntegralValues_(iPSet.getParameter<std::vector<int>>("particlesIntegralValues")),
0103         particlesPutToken_(produces()),
0104         pfJetsFloatingPointValues_(iPSet.getParameter<std::vector<double>>("pfJetsFloatingPointValues")),
0105         pfJetsIntegralValues_(iPSet.getParameter<std::vector<int>>("pfJetsIntegralValues")),
0106         pfJetsPutToken_(produces()),
0107         photonsFloatingPointValues_(iPSet.getParameter<std::vector<double>>("photonsFloatingPointValues")),
0108         photonsPutToken_(produces()),
0109         tracksFloatingPointValues_(iPSet.getParameter<std::vector<double>>("tracksFloatingPointValues")),
0110         tracksIntegralValues_(iPSet.getParameter<std::vector<int>>("tracksIntegralValues")),
0111         tracksPutToken_(produces()),
0112         vertexesFloatingPointValues_(iPSet.getParameter<std::vector<double>>("vertexesFloatingPointValues")),
0113         vertexesIntegralValues_(iPSet.getParameter<std::vector<int>>("vertexesIntegralValues")),
0114         vertexesPutToken_(produces()) {
0115     if (caloJetsValues_.size() != 16) {
0116       throwWithMessage("caloJetsValues must have 16 elements and it does not");
0117     }
0118     if (electronsFloatingPointValues_.size() != 14) {
0119       throwWithMessage("electronsFloatingPointValues must have 14 elements and it does not");
0120     }
0121     if (electronsIntegralValues_.size() != 2) {
0122       throwWithMessage("electronsIntegralValues must have 2 elements and it does not");
0123     }
0124     if (muonsFloatingPointValues_.size() != 23) {
0125       throwWithMessage("muonsFloatingPointValues must have 23 elements and it does not");
0126     }
0127     if (muonsIntegralValues_.size() != 8) {
0128       throwWithMessage("muonsIntegralValues must have 8 elements and it does not");
0129     }
0130     if (particlesFloatingPointValues_.size() != 4) {
0131       throwWithMessage("particlesFloatingPointValues must have 4 elements and it does not");
0132     }
0133     if (particlesIntegralValues_.size() != 2) {
0134       throwWithMessage("particlesIntegralValues must have 2 elements and it does not");
0135     }
0136     if (pfJetsFloatingPointValues_.size() != 15) {
0137       throwWithMessage("pfJetsFloatingPointValues must have 15 elements and it does not");
0138     }
0139     if (pfJetsIntegralValues_.size() != 8) {
0140       throwWithMessage("pfJetsIntegralValues must have 8 elements and it does not");
0141     }
0142     if (photonsFloatingPointValues_.size() != 8) {
0143       throwWithMessage("photonsFloatingPointValues must have 8 elements and it does not");
0144     }
0145     if (tracksFloatingPointValues_.size() != 16) {
0146       throwWithMessage("tracksFloatingPointValues must have 16 elements and it does not");
0147     }
0148     if (tracksIntegralValues_.size() != 4) {
0149       throwWithMessage("tracksIntegralValues must have 4 elements and it does not");
0150     }
0151     if (vertexesFloatingPointValues_.size() != 7) {
0152       throwWithMessage("vertexesFloatingPointValues must have 7 elements and it does not");
0153     }
0154     if (vertexesIntegralValues_.size() != 3) {
0155       throwWithMessage("vertexesIntegralValues must have 3 elements and it does not");
0156     }
0157   }
0158 
0159   void TestWriteRun2Scouting::produce(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const {
0160     // Fill Run2 scouting objects. Make sure all the containers inside
0161     // of them have something in them (not empty). The values are meaningless.
0162     // We will later check that after writing these objects to persistent storage
0163     // and then reading them in a later process we obtain matching values for
0164     // all this content.
0165 
0166     produceCaloJets(iEvent);
0167     produceElectrons(iEvent);
0168     produceMuons(iEvent);
0169     produceParticles(iEvent);
0170     producePFJets(iEvent);
0171     producePhotons(iEvent);
0172     produceTracks(iEvent);
0173     produceVertexes(iEvent);
0174   }
0175 
0176   void TestWriteRun2Scouting::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0177     edm::ParameterSetDescription desc;
0178     desc.add<std::vector<double>>("caloJetsValues");
0179     desc.add<std::vector<double>>("electronsFloatingPointValues");
0180     desc.add<std::vector<int>>("electronsIntegralValues");
0181     desc.add<std::vector<double>>("muonsFloatingPointValues");
0182     desc.add<std::vector<int>>("muonsIntegralValues");
0183     desc.add<std::vector<double>>("particlesFloatingPointValues");
0184     desc.add<std::vector<int>>("particlesIntegralValues");
0185     desc.add<std::vector<double>>("pfJetsFloatingPointValues");
0186     desc.add<std::vector<int>>("pfJetsIntegralValues");
0187     desc.add<std::vector<double>>("photonsFloatingPointValues");
0188     desc.add<std::vector<double>>("tracksFloatingPointValues");
0189     desc.add<std::vector<int>>("tracksIntegralValues");
0190     desc.add<std::vector<double>>("vertexesFloatingPointValues");
0191     desc.add<std::vector<int>>("vertexesIntegralValues");
0192     descriptions.addDefault(desc);
0193   }
0194 
0195   void TestWriteRun2Scouting::produceCaloJets(edm::Event& iEvent) const {
0196     auto run2ScoutingCaloJets = std::make_unique<std::vector<ScoutingCaloJet>>();
0197     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0198     run2ScoutingCaloJets->reserve(vectorSize);
0199     for (unsigned int i = 0; i < vectorSize; ++i) {
0200       double offset = static_cast<double>(iEvent.id().event() + i);
0201       run2ScoutingCaloJets->emplace_back(static_cast<float>(caloJetsValues_[0] + offset),
0202                                          static_cast<float>(caloJetsValues_[1] + offset),
0203                                          static_cast<float>(caloJetsValues_[2] + offset),
0204                                          static_cast<float>(caloJetsValues_[3] + offset),
0205                                          static_cast<float>(caloJetsValues_[4] + offset),
0206                                          static_cast<float>(caloJetsValues_[5] + offset),
0207                                          static_cast<float>(caloJetsValues_[6] + offset),
0208                                          static_cast<float>(caloJetsValues_[7] + offset),
0209                                          static_cast<float>(caloJetsValues_[8] + offset),
0210                                          static_cast<float>(caloJetsValues_[9] + offset),
0211                                          static_cast<float>(caloJetsValues_[10] + offset),
0212                                          static_cast<float>(caloJetsValues_[11] + offset),
0213                                          static_cast<float>(caloJetsValues_[12] + offset),
0214                                          static_cast<float>(caloJetsValues_[13] + offset),
0215                                          static_cast<float>(caloJetsValues_[14] + offset),
0216                                          static_cast<float>(caloJetsValues_[15] + offset));
0217     }
0218     iEvent.put(caloJetsPutToken_, std::move(run2ScoutingCaloJets));
0219   }
0220 
0221   void TestWriteRun2Scouting::produceElectrons(edm::Event& iEvent) const {
0222     auto run2ScoutingElectrons = std::make_unique<std::vector<ScoutingElectron>>();
0223     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0224     run2ScoutingElectrons->reserve(vectorSize);
0225     for (unsigned int i = 0; i < vectorSize; ++i) {
0226       double offset = static_cast<double>(iEvent.id().event() + i);
0227       int iOffset = static_cast<int>(iEvent.id().event() + i);
0228 
0229       run2ScoutingElectrons->emplace_back(static_cast<float>(electronsFloatingPointValues_[0] + offset),
0230                                           static_cast<float>(electronsFloatingPointValues_[1] + offset),
0231                                           static_cast<float>(electronsFloatingPointValues_[2] + offset),
0232                                           static_cast<float>(electronsFloatingPointValues_[3] + offset),
0233                                           static_cast<float>(electronsFloatingPointValues_[4] + offset),
0234                                           static_cast<float>(electronsFloatingPointValues_[5] + offset),
0235                                           static_cast<float>(electronsFloatingPointValues_[6] + offset),
0236                                           static_cast<float>(electronsFloatingPointValues_[7] + offset),
0237                                           static_cast<float>(electronsFloatingPointValues_[8] + offset),
0238                                           static_cast<float>(electronsFloatingPointValues_[9] + offset),
0239                                           static_cast<float>(electronsFloatingPointValues_[10] + offset),
0240                                           electronsIntegralValues_[0] + iOffset,
0241                                           electronsIntegralValues_[1] + iOffset,
0242                                           static_cast<float>(electronsFloatingPointValues_[11] + offset),
0243                                           static_cast<float>(electronsFloatingPointValues_[12] + offset),
0244                                           static_cast<float>(electronsFloatingPointValues_[13] + offset));
0245     }
0246     iEvent.put(electronsPutToken_, std::move(run2ScoutingElectrons));
0247   }
0248 
0249   void TestWriteRun2Scouting::produceMuons(edm::Event& iEvent) const {
0250     auto run2ScoutingMuons = std::make_unique<std::vector<ScoutingMuon>>();
0251     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0252     run2ScoutingMuons->reserve(vectorSize);
0253     for (unsigned int i = 0; i < vectorSize; ++i) {
0254       double offset = static_cast<double>(iEvent.id().event() + i);
0255       int iOffset = static_cast<int>(iEvent.id().event() + i);
0256 
0257       std::vector<int> vtxIndx;
0258       vtxIndx.reserve(vectorSize);
0259       for (unsigned int j = 0; j < vectorSize; ++j) {
0260         vtxIndx.push_back(static_cast<int>(muonsIntegralValues_[7] + iOffset + j * 10));
0261       }
0262 
0263       run2ScoutingMuons->emplace_back(static_cast<float>(muonsFloatingPointValues_[0] + offset),
0264                                       static_cast<float>(muonsFloatingPointValues_[1] + offset),
0265                                       static_cast<float>(muonsFloatingPointValues_[2] + offset),
0266                                       static_cast<float>(muonsFloatingPointValues_[3] + offset),
0267                                       static_cast<float>(muonsFloatingPointValues_[4] + offset),
0268                                       static_cast<float>(muonsFloatingPointValues_[5] + offset),
0269                                       static_cast<float>(muonsFloatingPointValues_[6] + offset),
0270                                       static_cast<float>(muonsFloatingPointValues_[7] + offset),
0271                                       static_cast<float>(muonsFloatingPointValues_[8] + offset),
0272                                       muonsIntegralValues_[0] + iOffset,
0273                                       static_cast<float>(muonsFloatingPointValues_[9] + offset),
0274                                       static_cast<float>(muonsFloatingPointValues_[10] + offset),
0275                                       muonsIntegralValues_[1] + iOffset,
0276                                       muonsIntegralValues_[2] + iOffset,
0277                                       muonsIntegralValues_[3] + iOffset,
0278                                       muonsIntegralValues_[4] + iOffset,
0279                                       muonsIntegralValues_[5] + iOffset,
0280                                       muonsIntegralValues_[6] + iOffset,
0281                                       static_cast<float>(muonsFloatingPointValues_[11] + offset),
0282                                       static_cast<float>(muonsFloatingPointValues_[12] + offset),
0283                                       static_cast<float>(muonsFloatingPointValues_[13] + offset),
0284                                       static_cast<float>(muonsFloatingPointValues_[14] + offset),
0285                                       static_cast<float>(muonsFloatingPointValues_[15] + offset),
0286                                       static_cast<float>(muonsFloatingPointValues_[16] + offset),
0287                                       static_cast<float>(muonsFloatingPointValues_[17] + offset),
0288                                       static_cast<float>(muonsFloatingPointValues_[18] + offset),
0289                                       static_cast<float>(muonsFloatingPointValues_[19] + offset),
0290                                       static_cast<float>(muonsFloatingPointValues_[20] + offset),
0291                                       static_cast<float>(muonsFloatingPointValues_[21] + offset),
0292                                       static_cast<float>(muonsFloatingPointValues_[22] + offset),
0293                                       std::move(vtxIndx));
0294     }
0295     iEvent.put(muonsPutToken_, std::move(run2ScoutingMuons));
0296   }
0297 
0298   void TestWriteRun2Scouting::produceParticles(edm::Event& iEvent) const {
0299     auto run2ScoutingParticles = std::make_unique<std::vector<ScoutingParticle>>();
0300     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0301     run2ScoutingParticles->reserve(vectorSize);
0302     for (unsigned int i = 0; i < vectorSize; ++i) {
0303       double offset = static_cast<double>(iEvent.id().event() + i);
0304       int iOffset = static_cast<int>(iEvent.id().event() + i);
0305       run2ScoutingParticles->emplace_back(static_cast<float>(particlesFloatingPointValues_[0] + offset),
0306                                           static_cast<float>(particlesFloatingPointValues_[1] + offset),
0307                                           static_cast<float>(particlesFloatingPointValues_[2] + offset),
0308                                           static_cast<float>(particlesFloatingPointValues_[3] + offset),
0309                                           particlesIntegralValues_[0] + iOffset,
0310                                           particlesIntegralValues_[1] + iOffset);
0311     }
0312     iEvent.put(particlesPutToken_, std::move(run2ScoutingParticles));
0313   }
0314 
0315   void TestWriteRun2Scouting::producePFJets(edm::Event& iEvent) const {
0316     auto run2ScoutingPFJets = std::make_unique<std::vector<ScoutingPFJet>>();
0317     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0318     run2ScoutingPFJets->reserve(vectorSize);
0319 
0320     for (unsigned int i = 0; i < vectorSize; ++i) {
0321       double offset = static_cast<double>(iEvent.id().event() + i);
0322       int iOffset = static_cast<int>(iEvent.id().event() + i);
0323 
0324       std::vector<int> constituents;
0325       constituents.reserve(vectorSize);
0326       for (unsigned int j = 0; j < vectorSize; ++j) {
0327         constituents.push_back(static_cast<int>(pfJetsIntegralValues_[7] + iOffset + j * 10));
0328       }
0329 
0330       run2ScoutingPFJets->emplace_back(static_cast<float>(pfJetsFloatingPointValues_[0] + offset),
0331                                        static_cast<float>(pfJetsFloatingPointValues_[1] + offset),
0332                                        static_cast<float>(pfJetsFloatingPointValues_[2] + offset),
0333                                        static_cast<float>(pfJetsFloatingPointValues_[3] + offset),
0334                                        static_cast<float>(pfJetsFloatingPointValues_[4] + offset),
0335                                        static_cast<float>(pfJetsFloatingPointValues_[5] + offset),
0336                                        static_cast<float>(pfJetsFloatingPointValues_[6] + offset),
0337                                        static_cast<float>(pfJetsFloatingPointValues_[7] + offset),
0338                                        static_cast<float>(pfJetsFloatingPointValues_[8] + offset),
0339                                        static_cast<float>(pfJetsFloatingPointValues_[9] + offset),
0340                                        static_cast<float>(pfJetsFloatingPointValues_[10] + offset),
0341                                        static_cast<float>(pfJetsFloatingPointValues_[11] + offset),
0342                                        pfJetsIntegralValues_[0] + iOffset,
0343                                        pfJetsIntegralValues_[1] + iOffset,
0344                                        pfJetsIntegralValues_[2] + iOffset,
0345                                        pfJetsIntegralValues_[3] + iOffset,
0346                                        pfJetsIntegralValues_[4] + iOffset,
0347                                        pfJetsIntegralValues_[5] + iOffset,
0348                                        pfJetsIntegralValues_[6] + iOffset,
0349                                        static_cast<float>(pfJetsFloatingPointValues_[12] + offset),
0350                                        static_cast<float>(pfJetsFloatingPointValues_[13] + offset),
0351                                        static_cast<float>(pfJetsFloatingPointValues_[14] + offset),
0352                                        std::move(constituents));
0353     }
0354     iEvent.put(pfJetsPutToken_, std::move(run2ScoutingPFJets));
0355   }
0356 
0357   void TestWriteRun2Scouting::producePhotons(edm::Event& iEvent) const {
0358     auto run2ScoutingPhotons = std::make_unique<std::vector<ScoutingPhoton>>();
0359     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0360     run2ScoutingPhotons->reserve(vectorSize);
0361     for (unsigned int i = 0; i < vectorSize; ++i) {
0362       double offset = static_cast<double>(iEvent.id().event() + i);
0363 
0364       run2ScoutingPhotons->emplace_back(static_cast<float>(photonsFloatingPointValues_[0] + offset),
0365                                         static_cast<float>(photonsFloatingPointValues_[1] + offset),
0366                                         static_cast<float>(photonsFloatingPointValues_[2] + offset),
0367                                         static_cast<float>(photonsFloatingPointValues_[3] + offset),
0368                                         static_cast<float>(photonsFloatingPointValues_[4] + offset),
0369                                         static_cast<float>(photonsFloatingPointValues_[5] + offset),
0370                                         static_cast<float>(photonsFloatingPointValues_[6] + offset),
0371                                         static_cast<float>(photonsFloatingPointValues_[7] + offset));
0372     }
0373     iEvent.put(photonsPutToken_, std::move(run2ScoutingPhotons));
0374   }
0375 
0376   void TestWriteRun2Scouting::produceTracks(edm::Event& iEvent) const {
0377     auto run2ScoutingTracks = std::make_unique<std::vector<ScoutingTrack>>();
0378     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0379     run2ScoutingTracks->reserve(vectorSize);
0380     for (unsigned int i = 0; i < vectorSize; ++i) {
0381       double offset = static_cast<double>(iEvent.id().event() + i);
0382       int iOffset = static_cast<int>(iEvent.id().event() + i);
0383 
0384       run2ScoutingTracks->emplace_back(static_cast<float>(tracksFloatingPointValues_[0] + offset),
0385                                        static_cast<float>(tracksFloatingPointValues_[1] + offset),
0386                                        static_cast<float>(tracksFloatingPointValues_[2] + offset),
0387                                        static_cast<float>(tracksFloatingPointValues_[3] + offset),
0388                                        static_cast<float>(tracksFloatingPointValues_[4] + offset),
0389                                        tracksIntegralValues_[0] + iOffset,
0390                                        static_cast<float>(tracksFloatingPointValues_[5] + offset),
0391                                        static_cast<float>(tracksFloatingPointValues_[6] + offset),
0392                                        tracksIntegralValues_[1] + iOffset,
0393                                        tracksIntegralValues_[2] + iOffset,
0394                                        tracksIntegralValues_[3] + iOffset,
0395                                        static_cast<float>(tracksFloatingPointValues_[7] + offset),
0396                                        static_cast<float>(tracksFloatingPointValues_[8] + offset),
0397                                        static_cast<float>(tracksFloatingPointValues_[9] + offset),
0398                                        static_cast<float>(tracksFloatingPointValues_[10] + offset),
0399                                        static_cast<float>(tracksFloatingPointValues_[11] + offset),
0400                                        static_cast<float>(tracksFloatingPointValues_[12] + offset),
0401                                        static_cast<float>(tracksFloatingPointValues_[13] + offset),
0402                                        static_cast<float>(tracksFloatingPointValues_[14] + offset),
0403                                        static_cast<float>(tracksFloatingPointValues_[15] + offset));
0404     }
0405     iEvent.put(tracksPutToken_, std::move(run2ScoutingTracks));
0406   }
0407 
0408   void TestWriteRun2Scouting::produceVertexes(edm::Event& iEvent) const {
0409     auto run2ScoutingVertexes = std::make_unique<std::vector<ScoutingVertex>>();
0410     unsigned int vectorSize = 2 + iEvent.id().event() % 4;
0411     run2ScoutingVertexes->reserve(vectorSize);
0412 
0413     for (unsigned int i = 0; i < vectorSize; ++i) {
0414       double offset = static_cast<double>(iEvent.id().event() + i);
0415       int iOffset = static_cast<int>(iEvent.id().event() + i);
0416 
0417       run2ScoutingVertexes->emplace_back(static_cast<float>(vertexesFloatingPointValues_[0] + offset),
0418                                          static_cast<float>(vertexesFloatingPointValues_[1] + offset),
0419                                          static_cast<float>(vertexesFloatingPointValues_[2] + offset),
0420                                          static_cast<float>(vertexesFloatingPointValues_[3] + offset),
0421                                          static_cast<float>(vertexesFloatingPointValues_[4] + offset),
0422                                          static_cast<float>(vertexesFloatingPointValues_[5] + offset),
0423                                          vertexesIntegralValues_[0] + iOffset,
0424                                          static_cast<float>(vertexesFloatingPointValues_[6] + offset),
0425                                          vertexesIntegralValues_[1] + iOffset,
0426                                          static_cast<bool>((vertexesIntegralValues_[2] + iOffset) % 2));
0427     }
0428     iEvent.put(vertexesPutToken_, std::move(run2ScoutingVertexes));
0429   }
0430 
0431   void TestWriteRun2Scouting::throwWithMessage(const char* msg) const {
0432     throw cms::Exception("TestFailure") << "TestWriteRun2Scouting constructor, test configuration error, " << msg;
0433   }
0434 
0435 }  // namespace edmtest
0436 
0437 using edmtest::TestWriteRun2Scouting;
0438 DEFINE_FWK_MODULE(TestWriteRun2Scouting);