CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
JetCorrectorOnTheFly< Jet > Class Template Reference
Inheritance diagram for JetCorrectorOnTheFly< Jet >:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 JetCorrectorOnTheFly (const edm::ParameterSet &)
 
 ~JetCorrectorOnTheFly () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::vector< JetJetCollection
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

edm::Service< TFileServicefs
 
TH1F * mCorPt
 
bool mDebug
 
edm::EDGetTokenT
< reco::JetCorrector
mJetCorrector
 
edm::EDGetTokenT< JetCollectionmJetToken
 
double mMinRawJetPt
 
TH1F * mRawPt
 
edm::EDGetTokenT
< reco::VertexCollection
mVertexToken
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

template<class Jet>
class JetCorrectorOnTheFly< Jet >

Definition at line 28 of file JetCorrectorOnTheFly.cc.

Member Typedef Documentation

template<class Jet >
typedef std::vector<Jet> JetCorrectorOnTheFly< Jet >::JetCollection
private

Definition at line 34 of file JetCorrectorOnTheFly.cc.

Constructor & Destructor Documentation

template<class Jet >
JetCorrectorOnTheFly< Jet >::JetCorrectorOnTheFly ( const edm::ParameterSet iConfig)
explicit

Definition at line 52 of file JetCorrectorOnTheFly.cc.

References edm::ParameterSet::getParameter(), HLT_FULL_cff::InputTag, and TFileService::kSharedResource.

52  {
53  mJetCorrector = consumes<reco::JetCorrector>(iConfig.getParameter<edm::InputTag>("JetCorrector"));
54  mJetToken = consumes<JetCollection>(edm::InputTag(iConfig.getParameter<edm::InputTag>("JetCollectionName")));
55  mVertexToken = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
56  mMinRawJetPt = iConfig.getParameter<double>("MinRawJetPt");
57  mDebug = iConfig.getParameter<bool>("Debug");
58 
59  usesResource(TFileService::kSharedResource);
60 }
static const std::string kSharedResource
Definition: TFileService.h:76
edm::EDGetTokenT< JetCollection > mJetToken
edm::EDGetTokenT< reco::VertexCollection > mVertexToken
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
template<class Jet >
JetCorrectorOnTheFly< Jet >::~JetCorrectorOnTheFly ( )
override

Definition at line 63 of file JetCorrectorOnTheFly.cc.

63 {}

Member Function Documentation

template<class Jet >
void JetCorrectorOnTheFly< Jet >::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 66 of file JetCorrectorOnTheFly.cc.

References pfClustersFromHGC3DClusters_cfi::corrector, gather_cfg::cout, edm::Event::getByToken(), fwrapper::jets, and pileupReCalc_HLTpaths::scale.

66  {
68  iEvent.getByToken(mJetCorrector, corrector);
70  iEvent.getByToken(mJetToken, jets);
71 
73  iEvent.getByToken(mVertexToken, recVtxs);
74  int NPV(0);
75  for (unsigned int ind = 0; ind < recVtxs->size(); ind++) {
76  if (!((*recVtxs)[ind].isFake())) {
77  NPV++;
78  }
79  }
80  typename JetCollection::const_iterator i_jet;
82  for (i_jet = jets->begin(); i_jet != jets->end(); i_jet++) {
83  if (i_jet->pt() < mMinRawJetPt)
84  continue;
85  //double scale = corrector->correction(i_jet->p4());
86  double scale = corrector->correction(*i_jet);
87  if (mDebug) {
88  std::cout << "energy = " << i_jet->energy() << ", "
89  << "eta = " << i_jet->eta() << ", "
90  << "raw pt = " << i_jet->pt() << ", "
91  << "NPV = " << NPV << ", "
92  << "correction = " << scale << ", "
93  << "cor pt = " << scale * i_jet->pt() << endl;
94  }
95  mRawPt->Fill(i_jet->pt());
96  mCorPt->Fill(scale * i_jet->pt());
97  }
98 }
edm::EDGetTokenT< JetCollection > mJetToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< reco::VertexCollection > mVertexToken
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector
vector< PseudoJet > jets
tuple cout
Definition: gather_cfg.py:144
template<class Jet >
void JetCorrectorOnTheFly< Jet >::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 101 of file JetCorrectorOnTheFly.cc.

References compareTotals::fs.

101  {
102  mRawPt = fs->make<TH1F>("RawJetPt", "RawJetPt", 1000, 0, 1000);
103  mCorPt = fs->make<TH1F>("CorJetPt", "CorJetPt", 1000, 0, 1000);
104 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::Service< TFileService > fs
template<class Jet >
void JetCorrectorOnTheFly< Jet >::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 107 of file JetCorrectorOnTheFly.cc.

107 {}

Member Data Documentation

template<class Jet >
edm::Service<TFileService> JetCorrectorOnTheFly< Jet >::fs
private

Definition at line 39 of file JetCorrectorOnTheFly.cc.

template<class Jet >
TH1F * JetCorrectorOnTheFly< Jet >::mCorPt
private

Definition at line 45 of file JetCorrectorOnTheFly.cc.

template<class Jet >
bool JetCorrectorOnTheFly< Jet >::mDebug
private

Definition at line 44 of file JetCorrectorOnTheFly.cc.

template<class Jet >
edm::EDGetTokenT<reco::JetCorrector> JetCorrectorOnTheFly< Jet >::mJetCorrector
private

Definition at line 40 of file JetCorrectorOnTheFly.cc.

template<class Jet >
edm::EDGetTokenT<JetCollection> JetCorrectorOnTheFly< Jet >::mJetToken
private

Definition at line 41 of file JetCorrectorOnTheFly.cc.

template<class Jet >
double JetCorrectorOnTheFly< Jet >::mMinRawJetPt
private

Definition at line 43 of file JetCorrectorOnTheFly.cc.

template<class Jet >
TH1F* JetCorrectorOnTheFly< Jet >::mRawPt
private

Definition at line 45 of file JetCorrectorOnTheFly.cc.

template<class Jet >
edm::EDGetTokenT<reco::VertexCollection> JetCorrectorOnTheFly< Jet >::mVertexToken
private

Definition at line 42 of file JetCorrectorOnTheFly.cc.