CMS 3D CMS Logo

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

#include <BTagSkimMC.h>

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

Public Member Functions

 BTagSkimMC (const edm::ParameterSet &)
 constructor More...
 
void endJob () override
 
bool filter (edm::Event &evt, const edm::EventSetup &es) 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 Attributes

unsigned int nAccepted_
 
unsigned int nEvents_
 
double overallLumi
 
std::string process_
 
double pthatMax
 
double pthatMin
 
bool verbose
 

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 5 of file BTagSkimMC.h.

Constructor & Destructor Documentation

BTagSkimMC::BTagSkimMC ( const edm::ParameterSet p)

constructor

Definition at line 13 of file BTagSkimMC.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), process_, pthatMax, and pthatMin.

13  :
14  nEvents_(0), nAccepted_(0)
15 {
16  verbose = p.getUntrackedParameter<bool> ("verbose", false);
17  pthatMin = p.getParameter<double> ("pthat_min");
18  pthatMax = p.getParameter<double> ("pthat_max");
19  process_ = p.getParameter<string> ("mcProcess");
20  if (verbose) cout << " Requested: " << process_<<endl;
21 
22 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double pthatMin
Definition: BTagSkimMC.h:18
unsigned int nAccepted_
Definition: BTagSkimMC.h:17
std::string process_
Definition: BTagSkimMC.h:19
double pthatMax
Definition: BTagSkimMC.h:18
unsigned int nEvents_
Definition: BTagSkimMC.h:16

Member Function Documentation

void BTagSkimMC::endJob ( void  )
overridevirtual

Reimplemented from edm::EDFilter.

Definition at line 80 of file BTagSkimMC.cc.

References DEFINE_FWK_MODULE, nAccepted_, and nEvents_.

81 {
82  edm::LogVerbatim( "BTagSkimMC" )
83  << "=============================================================================\n"
84  << " Events read: " << nEvents_
85  << "\n Events accepted by BTagSkimMC: " << nAccepted_
86  << "\n Efficiency: " << (double)(nAccepted_)/(double)(nEvents_)
87  << "\n==========================================================================="
88  << endl;
89 }
unsigned int nAccepted_
Definition: BTagSkimMC.h:17
unsigned int nEvents_
Definition: BTagSkimMC.h:16
bool BTagSkimMC::filter ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 25 of file BTagSkimMC.cc.

References gather_cfg::cout, GenHFHadronMatcher_cfi::genParticles, edm::Event::getByLabel(), mps_fire::i, nAccepted_, nEvents_, AlCaHLTBitMon_ParallelJobs::p, reco::Candidate::pdgId(), process_, pthatMax, pthatMin, and reco::Candidate::status().

26 {
27  nEvents_++;
28 
29  Handle<int> genProcessID;
30  evt.getByLabel( "genEventProcID", genProcessID );
31  double processID = *genProcessID;
32 
33  Handle<double> genEventScale;
34  evt.getByLabel( "genEventScale", genEventScale );
35  double pthat = *genEventScale;
36 
37  if (verbose) cout << "processID: "<< processID << " - pthat: " << pthat;
38 
39  if ((processID != 4) && (process_=="QCD")){ // the Pythia events (for ALPGEN see below)
40 
42  evt.getByLabel( "genEventRunInfo", "FilterEfficiency", genFilterEff);
43  double filter_eff = *genFilterEff;
44  if (verbose) cout << " Is QCD ";
45  // qcd (including min bias HS)
46  if ((filter_eff == 1. || filter_eff == 0.964) && (processID == 11 || processID == 12 || processID == 13 || processID == 28 || processID == 68 || processID == 53)) {
47 
48  if (pthat > pthatMin && pthat < pthatMax) {
49  if (verbose) cout << " ACCEPTED "<<endl;
50  nAccepted_++;
51  return true;
52  }
53  }
54 
55 
56  } // ALPGEN
57  else if(processID == 4) { // this is the number for external ALPGEN events
58 
60  evt.getByLabel( "genParticles", genParticles );
61 
62  for( size_t i = 0; i < genParticles->size(); ++ i ) {
63  const Candidate & p = (*genParticles)[ i ];
64  int id = p.pdgId();
65  int st = p.status();
66 
67  // tt+jets
68  if(st == 3 && (id == 6 || id == -6) ) {
69  if (verbose) cout << "We have a ttbar event"<<endl;
70  nAccepted_++;
71  return true;
72  }
73  }
74  }
75  if (verbose) cout << " REJECTED "<<endl;
76 
77  return false;
78 }
double pthatMin
Definition: BTagSkimMC.h:18
virtual int status() const =0
status word
unsigned int nAccepted_
Definition: BTagSkimMC.h:17
virtual int pdgId() const =0
PDG identifier.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
std::string process_
Definition: BTagSkimMC.h:19
double pthatMax
Definition: BTagSkimMC.h:18
unsigned int nEvents_
Definition: BTagSkimMC.h:16

Member Data Documentation

unsigned int BTagSkimMC::nAccepted_
private

Definition at line 17 of file BTagSkimMC.h.

Referenced by endJob(), and filter().

unsigned int BTagSkimMC::nEvents_
private

Definition at line 16 of file BTagSkimMC.h.

Referenced by endJob(), and filter().

double BTagSkimMC::overallLumi
private

Definition at line 14 of file BTagSkimMC.h.

std::string BTagSkimMC::process_
private

Definition at line 19 of file BTagSkimMC.h.

Referenced by BTagSkimMC(), and filter().

double BTagSkimMC::pthatMax
private

Definition at line 18 of file BTagSkimMC.h.

Referenced by BTagSkimMC(), and filter().

double BTagSkimMC::pthatMin
private

Definition at line 18 of file BTagSkimMC.h.

Referenced by BTagSkimMC(), and filter().

bool BTagSkimMC::verbose
private

Definition at line 13 of file BTagSkimMC.h.