21 typedef std::pair<std::string, edm::InputTag>
NameTag;
38 std::map<std::string, IDContainerData> idContainerMap;
39 for (
auto const&
name : names) {
46 std::map<std::string, IDContainerData>::iterator it;
47 it = idContainerMap.insert({tag.label() + tag.instance(), {
tag, std::vector<NameWPIdx>()}}).first;
52 if (
tauIDSrcs_.empty() && idContainerMap.empty())
53 throw cms::Exception(
"Configuration") <<
"PATTauProducer: id addTauID is true, you must specify:\n"
54 <<
"\tPSet tauIDSources = { \n"
55 <<
"\t\tInputTag <someName> = <someTag> // as many as you want \n "
57 for (
auto const& mapEntry : idContainerMap) {
62 tauIDSrcs_, [
this](
NameTag const& tag) {
return mayConsume<pat::PATTauDiscriminator>(tag.second); });
69 produces<std::vector<pat::Tau> >();
76 auto outputTaus = std::make_unique<std::vector<pat::Tau> >();
77 outputTaus->reserve(inputTaus->size());
80 for (pat::TauCollection::const_iterator inputTau = inputTaus->begin(); inputTau != inputTaus->end();
81 ++inputTau, ++tau_idx) {
84 size_t nTauIds = inputTau->tauIDs().size();
85 std::vector<pat::Tau::IdPair> tauIds(nTauIds +
nNewTauIds_);
88 for (
size_t i = 0;
i < nTauIds; ++
i) {
89 tauIds[
i] = inputTau->tauIDs().at(
i);
97 tauIds[nTauIds +
i].second = (*tauDiscr)[inputTauRef];
108 if (tauDiscrCont[inputTauRef].
rawValues.size() == 1)
110 tauIds[nEmbeddedIDs +
j].
second = tauDiscrCont[inputTauRef].
rawValues.at(0);
113 tauIds[nEmbeddedIDs +
j].second = tauDiscrCont[inputTauRef].rawValues.at(-1 - wpIdx);
117 tauIds[nEmbeddedIDs +
j].
second = 0.0;
119 tauIds[nEmbeddedIDs +
j].second = tauDiscrCont[inputTauRef].workingPoints.at(wpIdx);
126 outputTaus->push_back(outputTau);
std::vector< edm::EDGetTokenT< pat::PATTauDiscriminator > > patTauIDTokens_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::pair< edm::InputTag, std::vector< NameWPIdx > > IDContainerData
tuple cont
load Luminosity info ##
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< NameTag > tauIDSrcs_
void setTauIDs(const std::vector< IdPair > &ids)
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
const std::string names[nVars_]
~PATTauIDEmbedder() override
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
U second(std::pair< T, U > const &p)
bool get(ProductID const &oid, Handle< PROD > &result) const
Analysis-level tau class.
PATTauIDEmbedder(const edm::ParameterSet &)
edm::EDGetTokenT< pat::TauCollection > src_
T getParameter(std::string const &) const
std::pair< std::string, int > NameWPIdx
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< std::vector< NameWPIdx > > tauIDSrcContainers_
std::pair< std::string, edm::InputTag > NameTag
std::vector< edm::EDGetTokenT< reco::TauDiscriminatorContainer > > patTauIDContainerTokens_