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

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().