CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::ModelFilter Class Reference

#include <ModelFilter.h>

Inheritance diagram for edm::ModelFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< std::string >::const_iterator comments_const_iterator
 
- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 ModelFilter (const edm::ParameterSet &)
 
std::vector< std::string > split (std::string fstring, std::string splitter)
 
 ~ModelFilter () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::string modelTag_
 
std::vector< double > parameterMaxs_
 
std::vector< double > parameterMins_
 
edm::EDGetTokenT< LHEEventProducttokenSource_
 

Additional Inherited Members

- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Definition at line 22 of file ModelFilter.h.

Member Typedef Documentation

typedef std::vector<std::string>::const_iterator edm::ModelFilter::comments_const_iterator

Definition at line 30 of file ModelFilter.h.

Constructor & Destructor Documentation

ModelFilter::ModelFilter ( const edm::ParameterSet iConfig)
explicit

Definition at line 12 of file ModelFilter.cc.

References edm::ParameterSet::getParameter().

13 {
14  tokenSource_ = consumes<LHEEventProduct>(iConfig.getParameter<InputTag>("source"));
15  modelTag_ = iConfig.getParameter<string>("modelTag");
16  parameterMins_ = iConfig.getParameter<vector<double> >("parameterMins");
17  parameterMaxs_ = iConfig.getParameter<vector<double> >("parameterMaxs");
18 }
T getParameter(std::string const &) const
edm::EDGetTokenT< LHEEventProduct > tokenSource_
Definition: ModelFilter.h:37
std::string modelTag_
Definition: ModelFilter.h:38
std::vector< double > parameterMins_
Definition: ModelFilter.h:39
std::vector< double > parameterMaxs_
Definition: ModelFilter.h:40
ModelFilter::~ModelFilter ( )
override

Definition at line 21 of file ModelFilter.cc.

22 {
23 }

Member Function Documentation

void ModelFilter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 72 of file ModelFilter.cc.

73 {
74 }
void ModelFilter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 76 of file ModelFilter.cc.

76  {
77 }
void ModelFilter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 79 of file ModelFilter.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

79  {
81  desc.setUnknown();
82  descriptions.addDefault(desc);
83 }
void addDefault(ParameterSetDescription const &psetDescription)
bool ModelFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 25 of file ModelFilter.cc.

References comment, LHEEventProduct::comments_begin(), LHEEventProduct::comments_end(), gather_cfg::cout, edm::Event::getByToken(), mps_fire::i, and split.

26 {
28  iEvent.getByToken(tokenSource_, product);
30 
31  string tempString;
32  vector<string> parameters;
33 
34  for(comment = product->comments_begin(); comment != product->comments_end();
35  comment++)
36  {
37  if(comment->find(modelTag_) != string::npos)
38  {
39  tempString = comment->substr(comment->find(modelTag_),
40  comment->size());
41  tempString = tempString.substr(0, tempString.find(" "));
42  parameters = split(tempString, "_");
43 
44  if(parameters.size() - 1 != parameterMins_.size())
45  {
46  std::cout<<"Error: number of modeParameters does not match number of parameters in file"<<std::endl;
47  return false;
48  }
49  else if(parameterMins_.size() != parameterMaxs_.size())
50  {
51  std::cout<<"Error: umber of parameter mins != number parameter maxes"<<std::endl;
52  }
53  else
54  {
55  for(unsigned i = 0; i < parameterMins_.size(); i++)
56  {
57  if(parameterMins_[i] > atof(parameters[i +1 ].c_str()) ||
58  parameterMaxs_[i] < atof(parameters[i + 1].c_str()))
59  {
60  return false;
61  }
62  }
63  return true;
64  }
65 
66  }
67  }
68  std::cout<<"FAILED: "<<*comment<<std::endl;
69  return false;
70 
71 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< std::string > split(std::string fstring, std::string splitter)
Definition: ModelFilter.cc:84
edm::EDGetTokenT< LHEEventProduct > tokenSource_
Definition: ModelFilter.h:37
comments_const_iterator comments_begin() const
std::string modelTag_
Definition: ModelFilter.h:38
std::vector< double > parameterMins_
Definition: ModelFilter.h:39
std::vector< double > parameterMaxs_
Definition: ModelFilter.h:40
comments_const_iterator comments_end() const
std::vector< std::string >::const_iterator comments_const_iterator
Definition: ModelFilter.h:30
#define comment(par)
Definition: vmac.h:163
vector< string > ModelFilter::split ( std::string  fstring,
std::string  splitter 
)

Definition at line 84 of file ModelFilter.cc.

References gather_cfg::cout, and DEFINE_FWK_MODULE.

85 {
86  vector<string> returnVector;
87  size_t cursor;
88  string beforeSplitter;
89  string afterSplitter = fstring;
90  if(fstring.find(splitter) == string::npos)
91  {
92  std::cout<<"No "<<splitter<<" found"<<std::endl;
93  returnVector.push_back(fstring);
94  return returnVector;
95  }
96  else
97  {
98  while(afterSplitter.find(splitter) != string::npos)
99  {
100  cursor = afterSplitter.find(splitter);
101 
102  beforeSplitter = afterSplitter.substr(0, cursor);
103  afterSplitter = afterSplitter.substr(cursor +1, afterSplitter.size());
104 
105  returnVector.push_back(beforeSplitter);
106 
107  if(afterSplitter.find(splitter) == string::npos)
108  returnVector.push_back(afterSplitter);
109  }
110  return returnVector;
111  }
112 }

Member Data Documentation

std::string edm::ModelFilter::modelTag_
private

Definition at line 38 of file ModelFilter.h.

std::vector<double> edm::ModelFilter::parameterMaxs_
private

Definition at line 40 of file ModelFilter.h.

std::vector<double> edm::ModelFilter::parameterMins_
private

Definition at line 39 of file ModelFilter.h.

edm::EDGetTokenT<LHEEventProduct> edm::ModelFilter::tokenSource_
private

Definition at line 37 of file ModelFilter.h.