CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PileupJPTJetIdProducer Class Reference
Inheritance diagram for PileupJPTJetIdProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PileupJPTJetIdProducer (const edm::ParameterSet &)
 
 ~PileupJPTJetIdProducer () 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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 Member Functions

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

Private Attributes

bool allowMissingInputs_
 
edm::EDGetTokenT< edm::View< reco::JPTJet > > input_token_
 
edm::InputTag jets_
 
cms::PileupJPTJetIdAlgopualgo
 
int verbosity
 

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
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Definition at line 22 of file PileupJPTJetIdProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 38 of file PileupJPTJetIdProducer.cc.

References allowMissingInputs_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), input_token_, jets_, pualgo, and verbosity.

38  {
39  jets_ = iConfig.getParameter<edm::InputTag>("jets");
40  input_token_ = consumes<edm::View<reco::JPTJet>>(jets_);
41  verbosity = iConfig.getParameter<int>("Verbosity");
42  allowMissingInputs_ = iConfig.getUntrackedParameter<bool>("AllowMissingInputs", false);
43  pualgo = new cms::PileupJPTJetIdAlgo(iConfig);
44  pualgo->bookMVAReader();
45  produces<edm::ValueMap<float>>("JPTPUDiscriminant");
46  produces<edm::ValueMap<int>>("JPTPUId");
47 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< reco::JPTJet > > input_token_
cms::PileupJPTJetIdAlgo * pualgo
PileupJPTJetIdProducer::~PileupJPTJetIdProducer ( )
override

Definition at line 50 of file PileupJPTJetIdProducer.cc.

50 {}

Member Function Documentation

void PileupJPTJetIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

|eta|<2.6

Definition at line 53 of file PileupJPTJetIdProducer.cc.

References b, gather_cfg::cout, DEFINE_FWK_MODULE, reco::LeafCandidate::eta(), cms::PileupJPTJetIdAlgo::fillJPTBlock(), edm::Event::getByToken(), reco::JPTJet::getSpecific(), mps_fire::i, input_token_, metsig::jet, singleTopDQM_cfi::jets, eostools::move(), beam_dqm_sourceclient-live_cfg::mva, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), pualgo, edm::Event::put(), verbosity, and reco::JPTJet::Specific::Zch.

53  {
54  using namespace edm;
55  using namespace std;
56  using namespace reco;
58  iEvent.getByToken(input_token_, jets);
59  vector<float> mva;
60  vector<int> idflag;
61  for (unsigned int i = 0; i < jets->size(); ++i) {
62  int b = -1;
63  const JPTJet& jet = jets->at(i);
64 
65  float mvapu = pualgo->fillJPTBlock(&jet);
66 
67  mva.push_back(mvapu);
68 
69  // Get PUid type
71  //WP 95% JPT PUID > 0.3
72  //WP 90% JPT PUID > 0.7
73  //WP 80% JPT PUID > 0.9
74 
75  //|eta|>=2.6
76  //WP 90% JPT PUID > -0.55
77  //WP 80% JPT PUID > -0.3
78  //WP 70% JPT PUID > -0.1
79 
80  if (fabs(jet.eta()) < 2.6) {
81  if (mvapu > 0.3)
82  b = 0;
83  if (mvapu > 0.7)
84  b = 1;
85  if (mvapu > 0.9)
86  b = 2;
87  } else {
88  if (mvapu > -0.55)
89  b = 0;
90  if (mvapu > -0.3)
91  b = 1;
92  if (mvapu > -0.1)
93  b = 2;
94  }
95 
96  idflag.push_back(b);
97 
98  if (verbosity > 0)
99  std::cout << " PUID producer::Corrected JPT Jet is " << jet.pt() << " " << jet.eta() << " " << jet.phi() << " "
100  << jet.getSpecific().Zch << std::endl;
101  }
102 
103  auto mvaout = std::make_unique<ValueMap<float>>();
104  ValueMap<float>::Filler mvafiller(*mvaout);
105  mvafiller.insert(jets, mva.begin(), mva.end());
106  mvafiller.fill();
107  iEvent.put(std::move(mvaout), "JPTPUDiscriminant");
108 
109  auto idflagout = std::make_unique<ValueMap<int>>();
110  ValueMap<int>::Filler idflagfiller(*idflagout);
111  idflagfiller.insert(jets, idflag.begin(), idflag.end());
112  idflagfiller.fill();
113  iEvent.put(std::move(idflagout), "JPTPUId");
114 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const Specific & getSpecific() const
block accessors
Definition: JPTJet.h:136
double pt() const final
transverse momentum
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:28
edm::EDGetTokenT< edm::View< reco::JPTJet > > input_token_
cms::PileupJPTJetIdAlgo * pualgo
double b
Definition: hdecay.h:118
float fillJPTBlock(const reco::JPTJet *jet)
fixed size matrix
HLT enums.
double phi() const final
momentum azimuthal angle
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

bool PileupJPTJetIdProducer::allowMissingInputs_
private

Definition at line 32 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

edm::EDGetTokenT<edm::View<reco::JPTJet> > PileupJPTJetIdProducer::input_token_
private

Definition at line 31 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

edm::InputTag PileupJPTJetIdProducer::jets_
private

Definition at line 30 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

cms::PileupJPTJetIdAlgo* PileupJPTJetIdProducer::pualgo
private

Definition at line 34 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

int PileupJPTJetIdProducer::verbosity
private

Definition at line 33 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().