CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void beginJob ()
 
reco::TrackRefVector calculateBGtracksJet (reco::JPTJetCollection &, std::vector< reco::TrackRef > &, edm::Handle< std::vector< reco::TrackExtrapolation > > &, reco::TrackRefVector &)
 
virtual void endJob ()
 
 JetPlusTrackProducerAA (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~JetPlusTrackProducerAA ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string alias
 
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
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, 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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 53 of file JetPlusTrackProducerAA.h.

Constructor & Destructor Documentation

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

Definition at line 79 of file JetPlusTrackProducerAA.cc.

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

80 {
81  //register your products
82  src = iConfig.getParameter<edm::InputTag>("src");
83  alias = iConfig.getUntrackedParameter<string>("alias");
84  mTracks = iConfig.getParameter<edm::InputTag> ("tracks");
85  srcPVs_ = iConfig.getParameter<edm::InputTag>("srcPVs");
86  vectorial_ = iConfig.getParameter<bool>("VectorialCorrection");
87  useZSP = iConfig.getParameter<bool>("UseZSP");
88  std::string tq = iConfig.getParameter<std::string>("TrackQuality");
90  mConeSize = iConfig.getParameter<double> ("coneSize");
91 //=>
92  mExtrapolations = iConfig.getParameter<edm::InputTag> ("extrapolations");
93 //=>
94  mJPTalgo = new JetPlusTrackCorrector(iConfig);
95  if(useZSP) mZSPalgo = new ZSPJPTJetCorrector(iConfig);
96 
97  produces<reco::JPTJetCollection>().setBranchAlias(alias);
98 
99 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
reco::TrackBase::TrackQuality trackQuality_
ZSPJPTJetCorrector * mZSPalgo
JetPlusTrackCorrector * mJPTalgo
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:46
Jet energy correction algorithm using tracks.
JetPlusTrackProducerAA::~JetPlusTrackProducerAA ( )

Definition at line 102 of file JetPlusTrackProducerAA.cc.

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

Member Function Documentation

void JetPlusTrackProducerAA::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 477 of file JetPlusTrackProducerAA.cc.

478 {
479 }
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 386 of file JetPlusTrackProducerAA.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), reco::TrackBase::eta(), reco::LeafCandidate::eta(), spr::find(), j, metsig::jet, reco::btau::jetEta, reco::btau::jetPhi, M_PI, reco::TrackBase::phi(), reco::LeafCandidate::phi(), edm::RefVector< C, T, F >::push_back(), lumiQTWidget::t, reco::btau::trackEta, and reco::btau::trackPhi.

388  {
389 
390 
391  reco::TrackRefVector trBgOutOfVertex;
392 
393  for (unsigned t = 0; t < fTracks.size(); ++t) {
394 
395  int track_bg = 0;
396 
397  // if(!(*fTracks[t]).quality(trackQuality_))
398  // {
399  // cout<<"BG, BAD trackQuality, ptBgV="<<fTracks[t]->pt()<<" etaBgV = "<<fTracks[t]->eta()<<" phiBgV = "<<fTracks[t]->phi()<<endl;
400  // continue;
401  // }
402 
403  const reco::Track* track = &*(fTracks[t]);
404  double trackEta = track->eta();
405  double trackPhi = track->phi();
406 
407  // std::cout<<"++++++++++++++++> track="<<t<<" trackEta="<<trackEta<<" trackPhi="<<trackPhi
408  // <<" coneSize="<<mConeSize<<std::endl;
409 
410  //loop on jets
411  for (unsigned j = 0; j < fJets.size(); ++j) {
412 
413  const reco::Jet* jet = &(fJets[j]);
414  double jetEta = jet->eta();
415  double jetPhi = jet->phi();
416 
417  // std::cout<<"-jet="<<j<<" jetEt ="<<jet->pt()
418  // <<" jetE="<<jet->energy()<<" jetEta="<<jetEta<<" jetPhi="<<jetPhi<<std::endl;
419 
420  if(fabs(jetEta - trackEta) < mConeSize) {
421  double dphiTrackJet = fabs(trackPhi - jetPhi);
422  if(dphiTrackJet > M_PI) dphiTrackJet = 2*M_PI - dphiTrackJet;
423 
424  if(dphiTrackJet < mConeSize)
425  {
426  track_bg = 1;
427  // std::cout<<"===>>>> Track inside jet at vertex, track_bg="<< track_bg <<" track="<<t<<" jet="<<j
428  // <<" trackEta="<<trackEta<<" trackPhi="<<trackPhi
429  // <<" jetEta="<<jetEta<<" jetPhi="<<jetPhi<<std::endl;
430  }
431  }
432  } //jets
433 
434  if( track_bg == 0 )
435  {
436  trBgOutOfVertex.push_back (fTracks[t]);
437 
438 // std::cout<<"------Track outside jet at vertex, track_bg="<< track_bg<<" track="<<t
439 // <<" trackEta="<<trackEta<<" trackPhi="<<trackPhi <<std::endl;
440  }
441 
442  } //tracks
443 
444 //=====> Propagate BG tracks to calo
445  int nValid = 0;
446  for ( std::vector<reco::TrackExtrapolation>::const_iterator xtrpBegin = extrapolations_h->begin(),
447  xtrpEnd = extrapolations_h->end(), ixtrp = xtrpBegin;
448  ixtrp != xtrpEnd; ++ixtrp ) {
449 
450 // std::cout<<"JetPlusTrackProducerAA::calculateBGtracksJet: initial track pt= "<<ixtrp->track()->pt()
451 // <<" eta= "<<ixtrp->track()->eta()<<" phi="<<ixtrp->track()->phi()
452 // <<" Valid? "<<ixtrp->isValid().at(0)<<std::endl;
453 
454  //if( ixtrp->isValid().at(0) == 0 ) continue;
455  //in DF change in 4.2, all entries are valid.
456  nValid++;
457 
458  reco::TrackRefVector::iterator it = find(trBgOutOfVertex.begin(),trBgOutOfVertex.end(),(*ixtrp).track() );
459 
460  if ( it != trBgOutOfVertex.end() ){
461  trBgOutOfCalo.push_back (*it);
462 
463 // std::cout<<"+++trBgOutOfCalo, pt= "<<ixtrp->track()->pt()<<" eta= "<<ixtrp->track()->eta()<<" phi="<<ixtrp->track()->phi()
464 // <<" Valid? "<<ixtrp->isValid().at(0)<<std::endl;
465  }
466 
467  }
468 
469 // std::cout<<"calculateBGtracksJet, trBgOutOfCalo="<<trBgOutOfCalo.size()
470 // <<" trBgOutOfVertex="<<trBgOutOfVertex.size()<<" nValid="<<nValid<<endl;
471 //=====>
472 
473  return trBgOutOfVertex;
474 }
Base class for all types of Jets.
Definition: Jet.h:20
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:137
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:139
int j
Definition: DBlmapReader.cc:9
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
#define M_PI
Definition: BFit3D.cc:3
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
void JetPlusTrackProducerAA::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 483 of file JetPlusTrackProducerAA.cc.

483  {
484 }
void JetPlusTrackProducerAA::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 117 of file JetPlusTrackProducerAA.cc.

References edm::RefVector< C, T, F >::begin(), SiPixelRawToDigiRegional_cfi::deltaPhi, deltaR(), reco::JPTJet::Specific::elecsInVertexInCalo, reco::JPTJet::Specific::elecsInVertexOutCalo, reco::JPTJet::Specific::elecsOutVertexInCalo, edm::RefVector< C, T, F >::end(), reco::LeafCandidate::energy(), reco::JPTJet::Specific::Eta2momtr, edm::Event::getByLabel(), reco::Jet::getJetConstituents(), i, jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, edm::HandleBase::isValid(), M_PI, reco::JPTJet::Specific::mChargedHadronEnergy, reco::JPTJet::Specific::mResponseOfChargedWithEff, reco::JPTJet::Specific::mResponseOfChargedWithoutEff, reco::JPTJet::Specific::mSumEnergyOfChargedWithEff, reco::JPTJet::Specific::mSumEnergyOfChargedWithoutEff, reco::JPTJet::Specific::mSumPtOfChargedWithEff, reco::JPTJet::Specific::mSumPtOfChargedWithoutEff, patZpeak::muons, reco::JPTJet::Specific::muonsInVertexInCalo, reco::JPTJet::Specific::muonsInVertexOutCalo, reco::JPTJet::Specific::muonsOutVertexInCalo, reco::JPTJet::Specific::mZSPCor, convertSQLiteXML::ok, jpt::MatchedTracks::outOfVertexInCalo_, p4, reco::JPTJet::Specific::Phi2momtr, reco::JPTJet::Specific::pionsInVertexInCalo, reco::JPTJet::Specific::pionsInVertexOutCalo, reco::JPTJet::Specific::pionsOutVertexInCalo, reco::JPTJet::Specific::Pout, edm::Event::put(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::LeafCandidate::pz(), reco::JPTJet::Specific::R2momtr, reco::Jet::scaleEnergy(), edm::second(), timingPdfMaker::specific, mathSSE::sqrt(), alcazmumu_cfi::src, reco::JPTJet::Specific::theCaloJetRef, and reco::JPTJet::Specific::Zch.

118 {
119  using namespace edm;
120 
121 
122 // std::cout<<" RecoJets::JetPlusTrackProducerAA::produce "<<std::endl;
123 
124 // get stuff from Event
126  iEvent.getByLabel (src, jets_h);
127 
129  iEvent.getByLabel (mTracks, tracks_h);
130 
131  std::vector <reco::TrackRef> fTracks;
132  fTracks.reserve (tracks_h->size());
133  for (unsigned i = 0; i < tracks_h->size(); ++i) {
134  fTracks.push_back (reco::TrackRef (tracks_h, i));
135  }
136 
137 //=>
139  iEvent.getByLabel (mExtrapolations, extrapolations_h);
140 
141 // std::cout<<"JetPlusTrackProducerAA::produce, extrapolations_h="<<extrapolations_h->size()<<std::endl;
142 //=>
143 
144  std::auto_ptr<reco::JPTJetCollection> pOut(new reco::JPTJetCollection());
145 
146  reco::JPTJetCollection tmpColl;
147 
148  for (unsigned i = 0; i < jets_h->size(); ++i) {
149 
150  const reco::CaloJet* oldjet = &(*(jets_h->refAt(i)));
151 
152  reco::CaloJet corrected = *oldjet;
153 
154 // ZSP corrections
155 
156  double factorZSP = 1.;
157  if(useZSP) factorZSP = mZSPalgo->correction(corrected, iEvent, iSetup);
158 
159 // std::cout << " UseZSP = "<<useZSP<<std::endl;
160 
161 
162  corrected.scaleEnergy (factorZSP);
163 
164 // JPT corrections
165 
166  double scaleJPT = 1.;
167 
169 
170 // Construct JPTJet constituent
171  jpt::MatchedTracks pions;
173  jpt::MatchedTracks elecs;
174  bool ok=false;
175 
176  if ( !vectorial_ ) {
177 
178  scaleJPT = mJPTalgo->correction ( corrected, *oldjet, iEvent, iSetup, pions, muons, elecs, ok );
179  p4 = math::XYZTLorentzVector( corrected.px()*scaleJPT,
180  corrected.py()*scaleJPT,
181  corrected.pz()*scaleJPT,
182  corrected.energy()*scaleJPT );
183  } else {
184  scaleJPT = mJPTalgo->correction( corrected, *oldjet, iEvent, iSetup, p4, pions, muons, elecs, ok );
185  }
186 
187 
188 
190 
191  if(ok) {
192 // std::cout<<" Size of Pion in-in "<<pions.inVertexInCalo_.size()<<" in-out "<<pions.inVertexOutOfCalo_.size()
193 // <<" out-in "<<pions.outOfVertexInCalo_.size()<<" Oldjet "<<oldjet->et()<<" factorZSP "<<factorZSP
194 // <<" "<<corrected.et()<<" scaleJPT "<<scaleJPT<<" after JPT "<<p4.pt()<<std::endl;
195 
196 
197  specific.pionsInVertexInCalo = pions.inVertexInCalo_;
198  specific.pionsInVertexOutCalo = pions.inVertexOutOfCalo_;
199  specific.pionsOutVertexInCalo = pions.outOfVertexInCalo_;
200  specific.muonsInVertexInCalo = muons.inVertexInCalo_;
201  specific.muonsInVertexOutCalo = muons.inVertexOutOfCalo_;
202  specific.muonsOutVertexInCalo = muons.outOfVertexInCalo_;
203  specific.elecsInVertexInCalo = elecs.inVertexInCalo_;
204  specific.elecsInVertexOutCalo = elecs.inVertexOutOfCalo_;
205  specific.elecsOutVertexInCalo = elecs.outOfVertexInCalo_;
206  }
207 
208 // Fill JPT Specific
209  edm::RefToBase<reco::Jet> myjet = (edm::RefToBase<reco::Jet>)jets_h->refAt(i);
210  specific.theCaloJetRef = myjet;
211  specific.mZSPCor = factorZSP;
214  specific.mSumPtOfChargedWithEff = (float)mJPTalgo->getSumPtWithEff();
219 // Fill Charged Jet shape parameters
220  double deR2Tr = 0.;
221  double deEta2Tr = 0.;
222  double dePhi2Tr = 0.;
223  double Zch = 0.;
224  double Pout2 = 0.;
225  double Pout = 0.;
226  double denominator_tracks = 0.;
227  int ntracks = 0;
228 
229  for( reco::TrackRefVector::const_iterator it = pions.inVertexInCalo_.begin(); it != pions.inVertexInCalo_.end(); it++) {
230  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
231  double deEta = (*it)->eta() - p4.eta();
232  double dePhi = deltaPhi((*it)->phi(), p4.phi());
233  if((**it).ptError()/(**it).pt() < 0.1) {
234  deR2Tr = deR2Tr + deR*deR*(*it)->pt();
235  deEta2Tr = deEta2Tr + deEta*deEta*(*it)->pt();
236  dePhi2Tr = dePhi2Tr + dePhi*dePhi*(*it)->pt();
237  denominator_tracks = denominator_tracks + (*it)->pt();
238  Zch = Zch + (*it)->pt();
239 
240  Pout2 = Pout2 + (**it).p()*(**it).p() - (Zch*p4.P())*(Zch*p4.P());
241  ntracks++;
242  }
243  }
244  for( reco::TrackRefVector::const_iterator it = muons.inVertexInCalo_.begin(); it != muons.inVertexInCalo_.end(); it++) {
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();
254 
255  Pout2 = Pout2 + (**it).p()*(**it).p() - (Zch*p4.P())*(Zch*p4.P());
256  ntracks++;
257  }
258  }
259  for( reco::TrackRefVector::const_iterator it = elecs.inVertexInCalo_.begin(); it != elecs.inVertexInCalo_.end(); it++) {
260  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
261  double deEta = (*it)->eta() - p4.eta();
262  double dePhi = deltaPhi((*it)->phi(), p4.phi());
263  if((**it).ptError()/(**it).pt() < 0.1) {
264  deR2Tr = deR2Tr + deR*deR*(*it)->pt();
265  deEta2Tr = deEta2Tr + deEta*deEta*(*it)->pt();
266  dePhi2Tr = dePhi2Tr + dePhi*dePhi*(*it)->pt();
267  denominator_tracks = denominator_tracks + (*it)->pt();
268  Zch = Zch + (*it)->pt();
269 
270  Pout2 = Pout2 + (**it).p()*(**it).p() - (Zch*p4.P())*(Zch*p4.P());
271  ntracks++;
272  }
273  }
274  for( reco::TrackRefVector::const_iterator it = pions.inVertexOutOfCalo_.begin(); it != pions.inVertexOutOfCalo_.end(); it++) {
275  Zch = Zch + (*it)->pt();
276  }
277  for( reco::TrackRefVector::const_iterator it = muons.inVertexOutOfCalo_.begin(); it != muons.inVertexOutOfCalo_.end(); it++) {
278  Zch = Zch + (*it)->pt();
279  }
280  for( reco::TrackRefVector::const_iterator it = elecs.inVertexOutOfCalo_.begin(); it != elecs.inVertexOutOfCalo_.end(); it++) {
281  Zch = Zch + (*it)->pt();
282  }
283 
284  if(mJPTalgo->getSumPtForBeta()> 0.) Zch = Zch/mJPTalgo->getSumPtForBeta();
285 
286  // std::cout<<" Zch "<< Zch<<" "<<mJPTalgo->getSumPtForBeta()<<std::endl;
287 
288  if(ntracks > 0) {
289  Pout = sqrt(fabs(Pout2))/ntracks;
290  }
291 
292 
293  if (denominator_tracks!=0){
294  deR2Tr = deR2Tr/denominator_tracks;
295  deEta2Tr= deEta2Tr/denominator_tracks;
296  dePhi2Tr= dePhi2Tr/denominator_tracks;
297  }
298 
299  specific.R2momtr = deR2Tr;
300  specific.Eta2momtr = deEta2Tr;
301  specific.Phi2momtr = dePhi2Tr;
302  specific.Pout = Pout;
303  specific.Zch = Zch;
304 
305 // Create JPT jet
306 
308 
309 // If we add primary vertex
311  iEvent.getByLabel(srcPVs_,pvCollection);
312  if ( pvCollection.isValid() && pvCollection->size()>0 ) vertex_=pvCollection->begin()->position();
313 
314  reco::JPTJet fJet(p4, vertex_, specific, corrected.getJetConstituents());
315  // fJet.printJet();
316 
317 // Temporarily collection before correction for background
318 
319  tmpColl.push_back(fJet);
320 
321  }
322 
323 //=======================================================================================================>
324 // Correction for background
325 
326  reco::TrackRefVector trBgOutOfCalo;
327  reco::TrackRefVector trBgOutOfVertex = calculateBGtracksJet(tmpColl,fTracks,extrapolations_h,trBgOutOfCalo);
328 
329 //===> Area without Jets
330  std::map<reco::JPTJetCollection::iterator, double> AreaNonJet;
331 
332  for(reco::JPTJetCollection::iterator ij1=tmpColl.begin(); ij1!=tmpColl.end(); ij1++)
333  {
334  int nj1 = 1;
335  for(reco::JPTJetCollection::iterator ij2=tmpColl.begin(); ij2!=tmpColl.end(); ij2++)
336  {
337  if(ij2 == ij1) continue;
338  if(fabs((*ij1).eta() - (*ij2).eta()) > 0.5 ) continue;
339  nj1++;
340 
341  }
342 
343  AreaNonJet[ij1] = 4*M_PI*mConeSize - nj1*4*mConeSize*mConeSize;
344 
345 // std::cout<<"+++AreaNonJet[ij1]="<<AreaNonJet[ij1]<<" nj1="<<nj1<<std::endl;
346  }
347 
348 //===>
349 
350 // std::cout<<" The size of BG tracks: trBgOutOfVertex= "<<trBgOutOfVertex.size()
351 // <<" trBgOutOfCalo= "<<trBgOutOfCalo.size()<<std::endl;
352 //
353 // std::cout<<" The size of JPT jet collection "<<tmpColl.size()<<std::endl;
354 
355  for(reco::JPTJetCollection::iterator ij=tmpColl.begin(); ij!=tmpColl.end(); ij++)
356  {
357 // Correct JPTjet for background tracks
358 
359  const reco::TrackRefVector pioninin = (*ij).getPionsInVertexInCalo();
360  const reco::TrackRefVector pioninout = (*ij).getPionsInVertexOutCalo();
361 
362  double ja = (AreaNonJet.find(ij))->second;
363 
364 // std::cout<<"+++ ja="<<ja<<" pioninout="<<pioninout.size()<<std::endl;
365 
366  double factorPU = mJPTalgo->correctAA(*ij,trBgOutOfVertex,mConeSize,pioninin,pioninout,ja,trBgOutOfCalo);
367 
368  (*ij).scaleEnergy (factorPU);
369 
370 // std::cout<<" FactorPU "<<factorPU<<std::endl;
371 
372 // Output module
373  pOut->push_back(*ij);
374 
375 // std::cout<<" New JPT energy "<<(*ij).et()<<" "<<(*ij).pt()<<" "<<(*ij).eta()<<" "<<(*ij).phi()<<std::endl;
376 
377  }
378 
379  iEvent.put(pOut);
380 
381 }
reco::TrackRefVector muonsInVertexOutCalo
Definition: JPTJet.h:57
virtual double energy() const GCC11_FINAL
energy
int i
Definition: DBlmapReader.cc:9
float mSumEnergyOfChargedWithoutEff
Definition: JPTJet.h:71
dictionary specific
Jets made from CaloTowers.
Definition: CaloJet.h:29
reco::TrackRefVector muonsInVertexInCalo
Definition: JPTJet.h:56
reco::TrackRefVector calculateBGtracksJet(reco::JPTJetCollection &, std::vector< reco::TrackRef > &, edm::Handle< std::vector< reco::TrackExtrapolation > > &, reco::TrackRefVector &)
ZSPJPTJetCorrector * mZSPalgo
std::vector< JPTJet > JPTJetCollection
collection of CaloJet objects
float mChargedHadronEnergy
Definition: JPTJet.h:62
float mSumPtOfChargedWithEff
Definition: JPTJet.h:68
reco::TrackRefVector inVertexInCalo_
reco::TrackRefVector muonsOutVertexInCalo
Definition: JPTJet.h:58
virtual void scaleEnergy(double fScale)
scale energy of the jet
Definition: Jet.cc:444
reco::TrackRefVector inVertexOutOfCalo_
virtual double correction(const reco::Jet &, const edm::Event &, const edm::EventSetup &) const
apply correction using Event information
float mResponseOfChargedWithEff
Definition: JPTJet.h:66
reco::TrackRefVector elecsOutVertexInCalo
Definition: JPTJet.h:61
reco::TrackRefVector pionsInVertexOutCalo
Definition: JPTJet.h:54
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
T sqrt(T t)
Definition: SSEVec.h:48
double p4[4]
Definition: TauolaWrapper.h:92
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:29
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)
JetPlusTrackCorrector * mJPTalgo
double getResponseOfChargedWithEff()
Get responses/sumPT/SumEnergy with and without Efficiency correction.
reco::TrackRefVector pionsOutVertexInCalo
Definition: JPTJet.h:55
float mSumEnergyOfChargedWithEff
Definition: JPTJet.h:70
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
math::XYZPoint Point
point in the space
Definition: Particle.h:31
reco::TrackRefVector outOfVertexInCalo_
reco::TrackRefVector elecsInVertexInCalo
Definition: JPTJet.h:59
bool isValid() const
Definition: HandleBase.h:76
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.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
edm::RefToBase< reco::Jet > theCaloJetRef
Definition: JPTJet.h:52
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
float mResponseOfChargedWithoutEff
Definition: JPTJet.h:67
reco::TrackRefVector pionsInVertexInCalo
Definition: JPTJet.h:53
#define M_PI
Definition: BFit3D.cc:3
float mSumPtOfChargedWithoutEff
Definition: JPTJet.h:69
reco::TrackRefVector elecsInVertexOutCalo
Definition: JPTJet.h:60
Particles matched to tracks that are in/in, in/out, out/in at Vertex and CaloFace.
tuple muons
Definition: patZpeak.py:38
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:30
virtual Constituents getJetConstituents() const
list of constituents
Definition: Jet.cc:350

Member Data Documentation

std::string JetPlusTrackProducerAA::alias
private

Definition at line 73 of file JetPlusTrackProducerAA.h.

double JetPlusTrackProducerAA::mConeSize
private

Definition at line 77 of file JetPlusTrackProducerAA.h.

edm::InputTag JetPlusTrackProducerAA::mExtrapolations
private

Definition at line 81 of file JetPlusTrackProducerAA.h.

JetPlusTrackCorrector* JetPlusTrackProducerAA::mJPTalgo
private

Definition at line 69 of file JetPlusTrackProducerAA.h.

edm::InputTag JetPlusTrackProducerAA::mTracks
private

Definition at line 76 of file JetPlusTrackProducerAA.h.

ZSPJPTJetCorrector* JetPlusTrackProducerAA::mZSPalgo
private

Definition at line 70 of file JetPlusTrackProducerAA.h.

edm::InputTag JetPlusTrackProducerAA::src
private

Definition at line 71 of file JetPlusTrackProducerAA.h.

edm::InputTag JetPlusTrackProducerAA::srcPVs_
private

Definition at line 72 of file JetPlusTrackProducerAA.h.

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

Definition at line 78 of file JetPlusTrackProducerAA.h.

bool JetPlusTrackProducerAA::useZSP
private

Definition at line 75 of file JetPlusTrackProducerAA.h.

bool JetPlusTrackProducerAA::vectorial_
private

Definition at line 74 of file JetPlusTrackProducerAA.h.