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"});
49 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.;
51 int nSL = 0, nSM = 0, nSE = 0;
56 std::vector<fastjet::PseudoJet> currentAxes;
60 if (tau1 != 0.) tau21 = tau2/tau1;
67 for (
size_t itt=0; itt < trackSize; ++itt)
72 float track_PVweight = 0.;
74 if (track_PVweight>0.) { allKinematics.
add(ptrack, track_PVweight); }
79 std::map<double, size_t> VTXmass;
80 for (
size_t vtx = 0; vtx < svTagInfo.nVertices(); ++vtx)
82 vertexNTracks += (svTagInfo.secondaryVertex(vtx)).numberOfSourceCandidatePtrs();
87 VTXmass[svTagInfo.secondaryVertex(vtx).p4().mass()]=vtx;
94 for ( std::map<double, size_t>::reverse_iterator iVtx=VTXmass.rbegin(); iVtx!=VTXmass.rend(); ++iVtx)
104 SV_mass_0 = vertex.
p4().mass() ;
105 SV_EnergyRatio_0 = vertexSum.E() / allSum.E();
106 SV_pt_0 = vertex.
p4().pt();
107 flightDir_0 = svTagInfo.flightDirection(iVtx->second);
108 SV_p4_0 = vertex.
p4();
111 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());
113 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());
117 SV_EnergyRatio_1= vertexSum.E() / allSum.E();
118 flightDir_1 = svTagInfo.flightDirection(iVtx->second);
119 SV_p4_1 = vertex.
p4();
120 z_ratio =
reco::deltaR(flightDir_0,flightDir_1)*SV_pt_0/(SV_p4_0+SV_p4_1).mass();
125 nSM = muonTagInfo.leptons();
126 nSE = elecTagInfo.leptons();
129 float PFLepton_ptrel = -1., PFLepton_IP2D = -1.;
132 for (
size_t leptIdx = 0; leptIdx < muonTagInfo.leptons() ; ++leptIdx)
134 float PFMuon_ptrel = (muonTagInfo.properties(leptIdx).ptRel);
135 if (PFMuon_ptrel > PFLepton_ptrel )
137 PFLepton_ptrel = PFMuon_ptrel;
138 PFLepton_IP2D = (muonTagInfo.properties(leptIdx).sip2d);
143 for (
size_t leptIdx = 0; leptIdx < elecTagInfo.leptons() ; ++leptIdx)
145 float PFElectron_ptrel = (elecTagInfo.properties(leptIdx).ptRel);
146 if (PFElectron_ptrel > PFLepton_ptrel )
148 PFLepton_ptrel = PFElectron_ptrel;
149 PFLepton_IP2D = (elecTagInfo.properties(leptIdx).sip2d);
153 std::map<std::string,float>
inputs;
154 inputs[
"z_ratio1"] = z_ratio;
155 inputs[
"tau_dot"] = tau_dot;
156 inputs[
"SV_mass_0"] = SV_mass_0;
157 inputs[
"SV_vtx_EnergyRatio_0"] = SV_EnergyRatio_0;
158 inputs[
"SV_vtx_EnergyRatio_1"] = SV_EnergyRatio_1;
160 inputs[
"PFLepton_ptrel"] = PFLepton_ptrel;
161 inputs[
"PFLepton_IP2D"] = PFLepton_IP2D;
163 inputs[
"tau2/tau1"] = tau21;
166 value =
mvaID->evaluate(inputs);
175 std::vector<fastjet::PseudoJet> fjParticles;
180 if ( daughter.isNonnull() && daughter.isAvailable() )
181 fjParticles.push_back( fastjet::PseudoJet( daughter->px(), daughter->py(), daughter->pz(), daughter->energy() ) );
183 edm::LogWarning(
"MissingJetConstituent") <<
"Jet constituent required for N-subjettiness computation is missing!";
207 if( baseRef == trackBaseRef )
242 for(std::vector<reco::CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
243 const reco::Track& mytrack = *(*track)->bestTrack();
244 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
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
edm::FileInPath weightFile_
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