CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

JetVertexChecker Class Reference

#include <RecoBTag/JetVertexChecker/src/JetVertexChecker.cc>

Inheritance diagram for JetVertexChecker:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 JetVertexChecker (const edm::ParameterSet &)
 ~JetVertexChecker ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Member Functions

virtual void beginJob ()
virtual bool beginLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
virtual bool beginRun (edm::Run &, edm::EventSetup const &)
virtual void endJob ()
virtual bool endLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
virtual bool endRun (edm::Run &, edm::EventSetup const &)
virtual bool filter (edm::Event &, const edm::EventSetup &)

Private Attributes

edm::InputTag m_associator
edm::InputTag m_beamSpot
double m_cutMinPt
double m_cutMinPtRatio
bool m_doFilter
int32_t m_maxNjets
edm::InputTag m_primaryVertexProducer

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 48 of file JetVertexChecker.cc.


Constructor & Destructor Documentation

JetVertexChecker::JetVertexChecker ( const edm::ParameterSet iConfig) [explicit]

Definition at line 87 of file JetVertexChecker.cc.

References edm::ParameterSet::getParameter(), m_associator, m_beamSpot, m_cutMinPt, m_cutMinPtRatio, m_doFilter, and m_maxNjets.

{
   //now do what ever initialization is needed
  m_beamSpot          = iConfig.getParameter<edm::InputTag>("beamSpot");
  m_associator              = iConfig.getParameter<edm::InputTag>("jetTracks");
  m_doFilter                = iConfig.getParameter<bool>("doFilter");
  m_cutMinPt                = iConfig.getParameter<double>("minPt");
  m_cutMinPtRatio           = iConfig.getParameter<double>("minPtRatio");
  m_maxNjets           = iConfig.getParameter<int32_t>("maxNJetsToCheck");
  produces<std::vector<reco::CaloJet> >(); 
  produces<reco::VertexCollection >(); 
}
JetVertexChecker::~JetVertexChecker ( )

Definition at line 101 of file JetVertexChecker.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void JetVertexChecker::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 168 of file JetVertexChecker.cc.

{
}
bool JetVertexChecker::beginLuminosityBlock ( edm::LuminosityBlock ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 193 of file JetVertexChecker.cc.

{
  return true;
}
bool JetVertexChecker::beginRun ( edm::Run ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 179 of file JetVertexChecker.cc.

{ 
  return true;
}
void JetVertexChecker::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 174 of file JetVertexChecker.cc.

                         {
}
bool JetVertexChecker::endLuminosityBlock ( edm::LuminosityBlock ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 200 of file JetVertexChecker.cc.

{
  return true;
}
bool JetVertexChecker::endRun ( edm::Run ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 186 of file JetVertexChecker.cc.

{
  return true;
}
void JetVertexChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDFilter.

Definition at line 207 of file JetVertexChecker.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

                                                                             {
  //The following says we do not know what parameters are allowed so do no validation
  // Please change this to state exactly what you do use, even if it is no parameters
  edm::ParameterSetDescription desc;
  desc.setUnknown();
  descriptions.addDefault(desc);
}
bool JetVertexChecker::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDFilter.

Definition at line 116 of file JetVertexChecker.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, edm::RefVector< C, T, F >::begin(), alignCSCRings::e, edm::RefVector< C, T, F >::end(), edm::Event::getByLabel(), i, m_associator, m_beamSpot, m_cutMinPt, m_cutMinPtRatio, m_doFilter, m_maxNjets, AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), query::result, and testEve_cfg::tracks.

{
   using namespace edm;
   Handle<reco::JetTracksAssociationCollection> jetTracksAssociation;
   iEvent.getByLabel(m_associator, jetTracksAssociation);
   std::auto_ptr<std::vector<reco::CaloJet> > pOut(new std::vector<reco::CaloJet> );

   bool result=true;
   int i = 0;
   //limit to first two jets
   for(reco::JetTracksAssociationCollection::const_iterator it = jetTracksAssociation->begin();
       it != jetTracksAssociation->end() && i < m_maxNjets; it++, i++) {
     if(fabs(it->first->eta()) < 2.4)
     {
      reco::TrackRefVector tracks = it->second;
      math::XYZVector jetMomentum = it->first->momentum();
      math::XYZVector trMomentum;
      for(reco::TrackRefVector::const_iterator itTrack = tracks.begin(); itTrack != tracks.end(); ++itTrack) 
      {
             trMomentum += (*itTrack)->momentum();
      }
      if(trMomentum.rho()/jetMomentum.rho() < m_cutMinPtRatio || trMomentum.rho() < m_cutMinPt) 
      {
//        std::cout << "bad jet " << it->first->pt() << std::endl;
        pOut->push_back(* dynamic_cast<const reco::CaloJet *>(&(*it->first)));
        result=false;
      }
     }
    } 
  
    iEvent.put(pOut);

   edm::Handle<reco::BeamSpot> beamSpot;
   iEvent.getByLabel(m_beamSpot,beamSpot);
 
   reco::Vertex::Error e;
   e(0, 0) = 0.0015 * 0.0015;
   e(1, 1) = 0.0015 * 0.0015;
   e(2, 2) = 1.5 * 1.5;
   reco::Vertex::Point p(beamSpot->x0(), beamSpot->y0(), beamSpot->z0());
   reco::Vertex thePV(p, e, 0, 0, 0);
   std::auto_ptr<reco::VertexCollection> pOut2(new reco::VertexCollection);
   pOut2->push_back(thePV);
   iEvent.put(pOut2);
//   std::cout << " filter " << result << std::endl;
   if(m_doFilter) return result;
   else 
   return true;
}

Member Data Documentation

Definition at line 66 of file JetVertexChecker.cc.

Referenced by filter(), and JetVertexChecker().

Definition at line 68 of file JetVertexChecker.cc.

Referenced by filter(), and JetVertexChecker().

double JetVertexChecker::m_cutMinPt [private]

Definition at line 70 of file JetVertexChecker.cc.

Referenced by filter(), and JetVertexChecker().

Definition at line 71 of file JetVertexChecker.cc.

Referenced by filter(), and JetVertexChecker().

Definition at line 69 of file JetVertexChecker.cc.

Referenced by filter(), and JetVertexChecker().

int32_t JetVertexChecker::m_maxNjets [private]

Definition at line 72 of file JetVertexChecker.cc.

Referenced by filter(), and JetVertexChecker().

Definition at line 67 of file JetVertexChecker.cc.