62 #include "TLorentzVector.h" 73 enum Alg { useKalmanFit = 0, useTrackHelix };
94 std::unique_ptr<StringCutObjectSelector<reco::PFTau>>
cut_;
100 : PFTauTag_(iConfig.getParameter<
edm::
InputTag>(
"PFTauTag")),
101 PFTauTIPTag_(iConfig.getParameter<
edm::
InputTag>(
"PFTauTIPTag")),
102 Algorithm_(iConfig.getParameter<
int>(
"Algorithm")),
103 ndfPVT_(iConfig.getUntrackedParameter(
"ndfPVT", (
int)5)) {
106 iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"discriminators");
114 newCut->
cut_ =
pset.getParameter<
double>(
"selectionCut");
118 if (iConfig.
exists(
"cut"))
121 produces<edm::AssociationVector<PFTauRefProd, std::vector<reco::PFTau3ProngSummaryRef>>>();
122 produces<PFTau3ProngSummaryCollection>(
"PFTau3ProngSummary");
139 if (packedCand !=
nullptr)
157 auto AVPFTau3PS = std::make_unique<edm::AssociationVector<PFTauRefProd, std::vector<reco::PFTau3ProngSummaryRef>>>(
159 auto PFTau3PSCollection_out = std::make_unique<PFTau3ProngSummaryCollection>();
178 bool passedDisc =
true;
179 if (
disc->cutFormula_)
180 passedDisc = (
disc->cutFormula_->Eval((*
disc->handle_)[
tau]) > 0.5);
197 bool SecondaryVtxOK(
false);
200 const VertexRef secVtx = theTIP->secondaryVertex();
201 GlobalPoint sv(secVtx->position().x(), secVtx->position().y(), secVtx->position().z());
202 double vtxchi2(0), vtxndf(1);
204 vtxchi2 = secVtx->chi2();
205 vtxndf = secVtx->ndof();
206 const std::vector<reco::Track>&
selectedTracks = secVtx->refittedTracks();
207 std::vector<reco::TransientTrack> transTrkVect;
211 float piMassSigma(1.
e-6), piChi(0.0), piNdf(0.0);
212 std::vector<RefCountedKinematicParticle> pions;
213 for (
unsigned int i = 0;
i < transTrkVect.size();
i++)
214 pions.push_back(kinFactory.
particle(transTrkVect[
i], pdgInfo.
pi_mass(), piChi, piNdf,
sv, piMassSigma));
216 jpTree->movePointerToTheTop();
218 AlgebraicSymMatrix77 cov = jpTree->currentParticle()->currentState().kinematicParametersError().matrix();
221 std::vector<reco::Track>
Tracks;
222 std::vector<LorentzVectorParticle> ReFitPions;
223 for (
unsigned int i = 0;
i < transTrkVect.size();
i++) {
224 c += transTrkVect[
i].charge();
225 ReFitPions.push_back(ParticleBuilder::createLorentzVectorParticle(transTrkVect[
i], *secVtx,
true,
true));
228 TVectorT<double> a1_par(LorentzVectorParticle::NLorentzandVertexPar);
229 TMatrixTSym<double> a1_cov(LorentzVectorParticle::NLorentzandVertexPar);
230 for (
int i = 0;
i < LorentzVectorParticle::NLorentzandVertexPar;
i++) {
232 for (
int j = 0;
j < LorentzVectorParticle::NLorentzandVertexPar;
j++) {
233 a1_cov(
i,
j) = cov(
i,
j);
238 SecondaryVtxOK =
true;
242 std::vector<TrackParticle> pions;
245 const std::vector<edm::Ptr<reco::Candidate>>
cands =
tau->signalChargedHadrCands();
249 if (
track !=
nullptr) {
251 pions.push_back(ParticleBuilder::createTrackParticle(transTrk, pvpoint,
true,
true));
254 TVector3
pv(secVtx->position().x(), secVtx->position().y(), secVtx->position().z());
256 SecondaryVtxOK = chi2v.fit();
258 for (
unsigned int i = 0;
i < pions.size();
i++) {
259 c += pions[
i].charge();
262 a1 = chi2v.getMother(
pdgid);
266 if (SecondaryVtxOK) {
274 pvcov(
i,
j) = pvCov(
i,
j);
277 for (
unsigned int i = 0;
i < PFTau3ProngSummary::nsolutions;
i++) {
279 bool isFitOK = TauA1NU.
fit();
283 std::vector<TLorentzVector> daughter_p4;
284 std::vector<int> daughter_charge, daughter_PDGID;
285 for (
unsigned int d = 0;
d < daughter.size();
d++) {
286 daughter_p4.push_back(daughter[
d].p4());
287 daughter_charge.push_back((
int)daughter[
d].
charge());
288 daughter_PDGID.push_back(daughter[
d].
pdgId());
290 PFTau3PS.
AddSolution(
i, theTau.
p4(), daughter_p4, daughter_charge, daughter_PDGID, (isFitOK), 0.0, -999);
297 PFTau3PSCollection_out->push_back(PFTau3PS);
298 AVPFTau3PS->setValue(iPFTau, PFTau3PSRef);
NVertex
parameters for fixed-width plots
std::vector< reco::PFTau3ProngSummary > PFTau3ProngSummaryCollection
collection of PFTau3ProngSummary objects
KinematicParticleVertexFitter kpvFitter_
reco::GsfTrackRef gsfTrackRef() const
T getParameter(std::string const &) const
PFTau3ProngReco(const edm::ParameterSet &iConfig)
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &particles) const
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< StringCutObjectSelector< reco::PFTau > > cut_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
bool isNonnull() const
Checks for non-null.
edm::InputTag PFTauTIPTag_
edm::RefProd< PFTauCollection > PFTauRefProd
references to PFTau collection
reco::TransientTrack build(const reco::Track *p) const
std::vector< LorentzVectorParticle > getRefitDaughters()
LorentzVectorParticle getMother()
Abs< T >::type abs(const T &t)
edm::Handle< reco::PFTauDiscriminator > handle_
RefCountedKinematicParticle particle(const reco::TransientTrack &initialTrack, const ParticleMass &massGuess, float chiSquared, float degreesOfFr, float &m_sigma) const
DiscCutPairVec discriminators_
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
edm::Ref< PFTau3ProngSummaryCollection > PFTau3ProngSummaryRef
presistent reference to a PFTau3ProngSummary
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
const MagneticField * field() const
~PFTau3ProngReco() override
virtual bool AddSolution(unsigned int solution, const TLorentzVector &tau, const std::vector< TLorentzVector > &daughter_p4, const std::vector< int > &daughter_charge, const std::vector< int > &daughter_PDGID, bool has3ProngSolution, double solutionChi2, double thetaGJsig)
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepSym< double, 7 > > AlgebraicSymMatrix77
std::vector< DiscCutPair * > DiscCutPairVec
Particle reconstructed by the particle flow algorithm.
T const * get() const
Returns C++ pointer to the item.
reco::TrackRef trackRef() const
void produce(edm::Event &, const edm::EventSetup &) override
primaryVertex
hltOfflineBeamSpot for HLTMON
TLorentzVector p4() const