Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #49 from daiktas/master
Browse files Browse the repository at this point in the history
remove pre-processing
  • Loading branch information
vcepaitis authored Jun 5, 2019
2 parents f67d283 + 61408f4 commit e922964
Show file tree
Hide file tree
Showing 10 changed files with 409 additions and 545 deletions.
2 changes: 2 additions & 0 deletions Jet/interface/ChargedPFTagData.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ChargedPFTagData:
float fromPV;
float puppi_weight;
float track_chi2;
float track_ndof;
float track_quality;

float jetmassdroprel;
Expand Down Expand Up @@ -78,6 +79,7 @@ class ChargedPFTagData:
cpfDataArray.bookProperty("fromPV",&Data::fromPV);
cpfDataArray.bookProperty("puppi_weight",&Data::puppi_weight);
cpfDataArray.bookProperty("track_chi2",&Data::track_chi2);
cpfDataArray.bookProperty("track_ndof",&Data::track_ndof);
cpfDataArray.bookProperty("track_quality",&Data::track_quality);

cpfDataArray.bookProperty("jetmassdroprel",&Data::jetmassdroprel);
Expand Down
2 changes: 1 addition & 1 deletion Jet/interface/GlobalJetTagData.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class GlobalJetTagData:
array.bookProperty("pt", &Data::pt);
array.bookProperty("eta", &Data::eta);
array.bookProperty("phi", &Data::phi);
array.bookProperty("jetIdx", &Data::phi);
array.bookProperty("jetIdx", &Data::jetIdx);
for (unsigned int i = 0; i < jetData.size(); ++i)
{
array.fill(&jetData[i], i);
Expand Down
4 changes: 2 additions & 2 deletions Jet/interface/SVTagData.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SVTagData:
float mass;
float ntracks;
float chi2;
float normchi2;
float ndof;
float dxy;
float dxysig;
float d3d;
Expand Down Expand Up @@ -49,7 +49,7 @@ class SVTagData:
svDataArray.bookProperty("mass",&Data::mass);
svDataArray.bookProperty("ntracks",&Data::ntracks);
svDataArray.bookProperty("chi2",&Data::chi2);
svDataArray.bookProperty("normchi2",&Data::normchi2);
svDataArray.bookProperty("ndof",&Data::ndof);
svDataArray.bookProperty("dxy",&Data::dxy);
svDataArray.bookProperty("dxysig",&Data::dxysig);
svDataArray.bookProperty("d3d",&Data::d3d);
Expand Down
33 changes: 7 additions & 26 deletions Jet/plugins/CSVInputTagPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,11 @@ class CSVInputTagDataPlugin:

//http://cmslxr.fnal.gov/source/DataFormats/BTauReco/interface/TaggingVariable.h?v=CMSSW_9_4_0_pre1#0033
float trackSumJetEtRatio = vars.get(reco::btau::trackSumJetEtRatio, -1);
if (trackSumJetEtRatio>0) trackSumJetEtRatio = 0.1/(0.1+trackSumJetEtRatio);
jetTagData.trackSumJetEtRatio = trackSumJetEtRatio;

float trackSumJetDeltaR = vars.get(reco::btau::trackSumJetDeltaR, -1);
if (trackSumJetDeltaR>0) trackSumJetDeltaR = 0.1/(0.1+trackSumJetDeltaR);
jetTagData.trackSumJetDeltaR = trackSumJetDeltaR;



jetTagData.vertexCategory = vars.get(reco::btau::vertexCategory, -1);
jetTagData.jetNSelectedTracks = vars.get(reco::btau::jetNSelectedTracks, -1);
jetTagData.jetNTracksEtaRel = vars.get(reco::btau::jetNTracksEtaRel, -1);
Expand All @@ -91,31 +88,15 @@ class CSVInputTagDataPlugin:
//the significances take often the values -1
//this maybe a bug and happen if trackSip2dValAboveCharm = -1 thus the reset value is ignored
//cmslxr.fnal.gov/source/RecoBTag/SecondaryVertex/plugins/TemplatedSecondaryVertexProducer.cc?v=CMSSW_9_4_0
if (trackSip2dValAboveCharm<0)
{
trackSip2dSigAboveCharm = -1;
jetTagData.trackSip2dValAboveCharm = trackSip2dValAboveCharm;
jetTagData.trackSip2dSigAboveCharm = trackSip2dSigAboveCharm;
}
else
{
jetTagData.trackSip2dValAboveCharm = trackSip2dValAboveCharm;
jetTagData.trackSip2dSigAboveCharm = std::log10(1+trackSip2dSigAboveCharm);
}
jetTagData.trackSip2dValAboveCharm = trackSip2dValAboveCharm;
jetTagData.trackSip2dSigAboveCharm = trackSip2dSigAboveCharm;

float trackSip3dValAboveCharm = vars.get(reco::btau::trackSip2dValAboveCharm, -1);
float trackSip3dSigAboveCharm = vars.get(reco::btau::trackSip3dSigAboveCharm, -1);
if (trackSip3dValAboveCharm<0)
{
trackSip3dSigAboveCharm = -1;
jetTagData.trackSip3dValAboveCharm = trackSip3dValAboveCharm;
jetTagData.trackSip3dSigAboveCharm = trackSip3dSigAboveCharm;
}
else
{
jetTagData.trackSip3dValAboveCharm = trackSip3dValAboveCharm;
jetTagData.trackSip3dSigAboveCharm = std::log10(10+trackSip3dSigAboveCharm);
}

jetTagData.trackSip3dValAboveCharm = trackSip3dValAboveCharm;
jetTagData.trackSip3dSigAboveCharm = trackSip3dSigAboveCharm;

output->at(0).jetData.push_back(jetTagData);
}

Expand Down
29 changes: 15 additions & 14 deletions Jet/plugins/ChargedPFTagPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class ChargedPFTagDataPlugin:
{
const pat::Jet& jet = jetCollection->at(ijet);
const float jet_pt_uncorr = jet.correctedJet("Uncorrected").pt();
//const float jet_e_uncorr = jet.correctedJet("Uncorrected").energy();

std::vector<nanox::ChargedPFTagData::Data> cpfData;
for (unsigned int idaughter = 0; idaughter < jet.numberOfDaughters(); ++idaughter)
Expand All @@ -90,7 +89,7 @@ class ChargedPFTagDataPlugin:

nanox::ChargedPFTagData::Data data;

data.ptrel = 0.01/(0.01+constituent->pt()/jet_pt_uncorr);
data.ptrel = constituent->pt()/jet_pt_uncorr;

data.drminsv = 0.4;
for (const auto& sv: *svCollection.product())
Expand All @@ -102,10 +101,12 @@ class ChargedPFTagDataPlugin:
data.vertex_association = constituent->pvAssociationQuality();
data.fromPV = constituent->fromPV();
data.puppi_weight = constituent->puppiWeight();
data.track_chi2 = std::log10(constituent->pseudoTrack().chi2()/constituent->pseudoTrack().ndof()+1);
data.track_chi2 = constituent->pseudoTrack().chi2();
data.track_ndof = constituent->pseudoTrack().ndof();
data.track_quality = constituent->pseudoTrack().qualityMask();

if (jet.mass()<1e-10) data.jetmassdroprel = 0;
else data.jetmassdroprel = std::log10(1-(jet.p4()-constituent->p4()).mass()/jet.mass());
else data.jetmassdroprel = (jet.p4()-constituent->p4()).mass()/jet.mass();

reco::TransientTrack transientTrack = builder->build(constituent->pseudoTrack());
reco::Candidate::Vector jetDir = jet.momentum().Unit();
Expand All @@ -120,18 +121,18 @@ class ChargedPFTagDataPlugin:
TVector3 jetDir3(jetDir.x(),jetDir.y(),jetDir.z());

data.trackEtaRel=reco::btau::etaRel(jetDir, trackMom);
data.trackPtRel=std::log10(trackMom3.Perp(jetDir3));
data.trackPPar=std::log10(1+jetDir.Dot(trackMom));
data.trackPtRel=trackMom3.Perp(jetDir3);
data.trackPPar=jetDir.Dot(trackMom);
data.trackDeltaR=reco::deltaR(trackMom, jetDir);
data.trackPtRatio=std::log10(1-data.trackPtRel / trackMag);
data.trackPParRatio=std::log10(1+data.trackPPar / trackMag);
data.trackPtRatio=data.trackPtRel / trackMag;
data.trackPParRatio=data.trackPPar / trackMag;

data.trackSip2dVal=std::copysign(std::log10(std::fabs(meas_ip2d.value())),meas_ip2d.value());
data.trackSip2dSig=std::copysign(std::log10(std::fabs(meas_ip2d.significance())),meas_ip2d.significance());
data.trackSip3dVal=std::copysign(std::log10(std::fabs(meas_ip3d.value())),meas_ip3d.value());
data.trackSip3dSig=std::copysign(std::log10(std::fabs(meas_ip3d.significance())),meas_ip3d.significance());
data.trackSip2dVal=std::abs(meas_ip2d.value());
data.trackSip2dSig=std::abs(meas_ip2d.significance());
data.trackSip3dVal=std::abs(meas_ip3d.value());
data.trackSip3dSig=std::abs(meas_ip3d.significance());

data.trackJetDistVal = std::log10(1-jetdist.value());
data.trackJetDistVal = jetdist.value();
data.trackJetDistSig = jetdist.significance();

float sumPt = 0.;
Expand All @@ -143,7 +144,7 @@ class ChargedPFTagDataPlugin:
sumPt += other->pt();
}
}
data.relIso01 = 10./(10.+sumPt/constituent->pt());
data.relIso01 = sumPt/constituent->pt();

data.lostInnerHits = constituent->lostInnerHits(); //http://cmsdoxygen.web.cern.ch/cmsdoxygen/CMSSW_9_4_4/doc/html/d8/d79/classpat_1_1PackedCandidate.html#ab9ef9a12f92e02fa61653ba77ee34274

Expand Down
2 changes: 1 addition & 1 deletion Jet/plugins/JetOriginTagPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class JetOriginTagDataPlugin:
{
mother = mother->mother();
}
//find gluon anchestor
//find gluon ancestor
if (mother->mother() and mother->mother()->pdgId()==21)
{
nGluons+=1;
Expand Down
10 changes: 5 additions & 5 deletions Jet/plugins/NeutralPFTagPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class NeutralPFTagDataPlugin:
{
const pat::Jet& jet = jetCollection->at(ijet);
const float jet_pt_uncorr = jet.correctedJet("Uncorrected").pt();
//const float jet_e_uncorr = jet.correctedJet("Uncorrected").energy();

std::vector<nanox::NeutralPFTagData::Data> npfData;
for (unsigned int idaughter = 0; idaughter < jet.numberOfDaughters(); ++idaughter)
Expand All @@ -76,7 +75,7 @@ class NeutralPFTagDataPlugin:

nanox::NeutralPFTagData::Data data;

data.ptrel = 0.01/(0.01+constituent->pt()/jet_pt_uncorr);
data.ptrel = constituent->pt()/jet_pt_uncorr;
data.puppi_weight = constituent->puppiWeight();
data.deltaR = reco::deltaR(*constituent,jet);
data.isGamma = fabs(constituent->pdgId())==22;
Expand All @@ -89,8 +88,9 @@ class NeutralPFTagDataPlugin:
data.drminsv = std::min(data.drminsv,dR);
}

if (jet.mass()<1e-10) data.jetmassdroprel = 0;
else data.jetmassdroprel = std::log10(1-(jet.p4()-constituent->p4()).mass()/jet.mass());
if (jet.mass()<1e-10) data.jetmassdroprel = -9;
else data.jetmassdroprel = (jet.p4()- constituent->p4()).mass()/jet.mass();


float sumPt = 0.;
for (unsigned int jdaughter = 0; jdaughter < jet.numberOfDaughters(); ++jdaughter)
Expand All @@ -101,7 +101,7 @@ class NeutralPFTagDataPlugin:
sumPt += other->pt();
}
}
data.relIso01 = 10./(10.+sumPt/constituent->pt());
data.relIso01 = sumPt/constituent->pt();

npfData.emplace_back(data);
}
Expand Down
18 changes: 9 additions & 9 deletions Jet/plugins/SVTagPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,29 +87,29 @@ class SVTagDataPlugin:
data.pt = std::log10(sv.pt());

data.deltaR = reco::deltaR(sv,jet);
data.mass = std::log10(1+sv.mass());
data.mass = sv.mass();
data.ntracks = sv.numberOfDaughters();
data.chi2 = std::log10(sv.vertexChi2());
data.normchi2 = std::log10(sv.vertexChi2()/sv.vertexNdof());
data.chi2 = sv.vertexChi2();
data.ndof = sv.vertexNdof();

reco::Vertex::CovarianceMatrix covsv;
sv.fillVertexCovariance(covsv);
reco::Vertex svtx(sv.vertex(), covsv);

VertexDistanceXY distXY;
Measurement1D distanceXY = distXY.distance(svtx, pv);
data.dxy = 0.1/(0.1+distanceXY.value());
data.dxysig = std::log10(distanceXY.value()/distanceXY.error());
data.dxy = distanceXY.value();
data.dxysig = distanceXY.value()/distanceXY.error();

VertexDistance3D dist3D;
Measurement1D distance3D = dist3D.distance(svtx, pv);
data.d3d = 0.1/(0.1+distance3D.value());
data.d3dsig = std::log10(distance3D.value()/distance3D.error());
data.d3d = distance3D.value();
data.d3dsig = distance3D.value()/distance3D.error();

reco::Candidate::Vector distance(sv.vx() - pv.x(), sv.vy() - pv.y(), sv.vz() - pv.z());
data.costhetasvpv = 0.01/(1.01-sv.momentum().Unit().Dot(distance.Unit()));
data.costhetasvpv = sv.momentum().Unit().Dot(distance.Unit());

data.enratio = 0.1/(0.1+sv.energy()/jet_e_uncorr);
data.enratio = sv.energy()/jet_e_uncorr;


svData.emplace_back(data);
Expand Down
Loading

0 comments on commit e922964

Please sign in to comment.