12 beta_(parameters.getParameter<double>(
"beta")),
13 R0_(parameters.getParameter<double>(
"R0")),
14 njettiness_(fastjet::contrib::OnePass_KT_Axes(), fastjet::contrib::NormalizedMeasure(beta_,R0_)),
15 maxSVDeltaRToJet_(parameters.getParameter<double>(
"maxSVDeltaRToJet")),
16 weightFile_(parameters.getParameter<edm::
FileInPath>(
"weightFile"))
18 uses(0,
"ipTagInfos");
19 uses(1,
"svTagInfos");
20 uses(2,
"muonTagInfos");
21 uses(3,
"elecTagInfos");
26 std::vector<std::string>
variables({
"PFLepton_ptrel",
"z_ratio1",
"tau_dot",
"SV_mass_0",
"SV_vtx_EnergyRatio_0",
27 "SV_vtx_EnergyRatio_1",
"PFLepton_IP2D",
"tau2/tau1",
"nSL",
"jetNTracksEtaRel"});
28 std::vector<std::string> spectators({
"massGroomed",
"flavour",
"nbHadrons",
"ptGroomed",
"etaGroomed"});
46 float z_ratio = -1. , tau_dot = -1., SV_pt_0 = -1., SV_mass_0 = -1., SV_EnergyRatio_0 = -1., SV_EnergyRatio_1 = -1., tau21 = -1.;
48 int nSL = 0, nSM = 0, nSE = 0;
53 std::vector<fastjet::PseudoJet> currentAxes;
57 if (tau1 != 0.) tau21 = tau2/tau1;
64 for (
size_t itt=0; itt < trackSize; ++itt)
69 float track_PVweight = 0.;
71 if (track_PVweight>0.) { allKinematics.
add(ptrack, track_PVweight); }
76 std::map<double, size_t> VTXmass;
77 for (
size_t vtx = 0; vtx < svTagInfo.nVertices(); ++vtx)
79 vertexNTracks += (svTagInfo.secondaryVertex(vtx)).numberOfSourceCandidatePtrs();
84 VTXmass[svTagInfo.secondaryVertex(vtx).p4().mass()]=vtx;
91 for ( std::map<double, size_t>::reverse_iterator iVtx=VTXmass.rbegin(); iVtx!=VTXmass.rend(); ++iVtx)
101 SV_mass_0 = vertex.
p4().mass() ;
102 SV_EnergyRatio_0 = vertexSum.E() / allSum.E();
103 SV_pt_0 = vertex.
p4().pt();
104 flightDir_0 = svTagInfo.flightDirection(iVtx->second);
105 SV_p4_0 = vertex.
p4();
108 tau_dot = (currentAxes[1].px()*flightDir_0.
x()+currentAxes[1].py()*flightDir_0.
y()+currentAxes[1].pz()*flightDir_0.
z())/(
sqrt(currentAxes[1].modp2())*flightDir_0.
mag());
110 tau_dot = (currentAxes[0].px()*flightDir_0.
x()+currentAxes[0].py()*flightDir_0.
y()+currentAxes[0].pz()*flightDir_0.
z())/(
sqrt(currentAxes[0].modp2())*flightDir_0.
mag());
114 SV_EnergyRatio_1= vertexSum.E() / allSum.E();
115 flightDir_1 = svTagInfo.flightDirection(iVtx->second);
116 SV_p4_1 = vertex.
p4();
117 z_ratio =
reco::deltaR(flightDir_0,flightDir_1)*SV_pt_0/(SV_p4_0+SV_p4_1).mass();
122 nSM = muonTagInfo.leptons();
123 nSE = elecTagInfo.leptons();
126 float PFLepton_ptrel = -1., PFLepton_IP2D = -1.;
129 for (
size_t leptIdx = 0; leptIdx < muonTagInfo.leptons() ; ++leptIdx)
131 float PFMuon_ptrel = (muonTagInfo.properties(leptIdx).ptRel);
132 if (PFMuon_ptrel > PFLepton_ptrel )
134 PFLepton_ptrel = PFMuon_ptrel;
135 PFLepton_IP2D = (muonTagInfo.properties(leptIdx).sip2d);
140 for (
size_t leptIdx = 0; leptIdx < elecTagInfo.leptons() ; ++leptIdx)
142 float PFElectron_ptrel = (elecTagInfo.properties(leptIdx).ptRel);
143 if (PFElectron_ptrel > PFLepton_ptrel )
145 PFLepton_ptrel = PFElectron_ptrel;
146 PFLepton_IP2D = (elecTagInfo.properties(leptIdx).sip2d);
150 std::map<std::string,float>
inputs;
151 inputs[
"z_ratio1"] = z_ratio;
152 inputs[
"tau_dot"] = tau_dot;
153 inputs[
"SV_mass_0"] = SV_mass_0;
154 inputs[
"SV_vtx_EnergyRatio_0"] = SV_EnergyRatio_0;
155 inputs[
"SV_vtx_EnergyRatio_1"] = SV_EnergyRatio_1;
157 inputs[
"PFLepton_ptrel"] = PFLepton_ptrel;
158 inputs[
"PFLepton_IP2D"] = PFLepton_IP2D;
160 inputs[
"tau2/tau1"] = tau21;
163 value =
mvaID->evaluate(inputs);
172 std::vector<fastjet::PseudoJet> fjParticles;
177 if ( daughter.isNonnull() && daughter.isAvailable() )
178 fjParticles.push_back( fastjet::PseudoJet( daughter->px(), daughter->py(), daughter->pz(), daughter->energy() ) );
180 edm::LogWarning(
"MissingJetConstituent") <<
"Jet constituent required for N-subjettiness computation is missing!";
204 if( baseRef == trackBaseRef )
239 for(std::vector<reco::CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
240 const reco::Track& mytrack = *(*track)->bestTrack();
241 vtxKinematics.
add(mytrack, 1.0);
const math::XYZTLorentzVector & weightedVectorSum() const
const T & get(unsigned int index=0) const
tuple cont
load Luminosity info ##
trackRef_iterator tracks_end() const
last iterator over tracks
void add(const reco::Track &track, double weight=1.0)
T const * get() const
Returns C++ pointer to the item.
void setTracksPV(const reco::CandidatePtr &trackRef, const reco::VertexRef &vertexRef, float &PVweight) const
virtual Vector momentum() const
spatial momentum vector
const Container & selectedTracks() const
double deltaR(const T1 &t1, const T2 &t2)
const reco::Track * toTrack(const reco::TrackBaseRef &t)
const edm::Ref< VertexCollection > & primaryVertex() const
reco::TrackRef trackRef() const
std::unique_ptr< TMVAEvaluator > mvaID
const edm::FileInPath weightFile_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
const PVAssoc fromPV(size_t ipv=0) const
void uses(unsigned int id, const std::string &label)
double deltaR2(const T1 &t1, const T2 &t2)
void setTracksPVBase(const reco::TrackRef &trackRef, const reco::VertexRef &vertexRef, float &PVweight) const
std::vector< LinkConnSpec >::const_iterator IT
const double maxSVDeltaRToJet_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
void vertexKinematics(const reco::VertexCompositePtrCandidate &vertex, reco::TrackKinematics &vertexKinematics) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Particle reconstructed by the particle flow algorithm.
void calcNsubjettiness(const reco::JetBaseRef &jet, float &tau1, float &tau2, std::vector< fastjet::PseudoJet > ¤tAxes) const
const daughters & daughterPtrVector() const
references to daughtes
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
float discriminator(const TagInfoHelper &tagInfos) const override
fastjet::contrib::Njettiness njettiness_
std::string fullPath() const
trackRef_iterator tracks_begin() const
first iterator over tracks
CandidateBoostedDoubleSecondaryVertexComputer(const edm::ParameterSet ¶meters)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector