Skip to content

Commit

Permalink
rm jetIdx/ fixed frac01..04
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-komm authored and matt-komm committed Nov 16, 2020
1 parent 8b455ef commit 17186f5
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 30 deletions.
2 changes: 0 additions & 2 deletions DataFormats/interface/ChargedCandidateFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace llpdnnx {

struct ChargedCandidateFeatures
{
int jetIdx;
float ptrel;
float deta;
float dphi;
Expand Down Expand Up @@ -60,7 +59,6 @@ struct ChargedCandidateFeatures
float dZmin;

ChargedCandidateFeatures():
jetIdx(-1),
ptrel(-1),
deta(1),
dphi(1),
Expand Down
2 changes: 0 additions & 2 deletions DataFormats/interface/ElectronCandidateFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace llpdnnx {

struct ElectronCandidateFeatures {
int jetIdx;
float ptrel;
float deltaR;
float deta;
Expand Down Expand Up @@ -106,7 +105,6 @@ struct ElectronCandidateFeatures {


ElectronCandidateFeatures():
jetIdx(-1),
ptrel(0),
deltaR(0),
deta(0),
Expand Down
2 changes: 0 additions & 2 deletions DataFormats/interface/JetFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace llpdnnx {

struct JetFeatures
{
int jetIdx;
float pt;
float eta;
float phi;
Expand Down Expand Up @@ -56,7 +55,6 @@ struct JetFeatures
int numberElectron;

JetFeatures():
jetIdx(-1),
pt(-1),
eta(0),
phi(0),
Expand Down
2 changes: 0 additions & 2 deletions DataFormats/interface/LLPLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class LLPLabel {

TauDecay tauDecay;

int jetIdx;
int partonFlavor;
int hadronFlavor;
int llpId;
Expand All @@ -97,7 +96,6 @@ class LLPLabel {
LLPLabel():
type(Type::isUndefined),
tauDecay(TauDecay::NO_TAU),
jetIdx(-1),
partonFlavor(0),
hadronFlavor(0),
llpId(0),
Expand Down
2 changes: 0 additions & 2 deletions DataFormats/interface/MuonCandidateFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace llpdnnx {

struct MuonCandidateFeatures {

int jetIdx;
int isGlobal;
int isTight;
int isMedium;
Expand Down Expand Up @@ -63,7 +62,6 @@ struct MuonCandidateFeatures {


MuonCandidateFeatures():
jetIdx(-1),
isGlobal(-1),
isTight(-1),
isMedium(-1),
Expand Down
2 changes: 0 additions & 2 deletions DataFormats/interface/NeutralCandidateFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace llpdnnx {

struct NeutralCandidateFeatures
{
int jetIdx;
float ptrel;
float deta;
float dphi;
Expand All @@ -24,7 +23,6 @@ struct NeutralCandidateFeatures
float relmassdrop;

NeutralCandidateFeatures():
jetIdx(-1),
ptrel(0),
deta(0),
dphi(0),
Expand Down
3 changes: 0 additions & 3 deletions DataFormats/interface/SecondaryVertexFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ namespace llpdnnx {

struct SecondaryVertexFeatures
{

int jetIdx;
float ptrel;
float deta;
float dphi;
Expand All @@ -28,7 +26,6 @@ struct SecondaryVertexFeatures
float vz;

SecondaryVertexFeatures():
jetIdx(-1),
ptrel(0),
deta(0),
dphi(0),
Expand Down
14 changes: 13 additions & 1 deletion DataFormats/interface/ShallowTagInfoFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace llpdnnx {
struct ShallowTagInfoFeatures
{
// jet general
int jetIdx;
float trackSumJetEtRatio; // ratio of track sum transverse energy over jet energy
float trackSumJetDeltaR; // pseudoangular distance between jet axis and track fourvector sum
int vertexCategory; // category of secondary vertex (Reco, Pseudo, No)
Expand All @@ -17,6 +16,19 @@ struct ShallowTagInfoFeatures
// track info
int jetNTracksEtaRel; // tracks associated to jet for which trackEtaRel is calculated
int jetNSelectedTracks;

ShallowTagInfoFeatures():
trackSumJetEtRatio(0), // ratio of track sum transverse energy over jet energy
trackSumJetDeltaR(0), // pseudoangular distance between jet axis and track fourvector sum
vertexCategory(0), // category of secondary vertex (Reco, Pseudo, No)
trackSip2dValAboveCharm(0), // track 2D signed impact parameter of first track lifting mass above charm
trackSip2dSigAboveCharm(0), // track 2D signed impact parameter significance of first track lifting mass above charm
trackSip3dValAboveCharm(0), // track 3D signed impact parameter of first track lifting mass above charm
trackSip3dSigAboveCharm(0), // track 3D signed impact parameter significance of first track lifting mass above charm
// track info
jetNTracksEtaRel(0), // tracks associated to jet for which trackEtaRel is calculated
jetNSelectedTracks(0)
{}

};

Expand Down
29 changes: 15 additions & 14 deletions XTagInfoProducer/plugins/XTagInfoProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,11 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
features.jet_features.jetRchg = jetRchg;
features.jet_features.jetR = jetR;

int beta = 0;
int frac01 = 0;
int frac02 = 0;
int frac03 = 0;
int frac04 = 0;
float beta = 0;
features.jet_features.frac01 = 0;
features.jet_features.frac02 = 0;
features.jet_features.frac03 = 0;
features.jet_features.frac04 = 0;
float dR2Mean = 0;
float pt2Sum = 0;

Expand All @@ -842,27 +842,28 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
beta += cpf.fromPV;
dR2Mean += (cpf.ptrel*cpf.trackDeltaR) * (cpf.ptrel*cpf.trackDeltaR);
pt2Sum += (cpf.ptrel) * (cpf.ptrel);
if (cpf.trackDeltaR < 0.1) frac01+=cpf.ptrel;
else if (cpf.trackDeltaR < 0.2) frac02+=cpf.ptrel;
else if (cpf.trackDeltaR < 0.3) frac03+=cpf.ptrel;
else if (cpf.trackDeltaR < 0.4) frac04+=cpf.ptrel;
if (cpf.trackDeltaR < 0.1) features.jet_features.frac01+=cpf.ptrel;
else if (cpf.trackDeltaR < 0.2) features.jet_features.frac02+=cpf.ptrel;
else if (cpf.trackDeltaR < 0.3) features.jet_features.frac03+=cpf.ptrel;
else if (cpf.trackDeltaR < 0.4) features.jet_features.frac04+=cpf.ptrel;
}

if (features.cpf_features.size() > 0)
{
features.jet_features.beta = (float)beta/(float)features.cpf_features.size();
features.jet_features.beta = 1.*beta/features.cpf_features.size();
}

for (size_t i = 0; i < features.npf_features.size(); i++){
llpdnnx::NeutralCandidateFeatures npf = features.npf_features.at(i);
dR2Mean += (npf.ptrel*npf.deltaR) * (npf.ptrel*npf.deltaR);
pt2Sum += (npf.ptrel) * (npf.ptrel);
if (npf.deltaR < 0.1) frac01+=npf.ptrel;
else if (npf.deltaR < 0.2) frac02+=npf.ptrel;
else if (npf.deltaR < 0.3) frac03+=npf.ptrel;
else if (npf.deltaR < 0.4) frac04+=npf.ptrel;
if (npf.deltaR < 0.1) features.jet_features.frac01+=npf.ptrel;
else if (npf.deltaR < 0.2) features.jet_features.frac02+=npf.ptrel;
else if (npf.deltaR < 0.3) features.jet_features.frac03+=npf.ptrel;
else if (npf.deltaR < 0.4) features.jet_features.frac04+=npf.ptrel;
}

features.jet_features.dR2Mean = dR2Mean/pt2Sum;

features.jet_features.numberCpf = features.cpf_features.size();
features.jet_features.numberNpf = features.npf_features.size();
Expand Down

0 comments on commit 17186f5

Please sign in to comment.