Skip to content

Commit

Permalink
Merge pull request #41035 from arsahasransu/from-CMSSW_13_0_0
Browse files Browse the repository at this point in the history
(13_0_X) Add additional track variables to the Run 3 scouting electron collection for low pT electrons.
  • Loading branch information
cmsbuild authored Mar 18, 2023
2 parents da250fc + 2342f30 commit dd5befd
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 27 deletions.
50 changes: 35 additions & 15 deletions DataFormats/Scouting/interface/Run3ScoutingElectron.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ class Run3ScoutingElectron {
float eta,
float phi,
float m,
float d0,
float dz,
std::vector<float> trkd0,
std::vector<float> trkdz,
std::vector<float> trkpt,
std::vector<float> trketa,
std::vector<float> trkphi,
std::vector<float> trkchi2overndf,
float dEtaIn,
float dPhiIn,
float sigmaIetaIeta,
float hOverE,
float ooEMOop,
int missingHits,
int charge,
std::vector<int> trkcharge,
float ecalIso,
float hcalIso,
float trackIso,
Expand All @@ -37,15 +41,19 @@ class Run3ScoutingElectron {
eta_(eta),
phi_(phi),
m_(m),
d0_(d0),
dz_(dz),
trkd0_(std::move(trkd0)),
trkdz_(std::move(trkdz)),
trkpt_(std::move(trkpt)),
trketa_(std::move(trketa)),
trkphi_(std::move(trkphi)),
trkchi2overndf_(std::move(trkchi2overndf)),
dEtaIn_(dEtaIn),
dPhiIn_(dPhiIn),
sigmaIetaIeta_(sigmaIetaIeta),
hOverE_(hOverE),
ooEMOop_(ooEMOop),
missingHits_(missingHits),
charge_(charge),
trkcharge_(std::move(trkcharge)),
ecalIso_(ecalIso),
hcalIso_(hcalIso),
trackIso_(trackIso),
Expand All @@ -63,15 +71,19 @@ class Run3ScoutingElectron {
eta_(0),
phi_(0),
m_(0),
d0_(0),
dz_(0),
trkd0_(0),
trkdz_(0),
trkpt_(0),
trketa_(0),
trkphi_(0),
trkchi2overndf_(0),
dEtaIn_(0),
dPhiIn_(0),
sigmaIetaIeta_(0),
hOverE_(0),
ooEMOop_(0),
missingHits_(0),
charge_(0),
trkcharge_(0),
ecalIso_(0),
hcalIso_(0),
trackIso_(0),
Expand All @@ -86,15 +98,19 @@ class Run3ScoutingElectron {
float eta() const { return eta_; }
float phi() const { return phi_; }
float m() const { return m_; }
float d0() const { return d0_; }
float dz() const { return dz_; }
std::vector<float> const& trkd0() const { return trkd0_; }
std::vector<float> const& trkdz() const { return trkdz_; }
std::vector<float> const& trkpt() const { return trkpt_; }
std::vector<float> const& trketa() const { return trketa_; }
std::vector<float> const& trkphi() const { return trkphi_; }
std::vector<float> const& trkchi2overndf() const { return trkchi2overndf_; }
float dEtaIn() const { return dEtaIn_; }
float dPhiIn() const { return dPhiIn_; }
float sigmaIetaIeta() const { return sigmaIetaIeta_; }
float hOverE() const { return hOverE_; }
float ooEMOop() const { return ooEMOop_; }
int missingHits() const { return missingHits_; }
int charge() const { return charge_; }
std::vector<int> const& trkcharge() const { return trkcharge_; }
float ecalIso() const { return ecalIso_; }
float hcalIso() const { return hcalIso_; }
float trackIso() const { return trackIso_; }
Expand All @@ -112,15 +128,19 @@ class Run3ScoutingElectron {
float eta_;
float phi_;
float m_;
float d0_;
float dz_;
std::vector<float> trkd0_;
std::vector<float> trkdz_;
std::vector<float> trkpt_;
std::vector<float> trketa_;
std::vector<float> trkphi_;
std::vector<float> trkchi2overndf_;
float dEtaIn_;
float dPhiIn_;
float sigmaIetaIeta_;
float hOverE_;
float ooEMOop_;
int missingHits_;
int charge_;
std::vector<int> trkcharge_;
float ecalIso_;
float hcalIso_;
float trackIso_;
Expand Down
32 changes: 30 additions & 2 deletions DataFormats/Scouting/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,39 @@
<class name="Run3ScoutingVertex" ClassVersion="3">
<version ClassVersion="3" checksum="316446070"/>
</class>
<class name="Run3ScoutingElectron" ClassVersion="5">
<class name="Run3ScoutingElectron" ClassVersion="6">
<version ClassVersion="3" checksum="1086011373"/>
<version ClassVersion="4" checksum="1250202632"/>
<version ClassVersion="5" checksum="2230390721"/>
</class>
<version ClassVersion="6" checksum="2815634332"/>
</class>

<!-- Adding ioread rules for backwards compatibility -->

<ioread sourceClass="Run3ScoutingElectron" version="[3-5]"
source="float d0_;"
targetClass="Run3ScoutingElectron" target="trkd0_">
<![CDATA[
trkd0_.clear();
trkd0_.push_back(onfile.d0_);]]>
</ioread>

<ioread sourceClass="Run3ScoutingElectron" version="[3-5]"
source="float dz_;"
targetClass="Run3ScoutingElectron" target="trkdz_">
<![CDATA[
trkdz_.clear();
trkdz_.push_back(onfile.dz_);]]>
</ioread>

<ioread sourceClass="Run3ScoutingElectron" version="[3-5]"
source="int charge_;"
targetClass="Run3ScoutingElectron" target="trkcharge_">
<![CDATA[
trkcharge_.clear();
trkcharge_.push_back(onfile.charge_);]]>
</ioread>

<class name="Run3ScoutingMuon" ClassVersion="4">
<version ClassVersion="3" checksum="3882497397"/>
<version ClassVersion="4" checksum="4206297195"/>
Expand Down
42 changes: 32 additions & 10 deletions HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,39 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e
continue;
}

float d0 = 0.0;
float dz = 0.0;
int charge = -999;
unsigned int const maxTrkSize = EgammaGsfTrackCollection->size();
std::vector<float> trkd0;
std::vector<float> trkdz;
std::vector<float> trkpt;
std::vector<float> trketa;
std::vector<float> trkphi;
std::vector<float> trkchi2overndf;
std::vector<int> trkcharge;
trkd0.reserve(maxTrkSize);
trkdz.reserve(maxTrkSize);
trkpt.reserve(maxTrkSize);
trketa.reserve(maxTrkSize);
trkphi.reserve(maxTrkSize);
trkchi2overndf.reserve(maxTrkSize);
trkcharge.reserve(maxTrkSize);

for (auto& track : *EgammaGsfTrackCollection) {
RefToBase<TrajectorySeed> seed = track.extra()->seedRef();
reco::ElectronSeedRef elseed = seed.castTo<reco::ElectronSeedRef>();
RefToBase<reco::CaloCluster> caloCluster = elseed->caloCluster();
reco::SuperClusterRef scRefFromTrk = caloCluster.castTo<reco::SuperClusterRef>();
if (scRefFromTrk == scRef) {
d0 = track.d0();
dz = track.dz();
charge = track.charge();
trkd0.push_back(track.d0());
trkdz.push_back(track.dz());
trkpt.push_back(track.pt());
trketa.push_back(track.eta());
trkphi.push_back(track.phi());
auto const trackndof = track.ndof();
trkchi2overndf.push_back(((trackndof == 0) ? -1 : (track.chi2() / trackndof)));
trkcharge.push_back(track.charge());
}
}
if (charge == -999) { // No associated track. Candidate is a scouting photon
if (trkcharge.empty()) { // No associated track. Candidate is a scouting photon
outPhotons->emplace_back(candidate.pt(),
candidate.eta(),
candidate.phi(),
Expand All @@ -310,15 +328,19 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e
candidate.eta(),
candidate.phi(),
candidate.mass(),
d0,
dz,
trkd0,
trkdz,
trkpt,
trketa,
trkphi,
trkchi2overndf,
(*DetaMap)[candidateRef],
(*DphiMap)[candidateRef],
(*SigmaIEtaIEtaMap)[candidateRef],
HoE,
(*OneOEMinusOneOPMap)[candidateRef],
(*MissingHitsMap)[candidateRef],
charge,
trkcharge,
(*EcalPFClusterIsoMap)[candidateRef],
(*HcalPFClusterIsoMap)[candidateRef],
(*EleGsfTrackIsoMap)[candidateRef],
Expand Down

0 comments on commit dd5befd

Please sign in to comment.