23 : verbose_( pset.getParameter<
bool>(
"Verbose") ),
24 vectorial_( pset.getParameter<
bool>(
"VectorialCorrection") ),
25 vecResponse_( pset.getParameter<
bool>(
"UseResponseInVecCorr") ),
26 useInConeTracks_( pset.getParameter<
bool>(
"UseInConeTracks") ),
27 useOutOfConeTracks_( pset.getParameter<
bool>(
"UseOutOfConeTracks") ),
28 useOutOfVertexTracks_( pset.getParameter<
bool>(
"UseOutOfVertexTracks") ),
29 usePions_( pset.getParameter<
bool>(
"UsePions") ),
30 useEff_( pset.getParameter<
bool>(
"UseEfficiency") ),
31 useMuons_( pset.getParameter<
bool>(
"UseMuons") ),
32 useElecs_( pset.getParameter<
bool>(
"UseElectrons") ),
33 useTrackQuality_( pset.getParameter<
bool>(
"UseTrackQuality") ),
34 jetTracksAtVertex_( pset.getParameter<
edm::InputTag>(
"JetTracksAssociationAtVertex") ),
35 jetTracksAtCalo_( pset.getParameter<
edm::InputTag>(
"JetTracksAssociationAtCaloFace") ),
36 jetSplitMerge_( pset.getParameter<
int>(
"JetSplitMerge") ),
37 srcPVs_(pset.getParameter<
edm::InputTag>(
"srcPVs") ),
38 ptErrorQuality_( pset.getParameter<double>(
"PtErrorQuality") ),
39 dzVertexCut_( pset.getParameter<double>(
"DzVertexCut") ),
40 muons_( pset.getParameter<
edm::InputTag>(
"Muons") ),
41 electrons_( pset.getParameter<
edm::InputTag>(
"Electrons") ),
42 electronIds_( pset.getParameter<
edm::InputTag>(
"ElectronIds") ),
43 trackQuality_(
reco::TrackBase::qualityByName( pset.getParameter<
std::
string>(
"TrackQuality") ) ),
44 response_(
Map( pset.getParameter<
std::
string>(
"ResponseMap"), verbose_ ) ),
45 efficiency_(
Map( pset.getParameter<
std::
string>(
"EfficiencyMap"), verbose_ ) ),
46 leakage_(
Map( pset.getParameter<
std::
string>(
"LeakageMap"), verbose_ ) ),
50 maxEta_( pset.getParameter<double>(
"MaxJetEta") )
55 ss <<
"[JetPlusTrackCorrector::" << __func__ <<
"] Configuration for JPT corrector: " << std::endl
56 <<
" Particles" << std::endl
57 <<
" UsePions : " << (
usePions_ ?
"true" :
"false" ) << std::endl
58 <<
" UseMuons : " << (
useMuons_ ?
"true" :
"false" ) << std::endl
59 <<
" UseElecs : " << (
useElecs_ ?
"true" :
"false" ) << std::endl
60 <<
" Corrections" << std::endl
61 <<
" UseInConeTracks : " << (
useInConeTracks_ ?
"true" :
"false" ) << std::endl
65 <<
" Efficiency" << std::endl
66 <<
" UsePionEfficiency : " << (
useEff_ ?
"true" :
"false" ) << std::endl
69 <<
" Tracks" << std::endl
73 <<
" UseTrackQuality : " << (
useTrackQuality_ ?
"true" :
"false" ) << std::endl
74 <<
" Collections" << std::endl
75 <<
" Muons : " <<
muons_ << std::endl
77 <<
" Vectorial" << std::endl
87 ss <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 88 <<
" You are using JPT algorithm in a non-standard way!" << std::endl
89 <<
" UseInConeTracks : " << (
useInConeTracks_ ?
"true" :
"false" ) << std::endl
132 corrected = fJet.
p4();
135 validMatches =
matchTracks( fJetcalo, event, setup, pions, muons, elecs );
136 if ( !validMatches ) {
return 1.; }
149 <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 150 <<
" Applying JPT corrections...";
170 std::stringstream ss;
171 ss <<
"Total correction:" << std::endl
173 <<
" Uncorrected (Px,Py,Pz,E) : " 179 <<
" Corrected (Px,Py,Pz,E) : " 180 <<
"(" << corrected.px()
181 <<
"," << corrected.py()
182 <<
"," << corrected.pz()
183 <<
"," << corrected.energy()
185 <<
" Uncorrected (Pt,Eta,Phi,M) : " 189 <<
"," << fJet.
mass()
191 <<
" Corrected (Pt,Eta,Phi,M) : " 192 <<
"(" << corrected.pt()
193 <<
"," << corrected.eta()
194 <<
"," << corrected.phi()
195 <<
"," << corrected.mass()
197 <<
" Scalar correction to E : " << scale << std::endl
198 <<
" Scalar correction to Et : " << ( fJet.
et() > 0. ? corrected.Et() / fJet.
et() : 1. );
226 <<
"JetPlusTrackCorrector can be run on entire event only";
234 <<
"JetPlusTrackCorrector can be run on entire event only";
253 if ( !ok ) {
return false; }
256 matchTracks( jet_tracks, event, pions, muons, elecs );
260 std::stringstream ss;
261 ss <<
"Number of tracks:" << std::endl
262 <<
" In-cone at Vertex : " << jet_tracks.
vertex_.
size() << std::endl
290 <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 291 <<
" Empty label for the reco::JetTracksAssociation::Containers" 293 <<
" InputTag for JTA \"at vertex\" (label:instance:process) \"" 298 <<
" InputTag for JTA \"at calo face\" (label:instance:process) \"" 320 <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 321 <<
" Invalid handle to reco::JetTracksAssociation::Container (for Vertex)" 322 <<
" with InputTag (label:instance:process) \"" 349 <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 350 <<
" Invalid handle to reco::JetTracksAssociation::Container (for CaloFace)" 351 <<
" with InputTag (label:instance:process) \"" 377 <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 378 <<
" Invalid handle to reco::Muon collection" 379 <<
" with InputTag (label:instance:process) \"" 406 if ( pvCollection.
isValid() && !pvCollection->empty() )
vertex_=pvCollection->begin()->position();
410 bool found_reco_muons =
true;
416 bool found_reco_elecs =
true;
420 if ( !found_reco_muons || !found_reco_elecs ) {
422 <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 423 <<
" Unable to access RECO collections for muons and electrons";
436 for ( ; itrk != jtrk; ++itrk ) {
449 int itrack_belong = -1;
451 for( reco::VertexCollection::const_iterator iv = pvCollection->begin(); iv != pvCollection->end(); iv++) {
453 std::vector<reco::TrackBaseRef>::const_iterator
rr =
454 find((*iv).tracks_begin(),
457 if( rr != (*iv).tracks_end() ) {
467 if( numpv > 1 && itrack_belong == 0 ) {
507 for ( ; itrk != jtrk; ++itrk ) {
511 if ( !
tracksInCalo( pions, muons, elecs ) ) {
continue; }
529 std::stringstream ss;
530 ss <<
"[JetPlusTrackCorrector::" << __func__ <<
"] Number of tracks:" << std::endl
531 <<
" In-cone at Vertex and in-cone at CaloFace:" << std::endl
535 <<
" In-cone at Vertex and out-of-cone at CaloFace:" << std::endl
539 <<
" Out-of-cone at Vertex and in-cone at CaloFace:" << std::endl
543 LogTrace(
"JetPlusTrackCorrector") << ss.str();
556 <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 557 <<
" Invalid handle to reco::GsfElectron collection" 558 <<
" with InputTag (label:instance:process) \"" 567 <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 568 <<
" Invalid handle to reco::GsfElectron collection" 569 <<
" with InputTag (label:instance:process) \"" 584 bool retcode =
false;
587 retcode =
true;
return retcode;
590 retcode =
true;
return retcode;
593 retcode =
true;
return retcode;
607 if ( it != jet_tracks.
caloFace_.
end() ) {
return true; }
608 else {
return false; }
629 else {
return true; }
640 else {
return false; }
660 P4 corr_pions_in_cone;
661 P4 corr_pions_eff_in_cone;
666 corr_pions += corr_pions_in_cone;
669 corr_pions += corr_pions_eff_in_cone;
675 P4 corr_pions_out_of_cone;
676 P4 corr_pions_eff_out_of_cone;
681 corr_pions += corr_pions_out_of_cone;
683 corr_pions_eff_out_of_cone =
pionEfficiency( jet, out_of_cone,
false );
684 corr_pions += corr_pions_eff_out_of_cone;
690 P4 corr_pions_out_of_vertex;
695 corr_pions += corr_pions_out_of_vertex;
699 std::stringstream ss;
700 ss <<
" Pion corrections:" << std::endl
701 <<
" In/In : " <<
"(" << pions.
inVertexInCalo_.
size() <<
") " << corr_pions_in_cone.energy() << std::endl
702 <<
" In/Out : " <<
"(" << pions.
inVertexOutOfCalo_.
size() <<
") " << corr_pions_out_of_cone.energy() << std::endl
703 <<
" Out/In : " <<
"(" << pions.
outOfVertexInCalo_.
size() <<
") " << corr_pions_out_of_vertex.energy() << std::endl;
705 ss <<
" Pion efficiency corrections:" << std::endl
706 <<
" In/In : " <<
"(" << pions.
inVertexInCalo_.
size() <<
") " << corr_pions_eff_in_cone.energy() << std::endl
723 P4 corr_muons_in_cone;
724 P4 corr_muons_out_of_cone;
725 P4 corr_muons_out_of_vertex;
729 corr_muons += corr_muons_in_cone;
734 corr_muons += corr_muons_out_of_cone;
739 corr_muons += corr_muons_out_of_vertex;
743 std::stringstream ss;
744 ss <<
" Muon corrections:" << std::endl
745 <<
" In/In : " <<
"(" << muons.
inVertexInCalo_.
size() <<
") " << corr_muons_in_cone.energy() << std::endl
746 <<
" In/Out : " <<
"(" << muons.
inVertexOutOfCalo_.
size() <<
") " << corr_muons_out_of_cone.energy() << std::endl
763 std::stringstream ss;
764 ss <<
" Electron corrections:" << std::endl
765 <<
" In/In : " <<
"(" << elecs.
inVertexInCalo_.
size() <<
") " << null.energy() << std::endl
786 bool tracks_present_inin =
false;
793 for ( ; itrk != jtrk; ++itrk ) {
794 corr +=
PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. );
796 tracks_present_inin =
true;
803 for ( ; itrk != jtrk; ++itrk ) {
804 corr +=
PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. );
814 for ( ; itrk != jtrk; ++itrk ) {
815 corr +=
PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. );
823 for ( ; itrk != jtrk; ++itrk ) {
824 corr +=
PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. );
834 for ( ; itrk != jtrk; ++itrk ) {
835 corr +=
PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. );
843 for ( ; itrk != jtrk; ++itrk ) {
844 corr +=
PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. );
851 if ( !tracks_present_inin ) { corr = corrected; }
853 corr *= ( corr.P() > 0. ? corrected.P() / corr.P() : 1. );
854 corr =
P4( corr.px(), corr.py(), corr.pz(), corrected.energy() );
866 bool in_cone_at_vertex,
867 bool in_cone_at_calo_face,
891 double theSumResp = 0;
893 double theSumEnergy = 0;
897 if ( !tracks.
empty() ) {
901 for ( ; itrk != jtrk; ++itrk ) {
904 if ( in_cone_at_calo_face && is_pion && (*itrk)->pt() >= 50. ) {
continue; }
909 inner =
PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(),
mass );
911 double energy =
sqrt( (*itrk)->px() * (*itrk)->px() +
912 (*itrk)->py() * (*itrk)->py() +
913 (*itrk)->pz() * (*itrk)->pz() +
915 inner = ( jet.energy() > 0. ? energy / jet.energy() : 1. ) * jet;
919 if ( in_cone_at_vertex ) { correction +=
inner; }
922 double eta = fabs( (*itrk)->eta() );
923 double pt = fabs( (*itrk)->pt() );
932 if ( in_cone_at_calo_face ) {
935 double outer_pt = (*itrk)->pt();
936 double outer_eta = (*itrk)->eta();
937 double outer_phi = (*itrk)->phi();
938 if ( (*itrk)->extra().isNonnull() ) {
939 outer_pt = (*itrk)->pt();
940 outer_eta = (*itrk)->outerPosition().eta();
941 outer_phi = (*itrk)->outerPosition().phi();
943 outer =
PtEtaPhiM( outer_pt, outer_eta, outer_phi, mass );
945 if ( !is_pion ) { outer *= ( outer.energy() > 0. ? mip / outer.energy() : 1. ); }
946 else { outer *= ( outer.energy() > 0. ? inner.energy() / outer.energy() : 1. ); }
949 if ( !is_pion ) { outer = ( jet.energy() > 0. ? mip / jet.energy() : 1. ) * jet; }
950 else { outer =
inner; }
960 theSumPt += inner.pt();
961 theSumEnergy += inner.energy();
964 if ( is_pion ) { eff.
addE( ieta, ipt, inner.energy() ); }
968 std::stringstream
temp;
969 temp <<
" Response[" << ieta <<
"," << ipt <<
"]";
970 std::stringstream ss;
971 ss <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" << std::endl
972 <<
" Track eta / pt : " << eta <<
" / " << pt << std::endl
973 << temp.str() << std::setw(21-temp.str().size()) <<
" : " 975 <<
" Track momentum added : " << inner.energy() << std::endl
976 <<
" Response subtracted : " << outer.energy() << std::endl
977 <<
" Energy correction : " << correction.energy();
978 LogDebug(
"JetPlusTrackCorrector") << ss.str();
984 if( in_cone_at_vertex ) {
1010 bool in_cone_at_calo_face ) {
1015 double theSumResp = 0;
1016 double theSumPt = 0;
1017 double theSumEnergy = 0;
1024 if ( !eff.
nTrks(ieta,ipt) ) {
continue; }
1026 for ( uint16_t
ii = 0;
ii < 2; ++
ii ) {
1031 else if (
ii == 1 && in_cone_at_calo_face ) { corr = eff.
inConeCorr( ieta, ipt );}
1038 double corr_phi = jet.phi();
1041 corr_p4 *= ( corr_p4.energy() > 0. ? corr / corr_p4.energy() : 1. );
1043 corr_p4 = ( jet.energy() > 0. ? corr / jet.energy() : 1. ) * jet;
1047 if (
ii == 0 ) { correction += corr_p4; theSumPt += corr_p4.pt(); theSumEnergy += corr_p4.energy();}
1048 else if (
ii == 1 ) { correction -= corr_p4; theSumResp += corr_p4.energy();}
1075 if ( muons->empty() ) {
return false; }
1077 RecoMuons::const_iterator imuon = muons->begin();
1078 RecoMuons::const_iterator jmuon = muons->end();
1079 for ( ; imuon != jmuon; ++imuon ) {
1081 if ( imuon->innerTrack().isNull() ||
1083 imuon->innerTrack()->pt() < 3.0 ) {
continue; }
1085 if ( itrk->id() != imuon->innerTrack().
id() ) {
1087 <<
"[JetPlusTrackCorrector::" << __func__ <<
"]" 1088 <<
"Product id of the tracks associated to the jet " << itrk->id()
1089 <<
" is different from the product id of the inner track used for muons " << imuon->innerTrack().
id()
1091 <<
"Cannot compare tracks from different collection. Configuration Error!";
1095 if ( *itrk == imuon->innerTrack() ) {
return true; }
1108 if ( elecs->empty() ) {
return false; }
1111 double deltaRMIN = 999.;
1113 uint32_t electron_index = 0;
1114 RecoElectrons::const_iterator ielec = elecs->begin();
1115 RecoElectrons::const_iterator jelec = elecs->end();
1116 for ( ; ielec != jelec; ++ielec ) {
1121 if ( (*elec_ids)[electron_ref] < 1.
e-6 ) {
continue; }
1124 double deltaphi = fabs( ielec->phi() - (*itrk)->momentum().phi() );
1125 if ( deltaphi > 6.283185308 ) deltaphi -= 6.283185308;
1126 if ( deltaphi > 3.141592654 ) deltaphi = 6.283185308 - deltaphi;
1127 deltaR =
abs(
sqrt(
pow( (ielec->eta() - (*itrk)->momentum().eta()), 2 ) +
1128 pow( deltaphi , 2 ) ) );
1129 if ( deltaR < deltaRMIN ) { deltaRMIN =
deltaR; }
1133 if ( deltaR < 0.02 )
return true;
1151 typedef std::vector<reco::JetBaseRef>::iterator JetBaseRefIterator;
1164 double jetEtIn=1.0/fJet.
et();
1168 double trkEta=(**it).eta();
1169 double trkPhi=(**it).phi();
1170 double dR2this =
deltaR2( jetEta, jetPhi, trkEta, trkPhi );
1176 double scalethis = dR2this;
1181 for(JetBaseRefIterator
ii = theJets.begin();
ii != theJets.end();
ii++)
1183 if(&(**
ii) == &fJet ) {
continue;}
1184 double dR2 =
deltaR2( (*ii)->eta(), (*ii)->phi(), trkEta, trkPhi );
1188 if(scale < scalethis) flag = 0;
1216 if(Excl.
empty())
return;
1230 if(itold == Excl.
end()) {
1252 double NewResponse = fJet.
energy();
1258 if( trBgOutOfVertex.
empty() )
return mScale;
1259 double EnergyOfBackgroundCharged = 0.;
1260 double ResponseOfBackgroundCharged = 0.;
1274 double eta = fabs( (**iBgtV).eta() );
1275 double pt = fabs( (**iBgtV).pt() );
1279 if(fabs(fJet.
eta() -(**iBgtV).eta()) > mConeSize)
continue;
1285 double echarBg=
sqrt((**iBgtV).px()*(**iBgtV).px()+(**iBgtV).py()*(**iBgtV).py()+(**iBgtV).pz()*(**iBgtV).pz()+0.14*0.14);
1304 double eta = fabs( (**iBgtC).eta() );
1305 double pt = fabs( (**iBgtC).pt() );
1309 if(fabs(fJet.
eta() -(**iBgtC).eta()) > mConeSize)
continue;
1315 double echarBg=
sqrt((**iBgtC).px()*(**iBgtC).px()+(**iBgtC).py()*(**iBgtC).py()+(**iBgtC).pz()*(**iBgtC).pz()+0.14*0.14);
1343 en+=
sqrt((*it)->p()*(*it)->p()+0.14*0.14);
1361 en_in+=
sqrt((*it)->p()*(*it)->p()+0.14*0.14);
1369 double SquareEtaRingWithoutJets = ja;
1373 EnergyOfBackgroundCharged = EnergyOfBackgroundCharged/SquareEtaRingWithoutJets;
1374 ResponseOfBackgroundCharged = ResponseOfBackgroundCharged/SquareEtaRingWithoutJets;
1378 EnergyOfBackgroundCharged =
M_PI*mConeSize*mConeSize*EnergyOfBackgroundCharged;
1379 ResponseOfBackgroundCharged =
M_PI*mConeSize*mConeSize*ResponseOfBackgroundCharged;
1383 NewResponse = NewResponse - EnergyOfBackgroundCharged + ResponseOfBackgroundCharged;
1389 mScale = NewResponse/fJet.
energy();
1390 if(mScale <0.) mScale=0.;
1403 std::vector<Element>
data;
1407 std::ifstream
in( file.c_str() );
1409 uint32_t ieta_old = 0;
1410 while ( std::getline(
in, line ) ) {
1411 if ( line.empty() || line[0]==
'#' ) {
continue; }
1412 std::istringstream ss(line);
1415 data.push_back(temp);
1416 if ( !ieta_old || temp.
ieta_ != ieta_old ) {
1419 ieta_old = temp.
ieta_;
1427 std::vector<Element>::const_iterator idata = data.begin();
1428 std::vector<Element>::const_iterator jdata = data.end();
1429 for ( ; idata != jdata; ++idata ) {
data_[idata->ieta_][idata->ipt_] = idata->val_; }
1433 std::stringstream ss;
1434 ss <<
"[jpt::Map::" << __func__ <<
"]" 1435 <<
" Problem parsing map in location \"" 1443 std::stringstream ss;
1444 ss <<
"[jpt::Map::" << __func__ <<
"]" 1445 <<
" Discrepancy b/w number of bins!";
1451 std::stringstream ss;
1452 ss <<
"[jpt::Map::" << __func__ <<
"]" 1453 <<
" Parsed contents of map at location:" << std::endl
1454 <<
"\"" << file <<
"\"" << std::endl;
1456 LogTrace(
"JetPlusTrackCorrector") << ss.str();
1487 if ( !
eta_.empty() && eta_bin <
eta_.size() ) {
return eta_[eta_bin]; }
1501 if ( !
pt_.empty() && pt_bin <
pt_.size() ) {
return pt_[pt_bin]; }
1508 return pt_[
pt_.size()-1];
1515 if ( !
eta_.empty() && eta_bin+1 <
eta_.size() ) {
1516 return eta_[eta_bin] + (
eta_[eta_bin+1] -
eta_[eta_bin] ) / 2.;
1530 if ( !
pt_.empty() && pt_bin+1 <
pt_.size() ) {
1531 return pt_[pt_bin] + (
pt_[pt_bin+1] -
pt_[pt_bin] ) / 2.;
1538 return pt_[
pt_.size()-1];
1546 for ( uint32_t ieta = 0; ieta <
nEtaBins()-1; ++ieta ) {
1547 if ( val >
eta(ieta) && ( ieta+1 ==
nEtaBins() || val <
eta(ieta+1) ) ) {
return ieta; }
1556 for ( uint32_t ipt = 0; ipt <
nPtBins()-1; ++ipt ) {
1557 if ( val >
pt(ipt) && ( (ipt+1) ==
nPtBins() || val <
pt(ipt+1) ) ) {
return ipt; }
1565 if ( eta_bin <
data_.size() &&
1566 pt_bin < (
data_.empty() ? 0 :
data_[0].size() ) ) {
return data_[eta_bin][pt_bin]; }
1580 ss <<
" Number of bins in eta : " <<
data_.size() << std::endl
1581 <<
" Number of bins in pt : " << (
data_.empty() ? 0 :
data_[0].size() ) << std::endl;
1582 VVDouble::const_iterator ieta =
data_.begin();
1583 VVDouble::const_iterator
jeta =
data_.end();
1584 for ( ; ieta !=
jeta; ++ieta ) {
1585 VDouble::const_iterator ipt = ieta->begin();
1586 VDouble::const_iterator
jpt = ieta->end();
1587 for ( ; ipt != jpt; ++ipt ) {
1588 uint32_t eta_bin =
static_cast<uint32_t
>( ieta -
data_.begin() );
1589 uint32_t pt_bin =
static_cast<uint32_t
>( ipt - ieta->begin() );
1590 ss <<
" EtaBinNumber: " << eta_bin
1591 <<
" PtBinNumber: " << pt_bin
1592 <<
" EtaValue: " <<
eta_[ eta_bin ]
1593 <<
" PtValue: " <<
pt_[ pt_bin ]
1594 <<
" Value: " <<
data_[eta_bin][pt_bin]
1603 : inVertexInCalo_(),
1604 outOfVertexInCalo_(),
1605 inVertexOutOfCalo_()
1651 : response_(response),
1652 efficiency_(efficiency),
1661 if (
check(eta_bin,pt_bin,__func__) ) {
1665 }
else {
return 0.; }
1671 if (
check(eta_bin,pt_bin,__func__) ) {
1672 uint16_t ntrks =
nTrks( eta_bin, pt_bin );
1675 if ( !ntrks ) {
return 0.; }
1676 return ( ntrks * eff * mean );
1677 }
else {
return 0.; }
1683 if (
check(eta_bin,pt_bin,__func__) ) {
1684 return data_[eta_bin][pt_bin].first;
1685 }
else {
return 0; }
1691 if (
check(eta_bin,pt_bin,__func__) ) {
1692 return data_[eta_bin][pt_bin].second;
1693 }
else {
return 0.; }
1699 if (
check(eta_bin,pt_bin,__func__) ) {
1701 if ( tmp.first ) {
return tmp.second / tmp.first; }
1703 }
else {
return 0.; }
1709 if (
check(eta_bin,pt_bin,__func__) ) {
1710 data_[eta_bin][pt_bin].first++;
1711 data_[eta_bin][pt_bin].second += energy;
1718 if ( eta_bin <
data_.size() && pt_bin < (
data_.empty() ? 0 :
data_[0].size() ) ) {
return true; }
1740 std::stringstream ss;
1741 ss <<
"[jpt::Efficiency::" << __func__ <<
"]" 1742 <<
" Contents of maps:" << std::endl;
1743 ss <<
"Response map: " << std::endl;
1745 ss <<
"Efficiency map: " << std::endl;
1747 ss <<
"Leakage map: " << std::endl;
1749 LogTrace(
"JetPlusTrackCorrector") << ss.str();
math::XYZTLorentzVector P4
T getParameter(std::string const &) const
uint32_t nEtaBins() const
double eta() const final
momentum pseudorapidity
double eta(uint32_t) const
bool useOutOfVertexTracks_
edm::EDGetTokenT< RecoMuons > inut_reco_muons_token_
double meanE(uint32_t eta_bin, uint32_t pt_bin) const
Base class for all types of Jets.
double px() const final
x coordinate of momentum vector
const jpt::Map & responseMap() const
reco::TrackRefVector inVertexInCalo_
bool matchTracks(const reco::Jet &, const edm::Event &, const edm::EventSetup &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs)
Matches tracks to different particle types.
float theResponseOfChargedWithoutEff
def setup(process, global_tag, zero_tesla=False)
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::InputTag electronIds_
reco::TrackRefVector vertex_
void addE(uint32_t eta_bin, uint32_t pt_bin, double energy)
reco::TrackRefVector inVertexOutOfCalo_
P4 calculateCorr(const P4 &jet, const TrackRefs &, jpt::Efficiency &, bool in_cone_at_vertex, bool in_cone_at_calo_face, double mass, bool is_pion, double mip)
Generic method to calculates 4-momentum correction to be applied.
reco::GsfElectronCollection RecoElectrons
std::pair< uint16_t, double > Pair
Container class for response & efficiency maps.
const_iterator end() const
Termination of iteration.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
uint32_t etaBin(double eta) const
bool empty() const
Is the RefVector empty.
double checkScale(const P4 &jet, P4 &corrected) const
Check corrected 4-momentum does not give negative scale.
const jpt::Map & efficiency_
ProductID id() const
Accessor for product ID.
const_iterator begin() const
Initialize an iterator over the RefVector.
P4 pionCorrection(const P4 &jet, const jpt::MatchedTracks &pions)
Calculates corrections to be applied using pions.
edm::EDGetTokenT< RecoElectronIds > input_reco_elec_ids_token_
static std::string const input
const jpt::Map & efficiencyMap() const
bool tracksInCalo(const jpt::MatchedTracks &pions, const jpt::MatchedTracks &muons, const jpt::MatchedTracks &elecs) const
Determines if any tracks in cone at CaloFace.
reco::Particle::Point vertex_
const jpt::Map efficiency_
edm::EDGetTokenT< RecoElectrons > input_reco_elecs_token_
bool canCorrect(const reco::Jet &) const
Can jet be JPT-corrected?
const jpt::Map & response_
double et() const final
transverse energy
reco::TrackRefVector caloFace_
double pz() const final
z coordinate of momentum vector
void print(std::stringstream &ss) const
double pt(uint32_t) const
double correction(const reco::Jet &, const reco::Jet &, const edm::Event &, const edm::EventSetup &, P4 &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs, bool &validMatches)
Vectorial correction method (corrected 4-momentum passed by reference)
bool findTrack(const jpt::JetTracks &, TrackRefs::const_iterator &, TrackRefs::iterator &) const
Find track in JetTracks collection.
const jpt::Map & leakageMap() const
double energy() const final
energy
double binCenterPt(uint32_t) const
math::XYZPoint Point
point in the space
Abs< T >::type abs(const T &t)
reco::TrackRefVector outOfVertexInCalo_
edm::InputTag jetTracksAtCalo_
float theSumEnergyWithoutEff
bool matchMuons(TrackRefs::const_iterator &, const edm::Handle< RecoMuons > &) const
Matches tracks to RECO muons.
P4 pionEfficiency(const P4 &jet, const jpt::Efficiency &, bool in_cone_at_calo_face)
Correction to be applied using tracking efficiency.
bool failTrackQuality(TrackRefs::const_iterator &) const
Check on track quality.
const LorentzVector & p4() const final
four-momentum Lorentz vector
const reco::TrackRefVector & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
double outOfConeCorr(uint32_t eta_bin, uint32_t pt_bin) const
double inConeCorr(uint32_t eta_bin, uint32_t pt_bin) const
double correctAA(const reco::Jet &, const reco::TrackRefVector &, double &, const reco::TrackRefVector &, const reco::TrackRefVector &, double, const reco::TrackRefVector &) const
For AA - correct in tracker.
virtual ~JetPlusTrackCorrector()
Destructor.
void rebuildJta(const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, TrackRefs &excluded) const
Rebuild jet-track association.
bool getMuons(const edm::Event &, edm::Handle< RecoMuons > &) const
Get RECO muons.
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
double sumE(uint32_t eta_bin, uint32_t pt_bin) const
edm::InputTag jetTracksAtVertex_
std::vector< reco::JetBaseRef > allJets(const Container &)
fill list of all jets associated with values. Return # of jets in the list
P4 elecCorrection(const P4 &jet, const jpt::MatchedTracks &elecs) const
Calculates correction to be applied using electrons.
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
float theResponseOfChargedWithEff
T const * product() const
void clear()
Clear the vector.
void excludeJta(const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, const TrackRefs &excluded) const
Exclude jet-track association.
Tracks associated to jets that are in-cone at Vertex and CaloFace.
bool getElectrons(const edm::Event &, edm::Handle< RecoElectrons > &, edm::Handle< RecoElectronIds > &) const
Get RECO electrons.
std::vector< double > pt_
double py() const final
y coordinate of momentum vector
reco::TrackBase::TrackQuality trackQuality_
std::vector< Pair > VPair
P4 muonCorrection(const P4 &jet, const jpt::MatchedTracks &muons)
Calculates correction to be applied using muons.
std::vector< double > eta_
Particles matched to tracks that are in/in, in/out, out/in at Vertex and CaloFace.
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const
std::vector< std::vector< double > > tmp
char data[epos_bytes_allocation]
uint16_t nTrks(uint32_t eta_bin, uint32_t pt_bin) const
bool jtaUsingEventData(const reco::Jet &, const edm::Event &, jpt::JetTracks &) const
JTA using collections from event.
uint32_t ptBin(double pt) const
float theSumEnergyWithEff
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
size_type size() const
Size of the RefVector.
std::string fullPath() const
JetPlusTrackCorrector()
Default constructor.
edm::EDGetTokenT< reco::JetTracksAssociation::Container > input_jetTracksAtCalo_token_
P4 jetDirFromTracks(const P4 &jet, const jpt::MatchedTracks &pions, const jpt::MatchedTracks &muons, const jpt::MatchedTracks &elecs) const
Calculates vectorial correction using total track 3-momentum.
double value(uint32_t eta_bin, uint32_t pt_bin) const
edm::EDGetTokenT< reco::JetTracksAssociation::Container > input_jetTracksAtVertex_token_
reco::MuonCollection RecoMuons
Get reponses.
edm::EDGetTokenT< reco::VertexCollection > input_pvCollection_token_
double phi() const final
momentum azimuthal angle
double binCenterEta(uint32_t) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Power< A, B >::type pow(const A &a, const B &b)
std::vector< double > VDouble
virtual bool jetTrackAssociation(const reco::Jet &, const edm::Event &, const edm::EventSetup &, jpt::JetTracks &) const
Associates tracks to jets (overriden in derived class)
math::PtEtaPhiMLorentzVectorD PtEtaPhiM
bool matchElectrons(TrackRefs::const_iterator &, const edm::Handle< RecoElectrons > &, const edm::Handle< RecoElectronIds > &) const
Matches tracks to RECO electrons.
double mass() const final
mass
const jpt::Map & leakage_