Public Member Functions | |
bestPVselector (const edm::ParameterSet &iConfig) | |
void | endJob () |
void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
virtual | ~bestPVselector () |
Private Attributes | |
edm::InputTag | src_ |
Definition at line 23 of file PVSorterBySumP.cc.
bestPVselector< T1 >::bestPVselector | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 47 of file PVSorterBySumP.cc.
: src_(iConfig.getParameter<edm::InputTag>("src")) { produces<std::vector<T1> >(); }
bestPVselector< T1 >::~bestPVselector | ( | ) | [virtual] |
Definition at line 56 of file PVSorterBySumP.cc.
{}
void bestPVselector< T1 >::endJob | ( | void | ) | [virtual] |
void bestPVselector< T1 >::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 64 of file PVSorterBySumP.cc.
References edm::Event::getByLabel(), p4, and edm::Event::put().
{ std::auto_ptr<std::vector<T1> > theBestPV(new std::vector<T1 >); edm::Handle< std::vector<T1> > VertexHandle; iEvent.getByLabel(src_,VertexHandle); if( VertexHandle->size() == 0 ) { iEvent.put(theBestPV); return ; } typename std::vector<T1>::const_iterator PVit ; typename std::vector<T1>::const_iterator bestPV ; double bestP4 = 0 ; double sumSquarePt = 0 ; for (PVit = VertexHandle->begin(); PVit != VertexHandle->end(); ++PVit) { sumSquarePt = (PVit -> p4().pt())*(PVit -> p4().pt()) ; if( sumSquarePt > bestP4 ){ bestP4 = sumSquarePt ; bestPV = PVit ; } } theBestPV->push_back( *bestPV ); iEvent.put(theBestPV); }
edm::InputTag bestPVselector< T1 >::src_ [private] |
Definition at line 36 of file PVSorterBySumP.cc.