67 const std::vector<T>&
values,
91 tokens.push_back(
token);
105 template <
typename T>
111 auto tagsAOD = iPara.
getParameter<std::vector<edm::InputTag>>(tagAOD);
112 auto tagsMiniAOD = iPara.
getParameter<std::vector<edm::InputTag>>(tagMiniAOD);
117 for (
size_t tagNr = 0; tagNr < tagsAOD.size(); tagNr++) {
118 setToken(tokens[tagNr].aod, tagsAOD[tagNr]);
121 if (
format.tryMiniAOD()) {
122 for (
size_t tagNr = 0; tagNr < tagsMiniAOD.size(); tagNr++) {
128 template <
typename T>
131 if (!
token.aod.isUninitialized())
133 if (!
handle.isValid() && !
token.miniAOD.isUninitialized())
138 template <
typename T>
140 std::vector<edm::Handle<T>>
handles(tokens.size());
143 if (!tokens[0].aod.isUninitialized())
149 for (
size_t tokenNr = 1; tokenNr < tokens.size(); tokenNr++) {
150 auto token =
isAOD ? tokens[tokenNr].aod : tokens[tokenNr].miniAOD;
151 if (!
token.isUninitialized())
157 template <
typename T>
160 if (!
token.aod.isUninitialized())
171 std::vector<DualToken<pat::PackedCandidateCollection>>
candTokens_;
192 : trkIsoCalcCfg_(iConfig.getParameter<
edm::
ParameterSet>(
"trkIsoConfig")),
193 trkIso04CalcCfg_(iConfig.getParameter<
edm::
ParameterSet>(
"trkIso04Config")),
194 makeTrkIso04_(iConfig.getParameter<
bool>(
"makeTrkIso04")),
195 dataFormat_(iConfig.getParameter<
int>(
"dataFormat")) {
203 auto fillVetos = [](
const auto&
in,
auto&
out) {
209 throw cms::Exception(
"ConfigError") <<
" Error candVetosAOD should be the same size as candsAOD " << std::endl;
214 throw cms::Exception(
"ConfigError") <<
" Error candVetosMiniAOD should be the same size as candsMiniAOD "
242 trkIsoCalcs.emplace_back(std::make_unique<EleTkIsolFromCands>(
trkIsoCalcCfg_, *
handle, candVetos[handleNr]));
244 trkIso04Calcs.emplace_back(
254 std::vector<float> eleTrkPtIso;
255 std::vector<float> eleTrkPtIso04;
256 std::vector<int> eleNrSaturateIn5x5;
257 for (
auto const& ele : *eleHandle) {
258 eleTrkPtIso.push_back(
calTrkIso(ele, trkIsoCalcs));
260 eleTrkPtIso04.push_back(
calTrkIso(ele, trkIso04Calcs));
262 eleNrSaturateIn5x5.push_back(
nrSaturatedCrysIn5x5(ele, ebRecHitHandle, eeRecHitHandle, caloTopoHandle));
287 for (
auto& calculator : isolationCalculators) {
293 template <
typename T>
296 const std::vector<T>&
values,
310 desc.add<std::vector<edm::InputTag>>(
"candsAOD", {
edm::InputTag(
"packedCandidates")});
311 desc.add<std::vector<std::string>>(
"candVetosAOD", {
"none"});
316 desc.add<std::vector<edm::InputTag>>(
"candsMiniAOD", {
edm::InputTag(
"packedCandidates")});
317 desc.add<std::vector<std::string>>(
"candVetosMiniAOD", {
"none"});
319 desc.add<
int>(
"dataFormat", 0);
320 desc.add<
bool>(
"makeTrkIso04",
false);