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::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TriggerResultsConverter (const edm::ParameterSet &)
 
 ~L1TriggerResultsConverter () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

std::vector< unsigned int > indices_
 
const bool legacyL1_
 
std::vector< unsigned int > mask_
 
std::vector< std::string > names_
 
const edm::EDGetTokenT< GlobalAlgBlkBxCollectiontoken_
 
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecordtokenLegacy_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 50 of file L1TriggerResultsConverter.cc.

Constructor & Destructor Documentation

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

Definition at line 75 of file L1TriggerResultsConverter.cc.

75  :
76  legacyL1_( params.getParameter<bool>("legacyL1") ),
77  tokenLegacy_(legacyL1_?consumes<L1GlobalTriggerReadoutRecord>( params.getParameter<edm::InputTag>("src") ): edm::EDGetTokenT<L1GlobalTriggerReadoutRecord>()),
78  token_(!legacyL1_?consumes<GlobalAlgBlkBxCollection>( params.getParameter<edm::InputTag>("src") ): edm::EDGetTokenT<GlobalAlgBlkBxCollection>())
79 {
80  produces<edm::TriggerResults>();
81 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > token_
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tokenLegacy_
L1TriggerResultsConverter::~L1TriggerResultsConverter ( )
override

Definition at line 84 of file L1TriggerResultsConverter.cc.

85 {
86 
87  // do anything here that needs to be done at destruction time
88  // (e.g. close files, deallocate resources etc.)
89 
90 }

Member Function Documentation

void L1TriggerResultsConverter::beginRun ( edm::StreamID  streamID,
edm::Run const &  ,
edm::EventSetup const &  setup 
)
privatevirtual

Definition at line 97 of file L1TriggerResultsConverter.cc.

References edm::EventSetup::get(), L1TUtmTriggerMenu::getAlgorithmMap(), L1GtTriggerMenu::gtAlgorithmAliasMap(), L1GtTriggerMask::gtTriggerMask(), indices_, legacyL1_, taus_updatedMVAIds_cff::mapping, mask_, and names_.

97  {
98  mask_.clear();
99  names_.clear();
100  indices_.clear();
101  if(legacyL1_){
103  edm::ESHandle<L1GtTriggerMask> handleAlgoMask;
104  setup.get<L1GtTriggerMenuRcd>().get(handleMenu);
105  auto const & mapping = handleMenu->gtAlgorithmAliasMap();
106  for (auto const & keyval: mapping) {
107  names_.push_back(keyval.first);
108  indices_.push_back(keyval.second.algoBitNumber());
109  }
110  setup.get<L1GtTriggerMaskAlgoTrigRcd>().get(handleAlgoMask);
111  mask_ = handleAlgoMask->gtTriggerMask();
112  } else {
114  setup.get<L1TUtmTriggerMenuRcd>().get(menu);
115  auto const & mapping = menu->getAlgorithmMap();
116  for (auto const & keyval: mapping) {
117  names_.push_back(keyval.first);
118  indices_.push_back(keyval.second.getIndex());
119  }
120 
121  }
122 }
std::vector< unsigned int > indices_
std::vector< std::string > names_
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
std::vector< unsigned int > mask_
const std::map< std::string, L1TUtmAlgorithm > & getAlgorithmMap() const
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
void L1TriggerResultsConverter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 160 of file L1TriggerResultsConverter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

160  {
162  desc.add<bool>("legacyL1")->setComment("is legacy L1");
163  desc.add<edm::InputTag>("src")->setComment("L1 input (L1GlobalTriggerReadoutRecord if legacy, GlobalAlgBlkBxCollection otherwise)");
164  descriptions.add("L1TriggerResultsConverter",desc);
165 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void L1TriggerResultsConverter::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 128 of file L1TriggerResultsConverter.cc.

References BXVector< T >::at(), L1GlobalTriggerReadoutRecord::decisionWord(), edm::hlt::Fail, GlobalAlgBlk::getAlgoDecisionFinal(), edm::Event::getByToken(), indices_, legacyL1_, mask_, eostools::move(), names_, MillePedeFileConverter_cfg::out, edm::hlt::Pass, edm::Event::put(), mps_fire::result, token_, and tokenLegacy_.

129 {
130  using namespace edm;
131  const std::vector<bool> * wordp=nullptr;
132  if (!legacyL1_){
134  iEvent.getByToken(token_, handleResults);
135  wordp= & handleResults->at(0,0).getAlgoDecisionFinal() ;
136  } else {
137 // Legacy access
139  iEvent.getByToken(tokenLegacy_, handleResults);
140  wordp = & handleResults->decisionWord();
141  }
142  auto const &word = *wordp;
143  HLTGlobalStatus l1bitsAsHLTStatus(names_.size());
144 // std::cout << word.size() << " " << names_.size() << " " << mask_.size() << std::endl;
145  unsigned indices_size = indices_.size();
146  for(size_t nidx=0;nidx<indices_size; nidx++) {
147  unsigned int index = indices_[nidx];
148  bool result =word[index];
149  if(!mask_.empty()) result &= (mask_[index] !=0);
150  l1bitsAsHLTStatus[nidx]=HLTPathStatus(result?edm::hlt::Pass:edm::hlt::Fail);
151  }
152  //mimic HLT trigger bits for L1
153  auto out = std::make_unique<edm::TriggerResults>(l1bitsAsHLTStatus,names_);
154  iEvent.put(std::move(out));
155 
156 }
std::vector< unsigned int > indices_
std::vector< std::string > names_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::vector< bool > const & getAlgoDecisionFinal() const
Definition: GlobalAlgBlk.h:90
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
reject
Definition: HLTenums.h:20
accept
Definition: HLTenums.h:19
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > token_
const DecisionWord & decisionWord(int bxInEventValue) const
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tokenLegacy_
std::vector< unsigned int > mask_
HLT enums.
def move(src, dest)
Definition: eostools.py:511
const T & at(int bx, unsigned i) const

Member Data Documentation

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

Definition at line 67 of file L1TriggerResultsConverter.cc.

Referenced by beginRun(), and produce().

const bool L1TriggerResultsConverter::legacyL1_
private

Definition at line 62 of file L1TriggerResultsConverter.cc.

Referenced by beginRun(), and produce().

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

Definition at line 66 of file L1TriggerResultsConverter.cc.

Referenced by beginRun(), and produce().

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

Definition at line 65 of file L1TriggerResultsConverter.cc.

Referenced by beginRun(), and produce().

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

Definition at line 64 of file L1TriggerResultsConverter.cc.

Referenced by produce().

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

Definition at line 63 of file L1TriggerResultsConverter.cc.

Referenced by produce().