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);