8#ifndef USERUTILS_EDMUTILS_PLUGINALIAS_HPP
9#define USERUTILS_EDMUTILS_PLUGINALIAS_HPP
11#include "FWCore/Framework/interface/Event.h"
12#include "FWCore/Framework/interface/MakerMacros.h"
13#include "FWCore/Framework/interface/one/EDAnalyzer.h"
14#include "FWCore/Framework/interface/one/EDFilter.h"
15#include "FWCore/ParameterSet/interface/ParameterSet.h"
35template<
typename EDMPLUGIN>
55 template<
typename TYPE>
56 inline edm::EDGetToken
59 return edm::EDConsumerBase::consumes<TYPE>(
60 _config.getParameter<edm::InputTag>( configtag ) );
68 template<
typename TYPE>
69 inline edm::EDGetToken
72 return edm::EDConsumerBase::consumes<TYPE, edm::InRun>(
73 _config.getParameter<edm::InputTag>( configtag ) );
80 template<
typename TYPE>
81 inline edm::Handle<TYPE>
82 MakeHandle(
const edm::Event& event,
const edm::EDGetToken tok )
84 edm::Handle<TYPE> handle;
85 event.getByToken( tok, handle );
86 assert( handle.isValid() );
96 const std::string objtag )
97 {
return GetFileObj( _config, filetag, objtag ); }
112 const std::string& filetag )
114 return config.getParameter<edm::FileInPath>( filetag ).fullPath();
128 const std::string& filetag,
129 const std::string& objtag )
131 const std::string filename =
GetFilePath( config, filetag );
132 const std::string objname = config.getParameter<std::string>( objtag );
133 TFile* file = TFile::Open( filename.c_str() );
134 TObject* ans = file->Get( objname.c_str() )->Clone();
142 const edm::ParameterSet& _config;
145typedef PluginAlias<edm::one::EDAnalyzer<edm::one::SharedResources> >
147typedef PluginAlias<edm::one::EDFilter<edm::one::SharedResources> >
class for reducing the verbosity of the various edm plugin calls.
Definition: PluginAlias.hpp:37
edm::EDGetToken GetToken(const std::string &configtag)
template class for getting the EdmToken from the initializer configuration parameter set.
Definition: PluginAlias.hpp:57
static std::string GetFilePath(const edm::ParameterSet &config, const std::string &filetag)
returing the string to a path in the parameterset if an EDM::FileInPath was used.
Definition: PluginAlias.hpp:111
TObject * GetFileObj(const std::string &filetag, const std::string objtag)
getting a clone of an object described in a file. See static function for full documentation.
Definition: PluginAlias.hpp:95
std::string GetFilePath(const std::string &filetag)
getting the full path to a file. See static function for full documentation.
Definition: PluginAlias.hpp:103
PluginAlias(const edm::ParameterSet &config)
Definition: PluginAlias.hpp:43
edm::Handle< TYPE > MakeHandle(const edm::Event &event, const edm::EDGetToken tok)
Construction for a handle.
Definition: PluginAlias.hpp:82
edm::EDGetToken GetRunToken(const std::string &configtag)
Same template function as GetToken() except for getting Run level objects.
Definition: PluginAlias.hpp:70
static TObject * GetFileObj(const edm::ParameterSet &config, const std::string &filetag, const std::string &objtag)
Given a file path in the form of an EDM::FileInPath, and a object key as a parameter set string.
Definition: PluginAlias.hpp:127