CMS 3D CMS Logo

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

#include <PhysicsTools/L1TriggerResultsConverter/plugins/L1TriggerResultsConverter.cc>

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

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

std::vector< unsigned int > indices_
 
const bool legacyL1_
 
const unsigned int m_triggerRulePrefireVetoBit = 255
 
std::vector< unsigned int > mask_
 
std::vector< std::string > names_
 
const bool store_unprefireable_bit_
 
const edm::EDGetTokenT< GlobalAlgBlkBxCollectiontoken_
 
const edm::EDGetTokenT< GlobalExtBlkBxCollectiontoken_ext_
 
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecordtokenLegacy_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 50 of file L1TriggerResultsConverter.cc.

Constructor & Destructor Documentation

◆ L1TriggerResultsConverter()

L1TriggerResultsConverter::L1TriggerResultsConverter ( const edm::ParameterSet params)
explicit

Definition at line 77 of file L1TriggerResultsConverter.cc.

78  : legacyL1_(params.getParameter<bool>("legacyL1")),
79  store_unprefireable_bit_(!legacyL1_ ? params.getParameter<bool>("storeUnprefireableBit") : false),
80  tokenLegacy_(legacyL1_ ? consumes<L1GlobalTriggerReadoutRecord>(params.getParameter<edm::InputTag>("src"))
82  token_(!legacyL1_ ? consumes<GlobalAlgBlkBxCollection>(params.getParameter<edm::InputTag>("src"))
85  ? consumes<GlobalExtBlkBxCollection>(params.getParameter<edm::InputTag>("src_ext"))
87  produces<edm::TriggerResults>();
88 }

◆ ~L1TriggerResultsConverter()

L1TriggerResultsConverter::~L1TriggerResultsConverter ( )
override

Definition at line 90 of file L1TriggerResultsConverter.cc.

90  {
91  // do anything here that needs to be done at destruction time
92  // (e.g. close files, deallocate resources etc.)
93 }

Member Function Documentation

◆ beginRun()

void L1TriggerResultsConverter::beginRun ( edm::Run const &  ,
edm::EventSetup const &  setup 
)
overrideprivate

Definition at line 99 of file L1TriggerResultsConverter.cc.

99  {
100  mask_.clear();
101  names_.clear();
102  indices_.clear();
103  if (legacyL1_) {
105  edm::ESHandle<L1GtTriggerMask> handleAlgoMask;
106  setup.get<L1GtTriggerMenuRcd>().get(handleMenu);
107  auto const& mapping = handleMenu->gtAlgorithmAliasMap();
108  for (auto const& keyval : mapping) {
109  names_.push_back(keyval.first);
110  indices_.push_back(keyval.second.algoBitNumber());
111  }
112  setup.get<L1GtTriggerMaskAlgoTrigRcd>().get(handleAlgoMask);
113  mask_ = handleAlgoMask->gtTriggerMask();
114  } else {
117  auto const& mapping = menu->getAlgorithmMap();
118  for (auto const& keyval : mapping) {
119  names_.push_back(keyval.first);
120  indices_.push_back(keyval.second.getIndex());
121  }
123  names_.push_back("L1_UnprefireableEvent");
124  }
125 }

References get, L1GtTriggerMenu::gtAlgorithmAliasMap(), L1GtTriggerMask::gtTriggerMask(), indices_, legacyL1_, taus_updatedMVAIds_cff::mapping, mask_, optionsL1T::menu, names_, singleTopDQM_cfi::setup, and store_unprefireable_bit_.

◆ fillDescriptions()

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

Definition at line 167 of file L1TriggerResultsConverter.cc.

167  {
169  desc.add<bool>("legacyL1")->setComment("is legacy L1");
170  desc.add<edm::InputTag>("src")->setComment(
171  "L1 input (L1GlobalTriggerReadoutRecord if legacy, GlobalAlgBlkBxCollection otherwise)");
172  desc.add<bool>("storeUnprefireableBit", false)
173  ->setComment("Activate storage of L1 unprefireable bit (needs L1 external decision input)");
174  desc.add<edm::InputTag>("src_ext", edm::InputTag(""))
175  ->setComment("L1 external decision input (GlobalExtBlkBxCollection, only supported if not legacy");
176  descriptions.add("L1TriggerResultsConverter", desc);
177 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ produce()

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

Definition at line 129 of file L1TriggerResultsConverter.cc.

129  {
130  using namespace edm;
131  const std::vector<bool>* wordp = nullptr;
132  bool unprefireable_bit = false;
133  if (!legacyL1_) {
135  iEvent.getByToken(token_, handleResults);
136  wordp = &handleResults->at(0, 0).getAlgoDecisionFinal();
138  edm::Handle<GlobalExtBlkBxCollection> handleExtResults;
139  iEvent.getByToken(token_ext_, handleExtResults);
140  unprefireable_bit = handleExtResults->at(0, 0).getExternalDecision(
142  }
143  } else {
144  // Legacy access
146  iEvent.getByToken(tokenLegacy_, handleResults);
147  wordp = &handleResults->decisionWord();
148  }
149  auto const& word = *wordp;
150  HLTGlobalStatus l1bitsAsHLTStatus(names_.size());
151  unsigned indices_size = indices_.size();
152  for (size_t nidx = 0; nidx < indices_size; nidx++) {
153  unsigned int index = indices_[nidx];
154  bool result = word[index];
155  if (!mask_.empty())
156  result &= (mask_[index] != 0);
157  l1bitsAsHLTStatus[nidx] = HLTPathStatus(result ? edm::hlt::Pass : edm::hlt::Fail);
158  }
160  l1bitsAsHLTStatus[indices_size] = HLTPathStatus(unprefireable_bit ? edm::hlt::Pass : edm::hlt::Fail);
161  //mimic HLT trigger bits for L1
162  auto out = std::make_unique<edm::TriggerResults>(l1bitsAsHLTStatus, names_);
163  iEvent.put(std::move(out));
164 }

References BXVector< T >::at(), L1GlobalTriggerReadoutRecord::decisionWord(), edm::hlt::Fail, iEvent, indices_, legacyL1_, m_triggerRulePrefireVetoBit, mask_, SiStripPI::max, GlobalExtBlk::maxExternalConditions, eostools::move(), names_, MillePedeFileConverter_cfg::out, edm::hlt::Pass, mps_fire::result, store_unprefireable_bit_, token_, token_ext_, and tokenLegacy_.

Member Data Documentation

◆ indices_

std::vector<unsigned int> L1TriggerResultsConverter::indices_
private

Definition at line 69 of file L1TriggerResultsConverter.cc.

Referenced by beginRun(), and produce().

◆ legacyL1_

const bool L1TriggerResultsConverter::legacyL1_
private

Definition at line 62 of file L1TriggerResultsConverter.cc.

Referenced by beginRun(), and produce().

◆ m_triggerRulePrefireVetoBit

const unsigned int L1TriggerResultsConverter::m_triggerRulePrefireVetoBit = 255
private

Definition at line 71 of file L1TriggerResultsConverter.cc.

Referenced by produce().

◆ mask_

std::vector<unsigned int> L1TriggerResultsConverter::mask_
private

Definition at line 68 of file L1TriggerResultsConverter.cc.

Referenced by beginRun(), and produce().

◆ names_

std::vector<std::string> L1TriggerResultsConverter::names_
private

Definition at line 67 of file L1TriggerResultsConverter.cc.

Referenced by beginRun(), and produce().

◆ store_unprefireable_bit_

const bool L1TriggerResultsConverter::store_unprefireable_bit_
private

Definition at line 63 of file L1TriggerResultsConverter.cc.

Referenced by beginRun(), and produce().

◆ token_

const edm::EDGetTokenT<GlobalAlgBlkBxCollection> L1TriggerResultsConverter::token_
private

Definition at line 65 of file L1TriggerResultsConverter.cc.

Referenced by produce().

◆ token_ext_

const edm::EDGetTokenT<GlobalExtBlkBxCollection> L1TriggerResultsConverter::token_ext_
private

Definition at line 66 of file L1TriggerResultsConverter.cc.

Referenced by produce().

◆ tokenLegacy_

const edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> L1TriggerResultsConverter::tokenLegacy_
private

Definition at line 64 of file L1TriggerResultsConverter.cc.

Referenced by produce().

L1TUtmTriggerMenuRcd
Definition: L1TUtmTriggerMenuRcd.h:11
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
L1TriggerResultsConverter::legacyL1_
const bool legacyL1_
Definition: L1TriggerResultsConverter.cc:62
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord >
GlobalExtBlk::maxExternalConditions
const static unsigned int maxExternalConditions
Definition: GlobalExtBlk.h:43
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::HLTGlobalStatus
Definition: HLTGlobalStatus.h:25
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
L1TriggerResultsConverter::store_unprefireable_bit_
const bool store_unprefireable_bit_
Definition: L1TriggerResultsConverter.cc:63
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
L1TriggerResultsConverter::tokenLegacy_
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tokenLegacy_
Definition: L1TriggerResultsConverter.cc:64
L1GtTriggerMenuRcd
Definition: L1GtTriggerMenuRcd.h:32
L1GtTriggerMaskAlgoTrigRcd
Definition: L1GtTriggerMaskAlgoTrigRcd.h:39
edm::ESHandle
Definition: DTSurvey.h:22
L1TriggerResultsConverter::token_ext_
const edm::EDGetTokenT< GlobalExtBlkBxCollection > token_ext_
Definition: L1TriggerResultsConverter.cc:66
optionsL1T.menu
menu
Definition: optionsL1T.py:29
edm::hlt::Fail
reject
Definition: HLTenums.h:19
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
L1GtTriggerMask::gtTriggerMask
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
Definition: L1GtTriggerMask.h:47
L1GlobalTriggerReadoutRecord::decisionWord
const DecisionWord & decisionWord(int bxInEventValue) const
Definition: L1GlobalTriggerReadoutRecord.cc:186
BXVector::at
const T & at(int bx, unsigned i) const
edm::HLTPathStatus
Definition: HLTPathStatus.h:33
L1TriggerResultsConverter::mask_
std::vector< unsigned int > mask_
Definition: L1TriggerResultsConverter.cc:68
iEvent
int iEvent
Definition: GenABIO.cc:224
L1GtTriggerMenu::gtAlgorithmAliasMap
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
Definition: L1GtTriggerMenu.h:192
get
#define get
L1TriggerResultsConverter::indices_
std::vector< unsigned int > indices_
Definition: L1TriggerResultsConverter.cc:69
L1TriggerResultsConverter::names_
std::vector< std::string > names_
Definition: L1TriggerResultsConverter.cc:67
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
L1TriggerResultsConverter::token_
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > token_
Definition: L1TriggerResultsConverter.cc:65
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
L1TriggerResultsConverter::m_triggerRulePrefireVetoBit
const unsigned int m_triggerRulePrefireVetoBit
Definition: L1TriggerResultsConverter.cc:71
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:311
edm::hlt::Pass
accept
Definition: HLTenums.h:18
taus_updatedMVAIds_cff.mapping
mapping
Definition: taus_updatedMVAIds_cff.py:29
edm::InputTag
Definition: InputTag.h:15