67 vectorial_ = iConfig.
getParameter<
bool>(
"VectorialCorrection");
77 produces<reco::JPTJetCollection>().setBranchAlias(alias_);
78 produces<reco::CaloJetCollection>().setBranchAlias(
"ak4CaloJetsJPT");
80 input_jets_token_ = consumes<edm::View<reco::CaloJet> >(src_);
82 input_trackjets_token_ = consumes<edm::View<reco::TrackJet> >(srcTrackJets_);
83 input_vertex_token_ = consumes<reco::VertexCollection>(srcPVs_);
102 auto const& jets_h = iEvent.
get(input_jets_token_);
103 auto const& addjets_h = iEvent.
get(input_addjets_token_);
104 auto const& iExtrapolations = iEvent.
get(mExtrapolations_);
108 auto pOut = std::make_unique<reco::JPTJetCollection>();
109 auto pOut1 = std::make_unique<reco::CaloJetCollection>();
111 double scaleJPT = 1.;
112 for (
auto const&
jet : iEvent.
get(input_trackjets_token_)) {
115 for (
auto const& oldjet : addjets_h) {
117 if (dr2 <= dRcone_ * dRcone_) {
124 auto const& mycalo = addjets_h[icalo];
125 std::vector<edm::Ptr<reco::Track> > tracksinjet =
jet.tracks();
128 for (
auto const& itrack : tracksinjet) {
129 for (
auto const& ixtrp : iExtrapolations) {
130 if (ixtrp.positions().empty())
133 double mydphi =
deltaPhi(ixtrp.track()->phi(), itrack->phi());
134 if (fabs(ixtrp.track()->pt() - itrack->pt()) > 0.001 || fabs(ixtrp.track()->eta() - itrack->eta()) > 0.001 ||
138 if (itrack.id() != ixtrp.track().id() || itrack.key() != ixtrp.track().key())
144 if (dr2 <= dRcone_ * dRcone_) {
157 mJPTalgo->correction(corrected, mycalo, iEvent, iSetup, tracksinvert, tracksincalo, p4, pions, muons, elecs);
158 if (p4.pt() > ptCUT_) {
172 reco::JPTJet fJet(p4,
jet.primaryVertex()->position(), jptspe, mycalo.getJetConstituents());
173 pOut->push_back(fJet);
174 pOut1->push_back(mycalo);
179 for (
auto const& oldjet : jets_h) {
183 double factorZSP = 1.;
185 factorZSP = mZSPalgo->correction(corrected, iEvent, iSetup);
199 scaleJPT = mJPTalgo->correction(corrected, oldjet, iEvent, iSetup, pions, muons, elecs, ok);
201 corrected.
py() * scaleJPT,
202 corrected.
pz() * scaleJPT,
203 corrected.
energy() * scaleJPT);
205 scaleJPT = mJPTalgo->correction(corrected, oldjet, iEvent, iSetup, p4, pions, muons, elecs, ok);
235 double deEta2Tr = 0.;
236 double dePhi2Tr = 0.;
240 double denominator_tracks = 0.;
245 double deR =
deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
246 double deEta = (*it)->eta() - p4.eta();
247 double dePhi =
deltaPhi((*it)->phi(), p4.phi());
248 if ((**it).ptError() / (**it).pt() < 0.1) {
249 deR2Tr = deR2Tr + deR * deR * (*it)->pt();
250 deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
251 dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
252 denominator_tracks = denominator_tracks + (*it)->pt();
253 Zch = Zch + (*it)->pt();
255 Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch * p4.P()) * (Zch * p4.P());
262 double deR =
deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
263 double deEta = (*it)->eta() - p4.eta();
264 double dePhi =
deltaPhi((*it)->phi(), p4.phi());
265 if ((**it).ptError() / (**it).pt() < 0.1) {
266 deR2Tr = deR2Tr + deR * deR * (*it)->pt();
267 deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
268 dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
269 denominator_tracks = denominator_tracks + (*it)->pt();
270 Zch = Zch + (*it)->pt();
272 Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch * p4.P()) * (Zch * p4.P());
278 double deR =
deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
279 double deEta = (*it)->eta() - p4.eta();
280 double dePhi =
deltaPhi((*it)->phi(), p4.phi());
281 if ((**it).ptError() / (**it).pt() < 0.1) {
282 deR2Tr = deR2Tr + deR * deR * (*it)->pt();
283 deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
284 dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
285 denominator_tracks = denominator_tracks + (*it)->pt();
286 Zch = Zch + (*it)->pt();
288 Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch * p4.P()) * (Zch * p4.P());
295 Zch = Zch + (*it)->pt();
300 Zch = Zch + (*it)->pt();
305 Zch = Zch + (*it)->pt();
308 if (mJPTalgo->getSumPtForBeta() > 0.)
309 Zch = Zch / mJPTalgo->getSumPtForBeta();
312 Pout =
sqrt(fabs(Pout2)) / ntracks;
314 if (denominator_tracks != 0) {
315 deR2Tr = deR2Tr / denominator_tracks;
316 deEta2Tr = deEta2Tr / denominator_tracks;
317 dePhi2Tr = dePhi2Tr / denominator_tracks;
323 specific.
Pout = Pout;
332 iEvent.
getByToken(input_vertex_token_, pvCollection);
333 if (pvCollection.
isValid() && !pvCollection->empty())
334 vertex_ = pvCollection->begin()->position();
340 if (fJet.pt() > ptCUT_)
341 pOut->push_back(fJet);
343 std::sort(pOut->begin(), pOut->end(),
sort_by_pt);
reco::TrackRefVector muonsInVertexOutCalo
T getUntrackedParameter(std::string const &, T const &) const
float mSumEnergyOfChargedWithoutEff
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double pz() const final
z coordinate of momentum vector
Jets made from CaloTowers.
reco::TrackRefVector muonsInVertexInCalo
virtual void scaleEnergy(double fScale)
scale energy of the jet
double pt() const final
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
float mChargedHadronEnergy
float mSumPtOfChargedWithEff
reco::TrackRefVector inVertexInCalo_
reco::TrackRefVector muonsOutVertexInCalo
reco::TrackRefVector inVertexOutOfCalo_
float mResponseOfChargedWithEff
void produce(edm::Event &, const edm::EventSetup &) override
reco::TrackRefVector elecsOutVertexInCalo
virtual Constituents getJetConstituents() const
list of constituents
reco::TrackRefVector pionsInVertexOutCalo
const_iterator end() const
Termination of iteration.
const_iterator begin() const
Initialize an iterator over the RefVector.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double px() const final
x coordinate of momentum vector
Jets made from CaloJets corrected for ZSP and tracks.
reco::TrackRefVector pionsOutVertexInCalo
float mSumEnergyOfChargedWithEff
math::XYZPoint Point
point in the space
bool sort_by_pt(const reco::JPTJet &a, const reco::JPTJet &b)
reco::TrackRefVector outOfVertexInCalo_
bool get(ProductID const &oid, Handle< PROD > &result) const
reco::TrackRefVector elecsInVertexInCalo
math::XYZPoint Point
point in the space
double py() const final
y coordinate of momentum vector
RefProd< PROD > getRefBeforePut()
edm::RefToBase< reco::Jet > theCaloJetRef
JetPlusTrackProducer(const edm::ParameterSet &)
float mResponseOfChargedWithoutEff
reco::TrackRefVector pionsInVertexInCalo
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
T getParameter(std::string const &) const
float mSumPtOfChargedWithoutEff
reco::TrackRefVector elecsInVertexOutCalo
Particles matched to tracks that are in/in, in/out, out/in at Vertex and CaloFace.
Jet energy correction algorithm using tracks.
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
~JetPlusTrackProducer() override
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
math::XYZPoint Point
point in the space
double energy() const final
energy