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 Member Functions | Private Attributes
ZgammaMassFilter Class Reference

#include <ZgammaMassFilter.h>

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

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 ZgammaMassFilter (const edm::ParameterSet &)
 
 ~ZgammaMassFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

int charge (const int &Id)
 

Private Attributes

double maxLeptonEta
 
double maxPhotonEta
 
double minDileptonMass
 
double minLeptonEta
 
double minLeptonPt
 
double minPhotonEta
 
double minPhotonPt
 
double minZgMass
 
edm::EDGetTokenT
< edm::HepMCProduct
token_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
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 &)
 
- 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 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 43 of file ZgammaMassFilter.h.

Constructor & Destructor Documentation

ZgammaMassFilter::ZgammaMassFilter ( const edm::ParameterSet iConfig)
explicit

Definition at line 22 of file ZgammaMassFilter.cc.

References edm::ParameterSet::getParameter().

23 {
24  token_ =consumes<edm::HepMCProduct>(iConfig.getParameter<InputTag>("HepMCProduct"));
25  minPhotonPt =iConfig.getParameter<double>("minPhotonPt");
26  minLeptonPt =iConfig.getParameter<double>("minLeptonPt");
27  minPhotonEta =iConfig.getParameter<double>("minPhotonEta");
28  minLeptonEta =iConfig.getParameter<double>("minLeptonEta");
29  maxPhotonEta =iConfig.getParameter<double>("maxPhotonEta");
30  maxLeptonEta =iConfig.getParameter<double>("maxLeptonEta");
31  minDileptonMass =iConfig.getParameter<double>("minDileptonMass");
32  minZgMass =iConfig.getParameter<double>("minZgMass");
33 }
edm::EDGetTokenT< edm::HepMCProduct > token_
T getParameter(std::string const &) const
ZgammaMassFilter::~ZgammaMassFilter ( )

Definition at line 35 of file ZgammaMassFilter.cc.

36 {
37 }

Member Function Documentation

int ZgammaMassFilter::charge ( const int &  Id)
private
bool ZgammaMassFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDFilter.

Definition at line 40 of file ZgammaMassFilter.cc.

References funct::abs(), edm::Event::getByToken(), AlCaHLTBitMon_ParallelJobs::p, and configurableAnalysis::Photon.

41 {
42  using namespace edm;
43 
44  bool accepted = false;
46  iEvent.getByToken(token_, evt);
47  const HepMC::GenEvent * myGenEvent = evt->GetEvent();
48 
49  vector<TLorentzVector> Lepton; Lepton.clear();
50  vector<TLorentzVector> Photon; Photon.clear();
51  vector<float> Charge; Charge.clear();
52 
53  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
54  p != myGenEvent->particles_end(); ++p )
55  {
56  if ((*p)->status() == 1 && (abs((*p)->pdg_id()) == 11 || abs((*p)->pdg_id()) == 13 || abs((*p)->pdg_id()) == 15)) {
57  TLorentzVector LeptP((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz(), (*p)->momentum().e());
58  if (LeptP.Pt() > minLeptonPt) {
59  Lepton.push_back(LeptP);
60  } // if pt
61  }// if lepton
62 
63  if ( abs((*p)->pdg_id()) == 22 && (*p)->status() == 1) {
64  TLorentzVector PhotP((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz(), (*p)->momentum().e());
65  if (PhotP.Pt() > minPhotonPt) {
66  Photon.push_back(PhotP);
67  }// if pt
68  }// if photon
69 
70  }// loop over particles
71 
72 
73  // std::cout << "\n" << "Photon size: " << Photon.size() << std::endl;
74  // for (unsigned int u=0; u<Photon.size(); u++){
75  // std::cout << "BEF photon PT: " << Photon[u].Pt() << std::endl;
76  // }
77  // std::cout << "\n" << "Lepton size: " << Lepton.size() << std::endl;
78  // for (unsigned int u=0; u<Lepton.size(); u++){
79  // std::cout << "BEF lepton PT: " << Lepton[u].Pt() << std::endl;
80  // }
81 
82  // order Lepton and Photon according to Pt
83  std::stable_sort(Photon.begin(), Photon.end(), orderByPt());
84  std::stable_sort(Lepton.begin(), Lepton.end(), orderByPt());
85 
86  // std::cout << "\n" << std::endl;
87  // std::cout << "\n" << "Photon size: " << Photon.size() << std::endl;
88  // for (unsigned int u=0; u<Photon.size(); u++){
89  // std::cout << "AFT photon PT: " << Photon[u].Pt() << std::endl;
90  // }
91  // std::cout << "\n" << "Lepton size: " << Lepton.size() << std::endl;
92  // for (unsigned int u=0; u<Lepton.size(); u++){
93  // std::cout << "AFT lepton PT: " << Lepton[u].Pt() << std::endl;
94  // }
95  // std::cout << "\n" << std::endl;
96 
97  if (
98  Photon.size() > 0 && Lepton.size() > 1 &&
99  Photon[0].Pt() > minPhotonPt &&
100  Lepton[0].Pt() > minLeptonPt &&
101  Lepton[1].Pt() > minLeptonPt &&
102  Photon[0].Eta() > minPhotonEta &&
103  Lepton[0].Eta() > minLeptonEta &&
104  Lepton[1].Eta() > minLeptonEta &&
105  Photon[0].Eta() < maxPhotonEta &&
106  Lepton[0].Eta() < maxLeptonEta &&
107  Lepton[1].Eta() < maxLeptonEta &&
108  (Lepton[0]+Lepton[1]).M() > minDileptonMass &&
109  (Lepton[0]+Lepton[1]+Photon[0]).M() > minZgMass
110  )
111  { // satisfy molteplicity, kinematics, and ll llg minimum mass
112  accepted = true;
113  }
114 
115  // std::cout << "++ returning: " << accepted << "\n" << std::endl;
116 
117  return accepted;
118 }
edm::EDGetTokenT< edm::HepMCProduct > token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

double ZgammaMassFilter::maxLeptonEta
private

Definition at line 65 of file ZgammaMassFilter.h.

double ZgammaMassFilter::maxPhotonEta
private

Definition at line 64 of file ZgammaMassFilter.h.

double ZgammaMassFilter::minDileptonMass
private

Definition at line 67 of file ZgammaMassFilter.h.

double ZgammaMassFilter::minLeptonEta
private

Definition at line 62 of file ZgammaMassFilter.h.

double ZgammaMassFilter::minLeptonPt
private

Definition at line 59 of file ZgammaMassFilter.h.

double ZgammaMassFilter::minPhotonEta
private

Definition at line 61 of file ZgammaMassFilter.h.

double ZgammaMassFilter::minPhotonPt
private

Definition at line 58 of file ZgammaMassFilter.h.

double ZgammaMassFilter::minZgMass
private

Definition at line 68 of file ZgammaMassFilter.h.

edm::EDGetTokenT<edm::HepMCProduct> ZgammaMassFilter::token_
private

Definition at line 56 of file ZgammaMassFilter.h.