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
172 << std::fixed << std::setprecision(6)
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->size()>0 )
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.
size() == 0)
return;
1230 if(itold == Excl.
end()) {
1252 double NewResponse = fJet.
energy();
1258 if( trBgOutOfVertex.
size() == 0 )
return mScale;
1259 double EnergyOfBackgroundCharged = 0.;
1260 double ResponseOfBackgroundCharged = 0.;
1261 double NumberOfBackgroundChargedVertex = 0.;
1262 double NumberOfBackgroundChargedCalo = 0.;
1276 double eta = fabs( (**iBgtV).eta() );
1277 double pt = fabs( (**iBgtV).pt() );
1281 if(fabs(fJet.
eta() -(**iBgtV).eta()) > mConeSize)
continue;
1287 double echarBg=
sqrt((**iBgtV).px()*(**iBgtV).px()+(**iBgtV).py()*(**iBgtV).py()+(**iBgtV).pz()*(**iBgtV).pz()+0.14*0.14);
1295 NumberOfBackgroundChargedVertex++;
1308 double eta = fabs( (**iBgtC).eta() );
1309 double pt = fabs( (**iBgtC).pt() );
1313 if(fabs(fJet.
eta() -(**iBgtC).eta()) > mConeSize)
continue;
1319 double echarBg=
sqrt((**iBgtC).px()*(**iBgtC).px()+(**iBgtC).py()*(**iBgtC).py()+(**iBgtC).pz()*(**iBgtC).pz()+0.14*0.14);
1326 NumberOfBackgroundChargedCalo++;
1349 en+=
sqrt((*it)->p()*(*it)->p()+0.14*0.14);
1367 en_in+=
sqrt((*it)->p()*(*it)->p()+0.14*0.14);
1375 double SquareEtaRingWithoutJets = ja;
1379 EnergyOfBackgroundCharged = EnergyOfBackgroundCharged/SquareEtaRingWithoutJets;
1380 ResponseOfBackgroundCharged = ResponseOfBackgroundCharged/SquareEtaRingWithoutJets;
1381 NumberOfBackgroundChargedVertex = NumberOfBackgroundChargedVertex/SquareEtaRingWithoutJets;
1382 NumberOfBackgroundChargedCalo = NumberOfBackgroundChargedCalo/SquareEtaRingWithoutJets;
1386 EnergyOfBackgroundCharged =
M_PI*mConeSize*mConeSize*EnergyOfBackgroundCharged;
1387 ResponseOfBackgroundCharged =
M_PI*mConeSize*mConeSize*ResponseOfBackgroundCharged;
1388 NumberOfBackgroundChargedVertex =
M_PI*mConeSize*mConeSize*NumberOfBackgroundChargedVertex;
1389 NumberOfBackgroundChargedCalo =
M_PI*mConeSize*mConeSize*NumberOfBackgroundChargedCalo;
1393 NewResponse = NewResponse - EnergyOfBackgroundCharged + ResponseOfBackgroundCharged;
1401 mScale = NewResponse/fJet.
energy();
1402 if(mScale <0.) mScale=0.;
1415 std::vector<Element>
data;
1419 std::ifstream
in( file.c_str() );
1421 uint32_t ieta_old = 0;
1422 while ( std::getline(
in, line ) ) {
1423 if ( !line.size() || line[0]==
'#' ) {
continue; }
1424 std::istringstream
ss(line);
1427 data.push_back(temp);
1428 if ( !ieta_old || temp.
ieta_ != ieta_old ) {
1431 ieta_old = temp.
ieta_;
1439 std::vector<Element>::const_iterator idata = data.begin();
1440 std::vector<Element>::const_iterator jdata = data.end();
1441 for ( ; idata != jdata; ++idata ) {
data_[idata->ieta_][idata->ipt_] = idata->val_; }
1445 std::stringstream
ss;
1446 ss <<
"[jpt::Map::" << __func__ <<
"]"
1447 <<
" Problem parsing map in location \""
1455 std::stringstream
ss;
1456 ss <<
"[jpt::Map::" << __func__ <<
"]"
1457 <<
" Discrepancy b/w number of bins!";
1463 std::stringstream
ss;
1464 ss <<
"[jpt::Map::" << __func__ <<
"]"
1465 <<
" Parsed contents of map at location:" << std::endl
1466 <<
"\"" << file <<
"\"" << std::endl;
1468 LogTrace(
"JetPlusTrackCorrector") << ss.str();
1499 if ( !
eta_.empty() && eta_bin <
eta_.size() ) {
return eta_[eta_bin]; }
1513 if ( !
pt_.empty() && pt_bin <
pt_.size() ) {
return pt_[pt_bin]; }
1520 return pt_[
pt_.size()-1];
1527 if ( !
eta_.empty() && eta_bin+1 <
eta_.size() ) {
1528 return eta_[eta_bin] + (
eta_[eta_bin+1] -
eta_[eta_bin] ) / 2.;
1542 if ( !
pt_.empty() && pt_bin+1 <
pt_.size() ) {
1543 return pt_[pt_bin] + (
pt_[pt_bin+1] -
pt_[pt_bin] ) / 2.;
1550 return pt_[
pt_.size()-1];
1558 for ( uint32_t ieta = 0; ieta <
nEtaBins()-1; ++ieta ) {
1559 if ( val >
eta(ieta) && ( ieta+1 ==
nEtaBins() || val <
eta(ieta+1) ) ) {
return ieta; }
1568 for ( uint32_t ipt = 0; ipt <
nPtBins()-1; ++ipt ) {
1569 if ( val >
pt(ipt) && ( (ipt+1) ==
nPtBins() || val <
pt(ipt+1) ) ) {
return ipt; }
1577 if ( eta_bin <
data_.size() &&
1578 pt_bin < (
data_.empty() ? 0 :
data_[0].size() ) ) {
return data_[eta_bin][pt_bin]; }
1592 ss <<
" Number of bins in eta : " <<
data_.size() << std::endl
1593 <<
" Number of bins in pt : " << (
data_.empty() ? 0 :
data_[0].size() ) << std::endl;
1594 VVDouble::const_iterator ieta =
data_.begin();
1595 VVDouble::const_iterator jeta =
data_.end();
1596 for ( ; ieta != jeta; ++ieta ) {
1597 VDouble::const_iterator ipt = ieta->begin();
1598 VDouble::const_iterator jpt = ieta->end();
1599 for ( ; ipt != jpt; ++ipt ) {
1600 uint32_t eta_bin =
static_cast<uint32_t
>( ieta -
data_.begin() );
1601 uint32_t pt_bin =
static_cast<uint32_t
>( ipt - ieta->begin() );
1602 ss <<
" EtaBinNumber: " << eta_bin
1603 <<
" PtBinNumber: " << pt_bin
1604 <<
" EtaValue: " <<
eta_[ eta_bin ]
1605 <<
" PtValue: " <<
pt_[ pt_bin ]
1606 <<
" Value: " <<
data_[eta_bin][pt_bin]
1615 : inVertexInCalo_(),
1616 outOfVertexInCalo_(),
1617 inVertexOutOfCalo_()
1663 : response_(response),
1664 efficiency_(efficiency),
1673 if (
check(eta_bin,pt_bin,__func__) ) {
1677 }
else {
return 0.; }
1683 if (
check(eta_bin,pt_bin,__func__) ) {
1684 uint16_t ntrks =
nTrks( eta_bin, pt_bin );
1687 if ( !ntrks ) {
return 0.; }
1688 return ( ntrks * eff * mean );
1689 }
else {
return 0.; }
1695 if (
check(eta_bin,pt_bin,__func__) ) {
1696 return data_[eta_bin][pt_bin].first;
1697 }
else {
return 0; }
1703 if (
check(eta_bin,pt_bin,__func__) ) {
1704 return data_[eta_bin][pt_bin].second;
1705 }
else {
return 0.; }
1711 if (
check(eta_bin,pt_bin,__func__) ) {
1713 if ( tmp.first ) {
return tmp.second / tmp.first; }
1715 }
else {
return 0.; }
1721 if (
check(eta_bin,pt_bin,__func__) ) {
1722 data_[eta_bin][pt_bin].first++;
1730 if ( eta_bin <
data_.size() && pt_bin < (
data_.empty() ? 0 :
data_[0].size() ) ) {
return true; }
1752 std::stringstream
ss;
1753 ss <<
"[jpt::Efficiency::" << __func__ <<
"]"
1754 <<
" Contents of maps:" << std::endl;
1755 ss <<
"Response map: " << std::endl;
1757 ss <<
"Efficiency map: " << std::endl;
1759 ss <<
"Leakage map: " << std::endl;
1761 LogTrace(
"JetPlusTrackCorrector") << ss.str();
math::XYZTLorentzVector P4
T getParameter(std::string const &) const
uint32_t nEtaBins() const
double eta(uint32_t) const
bool useOutOfVertexTracks_
virtual double et() const
transverse energy
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.
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
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.
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
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.
virtual double mass() const
mass
virtual double energy() const
energy
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_
reco::TrackRefVector caloFace_
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 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.
double deltaR2(const T1 &t1, const T2 &t2)
bool failTrackQuality(TrackRefs::const_iterator &) const
Check on track quality.
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
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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
double deltaR(double eta1, double eta2, double phi1, double phi2)
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.
float theResponseOfChargedWithEff
T const * product() const
void clear()
Clear the vector.
virtual double px() const
x coordinate of momentum 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_
reco::TrackBase::TrackQuality trackQuality_
virtual double pz() const
z coordinate of momentum vector
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.
JetPlusTrackCorrector()
Default constructor.
edm::EDGetTokenT< reco::JetTracksAssociation::Container > input_jetTracksAtCalo_token_
std::string fullPath() const
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_
virtual double phi() const
momentum azimuthal angle
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
double binCenterEta(uint32_t) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual double py() const
y coordinate of momentum 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.
const jpt::Map & leakage_