CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Attributes

JetConstituentSelector< T > Class Template Reference

Inheritance diagram for JetConstituentSelector< T >:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef std::vector< typename
T::ConstituentTypeFwdPtr > 
ConstituentsOutput
typedef std::vector< TJetsOutput

Public Member Functions

virtual void beginJob ()
virtual void endJob ()
virtual bool filter (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 JetConstituentSelector (edm::ParameterSet const &params)
virtual ~JetConstituentSelector ()

Protected Attributes

std::string cut_
bool filter_
StringCutObjectSelector< Tselector_
edm::InputTag src_

Detailed Description

template<class T>
class JetConstituentSelector< T >

Definition at line 30 of file JetConstituentSelector.cc.


Member Typedef Documentation

template<class T >
typedef std::vector<typename T::ConstituentTypeFwdPtr> JetConstituentSelector< T >::ConstituentsOutput

Definition at line 35 of file JetConstituentSelector.cc.

template<class T >
typedef std::vector<T> JetConstituentSelector< T >::JetsOutput

Definition at line 34 of file JetConstituentSelector.cc.


Constructor & Destructor Documentation

template<class T >
JetConstituentSelector< T >::JetConstituentSelector ( edm::ParameterSet const &  params) [inline]

Definition at line 37 of file JetConstituentSelector.cc.

                                                            :
      src_( params.getParameter<edm::InputTag>("src") ),
      cut_( params.getParameter<std::string>("cut") ),
      filter_(false),
      selector_( cut_ )
  {
        produces< JetsOutput >();
        produces< ConstituentsOutput > ("constituents");
  }
template<class T >
virtual JetConstituentSelector< T >::~JetConstituentSelector ( ) [inline, virtual]

Definition at line 47 of file JetConstituentSelector.cc.

{}

Member Function Documentation

template<class T >
virtual void JetConstituentSelector< T >::beginJob ( void  ) [inline, virtual]

Reimplemented from edm::EDFilter.

Definition at line 49 of file JetConstituentSelector.cc.

{}
template<class T >
virtual void JetConstituentSelector< T >::endJob ( void  ) [inline, virtual]

Reimplemented from edm::EDFilter.

Definition at line 50 of file JetConstituentSelector.cc.

{}
template<class T >
virtual bool JetConstituentSelector< T >::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [inline, override, virtual]

Implements edm::EDFilter.

Definition at line 52 of file JetConstituentSelector.cc.

References JetConstituentSelector< T >::filter_, edm::Event::getByLabel(), fwrapper::jets, edm::Event::put(), JetConstituentSelector< T >::selector_, and JetConstituentSelector< T >::src_.

                                                                                {

      std::auto_ptr< JetsOutput > jets ( new std::vector<T>() ); 
      std::auto_ptr< ConstituentsOutput > candsOut( new ConstituentsOutput  );

      edm::Handle< typename edm::View<T> > h_jets;
      iEvent.getByLabel( src_, h_jets );

      // Now set the Ptrs with the orphan handles. 
      for ( typename edm::View<T>::const_iterator ibegin = h_jets->begin(),
              iend = h_jets->end(), ijet = ibegin;
            ijet != iend; ++ijet ) {

        // Check the selection
        if ( selector_(*ijet) ) {
          // Add the jets that pass to the output collection
          jets->push_back( *ijet );
          for ( unsigned int ida = 0; ida < ijet->numberOfDaughters(); ++ida ) {
            candsOut->push_back( typename ConstituentsOutput::value_type( ijet->getPFConstituent(ida), ijet->getPFConstituent(ida) ) );
          }
        }
      }

      // put  in Event
      bool pass = jets->size() > 0;
      iEvent.put(jets);
      iEvent.put(candsOut, "constituents");

      if ( filter_ ) 
        return pass;
      else 
        return true;
      
    }

Member Data Documentation

template<class T >
std::string JetConstituentSelector< T >::cut_ [protected]

Definition at line 89 of file JetConstituentSelector.cc.

template<class T >
bool JetConstituentSelector< T >::filter_ [protected]

Definition at line 90 of file JetConstituentSelector.cc.

Referenced by JetConstituentSelector< T >::filter().

template<class T >
StringCutObjectSelector<T> JetConstituentSelector< T >::selector_ [protected]

Definition at line 91 of file JetConstituentSelector.cc.

Referenced by JetConstituentSelector< T >::filter().

template<class T >
edm::InputTag JetConstituentSelector< T >::src_ [protected]

Definition at line 88 of file JetConstituentSelector.cc.

Referenced by JetConstituentSelector< T >::filter().