CMS 3D CMS Logo

Public Member Functions | Private Attributes

ZllArbitrator< T1 > Class Template Reference

Inheritance diagram for ZllArbitrator< T1 >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void endJob ()
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 ZllArbitrator (const edm::ParameterSet &iConfig)
virtual ~ZllArbitrator ()

Private Attributes

edm::InputTag srcZCand_

Detailed Description

template<typename T1>
class ZllArbitrator< T1 >

Definition at line 32 of file ZllArbitrator.cc.


Constructor & Destructor Documentation

template<typename T1 >
ZllArbitrator< T1 >::ZllArbitrator ( const edm::ParameterSet iConfig)

Definition at line 56 of file ZllArbitrator.cc.

  : srcZCand_(iConfig.getParameter<edm::InputTag>("ZCandidateCollection"))
{
  produces<std::vector<T1> >();
}
template<typename T1 >
ZllArbitrator< T1 >::~ZllArbitrator ( ) [virtual]

Definition at line 65 of file ZllArbitrator.cc.

{}

Member Function Documentation

template<typename T1 >
void ZllArbitrator< T1 >::endJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 108 of file ZllArbitrator.cc.

{
}
template<typename T1 >
void ZllArbitrator< T1 >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 73 of file ZllArbitrator.cc.

References edm::Event::getByLabel(), and edm::Event::put().

{
  std::stringstream ss ;
  
  std::auto_ptr<std::vector<T1> > TheBestZ(new std::vector<T1 >);
  
  edm::Handle< std::vector<T1> > ZCandidatesHandle;
  iEvent.getByLabel(srcZCand_,ZCandidatesHandle);
  
  if( ZCandidatesHandle->size() == 0 ) 
  {
    iEvent.put(TheBestZ);
    return ;
  }
  
  double ZmassPDG  = 91.18;
  double DeltaMass = 10000;
  
  typename std::vector<T1>::const_iterator ZCandIt   ;
  typename std::vector<T1>::const_iterator bestZCand ;

  for (ZCandIt = ZCandidatesHandle->begin(); ZCandIt != ZCandidatesHandle->end(); ++ZCandIt) {

        if( fabs(ZCandIt->mass()-ZmassPDG) < DeltaMass ){
          DeltaMass = fabs(ZCandIt->mass()-ZmassPDG) ;
          bestZCand = ZCandIt; 
        }
  }

  TheBestZ->push_back( *bestZCand );  
  iEvent.put(TheBestZ);
  
}

Member Data Documentation

template<typename T1 >
edm::InputTag ZllArbitrator< T1 >::srcZCand_ [private]

Definition at line 45 of file ZllArbitrator.cc.