CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
JetPlusTrackProducerAA Class Reference

#include <JetPlusTrackProducerAA.cc>

Inheritance diagram for JetPlusTrackProducerAA:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob () override
 
reco::TrackRefVector calculateBGtracksJet (reco::JPTJetCollection &, std::vector< reco::TrackRef > &, edm::Handle< std::vector< reco::TrackExtrapolation > > &, reco::TrackRefVector &)
 
void endJob () override
 
 JetPlusTrackProducerAA (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~JetPlusTrackProducerAA () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::string alias
 
edm::EDGetTokenT< std::vector< reco::TrackExtrapolation > > input_extrapolations_token_
 
edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
 
edm::EDGetTokenT< reco::TrackCollectioninput_tracks_token_
 
edm::EDGetTokenT< reco::VertexCollectioninput_vertex_token_
 
double mConeSize
 
edm::InputTag mExtrapolations
 
JetPlusTrackCorrectormJPTalgo
 
edm::InputTag mTracks
 
ZSPJPTJetCorrectormZSPalgo
 
edm::InputTag src
 
edm::InputTag srcPVs_
 
reco::TrackBase::TrackQuality trackQuality_
 
bool useZSP
 
bool vectorial_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 55 of file JetPlusTrackProducerAA.h.

Constructor & Destructor Documentation

◆ JetPlusTrackProducerAA()

JetPlusTrackProducerAA::JetPlusTrackProducerAA ( const edm::ParameterSet iConfig)
explicit

Definition at line 77 of file JetPlusTrackProducerAA.cc.

77  {
78  //register your products
79  src = iConfig.getParameter<edm::InputTag>("src");
80  alias = iConfig.getUntrackedParameter<string>("alias");
81  mTracks = iConfig.getParameter<edm::InputTag>("tracks");
82  srcPVs_ = iConfig.getParameter<edm::InputTag>("srcPVs");
83  vectorial_ = iConfig.getParameter<bool>("VectorialCorrection");
84  useZSP = iConfig.getParameter<bool>("UseZSP");
85  std::string tq = iConfig.getParameter<std::string>("TrackQuality");
87  mConeSize = iConfig.getParameter<double>("coneSize");
88  //=>
89  mExtrapolations = iConfig.getParameter<edm::InputTag>("extrapolations");
90  //=>
92  if (useZSP)
93  mZSPalgo = new ZSPJPTJetCorrector(iConfig);
94 
95  produces<reco::JPTJetCollection>().setBranchAlias(alias);
96 
97  input_jets_token_ = consumes<edm::View<reco::CaloJet> >(src);
98  input_vertex_token_ = consumes<reco::VertexCollection>(srcPVs_);
99  input_tracks_token_ = consumes<reco::TrackCollection>(mTracks);
100  input_extrapolations_token_ = consumes<std::vector<reco::TrackExtrapolation> >(mExtrapolations);
101 }

References SiStripOfflineCRack_cfg::alias, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), reco::TrackBase::qualityByName(), TrackRefitter_38T_cff::src, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~JetPlusTrackProducerAA()

JetPlusTrackProducerAA::~JetPlusTrackProducerAA ( )
override

Definition at line 103 of file JetPlusTrackProducerAA.cc.

103  {
104  // do anything here that needs to be done at desctruction time
105  // (e.g. close files, deallocate resources etc.)
106 }

Member Function Documentation

◆ beginJob()

void JetPlusTrackProducerAA::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 467 of file JetPlusTrackProducerAA.cc.

467 {}

◆ calculateBGtracksJet()

reco::TrackRefVector JetPlusTrackProducerAA::calculateBGtracksJet ( reco::JPTJetCollection fJets,
std::vector< reco::TrackRef > &  fTracks,
edm::Handle< std::vector< reco::TrackExtrapolation > > &  extrapolations_h,
reco::TrackRefVector trBgOutOfCalo 
)

Definition at line 380 of file JetPlusTrackProducerAA.cc.

384  {
385  reco::TrackRefVector trBgOutOfVertex;
386 
387  for (unsigned t = 0; t < fTracks.size(); ++t) {
388  int track_bg = 0;
389 
390  // if(!(*fTracks[t]).quality(trackQuality_))
391  // {
392  // cout<<"BG, BAD trackQuality, ptBgV="<<fTracks[t]->pt()<<" etaBgV = "<<fTracks[t]->eta()<<" phiBgV = "<<fTracks[t]->phi()<<endl;
393  // continue;
394  // }
395 
396  const reco::Track* track = &*(fTracks[t]);
397  double trackEta = track->eta();
398  double trackPhi = track->phi();
399 
400  // std::cout<<"++++++++++++++++> track="<<t<<" trackEta="<<trackEta<<" trackPhi="<<trackPhi
401  // <<" coneSize="<<mConeSize<<std::endl;
402 
403  //loop on jets
404  for (unsigned j = 0; j < fJets.size(); ++j) {
405  const reco::Jet* jet = &(fJets[j]);
406  double jetEta = jet->eta();
407  double jetPhi = jet->phi();
408 
409  // std::cout<<"-jet="<<j<<" jetEt ="<<jet->pt()
410  // <<" jetE="<<jet->energy()<<" jetEta="<<jetEta<<" jetPhi="<<jetPhi<<std::endl;
411 
412  if (fabs(jetEta - trackEta) < mConeSize) {
413  double dphiTrackJet = fabs(trackPhi - jetPhi);
414  if (dphiTrackJet > M_PI)
415  dphiTrackJet = 2 * M_PI - dphiTrackJet;
416 
417  if (dphiTrackJet < mConeSize) {
418  track_bg = 1;
419  // std::cout<<"===>>>> Track inside jet at vertex, track_bg="<< track_bg <<" track="<<t<<" jet="<<j
420  // <<" trackEta="<<trackEta<<" trackPhi="<<trackPhi
421  // <<" jetEta="<<jetEta<<" jetPhi="<<jetPhi<<std::endl;
422  }
423  }
424  } //jets
425 
426  if (track_bg == 0) {
427  trBgOutOfVertex.push_back(fTracks[t]);
428 
429  // std::cout<<"------Track outside jet at vertex, track_bg="<< track_bg<<" track="<<t
430  // <<" trackEta="<<trackEta<<" trackPhi="<<trackPhi <<std::endl;
431  }
432 
433  } //tracks
434 
435  //=====> Propagate BG tracks to calo
436  int nValid = 0;
437  for (std::vector<reco::TrackExtrapolation>::const_iterator xtrpBegin = extrapolations_h->begin(),
438  xtrpEnd = extrapolations_h->end(),
439  ixtrp = xtrpBegin;
440  ixtrp != xtrpEnd;
441  ++ixtrp) {
442  // std::cout<<"JetPlusTrackProducerAA::calculateBGtracksJet: initial track pt= "<<ixtrp->track()->pt()
443  // <<" eta= "<<ixtrp->track()->eta()<<" phi="<<ixtrp->track()->phi()
444  // <<" Valid? "<<ixtrp->isValid().at(0)<<std::endl;
445 
446  //if( ixtrp->isValid().at(0) == 0 ) continue;
447  //in DF change in 4.2, all entries are valid.
448  nValid++;
449 
450  reco::TrackRefVector::iterator it = find(trBgOutOfVertex.begin(), trBgOutOfVertex.end(), (*ixtrp).track());
451 
452  if (it != trBgOutOfVertex.end()) {
453  trBgOutOfCalo.push_back(*it);
454 
455  // std::cout<<"+++trBgOutOfCalo, pt= "<<ixtrp->track()->pt()<<" eta= "<<ixtrp->track()->eta()<<" phi="<<ixtrp->track()->phi()
456  // <<" Valid? "<<ixtrp->isValid().at(0)<<std::endl;
457  }
458  }
459 
460  // std::cout<<"calculateBGtracksJet, trBgOutOfCalo="<<trBgOutOfCalo.size()
461  // <<" trBgOutOfVertex="<<trBgOutOfVertex.size()<<" nValid="<<nValid<<endl;
462  //=====>
463 
464  return trBgOutOfVertex;
465 }

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), spr::find(), dqmiolumiharvest::j, metsig::jet, reco::btau::jetEta, reco::btau::jetPhi, M_PI, edm::RefVector< C, T, F >::push_back(), OrderedSet::t, HLT_2018_cff::track, reco::btau::trackEta, and reco::btau::trackPhi.

◆ endJob()

void JetPlusTrackProducerAA::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 470 of file JetPlusTrackProducerAA.cc.

470 {}

◆ produce()

void JetPlusTrackProducerAA::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 113 of file JetPlusTrackProducerAA.cc.

113  {
114  using namespace edm;
115 
116  // std::cout<<" RecoJets::JetPlusTrackProducerAA::produce "<<std::endl;
117 
118  // get stuff from Event
120  iEvent.getByToken(input_jets_token_, jets_h);
121 
123  iEvent.getByToken(input_tracks_token_, tracks_h);
124 
125  std::vector<reco::TrackRef> fTracks;
126  fTracks.reserve(tracks_h->size());
127  for (unsigned i = 0; i < tracks_h->size(); ++i) {
128  fTracks.push_back(reco::TrackRef(tracks_h, i));
129  }
130 
131  //=>
133  iEvent.getByToken(input_extrapolations_token_, extrapolations_h);
134 
135  // std::cout<<"JetPlusTrackProducerAA::produce, extrapolations_h="<<extrapolations_h->size()<<std::endl;
136  //=>
137 
138  auto pOut = std::make_unique<reco::JPTJetCollection>();
139 
140  reco::JPTJetCollection tmpColl;
141 
142  for (unsigned i = 0; i < jets_h->size(); ++i) {
143  const reco::CaloJet* oldjet = &(*(jets_h->refAt(i)));
144 
145  reco::CaloJet corrected = *oldjet;
146 
147  // ZSP corrections
148 
149  double factorZSP = 1.;
150  if (useZSP)
151  factorZSP = mZSPalgo->correction(corrected, iEvent, iSetup);
152 
153  // std::cout << " UseZSP = "<<useZSP<<std::endl;
154 
155  corrected.scaleEnergy(factorZSP);
156 
157  // JPT corrections
158 
159  double scaleJPT = 1.;
160 
162 
163  // Construct JPTJet constituent
164  jpt::MatchedTracks pions;
167  bool ok = false;
168 
169  if (!vectorial_) {
170  scaleJPT = mJPTalgo->correction(corrected, *oldjet, iEvent, iSetup, pions, muons, elecs, ok);
171  p4 = math::XYZTLorentzVector(corrected.px() * scaleJPT,
172  corrected.py() * scaleJPT,
173  corrected.pz() * scaleJPT,
174  corrected.energy() * scaleJPT);
175  } else {
176  scaleJPT = mJPTalgo->correction(corrected, *oldjet, iEvent, iSetup, p4, pions, muons, elecs, ok);
177  }
178 
180 
181  if (ok) {
182  // std::cout<<" Size of Pion in-in "<<pions.inVertexInCalo_.size()<<" in-out "<<pions.inVertexOutOfCalo_.size()
183  // <<" out-in "<<pions.outOfVertexInCalo_.size()<<" Oldjet "<<oldjet->et()<<" factorZSP "<<factorZSP
184  // <<" "<<corrected.et()<<" scaleJPT "<<scaleJPT<<" after JPT "<<p4.pt()<<std::endl;
185 
186  specific.pionsInVertexInCalo = pions.inVertexInCalo_;
187  specific.pionsInVertexOutCalo = pions.inVertexOutOfCalo_;
188  specific.pionsOutVertexInCalo = pions.outOfVertexInCalo_;
189  specific.muonsInVertexInCalo = muons.inVertexInCalo_;
190  specific.muonsInVertexOutCalo = muons.inVertexOutOfCalo_;
191  specific.muonsOutVertexInCalo = muons.outOfVertexInCalo_;
192  specific.elecsInVertexInCalo = elecs.inVertexInCalo_;
193  specific.elecsInVertexOutCalo = elecs.inVertexOutOfCalo_;
194  specific.elecsOutVertexInCalo = elecs.outOfVertexInCalo_;
195  }
196 
197  // Fill JPT Specific
198  edm::RefToBase<reco::Jet> myjet = (edm::RefToBase<reco::Jet>)jets_h->refAt(i);
199  specific.theCaloJetRef = myjet;
200  specific.mZSPCor = factorZSP;
201  specific.mResponseOfChargedWithEff = (float)mJPTalgo->getResponseOfChargedWithEff();
202  specific.mResponseOfChargedWithoutEff = (float)mJPTalgo->getResponseOfChargedWithoutEff();
203  specific.mSumPtOfChargedWithEff = (float)mJPTalgo->getSumPtWithEff();
204  specific.mSumPtOfChargedWithoutEff = (float)mJPTalgo->getSumPtWithoutEff();
205  specific.mSumEnergyOfChargedWithEff = (float)mJPTalgo->getSumEnergyWithEff();
206  specific.mSumEnergyOfChargedWithoutEff = (float)mJPTalgo->getSumEnergyWithoutEff();
207  specific.mChargedHadronEnergy = (float)mJPTalgo->getSumEnergyWithoutEff();
208  // Fill Charged Jet shape parameters
209  double deR2Tr = 0.;
210  double deEta2Tr = 0.;
211  double dePhi2Tr = 0.;
212  double Zch = 0.;
213  double Pout2 = 0.;
214  double Pout = 0.;
215  double denominator_tracks = 0.;
216  int ntracks = 0;
217 
219  it++) {
220  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
221  double deEta = (*it)->eta() - p4.eta();
222  double dePhi = deltaPhi((*it)->phi(), p4.phi());
223  if ((**it).ptError() / (**it).pt() < 0.1) {
224  deR2Tr = deR2Tr + deR * deR * (*it)->pt();
225  deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
226  dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
227  denominator_tracks = denominator_tracks + (*it)->pt();
228  Zch = Zch + (*it)->pt();
229 
230  Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch * p4.P()) * (Zch * p4.P());
231  ntracks++;
232  }
233  }
234  for (reco::TrackRefVector::const_iterator it = muons.inVertexInCalo_.begin(); it != muons.inVertexInCalo_.end();
235  it++) {
236  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
237  double deEta = (*it)->eta() - p4.eta();
238  double dePhi = deltaPhi((*it)->phi(), p4.phi());
239  if ((**it).ptError() / (**it).pt() < 0.1) {
240  deR2Tr = deR2Tr + deR * deR * (*it)->pt();
241  deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
242  dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
243  denominator_tracks = denominator_tracks + (*it)->pt();
244  Zch = Zch + (*it)->pt();
245 
246  Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch * p4.P()) * (Zch * p4.P());
247  ntracks++;
248  }
249  }
250  for (reco::TrackRefVector::const_iterator it = elecs.inVertexInCalo_.begin(); it != elecs.inVertexInCalo_.end();
251  it++) {
252  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
253  double deEta = (*it)->eta() - p4.eta();
254  double dePhi = deltaPhi((*it)->phi(), p4.phi());
255  if ((**it).ptError() / (**it).pt() < 0.1) {
256  deR2Tr = deR2Tr + deR * deR * (*it)->pt();
257  deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
258  dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
259  denominator_tracks = denominator_tracks + (*it)->pt();
260  Zch = Zch + (*it)->pt();
261 
262  Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch * p4.P()) * (Zch * p4.P());
263  ntracks++;
264  }
265  }
267  it != pions.inVertexOutOfCalo_.end();
268  it++) {
269  Zch = Zch + (*it)->pt();
270  }
271  for (reco::TrackRefVector::const_iterator it = muons.inVertexOutOfCalo_.begin();
272  it != muons.inVertexOutOfCalo_.end();
273  it++) {
274  Zch = Zch + (*it)->pt();
275  }
276  for (reco::TrackRefVector::const_iterator it = elecs.inVertexOutOfCalo_.begin();
277  it != elecs.inVertexOutOfCalo_.end();
278  it++) {
279  Zch = Zch + (*it)->pt();
280  }
281 
282  if (mJPTalgo->getSumPtForBeta() > 0.)
283  Zch = Zch / mJPTalgo->getSumPtForBeta();
284 
285  // std::cout<<" Zch "<< Zch<<" "<<mJPTalgo->getSumPtForBeta()<<std::endl;
286 
287  if (ntracks > 0) {
288  Pout = sqrt(fabs(Pout2)) / ntracks;
289  }
290 
291  if (denominator_tracks != 0) {
292  deR2Tr = deR2Tr / denominator_tracks;
293  deEta2Tr = deEta2Tr / denominator_tracks;
294  dePhi2Tr = dePhi2Tr / denominator_tracks;
295  }
296 
297  specific.R2momtr = deR2Tr;
298  specific.Eta2momtr = deEta2Tr;
299  specific.Phi2momtr = dePhi2Tr;
300  specific.Pout = Pout;
301  specific.Zch = Zch;
302 
303  // Create JPT jet
304 
305  reco::Particle::Point vertex_ = reco::Jet::Point(0, 0, 0);
306 
307  // If we add primary vertex
310  if (pvCollection.isValid() && !pvCollection->empty())
311  vertex_ = pvCollection->begin()->position();
312 
313  reco::JPTJet fJet(p4, vertex_, specific, corrected.getJetConstituents());
314  // fJet.printJet();
315 
316  // Temporarily collection before correction for background
317 
318  tmpColl.push_back(fJet);
319  }
320 
321  //=======================================================================================================>
322  // Correction for background
323 
324  reco::TrackRefVector trBgOutOfCalo;
325  reco::TrackRefVector trBgOutOfVertex = calculateBGtracksJet(tmpColl, fTracks, extrapolations_h, trBgOutOfCalo);
326 
327  //===> Area without Jets
328  std::map<reco::JPTJetCollection::iterator, double> AreaNonJet;
329 
330  for (reco::JPTJetCollection::iterator ij1 = tmpColl.begin(); ij1 != tmpColl.end(); ij1++) {
331  int nj1 = 1;
332  for (reco::JPTJetCollection::iterator ij2 = tmpColl.begin(); ij2 != tmpColl.end(); ij2++) {
333  if (ij2 == ij1)
334  continue;
335  if (fabs((*ij1).eta() - (*ij2).eta()) > 0.5)
336  continue;
337  nj1++;
338  }
339 
340  AreaNonJet[ij1] = 4 * M_PI * mConeSize - nj1 * 4 * mConeSize * mConeSize;
341 
342  // std::cout<<"+++AreaNonJet[ij1]="<<AreaNonJet[ij1]<<" nj1="<<nj1<<std::endl;
343  }
344 
345  //===>
346 
347  // std::cout<<" The size of BG tracks: trBgOutOfVertex= "<<trBgOutOfVertex.size()
348  // <<" trBgOutOfCalo= "<<trBgOutOfCalo.size()<<std::endl;
349  //
350  // std::cout<<" The size of JPT jet collection "<<tmpColl.size()<<std::endl;
351 
352  for (reco::JPTJetCollection::iterator ij = tmpColl.begin(); ij != tmpColl.end(); ij++) {
353  // Correct JPTjet for background tracks
354 
355  const reco::TrackRefVector pioninin = (*ij).getPionsInVertexInCalo();
356  const reco::TrackRefVector pioninout = (*ij).getPionsInVertexOutCalo();
357 
358  double ja = (AreaNonJet.find(ij))->second;
359 
360  // std::cout<<"+++ ja="<<ja<<" pioninout="<<pioninout.size()<<std::endl;
361 
362  double factorPU = mJPTalgo->correctAA(*ij, trBgOutOfVertex, mConeSize, pioninin, pioninout, ja, trBgOutOfCalo);
363 
364  (*ij).scaleEnergy(factorPU);
365 
366  // std::cout<<" FactorPU "<<factorPU<<std::endl;
367 
368  // Output module
369  pOut->push_back(*ij);
370 
371  // std::cout<<" New JPT energy "<<(*ij).et()<<" "<<(*ij).pt()<<" "<<(*ij).eta()<<" "<<(*ij).phi()<<std::endl;
372  }
373 
374  iEvent.put(std::move(pOut));
375 }

References edm::RefVector< C, T, F >::begin(), SiPixelRawToDigiRegional_cfi::deltaPhi, PbPb_ZMuSkimMuonDPG_cff::deltaR, singleTopDQM_cfi::elecs, edm::RefVector< C, T, F >::end(), reco::LeafCandidate::energy(), dqmMemoryStats::float, reco::Jet::getJetConstituents(), mps_fire::i, iEvent, jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, M_PI, eostools::move(), PDWG_BPHSkim_cff::muons, convertSQLiteXML::ok, jpt::MatchedTracks::outOfVertexInCalo_, p4, anotherprimaryvertexanalyzer_cfi::pvCollection, reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::LeafCandidate::pz(), reco::Jet::scaleEnergy(), edm::second(), timingPdfMaker::specific, and mathSSE::sqrt().

Member Data Documentation

◆ alias

std::string JetPlusTrackProducerAA::alias
private

Definition at line 75 of file JetPlusTrackProducerAA.h.

◆ input_extrapolations_token_

edm::EDGetTokenT<std::vector<reco::TrackExtrapolation> > JetPlusTrackProducerAA::input_extrapolations_token_
private

Definition at line 89 of file JetPlusTrackProducerAA.h.

◆ input_jets_token_

edm::EDGetTokenT<edm::View<reco::CaloJet> > JetPlusTrackProducerAA::input_jets_token_
private

Definition at line 86 of file JetPlusTrackProducerAA.h.

◆ input_tracks_token_

edm::EDGetTokenT<reco::TrackCollection> JetPlusTrackProducerAA::input_tracks_token_
private

Definition at line 88 of file JetPlusTrackProducerAA.h.

◆ input_vertex_token_

edm::EDGetTokenT<reco::VertexCollection> JetPlusTrackProducerAA::input_vertex_token_
private

Definition at line 87 of file JetPlusTrackProducerAA.h.

◆ mConeSize

double JetPlusTrackProducerAA::mConeSize
private

Definition at line 79 of file JetPlusTrackProducerAA.h.

◆ mExtrapolations

edm::InputTag JetPlusTrackProducerAA::mExtrapolations
private

Definition at line 83 of file JetPlusTrackProducerAA.h.

◆ mJPTalgo

JetPlusTrackCorrector* JetPlusTrackProducerAA::mJPTalgo
private

Definition at line 71 of file JetPlusTrackProducerAA.h.

◆ mTracks

edm::InputTag JetPlusTrackProducerAA::mTracks
private

Definition at line 78 of file JetPlusTrackProducerAA.h.

◆ mZSPalgo

ZSPJPTJetCorrector* JetPlusTrackProducerAA::mZSPalgo
private

Definition at line 72 of file JetPlusTrackProducerAA.h.

◆ src

edm::InputTag JetPlusTrackProducerAA::src
private

Definition at line 73 of file JetPlusTrackProducerAA.h.

◆ srcPVs_

edm::InputTag JetPlusTrackProducerAA::srcPVs_
private

Definition at line 74 of file JetPlusTrackProducerAA.h.

◆ trackQuality_

reco::TrackBase::TrackQuality JetPlusTrackProducerAA::trackQuality_
private

Definition at line 80 of file JetPlusTrackProducerAA.h.

◆ useZSP

bool JetPlusTrackProducerAA::useZSP
private

Definition at line 77 of file JetPlusTrackProducerAA.h.

◆ vectorial_

bool JetPlusTrackProducerAA::vectorial_
private

Definition at line 76 of file JetPlusTrackProducerAA.h.

JetPlusTrackProducerAA::srcPVs_
edm::InputTag srcPVs_
Definition: JetPlusTrackProducerAA.h:74
reco::JPTJet
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:28
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
JetPlusTrackProducerAA::input_extrapolations_token_
edm::EDGetTokenT< std::vector< reco::TrackExtrapolation > > input_extrapolations_token_
Definition: JetPlusTrackProducerAA.h:89
JetPlusTrackProducerAA::src
edm::InputTag src
Definition: JetPlusTrackProducerAA.h:73
reco::Jet::scaleEnergy
virtual void scaleEnergy(double fScale)
scale energy of the jet
mps_fire.i
i
Definition: mps_fire.py:355
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
reco::LeafCandidate::Point
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
JetPlusTrackCorrector::correctAA
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.
Definition: JetPlusTrackCorrector.cc:1249
JetPlusTrackProducerAA::input_vertex_token_
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
Definition: JetPlusTrackProducerAA.h:87
jpt::MatchedTracks::inVertexOutOfCalo_
reco::TrackRefVector inVertexOutOfCalo_
Definition: JetPlusTrackCorrector.h:148
edm
HLT enums.
Definition: AlignableModifier.h:19
JetPlusTrackProducerAA::vectorial_
bool vectorial_
Definition: JetPlusTrackProducerAA.h:76
edm::RefVector::begin
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
JetPlusTrackProducerAA::mConeSize
double mConeSize
Definition: JetPlusTrackProducerAA.h:79
JetPlusTrackProducerAA::alias
std::string alias
Definition: JetPlusTrackProducerAA.h:75
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
reco::btau::trackEta
Definition: TaggingVariable.h:42
edm::RefVector< TrackCollection >
jpt::MatchedTracks::inVertexInCalo_
reco::TrackRefVector inVertexInCalo_
Definition: JetPlusTrackCorrector.h:146
reco::JPTJetCollection
std::vector< JPTJet > JPTJetCollection
collection of CaloJet objects
Definition: JPTJetCollection.h:13
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
edm::Handle
Definition: AssociativeIterator.h:50
ZSPJPTJetCorrector
Definition: ZSPJPTJetCorrector.h:21
edm::Ref< TrackCollection >
jpt::MatchedTracks
Particles matched to tracks that are in/in, in/out, out/in at Vertex and CaloFace.
Definition: JetPlusTrackCorrector.h:141
JetPlusTrackProducerAA::input_jets_token_
edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
Definition: JetPlusTrackProducerAA.h:86
JetPlusTrackProducerAA::input_tracks_token_
edm::EDGetTokenT< reco::TrackCollection > input_tracks_token_
Definition: JetPlusTrackProducerAA.h:88
edm::RefVector::end
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
JetPlusTrackCorrector::correction
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)
Definition: JetPlusTrackCorrector.cc:105
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
reco::LeafCandidate::py
double py() const final
y coordinate of momentum vector
Definition: LeafCandidate.h:142
timingPdfMaker.specific
specific
Definition: timingPdfMaker.py:78
JetPlusTrackProducerAA::useZSP
bool useZSP
Definition: JetPlusTrackProducerAA.h:77
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::Track
Definition: Track.h:27
JetPlusTrackProducerAA::mExtrapolations
edm::InputTag mExtrapolations
Definition: JetPlusTrackProducerAA.h:83
reco::Jet::getJetConstituents
virtual Constituents getJetConstituents() const
list of constituents
singleTopDQM_cfi.elecs
elecs
Definition: singleTopDQM_cfi.py:41
anotherprimaryvertexanalyzer_cfi.pvCollection
pvCollection
Definition: anotherprimaryvertexanalyzer_cfi.py:4
ZSPJPTJetCorrector::correction
virtual double correction(const reco::Jet &, const edm::Event &, const edm::EventSetup &) const
apply correction using Event information
Definition: ZSPJPTJetCorrector.cc:42
JetPlusTrackProducerAA::trackQuality_
reco::TrackBase::TrackQuality trackQuality_
Definition: JetPlusTrackProducerAA.h:80
OrderedSet.t
t
Definition: OrderedSet.py:90
reco::JPTJet::Specific
Definition: JPTJet.h:30
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
JetPlusTrackCorrector::getSumEnergyWithoutEff
double getSumEnergyWithoutEff()
Definition: JetPlusTrackCorrector.h:236
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::btau::jetPhi
Definition: TaggingVariable.h:36
reco::btau::jetEta
Definition: TaggingVariable.h:34
JetPlusTrackCorrector
Jet energy correction algorithm using tracks.
Definition: JetPlusTrackCorrector.h:168
reco::btau::trackPhi
Definition: TaggingVariable.h:43
JetPlusTrackCorrector::getResponseOfChargedWithEff
double getResponseOfChargedWithEff()
Get responses/sumPT/SumEnergy with and without Efficiency correction.
Definition: JetPlusTrackCorrector.h:231
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
JetPlusTrackCorrector::getSumPtWithoutEff
double getSumPtWithoutEff()
Definition: JetPlusTrackCorrector.h:234
JetPlusTrackProducerAA::mJPTalgo
JetPlusTrackCorrector * mJPTalgo
Definition: JetPlusTrackProducerAA.h:71
edm::RefVector::push_back
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
JetPlusTrackCorrector::getSumEnergyWithEff
double getSumEnergyWithEff()
Definition: JetPlusTrackCorrector.h:235
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
JetPlusTrackCorrector::getSumPtForBeta
double getSumPtForBeta()
Definition: JetPlusTrackCorrector.h:237
jpt::MatchedTracks::outOfVertexInCalo_
reco::TrackRefVector outOfVertexInCalo_
Definition: JetPlusTrackCorrector.h:147
eostools.move
def move(src, dest)
Definition: eostools.py:511
JetPlusTrackProducerAA::mTracks
edm::InputTag mTracks
Definition: JetPlusTrackProducerAA.h:78
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
metsig::jet
Definition: SignAlgoResolutions.h:47
JetPlusTrackCorrector::getResponseOfChargedWithoutEff
double getResponseOfChargedWithoutEff()
Definition: JetPlusTrackCorrector.h:232
edm::RefVectorIterator
Definition: EDProductfwd.h:33
edm::RefToBase< reco::Jet >
JetPlusTrackCorrector::getSumPtWithEff
double getSumPtWithEff()
Definition: JetPlusTrackCorrector.h:233
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
JetPlusTrackProducerAA::mZSPalgo
ZSPJPTJetCorrector * mZSPalgo
Definition: JetPlusTrackProducerAA.h:72
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition: Particle.h:25
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
JetPlusTrackProducerAA::calculateBGtracksJet
reco::TrackRefVector calculateBGtracksJet(reco::JPTJetCollection &, std::vector< reco::TrackRef > &, edm::Handle< std::vector< reco::TrackExtrapolation > > &, reco::TrackRefVector &)
Definition: JetPlusTrackProducerAA.cc:380
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
reco::LeafCandidate::px
double px() const final
x coordinate of momentum vector
Definition: LeafCandidate.h:140
reco::LeafCandidate::pz
double pz() const final
z coordinate of momentum vector
Definition: LeafCandidate.h:144
edm::InputTag
Definition: InputTag.h:15