test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RecoSelector Class Reference

#include <RecoSelector.h>

Public Member Functions

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

Private Attributes

edm::EDGetTokenT
< reco::CaloMETCollection
m_calometSrc
 
edm::EDGetTokenT
< reco::GsfElectronCollection
m_electronSrc
 
edm::EDGetTokenT
< reco::CaloJetCollection
m_jetsSrc
 
edm::EDGetTokenT
< reco::MuonCollection
m_muonSrc
 
edm::EDGetTokenT
< reco::PhotonCollection
m_photon_token_
 
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 34 of file RecoSelector.h.

Constructor & Destructor Documentation

RecoSelector::RecoSelector ( const edm::ParameterSet userCut_params,
edm::ConsumesCollector &&  iC 
)

Definition at line 20 of file RecoSelector.cc.

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

21 {
22 
23  name = userCut_params.getParameter<string>("name");
24  m_electronSrc = iC.consumes<GsfElectronCollection>(userCut_params.getParameter<string>("electrons"));
25  m_muonSrc = iC.consumes<MuonCollection>(userCut_params.getParameter<string>("muons"));
26  m_jetsSrc = iC.consumes<CaloJetCollection>(userCut_params.getParameter<string>("jets"));
27  m_photonSrc = userCut_params.getParameter<string>("photons");
28  m_photonProducerSrc = userCut_params.getParameter<string>("photonProducer");
30  m_calometSrc = iC.consumes<CaloMETCollection>(userCut_params.getParameter<string>("calomet"));
31 
32  reco_metMin = userCut_params.getParameter<double>("reco_metMin") ;
33  reco_ptJet1Min = userCut_params.getParameter<double>("reco_ptJet1Min");
34  reco_ptJet2Min = userCut_params.getParameter<double>("reco_ptJet2Min");
35  reco_ptElecMin = userCut_params.getParameter<double>("reco_ptElecMin");
36  reco_ptMuonMin = userCut_params.getParameter<double>("reco_ptMuonMin");
37  reco_ptPhotMin = userCut_params.getParameter<double>("reco_ptPhotMin");
38 
39  edm::LogInfo("RecoSelectorParameters") << endl;
40  edm::LogInfo("RecoSelectorParameters") << "UserAnalysis parameters for " << name << " selection:" << endl;
41  edm::LogInfo("RecoSelectorParameters") << " reco_metMin = " << reco_metMin << endl;
42  edm::LogInfo("RecoSelectorParameters") << " reco_ptJet1Min = " << reco_ptJet1Min << endl;
43  edm::LogInfo("RecoSelectorParameters") << " reco_ptJet2Min = " << reco_ptJet2Min << endl;
44  edm::LogInfo("RecoSelectorParameters") << " reco_ptElecMin = " << reco_ptElecMin << endl;
45  edm::LogInfo("RecoSelectorParameters") << " reco_ptMuonMin = " << reco_ptMuonMin << endl;
46  edm::LogInfo("RecoSelectorParameters") << " reco_ptPhotMin = " << reco_ptPhotMin << endl;
47 
48 }
edm::EDGetTokenT< reco::CaloJetCollection > m_jetsSrc
Definition: RecoSelector.h:54
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::CaloMETCollection > m_calometSrc
Definition: RecoSelector.h:58
edm::EDGetTokenT< reco::GsfElectronCollection > m_electronSrc
Definition: RecoSelector.h:52
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
Collection of Calo MET.
std::string m_photonProducerSrc
Definition: RecoSelector.h:56
edm::EDGetTokenT< reco::PhotonCollection > m_photon_token_
Definition: RecoSelector.h:57
edm::EDGetTokenT< reco::MuonCollection > m_muonSrc
Definition: RecoSelector.h:53
double reco_ptJet2Min
Definition: RecoSelector.h:61
std::string m_photonSrc
Definition: RecoSelector.h:55
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::string name
Definition: RecoSelector.h:51
double reco_ptMuonMin
Definition: RecoSelector.h:63
double reco_ptElecMin
Definition: RecoSelector.h:62
double reco_ptJet1Min
Definition: RecoSelector.h:60
double reco_metMin
Definition: RecoSelector.h:59
double reco_ptPhotMin
Definition: RecoSelector.h:64
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
virtual RecoSelector::~RecoSelector ( )
inlinevirtual

Definition at line 41 of file RecoSelector.h.

41 {};

Member Function Documentation

string RecoSelector::GetName ( )

Definition at line 50 of file RecoSelector.cc.

References mergeVDriftHistosByStation::name.

50 {return name;}
std::string name
Definition: RecoSelector.h:51
void RecoSelector::handleObjects ( const edm::Event iEvent)

Definition at line 122 of file RecoSelector.cc.

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

123 {
124 
125  //Get the electrons
126  Handle<GsfElectronCollection> theElectronCollectionHandle;
127  iEvent.getByToken(m_electronSrc, theElectronCollectionHandle);
128  theElectronCollection = theElectronCollectionHandle.product();
129 
130  //Get the Muons
131  Handle<MuonCollection> theMuonCollectionHandle;
132  iEvent.getByToken(m_muonSrc, theMuonCollectionHandle);
133  theMuonCollection = theMuonCollectionHandle.product();
134 
135  //Get the Photons
136  Handle<PhotonCollection> thePhotonCollectionHandle;
137  iEvent.getByToken(m_photon_token_, thePhotonCollectionHandle);
138  thePhotonCollection = thePhotonCollectionHandle.product();
139 
140  //Get the CaloJets
141  Handle<CaloJetCollection> theCaloJetCollectionHandle;
142  iEvent.getByToken(m_jetsSrc, theCaloJetCollectionHandle);
143  theCaloJetCollection = theCaloJetCollectionHandle.product();
144 
145  //Get the CaloMET
146  Handle<CaloMETCollection> theCaloMETCollectionHandle;
147  iEvent.getByToken(m_calometSrc, theCaloMETCollectionHandle);
148  theCaloMETCollection = theCaloMETCollectionHandle.product();
149 
150 }
edm::EDGetTokenT< reco::CaloJetCollection > m_jetsSrc
Definition: RecoSelector.h:54
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< reco::CaloMETCollection > m_calometSrc
Definition: RecoSelector.h:58
const reco::CaloMETCollection * theCaloMETCollection
Definition: RecoSelector.h:70
edm::EDGetTokenT< reco::GsfElectronCollection > m_electronSrc
Definition: RecoSelector.h:52
edm::EDGetTokenT< reco::PhotonCollection > m_photon_token_
Definition: RecoSelector.h:57
edm::EDGetTokenT< reco::MuonCollection > m_muonSrc
Definition: RecoSelector.h:53
const reco::PhotonCollection * thePhotonCollection
Definition: RecoSelector.h:68
const reco::GsfElectronCollection * theElectronCollection
Definition: RecoSelector.h:66
T const * product() const
Definition: Handle.h:81
const reco::CaloJetCollection * theCaloJetCollection
Definition: RecoSelector.h:69
const reco::MuonCollection * theMuonCollection
Definition: RecoSelector.h:67
bool RecoSelector::isSelected ( const edm::Event iEvent)

Definition at line 52 of file RecoSelector.cc.

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

53 {
54 
55 
56  this->handleObjects(iEvent);
57 
58 
59  bool TotalCutPassed = false;
60 
61  bool ElectronCutPassed = false;
62  for(unsigned int i=0; i<theElectronCollection->size(); i++) {
63  GsfElectron electron = (*theElectronCollection)[i];
64  if (electron.ecalDrivenSeed()) {
65  float elenergy = electron.superCluster()->energy();
66  float elpt = electron.pt() * elenergy / electron.p();
67  if(elpt>reco_ptElecMin) ElectronCutPassed = true;
68  LogDebug("RecoSelectorCuts") << "elpt = " << elpt << endl;
69  }
70  else {
71  // float elenergy = 0;
72  // float elpt = 0;
73  ElectronCutPassed = false;
74  }
75  }
76 
77  bool MuonCutPassed = false;
78  for(unsigned int i=0; i<theMuonCollection->size(); i++) {
79  Muon muon = (*theMuonCollection)[i];
80  float muonpt = muon.pt();
81  if(muonpt>reco_ptMuonMin) MuonCutPassed = true;
82  LogDebug("RecoSelectorCuts") << "muonpt = " << muonpt << endl;
83  }
84 
85  bool PhotonCutPassed = false;
86  for(unsigned int i=0; i<thePhotonCollection->size(); i++) {
87  Photon photon = (*thePhotonCollection)[i];
88  float photonpt = photon.pt();
89  if(photonpt>reco_ptPhotMin) PhotonCutPassed = true;
90  LogDebug("RecoSelectorCuts") << "photonpt = " << photonpt << endl;
91  }
92 
93 
94  bool JetCutPassed = false;
95  if(theCaloJetCollection->size()>1) {
96  if((*theCaloJetCollection)[0].pt() > reco_ptJet1Min &&
97  (*theCaloJetCollection)[1].pt() > reco_ptJet2Min ) JetCutPassed = true;
98  }
99 
100  bool MetCutPassed = false;
101  const CaloMET theCaloMET = theCaloMETCollection->front();
102  float calomet = theCaloMET.pt();
103  LogDebug("RecoSelectorCuts") << "calomet = " << calomet << endl;
104  if(calomet > reco_metMin) MetCutPassed = true;
105 
106  edm::LogInfo("RecoSelectorPassed") << "ElectronCutPassed = " << (int)ElectronCutPassed << endl;
107  edm::LogInfo("RecoSelectorPassed") << "MuonCutPassed = " << (int)MuonCutPassed << endl;
108  edm::LogInfo("RecoSelectorPassed") << "PhotonCutPassed = " << (int)PhotonCutPassed << endl;
109  edm::LogInfo("RecoSelectorPassed") << "JetCutPassed = " << (int)JetCutPassed << endl;
110  edm::LogInfo("RecoSelectorPassed") << "MetCutPassed = " << (int)MetCutPassed << endl;
111 
112 
113  if(
114  (ElectronCutPassed || MuonCutPassed) &&
115  PhotonCutPassed &&
116  JetCutPassed &&
117  MetCutPassed ) TotalCutPassed = true;
118 
119  return TotalCutPassed;
120 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
virtual double p() const
magnitude of momentum vector
virtual float pt() const
transverse momentum
const reco::CaloMETCollection * theCaloMETCollection
Definition: RecoSelector.h:70
void handleObjects(const edm::Event &)
double reco_ptJet2Min
Definition: RecoSelector.h:61
const reco::PhotonCollection * thePhotonCollection
Definition: RecoSelector.h:68
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
const reco::GsfElectronCollection * theElectronCollection
Definition: RecoSelector.h:66
const reco::CaloJetCollection * theCaloJetCollection
Definition: RecoSelector.h:69
double reco_ptMuonMin
Definition: RecoSelector.h:63
double reco_ptElecMin
Definition: RecoSelector.h:62
const reco::MuonCollection * theMuonCollection
Definition: RecoSelector.h:67
double reco_ptJet1Min
Definition: RecoSelector.h:60
double reco_metMin
Definition: RecoSelector.h:59
double reco_ptPhotMin
Definition: RecoSelector.h:64
bool ecalDrivenSeed() const
Definition: GsfElectron.h:186

Member Data Documentation

edm::EDGetTokenT<reco::CaloMETCollection> RecoSelector::m_calometSrc
private

Definition at line 58 of file RecoSelector.h.

edm::EDGetTokenT<reco::GsfElectronCollection> RecoSelector::m_electronSrc
private

Definition at line 52 of file RecoSelector.h.

edm::EDGetTokenT<reco::CaloJetCollection> RecoSelector::m_jetsSrc
private

Definition at line 54 of file RecoSelector.h.

edm::EDGetTokenT<reco::MuonCollection> RecoSelector::m_muonSrc
private

Definition at line 53 of file RecoSelector.h.

edm::EDGetTokenT<reco::PhotonCollection> RecoSelector::m_photon_token_
private

Definition at line 57 of file RecoSelector.h.

std::string RecoSelector::m_photonProducerSrc
private

Definition at line 56 of file RecoSelector.h.

std::string RecoSelector::m_photonSrc
private

Definition at line 55 of file RecoSelector.h.

std::string RecoSelector::name
private
double RecoSelector::reco_metMin
private

Definition at line 59 of file RecoSelector.h.

double RecoSelector::reco_ptElecMin
private

Definition at line 62 of file RecoSelector.h.

double RecoSelector::reco_ptJet1Min
private

Definition at line 60 of file RecoSelector.h.

double RecoSelector::reco_ptJet2Min
private

Definition at line 61 of file RecoSelector.h.

double RecoSelector::reco_ptMuonMin
private

Definition at line 63 of file RecoSelector.h.

double RecoSelector::reco_ptPhotMin
private

Definition at line 64 of file RecoSelector.h.

const reco::CaloJetCollection* RecoSelector::theCaloJetCollection
private

Definition at line 69 of file RecoSelector.h.

const reco::CaloMETCollection* RecoSelector::theCaloMETCollection
private

Definition at line 70 of file RecoSelector.h.

const reco::GsfElectronCollection* RecoSelector::theElectronCollection
private

Definition at line 66 of file RecoSelector.h.

const reco::MuonCollection* RecoSelector::theMuonCollection
private

Definition at line 67 of file RecoSelector.h.

const reco::PhotonCollection* RecoSelector::thePhotonCollection
private

Definition at line 68 of file RecoSelector.h.