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 Member Functions | Private Attributes
NoPileUpPFMEtDataProducer Class Reference

#include <NoPileUpPFMEtDataProducer.h>

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

Public Member Functions

 NoPileUpPFMEtDataProducer (const edm::ParameterSet &)
 
 ~NoPileUpPFMEtDataProducer ()
 
- 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 Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

double dZcut_
 
std::string jetEnOffsetCorrLabel_
 
PileupJetIdentifier::Id jetIdSelection_
 
PFJetIDSelectionFunctorlooseJetIdAlgo_
 
int maxWarnings_
 
double minJetPt_
 
double minJetPtForMEtCov_
 
std::string moduleLabel_
 
int numWarnings_
 
PFMEtSignInterfaceBasepfMEtSignInterface_
 
edm::EDGetTokenT
< reco::VertexCollection
srcHardScatterVertex_
 
edm::EDGetTokenT
< edm::ValueMap< int > > 
srcJetIds_
 
edm::EDGetTokenT
< reco::PFJetCollection
srcJets_
 
edm::EDGetTokenT
< reco::PFJetCollection
srcJetsForMEtCov_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
srcPFCandidates_
 
edm::EDGetTokenT< edm::View
< reco::PFCandidate > > 
srcPFCandidatesView_
 
edm::EDGetTokenT
< PFCandToVertexAssMap
srcPFCandToVertexAssociations_
 
int verbosity_
 

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

Produce input objects used to compute MVA/No-PU MET

Authors
Phil Harris, CERN Christian Veelken, LLR

Definition at line 39 of file NoPileUpPFMEtDataProducer.h.

Constructor & Destructor Documentation

NoPileUpPFMEtDataProducer::NoPileUpPFMEtDataProducer ( const edm::ParameterSet cfg)

Definition at line 16 of file NoPileUpPFMEtDataProducer.cc.

References edm::ParameterSet::addParameter(), dZcut_, edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), jetEnOffsetCorrLabel_, jetIdSelection_, PileupJetIdentifier::kLoose, PileupJetIdentifier::kMedium, PileupJetIdentifier::kTight, looseJetIdAlgo_, maxWarnings_, minJetPt_, minJetPtForMEtCov_, numWarnings_, pfMEtSignInterface_, srcHardScatterVertex_, srcJetIds_, srcJets_, srcJetsForMEtCov_, srcPFCandidates_, srcPFCandidatesView_, srcPFCandToVertexAssociations_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

17  : moduleLabel_(cfg.getParameter<std::string>("@module_label")),
18  looseJetIdAlgo_(nullptr),
19  pfMEtSignInterface_(nullptr)
20 {
21  srcJets_ = consumes<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJets"));
22  srcJetIds_ = consumes<edm::ValueMap<int> >(cfg.getParameter<edm::InputTag>("srcJetIds"));
23  minJetPt_ = cfg.getParameter<double>("minJetPt");
24  std::string jetIdSelection_string = cfg.getParameter<std::string>("jetIdSelection");
25  if ( jetIdSelection_string == "loose" ) jetIdSelection_ = PileupJetIdentifier::kLoose;
26  else if ( jetIdSelection_string == "medium" ) jetIdSelection_ = PileupJetIdentifier::kMedium;
27  else if ( jetIdSelection_string == "tight" ) jetIdSelection_ = PileupJetIdentifier::kTight;
28  else throw cms::Exception("NoPileUpPFMEtDataProducer")
29  << "Invalid Configuration Parameter 'jetIdSelection' = " << jetIdSelection_string << " !!\n";
30  jetEnOffsetCorrLabel_ = cfg.getParameter<std::string>("jetEnOffsetCorrLabel");
31 
32  srcPFCandidates_ = consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates"));
33  srcPFCandidatesView_ = consumes<edm::View<reco::PFCandidate> >(cfg.getParameter<edm::InputTag>("srcPFCandidates"));
34  srcPFCandToVertexAssociations_ = consumes<PFCandToVertexAssMap>(cfg.getParameter<edm::InputTag>("srcPFCandToVertexAssociations"));
35  srcJetsForMEtCov_ = mayConsume<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJetsForMEtCov"));
36  minJetPtForMEtCov_ = cfg.getParameter<double>("minJetPtForMEtCov");
37  srcHardScatterVertex_ = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("srcHardScatterVertex"));
38  dZcut_ = cfg.getParameter<double>("dZcut");
39 
40  edm::ParameterSet cfgPFJetIdAlgo;
41  cfgPFJetIdAlgo.addParameter<std::string>("version", "FIRSTDATA");
42  cfgPFJetIdAlgo.addParameter<std::string>("quality", "LOOSE");
43  looseJetIdAlgo_ = new PFJetIDSelectionFunctor(cfgPFJetIdAlgo);
44 
46 
47  maxWarnings_ = ( cfg.exists("maxWarnings") ) ?
48  cfg.getParameter<int>("maxWarnings") : 1;
49  numWarnings_ = 0;
50 
51  verbosity_ = ( cfg.exists("verbosity") ) ?
52  cfg.getParameter<int>("verbosity") : 0;
53 
54  produces<reco::MVAMEtJetInfoCollection>();
55  produces<reco::MVAMEtPFCandInfoCollection>();
56 }
T getParameter(std::string const &) const
edm::EDGetTokenT< PFCandToVertexAssMap > srcPFCandToVertexAssociations_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::PFJetCollection > srcJetsForMEtCov_
edm::EDGetTokenT< reco::VertexCollection > srcHardScatterVertex_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > srcPFCandidatesView_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:142
edm::EDGetTokenT< reco::PFJetCollection > srcJets_
PFJetIDSelectionFunctor * looseJetIdAlgo_
PFMEtSignInterfaceBase * pfMEtSignInterface_
PF Jet selector for pat::Jets.
edm::EDGetTokenT< edm::ValueMap< int > > srcJetIds_
PileupJetIdentifier::Id jetIdSelection_
NoPileUpPFMEtDataProducer::~NoPileUpPFMEtDataProducer ( )

Definition at line 58 of file NoPileUpPFMEtDataProducer.cc.

References looseJetIdAlgo_, and pfMEtSignInterface_.

59 {
60  delete looseJetIdAlgo_;
61  delete pfMEtSignInterface_;
62 }
PFJetIDSelectionFunctor * looseJetIdAlgo_
PFMEtSignInterfaceBase * pfMEtSignInterface_

Member Function Documentation

void NoPileUpPFMEtDataProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 121 of file NoPileUpPFMEtDataProducer.cc.

References reco::MVAMEtPFCandInfo::charge_, PFMEtSignInterfaceBase::compResolution(), JetCorrector::correction(), funct::cos(), dZcut_, reco::LeafCandidate::energy(), edm::hlt::Exception, flag_isWithinFakeJet, flag_isWithinJetForMEtCov, flag_isWithinSelectedJet, edm::Ptr< T >::get(), metsig::SigInputObj::get_energy(), metsig::SigInputObj::get_phi(), metsig::SigInputObj::get_sigma_e(), metsig::SigInputObj::get_sigma_tan(), metsig::SigInputObj::get_type(), edm::Event::getByToken(), JetCorrector::getJetCorrector(), customizeTrackingMonitorSeedNumber::idx, if(), edm::EDGetTokenT< T >::isUninitialized(), isVertexAssociated_fast(), reco::MVAMEtPFCandInfo::isWithinJet_, metsig::jet, jetEnOffsetCorrLabel_, jetIdSelection_, fwrapper::jets, noPuUtils::kChHSAssoc, edm::Ptr< T >::key(), reco::MVAMEtPFCandInfo::kNeutral, reco::MVAMEtJetInfo::kNoPileUp, reco::MVAMEtPFCandInfo::kNoPileUpCharged, reco::MVAMEtJetInfo::kPileUp, reco::MVAMEtPFCandInfo::kPileUpCharged, LogDebug, maxWarnings_, minJetPt_, minJetPtForMEtCov_, moduleLabel_, reco::MVAMEtJetInfo::neutralEnFrac_, numWarnings_, reco::MVAMEtJetInfo::offsetEnCorr_, reco::MVAMEtJetInfo::p4_, reco::MVAMEtPFCandInfo::p4_, reco::MVAMEtJetInfo::passesLooseJetId_, reco::MVAMEtPFCandInfo::passesLooseJetId_, PileupJetIdentifier::passJetId(), reco::tau::pfCandidates(), pfMEtSignInterface_, reco::MVAMEtJetInfo::pfMEtSignObj_, reco::MVAMEtPFCandInfo::pfMEtSignObj_, edm::Event::put(), reversePFCandToVertexAssociation(), metsig::SigInputObj::set(), reco::LeafCandidate::setP4(), funct::sin(), srcHardScatterVertex_, srcJetIds_, srcJets_, srcJetsForMEtCov_, srcPFCandidates_, srcPFCandidatesView_, srcPFCandToVertexAssociations_, reco::MVAMEtJetInfo::type_, and reco::MVAMEtPFCandInfo::type_.

122 {
123  LogDebug ("produce")
124  << "<NoPileUpPFMEtDataProducer::produce>:\n"
125  << " moduleLabel = " << moduleLabel_ << std::endl;
126 
127  // get jets
129  evt.getByToken(srcJets_, jets);
130 
131  typedef edm::ValueMap<int> jetIdMap;
132  edm::Handle<jetIdMap> jetIds;
133  evt.getByToken(srcJetIds_, jetIds);
134 
135  // get jets for computing contributions to PFMEt significance matrix
137  if ( ! srcJetsForMEtCov_.isUninitialized() ) evt.getByToken(srcJetsForMEtCov_, jetsForMEtCov);
138 
139  // get PFCandidates
140  typedef edm::View<reco::PFCandidate> PFCandidateView;
142  evt.getByToken(srcPFCandidatesView_, pfCandidates);
143 
144  std::vector<int> pfCandidateFlags(pfCandidates->size());
145  std::vector<const reco::PFJet*> pfCandidateToJetAssociations(pfCandidates->size());
146 
148  evt.getByToken(srcPFCandidates_, pfCandidateHandle);
149 
150  // get PFCandidate-to-vertex associations and "the" hard-scatter vertex
151  edm::Handle<PFCandToVertexAssMap> pfCandToVertexAssociations;
152  evt.getByToken(srcPFCandToVertexAssociations_, pfCandToVertexAssociations);
153 
154  reversedPFCandidateToVertexAssociationMap pfCandToVertexAssociations_reversed = reversePFCandToVertexAssociation(*pfCandToVertexAssociations);
155 
156  edm::Handle<reco::VertexCollection> hardScatterVertex;
157  evt.getByToken(srcHardScatterVertex_, hardScatterVertex);
158  // if ( verbosity_ && hardScatterVertex->size() >= 1 ) {
159  // reco::Vertex::Point hardScatterVertexPos = hardScatterVertex->front().position();
160  // std::cout << "hard-scatter Vertex: x = " << hardScatterVertexPos.x() << ", y = " << hardScatterVertexPos.y() << ", z = " << hardScatterVertexPos.z() << std::endl;
161  // for ( PFCandToVertexAssMap::const_iterator pfCandToVertexAssociation = pfCandToVertexAssociations->begin();
162  // pfCandToVertexAssociation != pfCandToVertexAssociations->end(); ++pfCandToVertexAssociation ) {
163  // reco::VertexRef vertex = pfCandToVertexAssociation->key;
164  // const PFCandQualityPairVector& pfCandidates_vertex = pfCandToVertexAssociation->val;
165  // for ( PFCandQualityPairVector::const_iterator pfCandidate_vertex = pfCandidates_vertex.begin();
166  // pfCandidate_vertex != pfCandidates_vertex.end(); ++pfCandidate_vertex ) {
167  // const reco::PFCandidate& pfCandidate = (*pfCandidate_vertex->first);
168  // int pfCandToVertexAssocQuality = pfCandidate_vertex->second;
169  // if ( pfCandidate.pt() > 2. && pfCandidate.charge() != 0 ) {
170  // double dZ = -1.;
171  // if ( pfCandidate.trackRef().isNonnull() ) dZ = std::abs(pfCandidate.trackRef()->dz(hardScatterVertexPos));
172  // else if ( pfCandidate.gsfTrackRef().isNonnull() ) dZ = std::abs(pfCandidate.gsfTrackRef()->dz(hardScatterVertexPos));
173  // std::cout << "pfCand #" << pfCandidate_vertex->first.key() << ": Pt = " << pfCandidate.pt() << ", eta = " << pfCandidate.eta() << ", phi = " << pfCandidate.phi()
174  // << " (charge = " << pfCandidate.charge() << ", dZ = " << dZ << ")" << std::endl;
175  // reco::Vertex::Point vertexPos = vertex->position();
176  // std::cout << " associated vertex (quality = " << pfCandToVertexAssocQuality << "):"
177  // << " x = " << vertexPos.x() << ", y = " << vertexPos.y() << ", z = " << vertexPos.z() << std::endl;
178  // }
179  // }
180  // }
181  // }
182 
183  std::auto_ptr<reco::MVAMEtJetInfoCollection> jetInfos(new reco::MVAMEtJetInfoCollection());
184  std::auto_ptr<reco::MVAMEtPFCandInfoCollection> pfCandInfos(new reco::MVAMEtPFCandInfoCollection());
185 
186  const JetCorrector* jetEnOffsetCorrector = nullptr;
187  if ( jetEnOffsetCorrLabel_ != "" ) {
188  jetEnOffsetCorrector = JetCorrector::getJetCorrector(jetEnOffsetCorrLabel_, es);
189  if ( !jetEnOffsetCorrector )
190  throw cms::Exception("NoPileUpPFMEtDataProducer::produce")
191  << "Failed to access Jet corrections for = " << jetEnOffsetCorrLabel_ << " !!\n";
192  }
193 
194  size_t numJets = jets->size();
195  for ( size_t iJet = 0; iJet < numJets; ++iJet ) {
196  reco::PFJetRef jet(jets, iJet);
197  if ( !(jet->pt() > minJetPt_) ) continue;
198 
199  bool passesLooseJetId = (*looseJetIdAlgo_)(*jet);
200  if ( !passesLooseJetId ) {
201  setPFCandidateFlag(*jet, *pfCandidates, pfCandidateFlags, flag_isWithinFakeJet, numWarnings_, maxWarnings_);
202  }
203  setPFCandidateFlag(*jet, *pfCandidates, pfCandidateFlags, flag_isWithinSelectedJet, numWarnings_, maxWarnings_);
204 
205  reco::MVAMEtJetInfo jetInfo;
206  jetInfo.p4_ = jet->p4();
207  int jetId = (*jetIds)[jet];
208  bool jetIdSelection_passed = PileupJetIdentifier::passJetId(jetId, jetIdSelection_);
209  jetInfo.type_ = ( jetIdSelection_passed ) ?
211  jetInfo.passesLooseJetId_ = passesLooseJetId;
212  double jetEnergy_uncorrected =
213  jet->chargedHadronEnergy()
214  + jet->neutralHadronEnergy()
215  + jet->photonEnergy()
216  + jet->electronEnergy()
217  + jet->muonEnergy()
218  + jet->HFHadronEnergy()
219  + jet->HFEMEnergy();
220  double jetPx_uncorrected = cos(jet->phi())*sin(jet->theta())*jetEnergy_uncorrected;
221  double jetPy_uncorrected = sin(jet->phi())*sin(jet->theta())*jetEnergy_uncorrected;
222  double jetPz_uncorrected = cos(jet->theta())*jetEnergy_uncorrected;
223  reco::Candidate::LorentzVector rawJetP4(jetPx_uncorrected, jetPy_uncorrected, jetPz_uncorrected, jetEnergy_uncorrected);
224  reco::PFJet rawJet(*jet);
225  rawJet.setP4(rawJetP4);
226  double jetNeutralEnFrac = ( jetEnergy_uncorrected > 0. ) ?
227  (jet->neutralEmEnergy() + jet->neutralHadronEnergy())/jetEnergy_uncorrected : -1.;
228  jetInfo.neutralEnFrac_ = jetNeutralEnFrac;
229  jetInfo.offsetEnCorr_ = ( jetEnOffsetCorrector ) ?
230  rawJet.energy()*(1. - jetEnOffsetCorrector->correction(rawJet, evt, es)) : 0.;
232  // if ( verbosity_ ) {
233  // std::cout << " jet: Pt = " << jet->pt() << ", eta = " << jet->eta() << ", phi = " << jet->phi() << ":"
234  // << " sigma(En)/En = " << (jetInfo.pfMEtSignObj_.get_sigma_e()/jet->energy()) << std::endl;
235  // std::cout << "(offsetEnCorr = " << jetInfo.offsetEnCorr_ << ")" << std::endl;
236  // std::cout << " id. flags: PU = " << jetIdSelection_passed << ", anti-noise = " << passesLooseJetId << std::endl;
237 
238  // size_t numPFJetConstituents = jet->getPFConstituents().size();
239  // std::cout << "numConstituents = " << numPFJetConstituents << std::endl;
240  // for ( size_t iPFJetConstituent = 0; iPFJetConstituent < numPFJetConstituents; ++iPFJetConstituent ) {
241  // const reco::PFCandidatePtr& pfJetConstituent = jet->getPFConstituents()[iPFJetConstituent];
242  // std::cout << " constituent #" << iPFJetConstituent << ": Pt = " << pfJetConstituent->pt() << ", eta = " << pfJetConstituent->eta() << ", phi = " << pfJetConstituent->phi() << std::endl;
243  // }
244  // }
245  jetInfos->push_back(jetInfo);
246  }
247  LogDebug ("produce") << "#jetInfos = " << jetInfos->size() << std::endl;
248 
249  for ( reco::PFJetCollection::const_iterator jet = jets->begin();
250  jet != jets->end(); ++jet ) {
251  if ( jet->pt() > minJetPtForMEtCov_ ) {
252  setPFCandidateFlag(*jet, *pfCandidates, pfCandidateFlags, flag_isWithinJetForMEtCov, numWarnings_, maxWarnings_, &pfCandidateToJetAssociations);
253  }
254  }
255 
256  size_t numPFCandidates = pfCandidates->size();
257  for ( size_t iPFCandidate = 0; iPFCandidate < numPFCandidates; ++iPFCandidate ) {
258  reco::PFCandidatePtr pfCandidatePtr = pfCandidates->ptrAt(iPFCandidate);
259 
260  int idx = pfCandidatePtr.key();
261  reco::MVAMEtPFCandInfo pfCandInfo;
262  pfCandInfo.p4_ = pfCandidatePtr->p4();
263  pfCandInfo.charge_ = pfCandidatePtr->charge();
264  pfCandInfo.type_ = -1;
265  // CV: need to call isVertexAssociated_fast instead of isVertexAssociated function
266  // (makes run-time of MVAPFMEtDataProducer::produce decrease from ~1s per event to ~0.35s per event)
267  //int vtxAssociationType = isVertexAssociated(*pfCandidatePtr, *pfCandToVertexAssociations, *hardScatterVertex, dZcut_);
268  reco::PFCandidateRef pfCandidateRef(pfCandidateHandle, iPFCandidate);
269  int vtxAssociationType = isVertexAssociated_fast(pfCandidateRef, pfCandToVertexAssociations_reversed, *hardScatterVertex, dZcut_, numWarnings_, maxWarnings_);
270  bool isHardScatterVertex_associated = (vtxAssociationType == noPuUtils::kChHSAssoc);
271  if ( pfCandidatePtr->charge() != 0 ) pfCandInfo.type_ = reco::MVAMEtPFCandInfo::kNeutral;
272  else if ( isHardScatterVertex_associated ) pfCandInfo.type_ = reco::MVAMEtPFCandInfo::kNoPileUpCharged;
274  pfCandInfo.isWithinJet_ = (pfCandidateFlags[idx] & flag_isWithinSelectedJet);
275  if ( pfCandInfo.isWithinJet_ ) pfCandInfo.passesLooseJetId_ = (pfCandidateFlags[idx] & flag_isWithinFakeJet);
276  else pfCandInfo.passesLooseJetId_ = true;
277  // CV: for PFCandidates that are within PFJets (of Pt between 'minJetPtForMEtCov' and 'minJetPt'),
278  // take contribution to PFMEt significance matrix from associated PFJet.
279  // (energy uncertainty scaled by ratio of PFCandidate/PFJet energy)
280  const reco::PFJet* jet_matched = pfCandidateToJetAssociations[idx];
281  if ( jet_matched ) {
282  metsig::SigInputObj pfCandResolution = pfMEtSignInterface_->compResolution(pfCandidatePtr.get());
283  metsig::SigInputObj jetResolution = pfMEtSignInterface_->compResolution(jet_matched);
284  //std::cout << " jet (matched): Pt = " << jet_matched->pt() << ", eta = " << jet_matched->eta() << ", phi = " << jet_matched->phi() << ":"
285  // << " sigma(En)/En = " << (jetResolution.get_sigma_e()/jet_matched->energy()) << std::endl;
286  //std::cout << "(pfCand: type = " << getPFCandidateType(*pfCandidate) << ","
287  // << " Pt = " << pfCandidatePtr->pt() << ", eta = " << pfCandidatePtr->eta() << ", phi = " << pfCandidatePtr->phi() << ":"
288  // << " sigma(En)/En = " << (pfCandResolution.get_sigma_e()/pfCandidatePtr->energy()) << ")" << std::endl;
289  pfCandInfo.pfMEtSignObj_.set(pfCandResolution.get_type(),
290  pfCandResolution.get_energy(),
291  pfCandResolution.get_phi(),
292  jetResolution.get_sigma_e()*(pfCandidatePtr->energy()/jet_matched->energy()),
293  jetResolution.get_sigma_tan());
294  } else {
295  pfCandInfo.pfMEtSignObj_ = pfMEtSignInterface_->compResolution(pfCandidatePtr.get());
296  //std::cout << " pfCand: type = " << getPFCandidateType(*pfCandidate) << ","
297  // << " Pt = " << pfCandidatePtr->pt() << ", eta = " << pfCandidatePtr->eta() << ", phi = " << pfCandidatePtr->phi() << ":"
298  // << " sigma(En)/En = " << (pfCandInfo.pfMEtSignObj_.get_sigma_e()/pfCandidatePtr->energy()) << std::endl;
299  }
300 
301  pfCandInfos->push_back(pfCandInfo);
302  }
303 
304  LogDebug ("produce") << "#pfCandInfos = " << pfCandInfos->size() << std::endl;
305 
306  evt.put(jetInfos);
307  evt.put(pfCandInfos);
308 }
#define LogDebug(id)
double get_sigma_tan() const
Definition: SigInputObj.h:46
edm::EDGetTokenT< PFCandToVertexAssMap > srcPFCandToVertexAssociations_
metsig::SigInputObj pfMEtSignObj_
Definition: MVAMEtData.h:36
const int flag_isWithinSelectedJet
key_type key() const
Definition: Ptr.h:169
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
double passesLooseJetId_
Definition: MVAMEtData.h:33
double get_phi() const
Definition: SigInputObj.h:44
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:143
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::EDGetTokenT< reco::PFJetCollection > srcJetsForMEtCov_
const int flag_isWithinFakeJet
edm::EDGetTokenT< reco::VertexCollection > srcHardScatterVertex_
reco::Candidate::LorentzVector p4_
Definition: MVAMEtData.h:51
Jets made from PFObjects.
Definition: PFJet.h:21
void set(const std::string &m_type, const double &m_energy, const double &m_phi, const double &m_sigma_e, const double &m_sigma_tan)
Definition: SigInputObj.h:48
edm::EDGetTokenT< edm::View< reco::PFCandidate > > srcPFCandidatesView_
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
reversedPFCandidateToVertexAssociationMap reversePFCandToVertexAssociation(const PFCandToVertexAssMap &)
virtual double energy() const
energy
static bool passJetId(int flag, Id level)
const int flag_isWithinJetForMEtCov
std::vector< reco::MVAMEtJetInfo > MVAMEtJetInfoCollection
Definition: MVAMEtDataFwd.h:10
reco::Candidate::LorentzVector p4_
Definition: MVAMEtData.h:29
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
vector< PseudoJet > jets
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::EDGetTokenT< reco::PFJetCollection > srcJets_
PFMEtSignInterfaceBase * pfMEtSignInterface_
std::vector< reco::MVAMEtPFCandInfo > MVAMEtPFCandInfoCollection
Definition: MVAMEtDataFwd.h:12
edm::EDGetTokenT< edm::ValueMap< int > > srcJetIds_
double get_energy() const
Definition: SigInputObj.h:43
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:50
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
int isVertexAssociated_fast(const reco::PFCandidateRef &, const reversedPFCandidateToVertexAssociationMap &, const reco::VertexCollection &, double, int &, int)
PileupJetIdentifier::Id jetIdSelection_
bool isUninitialized() const
Definition: EDGetToken.h:71
std::string get_type() const
Definition: SigInputObj.h:42
metsig::SigInputObj compResolution(const T *particle) const
if(conf.exists("allCellsPositionCalc"))
metsig::SigInputObj pfMEtSignObj_
Definition: MVAMEtData.h:58
double get_sigma_e() const
Definition: SigInputObj.h:45

Member Data Documentation

double NoPileUpPFMEtDataProducer::dZcut_
private

Definition at line 64 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

std::string NoPileUpPFMEtDataProducer::jetEnOffsetCorrLabel_
private

Definition at line 56 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

PileupJetIdentifier::Id NoPileUpPFMEtDataProducer::jetIdSelection_
private

Definition at line 55 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

PFJetIDSelectionFunctor* NoPileUpPFMEtDataProducer::looseJetIdAlgo_
private
int NoPileUpPFMEtDataProducer::maxWarnings_
private

Definition at line 70 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

double NoPileUpPFMEtDataProducer::minJetPt_
private

Definition at line 54 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

double NoPileUpPFMEtDataProducer::minJetPtForMEtCov_
private

Definition at line 62 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

std::string NoPileUpPFMEtDataProducer::moduleLabel_
private
int NoPileUpPFMEtDataProducer::numWarnings_
private

Definition at line 71 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

PFMEtSignInterfaceBase* NoPileUpPFMEtDataProducer::pfMEtSignInterface_
private
edm::EDGetTokenT<reco::VertexCollection> NoPileUpPFMEtDataProducer::srcHardScatterVertex_
private

Definition at line 63 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<int> > NoPileUpPFMEtDataProducer::srcJetIds_
private

Definition at line 53 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

edm::EDGetTokenT<reco::PFJetCollection> NoPileUpPFMEtDataProducer::srcJets_
private

Definition at line 52 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

edm::EDGetTokenT<reco::PFJetCollection> NoPileUpPFMEtDataProducer::srcJetsForMEtCov_
private

Definition at line 61 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

edm::EDGetTokenT<reco::PFCandidateCollection> NoPileUpPFMEtDataProducer::srcPFCandidates_
private

Definition at line 58 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

edm::EDGetTokenT<edm::View<reco::PFCandidate> > NoPileUpPFMEtDataProducer::srcPFCandidatesView_
private

Definition at line 59 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

edm::EDGetTokenT<PFCandToVertexAssMap> NoPileUpPFMEtDataProducer::srcPFCandToVertexAssociations_
private

Definition at line 60 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer(), and produce().

int NoPileUpPFMEtDataProducer::verbosity_
private

Definition at line 73 of file NoPileUpPFMEtDataProducer.h.

Referenced by NoPileUpPFMEtDataProducer().