CMS 3D CMS Logo

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

#include <BsJpsiPhiFilter.h>

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

Classes

struct  CutStruct
 

Public Member Functions

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

typedef std::vector
< HepMC::GenParticle * > 
GenPartVect
 
typedef std::vector
< HepMC::GenParticle * >
::const_iterator 
GenPartVectIt
 

Private Member Functions

bool cuts (const HepMC::GenParticle *jpsi, const CutStruct &cut)
 
bool etaInRange (float eta, float etamin, float etamax)
 
HepMC::GenParticle * findParticle (HepMC::GenVertex *, const int requested_id)
 
HepMC::GenEvent::particle_const_iterator getNextBs (const HepMC::GenEvent::particle_const_iterator start, const HepMC::GenEvent::particle_const_iterator end)
 

Private Attributes

CutStruct hadronCuts
 
CutStruct leptonCuts
 
int noAccepted
 
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 27 of file BsJpsiPhiFilter.h.

Member Typedef Documentation

typedef std::vector< HepMC::GenParticle * > BsJpsiPhiFilter::GenPartVect
private

Definition at line 44 of file BsJpsiPhiFilter.h.

typedef std::vector< HepMC::GenParticle * >::const_iterator BsJpsiPhiFilter::GenPartVectIt
private

Definition at line 45 of file BsJpsiPhiFilter.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file BsJpsiPhiFilter.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HLT_25ns14e33_v1_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

10 {
11  token_ = consumes<edm::HepMCProduct>(edm::InputTag(iConfig.getUntrackedParameter("moduleLabel",std::string("generator")),"unsmeared"));
12  hadronCuts.type = iConfig.getParameter< int >("hadronType");
13  hadronCuts.etaMin = iConfig.getParameter<double>("hadronEtaMin");
14  hadronCuts.etaMax = iConfig.getParameter<double>("hadronEtaMax");
15  hadronCuts.ptMin = iConfig.getParameter<double>("hadronPtMin");
16  leptonCuts.type = iConfig.getParameter< int >("leptonType");
17  leptonCuts.etaMin = iConfig.getParameter<double>("leptonEtaMin");
18  leptonCuts.etaMax = iConfig.getParameter<double>("leptonEtaMax");
19  leptonCuts.ptMin = iConfig.getParameter<double>("leptonPtMin");
20 
21  noAccepted = 0;
22 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
CutStruct hadronCuts
edm::EDGetTokenT< edm::HepMCProduct > token_
CutStruct leptonCuts
BsJpsiPhiFilter::~BsJpsiPhiFilter ( )

Definition at line 25 of file BsJpsiPhiFilter.cc.

References gather_cfg::cout.

26 {
27  std::cout << "Total number of accepted events = " << noAccepted << std::endl;
28 }
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

bool BsJpsiPhiFilter::cuts ( const HepMC::GenParticle *  jpsi,
const CutStruct cut 
)
private

Definition at line 148 of file BsJpsiPhiFilter.cc.

References funct::abs(), gather_cfg::cout, eta, BsJpsiPhiFilter::CutStruct::etaMax, BsJpsiPhiFilter::CutStruct::etaMin, AlCaHLTBitMon_ParallelJobs::p, BsJpsiPhiFilter::CutStruct::ptMin, and BsJpsiPhiFilter::CutStruct::type.

149 {
150  HepMC::GenVertex* myVertex = jpsi->end_vertex();
151  int numChildren = myVertex->particles_out_size();
152  std::vector<HepMC::GenParticle*> psiChild;
153  for(std::vector<GenParticle*>::const_iterator p = myVertex->particles_out_const_begin();
154  p != myVertex->particles_out_const_end(); p++)
155  psiChild.push_back((*p));
156 
157  if(numChildren>1) {
158  cout << psiChild[0]->pdg_id()<<" "<<psiChild[1]->pdg_id()<<endl;
159 
160  if (psiChild.size()==2 && (abs(psiChild[0]->pdg_id()) == cut.type) &&
161  (abs(psiChild[1]->pdg_id()) == cut.type))
162  {
163  cout << psiChild[0]->momentum().rho()<<" "<<psiChild[0]->momentum().eta()
164  <<" "<<psiChild[1]->momentum().rho()<<" "<<psiChild[1]->momentum().eta()<<endl;
165  return ( (etaInRange(psiChild[0]->momentum().eta(), cut.etaMin, cut.etaMax)) &&
166  (etaInRange(psiChild[1]->momentum().eta(), cut.etaMin, cut.etaMax)) &&
167  (psiChild[0]->momentum().perp()> cut.ptMin) &&
168  (psiChild[1]->momentum().perp()> cut.ptMin));
169  }
170  return false;
171  }
172  return false;
173 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool etaInRange(float eta, float etamin, float etamax)
#define jpsi
tuple cout
Definition: gather_cfg.py:121
bool BsJpsiPhiFilter::etaInRange ( float  eta,
float  etamin,
float  etamax 
)
private

Definition at line 175 of file BsJpsiPhiFilter.cc.

176 {
177  return ( (etamin < eta) && (eta < etamax) );
178 }
bool BsJpsiPhiFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDFilter.

Definition at line 72 of file BsJpsiPhiFilter.cc.

References gather_cfg::cout, ParticleFlowFastSim_cff::cuts, GenParticle::GenParticle, edm::Event::getByToken(), jpsi, and phi().

73 {
75  iEvent.getByToken(token_, evt);
76 
77  const HepMC::GenEvent * generated_event = evt->GetEvent();
78  //cout << "Start\n";
79 
80  bool event_passed = false;
81  HepMC::GenEvent::particle_const_iterator bs = getNextBs(generated_event->particles_begin(),
82  generated_event->particles_end());
83  while (bs!= generated_event->particles_end() ) {
84 
85  // vector< GenParticle * > bsChild = (*bs)->listChildren();
86 
87  //***
88  HepMC::GenVertex* outVertex = (*bs)->end_vertex();
89  //***
90 
91  GenParticle * jpsi = 0;
92  GenParticle * phi = 0;
93  // cout << "bs size "<<bsChild.size()<<endl;
94  //***
95  int numChildren = outVertex->particles_out_size();
96  cout<< "bs size "<<numChildren<<endl;
97  //***
98 
99  /* if ((bsChild.size()==2) && ((jpsi = findParticle(bsChild, 443))!=0) &&
100  ((phi = findParticle(bsChild, 333))!=0)) {
101  cout << bsChild[0]->momentum()<<" "<<bsChild[0]->momentum().eta()
102  <<" "<<bsChild[1]->momentum()<<" "<<bsChild[1]->momentum().eta()<<endl;
103  */
104 
105  //***
106  if( (numChildren==2) && ((jpsi = findParticle(outVertex, 443))!=0) &&
107  ((phi = findParticle(outVertex, 333))!=0)) {
108 
109  cout << jpsi->momentum().rho()<<" "<<jpsi->momentum().eta()
110  <<" "<<phi->momentum().rho() <<" "<<phi->momentum().eta()<<endl;
111  cout <<"bs dec trouve"<<endl;
112  if (cuts(phi, hadronCuts) && cuts(jpsi, leptonCuts)) {
113  cout <<"OK trouve"<<endl;
114  event_passed = true;
115  break;
116  }
117  }
118  bs = getNextBs(++bs, generated_event->particles_end());
119  }
120 
121  if (event_passed) noAccepted++;
122  cout << "End filter\n";
123 
124  delete generated_event;
125 
126  return event_passed;
127 }
bool cuts(const HepMC::GenParticle *jpsi, const CutStruct &cut)
CutStruct hadronCuts
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
HepMC::GenEvent::particle_const_iterator getNextBs(const HepMC::GenEvent::particle_const_iterator start, const HepMC::GenEvent::particle_const_iterator end)
edm::EDGetTokenT< edm::HepMCProduct > token_
HepMC::GenParticle * findParticle(HepMC::GenVertex *, const int requested_id)
CutStruct leptonCuts
#define jpsi
tuple cout
Definition: gather_cfg.py:121
HepMC::GenParticle * BsJpsiPhiFilter::findParticle ( HepMC::GenVertex *  vertex,
const int  requested_id 
)
private

Definition at line 44 of file BsJpsiPhiFilter.cc.

References funct::abs(), gather_cfg::cout, and AlCaHLTBitMon_ParallelJobs::p.

46 {
47  for(std::vector<GenParticle*>::const_iterator p = vertex->particles_out_const_begin();
48  p != vertex->particles_out_const_end(); p++)
49  {
50  int event_particle_id = abs( (*p)->pdg_id() );
51  cout << "isC "<<event_particle_id<<"\n";
52  if (requested_id == event_particle_id) return *p;
53  }
54  return 0;
55 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
HepMC::GenEvent::particle_const_iterator BsJpsiPhiFilter::getNextBs ( const HepMC::GenEvent::particle_const_iterator  start,
const HepMC::GenEvent::particle_const_iterator  end 
)
private

Definition at line 58 of file BsJpsiPhiFilter.cc.

References funct::abs(), end, and AlCaHLTBitMon_ParallelJobs::p.

60 {
61  HepMC::GenEvent::particle_const_iterator p;
62  for (p = start; p != end; p++)
63  {
64  int event_particle_id = abs( (*p)->pdg_id() );
65 // cout << "search "<<event_particle_id<<"\n";
66  if (event_particle_id == 531) return p;
67  }
68  return p;
69 }
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:37

Member Data Documentation

CutStruct BsJpsiPhiFilter::hadronCuts
private

Definition at line 60 of file BsJpsiPhiFilter.h.

CutStruct BsJpsiPhiFilter::leptonCuts
private

Definition at line 60 of file BsJpsiPhiFilter.h.

int BsJpsiPhiFilter::noAccepted
private

Definition at line 63 of file BsJpsiPhiFilter.h.

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

Definition at line 62 of file BsJpsiPhiFilter.h.