2424#include " DataFormats/Scouting/interface/Run3ScoutingPhoton.h"
2525#include " DataFormats/Scouting/interface/Run3ScoutingTrack.h"
2626#include " DataFormats/Scouting/interface/Run3ScoutingVertex.h"
27+ #include " DataFormats/Scouting/interface/Run3ScoutingEBRecHit.h"
28+ #include " DataFormats/Scouting/interface/Run3ScoutingEERecHit.h"
29+ #include " DataFormats/Scouting/interface/Run3ScoutingHBHERecHit.h"
2730#include " FWCore/Framework/interface/Event.h"
2831#include " FWCore/Framework/interface/Frameworkfwd.h"
2932#include " FWCore/Framework/interface/global/EDAnalyzer.h"
@@ -55,6 +58,9 @@ namespace edmtest {
5558 void analyzePhotons (edm::Event const &) const ;
5659 void analyzeTracks (edm::Event const &) const ;
5760 void analyzeVertexes (edm::Event const &) const ;
61+ void analyzeEBRecHits (edm::Event const &) const ;
62+ void analyzeEERecHits (edm::Event const &) const ;
63+ void analyzeHBHERecHits (edm::Event const &) const ;
5864
5965 void throwWithMessageFromConstructor (const char *) const ;
6066 void throwWithMessage (const char *) const ;
@@ -96,6 +102,21 @@ namespace edmtest {
96102 const std::vector<double > expectedVertexFloatingPointValues_;
97103 const std::vector<int > expectedVertexIntegralValues_;
98104 const edm::EDGetTokenT<std::vector<Run3ScoutingVertex>> vertexesToken_;
105+
106+ const int inputEBRecHitClassVersion_;
107+ const std::vector<double > expectedEBRecHitFloatingPointValues_;
108+ const std::vector<int > expectedEBRecHitIntegralValues_;
109+ const edm::EDGetTokenT<std::vector<Run3ScoutingEBRecHit>> ebRecHitsToken_;
110+
111+ const int inputEERecHitClassVersion_;
112+ const std::vector<double > expectedEERecHitFloatingPointValues_;
113+ const std::vector<int > expectedEERecHitIntegralValues_;
114+ const edm::EDGetTokenT<std::vector<Run3ScoutingEERecHit>> eeRecHitsToken_;
115+
116+ const int inputHBHERecHitClassVersion_;
117+ const std::vector<double > expectedHBHERecHitFloatingPointValues_;
118+ const std::vector<int > expectedHBHERecHitIntegralValues_;
119+ const edm::EDGetTokenT<std::vector<Run3ScoutingHBHERecHit>> hbheRecHitsToken_;
99120 };
100121
101122 TestReadRun3Scouting::TestReadRun3Scouting (edm::ParameterSet const & iPSet)
@@ -128,7 +149,22 @@ namespace edmtest {
128149 expectedVertexFloatingPointValues_(
129150 iPSet.getParameter<std::vector<double >>(" expectedVertexFloatingPointValues" )),
130151 expectedVertexIntegralValues_(iPSet.getParameter<std::vector<int >>(" expectedVertexIntegralValues" )),
131- vertexesToken_(consumes(iPSet.getParameter<edm::InputTag>(" vertexesTag" ))) {
152+ vertexesToken_(consumes(iPSet.getParameter<edm::InputTag>(" vertexesTag" ))),
153+ inputEBRecHitClassVersion_(iPSet.getParameter<int >(" ebRecHitClassVersion" )),
154+ expectedEBRecHitFloatingPointValues_(
155+ iPSet.getParameter<std::vector<double >>(" expectedEBRecHitFloatingPointValues" )),
156+ expectedEBRecHitIntegralValues_(iPSet.getParameter<std::vector<int >>(" expectedEBRecHitIntegralValues" )),
157+ ebRecHitsToken_(consumes(iPSet.getParameter<edm::InputTag>(" ebRecHitsTag" ))),
158+ inputEERecHitClassVersion_(iPSet.getParameter<int >(" eeRecHitClassVersion" )),
159+ expectedEERecHitFloatingPointValues_(
160+ iPSet.getParameter<std::vector<double >>(" expectedEERecHitFloatingPointValues" )),
161+ expectedEERecHitIntegralValues_(iPSet.getParameter<std::vector<int >>(" expectedEERecHitIntegralValues" )),
162+ eeRecHitsToken_(consumes(iPSet.getParameter<edm::InputTag>(" eeRecHitsTag" ))),
163+ inputHBHERecHitClassVersion_(iPSet.getParameter<int >(" hbheRecHitClassVersion" )),
164+ expectedHBHERecHitFloatingPointValues_(
165+ iPSet.getParameter<std::vector<double >>(" expectedHBHERecHitFloatingPointValues" )),
166+ expectedHBHERecHitIntegralValues_(iPSet.getParameter<std::vector<int >>(" expectedHBHERecHitIntegralValues" )),
167+ hbheRecHitsToken_(consumes(iPSet.getParameter<edm::InputTag>(" hbheRecHitsTag" ))) {
132168 if (expectedCaloJetsValues_.size () != 16 ) {
133169 throwWithMessageFromConstructor (" test configuration error, expectedCaloJetsValues must have size 16" );
134170 }
@@ -176,6 +212,25 @@ namespace edmtest {
176212 if (expectedVertexIntegralValues_.size () != 3 ) {
177213 throwWithMessageFromConstructor (" test configuration error, expectedVertexIntegralValues must have size 3" );
178214 }
215+ if (expectedEBRecHitFloatingPointValues_.size () != 2 ) {
216+ throwWithMessageFromConstructor (" test configuration error, expectedEBRecHitFloatingPointValues must have size 2" );
217+ }
218+ if (expectedEBRecHitIntegralValues_.size () != 2 ) {
219+ throwWithMessageFromConstructor (" test configuration error, expectedEBRecHitIntegralValues must have size 2" );
220+ }
221+ if (expectedEERecHitFloatingPointValues_.size () != 2 ) {
222+ throwWithMessageFromConstructor (" test configuration error, expectedEERecHitFloatingPointValues must have size 2" );
223+ }
224+ if (expectedEERecHitIntegralValues_.size () != 1 ) {
225+ throwWithMessageFromConstructor (" test configuration error, expectedEERecHitIntegralValues must have size 1" );
226+ }
227+ if (expectedHBHERecHitFloatingPointValues_.size () != 1 ) {
228+ throwWithMessageFromConstructor (
229+ " test configuration error, expectedHBHERecHitFloatingPointValues must have size 1" );
230+ }
231+ if (expectedHBHERecHitIntegralValues_.size () != 1 ) {
232+ throwWithMessageFromConstructor (" test configuration error, expectedHBHERecHitIntegralValues must have size 1" );
233+ }
179234 }
180235
181236 void TestReadRun3Scouting::analyze (edm::StreamID, edm::Event const & iEvent, edm::EventSetup const &) const {
@@ -187,6 +242,9 @@ namespace edmtest {
187242 analyzePhotons (iEvent);
188243 analyzeTracks (iEvent);
189244 analyzeVertexes (iEvent);
245+ analyzeEBRecHits (iEvent);
246+ analyzeEERecHits (iEvent);
247+ analyzeHBHERecHits (iEvent);
190248 }
191249
192250 void TestReadRun3Scouting::fillDescriptions (edm::ConfigurationDescriptions& descriptions) {
@@ -217,6 +275,18 @@ namespace edmtest {
217275 desc.add <std::vector<double >>(" expectedVertexFloatingPointValues" );
218276 desc.add <std::vector<int >>(" expectedVertexIntegralValues" );
219277 desc.add <edm::InputTag>(" vertexesTag" );
278+ desc.add <int >(" ebRecHitClassVersion" );
279+ desc.add <std::vector<double >>(" expectedEBRecHitFloatingPointValues" );
280+ desc.add <std::vector<int >>(" expectedEBRecHitIntegralValues" );
281+ desc.add <edm::InputTag>(" ebRecHitsTag" );
282+ desc.add <int >(" eeRecHitClassVersion" );
283+ desc.add <std::vector<double >>(" expectedEERecHitFloatingPointValues" );
284+ desc.add <std::vector<int >>(" expectedEERecHitIntegralValues" );
285+ desc.add <edm::InputTag>(" eeRecHitsTag" );
286+ desc.add <int >(" hbheRecHitClassVersion" );
287+ desc.add <std::vector<double >>(" expectedHBHERecHitFloatingPointValues" );
288+ desc.add <std::vector<int >>(" expectedHBHERecHitIntegralValues" );
289+ desc.add <edm::InputTag>(" hbheRecHitsTag" );
220290 descriptions.addDefault (desc);
221291 }
222292
@@ -1178,6 +1248,90 @@ namespace edmtest {
11781248 }
11791249 }
11801250
1251+ void TestReadRun3Scouting::analyzeEBRecHits (edm::Event const & iEvent) const {
1252+ if (inputEBRecHitClassVersion_ < 3 ) {
1253+ return ;
1254+ }
1255+
1256+ auto const & ebRecHits = iEvent.get (ebRecHitsToken_);
1257+ unsigned int vectorSize = 2 + iEvent.id ().event () % 4 ;
1258+ if (ebRecHits.size () != vectorSize) {
1259+ throwWithMessage (" analyzeEBRecHits, ebRecHits does not have expected size" );
1260+ }
1261+ unsigned int i = 0 ;
1262+ for (auto const & ebRecHit : ebRecHits) {
1263+ double offset = static_cast <double >(iEvent.id ().event () + i);
1264+ int iOffset = static_cast <int >(iEvent.id ().event () + i);
1265+
1266+ if (ebRecHit.energy () != expectedEBRecHitFloatingPointValues_[0 ] + offset) {
1267+ throwWithMessage (" analyzeEBRecHits, energy does not equal expected value" );
1268+ }
1269+ if (ebRecHit.time () != expectedEBRecHitFloatingPointValues_[1 ] + offset) {
1270+ throwWithMessage (" analyzeEBRecHits, time does not equal expected value" );
1271+ }
1272+ if (ebRecHit.detId () != static_cast <unsigned int >(expectedEBRecHitIntegralValues_[0 ] + iOffset)) {
1273+ throwWithMessage (" analyzeEBRecHits, detId does not equal expected value" );
1274+ }
1275+ if (ebRecHit.flags () != static_cast <uint32_t >(expectedEBRecHitIntegralValues_[1 ] + iOffset)) {
1276+ throwWithMessage (" analyzeEBRecHits, flags does not equal expected value" );
1277+ }
1278+ ++i;
1279+ }
1280+ }
1281+
1282+ void TestReadRun3Scouting::analyzeEERecHits (edm::Event const & iEvent) const {
1283+ if (inputEERecHitClassVersion_ < 3 ) {
1284+ return ;
1285+ }
1286+
1287+ auto const & eeRecHits = iEvent.get (eeRecHitsToken_);
1288+ unsigned int vectorSize = 2 + iEvent.id ().event () % 4 ;
1289+ if (eeRecHits.size () != vectorSize) {
1290+ throwWithMessage (" analyzeEERecHits, eeRecHits does not have expected size" );
1291+ }
1292+ unsigned int i = 0 ;
1293+ for (auto const & eeRecHit : eeRecHits) {
1294+ double offset = static_cast <double >(iEvent.id ().event () + i);
1295+ int iOffset = static_cast <int >(iEvent.id ().event () + i);
1296+
1297+ if (eeRecHit.energy () != expectedEERecHitFloatingPointValues_[0 ] + offset) {
1298+ throwWithMessage (" analyzeEERecHits, energy does not equal expected value" );
1299+ }
1300+ if (eeRecHit.time () != expectedEERecHitFloatingPointValues_[1 ] + offset) {
1301+ throwWithMessage (" analyzeEERecHits, time does not equal expected value" );
1302+ }
1303+ if (eeRecHit.detId () != static_cast <unsigned int >(expectedEERecHitIntegralValues_[0 ] + iOffset)) {
1304+ throwWithMessage (" analyzeEERecHits, detId does not equal expected value" );
1305+ }
1306+ ++i;
1307+ }
1308+ }
1309+
1310+ void TestReadRun3Scouting::analyzeHBHERecHits (edm::Event const & iEvent) const {
1311+ if (inputHBHERecHitClassVersion_ < 3 ) {
1312+ return ;
1313+ }
1314+
1315+ auto const & hbheRecHits = iEvent.get (hbheRecHitsToken_);
1316+ unsigned int vectorSize = 2 + iEvent.id ().event () % 4 ;
1317+ if (hbheRecHits.size () != vectorSize) {
1318+ throwWithMessage (" analyzeHBHERecHits, hbheRecHits does not have expected size" );
1319+ }
1320+ unsigned int i = 0 ;
1321+ for (auto const & hbheRecHit : hbheRecHits) {
1322+ double offset = static_cast <double >(iEvent.id ().event () + i);
1323+ int iOffset = static_cast <int >(iEvent.id ().event () + i);
1324+
1325+ if (hbheRecHit.energy () != expectedHBHERecHitFloatingPointValues_[0 ] + offset) {
1326+ throwWithMessage (" analyzeHBHERecHits, energy does not equal expected value" );
1327+ }
1328+ if (hbheRecHit.detId () != static_cast <unsigned int >(expectedHBHERecHitIntegralValues_[0 ] + iOffset)) {
1329+ throwWithMessage (" analyzeHBHERecHits, detId does not equal expected value" );
1330+ }
1331+ ++i;
1332+ }
1333+ }
1334+
11811335 void TestReadRun3Scouting::throwWithMessageFromConstructor (const char * msg) const {
11821336 throw cms::Exception (" TestFailure" ) << " TestReadRun3Scouting constructor, " << msg;
11831337 }
0 commit comments