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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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
 
const L1GtTriggerMaskm_l1GtTmTech
 
unsigned long long m_l1GtTmTechCacheID
 
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 37 of file L1GlobalTriggerRecordProducer.h.

Constructor & Destructor Documentation

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

constructor(s)

Definition at line 38 of file L1GlobaTriggerRecordProducer.cc.

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

38  {
39  produces<L1GlobalTriggerRecord>();
40 
41  // input tag for DAQ GT record
43  consumes<L1GlobalTriggerReadoutRecord>(parSet.getParameter<edm::InputTag>("L1GtReadoutRecordTag"));
44 
45  LogDebug("L1GlobalTriggerRecordProducer").log([&parSet](auto& l) {
46  l << "\nInput tag for L1 GT DAQ record: " << parSet.getParameter<edm::InputTag>("L1GtReadoutRecordTag");
47  });
48 
49  // initialize cached IDs
50 
51  m_l1GtTmAlgoCacheID = 0ULL;
52  m_l1GtTmTechCacheID = 0ULL;
53 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtReadoutRecordTag
InputTag for the L1 Global Trigger DAQ readout record.
L1GlobalTriggerRecordProducer::~L1GlobalTriggerRecordProducer ( )
override

destructor

Definition at line 56 of file L1GlobaTriggerRecordProducer.cc.

56  {
57  // empty
58 }

Member Function Documentation

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 63 of file L1GlobaTriggerRecordProducer.cc.

References L1GlobalTriggerReadoutRecord::decisionWord(), L1GlobalTriggerReadoutRecord::finalOR(), edm::EventSetup::get(), edm::Event::getByToken(), L1GlobalTriggerReadoutRecord::gtFdlWord(), L1GtTriggerMask::gtTriggerMask(), edm::isDebugEnabled(), edm::HandleBase::isValid(), cmsLHEtoEOSManager::l, SummaryClient_cfi::labels, LogDebug, LogTrace, m_l1GtReadoutRecordTag, m_l1GtTmAlgo, m_l1GtTmAlgoCacheID, m_l1GtTmTech, m_l1GtTmTechCacheID, m_triggerMaskAlgoTrig, m_triggerMaskTechTrig, edm::ProductLabels::module, eostools::move(), edm::ProductLabels::process, edm::ESHandle< T >::product(), edm::ProductLabels::productInstance, edm::Event::put(), and L1GlobalTriggerReadoutRecord::technicalTriggerWord().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

63  {
64  // produce the L1GlobalTriggerRecord
65  std::unique_ptr<L1GlobalTriggerRecord> gtRecord(new L1GlobalTriggerRecord());
66 
67  // get L1GlobalTriggerReadoutRecord
69  iEvent.getByToken(m_l1GtReadoutRecordTag, gtReadoutRecord);
70 
71  if (!gtReadoutRecord.isValid()) {
72  LogDebug("L1GlobalTriggerRecordProducer").log([this](auto& l) {
73  l << "\n\n Error: no L1GlobalTriggerReadoutRecord found with input tag ";
75  labelsForToken(m_l1GtReadoutRecordTag, labels);
76  l << labels.module << " " << labels.productInstance << " " << labels.process
77  << "\n Returning empty L1GlobalTriggerRecord.\n\n";
78  });
79  iEvent.put(std::move(gtRecord));
80  return;
81  }
82 
83  //
84  cms_uint16_t gtFinalOR = gtReadoutRecord->finalOR();
85  int physicsDaqPartition = 0;
86  bool gtDecision = static_cast<bool>(gtFinalOR & (1 << physicsDaqPartition));
87 
88  DecisionWord algoDecisionWord = gtReadoutRecord->decisionWord();
89  TechnicalTriggerWord techDecisionWord = gtReadoutRecord->technicalTriggerWord();
90 
91  // get / update the trigger mask from the EventSetup
92  // local cache & check on cacheIdentifier
93 
94  unsigned long long l1GtTmAlgoCacheID = evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();
95 
96  if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
98  evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
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  evSetup.get<L1GtTriggerMaskTechTrigRcd>().get(l1GtTmTech);
111  m_l1GtTmTech = l1GtTmTech.product();
112 
114 
115  m_l1GtTmTechCacheID = l1GtTmTechCacheID;
116  }
117 
120  gtRecord->setDecisionWordBeforeMask(algoDecisionWord);
121  gtRecord->setTechnicalTriggerWordBeforeMask(techDecisionWord);
122 
123  // mask the required bits for DAQ partition 0 (Physics Partition)
124 
125  int iDaq = 0;
126 
127  // algorithm trigger mask
128 
129  int iBit = -1; // bit counter
130 
131  for (std::vector<bool>::iterator itBit = algoDecisionWord.begin(); itBit != algoDecisionWord.end(); ++itBit) {
132  iBit++;
133 
134  int triggerMaskAlgoTrigBit = m_triggerMaskAlgoTrig[iBit] & (1 << iDaq);
135  //LogTrace("L1GlobalTriggerFDL")
136  //<< "\nAlgorithm trigger bit: " << iBit
137  //<< " mask = " << triggerMaskAlgoTrigBit
138  //<< " DAQ partition " << iDaq
139  //<< std::endl;
140 
141  if (triggerMaskAlgoTrigBit) {
142  *itBit = false;
143 
144  //LogTrace("L1GlobalTriggerFDL")
145  //<< "\nMasked algorithm trigger: " << iBit << ". Result set to false"
146  //<< std::endl;
147  }
148  }
149 
150  // mask the technical trigger
151 
152  iBit = -1; // bit counter
153 
154  for (std::vector<bool>::iterator itBit = techDecisionWord.begin(); itBit != techDecisionWord.end(); ++itBit) {
155  iBit++;
156 
157  int triggerMaskTechTrigBit = m_triggerMaskTechTrig[iBit] & (1 << iDaq);
158  //LogTrace("L1GlobalTriggerFDL")
159  //<< "\nTechnical trigger bit: " << iBit
160  //<< " mask = " << triggerMaskTechTrigBit
161  //<< " DAQ partition " << iDaq
162  //<< std::endl;
163 
164  if (triggerMaskTechTrigBit) {
165  *itBit = false;
166 
167  //LogTrace("L1GlobalTriggerFDL")
168  //<< "\nMasked technical trigger: " << iBit << ". Result set to false"
169  //<< std::endl;
170  }
171  }
172 
173  // set global decision, decision word and technical trigger word
174  // for bunch cross with L1Accept (BxInEvent = 0) after applying the trigger masks
175  gtRecord->setDecision(gtDecision);
176  gtRecord->setDecisionWord(algoDecisionWord);
177  gtRecord->setTechnicalTriggerWord(techDecisionWord);
178 
179  // get/set index of the set of prescale factors
180  unsigned int pfIndexTech = static_cast<unsigned int>((gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexTech());
181  unsigned int pfIndexAlgo = static_cast<unsigned int>((gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo());
182 
183  gtRecord->setGtPrescaleFactorIndexTech(pfIndexTech);
184  gtRecord->setGtPrescaleFactorIndexAlgo(pfIndexAlgo);
185 
186  if (edm::isDebugEnabled()) {
187  std::ostringstream myCoutStream;
188  gtRecord->print(myCoutStream);
189  LogTrace("L1GlobalTriggerRecordProducer") << "\n The following L1 GT record was produced.\n"
190  << myCoutStream.str() << "\n"
191  << std::endl;
192  }
193 
194  // put records into event
195  iEvent.put(std::move(gtRecord));
196 }
#define LogDebug(id)
bool isDebugEnabled()
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtReadoutRecordTag
InputTag for the L1 Global Trigger DAQ readout record.
const TechnicalTriggerWord & technicalTriggerWord(int bxInEventValue) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< unsigned int > m_triggerMaskAlgoTrig
const cms_uint16_t finalOR(int bxInEventValue) const
char const * process
Definition: ProductLabels.h:7
const L1GtTriggerMask * m_l1GtTmAlgo
cached stuff
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
std::vector< bool > DecisionWord
typedefs
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
unsigned short cms_uint16_t
Definition: typedefs.h:13
bool isValid() const
Definition: HandleBase.h:70
char const * module
Definition: ProductLabels.h:5
std::vector< unsigned int > m_triggerMaskTechTrig
#define LogTrace(id)
const DecisionWord & decisionWord(int bxInEventValue) const
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
char const * productInstance
Definition: ProductLabels.h:6
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

InputTag for the L1 Global Trigger DAQ readout record.

Definition at line 63 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmAlgo
private

cached stuff

trigger masks

Definition at line 52 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmAlgoCacheID
private

Definition at line 53 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmTech
private

Definition at line 55 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmTechCacheID
private

Definition at line 56 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

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

Definition at line 58 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

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

Definition at line 59 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().