138 auto AVPFTau3PS = std::make_unique<edm::AssociationVector<PFTauRefProd, std::vector<reco::PFTau3ProngSummaryRef>>>(
PFTauRefProd(Tau));
139 auto PFTau3PSCollection_out = std::make_unique<PFTau3ProngSummaryCollection>();
155 bool passedDisc =
true;
156 if ( disc->cutFormula_ )passedDisc = (disc->cutFormula_->Eval((*disc->handle_)[
tau]) > 0.5);
157 else passedDisc = ((*disc->handle_)[
tau] > disc->cut_);
158 if ( !passedDisc ){
passed =
false;
break;}
167 bool SecondaryVtxOK(
false);
169 if(theTIP->hasSecondaryVertex() && primaryVertex->ndof()>
ndfPVT_){
170 const VertexRef secVtx=theTIP->secondaryVertex();
171 GlobalPoint sv(secVtx->position().x(),secVtx->position().y(),secVtx->position().z());
172 double vtxchi2(0), vtxndf(1);
174 vtxchi2=secVtx->chi2();
175 vtxndf=secVtx->ndof();
176 const std::vector<reco::Track>&
selectedTracks=secVtx->refittedTracks();
177 std::vector<reco::TransientTrack> transTrkVect;
178 for(
unsigned int i = 0;
i!=selectedTracks.size();
i++) transTrkVect.push_back(transTrackBuilder->
build(selectedTracks[
i]));
180 float piMassSigma(1.
e-6), piChi(0.0), piNdf(0.0);
181 std::vector<RefCountedKinematicParticle> pions;
182 for(
unsigned int i = 0; i<transTrkVect.size();i++) pions.push_back(kinFactory.
particle(transTrkVect[i],pdgInfo.
pi_mass(),piChi,piNdf,sv,piMassSigma));
184 jpTree->movePointerToTheTop();
186 AlgebraicSymMatrix77 cov=jpTree->currentParticle()->currentState().kinematicParametersError().matrix();
189 std::vector<reco::Track>
Tracks;
190 std::vector<LorentzVectorParticle> ReFitPions;
191 for(
unsigned int i=0;i<transTrkVect.size();i++){
192 c+=transTrkVect[
i].charge();
193 ReFitPions.push_back(ParticleBuilder::createLorentzVectorParticle(transTrkVect[i],*secVtx,
true,
true));
196 TVectorT<double> a1_par(LorentzVectorParticle::NLorentzandVertexPar);
197 TMatrixTSym<double> a1_cov(LorentzVectorParticle::NLorentzandVertexPar);
198 for(
int i = 0; i<LorentzVectorParticle::NLorentzandVertexPar; i++){
200 for(
int j = 0; j<LorentzVectorParticle::NLorentzandVertexPar; j++){
201 a1_cov(i,j)=cov(i,j);
210 std::vector<TrackParticle> pions;
211 GlobalPoint pvpoint(primaryVertex->position().x(),primaryVertex->position().y(),primaryVertex->position().z());
212 const std::vector<edm::Ptr<reco::PFCandidate> >
cands =
tau->signalPFChargedHadrCands();
214 if(iter->get()->trackRef().isNonnull()){
216 pions.push_back(ParticleBuilder::createTrackParticle(transTrk,pvpoint,
true,
true));
218 else if(iter->get()->gsfTrackRef().isNonnull()){
223 TVector3
pv(secVtx->position().x(),secVtx->position().y(),secVtx->position().z());
225 SecondaryVtxOK=chi2v.fit();
226 double c(0);
for(
unsigned int i=0;i<pions.size();i++){c+=pions[
i].charge();}
228 a1=chi2v.getMother(pdgid);
234 TVector3
pv(primaryVertex->position().x(),primaryVertex->position().y(),primaryVertex->position().z());
235 TMatrixTSym<double> pvcov(LorentzVectorParticle::NVertex);
237 primaryVertex->fill(pvCov);
238 for(
int i = 0; i<LorentzVectorParticle::NVertex; i++){
239 for(
int j = 0; j<LorentzVectorParticle::NVertex; j++){
240 pvcov(i,j)=pvCov(i,j);
243 for(
unsigned int i=0; i<PFTau3ProngSummary::nsolutions;i++){
245 bool isFitOK=TauA1NU.fit();
248 std::vector<LorentzVectorParticle> daughter=TauA1NU.getRefitDaughters();
249 std::vector<TLorentzVector> daughter_p4;
250 std::vector<int> daughter_charge,daughter_PDGID;
251 for(
unsigned int d=0;
d<daughter.size();
d++){
252 daughter_p4.push_back(daughter[
d].
p4());
253 daughter_charge.push_back((
int)daughter[
d].
charge());
254 daughter_PDGID.push_back(daughter[
d].
pdgId());
256 PFTau3PS.
AddSolution(i,theTau.
p4(),daughter_p4,daughter_charge,daughter_PDGID,(isFitOK),0.0,-999);
262 PFTau3PSCollection_out->push_back(PFTau3PS);
263 AVPFTau3PS->setValue(iPFTau,PFTau3PSRef);
266 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
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