CMS 3D CMS Logo

Public Member Functions | Private Attributes

BTagSkimMC Class Reference

#include <BTagSkimMC.h>

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

List of all members.

Public Member Functions

 BTagSkimMC (const edm::ParameterSet &)
 constructor
void endJob ()
bool filter (edm::Event &evt, const edm::EventSetup &es)

Private Attributes

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

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.

                                               :
  nEvents_(0), nAccepted_(0)
{
  verbose = p.getUntrackedParameter<bool> ("verbose", false);
  pthatMin = p.getParameter<double> ("pthat_min");
  pthatMax = p.getParameter<double> ("pthat_max");
  process_ = p.getParameter<string> ("mcProcess");
  if (verbose) cout << " Requested:  " << process_<<endl;

}

Member Function Documentation

void BTagSkimMC::endJob ( void  ) [virtual]

Reimplemented from edm::EDFilter.

Definition at line 80 of file BTagSkimMC.cc.

References nAccepted_, and nEvents_.

{
  edm::LogVerbatim( "BTagSkimMC" ) 
    << "=============================================================================\n"
        << " Events read: " << nEvents_
    << "\n Events accepted by BTagSkimMC: " << nAccepted_
    << "\n Efficiency: " << (double)(nAccepted_)/(double)(nEvents_)
        << "\n==========================================================================="
    << endl;
}
bool BTagSkimMC::filter ( edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDFilter.

Definition at line 25 of file BTagSkimMC.cc.

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

{
  nEvents_++;

  Handle<int> genProcessID;
  evt.getByLabel( "genEventProcID", genProcessID );
  double processID = *genProcessID;

  Handle<double> genEventScale;
  evt.getByLabel( "genEventScale", genEventScale );
  double pthat = *genEventScale;

  if (verbose) cout << "processID: "<< processID << " - pthat: " << pthat;
  
  if  ((processID != 4) && (process_=="QCD")){  // the Pythia events (for ALPGEN see below)

    Handle<double> genFilterEff;
    evt.getByLabel( "genEventRunInfo", "FilterEfficiency", genFilterEff);
    double filter_eff = *genFilterEff;
    if (verbose) cout << " Is QCD ";
    // qcd (including min bias HS)
    if ((filter_eff == 1. || filter_eff == 0.964) && (processID == 11 || processID == 12 || processID == 13 || processID == 28 || processID == 68 || processID == 53)) {

      if (pthat > pthatMin && pthat < pthatMax) {
      if (verbose) cout << " ACCEPTED "<<endl;
        nAccepted_++;
        return true;
      }
    }


  }  // ALPGEN
  else if(processID == 4) { // this is the number for external ALPGEN events

    Handle<GenParticleCollection> genParticles;
    evt.getByLabel( "genParticles", genParticles );

    for( size_t i = 0; i < genParticles->size(); ++ i ) {
      const Candidate & p = (*genParticles)[ i ];
      int id = p.pdgId();
      int st = p.status();

      // tt+jets
      if(st == 3 && (id == 6 || id == -6) ) {
        if (verbose) cout << "We have a ttbar event"<<endl;
        nAccepted_++;
        return true;
      }
    }
  }
  if (verbose) cout << " REJECTED "<<endl;

  return false;
}

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.