Skip to content

Commit 2b93802

Browse files
authored
Merge pull request #48583 from elfontan/EF_151X_scoutingCaloRecHits
Adding Calo RecHits to the Scouting Event Content (end of 2025 data-taking)
2 parents 9a7badd + 247f9c3 commit 2b93802

12 files changed

+622
-13
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#ifndef DataFormats_Scouting_Run3ScoutingEBRecHit_h
2+
#define DataFormats_Scouting_Run3ScoutingEBRecHit_h
3+
4+
#include <vector>
5+
#include <stdint.h>
6+
7+
// Updated Run 3 HLT-Scouting data format to include calo recHits information:
8+
// - EBRecHits collection (ECAL Barrel)
9+
// Saved information is specific to each hit type: energy, time, flags, and detId are available for EB recHits
10+
//
11+
// IMPORTANT: any changes to Run3ScoutingEBRecHit must be backward-compatible!
12+
13+
class Run3ScoutingEBRecHit {
14+
public:
15+
Run3ScoutingEBRecHit(float energy, float time, unsigned int detId, uint32_t flags)
16+
: energy_{energy}, time_{time}, detId_{detId}, flags_{flags} {}
17+
18+
Run3ScoutingEBRecHit() : energy_{0}, time_{0}, detId_{0}, flags_{0} {}
19+
20+
float energy() const { return energy_; }
21+
float time() const { return time_; }
22+
unsigned int detId() const { return detId_; }
23+
uint32_t flags() const { return flags_; }
24+
25+
private:
26+
float energy_;
27+
float time_;
28+
unsigned int detId_;
29+
uint32_t flags_;
30+
// NOTE: types are kept the same as in the origin of the data in reco::PFRecHit
31+
};
32+
33+
using Run3ScoutingEBRecHitCollection = std::vector<Run3ScoutingEBRecHit>;
34+
35+
#endif
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#ifndef DataFormats_Scouting_Run3ScoutingEERecHit_h
2+
#define DataFormats_Scouting_Run3ScoutingEERecHit_h
3+
4+
#include <vector>
5+
6+
// Updated Run 3 HLT-Scouting data format to include calo recHits information:
7+
// - EERecHits collection (ECAL Endcap)
8+
// Saved information is specific to each hit type: energy, time, and detId are available for EE recHits
9+
//
10+
// IMPORTANT: any changes to Run3ScoutingEERecHit must be backward-compatible !
11+
12+
class Run3ScoutingEERecHit {
13+
public:
14+
Run3ScoutingEERecHit(float energy, float time, unsigned int detId) : energy_{energy}, time_{time}, detId_{detId} {}
15+
16+
Run3ScoutingEERecHit() : energy_{0}, time_{0}, detId_{0} {}
17+
18+
float energy() const { return energy_; }
19+
float time() const { return time_; }
20+
unsigned int detId() const { return detId_; }
21+
22+
private:
23+
float energy_;
24+
float time_;
25+
unsigned int detId_;
26+
};
27+
28+
using Run3ScoutingEERecHitCollection = std::vector<Run3ScoutingEERecHit>;
29+
30+
#endif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef DataFormats_Scouting_Run3ScoutingHBHERecHit_h
2+
#define DataFormats_Scouting_Run3ScoutingHBHERecHit_h
3+
4+
#include <vector>
5+
6+
// Updated Run 3 HLT-Scouting data format to include calo recHits information:
7+
// - HBHERecHits collection (HCAL Barrel and Endcap)
8+
// Saved information is specific to each hit type: energy and detId are available for HCAL recHits
9+
//
10+
// -- IMPORTANT: any changes to Run3ScoutingHBHERecHit must be backward-compatible!
11+
12+
class Run3ScoutingHBHERecHit {
13+
public:
14+
Run3ScoutingHBHERecHit(float energy, unsigned int detId) : energy_{energy}, detId_{detId} {}
15+
16+
Run3ScoutingHBHERecHit() : energy_{0}, detId_{0} {}
17+
18+
float energy() const { return energy_; }
19+
unsigned int detId() const { return detId_; }
20+
21+
private:
22+
float energy_;
23+
unsigned int detId_;
24+
};
25+
26+
using Run3ScoutingHBHERecHitCollection = std::vector<Run3ScoutingHBHERecHit>;
27+
28+
#endif

DataFormats/Scouting/src/classes.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
#include "DataFormats/Scouting/interface/ScoutingMuon.h"
88
#include "DataFormats/Scouting/interface/ScoutingPhoton.h"
99
#include "DataFormats/Scouting/interface/Run3ScoutingCaloJet.h"
10+
#include "DataFormats/Scouting/interface/Run3ScoutingElectron.h"
1011
#include "DataFormats/Scouting/interface/Run3ScoutingHitPatternPOD.h"
11-
#include "DataFormats/Scouting/interface/Run3ScoutingPFJet.h"
12+
#include "DataFormats/Scouting/interface/Run3ScoutingMuon.h"
1213
#include "DataFormats/Scouting/interface/Run3ScoutingParticle.h"
14+
#include "DataFormats/Scouting/interface/Run3ScoutingPFJet.h"
15+
#include "DataFormats/Scouting/interface/Run3ScoutingPhoton.h"
1316
#include "DataFormats/Scouting/interface/Run3ScoutingTrack.h"
1417
#include "DataFormats/Scouting/interface/Run3ScoutingVertex.h"
15-
#include "DataFormats/Scouting/interface/Run3ScoutingElectron.h"
16-
#include "DataFormats/Scouting/interface/Run3ScoutingMuon.h"
17-
#include "DataFormats/Scouting/interface/Run3ScoutingPhoton.h"
18+
#include "DataFormats/Scouting/interface/Run3ScoutingEBRecHit.h"
19+
#include "DataFormats/Scouting/interface/Run3ScoutingEERecHit.h"
20+
#include "DataFormats/Scouting/interface/Run3ScoutingHBHERecHit.h"
1821
#include "DataFormats/Common/interface/Wrapper.h"
1922
#include "DataFormats/Common/interface/Ref.h"

DataFormats/Scouting/src/classes_def.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@
6464
<version ClassVersion="3" checksum="316446070"/>
6565
<version ClassVersion="4" checksum="1670865213"/>
6666
</class>
67+
<class name="Run3ScoutingEBRecHit" ClassVersion="3">
68+
<version ClassVersion="3" checksum="873840696"/>
69+
</class>
70+
<class name="Run3ScoutingEERecHit" ClassVersion="3">
71+
<version ClassVersion="3" checksum="343593247"/>
72+
</class>
73+
<class name="Run3ScoutingHBHERecHit" ClassVersion="3">
74+
<version ClassVersion="3" checksum="1840081356"/>
75+
</class>
6776
<class name="ScoutingCaloJet" ClassVersion="3">
6877
<version ClassVersion="2" checksum="2705685116"/>
6978
<version ClassVersion="3" checksum="631496401"/>
@@ -100,6 +109,9 @@
100109
<class name="std::vector<Run3ScoutingPhoton>"/>
101110
<class name="std::vector<Run3ScoutingTrack>"/>
102111
<class name="std::vector<Run3ScoutingVertex>"/>
112+
<class name="std::vector<Run3ScoutingEBRecHit>"/>
113+
<class name="std::vector<Run3ScoutingEERecHit>"/>
114+
<class name="std::vector<Run3ScoutingHBHERecHit>"/>
103115
<class name="std::vector<ScoutingCaloJet>"/>
104116
<class name="std::vector<ScoutingElectron>"/>
105117
<class name="std::vector<ScoutingMuon>"/>
@@ -116,6 +128,9 @@
116128
<class name="edm::Wrapper<std::vector<Run3ScoutingPhoton> >"/>
117129
<class name="edm::Wrapper<std::vector<Run3ScoutingTrack> >"/>
118130
<class name="edm::Wrapper<std::vector<Run3ScoutingVertex> >"/>
131+
<class name="edm::Wrapper<std::vector<Run3ScoutingEBRecHit> >"/>
132+
<class name="edm::Wrapper<std::vector<Run3ScoutingEERecHit> >"/>
133+
<class name="edm::Wrapper<std::vector<Run3ScoutingHBHERecHit> >"/>
119134
<class name="edm::Wrapper<std::vector<ScoutingCaloJet> >"/>
120135
<class name="edm::Wrapper<std::vector<ScoutingElectron> >"/>
121136
<class name="edm::Wrapper<std::vector<ScoutingMuon> >"/>

DataFormats/Scouting/test/TestReadRun3Scouting.cc

Lines changed: 155 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
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

Comments
 (0)