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
 
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)
 
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::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

Definition at line 23 of file PileupJPTJetIdProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 40 of file PileupJPTJetIdProducer.cc.

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

41 {
42  jets_ = iConfig.getParameter<edm::InputTag>("jets");
43  input_token_ = consumes<edm::View<reco::JPTJet> >(jets_);
44  verbosity = iConfig.getParameter<int>("Verbosity");
45  allowMissingInputs_=iConfig.getUntrackedParameter<bool>("AllowMissingInputs",false);
46  pualgo = new cms::PileupJPTJetIdAlgo(iConfig);
47  pualgo->bookMVAReader();
48  produces<edm::ValueMap<float> > ("JPTPUDiscriminant");
49  produces<edm::ValueMap<int> > ("JPTPUId");
50 }
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 55 of file PileupJPTJetIdProducer.cc.

56 {
57 }

Member Function Documentation

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

|eta|<2.6

Definition at line 62 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, fwrapper::jets, eostools::move(), DetachedQuadStep_cff::mva, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), pualgo, edm::Event::put(), verbosity, and reco::JPTJet::Specific::Zch.

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

Member Data Documentation

bool PileupJPTJetIdProducer::allowMissingInputs_
private

Definition at line 33 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

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

Definition at line 32 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

edm::InputTag PileupJPTJetIdProducer::jets_
private

Definition at line 31 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

cms::PileupJPTJetIdAlgo* PileupJPTJetIdProducer::pualgo
private

Definition at line 35 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

int PileupJPTJetIdProducer::verbosity
private

Definition at line 34 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().