CMS 3D CMS Logo

Public Member Functions | Private Attributes

RecoSelector Class Reference

#include <RecoSelector.h>

List of all members.

Public Member Functions

std::string GetName ()
void handleObjects (const edm::Event &)
bool isSelected (const edm::Event &)
 RecoSelector (edm::ParameterSet userCut_params)
virtual ~RecoSelector ()

Private Attributes

std::string m_calometSrc
std::string m_electronSrc
std::string m_jetsSrc
std::string m_muonSrc
std::string m_photonProducerSrc
std::string m_photonSrc
std::string name
double reco_metMin
double reco_ptElecMin
double reco_ptJet1Min
double reco_ptJet2Min
double reco_ptMuonMin
double reco_ptPhotMin
const reco::CaloJetCollectiontheCaloJetCollection
const reco::CaloMETCollectiontheCaloMETCollection
const reco::GsfElectronCollectiontheElectronCollection
const reco::MuonCollectiontheMuonCollection
const reco::PhotonCollectionthePhotonCollection

Detailed Description

Definition at line 33 of file RecoSelector.h.


Constructor & Destructor Documentation

RecoSelector::RecoSelector ( edm::ParameterSet  userCut_params)

Definition at line 20 of file RecoSelector.cc.

References edm::ParameterSet::getParameter(), and AlCaRecoCosmics_cfg::name.

{

  name                   = userCut_params.getParameter<string>("name");
  m_electronSrc          = userCut_params.getParameter<string>("electrons");
  m_muonSrc              = userCut_params.getParameter<string>("muons");
  m_jetsSrc              = userCut_params.getParameter<string>("jets");
  m_photonProducerSrc    = userCut_params.getParameter<string>("photonProducer");
  m_photonSrc            = userCut_params.getParameter<string>("photons");
  m_calometSrc           = userCut_params.getParameter<string>("calomet");

  reco_metMin    = userCut_params.getParameter<double>("reco_metMin") ;
  reco_ptJet1Min = userCut_params.getParameter<double>("reco_ptJet1Min");
  reco_ptJet2Min = userCut_params.getParameter<double>("reco_ptJet2Min");
  reco_ptElecMin = userCut_params.getParameter<double>("reco_ptElecMin");
  reco_ptMuonMin = userCut_params.getParameter<double>("reco_ptMuonMin");
  reco_ptPhotMin = userCut_params.getParameter<double>("reco_ptPhotMin");

  edm::LogInfo("RecoSelectorParameters") << endl;
  edm::LogInfo("RecoSelectorParameters") << "UserAnalysis parameters for " << name << " selection:" << endl;
  edm::LogInfo("RecoSelectorParameters") << " reco_metMin    = " << reco_metMin << endl;
  edm::LogInfo("RecoSelectorParameters") << " reco_ptJet1Min = " << reco_ptJet1Min  << endl;
  edm::LogInfo("RecoSelectorParameters") << " reco_ptJet2Min = " << reco_ptJet2Min  << endl;
  edm::LogInfo("RecoSelectorParameters") << " reco_ptElecMin = " << reco_ptElecMin  << endl;
  edm::LogInfo("RecoSelectorParameters") << " reco_ptMuonMin = " << reco_ptMuonMin  << endl;
  edm::LogInfo("RecoSelectorParameters") << " reco_ptPhotMin = " << reco_ptPhotMin  << endl;

}
virtual RecoSelector::~RecoSelector ( ) [inline, virtual]

Definition at line 40 of file RecoSelector.h.

{};

Member Function Documentation

string RecoSelector::GetName ( )

Definition at line 49 of file RecoSelector.cc.

References AlCaRecoCosmics_cfg::name.

{return name;}
void RecoSelector::handleObjects ( const edm::Event iEvent)

Definition at line 121 of file RecoSelector.cc.

References edm::Event::getByLabel(), and edm::Handle< T >::product().

{

  //Get the electrons
  Handle<GsfElectronCollection> theElectronCollectionHandle; 
  iEvent.getByLabel(m_electronSrc, theElectronCollectionHandle);
  theElectronCollection = theElectronCollectionHandle.product();

  //Get the Muons
  Handle<MuonCollection> theMuonCollectionHandle; 
  iEvent.getByLabel(m_muonSrc, theMuonCollectionHandle);
  theMuonCollection = theMuonCollectionHandle.product();

  //Get the Photons
  Handle<PhotonCollection> thePhotonCollectionHandle; 
  iEvent.getByLabel(m_photonProducerSrc, m_photonSrc, thePhotonCollectionHandle);
  thePhotonCollection = thePhotonCollectionHandle.product();

  //Get the CaloJets
  Handle<CaloJetCollection> theCaloJetCollectionHandle;
  iEvent.getByLabel(m_jetsSrc, theCaloJetCollectionHandle);
  theCaloJetCollection = theCaloJetCollectionHandle.product();

  //Get the CaloMET
  Handle<CaloMETCollection> theCaloMETCollectionHandle;
  iEvent.getByLabel(m_calometSrc, theCaloMETCollectionHandle);
  theCaloMETCollection = theCaloMETCollectionHandle.product();

}
bool RecoSelector::isSelected ( const edm::Event iEvent)

Definition at line 51 of file RecoSelector.cc.

References reco::GsfElectron::ecalDrivenSeed(), metsig::electron, i, LogDebug, metsig::muon, reco::LeafCandidate::p(), reco::LeafCandidate::pt(), and reco::GsfElectron::superCluster().

{


  this->handleObjects(iEvent);


  bool TotalCutPassed = false;

  bool ElectronCutPassed = false;
  for(unsigned int i=0; i<theElectronCollection->size(); i++) {
    GsfElectron electron = (*theElectronCollection)[i];
    if (electron.ecalDrivenSeed()) {
      float elenergy = electron.superCluster()->energy();
      float elpt = electron.pt() * elenergy / electron.p();
      if(elpt>reco_ptElecMin)  ElectronCutPassed = true;
      LogDebug("RecoSelectorCuts") << "elpt = " << elpt << endl;
    }
    else {
      //      float elenergy = 0;
      //      float elpt = 0;
      ElectronCutPassed = false;
    }
  }

  bool MuonCutPassed = false;
  for(unsigned int i=0; i<theMuonCollection->size(); i++) {
    Muon muon = (*theMuonCollection)[i];
    float muonpt = muon.pt();
    if(muonpt>reco_ptMuonMin) MuonCutPassed = true;
    LogDebug("RecoSelectorCuts") << "muonpt = " << muonpt << endl;
  }
  
  bool PhotonCutPassed = false;
  for(unsigned int i=0; i<thePhotonCollection->size(); i++) {
    Photon photon = (*thePhotonCollection)[i];
    float photonpt = photon.pt();
    if(photonpt>reco_ptPhotMin) PhotonCutPassed = true;
    LogDebug("RecoSelectorCuts") << "photonpt = " << photonpt << endl;
  }


  bool JetCutPassed = false;  
  if(theCaloJetCollection->size()>1) {
    if((*theCaloJetCollection)[0].pt() > reco_ptJet1Min &&
       (*theCaloJetCollection)[1].pt() > reco_ptJet2Min ) JetCutPassed = true;
  }

  bool MetCutPassed = false;  
  const CaloMET theCaloMET = theCaloMETCollection->front();
  float calomet = theCaloMET.pt();
  LogDebug("RecoSelectorCuts") << "calomet = " << calomet << endl;
  if(calomet > reco_metMin) MetCutPassed = true;

  edm::LogInfo("RecoSelectorPassed") << "ElectronCutPassed = " << (int)ElectronCutPassed << endl;
  edm::LogInfo("RecoSelectorPassed") << "MuonCutPassed     = " << (int)MuonCutPassed << endl;
  edm::LogInfo("RecoSelectorPassed") << "PhotonCutPassed   = " << (int)PhotonCutPassed << endl;
  edm::LogInfo("RecoSelectorPassed") << "JetCutPassed      = " << (int)JetCutPassed << endl;
  edm::LogInfo("RecoSelectorPassed") << "MetCutPassed      = " << (int)MetCutPassed << endl;


  if(
     (ElectronCutPassed || MuonCutPassed) &&
     PhotonCutPassed                      &&
     JetCutPassed                         &&
     MetCutPassed      )   TotalCutPassed = true;

  return TotalCutPassed;
}

Member Data Documentation

std::string RecoSelector::m_calometSrc [private]

Definition at line 56 of file RecoSelector.h.

std::string RecoSelector::m_electronSrc [private]

Definition at line 51 of file RecoSelector.h.

std::string RecoSelector::m_jetsSrc [private]

Definition at line 53 of file RecoSelector.h.

std::string RecoSelector::m_muonSrc [private]

Definition at line 52 of file RecoSelector.h.

std::string RecoSelector::m_photonProducerSrc [private]

Definition at line 55 of file RecoSelector.h.

std::string RecoSelector::m_photonSrc [private]

Definition at line 54 of file RecoSelector.h.

std::string RecoSelector::name [private]

Definition at line 50 of file RecoSelector.h.

double RecoSelector::reco_metMin [private]

Definition at line 57 of file RecoSelector.h.

double RecoSelector::reco_ptElecMin [private]

Definition at line 60 of file RecoSelector.h.

double RecoSelector::reco_ptJet1Min [private]

Definition at line 58 of file RecoSelector.h.

double RecoSelector::reco_ptJet2Min [private]

Definition at line 59 of file RecoSelector.h.

double RecoSelector::reco_ptMuonMin [private]

Definition at line 61 of file RecoSelector.h.

double RecoSelector::reco_ptPhotMin [private]

Definition at line 62 of file RecoSelector.h.

Definition at line 67 of file RecoSelector.h.

Definition at line 68 of file RecoSelector.h.

Definition at line 64 of file RecoSelector.h.

Definition at line 65 of file RecoSelector.h.

Definition at line 66 of file RecoSelector.h.