CMS 3D CMS Logo

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

#include <JetPlusTrackProducer.cc>

Inheritance diagram for JetPlusTrackProducer:
edm::stream::EDProducer<>

Public Member Functions

 JetPlusTrackProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~JetPlusTrackProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

std::string alias
 
edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
 
edm::EDGetTokenT< reco::VertexCollectioninput_vertex_token_
 
JetPlusTrackCorrectormJPTalgo
 
ZSPJPTJetCorrectormZSPalgo
 
double ptCUT
 
edm::InputTag src
 
edm::InputTag srcPVs_
 
bool useZSP
 
bool vectorial_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 41 of file JetPlusTrackProducer.h.

Constructor & Destructor Documentation

◆ JetPlusTrackProducer()

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

Definition at line 57 of file JetPlusTrackProducer.cc.

57  {
58  //register your products
59  src = iConfig.getParameter<edm::InputTag>("src");
60  alias = iConfig.getUntrackedParameter<string>("alias");
61  srcPVs_ = iConfig.getParameter<edm::InputTag>("srcPVs");
62  vectorial_ = iConfig.getParameter<bool>("VectorialCorrection");
63  useZSP = iConfig.getParameter<bool>("UseZSP");
64  ptCUT = iConfig.getParameter<double>("ptCUT");
65  mJPTalgo = new JetPlusTrackCorrector(iConfig, consumesCollector());
66  if (useZSP)
67  mZSPalgo = new ZSPJPTJetCorrector(iConfig);
68 
69  produces<reco::JPTJetCollection>().setBranchAlias(alias);
70 
71  input_jets_token_ = consumes<edm::View<reco::CaloJet> >(src);
72  input_vertex_token_ = consumes<reco::VertexCollection>(srcPVs_);
73 }

References SiStripOfflineCRack_cfg::alias, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), RecoJPTJets_cff::ptCUT, and TrackRefitter_38T_cff::src.

◆ ~JetPlusTrackProducer()

JetPlusTrackProducer::~JetPlusTrackProducer ( )
override

Definition at line 75 of file JetPlusTrackProducer.cc.

75  {
76  // do anything here that needs to be done at desctruction time
77  // (e.g. close files, deallocate resources etc.)
78 }

Member Function Documentation

◆ produce()

void JetPlusTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 85 of file JetPlusTrackProducer.cc.

85  {
86  using namespace edm;
87 
88  // std::cout<<" RecoJets::JetPlusTrackProducer::produce "<<std::endl;
89 
90  // get stuff from Event
92  iEvent.getByToken(input_jets_token_, jets_h);
93 
94  // auto pOut = std::make_unique<reco::CaloJetCollection>();
95  auto pOut = std::make_unique<reco::JPTJetCollection>();
96 
97  for (unsigned i = 0; i < jets_h->size(); ++i) {
98  const reco::CaloJet* oldjet = &(*(jets_h->refAt(i)));
99 
100  reco::CaloJet corrected = *oldjet;
101 
102  // ZSP corrections
103 
104  double factorZSP = 1.;
105  if (useZSP)
106  factorZSP = mZSPalgo->correction(corrected, iEvent, iSetup);
107 
108  corrected.scaleEnergy(factorZSP);
109 
110  // JPT corrections
111 
112  double scaleJPT = 1.;
113 
115 
116  jpt::MatchedTracks pions;
119  bool ok = false;
120 
121  if (!vectorial_) {
122  scaleJPT = mJPTalgo->correction(corrected, *oldjet, iEvent, iSetup, pions, muons, elecs, ok);
123  p4 = math::XYZTLorentzVector(corrected.px() * scaleJPT,
124  corrected.py() * scaleJPT,
125  corrected.pz() * scaleJPT,
126  corrected.energy() * scaleJPT);
127  } else {
128  scaleJPT = mJPTalgo->correction(corrected, *oldjet, iEvent, iSetup, p4, pions, muons, elecs, ok);
129  }
130 
132 
133  if (ok) {
134  specific.pionsInVertexInCalo = pions.inVertexInCalo_;
135  specific.pionsInVertexOutCalo = pions.inVertexOutOfCalo_;
136  specific.pionsOutVertexInCalo = pions.outOfVertexInCalo_;
137  specific.muonsInVertexInCalo = muons.inVertexInCalo_;
138  specific.muonsInVertexOutCalo = muons.inVertexOutOfCalo_;
139  specific.muonsOutVertexInCalo = muons.outOfVertexInCalo_;
140  specific.elecsInVertexInCalo = elecs.inVertexInCalo_;
141  specific.elecsInVertexOutCalo = elecs.inVertexOutOfCalo_;
142  specific.elecsOutVertexInCalo = elecs.outOfVertexInCalo_;
143  }
144 
145  // Fill JPT Specific
146  edm::RefToBase<reco::Jet> myjet = (edm::RefToBase<reco::Jet>)jets_h->refAt(i);
147  specific.theCaloJetRef = myjet;
148  specific.mZSPCor = factorZSP;
149  specific.mResponseOfChargedWithEff = (float)mJPTalgo->getResponseOfChargedWithEff();
150  specific.mResponseOfChargedWithoutEff = (float)mJPTalgo->getResponseOfChargedWithoutEff();
151  specific.mSumPtOfChargedWithEff = (float)mJPTalgo->getSumPtWithEff();
152  specific.mSumPtOfChargedWithoutEff = (float)mJPTalgo->getSumPtWithoutEff();
153  specific.mSumEnergyOfChargedWithEff = (float)mJPTalgo->getSumEnergyWithEff();
154  specific.mSumEnergyOfChargedWithoutEff = (float)mJPTalgo->getSumEnergyWithoutEff();
155  specific.mChargedHadronEnergy = (float)mJPTalgo->getSumEnergyWithoutEff();
156 
157  // Fill Charged Jet shape parameters
158  double deR2Tr = 0.;
159  double deEta2Tr = 0.;
160  double dePhi2Tr = 0.;
161  double Zch = 0.;
162  double Pout2 = 0.;
163  double Pout = 0.;
164  double denominator_tracks = 0.;
165  int ntracks = 0;
166 
168  it++) {
169  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
170  double deEta = (*it)->eta() - p4.eta();
171  double dePhi = deltaPhi((*it)->phi(), p4.phi());
172  if ((**it).ptError() / (**it).pt() < 0.1) {
173  deR2Tr = deR2Tr + deR * deR * (*it)->pt();
174  deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
175  dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
176  denominator_tracks = denominator_tracks + (*it)->pt();
177  Zch = Zch + (*it)->pt();
178 
179  Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch * p4.P()) * (Zch * p4.P());
180  ntracks++;
181  }
182  }
183 
184  for (reco::TrackRefVector::const_iterator it = muons.inVertexInCalo_.begin(); it != muons.inVertexInCalo_.end();
185  it++) {
186  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
187  double deEta = (*it)->eta() - p4.eta();
188  double dePhi = deltaPhi((*it)->phi(), p4.phi());
189  if ((**it).ptError() / (**it).pt() < 0.1) {
190  deR2Tr = deR2Tr + deR * deR * (*it)->pt();
191  deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
192  dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
193  denominator_tracks = denominator_tracks + (*it)->pt();
194  Zch = Zch + (*it)->pt();
195 
196  Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch * p4.P()) * (Zch * p4.P());
197  ntracks++;
198  }
199  }
200  for (reco::TrackRefVector::const_iterator it = elecs.inVertexInCalo_.begin(); it != elecs.inVertexInCalo_.end();
201  it++) {
202  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
203  double deEta = (*it)->eta() - p4.eta();
204  double dePhi = deltaPhi((*it)->phi(), p4.phi());
205  if ((**it).ptError() / (**it).pt() < 0.1) {
206  deR2Tr = deR2Tr + deR * deR * (*it)->pt();
207  deEta2Tr = deEta2Tr + deEta * deEta * (*it)->pt();
208  dePhi2Tr = dePhi2Tr + dePhi * dePhi * (*it)->pt();
209  denominator_tracks = denominator_tracks + (*it)->pt();
210  Zch = Zch + (*it)->pt();
211 
212  Pout2 = Pout2 + (**it).p() * (**it).p() - (Zch * p4.P()) * (Zch * p4.P());
213  ntracks++;
214  }
215  }
217  it != pions.inVertexOutOfCalo_.end();
218  it++) {
219  Zch = Zch + (*it)->pt();
220  }
221  for (reco::TrackRefVector::const_iterator it = muons.inVertexOutOfCalo_.begin();
222  it != muons.inVertexOutOfCalo_.end();
223  it++) {
224  Zch = Zch + (*it)->pt();
225  }
226  for (reco::TrackRefVector::const_iterator it = elecs.inVertexOutOfCalo_.begin();
227  it != elecs.inVertexOutOfCalo_.end();
228  it++) {
229  Zch = Zch + (*it)->pt();
230  }
231 
232  if (mJPTalgo->getSumPtForBeta() > 0.)
233  Zch = Zch / mJPTalgo->getSumPtForBeta();
234 
235  // std::cout<<" Zch "<< Zch<<" "<<mJPTalgo->getSumPtForBeta()<<std::endl;
236 
237  if (ntracks > 0) {
238  Pout = sqrt(fabs(Pout2)) / ntracks;
239  }
240  if (denominator_tracks != 0) {
241  deR2Tr = deR2Tr / denominator_tracks;
242  deEta2Tr = deEta2Tr / denominator_tracks;
243  dePhi2Tr = dePhi2Tr / denominator_tracks;
244  }
245 
246  specific.R2momtr = deR2Tr;
247  specific.Eta2momtr = deEta2Tr;
248  specific.Phi2momtr = dePhi2Tr;
249  specific.Pout = Pout;
250  specific.Zch = Zch;
251 
252  // std::cout<<" Moments for charged component "<<deR2_Tr<<" "<<deEta2_Tr<<" "<<dePhi2_Tr<<std::endl;
253 
254  // Create JPT jet
255 
256  reco::Particle::Point vertex_ = reco::Jet::Point(0, 0, 0);
257 
258  // If we add primary vertex
261  if (pvCollection.isValid() && !pvCollection->empty())
262  vertex_ = pvCollection->begin()->position();
263 
264  reco::JPTJet fJet(p4, vertex_, specific, corrected.getJetConstituents());
265 
266  // fJet.printJet();
267 
268  // Output module
269  if (fJet.pt() > ptCUT)
270  pOut->push_back(fJet);
271  }
272 
273  iEvent.put(std::move(pOut));
274 }

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_, eostools::move(), PDWG_BPHSkim_cff::muons, convertSQLiteXML::ok, jpt::MatchedTracks::outOfVertexInCalo_, p4, RecoJPTJets_cff::ptCUT, anotherprimaryvertexanalyzer_cfi::pvCollection, reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::LeafCandidate::pz(), reco::Jet::scaleEnergy(), timingPdfMaker::specific, and mathSSE::sqrt().

Member Data Documentation

◆ alias

std::string JetPlusTrackProducer::alias
private

Definition at line 53 of file JetPlusTrackProducer.h.

◆ input_jets_token_

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

Definition at line 58 of file JetPlusTrackProducer.h.

◆ input_vertex_token_

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

Definition at line 59 of file JetPlusTrackProducer.h.

◆ mJPTalgo

JetPlusTrackCorrector* JetPlusTrackProducer::mJPTalgo
private

Definition at line 49 of file JetPlusTrackProducer.h.

◆ mZSPalgo

ZSPJPTJetCorrector* JetPlusTrackProducer::mZSPalgo
private

Definition at line 50 of file JetPlusTrackProducer.h.

◆ ptCUT

double JetPlusTrackProducer::ptCUT
private

Definition at line 56 of file JetPlusTrackProducer.h.

◆ src

edm::InputTag JetPlusTrackProducer::src
private

Definition at line 51 of file JetPlusTrackProducer.h.

◆ srcPVs_

edm::InputTag JetPlusTrackProducer::srcPVs_
private

Definition at line 52 of file JetPlusTrackProducer.h.

◆ useZSP

bool JetPlusTrackProducer::useZSP
private

Definition at line 55 of file JetPlusTrackProducer.h.

◆ vectorial_

bool JetPlusTrackProducer::vectorial_
private

Definition at line 54 of file JetPlusTrackProducer.h.

JetPlusTrackProducer::useZSP
bool useZSP
Definition: JetPlusTrackProducer.h:55
reco::JPTJet
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:28
JetPlusTrackProducer::ptCUT
double ptCUT
Definition: JetPlusTrackProducer.h:56
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
reco::Jet::scaleEnergy
virtual void scaleEnergy(double fScale)
scale energy of the jet
mps_fire.i
i
Definition: mps_fire.py:355
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
reco::LeafCandidate::Point
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
JetPlusTrackProducer::input_jets_token_
edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
Definition: JetPlusTrackProducer.h:58
jpt::MatchedTracks::inVertexOutOfCalo_
reco::TrackRefVector inVertexOutOfCalo_
Definition: JetPlusTrackCorrector.h:148
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::RefVector::begin
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
jpt::MatchedTracks::inVertexInCalo_
reco::TrackRefVector inVertexInCalo_
Definition: JetPlusTrackCorrector.h:146
JetPlusTrackProducer::src
edm::InputTag src
Definition: JetPlusTrackProducer.h:51
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
edm::Handle
Definition: AssociativeIterator.h:50
ZSPJPTJetCorrector
Definition: ZSPJPTJetCorrector.h:21
jpt::MatchedTracks
Particles matched to tracks that are in/in, in/out, out/in at Vertex and CaloFace.
Definition: JetPlusTrackCorrector.h:141
JetPlusTrackProducer::srcPVs_
edm::InputTag srcPVs_
Definition: JetPlusTrackProducer.h:52
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
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
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
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
JetPlusTrackProducer::input_vertex_token_
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
Definition: JetPlusTrackProducer.h:59
JetPlusTrackCorrector
Jet energy correction algorithm using tracks.
Definition: JetPlusTrackCorrector.h:168
JetPlusTrackCorrector::getResponseOfChargedWithEff
double getResponseOfChargedWithEff()
Get responses/sumPT/SumEnergy with and without Efficiency correction.
Definition: JetPlusTrackCorrector.h:231
JetPlusTrackProducer::mJPTalgo
JetPlusTrackCorrector * mJPTalgo
Definition: JetPlusTrackProducer.h:49
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
JetPlusTrackCorrector::getSumPtWithoutEff
double getSumPtWithoutEff()
Definition: JetPlusTrackCorrector.h:234
JetPlusTrackCorrector::getSumEnergyWithEff
double getSumEnergyWithEff()
Definition: JetPlusTrackCorrector.h:235
JetPlusTrackProducer::mZSPalgo
ZSPJPTJetCorrector * mZSPalgo
Definition: JetPlusTrackProducer.h:50
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
JetPlusTrackProducer::alias
std::string alias
Definition: JetPlusTrackProducer.h:53
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
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
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
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition: Particle.h:25
JetPlusTrackProducer::vectorial_
bool vectorial_
Definition: JetPlusTrackProducer.h:54
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