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
PileupJPTJetIdProducer Class Reference
Inheritance diagram for PileupJPTJetIdProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PileupJPTJetIdProducer (const edm::ParameterSet &)
 
 ~PileupJPTJetIdProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run &, edm::EventSetup const &)
 
virtual void endLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
 
virtual void endRun (edm::Run &, edm::EventSetup const &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

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
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)
 
- 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 45 of file PileupJPTJetIdProducer.cc.

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

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

Definition at line 60 of file PileupJPTJetIdProducer.cc.

61 {
62 }

Member Function Documentation

void PileupJPTJetIdProducer::beginLuminosityBlock ( edm::LuminosityBlock ,
edm::EventSetup const &   
)
privatevirtual

Definition at line 139 of file PileupJPTJetIdProducer.cc.

140 {
141 }
void PileupJPTJetIdProducer::beginRun ( edm::Run ,
edm::EventSetup const &   
)
privatevirtual

Definition at line 127 of file PileupJPTJetIdProducer.cc.

128 {
129 }
void PileupJPTJetIdProducer::endLuminosityBlock ( edm::LuminosityBlock ,
edm::EventSetup const &   
)
privatevirtual

Definition at line 145 of file PileupJPTJetIdProducer.cc.

146 {
147 }
void PileupJPTJetIdProducer::endRun ( edm::Run ,
edm::EventSetup const &   
)
privatevirtual

Definition at line 133 of file PileupJPTJetIdProducer.cc.

134 {
135 }
void PileupJPTJetIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

|eta|<2.6

Implements edm::EDProducer.

Definition at line 67 of file PileupJPTJetIdProducer.cc.

References b, gather_cfg::cout, reco::LeafCandidate::eta(), cms::PileupJPTJetIdAlgo::fillJPTBlock(), edm::Event::getByToken(), reco::JPTJet::getSpecific(), i, input_token_, metsig::jet, fwrapper::jets, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), pualgo, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, verbosity, and reco::JPTJet::Specific::Zch.

68 {
69  using namespace edm;
70  using namespace std;
71  using namespace reco;
73  iEvent.getByToken(input_token_, jets);
74  vector<float> mva;
75  vector<int> idflag;
76  for ( unsigned int i=0; i<jets->size(); ++i ) {
77  int b = -1;
78  const JPTJet & jet = jets->at(i);
79 
80  float mvapu = pualgo->fillJPTBlock(&jet);
81 
82  mva.push_back(mvapu);
83 
84  // Get PUid type
86 //WP 95% JPT PUID > 0.3
87 //WP 90% JPT PUID > 0.7
88 //WP 80% JPT PUID > 0.9
89 
90 //|eta|>=2.6
91 //WP 90% JPT PUID > -0.55
92 //WP 80% JPT PUID > -0.3
93 //WP 70% JPT PUID > -0.1
94 
95  if(fabs(jet.eta()) < 2.6 ) {
96  if( mvapu > 0.3 ) b = 0;
97  if( mvapu > 0.7 ) b = 1;
98  if( mvapu > 0.9 ) b = 2;
99  } else {
100  if( mvapu > -0.55 ) b = 0;
101  if( mvapu > -0.3 ) b = 1;
102  if( mvapu > -0.1 ) b = 2;
103  }
104 
105  idflag.push_back(b);
106 
107  if(verbosity > 0) std::cout<<" PUID producer::Corrected JPT Jet is "<<jet.pt()<<" "<<jet.eta()<<" "<<jet.phi()<<" "<<jet.getSpecific().Zch<<std::endl;
108 
109  }
110 
111  auto_ptr<ValueMap<float> > mvaout(new ValueMap<float>());
112  ValueMap<float>::Filler mvafiller(*mvaout);
113  mvafiller.insert(jets,mva.begin(),mva.end());
114  mvafiller.fill();
115  iEvent.put(mvaout,"JPTPUDiscriminant");
116 
117  auto_ptr<ValueMap<int> > idflagout(new ValueMap<int>());
118  ValueMap<int>::Filler idflagfiller(*idflagout);
119  idflagfiller.insert(jets,idflag.begin(),idflag.end());
120  idflagfiller.fill();
121  iEvent.put(idflagout,"JPTPUId");
122 
123 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const Specific & getSpecific() const
block accessors
Definition: JPTJet.h:133
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
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)
tuple cout
Definition: gather_cfg.py:121
virtual double phi() const
momentum azimuthal angle

Member Data Documentation

bool PileupJPTJetIdProducer::allowMissingInputs_
private

Definition at line 38 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

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

Definition at line 37 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

edm::InputTag PileupJPTJetIdProducer::jets_
private

Definition at line 36 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer().

cms::PileupJPTJetIdAlgo* PileupJPTJetIdProducer::pualgo
private

Definition at line 40 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().

int PileupJPTJetIdProducer::verbosity
private

Definition at line 39 of file PileupJPTJetIdProducer.cc.

Referenced by PileupJPTJetIdProducer(), and produce().