Skip to content

Commit

Permalink
Commit to add the detector ids to the scouting electron and photon co…
Browse files Browse the repository at this point in the history
…llection
  • Loading branch information
arsahasransu committed Feb 18, 2022
1 parent 9c3a5ca commit 0cd224f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
11 changes: 8 additions & 3 deletions DataFormats/Scouting/interface/Run3ScoutingElectron.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DataFormats_Run3ScoutingElectron_h

#include <vector>
#include <cstdint>

// Class for holding electron information, for use in data scouting
// IMPORTANT: the content of this class should be changed only in backwards compatible ways!
Expand All @@ -27,8 +28,9 @@ class Run3ScoutingElectron {
float r9,
float sMin,
float sMaj,
unsigned int seedId,
uint32_t seedId,
std::vector<float> energyMatrix,
std::vector<uint32_t> detIds,
std::vector<float> timingMatrix)
: pt_(pt),
eta_(eta),
Expand All @@ -51,6 +53,7 @@ class Run3ScoutingElectron {
sMaj_(sMaj),
seedId_(seedId),
energyMatrix_(std::move(energyMatrix)),
detIds_(std::move(detIds)),
timingMatrix_(std::move(timingMatrix)) {}
//default constructor
Run3ScoutingElectron()
Expand Down Expand Up @@ -95,8 +98,9 @@ class Run3ScoutingElectron {
float r9() const { return r9_; }
float sMin() const { return sMin_; }
float sMaj() const { return sMaj_; }
unsigned int seedId() const { return seedId_; }
uint32_t seedId() const { return seedId_; }
std::vector<float> const& energyMatrix() const { return energyMatrix_; }
std::vector<uint32_t> const& detIds() const { return detIds_; }
std::vector<float> const& timingMatrix() const { return timingMatrix_; }

private:
Expand All @@ -119,8 +123,9 @@ class Run3ScoutingElectron {
float r9_;
float sMin_;
float sMaj_;
unsigned int seedId_;
uint32_t seedId_;
std::vector<float> energyMatrix_;
std::vector<uint32_t> detIds_;
std::vector<float> timingMatrix_;
};

Expand Down
11 changes: 8 additions & 3 deletions DataFormats/Scouting/interface/Run3ScoutingPhoton.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DataFormats_Run3ScoutingPhoton_h

#include <vector>
#include <cstdint>

// Class for holding photon information, for use in data scouting
// IMPORTANT: the content of this class should be changed only in backwards compatible ways!
Expand All @@ -20,8 +21,9 @@ class Run3ScoutingPhoton {
float r9,
float sMin,
float sMaj,
unsigned int seedId,
uint32_t seedId,
std::vector<float> energyMatrix,
std::vector<uint32_t> detIds,
std::vector<float> timingMatrix)
: pt_(pt),
eta_(eta),
Expand All @@ -37,6 +39,7 @@ class Run3ScoutingPhoton {
sMaj_(sMaj),
seedId_(seedId),
energyMatrix_(std::move(energyMatrix)),
detIds_(std::move(detIds)),
timingMatrix_(std::move(timingMatrix)) {}
//default constructor
Run3ScoutingPhoton()
Expand Down Expand Up @@ -69,8 +72,9 @@ class Run3ScoutingPhoton {
float r9() const { return r9_; }
float sMin() const { return sMin_; }
float sMaj() const { return sMaj_; }
float seedId() const { return seedId_; }
uint32_t seedId() const { return seedId_; }
std::vector<float> const& energyMatrix() const { return energyMatrix_; }
std::vector<uint32_t> const& detIds() const { return detIds_; }
std::vector<float> const& timingMatrix() const { return timingMatrix_; }

private:
Expand All @@ -86,8 +90,9 @@ class Run3ScoutingPhoton {
float r9_;
float sMin_;
float sMaj_;
unsigned int seedId_;
uint32_t seedId_;
std::vector<float> energyMatrix_;
std::vector<uint32_t> detIds_;
std::vector<float> timingMatrix_;
};

Expand Down
6 changes: 4 additions & 2 deletions DataFormats/Scouting/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@
<class name="Run3ScoutingVertex" ClassVersion="3">
<version ClassVersion="3" checksum="316446070"/>
</class>
<class name="Run3ScoutingElectron" ClassVersion="3">
<class name="Run3ScoutingElectron" ClassVersion="4">
<version ClassVersion="3" checksum="1086011373"/>
<version ClassVersion="4" checksum="1250202632"/>
</class>
<class name="Run3ScoutingMuon" ClassVersion="3">
<version ClassVersion="3" checksum="3882497397"/>
</class>
<class name="Run3ScoutingPhoton" ClassVersion="3">
<class name="Run3ScoutingPhoton" ClassVersion="4">
<version ClassVersion="3" checksum="1683146807"/>
<version ClassVersion="4" checksum="1725280278"/>
</class>
<class name="Run3ScoutingTrack" ClassVersion="3">
<version ClassVersion="3" checksum="3352318277"/>
Expand Down
13 changes: 9 additions & 4 deletions HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Description: Producer for Run3ScoutingElectron and Run3ScoutingPhoton

#include "HLTScoutingEgammaProducer.h"

#include <cstdint>

// function to find rechhit associated to detid and return energy
float recHitE(const DetId id, const EcalRecHitCollection& recHits) {
if (id == DetId(0)) {
Expand Down Expand Up @@ -205,20 +207,21 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e
float sMin = moments.sMin;
float sMaj = moments.sMaj;

unsigned int seedId = (*SCseed).seed();
uint32_t seedId = (*SCseed).seed();

std::vector<DetId> mDetIds = EcalClusterTools::matrixDetId((topology), (*SCseed).seed(), rechitMatrixSize);

int detSize = mDetIds.size();
std::vector<uint32_t> mDetIdIds(detSize, 0);
std::vector<float> mEnergies(detSize, 0.);
std::vector<float> mTimes(detSize, 0.);

for (int i = 0; i < detSize; i++) {
mDetIdIds[i] = mDetIds[i];
mEnergies[i] =
MiniFloatConverter::reduceMantissaToNbitsRounding(recHitE(mDetIds.at(i), *rechits), mantissaPrecision);
MiniFloatConverter::reduceMantissaToNbitsRounding(recHitE(mDetIds[i], *rechits), mantissaPrecision);
if (saveRecHitTiming)
mTimes[i] =
MiniFloatConverter::reduceMantissaToNbitsRounding(recHitT(mDetIds.at(i), *rechits), mantissaPrecision);
mTimes[i] = MiniFloatConverter::reduceMantissaToNbitsRounding(recHitT(mDetIds[i], *rechits), mantissaPrecision);
}

float HoE = 999.;
Expand Down Expand Up @@ -254,6 +257,7 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e
sMaj,
seedId,
mEnergies,
mDetIdIds,
mTimes); //read for(ieta){for(iphi){}}
} else { // Candidate is a scouting electron
outElectrons->emplace_back(candidate.pt(),
Expand All @@ -277,6 +281,7 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e
sMaj,
seedId,
mEnergies,
mDetIdIds,
mTimes); //read for(ieta){for(iphi){}}
}
}
Expand Down

0 comments on commit 0cd224f

Please sign in to comment.