Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b5d0e83
Add modules to rekey PF candidates of PATObjects and VertexCompositeC…
nurfikri89 Sep 24, 2025
026c148
Explicitly use packedPFCandidates created in previous process
nurfikri89 Sep 24, 2025
b299d7f
First customization configurations for reMiniFromMini workflow
nurfikri89 Sep 24, 2025
70f135a
Specify packedPFCandidates collection for MET recomputation
nurfikri89 Sep 24, 2025
574643a
Revert modification in setupPuppiForPackedPF(), set Puppi producers t…
nurfikri89 Sep 24, 2025
1ba913b
Apply code-format patches
nurfikri89 Sep 24, 2025
deedc43
Merged from1510pre6_miniFromMiniSetup_v2 from repository nurfikri89 w…
vlimant Oct 6, 2025
09fba89
streamlining of PAT configuration
vlimant Oct 7, 2025
da17bba
re-mini configuration, on top of Fikri's customisation
vlimant Oct 7, 2025
6c38aaf
clean old code
vlimant Oct 7, 2025
7ced6f8
shadow inexiting modules in HI config
vlimant Oct 7, 2025
6c63a37
fix filter modules in tagging mode in case of fastSim configruation
vlimant Oct 7, 2025
bc5a389
run2 106X mini input limitations
vlimant Oct 9, 2025
8c97130
M2M test workflows. A2M UL workflows
vlimant Oct 9, 2025
52b2549
use range whereever possible
vlimant Oct 9, 2025
af42698
code formatting
vlimant Oct 9, 2025
75569c8
a range here too
vlimant Oct 9, 2025
f8fd039
use variable
vlimant Oct 9, 2025
1a552c6
enable Mini-to-mini on pre14.2 postUL MINI input
vlimant Oct 9, 2025
2f221c7
more Mini from Mini test workflows, and fix to harvesting of the appr…
vlimant Oct 9, 2025
c0069ea
remove irrelevant tests as per @ftorrresd
vlimant Oct 9, 2025
18c67c3
add Mini from mini workflows for run2 UL data
vlimant Oct 9, 2025
6e062cf
MIMI typo
vlimant Oct 9, 2025
514a8ca
add 23 data Mini to Mini, rename step for Summer23
vlimant Oct 9, 2025
51f24a9
Merge branch 'master' into mini_from_mini
vlimant Oct 9, 2025
8e9096d
use --data option and MINIAOD when it comes to data.
vlimant Oct 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions Configuration/Applications/python/ConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ def define_Configs(self):
self.VALIDATIONDefaultSeq=''
self.ENDJOBDefaultSeq='endOfProcess'
self.REPACKDefaultSeq='DigiToRawRepack'
self.PATDefaultSeq='miniAOD'
self.PATDefaultSeq='patTask'
self.PATGENDefaultSeq='miniGEN'
#TODO: Check based of file input
self.NANODefaultSeq='nanoSequence'
Expand All @@ -1118,7 +1118,6 @@ def define_Configs(self):
if self._options.isMC==True:
self.RAW2DIGIDefaultCFF="Configuration/StandardSequences/RawToDigi_cff"
self.RECODefaultCFF="Configuration/StandardSequences/Reconstruction_cff"
self.PATDefaultCFF="Configuration/StandardSequences/PATMC_cff"
self.PATGENDefaultCFF="Configuration/StandardSequences/PATGEN_cff"
self.DQMOFFLINEDefaultCFF="DQMOffline/Configuration/DQMOfflineMC_cff"
self.ALCADefaultCFF="Configuration/StandardSequences/AlCaRecoStreamsMC_cff"
Expand Down Expand Up @@ -1745,12 +1744,6 @@ def prepare_RAW2DIGI(self, stepSpec = "RawToDigi"):
self.scheduleSequence(_raw2digiSeq,'raw2digi_step')
return

def prepare_PATFILTER(self, stepSpec = None):
self.loadAndRemember("PhysicsTools/PatAlgos/slimming/metFilterPaths_cff")
from PhysicsTools.PatAlgos.slimming.metFilterPaths_cff import allMetFilterPaths
for filt in allMetFilterPaths:
self.schedule.append(getattr(self.process,'Flag_'+filt))

def prepare_L1HwVal(self, stepSpec = 'L1HwVal'):
''' Enrich the schedule with L1 HW validation '''
self.loadDefaultOrSpecifiedCFF(stepSpec,self.L1HwValDefaultCFF)
Expand Down Expand Up @@ -1822,18 +1815,20 @@ def prepare_RECOBEFMIX(self, stepSpec = "reconstruction"):
self.scheduleSequence(_recobefmixSeq,'reconstruction_befmix_step')
return

def prepare_PAT(self, stepSpec = "miniAOD"):
def prepare_PAT(self, stepSpec = "patTask"):
''' Enrich the schedule with PAT '''
self.prepare_PATFILTER(self)
self.loadDefaultOrSpecifiedCFF(stepSpec,self.PATDefaultCFF)
self.labelsToAssociate.append('patTask')
_,pat_sequence,pat_cff = self.loadDefaultOrSpecifiedCFF(stepSpec,self.PATDefaultCFF)
## handle the noise filters as Flag_* path that were loaded
for existing_path,path_ in self.process.paths_().items():
if existing_path.startswith('Flag_'):
print(f'scheduling {existing_path} as part of PAT configuration')
self.schedule.append( path_ )

self.labelsToAssociate.append(pat_sequence)
if self._options.isData:
self._options.customisation_file_unsch.insert(0,"PhysicsTools/PatAlgos/slimming/miniAOD_tools.miniAOD_customizeAllData")
self._options.customisation_file_unsch.insert(0,f"{pat_cff}.miniAOD_customizeAllData")
else:
if self._options.fast:
self._options.customisation_file_unsch.insert(0,"PhysicsTools/PatAlgos/slimming/miniAOD_tools.miniAOD_customizeAllMCFastSim")
else:
self._options.customisation_file_unsch.insert(0,"PhysicsTools/PatAlgos/slimming/miniAOD_tools.miniAOD_customizeAllMC")
self._options.customisation_file_unsch.insert(0,f"{pat_cff}.miniAOD_customizeAllMC")

if self._options.hltProcess:
self._customise_coms.append( f'process.patTrigger.processName = "{self._options.hltProcess}"')
Expand Down
15 changes: 0 additions & 15 deletions Configuration/StandardSequences/python/PATMC_cff.py

This file was deleted.

6 changes: 5 additions & 1 deletion Configuration/StandardSequences/python/PAT_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@
bunchSpacingProducer
)

miniAOD=cms.Sequence()
from PhysicsTools.PatAlgos.slimming.miniAOD_tools import miniAOD_customizeAllData
from PhysicsTools.PatAlgos.slimming.miniAOD_tools import miniAOD_customizeAllMC

## include cms.Path defined from event filters
from PhysicsTools.PatAlgos.slimming.metFilterPaths_cff import *
7 changes: 7 additions & 0 deletions Configuration/StandardSequences/python/REMINI_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import FWCore.ParameterSet.Config as cms

patAlgosToolsTask = cms.Task()

from PhysicsTools.PatAlgos.slimming.miniAODFromMiniAOD_tools import miniAODFromMiniAOD_customizeAllData as miniAOD_customizeAllData
from PhysicsTools.PatAlgos.slimming.miniAODFromMiniAOD_tools import miniAODFromMiniAOD_customizeAllMC as miniAOD_customizeAllMC

21 changes: 15 additions & 6 deletions DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@
from RecoJets.JetProducers.QGTagger_cfi import *
from RecoMET.METFilters.metFilters_cff import*

HcalStripHaloFilterDQM=HcalStripHaloFilter.clone(taggingMode = True)
CSCTightHaloFilterDQM=CSCTightHaloFilter.clone(taggingMode = True)
CSCTightHalo2015FilterDQM=CSCTightHalo2015Filter.clone(taggingMode = True)
eeBadScFilterDQM=eeBadScFilter.clone(taggingMode = True)
EcalDeadCellTriggerPrimitiveFilterDQM=EcalDeadCellTriggerPrimitiveFilter.clone(taggingMode = True)
EcalDeadCellBoundaryEnergyFilterDQM=EcalDeadCellBoundaryEnergyFilter.clone(taggingMode = True)

## interferes with fastSim sequence that replaced these modules by an HLTBool module
## is it sufficient to have them scheduled with cms.ignore, and not need for tagging mode?
def clone_in_tagging_mode( m ):
if hasattr( m , 'taggingMode'):
return m.clone(taggingMode = True)
else:
return m.clone()

HcalStripHaloFilterDQM = clone_in_tagging_mode( HcalStripHaloFilter )
CSCTightHaloFilterDQM = clone_in_tagging_mode( CSCTightHaloFilter )
CSCTightHalo2015FilterDQM = clone_in_tagging_mode( CSCTightHalo2015Filter )
eeBadScFilterDQM = clone_in_tagging_mode( eeBadScFilter )
EcalDeadCellTriggerPrimitiveFilterDQM = clone_in_tagging_mode( EcalDeadCellTriggerPrimitiveFilter )
EcalDeadCellBoundaryEnergyFilterDQM = clone_in_tagging_mode( EcalDeadCellBoundaryEnergyFilter )

pileupJetIdCalculatorDQM=pileupJetIdCalculator.clone(
jets = "ak4PFJets",
Expand Down
2 changes: 2 additions & 0 deletions DataFormats/PatCandidates/interface/Electron.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace reco {
// Class definition
namespace pat {
class PATElectronSlimmer;
class PATElectronCandidatesRekeyer;

class Electron : public Lepton<reco::GsfElectron> {
public:
Expand Down Expand Up @@ -269,6 +270,7 @@ namespace pat {
}

friend class PATElectronSlimmer;
friend class PATElectronCandidatesRekeyer;

protected:
/// init impact parameter defaults (for use in a constructor)
Expand Down
2 changes: 2 additions & 0 deletions DataFormats/PatCandidates/interface/Muon.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace reco {
namespace pat {

class PATMuonSlimmer;
class PATMuonCandidatesRekeyer;

class Muon : public Lepton<reco::Muon> {
public:
Expand Down Expand Up @@ -272,6 +273,7 @@ namespace pat {
friend std::ostream& reco::operator<<(std::ostream& out, const pat::Muon& obj);

friend class PATMuonSlimmer;
friend class PATMuonCandidatesRekeyer;

float pfEcalEnergy() const { return pfEcalEnergy_; }
void setPfEcalEnergy(float pfEcalEnergy) { pfEcalEnergy_ = pfEcalEnergy; }
Expand Down
2 changes: 2 additions & 0 deletions DataFormats/PatCandidates/interface/Photon.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace reco {
// Class definition
namespace pat {
class PATPhotonSlimmer;
class PATPhotonCandidatesRekeyer;

class Photon : public PATObject<reco::Photon> {
public:
Expand Down Expand Up @@ -328,6 +329,7 @@ namespace pat {
reco::CandidatePtr sourceCandidatePtr(size_type i) const override;

friend class PATPhotonSlimmer;
friend class PATPhotonCandidatesRekeyer;

protected:
// ---- for content embedding ----
Expand Down
78 changes: 78 additions & 0 deletions PhysicsTools/PatAlgos/plugins/PATElectronCandidatesRekeyer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/View.h"

#include "DataFormats/PatCandidates/interface/Electron.h"
#include "DataFormats/PatCandidates/interface/PackedCandidate.h"

#include "DataFormats/Candidate/interface/CandidateFwd.h"

namespace pat {
class PATElectronCandidatesRekeyer : public edm::stream::EDProducer<> {
public:
explicit PATElectronCandidatesRekeyer(const edm::ParameterSet &iConfig);
~PATElectronCandidatesRekeyer() override;

void produce(edm::Event &, const edm::EventSetup &) override;

private:
// configurables
edm::EDGetTokenT<std::vector<pat::Electron>> src_;
edm::EDGetTokenT<reco::CandidateView> pcNewCandViewToken_;
edm::EDGetTokenT<pat::PackedCandidateCollection> pcNewToken_;
};

} // namespace pat

using namespace pat;

PATElectronCandidatesRekeyer::PATElectronCandidatesRekeyer(const edm::ParameterSet &iConfig)
:

src_(consumes<std::vector<pat::Electron>>(iConfig.getParameter<edm::InputTag>("src"))),
pcNewCandViewToken_(consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("packedPFCandidatesNew"))),
pcNewToken_(
consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("packedPFCandidatesNew"))) {
produces<std::vector<pat::Electron>>();
}

PATElectronCandidatesRekeyer::~PATElectronCandidatesRekeyer() {}

void PATElectronCandidatesRekeyer::produce(edm::Event &iEvent, edm::EventSetup const &) {
edm::Handle<std::vector<pat::Electron>> src;
iEvent.getByToken(src_, src);

edm::Handle<reco::CandidateView> pcNewCandViewHandle;
iEvent.getByToken(pcNewCandViewToken_, pcNewCandViewHandle);

edm::Handle<pat::PackedCandidateCollection> pcNewHandle;
iEvent.getByToken(pcNewToken_, pcNewHandle);

auto outPtrP = std::make_unique<std::vector<pat::Electron>>();
outPtrP->reserve(src->size());

for (size_t i = 0; i < src->size(); ++i) {
// copy original pat object and append to vector
outPtrP->emplace_back((*src)[i]);

std::vector<unsigned int> keys;
for (const edm::Ref<pat::PackedCandidateCollection> &ref : outPtrP->back().associatedPackedPFCandidates()) {
keys.push_back(ref.key());
};
outPtrP->back().setAssociatedPackedPFCandidates(
edm::RefProd<pat::PackedCandidateCollection>(pcNewHandle), keys.begin(), keys.end());
if (keys.size() == 1) {
outPtrP->back().refToOrig_ = outPtrP->back().sourceCandidatePtr(0);
} else {
outPtrP->back().refToOrig_ = reco::CandidatePtr(pcNewHandle.id());
}
}
iEvent.put(std::move(outPtrP));
}

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(PATElectronCandidatesRekeyer);
110 changes: 110 additions & 0 deletions PhysicsTools/PatAlgos/plugins/PATJetCandidatesRekeyer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/View.h"

#include "DataFormats/PatCandidates/interface/Jet.h"
#include "DataFormats/PatCandidates/interface/PackedCandidate.h"

#include "DataFormats/Candidate/interface/CandidateFwd.h"

namespace pat {
class PATJetCandidatesRekeyer : public edm::stream::EDProducer<> {
public:
explicit PATJetCandidatesRekeyer(const edm::ParameterSet &iConfig);
~PATJetCandidatesRekeyer() override;

void produce(edm::Event &, const edm::EventSetup &) override;

private:
// configurables
edm::EDGetTokenT<std::vector<pat::Jet>> src_;
edm::EDGetTokenT<reco::CandidateView> pcNewCandViewToken_;
edm::EDGetTokenT<pat::PackedCandidateCollection> pcNewToken_;
// std::string subjetLabel_;
};
} // namespace pat

using namespace pat;

PATJetCandidatesRekeyer::PATJetCandidatesRekeyer(const edm::ParameterSet &iConfig)
: src_(consumes<std::vector<pat::Jet>>(iConfig.getParameter<edm::InputTag>("src"))),
pcNewCandViewToken_(consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("packedPFCandidatesNew"))),
pcNewToken_(
consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("packedPFCandidatesNew"))) {
produces<std::vector<pat::Jet>>();
produces<edm::OwnVector<reco::BaseTagInfo>>("tagInfos");
}

PATJetCandidatesRekeyer::~PATJetCandidatesRekeyer() {}

void PATJetCandidatesRekeyer::produce(edm::Event &iEvent, edm::EventSetup const &) {
edm::Handle<std::vector<pat::Jet>> src;
iEvent.getByToken(src_, src);

edm::Handle<reco::CandidateView> pcNewCandViewHandle;
iEvent.getByToken(pcNewCandViewToken_, pcNewCandViewHandle);

edm::Handle<pat::PackedCandidateCollection> pcNewHandle;
iEvent.getByToken(pcNewToken_, pcNewHandle);

edm::RefProd<edm::OwnVector<reco::BaseTagInfo>> h_tagInfosOut =
iEvent.getRefBeforePut<edm::OwnVector<reco::BaseTagInfo>>("tagInfos");
auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();

auto outPtrP = std::make_unique<std::vector<pat::Jet>>();
outPtrP->reserve(src->size());

//
//
//
for (std::vector<pat::Jet>::const_iterator ibegin = (*src).begin(), iend = (*src).end(), ijet = ibegin; ijet != iend;
++ijet) {
for (TagInfoFwdPtrCollection::const_iterator iinfoBegin = ijet->tagInfosFwdPtr().begin(),
iinfoEnd = ijet->tagInfosFwdPtr().end(),
iinfo = iinfoBegin;
iinfo != iinfoEnd;
++iinfo) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't a range for be enough here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have difficulties with this one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@battibass : had to roll back, if you have a concrete implementation suggestion, please do. I failed to find one at this time.

tagInfosOut->push_back(**iinfo);
}
}

edm::OrphanHandle<edm::OwnVector<reco::BaseTagInfo>> oh_tagInfosOut = iEvent.put(std::move(tagInfosOut), "tagInfos");

//
//
//
unsigned int tagInfoIndex = 0;

for (size_t i = 0; i < src->size(); ++i) {
// copy original pat object and append to vector
outPtrP->emplace_back((*src)[i]);

reco::CompositePtrCandidate::daughters old = outPtrP->back().daughterPtrVector();
outPtrP->back().clearDaughters();
for (const auto &dauItr : old) {
outPtrP->back().addDaughter(edm::Ptr<reco::Candidate>(pcNewHandle, dauItr.key()));
}

// Copy the tag infos
for (TagInfoFwdPtrCollection::const_iterator iinfoBegin = outPtrP->back().tagInfosFwdPtr().begin(),
iinfoEnd = outPtrP->back().tagInfosFwdPtr().end(),
iinfo = iinfoBegin;
iinfo != iinfoEnd;
++iinfo) {
// Update the "forward" bit of the FwdPtr to point at the new collection.
// ptr to "this" info in the global list
edm::Ptr<reco::BaseTagInfo> outPtr(oh_tagInfosOut, tagInfoIndex);
outPtrP->back().updateFwdTagInfoFwdPtr(iinfo - iinfoBegin, outPtr);
++tagInfoIndex;
}
}

iEvent.put(std::move(outPtrP));
}

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(PATJetCandidatesRekeyer);
Loading