CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Attributes
PatBJetTagAnalyzer Class Reference
Inheritance diagram for PatBJetTagAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  Plots
 

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &es) override
 
void beginJob () override
 
 PatBJetTagAnalyzer (const edm::ParameterSet &params)
 constructor and destructor More...
 
 ~PatBJetTagAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 Types

enum  Flavour {
  ALL_JETS = 0, UDSG_JETS, C_JETS, B_JETS,
  NONID_JETS, N_JET_TYPES
}
 

Private Attributes

TH1 * flavours_
 
double jetEtaCut_
 
double jetPtCut_
 
edm::EDGetTokenT< pat::JetCollectionjetsToken_
 
struct PatBJetTagAnalyzer::Plots plots_ [N_JET_TYPES]
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
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 20 of file PatBJetTagAnalyzer.cc.

Member Enumeration Documentation

Constructor & Destructor Documentation

PatBJetTagAnalyzer::PatBJetTagAnalyzer ( const edm::ParameterSet params)

constructor and destructor

Definition at line 56 of file PatBJetTagAnalyzer.cc.

56  :
57  jetsToken_(consumes<pat::JetCollection>(params.getParameter<edm::InputTag>("jets"))),
58  jetPtCut_(params.getParameter<double>("jetPtCut")),
59  jetEtaCut_(params.getParameter<double>("jetEtaCut"))
60 {
61 }
T getParameter(std::string const &) const
edm::EDGetTokenT< pat::JetCollection > jetsToken_
PatBJetTagAnalyzer::~PatBJetTagAnalyzer ( )
override

Definition at line 63 of file PatBJetTagAnalyzer.cc.

64 {
65 }

Member Function Documentation

void PatBJetTagAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup es 
)
override

Definition at line 115 of file PatBJetTagAnalyzer.cc.

References funct::abs(), ALL_JETS, B_JETS, C_JETS, DEFINE_FWK_MODULE, PatBJetTagAnalyzer::Plots::discrCSV, PatBJetTagAnalyzer::Plots::discrSSV, PatBJetTagAnalyzer::Plots::discrTC, GenHFHadronMatcher_cff::flavour, flavours_, metsig::jet, jetEtaCut_, jetPtCut_, jetsToken_, NONID_JETS, plots_, and UDSG_JETS.

116 {
117  // handle to the jets collection
119  event.getByToken(jetsToken_, jetsHandle);
120 
121  // now go through all jets
122  for(pat::JetCollection::const_iterator jet = jetsHandle->begin();
123  jet != jetsHandle->end(); ++jet) {
124 
125  // only look at jets that pass the pt and eta cut
126  if (jet->pt() < jetPtCut_ ||
127  std::abs(jet->eta()) > jetEtaCut_)
128  continue;
129 
131  // find out the jet flavour (differs between quark and anti-quark)
132  switch(std::abs(jet->partonFlavour())) {
133  case 1:
134  case 2:
135  case 3:
136  case 21:
137  flavour = UDSG_JETS;
138  break;
139  case 4:
140  flavour = C_JETS;
141  break;
142  case 5:
143  flavour = B_JETS;
144  break;
145  default:
146  flavour = NONID_JETS;
147  }
148 
149  // simply count the number of accepted jets
150  flavours_->Fill(ALL_JETS);
151  flavours_->Fill(flavour);
152 
153  double discrTC = jet->bDiscriminator("trackCountingHighEffBJetTags");
154  double discrSSV = jet->bDiscriminator("simpleSecondaryVertexBJetTags");
155  double discrCSV = jet->bDiscriminator("combinedSecondaryVertexBJetTags");
156 
157  plots_[ALL_JETS].discrTC->Fill(discrTC);
158  plots_[flavour].discrTC->Fill(discrTC);
159 
160  plots_[ALL_JETS].discrSSV->Fill(discrSSV);
161  plots_[flavour].discrSSV->Fill(discrSSV);
162 
163  plots_[ALL_JETS].discrCSV->Fill(discrCSV);
164  plots_[flavour].discrCSV->Fill(discrCSV);
165  }
166 }
struct PatBJetTagAnalyzer::Plots plots_[N_JET_TYPES]
edm::EDGetTokenT< pat::JetCollection > jetsToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void PatBJetTagAnalyzer::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file PatBJetTagAnalyzer.cc.

References ALL_JETS, B_JETS, C_JETS, PatBJetTagAnalyzer::Plots::discrCSV, PatBJetTagAnalyzer::Plots::discrSSV, PatBJetTagAnalyzer::Plots::discrTC, GenHFHadronMatcher_cff::flavour, flavours_, mps_fire::i, TFileService::make(), N_JET_TYPES, dataset::name, nanoDQM_cff::plots, plots_, and UDSG_JETS.

68 {
69  // retrieve handle to auxiliary service
70  // used for storing histograms into ROOT file
72 
73  flavours_ = fs->make<TH1F>("flavours", "jet flavours", 5, 0, 5);
74 
75  // book histograms for all jet flavours
76  for(unsigned int i = 0; i < N_JET_TYPES; i++) {
77  Plots &plots = plots_[i];
78  const char *flavour, *name;
79 
80  switch((Flavour)i) {
81  case ALL_JETS:
82  flavour = "all jets";
83  name = "all";
84  break;
85  case UDSG_JETS:
86  flavour = "light flavour jets";
87  name = "udsg";
88  break;
89  case C_JETS:
90  flavour = "charm jets";
91  name = "c";
92  break;
93  case B_JETS:
94  flavour = "bottom jets";
95  name = "b";
96  break;
97  default:
98  flavour = "unidentified jets";
99  name = "ni";
100  break;
101  }
102 
103  plots.discrTC = fs->make<TH1F>(Form("discrTC_%s", name),
104  Form("track counting (\"high efficiency\") in %s", flavour),
105  100, 0, 20);
106  plots.discrSSV = fs->make<TH1F>(Form("discrSSV_%s", name),
107  Form("simple secondary vertex in %s", flavour),
108  100, 0, 10);
109  plots.discrCSV = fs->make<TH1F>(Form("discrCSV_%s", name),
110  Form("combined secondary vertex in %s", flavour),
111  100, 0, 1);
112  }
113 }
struct PatBJetTagAnalyzer::Plots plots_[N_JET_TYPES]
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64

Member Data Documentation

TH1* PatBJetTagAnalyzer::flavours_
private

Definition at line 48 of file PatBJetTagAnalyzer.cc.

Referenced by analyze(), and beginJob().

double PatBJetTagAnalyzer::jetEtaCut_
private

Definition at line 35 of file PatBJetTagAnalyzer.cc.

Referenced by analyze().

double PatBJetTagAnalyzer::jetPtCut_
private

Definition at line 34 of file PatBJetTagAnalyzer.cc.

Referenced by analyze().

edm::EDGetTokenT<pat::JetCollection> PatBJetTagAnalyzer::jetsToken_
private

Definition at line 32 of file PatBJetTagAnalyzer.cc.

Referenced by analyze().

struct PatBJetTagAnalyzer::Plots PatBJetTagAnalyzer::plots_[N_JET_TYPES]
private

Referenced by analyze(), and beginJob().