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
JetPlusTrackProducer Class Reference

#include <JetPlusTrackProducer.cc>

Inheritance diagram for JetPlusTrackProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetPlusTrackProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~JetPlusTrackProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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
 
edm::EDGetTokenT< edm::View
< reco::CaloJet > > 
input_jets_token_
 
edm::EDGetTokenT
< reco::VertexCollection
input_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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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 43 of file JetPlusTrackProducer.h.

Constructor & Destructor Documentation

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

Definition at line 59 of file JetPlusTrackProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and alcazmumu_cfi::src.

60 {
61  //register your products
62  src = iConfig.getParameter<edm::InputTag>("src");
63  alias = iConfig.getUntrackedParameter<string>("alias");
64  srcPVs_ = iConfig.getParameter<edm::InputTag>("srcPVs");
65  vectorial_ = iConfig.getParameter<bool>("VectorialCorrection");
66  useZSP = iConfig.getParameter<bool>("UseZSP");
67  ptCUT = iConfig.getParameter<double>("ptCUT");
69  if(useZSP) mZSPalgo = new ZSPJPTJetCorrector(iConfig);
70 
71  produces<reco::JPTJetCollection>().setBranchAlias(alias);
72 
73  input_jets_token_ = consumes<edm::View<reco::CaloJet> >(src);
74  input_vertex_token_ = consumes<reco::VertexCollection>(srcPVs_);
75 
76 
77 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
ZSPJPTJetCorrector * mZSPalgo
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Jet energy correction algorithm using tracks.
JetPlusTrackCorrector * mJPTalgo
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
JetPlusTrackProducer::~JetPlusTrackProducer ( )

Definition at line 80 of file JetPlusTrackProducer.cc.

81 {
82 
83  // do anything here that needs to be done at desctruction time
84  // (e.g. close files, deallocate resources etc.)
85 
86 }

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 95 of file JetPlusTrackProducer.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::getByToken(), reco::Jet::getJetConstituents(), i, jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, edm::HandleBase::isValid(), 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(), timingPdfMaker::specific, mathSSE::sqrt(), reco::JPTJet::Specific::theCaloJetRef, and reco::JPTJet::Specific::Zch.

96 {
97  using namespace edm;
98 
99 
100 // std::cout<<" RecoJets::JetPlusTrackProducer::produce "<<std::endl;
101 
102 
103 // get stuff from Event
105  iEvent.getByToken (input_jets_token_, jets_h);
106 
107 // std::auto_ptr<reco::CaloJetCollection> pOut(new reco::CaloJetCollection());
108  std::auto_ptr<reco::JPTJetCollection> pOut(new reco::JPTJetCollection());
109 
110  for (unsigned i = 0; i < jets_h->size(); ++i) {
111 
112  const reco::CaloJet* oldjet = &(*(jets_h->refAt(i)));
113 
114  reco::CaloJet corrected = *oldjet;
115 
116 // ZSP corrections
117 
118  double factorZSP = 1.;
119  if(useZSP) factorZSP = mZSPalgo->correction(corrected, iEvent, iSetup);
120 
121  corrected.scaleEnergy (factorZSP);
122 
123 // JPT corrections
124 
125  double scaleJPT = 1.;
126 
128 
129  jpt::MatchedTracks pions;
131  jpt::MatchedTracks elecs;
132  bool ok=false;
133 
134  if ( !vectorial_ ) {
135 
136  scaleJPT = mJPTalgo->correction ( corrected, *oldjet, iEvent, iSetup, pions, muons, elecs,ok );
137  p4 = math::XYZTLorentzVector( corrected.px()*scaleJPT,
138  corrected.py()*scaleJPT,
139  corrected.pz()*scaleJPT,
140  corrected.energy()*scaleJPT );
141  } else {
142  scaleJPT = mJPTalgo->correction( corrected, *oldjet, iEvent, iSetup, p4, pions, muons, elecs,ok );
143  }
144 
145 
147 
148  if(ok) {
149  specific.pionsInVertexInCalo = pions.inVertexInCalo_;
150  specific.pionsInVertexOutCalo = pions.inVertexOutOfCalo_;
151  specific.pionsOutVertexInCalo = pions.outOfVertexInCalo_;
152  specific.muonsInVertexInCalo = muons.inVertexInCalo_;
153  specific.muonsInVertexOutCalo = muons.inVertexOutOfCalo_;
154  specific.muonsOutVertexInCalo = muons.outOfVertexInCalo_;
155  specific.elecsInVertexInCalo = elecs.inVertexInCalo_;
156  specific.elecsInVertexOutCalo = elecs.inVertexOutOfCalo_;
157  specific.elecsOutVertexInCalo = elecs.outOfVertexInCalo_;
158  }
159 
160 // Fill JPT Specific
161  edm::RefToBase<reco::Jet> myjet = (edm::RefToBase<reco::Jet>)jets_h->refAt(i);
162  specific.theCaloJetRef = myjet;
163  specific.mZSPCor = factorZSP;
166  specific.mSumPtOfChargedWithEff = (float)mJPTalgo->getSumPtWithEff();
171 
172 // Fill Charged Jet shape parameters
173  double deR2Tr = 0.;
174  double deEta2Tr = 0.;
175  double dePhi2Tr = 0.;
176  double Zch = 0.;
177  double Pout2 = 0.;
178  double Pout = 0.;
179  double denominator_tracks = 0.;
180  int ntracks = 0;
181 
182  for( reco::TrackRefVector::const_iterator it = pions.inVertexInCalo_.begin(); it != pions.inVertexInCalo_.end(); it++) {
183  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
184  double deEta = (*it)->eta() - p4.eta();
185  double dePhi = deltaPhi((*it)->phi(), p4.phi());
186  if((**it).ptError()/(**it).pt() < 0.1) {
187  deR2Tr = deR2Tr + deR*deR*(*it)->pt();
188  deEta2Tr = deEta2Tr + deEta*deEta*(*it)->pt();
189  dePhi2Tr = dePhi2Tr + dePhi*dePhi*(*it)->pt();
190  denominator_tracks = denominator_tracks + (*it)->pt();
191  Zch = Zch + (*it)->pt();
192 
193  Pout2 = Pout2 + (**it).p()*(**it).p() - (Zch*p4.P())*(Zch*p4.P());
194  ntracks++;
195  }
196  }
197 
198 
199 
200  for( reco::TrackRefVector::const_iterator it = muons.inVertexInCalo_.begin(); it != muons.inVertexInCalo_.end(); it++) {
201  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
202  double deEta = (*it)->eta() - p4.eta();
203  double dePhi = deltaPhi((*it)->phi(), p4.phi());
204  if((**it).ptError()/(**it).pt() < 0.1) {
205  deR2Tr = deR2Tr + deR*deR*(*it)->pt();
206  deEta2Tr = deEta2Tr + deEta*deEta*(*it)->pt();
207  dePhi2Tr = dePhi2Tr + dePhi*dePhi*(*it)->pt();
208  denominator_tracks = denominator_tracks + (*it)->pt();
209  Zch = Zch + (*it)->pt();
210 
211  Pout2 = Pout2 + (**it).p()*(**it).p() - (Zch*p4.P())*(Zch*p4.P());
212  ntracks++;
213  }
214  }
215  for( reco::TrackRefVector::const_iterator it = elecs.inVertexInCalo_.begin(); it != elecs.inVertexInCalo_.end(); it++) {
216  double deR = deltaR((*it)->eta(), (*it)->phi(), p4.eta(), p4.phi());
217  double deEta = (*it)->eta() - p4.eta();
218  double dePhi = deltaPhi((*it)->phi(), p4.phi());
219  if((**it).ptError()/(**it).pt() < 0.1) {
220  deR2Tr = deR2Tr + deR*deR*(*it)->pt();
221  deEta2Tr = deEta2Tr + deEta*deEta*(*it)->pt();
222  dePhi2Tr = dePhi2Tr + dePhi*dePhi*(*it)->pt();
223  denominator_tracks = denominator_tracks + (*it)->pt();
224  Zch = Zch + (*it)->pt();
225 
226  Pout2 = Pout2 + (**it).p()*(**it).p() - (Zch*p4.P())*(Zch*p4.P());
227  ntracks++;
228  }
229  }
230  for( reco::TrackRefVector::const_iterator it = pions.inVertexOutOfCalo_.begin(); it != pions.inVertexOutOfCalo_.end(); it++) {
231  Zch = Zch + (*it)->pt();
232  }
233  for( reco::TrackRefVector::const_iterator it = muons.inVertexOutOfCalo_.begin(); it != muons.inVertexOutOfCalo_.end(); it++) {
234  Zch = Zch + (*it)->pt();
235  }
236  for( reco::TrackRefVector::const_iterator it = elecs.inVertexOutOfCalo_.begin(); it != elecs.inVertexOutOfCalo_.end(); it++) {
237  Zch = Zch + (*it)->pt();
238  }
239 
240  if(mJPTalgo->getSumPtForBeta()> 0.) Zch = Zch/mJPTalgo->getSumPtForBeta();
241 
242 // std::cout<<" Zch "<< Zch<<" "<<mJPTalgo->getSumPtForBeta()<<std::endl;
243 
244  if(ntracks > 0) {
245  Pout = sqrt(fabs(Pout2))/ntracks;
246  }
247  if (denominator_tracks!=0){
248  deR2Tr = deR2Tr/denominator_tracks;
249  deEta2Tr= deEta2Tr/denominator_tracks;
250  dePhi2Tr= dePhi2Tr/denominator_tracks;
251  }
252 
253  specific.R2momtr = deR2Tr;
254  specific.Eta2momtr = deEta2Tr;
255  specific.Phi2momtr = dePhi2Tr;
256  specific.Pout = Pout;
257  specific.Zch = Zch;
258 
259 
260 // std::cout<<" Moments for charged component "<<deR2_Tr<<" "<<deEta2_Tr<<" "<<dePhi2_Tr<<std::endl;
261 
262 
263 // Create JPT jet
264 
266 
267 // If we add primary vertex
269  iEvent.getByToken(input_vertex_token_, pvCollection);
270  if ( pvCollection.isValid() && pvCollection->size()>0 ) vertex_=pvCollection->begin()->position();
271 
272  reco::JPTJet fJet(p4, vertex_, specific, corrected.getJetConstituents());
273 
274  // fJet.printJet();
275 
276 // Output module
277  if(fJet.pt()>ptCUT) pOut->push_back(fJet);
278 
279  }
280 
281  iEvent.put(pOut);
282 
283 }
reco::TrackRefVector muonsInVertexOutCalo
Definition: JPTJet.h:57
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
virtual void scaleEnergy(double fScale)
scale energy of the jet
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
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
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
edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
reco::TrackRefVector elecsOutVertexInCalo
Definition: JPTJet.h:61
virtual Constituents getJetConstituents() const
list of constituents
reco::TrackRefVector pionsInVertexOutCalo
Definition: JPTJet.h:54
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual double energy() const
energy
ZSPJPTJetCorrector * mZSPalgo
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
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)
double getResponseOfChargedWithEff()
Get responses/sumPT/SumEnergy with and without Efficiency correction.
reco::TrackRefVector pionsOutVertexInCalo
Definition: JPTJet.h:55
float mSumEnergyOfChargedWithEff
Definition: JPTJet.h:70
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
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
virtual double px() const
x coordinate of momentum vector
float mSumPtOfChargedWithoutEff
Definition: JPTJet.h:69
reco::TrackRefVector elecsInVertexOutCalo
Definition: JPTJet.h:60
virtual double pz() const
z coordinate of momentum vector
Particles matched to tracks that are in/in, in/out, out/in at Vertex and CaloFace.
tuple muons
Definition: patZpeak.py:38
JetPlusTrackCorrector * mJPTalgo
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
virtual double py() const
y coordinate of momentum vector
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:32

Member Data Documentation

std::string JetPlusTrackProducer::alias
private

Definition at line 56 of file JetPlusTrackProducer.h.

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

Definition at line 61 of file JetPlusTrackProducer.h.

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

Definition at line 62 of file JetPlusTrackProducer.h.

JetPlusTrackCorrector* JetPlusTrackProducer::mJPTalgo
private

Definition at line 52 of file JetPlusTrackProducer.h.

ZSPJPTJetCorrector* JetPlusTrackProducer::mZSPalgo
private

Definition at line 53 of file JetPlusTrackProducer.h.

double JetPlusTrackProducer::ptCUT
private

Definition at line 59 of file JetPlusTrackProducer.h.

edm::InputTag JetPlusTrackProducer::src
private

Definition at line 54 of file JetPlusTrackProducer.h.

edm::InputTag JetPlusTrackProducer::srcPVs_
private

Definition at line 55 of file JetPlusTrackProducer.h.

bool JetPlusTrackProducer::useZSP
private

Definition at line 58 of file JetPlusTrackProducer.h.

bool JetPlusTrackProducer::vectorial_
private

Definition at line 57 of file JetPlusTrackProducer.h.