CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
JGJFilter Class Reference

#include <JGJFilter.h>

Inheritance diagram for JGJFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JGJFilter (const edm::ParameterSet &)
 
 ~JGJFilter () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () 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 beginJob () override
 
void endJob () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

unsigned int nAccepted
 
unsigned int nEvents
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter 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::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
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 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 32 of file JGJFilter.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file JGJFilter.cc.

References nEvents.

22 {
23  //Number of events and Number Accepted
24  nEvents = 0;
25  nAccepted = 0;
26 }
unsigned int nAccepted
Definition: JGJFilter.h:46
unsigned int nEvents
Definition: JGJFilter.h:45
JGJFilter::~JGJFilter ( )
override

Definition at line 29 of file JGJFilter.cc.

References gather_cfg::cout, and nEvents.

30 {
31 std::cout << "Total number of tested events = " << nEvents << std::endl;
32 std::cout << "Total number of accepted events = " << nAccepted << std::endl;
33 std::cout << "nEfficiency = " << ((double)nAccepted)/((double)nEvents) << std::endl;
34 }
unsigned int nAccepted
Definition: JGJFilter.h:46
unsigned int nEvents
Definition: JGJFilter.h:45

Member Function Documentation

void JGJFilter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 143 of file JGJFilter.cc.

144 {
145 }
void JGJFilter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 149 of file JGJFilter.cc.

References DEFINE_FWK_MODULE.

150 {
151 }
bool JGJFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 36 of file JGJFilter.cc.

References cms::dd::accepted(), edm::Event::getByLabel(), edm::HandleBase::isValid(), metsig::jet, and nEvents.

37 {
38  nEvents++;
39  bool accepted = false;
40 
41  using namespace edm;
42  using namespace reco;
43  using namespace std;
44 
45  //KT4 jets ***************************************************************************
47  iEvent.getByLabel("kt4GenJetsjgj",o4);
48 
49  if( o4.isValid()) {
50 
51  float jet_pt[3];
52  float jet_eta[3];
53 
54  int njets(0);
55  for( GenJetCollection::const_iterator jet = o4->begin(); jet != o4->end(); ++jet ) {
56  if(njets<4) {
57  jet_pt[njets]=jet->pt();
58  jet_eta[njets]=jet->eta();
59  }
60  njets++;
61  }
62 
63  if(njets>1 && fabs(jet_eta[0]-jet_eta[1])>3.5) accepted = true;
64 
65  if(njets>2) {
66  if((jet_pt[2]/jet_pt[1])>0.8) {
67  if(fabs(jet_eta[0]-jet_eta[2])>3.5) accepted = true;
68  if(fabs(jet_eta[1]-jet_eta[2])>3.5) accepted = true;
69  }
70  }
71  } //valid
72 
73 
74  //KT6 jets ***************************************************************************
76  iEvent.getByLabel("kt6GenJetsjgj",o6);
77 
78  if( o6.isValid()) {
79 
80  float jet_pt[3];
81  float jet_eta[3];
82 
83  int njets(0);
84  for( GenJetCollection::const_iterator jet = o6->begin(); jet != o6->end(); ++jet ) {
85  if(njets<4) {
86  jet_pt[njets]=jet->pt();
87  jet_eta[njets]=jet->eta();
88  }
89  njets++;
90  }
91 
92  if(njets>1 && fabs(jet_eta[0]-jet_eta[1])>3.5) accepted = true;
93 
94  if(njets>2) {
95  if((jet_pt[2]/jet_pt[1])>0.8) {
96  if(fabs(jet_eta[0]-jet_eta[2])>3.5) accepted = true;
97  if(fabs(jet_eta[1]-jet_eta[2])>3.5) accepted = true;
98  }
99  }
100  } //valid
101 
102 
103  //SC5 jets ***************************************************************************
105  iEvent.getByLabel("sisCone5GenJetsjgj",oo);
106 
107  if( oo.isValid()) {
108 
109  float jet_pt[3];
110  float jet_eta[3];
111 
112  int njets(0);
113  for( GenJetCollection::const_iterator jet = oo->begin(); jet != oo->end(); ++jet ) {
114  if(njets<4) {
115  jet_pt[njets]=jet->pt();
116  jet_eta[njets]=jet->eta();
117  }
118  njets++;
119  }
120 
121  if(njets>1 && fabs(jet_eta[0]-jet_eta[1])>3.5) accepted = true;
122 
123 
124 
125  if(njets>2) {
126  if((jet_pt[2]/jet_pt[1])>0.8) {
127  if(fabs(jet_eta[0]-jet_eta[2])>3.5) accepted = true;
128  if(fabs(jet_eta[1]-jet_eta[2])>3.5) accepted = true;
129  }
130  }
131  } //valid
132 
133 
134  if ( accepted ){
135  nAccepted++;
136  return true;
137  }
138  else return false;
139 
140 }
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
unsigned int nAccepted
Definition: JGJFilter.h:46
bool accepted(std::vector< std::string_view > const &, std::string_view)
fixed size matrix
HLT enums.
unsigned int nEvents
Definition: JGJFilter.h:45

Member Data Documentation

unsigned int JGJFilter::nAccepted
private

Definition at line 46 of file JGJFilter.h.

unsigned int JGJFilter::nEvents
private

Definition at line 45 of file JGJFilter.h.

Referenced by looper.Looper::loop().