CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
L1TMuonProducer Class Reference

#include <L1Trigger/L1TMuon/src/L1TMuonProducer.cc>

Inheritance diagram for L1TMuonProducer:
edm::stream::EDProducer<>

Public Member Functions

 L1TMuonProducer (const edm::ParameterSet &)
 
 ~L1TMuonProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void addMuonsToCollections (MicroGMTConfiguration::InterMuonList &coll, MicroGMTConfiguration::InterMuonList &interout, std::unique_ptr< MuonBxCollection > &out, int bx) const
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void calculateRank (MicroGMTConfiguration::InterMuonList &muons) const
 
int computeMuonIdx (const RegionalMuonCand &mu, int currentLink, int muIdxAuto) const
 
void convertMuons (edm::Handle< MicroGMTConfiguration::InputCollection > const &in, MicroGMTConfiguration::InterMuonList &out, GMTInternalWedges &wedges, int bx) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 
void sortMuons (MicroGMTConfiguration::InterMuonList &, unsigned) const
 
void splitAndConvertMuons (edm::Handle< MicroGMTConfiguration::InputCollection > const &in, MicroGMTConfiguration::InterMuonList &out_pos, MicroGMTConfiguration::InterMuonList &out_neg, GMTInternalWedges &wedges_pos, GMTInternalWedges &wedges_neg, int bx) const
 

Static Private Member Functions

static bool compareMuons (const std::shared_ptr< MicroGMTConfiguration::InterMuon > &mu1, const std::shared_ptr< MicroGMTConfiguration::InterMuon > &mu2)
 

Private Attributes

bool m_autoBxRange
 
bool m_autoCancelMode
 
edm::InputTag m_barrelTfInputTag
 
edm::EDGetTokenT< MicroGMTConfiguration::InputCollectionm_barrelTfInputToken
 
l1t::cancelmode m_bmtfCancelMode
 
std::bitset< 12 > m_bmtfInputsToDisable
 
int m_bxMax
 
int m_bxMin
 
std::bitset< 28 > m_caloInputsToDisable
 
edm::EDGetTokenT< MicroGMTConfiguration::CaloInputCollectionm_caloTowerInputToken
 
MicroGMTCancelOutUnit m_cancelOutUnit
 
std::ofstream m_debugOut
 
l1t::cancelmode m_emtfCancelMode
 
std::bitset< 12 > m_emtfInputsToDisable
 
edm::InputTag m_endcapTfInputTag
 
edm::EDGetTokenT< MicroGMTConfiguration::InputCollectionm_endcapTfInputToken
 
std::bitset< 72 > m_inputsToDisable
 
MicroGMTIsolationUnit m_isolationUnit
 
std::bitset< 12 > m_maskedBmtfInputs
 
std::bitset< 28 > m_maskedCaloInputs
 
std::bitset< 12 > m_maskedEmtfInputs
 
std::bitset< 72 > m_maskedInputs
 
std::bitset< 12 > m_maskedOmtfInputs
 
edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsRcdm_microGMTParamsToken
 
edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsO2ORcdm_o2oProtoToken
 
std::bitset< 12 > m_omtfInputsToDisable
 
edm::InputTag m_overlapTfInputTag
 
edm::EDGetTokenT< MicroGMTConfiguration::InputCollectionm_overlapTfInputToken
 
std::shared_ptr< MicroGMTRankPtQualLUTm_rankPtQualityLUT
 
edm::InputTag m_trigTowerTag
 
std::unique_ptr< L1TMuonGlobalParamsHelpermicroGMTParamsHelper
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: Takes txt-file input and produces barrel- / overlap- / forward TF muons

Implementation: [Notes on implementation]

Definition at line 59 of file L1TMuonProducer.cc.

Constructor & Destructor Documentation

◆ L1TMuonProducer()

L1TMuonProducer::L1TMuonProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 143 of file L1TMuonProducer.cc.

References edm::ParameterSet::getParameter(), l1t::kftracks, m_autoBxRange, m_autoCancelMode, m_barrelTfInputTag, m_barrelTfInputToken, m_bmtfCancelMode, m_bxMax, m_bxMin, m_caloTowerInputToken, m_emtfCancelMode, m_endcapTfInputTag, m_endcapTfInputToken, m_microGMTParamsToken, m_o2oProtoToken, m_overlapTfInputTag, m_overlapTfInputToken, m_trigTowerTag, AlCaHLTBitMon_QueryRunRegistry::string, and DiMuonV_cfg::tracks.

144  : m_debugOut("test/debug/iso_debug.dat"),
147  // edm::InputTag barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
148  // edm::InputTag overlapTfInputTag = iConfig.getParameter<edm::InputTag>("overlapTFInput");
149  // edm::InputTag forwardTfInputTag = iConfig.getParameter<edm::InputTag>("forwardTFInput");
150 
151  m_barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
152  m_overlapTfInputTag = iConfig.getParameter<edm::InputTag>("overlapTFInput");
153  m_endcapTfInputTag = iConfig.getParameter<edm::InputTag>("forwardTFInput");
154  m_trigTowerTag = iConfig.getParameter<edm::InputTag>("triggerTowerInput");
155 
156  m_autoBxRange = iConfig.getParameter<bool>("autoBxRange");
157  m_bxMin = iConfig.getParameter<int>("bxMin");
158  m_bxMax = iConfig.getParameter<int>("bxMax");
159 
160  m_autoCancelMode = iConfig.getParameter<bool>("autoCancelMode");
161  if (!m_autoCancelMode) {
162  if (iConfig.getParameter<std::string>("bmtfCancelMode").find("kftracks") == 0) {
164  }
165  if (iConfig.getParameter<std::string>("emtfCancelMode").find("tracks") == 0) {
167  }
168  }
169 
170  m_barrelTfInputToken = consumes<MicroGMTConfiguration::InputCollection>(m_barrelTfInputTag);
171  m_overlapTfInputToken = consumes<MicroGMTConfiguration::InputCollection>(m_overlapTfInputTag);
172  m_endcapTfInputToken = consumes<MicroGMTConfiguration::InputCollection>(m_endcapTfInputTag);
173  m_caloTowerInputToken = consumes<MicroGMTConfiguration::CaloInputCollection>(m_trigTowerTag);
174  m_microGMTParamsToken = esConsumes<L1TMuonGlobalParams, L1TMuonGlobalParamsRcd, edm::Transition::BeginRun>();
175  m_o2oProtoToken = esConsumes<L1TMuonGlobalParams, L1TMuonGlobalParamsO2ORcd, edm::Transition::BeginRun>();
176 
177  //register your products
178  produces<MuonBxCollection>();
179  produces<MuonBxCollection>("imdMuonsBMTF");
180  produces<MuonBxCollection>("imdMuonsEMTFPos");
181  produces<MuonBxCollection>("imdMuonsEMTFNeg");
182  produces<MuonBxCollection>("imdMuonsOMTFPos");
183  produces<MuonBxCollection>("imdMuonsOMTFNeg");
184 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::ofstream m_debugOut
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_endcapTfInputToken
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_overlapTfInputToken
edm::EDGetTokenT< MicroGMTConfiguration::CaloInputCollection > m_caloTowerInputToken
l1t::cancelmode m_emtfCancelMode
edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsO2ORcd > m_o2oProtoToken
edm::InputTag m_overlapTfInputTag
edm::InputTag m_barrelTfInputTag
edm::InputTag m_endcapTfInputTag
edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsRcd > m_microGMTParamsToken
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_barrelTfInputToken
l1t::cancelmode m_bmtfCancelMode
edm::InputTag m_trigTowerTag

◆ ~L1TMuonProducer()

L1TMuonProducer::~L1TMuonProducer ( )
override

Definition at line 186 of file L1TMuonProducer.cc.

References m_debugOut.

186 { m_debugOut.close(); }
std::ofstream m_debugOut

Member Function Documentation

◆ addMuonsToCollections()

void L1TMuonProducer::addMuonsToCollections ( MicroGMTConfiguration::InterMuonList coll,
MicroGMTConfiguration::InterMuonList interout,
std::unique_ptr< MuonBxCollection > &  out,
int  bx 
) const
private

Definition at line 430 of file L1TMuonProducer.cc.

References nano_mu_digi_cff::bx, l1trig_cff::hwPtUnconstrained, amptDefaultParameters_cff::mu, and MillePedeFileConverter_cfg::out.

Referenced by produce().

433  {
434  for (auto& mu : coll) {
435  interout.push_back(mu);
436  math::PtEtaPhiMLorentzVector vec{(mu->hwPt() - 1) * 0.5, mu->hwEta() * 0.010875, mu->hwGlobalPhi() * 0.010908, 0.0};
437  int outMuQual = MicroGMTConfiguration::setOutputMuonQuality(mu->hwQual(), mu->trackFinderType(), mu->hwHF());
438  // set tfMuonIndex and iso to 0 like in the FW
439  Muon outMu{vec,
440  mu->hwPt(),
441  mu->hwEta(),
442  mu->hwGlobalPhi(),
443  outMuQual,
444  mu->hwSign(),
445  mu->hwSignValid(),
446  0,
447  0,
448  0,
449  true,
450  0,
451  mu->hwDPhi(),
452  mu->hwDEta(),
453  mu->hwRank()};
454 
455  int hwPtUnconstrained{mu->hwPtUnconstrained()};
456  outMu.setPtUnconstrained(hwPtUnconstrained == 0
457  ? 0
458  : (hwPtUnconstrained - 1)); // Don't want negative pT, unconstr. pT has LSB of 1 GeV.
459  outMu.setHwPtUnconstrained(hwPtUnconstrained);
460  outMu.setHwDXY(mu->hwDXY());
461 
462  if (mu->hwSignValid()) {
463  outMu.setCharge(1 - 2 * mu->hwSign());
464  } else {
465  outMu.setCharge(0);
466  }
467 
468  out->push_back(bx, outMu);
469  }
470 }
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
Definition: Muon.py:1

◆ beginRun()

void L1TMuonProducer::beginRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 572 of file L1TMuonProducer.cc.

References cast_to_L1TMuonGlobalParams(), cast_to_L1TMuonGlobalParams_PUBLIC(), l1t::MicroGMTRankPtQualLUTFactory::create(), edm::EventSetup::getHandle(), l1t::MicroGMTCancelOutUnit::initialise(), l1t::MicroGMTIsolationUnit::initialise(), l1t::kftracks, m_autoCancelMode, m_bmtfCancelMode, m_bmtfInputsToDisable, m_caloInputsToDisable, m_cancelOutUnit, m_emtfInputsToDisable, m_inputsToDisable, m_isolationUnit, m_maskedBmtfInputs, m_maskedCaloInputs, m_maskedEmtfInputs, m_maskedInputs, m_maskedOmtfInputs, m_microGMTParamsToken, m_o2oProtoToken, m_omtfInputsToDisable, m_rankPtQualityLUT, microGMTParamsHelper, and edm::ESHandle< T >::product().

572  {
573  edm::ESHandle<L1TMuonGlobalParams> microGMTParamsHandle = iSetup.getHandle(m_microGMTParamsToken);
574 
575  std::unique_ptr<L1TMuonGlobalParams_PUBLIC> microGMTParams(
577  if (microGMTParams->pnodes_.empty()) {
578  edm::ESHandle<L1TMuonGlobalParams> o2oProtoHandle = iSetup.getHandle(m_o2oProtoToken);
579  microGMTParamsHelper = std::make_unique<L1TMuonGlobalParamsHelper>(*o2oProtoHandle.product());
580  } else
582  std::make_unique<L1TMuonGlobalParamsHelper>(cast_to_L1TMuonGlobalParams(*microGMTParams.get()));
583 
584  //microGMTParamsHelper->print(std::cout);
585  m_inputsToDisable = microGMTParamsHelper->inputsToDisable();
586  edm::LogVerbatim("L1TMuonProducer")
587  << "uGMT inputsToDisable: " << m_inputsToDisable
588  << "\n EMTF-|OMTF-| BMTF |OMTF+|EMTF+| CALO | res 0";
589  m_caloInputsToDisable = microGMTParamsHelper->caloInputsToDisable();
590  m_bmtfInputsToDisable = microGMTParamsHelper->bmtfInputsToDisable();
591  m_omtfInputsToDisable = microGMTParamsHelper->omtfInputsToDisable();
592  m_emtfInputsToDisable = microGMTParamsHelper->emtfInputsToDisable();
593  m_maskedInputs = microGMTParamsHelper->maskedInputs();
594  edm::LogVerbatim("L1TMuonProducer")
595  << "uGMT maskedInputs: " << m_maskedInputs
596  << "\n EMTF-|OMTF-| BMTF |OMTF+|EMTF+| CALO | res 0";
597  m_maskedCaloInputs = microGMTParamsHelper->maskedCaloInputs();
598  m_maskedBmtfInputs = microGMTParamsHelper->maskedBmtfInputs();
599  m_maskedOmtfInputs = microGMTParamsHelper->maskedOmtfInputs();
600  m_maskedEmtfInputs = microGMTParamsHelper->maskedEmtfInputs();
605 
606  if (m_autoCancelMode) {
607  if (microGMTParamsHelper->fwVersion() >= 0x6000000) {
609  }
610  // TODO: No decision yet on when to use EMTF track addresses for cancel-out.
611  // if (microGMTParamsHelper->fwVersion() > 0x5000000) {
612  // m_emtfCancelMode = cancelmode::tracks;
613  // }
614  }
615 }
const L1TMuonGlobalParams & cast_to_L1TMuonGlobalParams(const L1TMuonGlobalParams_PUBLIC &x)
Log< level::Info, true > LogVerbatim
void initialise(L1TMuonGlobalParamsHelper *)
Initialisation from ES record.
std::unique_ptr< L1TMuonGlobalParamsHelper > microGMTParamsHelper
std::bitset< 12 > m_bmtfInputsToDisable
MicroGMTIsolationUnit m_isolationUnit
edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsO2ORcd > m_o2oProtoToken
std::shared_ptr< MicroGMTRankPtQualLUT > m_rankPtQualityLUT
static ReturnType create(const std::string &filename, const int fwVersion, const unsigned ptFactor, const unsigned qualFactor)
std::bitset< 12 > m_emtfInputsToDisable
T const * product() const
Definition: ESHandle.h:86
std::bitset< 12 > m_maskedBmtfInputs
edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsRcd > m_microGMTParamsToken
std::bitset< 12 > m_maskedEmtfInputs
const L1TMuonGlobalParams_PUBLIC & cast_to_L1TMuonGlobalParams_PUBLIC(const L1TMuonGlobalParams &x)
l1t::cancelmode m_bmtfCancelMode
std::bitset< 72 > m_maskedInputs
std::bitset< 12 > m_maskedOmtfInputs
std::bitset< 72 > m_inputsToDisable
std::bitset< 28 > m_caloInputsToDisable
std::bitset< 12 > m_omtfInputsToDisable
MicroGMTCancelOutUnit m_cancelOutUnit
void initialise(L1TMuonGlobalParamsHelper *)
Initialisation from ES record.
std::bitset< 28 > m_maskedCaloInputs

◆ calculateRank()

void L1TMuonProducer::calculateRank ( MicroGMTConfiguration::InterMuonList muons) const
private

Definition at line 423 of file L1TMuonProducer.cc.

References m_rankPtQualityLUT, and DiMuonV_cfg::muons.

Referenced by produce().

423  {
424  for (auto& mu1 : muons) {
425  int rank = m_rankPtQualityLUT->lookup(mu1->hwPt(), mu1->hwQual());
426  mu1->setHwRank(rank);
427  }
428 }
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:212
std::shared_ptr< MicroGMTRankPtQualLUT > m_rankPtQualityLUT

◆ compareMuons()

bool L1TMuonProducer::compareMuons ( const std::shared_ptr< MicroGMTConfiguration::InterMuon > &  mu1,
const std::shared_ptr< MicroGMTConfiguration::InterMuon > &  mu2 
)
staticprivate

Definition at line 383 of file L1TMuonProducer.cc.

Referenced by sortMuons().

384  {
385  return (mu1->hwWins() >= mu2->hwWins());
386 }

◆ computeMuonIdx()

int L1TMuonProducer::computeMuonIdx ( const RegionalMuonCand mu,
int  currentLink,
int  muIdxAuto 
) const
private

Definition at line 562 of file L1TMuonProducer.cc.

References amptDefaultParameters_cff::mu.

Referenced by convertMuons(), and splitAndConvertMuons().

562  {
563  // If the muon index was set in the data format we should use that. Otherwise we use the value computed from the position in the vector.
564  if (mu.muIdx() != -1) {
565  return 3 * (currentLink - 36) + mu.muIdx();
566  } else {
567  return 3 * (currentLink - 36) + muIdxAuto;
568  }
569 }

◆ convertMuons()

void L1TMuonProducer::convertMuons ( edm::Handle< MicroGMTConfiguration::InputCollection > const &  in,
MicroGMTConfiguration::InterMuonList out,
GMTInternalWedges wedges,
int  bx 
) const
private

Definition at line 522 of file L1TMuonProducer.cc.

References nano_mu_digi_cff::bx, computeMuonIdx(), mps_fire::i, recoMuon::in, m_inputsToDisable, m_maskedInputs, MillePedeFileConverter_cfg::out, and findQualityFiles::size.

Referenced by produce().

525  {
526  // initialize the wedge collection:
527  for (int i = 0; i < 12; ++i) {
528  wedges[i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
529  wedges[i].reserve(3);
530  }
531  if (bx < in->getFirstBX() || bx > in->getLastBX()) {
532  return;
533  }
534  int muIdxAuto = 0;
535  int currentLink = 0;
536  for (size_t i = 0; i < in->size(bx); ++i, ++muIdxAuto) {
537  if (in->at(bx, i).hwPt() > 0) {
538  int link = in->at(bx, i).link();
539  if (m_inputsToDisable.test(link) || m_maskedInputs.test(link)) {
540  continue; // only process if input link is enabled and not masked
541  }
542  if (currentLink != link) {
543  muIdxAuto = 0;
544  currentLink = link;
545  }
546  int gPhi = MicroGMTConfiguration::calcGlobalPhi(
547  in->at(bx, i).hwPhi(), in->at(bx, i).trackFinderType(), in->at(bx, i).processor());
548  int tfMuonIdx{computeMuonIdx(in->at(bx, i), currentLink, muIdxAuto)};
549  std::shared_ptr<GMTInternalMuon> outMu = std::make_shared<GMTInternalMuon>(in->at(bx, i), gPhi, tfMuonIdx);
550  out.emplace_back(outMu);
551  wedges[in->at(bx, i).processor()].push_back(outMu);
552  }
553  }
554  for (int i = 0; i < 12; ++i) {
555  if (wedges[i].size() > 3) {
556  edm::LogWarning("Input Mismatch") << " too many inputs per processor for barrel. Wedge " << i << ": Size "
557  << wedges[i].size() << std::endl;
558  }
559  }
560 }
size
Write out results.
int computeMuonIdx(const RegionalMuonCand &mu, int currentLink, int muIdxAuto) const
std::bitset< 72 > m_maskedInputs
std::bitset< 72 > m_inputsToDisable
Log< level::Warning, false > LogWarning

◆ fillDescriptions()

void L1TMuonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 618 of file L1TMuonProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

618  {
619  //The following says we do not know what parameters are allowed so do no validation
620  // Please change this to state exactly what you do use, even if it is no parameters
622  desc.setUnknown();
623  descriptions.addDefault(desc);
624 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void L1TMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 193 of file L1TMuonProducer.cc.

References addMuonsToCollections(), l1t::bmtf, nano_mu_digi_cff::bx, l1tstage1emulator_dqm_sourceclient-live_cfg::bxMax, l1tstage1emulator_dqm_sourceclient-live_cfg::bxMin, calculateRank(), convertMuons(), l1t::emtf_neg, l1t::emtf_pos, l1t::MicroGMTIsolationUnit::extrapolateMuons(), BXVector< T >::getFirstBX(), BXVector< T >::getLastBX(), l1trig_cff::hwPtUnconstrained, iEvent, l1t::MicroGMTIsolationUnit::isolatePreSummed(), m_autoBxRange, m_barrelTfInputToken, m_bmtfCancelMode, m_bmtfInputsToDisable, m_bxMax, m_bxMin, m_caloInputsToDisable, m_caloTowerInputToken, m_cancelOutUnit, m_debugOut, m_emtfCancelMode, m_emtfInputsToDisable, m_endcapTfInputToken, m_isolationUnit, m_maskedBmtfInputs, m_maskedCaloInputs, m_maskedEmtfInputs, m_maskedOmtfInputs, m_omtfInputsToDisable, m_overlapTfInputToken, SiStripPI::max, SiStripPI::min, eostools::move(), amptDefaultParameters_cff::mu, l1t::omtf_neg, l1t::omtf_pos, l1t::MicroGMTCancelOutUnit::setCancelOutBits(), l1t::MicroGMTCancelOutUnit::setCancelOutBitsOverlapBarrel(), l1t::MicroGMTCancelOutUnit::setCancelOutBitsOverlapEndcap(), l1t::MicroGMTIsolationUnit::setTowerSums(), sortMuons(), and splitAndConvertMuons().

193  {
194  using namespace edm;
195  std::unique_ptr<MuonBxCollection> outMuons(new MuonBxCollection());
196  std::unique_ptr<MuonBxCollection> imdMuonsBMTF(new MuonBxCollection());
197  std::unique_ptr<MuonBxCollection> imdMuonsEMTFPos(new MuonBxCollection());
198  std::unique_ptr<MuonBxCollection> imdMuonsEMTFNeg(new MuonBxCollection());
199  std::unique_ptr<MuonBxCollection> imdMuonsOMTFPos(new MuonBxCollection());
200  std::unique_ptr<MuonBxCollection> imdMuonsOMTFNeg(new MuonBxCollection());
201 
206 
207  iEvent.getByToken(m_barrelTfInputToken, bmtfMuons);
208  iEvent.getByToken(m_endcapTfInputToken, emtfMuons);
209  iEvent.getByToken(m_overlapTfInputToken, omtfMuons);
210  iEvent.getByToken(m_caloTowerInputToken, trigTowers);
211 
212  // find out the BX range from the inputs
213  // the smallest BX window defines the output BX window
214  if (m_autoBxRange) {
215  int bxMin = -1000;
216  int bxMax = 1000;
217  if (!(m_caloInputsToDisable.all() || m_maskedCaloInputs.all())) {
218  bxMin = std::max(bxMin, trigTowers->getFirstBX());
219  bxMax = std::min(bxMax, trigTowers->getLastBX());
220  }
221  if (!(m_bmtfInputsToDisable.all() || m_maskedBmtfInputs.all())) {
222  bxMin = std::max(bxMin, bmtfMuons->getFirstBX());
223  bxMax = std::min(bxMax, bmtfMuons->getLastBX());
224  }
225  if (!(m_omtfInputsToDisable.all() || m_maskedOmtfInputs.all())) {
226  bxMin = std::max(bxMin, omtfMuons->getFirstBX());
227  bxMax = std::min(bxMax, omtfMuons->getLastBX());
228  }
229  if (!(m_emtfInputsToDisable.all() || m_maskedEmtfInputs.all())) {
230  bxMin = std::max(bxMin, emtfMuons->getFirstBX());
231  bxMax = std::min(bxMax, emtfMuons->getLastBX());
232  }
233  if (bxMin > 0) {
234  bxMin = 0;
235  }
236  if (bxMax < 0) {
237  bxMax = 0;
238  }
239  if (bxMin > -1000) {
240  m_bxMin = bxMin;
241  } else {
242  m_bxMin = 0;
243  }
244  if (bxMax < 1000) {
245  m_bxMax = bxMax;
246  } else {
247  m_bxMax = 0;
248  }
249  }
250 
251  // set BX range for outputs
252  outMuons->setBXRange(m_bxMin, m_bxMax);
253  imdMuonsBMTF->setBXRange(m_bxMin, m_bxMax);
254  imdMuonsEMTFPos->setBXRange(m_bxMin, m_bxMax);
255  imdMuonsEMTFNeg->setBXRange(m_bxMin, m_bxMax);
256  imdMuonsOMTFPos->setBXRange(m_bxMin, m_bxMax);
257  imdMuonsOMTFNeg->setBXRange(m_bxMin, m_bxMax);
258 
259  for (int bx = m_bxMin; bx <= m_bxMax; ++bx) {
260  m_isolationUnit.setTowerSums(*trigTowers, bx);
261  MicroGMTConfiguration::InterMuonList internMuonsBmtf;
262  MicroGMTConfiguration::InterMuonList internMuonsEmtfPos;
263  MicroGMTConfiguration::InterMuonList internMuonsEmtfNeg;
264  MicroGMTConfiguration::InterMuonList internMuonsOmtfPos;
265  MicroGMTConfiguration::InterMuonList internMuonsOmtfNeg;
266 
267  // These wedges contain shared pointers to the ones in the InterMuonList
268  GMTInternalWedges omtfNegWedges;
269  GMTInternalWedges bmtfWedges;
270  GMTInternalWedges emtfPosWedges;
271  GMTInternalWedges emtfNegWedges;
272  GMTInternalWedges omtfPosWedges;
273 
274  // this converts the InputMuon type to the InternalMuon type and splits them into
275  // positive / negative eta collections necessary as LUTs may differ for pos / neg.
276  convertMuons(bmtfMuons, internMuonsBmtf, bmtfWedges, bx);
277  splitAndConvertMuons(emtfMuons, internMuonsEmtfPos, internMuonsEmtfNeg, emtfPosWedges, emtfNegWedges, bx);
278  splitAndConvertMuons(omtfMuons, internMuonsOmtfPos, internMuonsOmtfNeg, omtfPosWedges, omtfNegWedges, bx);
279 
280  // cancel out within the track finders:
286 
287  // cancel out between track finder acceptance overlaps:
292 
293  m_isolationUnit.extrapolateMuons(internMuonsBmtf);
294  m_isolationUnit.extrapolateMuons(internMuonsEmtfNeg);
295  m_isolationUnit.extrapolateMuons(internMuonsEmtfPos);
296  m_isolationUnit.extrapolateMuons(internMuonsOmtfNeg);
297  m_isolationUnit.extrapolateMuons(internMuonsOmtfPos);
298 
299  // the rank calculated here is used in the sort below
300  calculateRank(internMuonsBmtf);
301  calculateRank(internMuonsEmtfNeg);
302  calculateRank(internMuonsEmtfPos);
303  calculateRank(internMuonsOmtfNeg);
304  calculateRank(internMuonsOmtfPos);
305 
306  // The sort function both sorts and removes all but best "nSurvivors"
307  sortMuons(internMuonsBmtf, 8);
308  sortMuons(internMuonsOmtfPos, 4);
309  sortMuons(internMuonsOmtfNeg, 4);
310  sortMuons(internMuonsEmtfPos, 4);
311  sortMuons(internMuonsEmtfNeg, 4);
312 
313  // This combines the 5 streams into one InternalMuon collection for
314  // the final global sort.
316  addMuonsToCollections(internMuonsEmtfPos, internalMuons, imdMuonsEMTFPos, bx);
317  addMuonsToCollections(internMuonsOmtfPos, internalMuons, imdMuonsOMTFPos, bx);
318  addMuonsToCollections(internMuonsBmtf, internalMuons, imdMuonsBMTF, bx);
319  addMuonsToCollections(internMuonsOmtfNeg, internalMuons, imdMuonsOMTFNeg, bx);
320  addMuonsToCollections(internMuonsEmtfNeg, internalMuons, imdMuonsEMTFNeg, bx);
321 
322  // sort internal muons and delete all but best 8
323  sortMuons(internalMuons, 8);
324 
325  m_isolationUnit.isolatePreSummed(internalMuons);
326  // copy muons to output collection...
327  for (const auto& mu : internalMuons) {
328  if (mu->hwPt() > 0) {
330  (mu->hwPt() - 1) * 0.5, mu->hwEta() * 0.010875, mu->hwGlobalPhi() * 0.010908, 0.0};
331  int iso = mu->hwAbsIso() + (mu->hwRelIso() << 1);
332  int outMuQual = MicroGMTConfiguration::setOutputMuonQuality(mu->hwQual(), mu->trackFinderType(), mu->hwHF());
333  Muon outMu{vec,
334  mu->hwPt(),
335  mu->hwEta(),
336  mu->hwGlobalPhi(),
337  outMuQual,
338  mu->hwSign(),
339  mu->hwSignValid(),
340  iso,
341  mu->tfMuonIndex(),
342  0,
343  true,
344  mu->hwIsoSum(),
345  mu->hwDPhi(),
346  mu->hwDEta(),
347  mu->hwRank()};
348 
349  // Set coordinates at the vertex
350  outMu.setHwEtaAtVtx(MicroGMTConfiguration::calcMuonHwEtaExtra(outMu));
351  outMu.setHwPhiAtVtx(MicroGMTConfiguration::calcMuonHwPhiExtra(outMu));
352  outMu.setEtaAtVtx(MicroGMTConfiguration::calcMuonEtaExtra(outMu));
353  outMu.setPhiAtVtx(MicroGMTConfiguration::calcMuonPhiExtra(outMu));
354 
355  // Set displacement information
356  int hwPtUnconstrained{mu->hwPtUnconstrained()};
357  outMu.setPtUnconstrained(
358  hwPtUnconstrained == 0
359  ? 0
360  : (hwPtUnconstrained - 1)); // Don't want negative pT, unconstr. pT has LSB of 1 GeV.
361  outMu.setHwPtUnconstrained(hwPtUnconstrained);
362  outMu.setHwDXY(mu->hwDXY());
363 
364  if (mu->hwSignValid()) {
365  outMu.setCharge(1 - 2 * mu->hwSign());
366  } else {
367  outMu.setCharge(0);
368  }
369  m_debugOut << mu->hwCaloPhi() << " " << mu->hwCaloEta() << std::endl;
370  outMuons->push_back(bx, outMu);
371  }
372  }
373  }
374 
375  iEvent.put(std::move(outMuons));
376  iEvent.put(std::move(imdMuonsBMTF), "imdMuonsBMTF");
377  iEvent.put(std::move(imdMuonsEMTFPos), "imdMuonsEMTFPos");
378  iEvent.put(std::move(imdMuonsEMTFNeg), "imdMuonsEMTFNeg");
379  iEvent.put(std::move(imdMuonsOMTFPos), "imdMuonsOMTFPos");
380  iEvent.put(std::move(imdMuonsOMTFNeg), "imdMuonsOMTFNeg");
381 }
int getLastBX() const
void setCancelOutBitsOverlapEndcap(GMTInternalWedges &, GMTInternalWedges &, cancelmode)
Cancel-out between overlap and endcap track finders.
int getFirstBX() const
void extrapolateMuons(MicroGMTConfiguration::InterMuonList &) const
std::ofstream m_debugOut
void setCancelOutBitsOverlapBarrel(GMTInternalWedges &, GMTInternalWedges &, cancelmode)
Cancel-out between overlap and barrel track finders.
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_endcapTfInputToken
std::bitset< 12 > m_bmtfInputsToDisable
void convertMuons(edm::Handle< MicroGMTConfiguration::InputCollection > const &in, MicroGMTConfiguration::InterMuonList &out, GMTInternalWedges &wedges, int bx) const
void setTowerSums(const MicroGMTConfiguration::CaloInputCollection &inputs, int bx)
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_overlapTfInputToken
edm::EDGetTokenT< MicroGMTConfiguration::CaloInputCollection > m_caloTowerInputToken
MicroGMTIsolationUnit m_isolationUnit
l1t::cancelmode m_emtfCancelMode
void calculateRank(MicroGMTConfiguration::InterMuonList &muons) const
void isolatePreSummed(MicroGMTConfiguration::InterMuonList &muons) const
void sortMuons(MicroGMTConfiguration::InterMuonList &, unsigned) const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
std::bitset< 12 > m_emtfInputsToDisable
int iEvent
Definition: GenABIO.cc:224
Definition: Muon.py:1
void addMuonsToCollections(MicroGMTConfiguration::InterMuonList &coll, MicroGMTConfiguration::InterMuonList &interout, std::unique_ptr< MuonBxCollection > &out, int bx) const
void splitAndConvertMuons(edm::Handle< MicroGMTConfiguration::InputCollection > const &in, MicroGMTConfiguration::InterMuonList &out_pos, MicroGMTConfiguration::InterMuonList &out_neg, GMTInternalWedges &wedges_pos, GMTInternalWedges &wedges_neg, int bx) const
GMTInternalMuonList InterMuonList
std::bitset< 12 > m_maskedBmtfInputs
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
void setCancelOutBits(GMTInternalWedges &, tftype, cancelmode)
Cancel out between sectors/wedges in one track finder.
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_barrelTfInputToken
HLT enums.
std::bitset< 12 > m_maskedEmtfInputs
l1t::cancelmode m_bmtfCancelMode
std::map< int, std::vector< std::shared_ptr< GMTInternalMuon > > > GMTInternalWedges
std::bitset< 12 > m_maskedOmtfInputs
std::bitset< 28 > m_caloInputsToDisable
std::bitset< 12 > m_omtfInputsToDisable
MicroGMTCancelOutUnit m_cancelOutUnit
def move(src, dest)
Definition: eostools.py:511
std::bitset< 28 > m_maskedCaloInputs

◆ sortMuons()

void L1TMuonProducer::sortMuons ( MicroGMTConfiguration::InterMuonList muons,
unsigned  nSurvivors 
) const
private

Definition at line 388 of file L1TMuonProducer.cc.

References compareMuons(), and DiMuonV_cfg::muons.

Referenced by produce().

388  {
389  MicroGMTConfiguration::InterMuonList::iterator mu1;
390  // reset from previous sort stage
391  for (mu1 = muons.begin(); mu1 != muons.end(); ++mu1) {
392  (*mu1)->setHwWins(0);
393  }
394 
395  for (mu1 = muons.begin(); mu1 != muons.end(); ++mu1) {
396  int mu1CancelBit = (*mu1)->hwCancelBit();
397  auto mu2 = mu1;
398  mu2++;
399  for (; mu2 != muons.end(); ++mu2) {
400  if (mu1CancelBit != 1 && (*mu2)->hwCancelBit() != 1) {
401  if ((*mu1)->hwRank() >= (*mu2)->hwRank()) {
402  (*mu1)->increaseWins();
403  } else {
404  (*mu2)->increaseWins();
405  }
406  } else if (mu1CancelBit != 1) {
407  (*mu1)->increaseWins();
408  } else if ((*mu2)->hwCancelBit() != 1) {
409  (*mu2)->increaseWins();
410  }
411  }
412  }
413 
414  size_t nMuonsBefore = muons.size();
415  int minWins = nMuonsBefore - nSurvivors;
416 
417  // remove all muons that were cancelled or that do not have sufficient rank
418  // (reduces the container size to nSurvivors)
419  muons.remove_if([&minWins](auto muon) { return ((muon->hwWins() < minWins) || (muon->hwCancelBit() == 1)); });
421 }
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:212
static bool compareMuons(const std::shared_ptr< MicroGMTConfiguration::InterMuon > &mu1, const std::shared_ptr< MicroGMTConfiguration::InterMuon > &mu2)

◆ splitAndConvertMuons()

void L1TMuonProducer::splitAndConvertMuons ( edm::Handle< MicroGMTConfiguration::InputCollection > const &  in,
MicroGMTConfiguration::InterMuonList out_pos,
MicroGMTConfiguration::InterMuonList out_neg,
GMTInternalWedges wedges_pos,
GMTInternalWedges wedges_neg,
int  bx 
) const
private

Definition at line 472 of file L1TMuonProducer.cc.

References nano_mu_digi_cff::bx, computeMuonIdx(), mps_fire::i, recoMuon::in, m_inputsToDisable, m_maskedInputs, MillePedeFileConverter_cfg::out, and findQualityFiles::size.

Referenced by produce().

477  {
478  // initialize the wedge collections:
479  for (int i = 0; i < 6; ++i) {
480  wedges_pos[i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
481  wedges_pos[i].reserve(3);
482  wedges_neg[i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
483  wedges_neg[i].reserve(3);
484  }
485  if (bx < in->getFirstBX() || bx > in->getLastBX())
486  return;
487  int muIdxAuto = 0;
488  int currentLink = 0;
489  for (size_t i = 0; i < in->size(bx); ++i, ++muIdxAuto) {
490  if (in->at(bx, i).hwPt() > 0) {
491  int link = in->at(bx, i).link();
492  if (m_inputsToDisable.test(link) || m_maskedInputs.test(link)) {
493  continue; // only process if input link is enabled and not masked
494  }
495  if (currentLink != link) {
496  muIdxAuto = 0;
497  currentLink = link;
498  }
499  int gPhi = MicroGMTConfiguration::calcGlobalPhi(
500  in->at(bx, i).hwPhi(), in->at(bx, i).trackFinderType(), in->at(bx, i).processor());
501  int tfMuonIdx{computeMuonIdx(in->at(bx, i), currentLink, muIdxAuto)};
502  std::shared_ptr<GMTInternalMuon> out = std::make_shared<GMTInternalMuon>(in->at(bx, i), gPhi, tfMuonIdx);
503  if (in->at(bx, i).hwEta() > 0) {
504  out_pos.push_back(out);
505  wedges_pos[in->at(bx, i).processor()].push_back(out);
506  } else {
507  out_neg.emplace_back(out);
508  wedges_neg[in->at(bx, i).processor()].push_back(out);
509  }
510  }
511  }
512  for (int i = 0; i < 6; ++i) {
513  if (wedges_pos[i].size() > 3)
514  edm::LogWarning("Input Mismatch") << " too many inputs per processor for emtf+ / omtf+. Wedge " << i << ": Size "
515  << wedges_pos[i].size() << std::endl;
516  if (wedges_neg[i].size() > 3)
517  edm::LogWarning("Input Mismatch") << " too many inputs per processor for emtf- / omtf-. Wedge " << i << ": Size "
518  << wedges_neg[i].size() << std::endl;
519  }
520 }
size
Write out results.
int computeMuonIdx(const RegionalMuonCand &mu, int currentLink, int muIdxAuto) const
std::bitset< 72 > m_maskedInputs
std::bitset< 72 > m_inputsToDisable
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ m_autoBxRange

bool L1TMuonProducer::m_autoBxRange
private

Definition at line 98 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer(), and produce().

◆ m_autoCancelMode

bool L1TMuonProducer::m_autoCancelMode
private

Definition at line 101 of file L1TMuonProducer.cc.

Referenced by beginRun(), and L1TMuonProducer().

◆ m_barrelTfInputTag

edm::InputTag L1TMuonProducer::m_barrelTfInputTag
private

Definition at line 113 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer().

◆ m_barrelTfInputToken

edm::EDGetTokenT<MicroGMTConfiguration::InputCollection> L1TMuonProducer::m_barrelTfInputToken
private

Definition at line 124 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer(), and produce().

◆ m_bmtfCancelMode

l1t::cancelmode L1TMuonProducer::m_bmtfCancelMode
private

Definition at line 121 of file L1TMuonProducer.cc.

Referenced by beginRun(), L1TMuonProducer(), and produce().

◆ m_bmtfInputsToDisable

std::bitset<12> L1TMuonProducer::m_bmtfInputsToDisable
private

Definition at line 104 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_bxMax

int L1TMuonProducer::m_bxMax
private

Definition at line 100 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer(), and produce().

◆ m_bxMin

int L1TMuonProducer::m_bxMin
private

Definition at line 99 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer(), and produce().

◆ m_caloInputsToDisable

std::bitset<28> L1TMuonProducer::m_caloInputsToDisable
private

Definition at line 103 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_caloTowerInputToken

edm::EDGetTokenT<MicroGMTConfiguration::CaloInputCollection> L1TMuonProducer::m_caloTowerInputToken
private

Definition at line 127 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer(), and produce().

◆ m_cancelOutUnit

MicroGMTCancelOutUnit L1TMuonProducer::m_cancelOutUnit
private

Definition at line 119 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_debugOut

std::ofstream L1TMuonProducer::m_debugOut
private

Definition at line 120 of file L1TMuonProducer.cc.

Referenced by produce(), and ~L1TMuonProducer().

◆ m_emtfCancelMode

l1t::cancelmode L1TMuonProducer::m_emtfCancelMode
private

Definition at line 122 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer(), and produce().

◆ m_emtfInputsToDisable

std::bitset<12> L1TMuonProducer::m_emtfInputsToDisable
private

Definition at line 106 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_endcapTfInputTag

edm::InputTag L1TMuonProducer::m_endcapTfInputTag
private

Definition at line 115 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer().

◆ m_endcapTfInputToken

edm::EDGetTokenT<MicroGMTConfiguration::InputCollection> L1TMuonProducer::m_endcapTfInputToken
private

Definition at line 126 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer(), and produce().

◆ m_inputsToDisable

std::bitset<72> L1TMuonProducer::m_inputsToDisable
private

Definition at line 102 of file L1TMuonProducer.cc.

Referenced by beginRun(), convertMuons(), and splitAndConvertMuons().

◆ m_isolationUnit

MicroGMTIsolationUnit L1TMuonProducer::m_isolationUnit
private

Definition at line 118 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_maskedBmtfInputs

std::bitset<12> L1TMuonProducer::m_maskedBmtfInputs
private

Definition at line 109 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_maskedCaloInputs

std::bitset<28> L1TMuonProducer::m_maskedCaloInputs
private

Definition at line 108 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_maskedEmtfInputs

std::bitset<12> L1TMuonProducer::m_maskedEmtfInputs
private

Definition at line 111 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_maskedInputs

std::bitset<72> L1TMuonProducer::m_maskedInputs
private

Definition at line 107 of file L1TMuonProducer.cc.

Referenced by beginRun(), convertMuons(), and splitAndConvertMuons().

◆ m_maskedOmtfInputs

std::bitset<12> L1TMuonProducer::m_maskedOmtfInputs
private

Definition at line 110 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_microGMTParamsToken

edm::ESGetToken<L1TMuonGlobalParams, L1TMuonGlobalParamsRcd> L1TMuonProducer::m_microGMTParamsToken
private

Definition at line 128 of file L1TMuonProducer.cc.

Referenced by beginRun(), and L1TMuonProducer().

◆ m_o2oProtoToken

edm::ESGetToken<L1TMuonGlobalParams, L1TMuonGlobalParamsO2ORcd> L1TMuonProducer::m_o2oProtoToken
private

Definition at line 129 of file L1TMuonProducer.cc.

Referenced by beginRun(), and L1TMuonProducer().

◆ m_omtfInputsToDisable

std::bitset<12> L1TMuonProducer::m_omtfInputsToDisable
private

Definition at line 105 of file L1TMuonProducer.cc.

Referenced by beginRun(), and produce().

◆ m_overlapTfInputTag

edm::InputTag L1TMuonProducer::m_overlapTfInputTag
private

Definition at line 114 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer().

◆ m_overlapTfInputToken

edm::EDGetTokenT<MicroGMTConfiguration::InputCollection> L1TMuonProducer::m_overlapTfInputToken
private

Definition at line 125 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer(), and produce().

◆ m_rankPtQualityLUT

std::shared_ptr<MicroGMTRankPtQualLUT> L1TMuonProducer::m_rankPtQualityLUT
private

Definition at line 117 of file L1TMuonProducer.cc.

Referenced by beginRun(), and calculateRank().

◆ m_trigTowerTag

edm::InputTag L1TMuonProducer::m_trigTowerTag
private

Definition at line 116 of file L1TMuonProducer.cc.

Referenced by L1TMuonProducer().

◆ microGMTParamsHelper

std::unique_ptr<L1TMuonGlobalParamsHelper> L1TMuonProducer::microGMTParamsHelper
private

Definition at line 112 of file L1TMuonProducer.cc.

Referenced by beginRun().