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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 39 of file L1GlobaTriggerRecordProducer.cc.

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

40 {
41 
42  produces<L1GlobalTriggerRecord>();
43 
44  // input tag for DAQ GT record
45  m_l1GtReadoutRecordTag = consumes<L1GlobalTriggerReadoutRecord>(parSet.getParameter<edm::InputTag>("L1GtReadoutRecordTag"));
46 
47  LogDebug("L1GlobalTriggerRecordProducer").log([&parSet](auto& l) {
48  l<< "\nInput tag for L1 GT DAQ record: "
49  << parSet.getParameter<edm::InputTag>("L1GtReadoutRecordTag");
50  });
51 
52  // initialize cached IDs
53 
54  m_l1GtTmAlgoCacheID = 0ULL;
55  m_l1GtTmTechCacheID = 0ULL;
56 
57 }
#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 60 of file L1GlobaTriggerRecordProducer.cc.

61 {
62 
63  // empty
64 
65 }

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

References L1GlobalTriggerReadoutRecord::decisionWord(), L1GlobalTriggerReadoutRecord::finalOR(), edm::EventSetup::get(), edm::Event::getByToken(), L1GlobalTriggerReadoutRecord::gtFdlWord(), L1GtTriggerMask::gtTriggerMask(), edm::isDebugEnabled(), edm::HandleBase::isValid(), checklumidiff::l, tablePrinter::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().

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

Referenced by L1GlobalTriggerRecordProducer(), and produce().

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmAlgo
private

cached stuff

trigger masks

Definition at line 57 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmAlgoCacheID
private

Definition at line 58 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmTech
private

Definition at line 60 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmTechCacheID
private

Definition at line 61 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

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

Definition at line 63 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

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

Definition at line 64 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().