CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

TopProjector< Top, Bottom, Matcher > Class Template Reference

#include <TopProjector.h>

Inheritance diagram for TopProjector< Top, Bottom, Matcher >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef std::vector< Bottom > BottomCollection
typedef edm::FwdPtr< Bottom > BottomFwdPtr
typedef std::vector< BottomFwdPtrBottomFwdPtrCollection
typedef edm::Handle
< BottomFwdPtrCollection
BottomFwdPtrHandle
typedef edm::Handle
< std::vector< Bottom > > 
BottomHandle
typedef edm::Ptr< Bottom > BottomPtr
typedef edm::Ref
< BottomCollection
BottomRef
typedef std::vector< Top > TopCollection
typedef edm::FwdPtr< Top > TopFwdPtr
typedef std::vector< TopFwdPtrTopFwdPtrCollection
typedef edm::Handle
< TopFwdPtrCollection
TopFwdPtrHandle
typedef edm::Handle
< std::vector< Top > > 
TopHandle

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 TopProjector (const edm::ParameterSet &)
 ~TopProjector ()

Private Attributes

bool enable_
 enable? if not, all candidates in the bottom collection are copied to the output collection
edm::InputTag inputTagBottom_
 input tag for the masked collection.
edm::InputTag inputTagTop_
 input tag for the top (masking) collection
Matcher match_
 Matching method.
std::string name_
 name of the top projection

Detailed Description

template<class Top, class Bottom, class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
class TopProjector< Top, Bottom, Matcher >

Author:
Colin Bernet
Date:
february 2008

Definition at line 137 of file TopProjector.h.


Member Typedef Documentation

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef std::vector<Bottom> TopProjector< Top, Bottom, Matcher >::BottomCollection

Definition at line 147 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef edm::FwdPtr<Bottom> TopProjector< Top, Bottom, Matcher >::BottomFwdPtr

Definition at line 151 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef std::vector<BottomFwdPtr> TopProjector< Top, Bottom, Matcher >::BottomFwdPtrCollection

Definition at line 152 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef edm::Handle< BottomFwdPtrCollection > TopProjector< Top, Bottom, Matcher >::BottomFwdPtrHandle

Definition at line 153 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef edm::Handle< std::vector<Bottom> > TopProjector< Top, Bottom, Matcher >::BottomHandle

Definition at line 148 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef edm::Ptr<Bottom> TopProjector< Top, Bottom, Matcher >::BottomPtr

Definition at line 149 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef edm::Ref<BottomCollection> TopProjector< Top, Bottom, Matcher >::BottomRef

Definition at line 150 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef std::vector<Top> TopProjector< Top, Bottom, Matcher >::TopCollection

Definition at line 141 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef edm::FwdPtr<Top> TopProjector< Top, Bottom, Matcher >::TopFwdPtr

Definition at line 143 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef std::vector<TopFwdPtr> TopProjector< Top, Bottom, Matcher >::TopFwdPtrCollection

Definition at line 144 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef edm::Handle< TopFwdPtrCollection > TopProjector< Top, Bottom, Matcher >::TopFwdPtrHandle

Definition at line 145 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
typedef edm::Handle< std::vector<Top> > TopProjector< Top, Bottom, Matcher >::TopHandle

Definition at line 142 of file TopProjector.h.


Constructor & Destructor Documentation

template<class Top , class Bottom , class Matcher >
TopProjector< Top, Bottom, Matcher >::TopProjector ( const edm::ParameterSet iConfig)

Definition at line 184 of file TopProjector.h.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), TopProjector< Top, Bottom, Matcher >::inputTagBottom_, TopProjector< Top, Bottom, Matcher >::inputTagTop_, TopProjector< Top, Bottom, Matcher >::name_, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                                : 
  match_(iConfig),
  enable_(iConfig.getParameter<bool>("enable")) {
  name_ = iConfig.getUntrackedParameter<std::string>("name","No Name");
  inputTagTop_ = iConfig.getParameter<edm::InputTag>("topCollection");
  inputTagBottom_ = iConfig.getParameter<edm::InputTag>("bottomCollection");

  // will produce a collection of the unmasked candidates in the 
  // bottom collection 
  produces< BottomFwdPtrCollection > ();
}
template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
TopProjector< Top, Bottom, Matcher >::~TopProjector ( ) [inline]

Definition at line 157 of file TopProjector.h.

{};

Member Function Documentation

template<class Top , class Bottom , class Matcher >
void TopProjector< Top, Bottom, Matcher >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 198 of file TopProjector.h.

References newFWLiteAna::found, edm::Event::getByLabel(), i, LogDebug, and edm::Event::put().

                                                                       {
  // get the various collections

  // Access the masking collection
  TopFwdPtrHandle tops;
  iEvent.getByLabel(  inputTagTop_, tops );
  std::list<  TopFwdPtr > topsList;

  for ( typename TopFwdPtrCollection::const_iterator ibegin = tops->begin(), 
          iend = tops->end(), i = ibegin; i != iend; ++i ) {
    topsList.push_back( *i );
  }


/*   if( !tops.isValid() ) { */
/*     std::ostringstream  err; */
/*     err<<"The top collection must be supplied."<<std::endl */
/*        <<"It is now set to : "<<inputTagTop_<<std::endl; */
/*     edm::LogError("PFPAT")<<err.str(); */
/*     throw cms::Exception( "MissingProduct", err.str()); */
/*   } */


  

  // Access the collection to
  // be masked by the other ones
  BottomFwdPtrHandle bottoms;
  iEvent.getByLabel(  inputTagBottom_, bottoms );

/*   if( !bottoms.isValid() ) { */
/*     std::ostringstream  err; */
/*     err<<"The bottom collection must be supplied."<<std::endl */
/*        <<"It is now set to : "<<inputTagBottom_<<std::endl; */
/*     edm::LogError("PFPAT")<<err.str(); */
/*     throw cms::Exception( "MissingProduct", err.str()); */
/*   } */

 
  /* if(verbose_) { */
  /*   const edm::Provenance& topProv = iEvent.getProvenance(tops.id()); */
  /*   const edm::Provenance& bottomProv = iEvent.getProvenance(bottoms.id()); */

  /*   edm::LogDebug("TopProjection")<<"Top projector: event "<<iEvent.id().event()<<std::endl; */
  /*   edm::LogDebug("TopProjection")<<"Inputs --------------------"<<std::endl; */
  /*   edm::LogDebug("TopProjection")<<"Top      :  " */
  /*         <<tops.id()<<"\t"<<tops->size()<<std::endl */
  /*         <<topProv.branchDescription()<<std::endl; */

  /*   for(unsigned i=0; i<tops->size(); i++) { */
  /*     TopFwdPtr top = (*tops)[i]; */
  /*     edm::LogDebug("TopProjection") << "< " << i << " " << top.key() << " : " << *top << std::endl; */
  /*   } */


  /*   edm::LogDebug("TopProjection")<<"Bottom   :  " */
  /*         <<bottoms.id()<<"\t"<<bottoms->size()<<std::endl */
  /*         <<bottomProv.branchDescription()<<std::endl; */

  /*   for(unsigned i=0; i<bottoms->size(); i++) { */
  /*     BottomFwdPtr bottom = (*bottoms)[i]; */
  /*     edm::LogDebug("TopProjection") << "> " << i << " " << bottom.key() << " : " << *bottom << std::endl; */
  /*   } */

  /* } */


  // output collection of FwdPtrs to objects,
  // selected from the Bottom collection
  std::auto_ptr< BottomFwdPtrCollection > 
    pBottomFwdPtrOutput( new BottomFwdPtrCollection );

  LogDebug("TopProjection")<<" Remaining candidates in the bottom collection ------ ";
  
  for(typename BottomFwdPtrCollection::const_iterator i=bottoms->begin(),
        iend = bottoms->end(), ibegin = i; i != iend; ++i) {

    BottomFwdPtr const & bottom = *i;
    match_.setBottom(bottom);
    typename std::list< TopFwdPtr >::iterator found = topsList.end();
    if ( enable_ ) {
      found = std::find_if( topsList.begin(), topsList.end(), match_ );
    }

    // If this is masked in the top projection, we remove it. 
    if( found != topsList.end() ) {
      LogDebug("TopProjection")<<"X "<<i-ibegin << **i;
      topsList.erase(found);
      continue;
    }
    // otherwise, we keep it. 
    else {
      LogDebug("TopProjection")<<"O "<<i-ibegin << **i;
      pBottomFwdPtrOutput->push_back( bottom );
    }
  }

  iEvent.put( pBottomFwdPtrOutput ); 
}

Member Data Documentation

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
bool TopProjector< Top, Bottom, Matcher >::enable_ [private]

enable? if not, all candidates in the bottom collection are copied to the output collection

Definition at line 168 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
edm::InputTag TopProjector< Top, Bottom, Matcher >::inputTagBottom_ [private]

input tag for the masked collection.

Definition at line 177 of file TopProjector.h.

Referenced by TopProjector< Top, Bottom, Matcher >::TopProjector().

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
edm::InputTag TopProjector< Top, Bottom, Matcher >::inputTagTop_ [private]

input tag for the top (masking) collection

Definition at line 174 of file TopProjector.h.

Referenced by TopProjector< Top, Bottom, Matcher >::TopProjector().

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
Matcher TopProjector< Top, Bottom, Matcher >::match_ [private]

Matching method.

Definition at line 165 of file TopProjector.h.

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
std::string TopProjector< Top, Bottom, Matcher >::name_ [private]

name of the top projection

Definition at line 171 of file TopProjector.h.

Referenced by TopProjector< Top, Bottom, Matcher >::TopProjector().