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::EDProducer 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::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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
 
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 beginJob ()
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
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::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 72 of file L1GlobaTriggerRecordProducer.cc.

73 {
74  // empty
75 }
void L1GlobalTriggerRecordProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 234 of file L1GlobaTriggerRecordProducer.cc.

235 {
236 
237  // empty now
238 }
void L1GlobalTriggerRecordProducer::produce ( edm::Event iEvent,
const edm::EventSetup evSetup 
)
privatevirtual

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

Implements edm::EDProducer.

Definition at line 78 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().

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

Member Data Documentation

edm::InputTag L1GlobalTriggerRecordProducer::m_l1GtReadoutRecordTag
private

InputTag for the L1 Global Trigger DAQ readout record.

Definition at line 72 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmAlgo
private

cached stuff

trigger masks

Definition at line 60 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmAlgoCacheID
private

Definition at line 61 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

const L1GtTriggerMask* L1GlobalTriggerRecordProducer::m_l1GtTmTech
private

Definition at line 63 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

unsigned long long L1GlobalTriggerRecordProducer::m_l1GtTmTechCacheID
private

Definition at line 64 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

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

Definition at line 66 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

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

Definition at line 67 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().