154 auto AVPFTau3PS = std::make_unique<edm::AssociationVector<PFTauRefProd, std::vector<reco::PFTau3ProngSummaryRef>>>(
PFTauRefProd(Tau));
155 auto PFTau3PSCollection_out = std::make_unique<PFTau3ProngSummaryCollection>();
169 for(
auto const&
disc : discriminators_) {
171 bool passedDisc =
true;
172 if (
disc->cutFormula_ )passedDisc = (
disc->cutFormula_->Eval((*
disc->handle_)[
tau]) > 0.5);
173 else passedDisc = ((*
disc->handle_)[
tau] >
disc->cut_);
174 if ( !passedDisc ){
passed =
false;
break;}
183 bool SecondaryVtxOK(
false);
185 if(theTIP->hasSecondaryVertex() && primaryVertex->ndof()>
ndfPVT_){
186 const VertexRef secVtx=theTIP->secondaryVertex();
187 GlobalPoint sv(secVtx->position().x(),secVtx->position().y(),secVtx->position().z());
188 double vtxchi2(0), vtxndf(1);
190 vtxchi2=secVtx->chi2();
191 vtxndf=secVtx->ndof();
192 const std::vector<reco::Track>&
selectedTracks=secVtx->refittedTracks();
193 std::vector<reco::TransientTrack> transTrkVect;
194 for(
unsigned int i = 0;
i!=selectedTracks.size();
i++) transTrkVect.push_back(transTrackBuilder->
build(selectedTracks[
i]));
196 float piMassSigma(1.
e-6), piChi(0.0), piNdf(0.0);
197 std::vector<RefCountedKinematicParticle> pions;
198 for(
unsigned int i = 0; i<transTrkVect.size();i++) pions.push_back(kinFactory.
particle(transTrkVect[i],pdgInfo.
pi_mass(),piChi,piNdf,
sv,piMassSigma));
200 jpTree->movePointerToTheTop();
202 AlgebraicSymMatrix77 cov=jpTree->currentParticle()->currentState().kinematicParametersError().matrix();
205 std::vector<reco::Track>
Tracks;
206 std::vector<LorentzVectorParticle> ReFitPions;
207 for(
unsigned int i=0;i<transTrkVect.size();i++){
208 c+=transTrkVect[
i].charge();
209 ReFitPions.push_back(ParticleBuilder::createLorentzVectorParticle(transTrkVect[i],*secVtx,
true,
true));
212 TVectorT<double> a1_par(LorentzVectorParticle::NLorentzandVertexPar);
213 TMatrixTSym<double> a1_cov(LorentzVectorParticle::NLorentzandVertexPar);
214 for(
int i = 0; i<LorentzVectorParticle::NLorentzandVertexPar; i++){
216 for(
int j = 0; j<LorentzVectorParticle::NLorentzandVertexPar; j++){
217 a1_cov(i,j)=cov(i,j);
226 std::vector<TrackParticle> pions;
227 GlobalPoint pvpoint(primaryVertex->position().x(),primaryVertex->position().y(),primaryVertex->position().z());
228 const std::vector<edm::Ptr<reco::Candidate> >
cands =
tau->signalChargedHadrCands();
231 if (track !=
nullptr) {
233 pions.push_back(ParticleBuilder::createTrackParticle(transTrk,pvpoint,
true,
true));
237 TVector3
pv(secVtx->position().x(),secVtx->position().y(),secVtx->position().z());
239 SecondaryVtxOK=chi2v.fit();
240 double c(0);
for(
unsigned int i=0;i<pions.size();i++){c+=pions[
i].charge();}
242 a1=chi2v.getMother(pdgid);
248 TVector3
pv(primaryVertex->position().x(),primaryVertex->position().y(),primaryVertex->position().z());
249 TMatrixTSym<double> pvcov(LorentzVectorParticle::NVertex);
251 primaryVertex->fill(pvCov);
252 for(
int i = 0; i<LorentzVectorParticle::NVertex; i++){
253 for(
int j = 0; j<LorentzVectorParticle::NVertex; j++){
254 pvcov(i,j)=pvCov(i,j);
257 for(
unsigned int i=0; i<PFTau3ProngSummary::nsolutions;i++){
259 bool isFitOK=TauA1NU.fit();
262 std::vector<LorentzVectorParticle> daughter=TauA1NU.getRefitDaughters();
263 std::vector<TLorentzVector> daughter_p4;
264 std::vector<int> daughter_charge,daughter_PDGID;
265 for(
unsigned int d=0;
d<daughter.size();
d++){
266 daughter_p4.push_back(daughter[
d].
p4());
267 daughter_charge.push_back((
int)daughter[
d].
charge());
268 daughter_PDGID.push_back(daughter[
d].
pdgId());
270 PFTau3PS.
AddSolution(i,theTau.
p4(),daughter_p4,daughter_charge,daughter_PDGID,(isFitOK),0.0,-999);
276 PFTau3PSCollection_out->push_back(PFTau3PS);
277 AVPFTau3PS->setValue(iPFTau,PFTau3PSRef);
280 iEvent.
put(
std::move(PFTau3PSCollection_out),
"PFTau3ProngSummary");
std::vector< reco::PFTau3ProngSummary > PFTau3ProngSummaryCollection
collection of PFTau3ProngSummary objects
KinematicParticleVertexFitter kpvFitter_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
TLorentzVector p4() const
std::unique_ptr< StringCutObjectSelector< reco::PFTau > > cut_
reco::TransientTrack build(const reco::Track *p) const
edm::InputTag PFTauTIPTag_
edm::RefProd< PFTauCollection > PFTauRefProd
references to PFTau collection
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepSym< double, 7 > > AlgebraicSymMatrix77
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
const MagneticField * field() const
Abs< T >::type abs(const T &t)
DiscCutPairVec discriminators_
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &particles) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
RefProd< PROD > getRefBeforePut()
edm::Ref< PFTau3ProngSummaryCollection > PFTau3ProngSummaryRef
presistent reference to a PFTau3ProngSummary
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
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)
RefCountedKinematicParticle particle(const reco::TransientTrack &initialTrack, const ParticleMass &massGuess, float chiSquared, float degreesOfFr, float &m_sigma) const