CMS 3D CMS Logo

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

#include <L1GlobalTriggerRecordProducer.h>

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

Public Member Functions

 L1GlobalTriggerRecordProducer (const edm::ParameterSet &)
 constructor(s) More...
 
 ~L1GlobalTriggerRecordProducer () override
 destructor More...
 
- 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
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< L1GlobalTriggerReadoutRecordm_l1GtReadoutRecordTag
 InputTag for the L1 Global Trigger DAQ readout record. More...
 
const L1GtTriggerMaskm_l1GtTmAlgo
 cached stuff More...
 
unsigned long long m_l1GtTmAlgoCacheID
 
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcdm_l1GtTmAlgoToken
 EventSetup Token for l1GtTriggerMaskAlgo. More...
 
const L1GtTriggerMaskm_l1GtTmTech
 
unsigned long long m_l1GtTmTechCacheID
 
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskTechTrigRcdm_l1GtTmTechToken
 EventSetupToken for L1GtTriggerMaskTech. More...
 
std::vector< unsigned int > m_triggerMaskAlgoTrig
 
std::vector< unsigned int > m_triggerMaskTechTrig
 

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: L1GlobalTriggerRecord producer.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna

Definition at line 41 of file L1GlobalTriggerRecordProducer.h.

Constructor & Destructor Documentation

◆ L1GlobalTriggerRecordProducer()

L1GlobalTriggerRecordProducer::L1GlobalTriggerRecordProducer ( const edm::ParameterSet parSet)
explicit

constructor(s)

EventSetup Token for l1GtTriggerMaskAlgo

EventSetupToken for L1GtTriggerMaskTech

Definition at line 34 of file L1GlobaTriggerRecordProducer.cc.

34  {
35  produces<L1GlobalTriggerRecord>();
36 
37  // input tag for DAQ GT record
39  consumes<L1GlobalTriggerReadoutRecord>(parSet.getParameter<edm::InputTag>("L1GtReadoutRecordTag"));
40 
41  LogDebug("L1GlobalTriggerRecordProducer").log([&parSet](auto& l) {
42  l << "\nInput tag for L1 GT DAQ record: " << parSet.getParameter<edm::InputTag>("L1GtReadoutRecordTag");
43  });
45  m_l1GtTmAlgoToken = esConsumes<L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd>();
46 
48  m_l1GtTmTechToken = esConsumes<L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd>();
49 
50  // initialize cached IDs
51 
52  m_l1GtTmAlgoCacheID = 0ULL;
53  m_l1GtTmTechCacheID = 0ULL;
54 }

References edm::ParameterSet::getParameter(), cmsLHEtoEOSManager::l, LogDebug, m_l1GtReadoutRecordTag, m_l1GtTmAlgoCacheID, m_l1GtTmAlgoToken, m_l1GtTmTechCacheID, and m_l1GtTmTechToken.

◆ ~L1GlobalTriggerRecordProducer()

L1GlobalTriggerRecordProducer::~L1GlobalTriggerRecordProducer ( )
override

destructor

Definition at line 57 of file L1GlobaTriggerRecordProducer.cc.

57  {
58  // empty
59 }

Member Function Documentation

◆ produce()

void L1GlobalTriggerRecordProducer::produce ( edm::Event iEvent,
const edm::EventSetup evSetup 
)
overrideprivate

set global decision, decision word and technical trigger word for bunch cross with L1Accept (BxInEvent = 0) before applying the masks

Definition at line 64 of file L1GlobaTriggerRecordProducer.cc.

64  {
65  // produce the L1GlobalTriggerRecord
66  std::unique_ptr<L1GlobalTriggerRecord> gtRecord(new L1GlobalTriggerRecord());
67 
68  // get L1GlobalTriggerReadoutRecord
70  iEvent.getByToken(m_l1GtReadoutRecordTag, gtReadoutRecord);
71 
72  if (!gtReadoutRecord.isValid()) {
73  LogDebug("L1GlobalTriggerRecordProducer").log([this](auto& l) {
74  l << "\n\n Error: no L1GlobalTriggerReadoutRecord found with input tag ";
76  labelsForToken(m_l1GtReadoutRecordTag, labels);
77  l << labels.module << " " << labels.productInstance << " " << labels.process
78  << "\n Returning empty L1GlobalTriggerRecord.\n\n";
79  });
80  iEvent.put(std::move(gtRecord));
81  return;
82  }
83 
84  //
85  cms_uint16_t gtFinalOR = gtReadoutRecord->finalOR();
86  int physicsDaqPartition = 0;
87  bool gtDecision = static_cast<bool>(gtFinalOR & (1 << physicsDaqPartition));
88 
89  DecisionWord algoDecisionWord = gtReadoutRecord->decisionWord();
90  TechnicalTriggerWord techDecisionWord = gtReadoutRecord->technicalTriggerWord();
91 
92  // get / update the trigger mask from the EventSetup
93  // local cache & check on cacheIdentifier
94 
95  unsigned long long l1GtTmAlgoCacheID = evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();
96 
97  if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
99  m_l1GtTmAlgo = l1GtTmAlgo.product();
100 
102 
103  m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;
104  }
105 
106  unsigned long long l1GtTmTechCacheID = evSetup.get<L1GtTriggerMaskTechTrigRcd>().cacheIdentifier();
107 
108  if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
110  m_l1GtTmTech = l1GtTmTech.product();
111 
113 
114  m_l1GtTmTechCacheID = l1GtTmTechCacheID;
115  }
116 
119  gtRecord->setDecisionWordBeforeMask(algoDecisionWord);
120  gtRecord->setTechnicalTriggerWordBeforeMask(techDecisionWord);
121 
122  // mask the required bits for DAQ partition 0 (Physics Partition)
123 
124  int iDaq = 0;
125 
126  // algorithm trigger mask
127 
128  int iBit = -1; // bit counter
129 
130  for (std::vector<bool>::iterator itBit = algoDecisionWord.begin(); itBit != algoDecisionWord.end(); ++itBit) {
131  iBit++;
132 
133  int triggerMaskAlgoTrigBit = m_triggerMaskAlgoTrig[iBit] & (1 << iDaq);
134  //LogTrace("L1GlobalTriggerFDL")
135  //<< "\nAlgorithm trigger bit: " << iBit
136  //<< " mask = " << triggerMaskAlgoTrigBit
137  //<< " DAQ partition " << iDaq
138  //<< std::endl;
139 
140  if (triggerMaskAlgoTrigBit) {
141  *itBit = false;
142 
143  //LogTrace("L1GlobalTriggerFDL")
144  //<< "\nMasked algorithm trigger: " << iBit << ". Result set to false"
145  //<< std::endl;
146  }
147  }
148 
149  // mask the technical trigger
150 
151  iBit = -1; // bit counter
152 
153  for (std::vector<bool>::iterator itBit = techDecisionWord.begin(); itBit != techDecisionWord.end(); ++itBit) {
154  iBit++;
155 
156  int triggerMaskTechTrigBit = m_triggerMaskTechTrig[iBit] & (1 << iDaq);
157  //LogTrace("L1GlobalTriggerFDL")
158  //<< "\nTechnical trigger bit: " << iBit
159  //<< " mask = " << triggerMaskTechTrigBit
160  //<< " DAQ partition " << iDaq
161  //<< std::endl;
162 
163  if (triggerMaskTechTrigBit) {
164  *itBit = false;
165 
166  //LogTrace("L1GlobalTriggerFDL")
167  //<< "\nMasked technical trigger: " << iBit << ". Result set to false"
168  //<< std::endl;
169  }
170  }
171 
172  // set global decision, decision word and technical trigger word
173  // for bunch cross with L1Accept (BxInEvent = 0) after applying the trigger masks
174  gtRecord->setDecision(gtDecision);
175  gtRecord->setDecisionWord(algoDecisionWord);
176  gtRecord->setTechnicalTriggerWord(techDecisionWord);
177 
178  // get/set index of the set of prescale factors
179  unsigned int pfIndexTech = static_cast<unsigned int>((gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexTech());
180  unsigned int pfIndexAlgo = static_cast<unsigned int>((gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo());
181 
182  gtRecord->setGtPrescaleFactorIndexTech(pfIndexTech);
183  gtRecord->setGtPrescaleFactorIndexAlgo(pfIndexAlgo);
184 
185  if (edm::isDebugEnabled()) {
186  std::ostringstream myCoutStream;
187  gtRecord->print(myCoutStream);
188  LogTrace("L1GlobalTriggerRecordProducer") << "\n The following L1 GT record was produced.\n"
189  << myCoutStream.str() << "\n"
190  << std::endl;
191  }
192 
193  // put records into event
194  iEvent.put(std::move(gtRecord));
195 }

References L1GlobalTriggerReadoutRecord::decisionWord(), L1GlobalTriggerReadoutRecord::finalOR(), edm::EventSetup::get(), edm::EventSetup::getHandle(), L1GlobalTriggerReadoutRecord::gtFdlWord(), L1GtTriggerMask::gtTriggerMask(), iEvent, edm::isDebugEnabled(), edm::HandleBase::isValid(), cmsLHEtoEOSManager::l, SummaryClient_cfi::labels, LogDebug, LogTrace, m_l1GtReadoutRecordTag, m_l1GtTmAlgo, m_l1GtTmAlgoCacheID, m_l1GtTmAlgoToken, m_l1GtTmTech, m_l1GtTmTechCacheID, m_l1GtTmTechToken, m_triggerMaskAlgoTrig, m_triggerMaskTechTrig, eostools::move(), edm::ESHandle< T >::product(), and L1GlobalTriggerReadoutRecord::technicalTriggerWord().

Member Data Documentation

◆ m_l1GtReadoutRecordTag

edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> L1GlobalTriggerRecordProducer::m_l1GtReadoutRecordTag
private

InputTag for the L1 Global Trigger DAQ readout record.

Definition at line 67 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

◆ m_l1GtTmAlgo

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmAlgo
private

cached stuff

trigger masks

Definition at line 56 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

◆ m_l1GtTmAlgoCacheID

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmAlgoCacheID
private

Definition at line 57 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

◆ m_l1GtTmAlgoToken

edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd> L1GlobalTriggerRecordProducer::m_l1GtTmAlgoToken
private

EventSetup Token for l1GtTriggerMaskAlgo.

Definition at line 69 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

◆ m_l1GtTmTech

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmTech
private

Definition at line 59 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

◆ m_l1GtTmTechCacheID

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmTechCacheID
private

Definition at line 60 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

◆ m_l1GtTmTechToken

edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd> L1GlobalTriggerRecordProducer::m_l1GtTmTechToken
private

EventSetupToken for L1GtTriggerMaskTech.

Definition at line 71 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

◆ m_triggerMaskAlgoTrig

std::vector<unsigned int> L1GlobalTriggerRecordProducer::m_triggerMaskAlgoTrig
private

Definition at line 62 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

◆ m_triggerMaskTechTrig

std::vector<unsigned int> L1GlobalTriggerRecordProducer::m_triggerMaskTechTrig
private

Definition at line 63 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

L1GlobalTriggerRecordProducer::m_l1GtReadoutRecordTag
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtReadoutRecordTag
InputTag for the L1 Global Trigger DAQ readout record.
Definition: L1GlobalTriggerRecordProducer.h:67
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
L1GlobalTriggerReadoutRecord::finalOR
const cms_uint16_t finalOR(int bxInEventValue) const
Definition: L1GlobalTriggerReadoutRecord.cc:159
L1GlobalTriggerRecordProducer::m_l1GtTmTechToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd > m_l1GtTmTechToken
EventSetupToken for L1GtTriggerMaskTech.
Definition: L1GlobalTriggerRecordProducer.h:71
L1GlobalTriggerRecordProducer::m_l1GtTmAlgoCacheID
unsigned long long m_l1GtTmAlgoCacheID
Definition: L1GlobalTriggerRecordProducer.h:57
L1GlobalTriggerRecordProducer::m_l1GtTmTechCacheID
unsigned long long m_l1GtTmTechCacheID
Definition: L1GlobalTriggerRecordProducer.h:60
L1GlobalTriggerRecordProducer::m_triggerMaskAlgoTrig
std::vector< unsigned int > m_triggerMaskAlgoTrig
Definition: L1GlobalTriggerRecordProducer.h:62
edm::Handle
Definition: AssociativeIterator.h:50
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
L1GlobalTriggerRecordProducer::m_l1GtTmAlgo
const L1GtTriggerMask * m_l1GtTmAlgo
cached stuff
Definition: L1GlobalTriggerRecordProducer.h:56
L1GtTriggerMaskTechTrigRcd
Definition: L1GtTriggerMaskTechTrigRcd.h:39
L1GtTriggerMaskAlgoTrigRcd
Definition: L1GtTriggerMaskAlgoTrigRcd.h:39
edm::ESHandle
Definition: DTSurvey.h:22
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
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
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
L1GlobalTriggerRecordProducer::m_triggerMaskTechTrig
std::vector< unsigned int > m_triggerMaskTechTrig
Definition: L1GlobalTriggerRecordProducer.h:63
cms_uint16_t
unsigned short cms_uint16_t
Definition: typedefs.h:13
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
DecisionWord
std::vector< bool > DecisionWord
typedefs
Definition: L1GlobalTriggerReadoutSetupFwd.h:34
L1GlobalTriggerRecordProducer::m_l1GtTmAlgoToken
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd > m_l1GtTmAlgoToken
EventSetup Token for l1GtTriggerMaskAlgo.
Definition: L1GlobalTriggerRecordProducer.h:69
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::isDebugEnabled
bool isDebugEnabled()
Definition: MessageLogger.cc:12
L1GlobalTriggerReadoutRecord::technicalTriggerWord
const TechnicalTriggerWord & technicalTriggerWord(int bxInEventValue) const
Definition: L1GlobalTriggerReadoutRecord.cc:212
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
TechnicalTriggerWord
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
Definition: L1GlobalTriggerReadoutSetupFwd.h:41
L1GlobalTriggerRecord
Definition: L1GlobalTriggerRecord.h:33
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
L1GlobalTriggerReadoutRecord::gtFdlWord
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
Definition: L1GlobalTriggerReadoutRecord.cc:372
edm::InputTag
Definition: InputTag.h:15
edm::ProductLabels
Definition: ProductLabels.h:4
L1GlobalTriggerRecordProducer::m_l1GtTmTech
const L1GtTriggerMask * m_l1GtTmTech
Definition: L1GlobalTriggerRecordProducer.h:59