CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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 Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 
 TopProjector (const edm::ParameterSet &)
 
 ~TopProjector ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 186 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_, AlCaHLTBitMon_QueryRunRegistry::string, TopProjector< Top, Bottom, Matcher >::tokenBottom_, and TopProjector< Top, Bottom, Matcher >::tokenTop_.

186  :
187  match_(iConfig),
188  enable_(iConfig.getParameter<bool>("enable")) {
189  name_ = iConfig.getUntrackedParameter<std::string>("name","No Name");
190  inputTagTop_ = iConfig.getParameter<edm::InputTag>("topCollection");
191  tokenTop_ = consumes<TopFwdPtrCollection>(inputTagTop_);
192  inputTagBottom_ = iConfig.getParameter<edm::InputTag>("bottomCollection");
193  tokenBottom_ = consumes<BottomFwdPtrCollection>(inputTagBottom_);
194 
195  // will produce a collection of the unmasked candidates in the
196  // bottom collection
197  produces< BottomFwdPtrCollection > ();
198 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< BottomFwdPtrCollection > tokenBottom_
Definition: TopProjector.h:179
Matcher match_
Matching method.
Definition: TopProjector.h:165
bool enable_
enable? if not, all candidates in the bottom collection are copied to the output collection ...
Definition: TopProjector.h:168
edm::InputTag inputTagBottom_
input tag for the masked collection.
Definition: TopProjector.h:178
std::string name_
name of the top projection
Definition: TopProjector.h:171
edm::InputTag inputTagTop_
input tag for the top (masking) collection
Definition: TopProjector.h:174
edm::EDGetTokenT< TopFwdPtrCollection > tokenTop_
Definition: TopProjector.h:175
template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
TopProjector< Top, Bottom, Matcher >::~TopProjector ( )
inline

Definition at line 157 of file TopProjector.h.

157 {};

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::stream::EDProducerBase.

Definition at line 202 of file TopProjector.h.

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

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

203  {
204  // get the various collections
205 
206  // Access the masking collection
207  TopFwdPtrHandle tops;
208  iEvent.getByToken( tokenTop_, tops );
209  std::list< TopFwdPtr > topsList;
210 
211  for ( typename TopFwdPtrCollection::const_iterator ibegin = tops->begin(),
212  iend = tops->end(), i = ibegin; i != iend; ++i ) {
213  topsList.push_back( *i );
214  }
215 
216 
217 /* if( !tops.isValid() ) { */
218 /* std::ostringstream err; */
219 /* err<<"The top collection must be supplied."<<std::endl */
220 /* <<"It is now set to : "<<inputTagTop_<<std::endl; */
221 /* edm::LogError("PFPAT")<<err.str(); */
222 /* throw cms::Exception( "MissingProduct", err.str()); */
223 /* } */
224 
225 
226 
227 
228  // Access the collection to
229  // be masked by the other ones
230  BottomFwdPtrHandle bottoms;
231  iEvent.getByToken( tokenBottom_, bottoms );
232 
233 /* if( !bottoms.isValid() ) { */
234 /* std::ostringstream err; */
235 /* err<<"The bottom collection must be supplied."<<std::endl */
236 /* <<"It is now set to : "<<inputTagBottom_<<std::endl; */
237 /* edm::LogError("PFPAT")<<err.str(); */
238 /* throw cms::Exception( "MissingProduct", err.str()); */
239 /* } */
240 
241 
242  /* if(verbose_) { */
243  /* const edm::Provenance& topProv = iEvent.getProvenance(tops.id()); */
244  /* const edm::Provenance& bottomProv = iEvent.getProvenance(bottoms.id()); */
245 
246  /* edm::LogDebug("TopProjection")<<"Top projector: event "<<iEvent.id().event()<<std::endl; */
247  /* edm::LogDebug("TopProjection")<<"Inputs --------------------"<<std::endl; */
248  /* edm::LogDebug("TopProjection")<<"Top : " */
249  /* <<tops.id()<<"\t"<<tops->size()<<std::endl */
250  /* <<topProv.branchDescription()<<std::endl; */
251 
252  /* for(unsigned i=0; i<tops->size(); i++) { */
253  /* TopFwdPtr top = (*tops)[i]; */
254  /* edm::LogDebug("TopProjection") << "< " << i << " " << top.key() << " : " << *top << std::endl; */
255  /* } */
256 
257 
258  /* edm::LogDebug("TopProjection")<<"Bottom : " */
259  /* <<bottoms.id()<<"\t"<<bottoms->size()<<std::endl */
260  /* <<bottomProv.branchDescription()<<std::endl; */
261 
262  /* for(unsigned i=0; i<bottoms->size(); i++) { */
263  /* BottomFwdPtr bottom = (*bottoms)[i]; */
264  /* edm::LogDebug("TopProjection") << "> " << i << " " << bottom.key() << " : " << *bottom << std::endl; */
265  /* } */
266 
267  /* } */
268 
269 
270  // output collection of FwdPtrs to objects,
271  // selected from the Bottom collection
272  std::auto_ptr< BottomFwdPtrCollection >
273  pBottomFwdPtrOutput( new BottomFwdPtrCollection );
274 
275  LogDebug("TopProjection")<<" Remaining candidates in the bottom collection ------ ";
276 
277  for(typename BottomFwdPtrCollection::const_iterator i=bottoms->begin(),
278  iend = bottoms->end(), ibegin = i; i != iend; ++i) {
279 
280  BottomFwdPtr const & bottom = *i;
281  match_.setBottom(bottom);
282  typename std::list< TopFwdPtr >::iterator found = topsList.end();
283  if ( enable_ ) {
284  found = std::find_if( topsList.begin(), topsList.end(), match_ );
285  }
286 
287  // If this is masked in the top projection, we remove it.
288  if( found != topsList.end() ) {
289  LogDebug("TopProjection")<<"X "<<i-ibegin << **i;
290  topsList.erase(found);
291  continue;
292  }
293  // otherwise, we keep it.
294  else {
295  LogDebug("TopProjection")<<"O "<<i-ibegin << **i;
296  pBottomFwdPtrOutput->push_back( bottom );
297  }
298  }
299 
300  iEvent.put( pBottomFwdPtrOutput );
301 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
edm::Handle< BottomFwdPtrCollection > BottomFwdPtrHandle
Definition: TopProjector.h:153
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::FwdPtr< Bottom > BottomFwdPtr
Definition: TopProjector.h:151
edm::Handle< TopFwdPtrCollection > TopFwdPtrHandle
Definition: TopProjector.h:145
edm::EDGetTokenT< BottomFwdPtrCollection > tokenBottom_
Definition: TopProjector.h:179
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
Matcher match_
Matching method.
Definition: TopProjector.h:165
bool enable_
enable? if not, all candidates in the bottom collection are copied to the output collection ...
Definition: TopProjector.h:168
edm::EDGetTokenT< TopFwdPtrCollection > tokenTop_
Definition: TopProjector.h:175
std::vector< BottomFwdPtr > BottomFwdPtrCollection
Definition: TopProjector.h:152

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 178 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().

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
edm::EDGetTokenT<BottomFwdPtrCollection> TopProjector< Top, Bottom, Matcher >::tokenBottom_
private

Definition at line 179 of file TopProjector.h.

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

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top,Bottom>>
edm::EDGetTokenT<TopFwdPtrCollection> TopProjector< Top, Bottom, Matcher >::tokenTop_
private

Definition at line 175 of file TopProjector.h.

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