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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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::EDGetTokenT
< L1GlobalTriggerReadoutRecord
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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 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 ( )
virtual

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

References edm::EventSetup::get(), edm::Event::getByToken(), 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().

72 {
73 
74  // produce the L1GlobalTriggerRecord
75  std::auto_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( 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( gtRecord );
223 
224 }
#define LogDebug(id)
bool isDebugEnabled()
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtReadoutRecordTag
InputTag for the L1 Global Trigger DAQ readout record.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< unsigned int > m_triggerMaskAlgoTrig
const L1GtTriggerMask * m_l1GtTmAlgo
cached stuff
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:121
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:75
std::vector< unsigned int > m_triggerMaskTechTrig
#define LogTrace(id)
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86

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