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
PythiaFilterZJetWithOutBg Class Reference

#include <PythiaFilterZJetWithOutBg.h>

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

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 PythiaFilterZJetWithOutBg (const edm::ParameterSet &)
 
 ~PythiaFilterZJetWithOutBg ()
 
- 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 Attributes

double dm_z
 
double etaMuMax
 
double m_z
 
int maxnumberofeventsinrun
 
int nmu
 
double ptMuMin
 
double ptZMax
 
double ptZMin
 
int theNumberOfSelected
 
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

PythiaFilterZJetWithOutBg filter implements generator-level preselections for photon+jet like events to be used in jet energy calibration. Ported from fortran code written by V.Konoplianikov.

Author
A.Ulyanov, ITEP

Definition at line 30 of file PythiaFilterZJetWithOutBg.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file PythiaFilterZJetWithOutBg.cc.

References dm_z, m_z, and theNumberOfSelected.

9  :
10 token_(consumes<edm::HepMCProduct>(edm::InputTag(iConfig.getUntrackedParameter("moduleLabel",std::string("generator")),"unsmeared"))),
11 etaMuMax(iConfig.getUntrackedParameter<double>("MaxMuonEta", 2.5)),
12 ptMuMin(iConfig.getUntrackedParameter<double>("MinMuonPt", 3.5)),
13 ptZMin(iConfig.getUntrackedParameter<double>("MinZPt")),
14 ptZMax(iConfig.getUntrackedParameter<double>("MaxZPt")),
15 maxnumberofeventsinrun(iConfig.getUntrackedParameter<int>("MaxEvents",10000))
16 {
17  m_z=91.19;
18  dm_z=10.;
20 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > token_
PythiaFilterZJetWithOutBg::~PythiaFilterZJetWithOutBg ( )

Definition at line 23 of file PythiaFilterZJetWithOutBg.cc.

23 {}

Member Function Documentation

bool PythiaFilterZJetWithOutBg::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDFilter.

Definition at line 27 of file PythiaFilterZJetWithOutBg.cc.

References funct::abs(), gather_cfg::cout, dm_z, eta, etaMuMax, edm::Event::getByToken(), m_z, RPCpg::mu, AlCaHLTBitMon_ParallelJobs::p, ptMuMin, ptZMax, ptZMin, mathSSE::sqrt(), theNumberOfSelected, and token_.

27  {
28 
29 // if(theNumberOfSelected>=maxnumberofeventsinrun) {
30 // throw cms::Exception("endJob")<<"we have reached the maximum number of events ";
31 // }
32 
33  bool accepted = false;
35  iEvent.getByToken(token_, evt);
36 
37  const HepMC::GenEvent * myGenEvent = evt->GetEvent();
38 
39 
40 
41  std::vector<const HepMC::GenParticle *> mu;
42 
43  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end(); ++p ) {
44 
45  if ( std::abs((*p)->pdg_id())==13 && (*p)->status()==1 )
46  mu.push_back(*p);
47  if(mu.size()>1) break;
48  }
49 
50 // std::cout<<" Number of muons "<<mu.size()<<" "<<mu[0]->pdg_id()<<" "<<mu[1]->pdg_id()<<std::endl;
51 
52  if(mu.size() != 2) return false;
53 
54  if(mu[0]->pdg_id()*(mu[1]->pdg_id()) > 0) {
55  return false;
56  }
57 
58 // std::cout<<" Muons sign accept "<<mu[0]->momentum().perp()<<" "<<mu[1]->momentum().perp()<<std::endl;
59 
60  if(mu[0]->momentum().perp()<ptMuMin || mu[1]->momentum().perp()<ptMuMin) return false;
61 
62 // std::cout<<" Muons pt accept "<<std::fabs(mu[0]->momentum().eta())<<" "<<std::fabs(mu[1]->momentum().eta())<<std::endl;
63 
64  if(std::fabs(mu[0]->momentum().eta()) > etaMuMax) return false;
65  if(std::fabs(mu[1]->momentum().eta()) > etaMuMax) return false;
66 
67 
68  double mmup = mu[0]->generatedMass();
69  double mmum = mu[1]->generatedMass();
70  double pxZ = mu[0]->momentum().x()+mu[1]->momentum().x();
71  double pyZ = mu[0]->momentum().y()+mu[1]->momentum().y();
72  double pzZ = mu[0]->momentum().z()+mu[1]->momentum().z();
73 
74  double pmup2 = mu[0]->momentum().x()*mu[0]->momentum().x()+
75  mu[0]->momentum().y()*mu[0]->momentum().y()+
76  mu[0]->momentum().z()*mu[0]->momentum().z();
77  double pmum2 = mu[1]->momentum().x()*mu[1]->momentum().x()+
78  mu[1]->momentum().y()*mu[1]->momentum().y()+
79  mu[1]->momentum().z()*mu[1]->momentum().z();
80  double emup = sqrt(pmup2+mmup*mmup);
81  double emum = sqrt(pmum2+mmum*mmum);
82 
83  double massZ = sqrt((emup+emum)*(emup+emum)-pxZ*pxZ-pyZ*pyZ-pzZ*pzZ);
84 
85 // std::cout<<" Muons eta accept "<<massZ<<std::endl;
86 
87 
88  if(std::fabs(massZ-m_z)>dm_z) return false;
89 
90  // double ptZ= (mu[0]->momentum() + mu[1]->momentum()).perp();
91 // std::cout<<" MassZ accept "<<ptZ<<std::endl;
92 
93  math::XYZTLorentzVector tot_mom(mu[0]->momentum());
94  math::XYZTLorentzVector mom2(mu[1]->momentum());
95  tot_mom += mom2;
96  // double ptZ= (mu[0]->momentum() + mu[1]->momentum()).perp();
97  double ptZ = tot_mom.pt();
98 
99 
100  if (ptZ > ptZMin && ptZ < ptZMax ) accepted=true;
101 
102 
103  if (accepted) {
105  std::cout<<" Event accept "<<theNumberOfSelected<<std::endl;
106  return true;
107  }
108  else return false;
109 
110 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
edm::EDGetTokenT< edm::HepMCProduct > token_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const int mu
Definition: Constants.h:22
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

double PythiaFilterZJetWithOutBg::dm_z
private

Definition at line 45 of file PythiaFilterZJetWithOutBg.h.

Referenced by filter(), and PythiaFilterZJetWithOutBg().

double PythiaFilterZJetWithOutBg::etaMuMax
private

Definition at line 40 of file PythiaFilterZJetWithOutBg.h.

Referenced by filter().

double PythiaFilterZJetWithOutBg::m_z
private

Definition at line 44 of file PythiaFilterZJetWithOutBg.h.

Referenced by filter(), and PythiaFilterZJetWithOutBg().

int PythiaFilterZJetWithOutBg::maxnumberofeventsinrun
private

Definition at line 49 of file PythiaFilterZJetWithOutBg.h.

int PythiaFilterZJetWithOutBg::nmu
private

Definition at line 46 of file PythiaFilterZJetWithOutBg.h.

double PythiaFilterZJetWithOutBg::ptMuMin
private

Definition at line 41 of file PythiaFilterZJetWithOutBg.h.

Referenced by filter().

double PythiaFilterZJetWithOutBg::ptZMax
private

Definition at line 43 of file PythiaFilterZJetWithOutBg.h.

Referenced by filter().

double PythiaFilterZJetWithOutBg::ptZMin
private

Definition at line 42 of file PythiaFilterZJetWithOutBg.h.

Referenced by filter().

int PythiaFilterZJetWithOutBg::theNumberOfSelected
private

Definition at line 48 of file PythiaFilterZJetWithOutBg.h.

Referenced by filter(), and PythiaFilterZJetWithOutBg().

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

Definition at line 39 of file PythiaFilterZJetWithOutBg.h.

Referenced by filter().