CMS 3D CMS Logo

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::ProductRegistryHelper

List of all members.

Classes

struct  CutStruct

Public Member Functions

 BsJpsiPhiFilter (const edm::ParameterSet &)
virtual bool filter (edm::Event &, const edm::EventSetup &)
 ~BsJpsiPhiFilter ()

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
std::string label_
CutStruct leptonCuts
int noAccepted

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(), and edm::ParameterSet::getUntrackedParameter().

{
  label_ = iConfig.getUntrackedParameter("moduleLabel",std::string("generator"));
  hadronCuts.type = iConfig.getParameter< int >("hadronType");
  hadronCuts.etaMin = iConfig.getParameter<double>("hadronEtaMin");
  hadronCuts.etaMax = iConfig.getParameter<double>("hadronEtaMax");
  hadronCuts.ptMin = iConfig.getParameter<double>("hadronPtMin");
  leptonCuts.type = iConfig.getParameter< int >("leptonType");
  leptonCuts.etaMin = iConfig.getParameter<double>("leptonEtaMin");
  leptonCuts.etaMax = iConfig.getParameter<double>("leptonEtaMax");
  leptonCuts.ptMin = iConfig.getParameter<double>("leptonPtMin");

  noAccepted = 0;
}
BsJpsiPhiFilter::~BsJpsiPhiFilter ( )

Definition at line 25 of file BsJpsiPhiFilter.cc.

References gather_cfg::cout.

{  
  std::cout << "Total number of accepted events = " << noAccepted << std::endl;
}

Member Function Documentation

bool BsJpsiPhiFilter::cuts ( const HepMC::GenParticle *  jpsi,
const CutStruct  cut 
) [private]
bool BsJpsiPhiFilter::etaInRange ( float  eta,
float  etamin,
float  etamax 
) [private]

Definition at line 175 of file BsJpsiPhiFilter.cc.

{
  return ( (etamin < eta) && (eta < etamax) );
}
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, configurableAnalysis::GenParticle, edm::Event::getByLabel(), and phi.

{
  edm::Handle<HepMCProduct> evt;
  iEvent.getByLabel(label_, evt);
  
  const HepMC::GenEvent * generated_event = evt->GetEvent();
  //cout << "Start\n";

  bool event_passed = false;
  HepMC::GenEvent::particle_const_iterator bs = getNextBs(generated_event->particles_begin(), 
                                                    generated_event->particles_end());
  while (bs!=  generated_event->particles_end() ) {

    // vector< GenParticle * > bsChild = (*bs)->listChildren();

    //***
    HepMC::GenVertex* outVertex = (*bs)->end_vertex();
    //***
    
    GenParticle * jpsi = 0;
    GenParticle * phi = 0;
    // cout << "bs size "<<bsChild.size()<<endl;
    //***
    int numChildren = outVertex->particles_out_size();
    cout<< "bs size "<<numChildren<<endl;
    //***
    
    /*    if ((bsChild.size()==2) && ((jpsi = findParticle(bsChild, 443))!=0) && 
          ((phi = findParticle(bsChild, 333))!=0)) {
          cout << bsChild[0]->momentum()<<" "<<bsChild[0]->momentum().eta()
          <<" "<<bsChild[1]->momentum()<<" "<<bsChild[1]->momentum().eta()<<endl;
    */
    
    //***
    if( (numChildren==2) && ((jpsi = findParticle(outVertex, 443))!=0) && 
        ((phi = findParticle(outVertex, 333))!=0)) {
      
      cout << jpsi->momentum().rho()<<" "<<jpsi->momentum().eta()
           <<" "<<phi->momentum().rho() <<" "<<phi->momentum().eta()<<endl;
      cout <<"bs dec trouve"<<endl;
      if (cuts(phi, hadronCuts) && cuts(jpsi, leptonCuts)) {
        cout <<"OK trouve"<<endl;
        event_passed = true;
        break;
      }
    }
    bs = getNextBs(++bs, generated_event->particles_end());
  }
  
  if (event_passed) noAccepted++;
  cout << "End filter\n";
  
  delete generated_event; 
  
  return event_passed;
}
HepMC::GenParticle * BsJpsiPhiFilter::findParticle ( HepMC::GenVertex *  vertex,
const int  requested_id 
) [private]

Definition at line 44 of file BsJpsiPhiFilter.cc.

References abs, gather_cfg::cout, and L1TEmulatorMonitor_cff::p.

{
  for(std::vector<GenParticle*>::const_iterator p = vertex->particles_out_const_begin();
      p != vertex->particles_out_const_end(); p++)
    {
      int event_particle_id = abs( (*p)->pdg_id() );
      cout << "isC "<<event_particle_id<<"\n";
      if (requested_id == event_particle_id) return *p;
    }
  return 0;
}
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 abs, end, and L1TEmulatorMonitor_cff::p.

{
  HepMC::GenEvent::particle_const_iterator p;
  for (p = start; p != end; p++) 
    {
      int event_particle_id = abs( (*p)->pdg_id() );
//   cout << "search "<<event_particle_id<<"\n";
      if (event_particle_id == 531) return p;
    }
  return p;  
}

Member Data Documentation

Definition at line 60 of file BsJpsiPhiFilter.h.

std::string BsJpsiPhiFilter::label_ [private]

Definition at line 62 of file BsJpsiPhiFilter.h.

Definition at line 60 of file BsJpsiPhiFilter.h.

Definition at line 63 of file BsJpsiPhiFilter.h.