CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1GlobalTriggerRecordProducer (const edm::ParameterSet &)
 constructor(s) More...
 
virtual ~L1GlobalTriggerRecordProducer ()
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::InputTag m_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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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: L1GlobalTriggerRecord producer.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna

Definition at line 35 of file L1GlobalTriggerRecordProducer.h.

Constructor & Destructor Documentation

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

constructor(s)

Definition at line 40 of file L1GlobaTriggerRecordProducer.cc.

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

41 {
42 
43  produces<L1GlobalTriggerRecord>();
44 
45  // input tag for DAQ GT record
47  parSet.getParameter<edm::InputTag>("L1GtReadoutRecordTag");
48 
49  LogDebug("L1GlobalTriggerRecordProducer")
50  << "\nInput tag for L1 GT DAQ record: "
51  << m_l1GtReadoutRecordTag
52  << std::endl;
53 
54  // initialize cached IDs
55 
56  m_l1GtTmAlgoCacheID = 0ULL;
57  m_l1GtTmTechCacheID = 0ULL;
58 
59 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::InputTag m_l1GtReadoutRecordTag
InputTag for the L1 Global Trigger DAQ readout record.
L1GlobalTriggerRecordProducer::~L1GlobalTriggerRecordProducer ( )
virtual

destructor

Definition at line 62 of file L1GlobaTriggerRecordProducer.cc.

63 {
64 
65  // empty
66 
67 }

Member Function Documentation

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

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

Implements edm::stream::EDProducerBase.

Definition at line 73 of file L1GlobaTriggerRecordProducer.cc.

References edm::EventSetup::get(), edm::Event::getByLabel(), L1GtTriggerMask::gtTriggerMask(), edm::isDebugEnabled(), edm::HandleBase::isValid(), LogDebug, LogTrace, m_l1GtReadoutRecordTag, m_l1GtTmAlgo, m_l1GtTmAlgoCacheID, m_l1GtTmTech, m_l1GtTmTechCacheID, m_triggerMaskAlgoTrig, m_triggerMaskTechTrig, edm::ESHandle< class >::product(), and edm::Event::put().

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

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

Member Data Documentation

edm::InputTag 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().

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmAlgo
private

cached stuff

trigger masks

Definition at line 55 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmAlgoCacheID
private

Definition at line 56 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmTech
private

Definition at line 58 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmTechCacheID
private

Definition at line 59 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

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

Definition at line 61 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

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

Definition at line 62 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().