37 |
|
#include "DataFormats/Math/interface/Vector3D.h" |
38 |
|
#include "Math/GenVector/PxPyPzM4D.h" |
39 |
|
|
40 |
+ |
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h" |
41 |
+ |
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" |
42 |
+ |
#include "TrackingTools/Records/interface/TransientTrackRecord.h" |
43 |
+ |
#include "TrackingTools/IPTools/interface/IPTools.h" |
44 |
+ |
|
45 |
+ |
#include "CMGTools/External/interface/PileupJetIdentifier.h" |
46 |
+ |
#include "CMGTools/External/interface/PileupJetIdAlgo.h" |
47 |
+ |
//#include "CMGTools/External/interface/PileupJetIdProducer.h" |
48 |
|
|
49 |
|
#include <cmath> |
50 |
|
|
191 |
|
|
192 |
|
const Vertex &RecVtx = (*recVtxs)[VtxIn]; |
193 |
|
const Vertex &RecVtxFirst = (*recVtxs)[0]; |
194 |
+ |
const Vertex &vertex = RecVtxFirst; //used in ele id 2012 |
195 |
|
|
196 |
|
auxInfo->pvInfo.firstPVInPT2 = TVector3(RecVtxFirst.x(), RecVtxFirst.y(), RecVtxFirst.z()); |
197 |
|
auxInfo->pvInfo.firstPVInProb = TVector3(RecVtx.x(), RecVtx.y(), RecVtx.z()); |
206 |
|
edm::Handle<double> rho25Handle; |
207 |
|
iEvent.getByLabel(edm::InputTag("kt6PFJets25", "rho"),rho25Handle); |
208 |
|
auxInfo->puInfo.rho25 = *rho25Handle; |
209 |
+ |
edm::Handle<double> rho25HandleIso; |
210 |
+ |
iEvent.getByLabel(edm::InputTag("kt6PFJetsForIsolation", "rho"),rho25HandleIso); |
211 |
+ |
auxInfo->puInfo.rho25Iso = *rho25HandleIso; |
212 |
|
|
213 |
+ |
edm::Handle<double> rhoNeutralHandle; |
214 |
+ |
iEvent.getByLabel(edm::InputTag("kt6PFJetsCentralNeutral", "rho"),rhoNeutralHandle); |
215 |
+ |
auxInfo->puInfo.rhoNeutral = *rhoNeutralHandle; |
216 |
+ |
|
217 |
+ |
|
218 |
|
edm::Handle<std::vector< PileupSummaryInfo> > puHandle; |
219 |
|
|
220 |
|
if (runOnMC_){ |
224 |
|
std::vector< PileupSummaryInfo> pu = (*puHandle); |
225 |
|
for (std::vector<PileupSummaryInfo>::const_iterator it= pu.begin(); it!=pu.end(); ++it){ |
226 |
|
int bx = (*it).getBunchCrossing(); |
227 |
+ |
if(bx == 0) { auxInfo->puInfo.truePU = (*it).getTrueNumInteractions();} |
228 |
|
unsigned int num = (*it).getPU_NumInteractions(); |
229 |
|
// std::cout <<" PU PUSHING "<<bx<<" " <<num<<std::endl; |
230 |
|
auxInfo->puInfo.pus[bx] =num; |
391 |
|
|
392 |
|
/////// end generator block |
393 |
|
|
394 |
+ |
/// photon used in isolation |
395 |
+ |
edm::Handle<edm::View<reco::PFCandidate> > photonIsoH; |
396 |
+ |
iEvent.getByLabel("pfAllPhotons",photonIsoH); |
397 |
+ |
edm::View<reco::PFCandidate> photonsForIso = *photonIsoH; |
398 |
|
|
399 |
|
edm::Handle<edm::View<pat::Muon> > muonHandle; |
400 |
|
iEvent.getByLabel(muoLabel_,muonHandle); |
417 |
|
|
418 |
|
// standard jets |
419 |
|
|
398 |
– |
edm::Handle<edm::View<pat::Jet> > simplejet1Handle; |
399 |
– |
iEvent.getByLabel(simplejet1Label_,simplejet1Handle); |
400 |
– |
edm::View<pat::Jet> simplejets1 = *simplejet1Handle; |
420 |
|
|
421 |
|
edm::Handle<edm::View<pat::Jet> > simplejet2Handle; |
422 |
|
iEvent.getByLabel(simplejet2Label_,simplejet2Handle); |
426 |
|
iEvent.getByLabel(simplejet3Label_,simplejet3Handle); |
427 |
|
edm::View<pat::Jet> simplejets3 = *simplejet3Handle; |
428 |
|
|
410 |
– |
edm::Handle<edm::View<pat::Jet> > simplejet4Handle; |
411 |
– |
iEvent.getByLabel(simplejet4Label_,simplejet4Handle); |
412 |
– |
edm::View<pat::Jet> simplejets4 = *simplejet4Handle; |
429 |
|
|
430 |
|
|
431 |
|
edm::Handle<edm::View<pat::Electron> > electronHandle; |
440 |
|
edm::Handle<edm::View<pat::Tau> > tauHandle; |
441 |
|
iEvent.getByLabel(tauLabel_,tauHandle); |
442 |
|
edm::View<pat::Tau> taus = *tauHandle; |
443 |
< |
|
443 |
> |
|
444 |
> |
//Get the computer for the CSV |
445 |
> |
ESHandle<JetTagComputer> handle; |
446 |
> |
iSetup.get<JetTagComputerRecord>().get("combinedSecondaryVertex", handle); |
447 |
> |
computer = dynamic_cast<const GenericMVAJetTagComputer*>(handle.product()); |
448 |
|
|
449 |
|
//BTAGGING SCALE FACTOR FROM DATABASE |
450 |
|
//Combined Secondary Vertex Loose |
475 |
|
btagSFs.MISTAGSF_CSVT = (mistagSF_CSVT_.product()); |
476 |
|
|
477 |
|
#ifdef ENABLE_SIMPLEJETS1 |
478 |
+ |
edm::Handle<edm::View<pat::Jet> > simplejet1Handle; |
479 |
+ |
iEvent.getByLabel(simplejet1Label_,simplejet1Handle); |
480 |
+ |
edm::View<pat::Jet> simplejets1 = *simplejet1Handle; |
481 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets1.begin(); jet_iter!=simplejets1.end(); ++jet_iter){ |
482 |
|
// if(jet_iter->pt()>50) |
483 |
|
// njetscounter++; |
566 |
|
} |
567 |
|
|
568 |
|
#ifdef ENABLE_SIMPLEJETS4 |
569 |
+ |
edm::Handle<edm::View<pat::Jet> > simplejet4Handle; |
570 |
+ |
iEvent.getByLabel(simplejet4Label_,simplejet4Handle); |
571 |
+ |
edm::View<pat::Jet> simplejets4 = *simplejet4Handle; |
572 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets4.begin(); jet_iter!=simplejets4.end(); ++jet_iter){ |
573 |
|
// if(jet_iter->pt()>50) |
574 |
|
// njetscounter++; |
575 |
< |
VHbbEvent::SimpleJet sj; |
575 |
> |
|
576 |
> |
VHbbEvent::SimpleJet sj; |
577 |
|
// std::cout <<" sj4"<<std::endl; |
578 |
|
fillSimpleJet(sj,jet_iter); |
579 |
|
// if(!runOnMC_) |
580 |
|
setJecUnc(sj,jecUnc); |
581 |
+ |
|
582 |
|
|
583 |
|
|
584 |
|
Particle::LorentzVector p4Jet = jet_iter->p4(); |
614 |
|
} |
615 |
|
#endif //ENABLE SIMPLEJETS4 |
616 |
|
|
617 |
< |
|
617 |
> |
|
618 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets2.begin(); jet_iter!=simplejets2.end(); ++jet_iter){ |
619 |
|
|
620 |
+ |
|
621 |
+ |
|
622 |
|
VHbbEvent::SimpleJet sj; |
623 |
|
// std::cout <<" sj2"<<std::endl; |
624 |
< |
fillSimpleJet(sj,jet_iter); |
624 |
> |
fillSimpleJet(sj,jet_iter); |
625 |
> |
|
626 |
> |
///########### PU JET ID ################# |
627 |
> |
// add puId... |
628 |
> |
edm::Handle<edm::ValueMap<float> > puJetIdMVA; |
629 |
> |
iEvent.getByLabel("puJetMva","fullDiscriminant", puJetIdMVA); |
630 |
> |
|
631 |
> |
edm::Handle<edm::ValueMap<int> > puJetIdFlag; |
632 |
> |
iEvent.getByLabel("puJetMva", "fullId", puJetIdFlag); |
633 |
> |
|
634 |
> |
// cout << " pt " << jet_iter->pt() << " eta " << jet_iter->eta() << std::endl; |
635 |
> |
unsigned int idx = jet_iter - simplejets2.begin(); |
636 |
> |
|
637 |
> |
|
638 |
> |
|
639 |
> |
sj.puJetIdMva = (*puJetIdMVA)[simplejets2.refAt(idx)]; |
640 |
> |
int idflag = (*puJetIdFlag)[simplejets2.refAt(idx)]; |
641 |
> |
|
642 |
> |
|
643 |
> |
// cout << " PU JetID MVA " << mva; |
644 |
> |
if( PileupJetIdentifier::passJetId( idflag, PileupJetIdentifier::kLoose )) { |
645 |
> |
//cout << " pass loose wp"; |
646 |
> |
sj.puJetIdL =1; |
647 |
> |
} |
648 |
> |
if( PileupJetIdentifier::passJetId( idflag, PileupJetIdentifier::kMedium )) { |
649 |
> |
// cout << " pass medium wp"; |
650 |
> |
sj.puJetIdM =1; |
651 |
> |
} |
652 |
> |
if( PileupJetIdentifier::passJetId( idflag, PileupJetIdentifier::kTight )) { |
653 |
> |
// cout << " pass tight wp"; |
654 |
> |
sj.puJetIdT =1; |
655 |
> |
} |
656 |
> |
// cout << endl; |
657 |
> |
// ############# END OF PU JET ID ###################### |
658 |
> |
|
659 |
> |
|
660 |
|
// if(!runOnMC_) |
661 |
|
setJecUnc(sj,jecUnc); |
662 |
|
/* sj.flavour = jet_iter->partonFlavour(); |
679 |
|
sj.SF_CSVLerr=0; |
680 |
|
sj.SF_CSVMerr=0; |
681 |
|
sj.SF_CSVTerr=0; |
682 |
< |
|
682 |
> |
|
683 |
> |
|
684 |
|
// |
685 |
|
// addtaginfo for csv |
686 |
|
// |
929 |
|
// if(!runOnMC_) |
930 |
|
setJecUnc(fj,jecUnc); |
931 |
|
|
932 |
+ |
if(runOnMC_){ |
933 |
+ |
|
934 |
+ |
//BTV scale factors |
935 |
+ |
// fillScaleFactors(sj, btagSFs); |
936 |
+ |
|
937 |
+ |
//PAT genJet matching |
938 |
+ |
//genJet |
939 |
+ |
const reco::GenJet *gJ = filterjet_iter->genJet(); |
940 |
+ |
//physical parton for mother info ONLY |
941 |
+ |
if( (filterjet_iter->genParton()) ){ |
942 |
+ |
fj.bestMCid = filterjet_iter->genParton()->pdgId(); |
943 |
+ |
if( (filterjet_iter->genParton()->mother()) ) |
944 |
+ |
fj.bestMCmomid=filterjet_iter->genParton()->mother()->pdgId(); |
945 |
+ |
} |
946 |
+ |
TLorentzVector gJp4; |
947 |
+ |
if(gJ){ |
948 |
+ |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
949 |
+ |
fj.bestMCp4 = gJp4; |
950 |
+ |
if(verbose_){ |
951 |
+ |
std::clog << "filter genJet matched Pt = " << gJp4.Pt() << std::endl; |
952 |
+ |
std::clog << "filter genJet matched eta = " << gJp4.Eta() << std::endl; |
953 |
+ |
std::clog << "filter genJet matched deltaR = " << gJp4.DeltaR(fj.p4) << std::endl; |
954 |
+ |
std::clog << "filter genJet matched mother id = " << fj.bestMCmomid << std::endl; |
955 |
+ |
} |
956 |
+ |
} |
957 |
+ |
} |
958 |
+ |
|
959 |
|
hbbInfo->filterJets.push_back(fj); |
960 |
|
|
961 |
|
|
1002 |
|
} |
1003 |
|
|
1004 |
|
// type 1 corr met NoPU |
1005 |
< |
edm::Handle<edm::View<reco::MET> > pfmetNoPUType1corrHandle; |
1005 |
> |
/* edm::Handle<edm::View<reco::MET> > pfmetNoPUType1corrHandle; |
1006 |
|
iEvent.getByLabel("patType1CorrectedPFMetNoPU",pfmetNoPUType1corrHandle); |
1007 |
|
edm::View<reco::MET> pfmetsNoPUType1corr = *pfmetNoPUType1corrHandle; |
1008 |
|
if(pfmetsNoPUType1corr.size()){ |
1026 |
|
if (verbose_) std::cout <<" type 1 +2 corrected pfMET "<< hbbInfo->pfmetNoPUType1p2corr.metSig <<" " << hbbInfo->pfmetNoPUType1p2corr.sumEt<<std::endl; |
1027 |
|
} |
1028 |
|
|
1029 |
+ |
*/ |
1030 |
|
|
1031 |
|
/* |
1032 |
|
// MET uncertainty vector |
1392 |
|
} |
1393 |
|
|
1394 |
|
edm::Handle<edm::View<pat::MET> > metPFHandle; |
1395 |
< |
iEvent.getByLabel("patMETsPF",metPFHandle); |
1395 |
> |
iEvent.getByLabel("patMETsPFlow",metPFHandle); |
1396 |
|
edm::View<pat::MET> metsPF = *metPFHandle; |
1397 |
|
|
1398 |
|
if(metsPF.size()){ |
1419 |
|
mf.eIso=mu->ecalIso(); |
1420 |
|
mf.hIso=mu->hcalIso(); |
1421 |
|
mf.pfChaIso=mu->chargedHadronIso(); |
1422 |
< |
mf.pfChaPUIso=mu->userIso(5); |
1422 |
> |
mf.pfChaPUIso=mu->puChargedHadronIso(); //userIso(5); |
1423 |
|
mf.pfPhoIso=mu->photonIso(); |
1424 |
|
mf.pfNeuIso=mu->neutralHadronIso(); |
1425 |
|
Geom::Phi<double> deltaphi(mu->phi()-atan2(mf.p4.Px(), mf.p4.Py())); |
1451 |
|
|
1452 |
|
mf.nValidTracker = p1.numberOfValidTrackerHits(); |
1453 |
|
mf.nValidPixel = p1.numberOfValidPixelHits(); |
1454 |
+ |
mf.nValidLayers = p1.trackerLayersWithMeasurement(); |
1455 |
+ |
mf.isPF = mu->isPFMuon(); |
1456 |
|
|
1457 |
|
|
1458 |
|
|
1510 |
|
|
1511 |
|
if(verbose_) |
1512 |
|
std::cout << " INPUT electrons "<<electrons.size()<<std::endl; |
1513 |
+ |
InputTag reducedEBRecHitCollection(string("reducedEcalRecHitsEB")); |
1514 |
+ |
InputTag reducedEERecHitCollection(string("reducedEcalRecHitsEE")); |
1515 |
+ |
EcalClusterLazyTools lazyTools(iEvent, iSetup, reducedEBRecHitCollection, reducedEERecHitCollection); |
1516 |
+ |
edm::ESHandle<TransientTrackBuilder> builder; |
1517 |
+ |
iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder); |
1518 |
+ |
const TransientTrackBuilder & transientTrackBuilder= *(builder.product()); |
1519 |
+ |
|
1520 |
|
for(edm::View<pat::Electron>::const_iterator elec = electrons.begin(); elec!=electrons.end(); ++elec){ |
1521 |
|
VHbbEvent::ElectronInfo ef; |
1522 |
|
ef.p4=GENPTOLORP(elec); |
1528 |
|
ef.eIso=elec->ecalIso(); |
1529 |
|
ef.hIso=elec->hcalIso(); |
1530 |
|
ef.pfChaIso=elec->chargedHadronIso(); |
1531 |
< |
ef.pfChaPUIso=elec->userIso(5); |
1531 |
> |
ef.pfChaPUIso=elec->puChargedHadronIso();//userIso(5); |
1532 |
|
ef.pfPhoIso=elec->photonIso(); |
1533 |
+ |
ef.pfPhoIsoDoubleCounted=0; |
1534 |
+ |
|
1535 |
+ |
/* Check if there are photons sharing the super cluster*/ |
1536 |
+ |
for(size_t k=0;k<photonsForIso.size();k++) { |
1537 |
+ |
if(deltaR(elec->eta(),elec->phi(),photonsForIso[k].eta(),photonsForIso[k].phi()) < 0.05 && abs(photonsForIso[k].pt()-elec->pt())/(photonsForIso[k].pt()+elec->pt()) < 0.05 ) { |
1538 |
+ |
std::cout << "Double counting of supercluster!" << std::endl; |
1539 |
+ |
ef.pfPhoIsoDoubleCounted+=photonsForIso[k].pt(); |
1540 |
+ |
} |
1541 |
+ |
} |
1542 |
|
ef.pfNeuIso=elec->neutralHadronIso(); |
1543 |
|
|
1544 |
|
// |
1559 |
|
ef.HoE = elec->hadronicOverEm(); |
1560 |
|
ef.convDist = elec->convDist(); |
1561 |
|
ef.convDcot = elec->convDcot(); |
1562 |
< |
if(elec->gsfTrack().isNonnull()) ef.innerHits = elec->gsfTrack()->trackerExpectedHitsInner().numberOfHits(); |
1562 |
> |
if(elec->gsfTrack().isNonnull()) |
1563 |
> |
{ |
1564 |
> |
ef.innerHits = elec->gsfTrack()->trackerExpectedHitsInner().numberOfHits(); |
1565 |
> |
} |
1566 |
|
ef.isEB = elec->isEB(); |
1567 |
|
ef.isEE = elec->isEE(); |
1568 |
+ |
/* 2012 ELEID*/ |
1569 |
+ |
|
1570 |
+ |
const pat::Electron & ele = *elec; |
1571 |
+ |
bool validKF= false; |
1572 |
+ |
reco::TrackRef myTrackRef = ele.closestCtfTrackRef(); |
1573 |
+ |
validKF = (myTrackRef.isAvailable()); |
1574 |
+ |
validKF = (myTrackRef.isNonnull()); |
1575 |
+ |
|
1576 |
+ |
// Pure tracking variables |
1577 |
+ |
ef.fMVAVar_fbrem = ele.fbrem(); |
1578 |
+ |
ef.fMVAVar_kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0 ; |
1579 |
+ |
ef.fMVAVar_kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ; |
1580 |
+ |
// fMVAVar_kfhitsall = (validKF) ? myTrackRef->numberOfValidHits() : -1. ; // save also this in your ntuple as possible alternative |
1581 |
+ |
ef.fMVAVar_gsfchi2 = ele.gsfTrack()->normalizedChi2(); |
1582 |
+ |
|
1583 |
+ |
|
1584 |
+ |
// Geometrical matchings |
1585 |
+ |
ef.fMVAVar_deta = ele.deltaEtaSuperClusterTrackAtVtx(); |
1586 |
+ |
ef.fMVAVar_dphi = ele.deltaPhiSuperClusterTrackAtVtx(); |
1587 |
+ |
ef.fMVAVar_detacalo = ele.deltaEtaSeedClusterTrackAtCalo(); |
1588 |
+ |
// fMVAVar_dphicalo = ele.deltaPhiSeedClusterTrackAtCalo(); // save also this in your ntuple |
1589 |
+ |
|
1590 |
+ |
|
1591 |
+ |
// Pure ECAL -> shower shapes |
1592 |
+ |
ef.fMVAVar_see = ele.sigmaIetaIeta(); //EleSigmaIEtaIEta |
1593 |
+ |
std::vector<float> vCov = lazyTools.localCovariances(*(ele.superCluster()->seed())) ; |
1594 |
+ |
if (!isnan(vCov[2])) ef.fMVAVar_spp = sqrt (vCov[2]); //EleSigmaIPhiIPhi |
1595 |
+ |
else ef.fMVAVar_spp = 0.; |
1596 |
+ |
// fMVAVar_sigmaIEtaIPhi = vCov[1]; // save also this in your ntuple |
1597 |
+ |
|
1598 |
+ |
ef.fMVAVar_etawidth = ele.superCluster()->etaWidth(); |
1599 |
+ |
ef.fMVAVar_phiwidth = ele.superCluster()->phiWidth(); |
1600 |
+ |
ef.fMVAVar_e1x5e5x5 = (ele.e5x5()) !=0. ? 1.-(ele.e1x5()/ele.e5x5()) : -1. ; |
1601 |
+ |
ef.fMVAVar_R9 = lazyTools.e3x3(*(ele.superCluster()->seed())) / ele.superCluster()->rawEnergy(); |
1602 |
+ |
//fMVAVar_nbrems = fabs(ele.numberOfBrems()); // save also this in your ntuple |
1603 |
+ |
|
1604 |
+ |
// Energy matching |
1605 |
+ |
ef.fMVAVar_HoE = ele.hadronicOverEm(); |
1606 |
+ |
ef.fMVAVar_EoP = ele.eSuperClusterOverP(); |
1607 |
+ |
// fMVAVar_IoEmIoP = (1.0/(ele.superCluster()->energy())) - (1.0 / ele.p()); // in the future to be changed with ele.gsfTrack()->p() |
1608 |
+ |
ef.fMVAVar_IoEmIoP = (1.0/ele.ecalEnergy()) - (1.0 / ele.p()); // in the future to be changed with ele.gsfTrack()->p() // 24/04/2012 changed to correctly access the corrected supercluster energy from CMSSW_52X |
1609 |
+ |
|
1610 |
+ |
ef.fMVAVar_eleEoPout = ele.eEleClusterOverPout(); |
1611 |
+ |
ef.fMVAVar_PreShowerOverRaw= ele.superCluster()->preshowerEnergy() / ele.superCluster()->rawEnergy(); |
1612 |
+ |
// fMVAVar_EoPout = ele.eSeedClusterOverPout(); // save also this in your ntuple |
1613 |
+ |
|
1614 |
+ |
|
1615 |
+ |
// Spectators |
1616 |
+ |
ef.fMVAVar_eta = ele.superCluster()->eta(); |
1617 |
+ |
ef.fMVAVar_pt = ele.pt(); |
1618 |
+ |
|
1619 |
+ |
//additional for cut based |
1620 |
+ |
ef.dxy = elec->gsfTrack()->dxy(vertex.position()); |
1621 |
+ |
ef.dz = elec->gsfTrack()->dz(vertex.position()); |
1622 |
+ |
|
1623 |
+ |
|
1624 |
+ |
//d0 |
1625 |
+ |
if (ele.gsfTrack().isNonnull()) { |
1626 |
+ |
ef.fMVAVar_d0 = (-1.0)*ele.gsfTrack()->dxy(vertex.position()); |
1627 |
+ |
} else if (ele.closestCtfTrackRef().isNonnull()) { |
1628 |
+ |
ef.fMVAVar_d0 = (-1.0)*ele.closestCtfTrackRef()->dxy(vertex.position()); |
1629 |
+ |
} else { |
1630 |
+ |
ef.fMVAVar_d0 = -9999.0; |
1631 |
+ |
|
1632 |
+ |
//default values for IP3D |
1633 |
+ |
ef.fMVAVar_ip3d = -999.0; |
1634 |
+ |
// fMVAVar_ip3dSig = 0.0; |
1635 |
+ |
if (ele.gsfTrack().isNonnull()) { |
1636 |
+ |
const double gsfsign = ( (-ele.gsfTrack()->dxy(vertex.position())) >=0 ) ? 1. : -1.; |
1637 |
+ |
|
1638 |
+ |
const reco::TransientTrack &tt = transientTrackBuilder.build(ele.gsfTrack()); |
1639 |
+ |
const std::pair<bool,Measurement1D> &ip3dpv = IPTools::absoluteImpactParameter3D(tt,vertex); |
1640 |
+ |
if (ip3dpv.first) { |
1641 |
+ |
double ip3d = gsfsign*ip3dpv.second.value(); |
1642 |
+ |
//double ip3derr = ip3dpv.second.error(); |
1643 |
+ |
ef.fMVAVar_ip3d = ip3d; |
1644 |
+ |
// fMVAVar_ip3dSig = ip3d/ip3derr; |
1645 |
+ |
} |
1646 |
+ |
} |
1647 |
+ |
} |
1648 |
+ |
|
1649 |
+ |
|
1650 |
+ |
/* end of 2012 ELEID*/ |
1651 |
+ |
|
1652 |
|
// |
1653 |
|
// fill eleids |
1654 |
|
// |
1667 |
|
ef.id80r=elec->electronID("eidVBTFRel80"); |
1668 |
|
ef.id70 =elec->electronID("eidVBTFCom70"); |
1669 |
|
ef.id70r=elec->electronID("eidVBTFRel70"); |
1670 |
+ |
ef.mvaOut=elec->electronID("mvaNonTrigV0"); |
1671 |
+ |
ef.mvaOutTrig=elec->electronID("mvaTrigV0"); |
1672 |
|
|
1673 |
|
//Electron trigger matching |
1674 |
|
for (int itrig = 0; itrig != ntrigs; ++itrig){ |
2021 |
|
sj.SF_CSVMerr=0; |
2022 |
|
sj.SF_CSVTerr=0; |
2023 |
|
|
2024 |
+ |
//for quark-gluon tagger |
2025 |
+ |
sj.constituentPtDistribution = jet_iter->constituentPtDistribution(); |
2026 |
+ |
sj.constituentEtaPhiSpread = jet_iter->constituentEtaPhiSpread(); |
2027 |
+ |
|
2028 |
|
|
2029 |
|
if (jet_iter->isPFJet() == true) { |
2030 |
|
|
2035 |
|
sj.nConstituents = jet_iter->getPFConstituents().size(); |
2036 |
|
|
2037 |
|
} |
2038 |
+ |
sj.jetArea = jet_iter->jetArea(); |
2039 |
|
// |
2040 |
|
// addtaginfo for csv |
2041 |
|
// |
2044 |
|
|
2045 |
|
const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex(); |
2046 |
|
if (tf){ |
2047 |
+ |
math::XYZTLorentzVectorD vertexSum; |
2048 |
+ |
for(size_t vi=0;vi< tf->nVertices();vi++) |
2049 |
+ |
{ |
2050 |
+ |
vertexSum+=tf->secondaryVertex(vi).p4(); |
2051 |
+ |
} |
2052 |
+ |
sj.vtxP4 = GENPTOLOR(vertexSum); |
2053 |
+ |
|
2054 |
|
if (tf->nVertices() >0){ |
2055 |
< |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
2055 |
> |
sj.vtxPosition = TVector3(tf->secondaryVertex(0).position().x(),tf->secondaryVertex(0).position().y(),tf->secondaryVertex(0).position().z()); |
2056 |
> |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
2057 |
|
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
2058 |
|
std::vector<reco::TrackBaseRef >::const_iterator tit = tf->secondaryVertex(0).tracks_begin(); |
2059 |
|
for (; tit< tf->secondaryVertex(0).tracks_end(); ++tit){ |
2064 |
|
sj.vtx3deL = m.error(); |
2065 |
|
} |
2066 |
|
} |
2067 |
+ |
|
2068 |
+ |
// CSV track info |
2069 |
+ |
const reco::SecondaryVertexTagInfo * svTagInfos = jet_iter->tagInfoSecondaryVertex(); |
2070 |
+ |
const reco::TrackIPTagInfo * ipTagInfos = jet_iter->tagInfoTrackIP(); |
2071 |
+ |
for (edm::RefVector<reco::TrackCollection>::const_iterator t = ipTagInfos->selectedTracks().begin(); t != ipTagInfos->selectedTracks().end(); t++){ |
2072 |
+ |
sj.btagTrackIds.push_back(t->key()); |
2073 |
+ |
}// all btag IP selected tracks |
2074 |
+ |
std::vector<const reco::BaseTagInfo*> tagInfos; |
2075 |
+ |
tagInfos.push_back(dynamic_cast<const reco::BaseTagInfo*>(ipTagInfos)); |
2076 |
+ |
tagInfos.push_back(dynamic_cast<const reco::BaseTagInfo*>(svTagInfos)); |
2077 |
+ |
JetTagComputer::TagInfoHelper helper(tagInfos); |
2078 |
+ |
reco::TaggingVariableList varList = computer->taggingVariables(helper); // computer for getting CSV variables |
2079 |
+ |
|
2080 |
+ |
for(reco::TaggingVariableList::const_iterator iter = varList.begin(); iter != varList.end(); ++iter) |
2081 |
+ |
{ |
2082 |
+ |
//std::cout << reco::TaggingVariableTokens[iter->first] << " = " << iter->second << std::endl; |
2083 |
+ |
for (edm::RefVector<reco::TrackCollection>::const_iterator t = ipTagInfos->selectedTracks().begin(); t != ipTagInfos->selectedTracks().end(); t++){ |
2084 |
+ |
|
2085 |
+ |
if (strcmp(reco::TaggingVariableTokens[iter->first], "trackMomentum") == 0 && (fabs((float)iter->second - (float)(*t)->p()) < 0.0001) ){ |
2086 |
+ |
sj.csvTrackIds.push_back(t->key()); |
2087 |
+ |
}// if tagged track |
2088 |
+ |
}// loop on IPtracks |
2089 |
+ |
}// loop on CSV variables |
2090 |
+ |
|
2091 |
+ |
|
2092 |
+ |
sj.btagNTracks= ipTagInfos->selectedTracks().size(); |
2093 |
+ |
sj.csvNTracks = sj.csvTrackIds.size(); |
2094 |
+ |
|
2095 |
|
// |
2096 |
|
// add tVector |
2097 |
|
// |
2098 |
|
sj.tVector = getTvect(&(*jet_iter)); |
2099 |
|
|
2100 |
+ |
sj.ptRaw = jet_iter->correctedJet(0).pt(); |
2101 |
+ |
|
2102 |
+ |
sj.ptLeadTrack =-9999.; |
2103 |
+ |
if (jet_iter->isPFJet() == true) { |
2104 |
+ |
std::vector <reco::PFCandidatePtr> constituents = jet_iter->getPFConstituents (); |
2105 |
+ |
for (unsigned ic = 0; ic < constituents.size (); ++ic) { |
2106 |
+ |
if ( constituents[ic]->particleId() > 3 ) continue; |
2107 |
+ |
reco::TrackRef trackRef = constituents[ic]->trackRef(); |
2108 |
+ |
if ( trackRef.isNonnull() ) { if(trackRef->pt() > sj.ptLeadTrack) sj.ptLeadTrack=trackRef->pt(); } |
2109 |
+ |
} |
2110 |
+ |
} |
2111 |
+ |
|
2112 |
|
|
2113 |
|
} |
2114 |
|
|