Skip to content

Commit

Permalink
Merge pull request #39117 from bsunanda/Run3-alca228X
Browse files Browse the repository at this point in the history
Run3-alca228X Backport to 12_4_X the PR #39116 which modifies IsolatedBunchSelector and HcalNoise AlCaReco
  • Loading branch information
cmsbuild committed Aug 23, 2022
2 parents 191566c + 06d3120 commit 5668d98
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
Expand Up @@ -27,25 +27,25 @@

//#define EDM_ML_DEBUG

namespace AlCaIsolatedBunch {
namespace alCaIsolatedBunchSelector {
struct Counters {
Counters() : nAll_(0), nGood_(0) {}
mutable std::atomic<unsigned int> nAll_, nGood_;
};
} // namespace AlCaIsolatedBunch
} // namespace alCaIsolatedBunchSelector

class AlCaIsolatedBunchSelector : public edm::stream::EDFilter<edm::GlobalCache<AlCaIsolatedBunch::Counters> > {
class AlCaIsolatedBunchSelector : public edm::stream::EDFilter<edm::GlobalCache<alCaIsolatedBunchSelector::Counters> > {
public:
explicit AlCaIsolatedBunchSelector(edm::ParameterSet const&, const AlCaIsolatedBunch::Counters* count);
~AlCaIsolatedBunchSelector() override;
explicit AlCaIsolatedBunchSelector(edm::ParameterSet const&, const alCaIsolatedBunchSelector::Counters* count);
~AlCaIsolatedBunchSelector() override = default;

static std::unique_ptr<AlCaIsolatedBunch::Counters> initializeGlobalCache(edm::ParameterSet const& iConfig) {
return std::make_unique<AlCaIsolatedBunch::Counters>();
static std::unique_ptr<alCaIsolatedBunchSelector::Counters> initializeGlobalCache(edm::ParameterSet const& iConfig) {
return std::make_unique<alCaIsolatedBunchSelector::Counters>();
}

bool filter(edm::Event&, edm::EventSetup const&) override;
void endStream() override;
static void globalEndJob(const AlCaIsolatedBunch::Counters* counters);
static void globalEndJob(const alCaIsolatedBunchSelector::Counters* counters);
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
Expand All @@ -65,7 +65,7 @@ class AlCaIsolatedBunchSelector : public edm::stream::EDFilter<edm::GlobalCache<
// constructors and destructor
//
AlCaIsolatedBunchSelector::AlCaIsolatedBunchSelector(const edm::ParameterSet& iConfig,
const AlCaIsolatedBunch::Counters* count)
const alCaIsolatedBunchSelector::Counters* count)
: nRun_(0),
nAll_(0),
nGood_(0),
Expand All @@ -78,8 +78,6 @@ AlCaIsolatedBunchSelector::AlCaIsolatedBunchSelector(const edm::ParameterSet& iC
<< std::endl;
}

AlCaIsolatedBunchSelector::~AlCaIsolatedBunchSelector() {}

//
// member functions
//
Expand All @@ -92,21 +90,25 @@ bool AlCaIsolatedBunchSelector::filter(edm::Event& iEvent, edm::EventSetup const
edm::LogVerbatim("AlCaIsoBunch") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity "
<< iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl;
#endif
//Step1: Find if the event passes the chosen trigger
auto const& triggerResults = iEvent.getHandle(tok_trigRes_);
if (triggerResults.isValid()) {
const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
const std::vector<std::string>& triggerNames_ = triggerNames.triggerNames();
for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) {
int hlt = triggerResults->accept(iHLT);
if (triggerNames_[iHLT].find(trigName_) != std::string::npos) {
if (hlt > 0) {
accept = true;
if (trigName_.empty()) {
accept = true;
} else {
//Step1: Find if the event passes the chosen trigger
auto const& triggerResults = iEvent.getHandle(tok_trigRes_);
if (triggerResults.isValid()) {
const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
const std::vector<std::string>& triggerNames_ = triggerNames.triggerNames();
for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) {
int hlt = triggerResults->accept(iHLT);
if (triggerNames_[iHLT].find(trigName_) != std::string::npos) {
if (hlt > 0) {
accept = true;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("AlCaIsoBunch")
<< triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << accept << std::endl;
edm::LogVerbatim("AlCaIsoBunch")
<< triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << accept << std::endl;
#endif
break;
break;
}
}
}
}
Expand All @@ -124,7 +126,7 @@ void AlCaIsolatedBunchSelector::endStream() {
globalCache()->nGood_ += nGood_;
}

void AlCaIsolatedBunchSelector::globalEndJob(const AlCaIsolatedBunch::Counters* count) {
void AlCaIsolatedBunchSelector::globalEndJob(const alCaIsolatedBunchSelector::Counters* count) {
edm::LogVerbatim("AlCaIsoBunch") << "Selects " << count->nGood_ << " in " << count->nAll_ << " events" << std::endl;
}

Expand All @@ -145,7 +147,7 @@ void AlCaIsolatedBunchSelector::fillDescriptions(edm::ConfigurationDescriptions&
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("triggerResultLabel", edm::InputTag("TriggerResults", "", "HLT"));
desc.add<std::string>("processName", "HLT");
desc.add<std::string>("triggerName", "HLT_HcalIsolatedBunch");
desc.add<std::string>("triggerName", "");
descriptions.add("alcaIsolatedBunchSelector", desc);
}

Expand Down
Expand Up @@ -3,31 +3,29 @@

import HLTrigger.HLTfilters.hltHighLevel_cfi
noiseHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
HLTPaths = ['HLT_MET25'],
# eventSetupPathsKey='HcalCalNoise',
eventSetupPathsKey='HcalCalNoise',
throw = False #dont throw except on unknown path name
)

prescaler = cms.EDFilter("PrescalerFHN",
TriggerResultsTag = cms.InputTag("TriggerResults", "", "HLT"),

# Will select OR of all specified HLTs
# And increment if HLT is seen, regardless if
# others cause selection

Prescales = cms.VPSet(
cms.PSet(
HLTName = cms.string("HLT_MET25"),
PrescaleFactor = cms.uint32(1)
)
# cms.PSet(
# name = cms.string("HLTPath2"),
# factor = cms.uint32(100)
# )
))
TriggerResultsTag = cms.InputTag("TriggerResults", "", "HLT"),

# Will select OR of all specified HLTs
# And increment if HLT is seen, regardless if
# others cause selection

Prescales = cms.VPSet(
cms.PSet(
# HLTName = cms.string("HLT_PFMET130"),
PrescaleFactor = cms.uint32(1)
)
# cms.PSet(
# name = cms.string("HLTPath2"),
# factor = cms.uint32(100)
# )
))

from Calibration.HcalAlCaRecoProducers.alcahcalnoise_cfi import *

seqALCARECOHcalCalNoise = cms.Sequence(noiseHLT*prescaler*HcalNoiseProd)


#seqALCARECOHcalCalNoise = cms.Sequence(noiseHLT*prescaler*HcalNoiseProd)
seqALCARECOHcalCalNoise = cms.Sequence(noiseHLT*HcalNoiseProd)

0 comments on commit 5668d98

Please sign in to comment.