Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:18

0001 #ifndef RecoAlgos_DetSetCounterSelector_h
0002 #define RecoAlgos_DetSetCounterSelector_h
0003 /* \class DetSetCounterSelector
0004  *
0005  * \author Marco Musich
0006  *
0007  * $Id: DetSetCounterSelector.h,v 1.6 2023/09/22 16:00:00 musich Exp $
0008  */
0009 
0010 #include "FWCore/Utilities/interface/TypeDemangler.h"
0011 
0012 struct DetSetCounterSelector {
0013   DetSetCounterSelector(unsigned int minDetSetCounts, unsigned int maxDetSetCounts)
0014       : minDetSetCounts_(minDetSetCounts), maxDetSetCounts_(maxDetSetCounts) {}
0015   template <typename T>
0016   bool operator()(const T& t) const {
0017 #ifdef EDM_ML_DEBUG
0018     std::string demangledName(edm::typeDemangle(typeid(T).name()));
0019     edm::LogVerbatim("DetSetCounterSelector") << "counting counts in: " << demangledName << std::endl;
0020 #endif
0021 
0022     // count the number of objects in the DetSet
0023     unsigned int totalDetSetCounts = t.size();
0024     return (totalDetSetCounts >= minDetSetCounts_ && totalDetSetCounts <= maxDetSetCounts_);
0025   }
0026 
0027 private:
0028   unsigned int minDetSetCounts_;
0029   unsigned int maxDetSetCounts_;
0030 };
0031 
0032 #endif