CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TExtCondProducer Class Reference
Inheritance diagram for L1TExtCondProducer:
edm::stream::EDProducer<>

Public Member Functions

 L1TExtCondProducer (const ParameterSet &)
 
 ~L1TExtCondProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

int bxFirst_
 
int bxLast_
 
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcdl1GtMenuToken_
 
std::map< std::string, unsigned int > m_extBitMap
 
unsigned long long m_l1GtMenuCacheID
 
unsigned int m_triggerRulePrefireVetoBit
 
bool makeTriggerRulePrefireVetoBit_
 
bool setBptxAND_
 
bool setBptxMinus_
 
bool setBptxOR_
 
bool setBptxPlus_
 
edm::InputTag tcdsInputTag_
 
edm::EDGetTokenT< TCDSRecordtcdsRecordToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 48 of file L1TExtCondProducer.cc.

Constructor & Destructor Documentation

◆ L1TExtCondProducer()

L1TExtCondProducer::L1TExtCondProducer ( const ParameterSet iConfig)
explicit

Definition at line 87 of file L1TExtCondProducer.cc.

88  : bxFirst_(iConfig.getParameter<int>("bxFirst")),
89  bxLast_(iConfig.getParameter<int>("bxLast")),
90  setBptxAND_(iConfig.getParameter<bool>("setBptxAND")),
91  setBptxPlus_(iConfig.getParameter<bool>("setBptxPlus")),
92  setBptxMinus_(iConfig.getParameter<bool>("setBptxMinus")),
93  setBptxOR_(iConfig.getParameter<bool>("setBptxOR")),
94  tcdsInputTag_(iConfig.getParameter<edm::InputTag>("tcdsRecordLabel")),
95  l1GtMenuToken_(esConsumes<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd>()) {
97 
99 
100  if (!(tcdsInputTag_ == edm::InputTag(""))) {
101  tcdsRecordToken_ = consumes<TCDSRecord>(tcdsInputTag_);
103  }
104 
105  // register what you produce
106  produces<GlobalExtBlkBxCollection>();
107 
108  // Initialize parameters
109  m_l1GtMenuCacheID = 0ULL;
110 }

References m_l1GtMenuCacheID, m_triggerRulePrefireVetoBit, makeTriggerRulePrefireVetoBit_, GlobalExtBlk::maxExternalConditions, tcdsInputTag_, and tcdsRecordToken_.

◆ ~L1TExtCondProducer()

L1TExtCondProducer::~L1TExtCondProducer ( )
override

Definition at line 112 of file L1TExtCondProducer.cc.

112 {}

Member Function Documentation

◆ fillDescriptions()

void L1TExtCondProducer::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 241 of file L1TExtCondProducer.cc.

241  {
242  // simGtExtFakeProd
244  desc.add<bool>("setBptxMinus", true);
245  desc.add<bool>("setBptxAND", true);
246  desc.add<int>("bxFirst", -2);
247  desc.add<bool>("setBptxOR", true);
248  desc.add<int>("bxLast", 2);
249  desc.add<bool>("setBptxPlus", true);
250  desc.add<edm::InputTag>("tcdsRecordLabel", edm::InputTag(""));
251  descriptions.add("simGtExtFakeProd", desc);
252 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ produce()

void L1TExtCondProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 119 of file L1TExtCondProducer.cc.

119  {
120  LogDebug("L1TExtCondProducer") << "L1TExtCondProducer::produce function called...\n";
121 
122  // get / update the trigger menu from the EventSetup
123  // local cache & check on cacheIdentifier
124  unsigned long long l1GtMenuCacheID = iSetup.get<L1TUtmTriggerMenuRcd>().cacheIdentifier();
125 
126  if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
128  const L1TUtmTriggerMenu* utml1GtMenu = l1GtMenu.product();
129 
130  // Instantiate Parser
132 
133  std::map<std::string, unsigned int> extBitMap = gtParser.getExternalSignals(utml1GtMenu);
134 
135  m_l1GtMenuCacheID = l1GtMenuCacheID;
136  m_extBitMap = extBitMap;
137  }
138 
139  bool TriggerRulePrefireVetoBit(false);
141  // code taken from Nick Smith's EventFilter/L1TRawToDigi/plugins/TriggerRulePrefireVetoFilter.cc
142 
143  edm::Handle<TCDSRecord> tcdsRecordH;
144  iEvent.getByToken(tcdsRecordToken_, tcdsRecordH);
145  const auto& tcdsRecord = *tcdsRecordH.product();
146 
147  uint64_t thisEvent = (tcdsRecord.getBXID() - 1) + tcdsRecord.getOrbitNr() * 3564ull;
148 
149  std::vector<uint64_t> eventHistory;
150  for (auto&& l1a : tcdsRecord.getFullL1aHistory()) {
151  eventHistory.push_back(thisEvent - ((l1a.getBXID() - 1) + l1a.getOrbitNr() * 3564ull));
152  }
153 
154  // should be 16 according to TCDSRecord.h, we only care about the last 4
155  if (eventHistory.size() < 4) {
156  edm::LogError("L1TExtCondProducer") << "Unexpectedly small L1A history from TCDSRecord";
157  }
158 
159  // No more than 1 L1A in 3 BX
160  if (eventHistory[0] < 3ull) {
161  edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (1 in 3)";
162  }
163 
164  if (eventHistory[0] == 3ull)
165  TriggerRulePrefireVetoBit = true;
166 
167  // No more than 2 L1As in 25 BX
168  if (eventHistory[0] < 25ull and eventHistory[1] < 25ull) {
169  edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (2 in 25)";
170  }
171  if (eventHistory[0] < 25ull and eventHistory[1] == 25ull)
172  TriggerRulePrefireVetoBit = true;
173 
174  // No more than 3 L1As in 100 BX
175  if (eventHistory[0] < 100ull and eventHistory[1] < 100ull and eventHistory[2] < 100ull) {
176  edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (3 in 100)";
177  }
178  if (eventHistory[0] < 100ull and eventHistory[1] < 100ull and eventHistory[2] == 100ull)
179  TriggerRulePrefireVetoBit = true;
180 
181  // No more than 4 L1As in 240 BX
182  if (eventHistory[0] < 240ull and eventHistory[1] < 240ull and eventHistory[2] < 240ull and
183  eventHistory[3] < 240ull) {
184  edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (4 in 240)";
185  }
186  if (eventHistory[0] < 240ull and eventHistory[1] < 240ull and eventHistory[2] < 240ull and
187  eventHistory[3] == 240ull)
188  TriggerRulePrefireVetoBit = true;
189  }
190 
191  // Setup vectors
192  GlobalExtBlk extCond_bx;
193 
194  //outputs
195  std::unique_ptr<GlobalExtBlkBxCollection> extCond(new GlobalExtBlkBxCollection(0, bxFirst_, bxLast_));
196 
197  bool foundBptxAND = (m_extBitMap.find("BPTX_plus_AND_minus.v0") != m_extBitMap.end());
198  bool foundBptxPlus = (m_extBitMap.find("BPTX_plus.v0") != m_extBitMap.end());
199  bool foundBptxMinus = (m_extBitMap.find("BPTX_minus.v0") != m_extBitMap.end());
200  bool foundBptxOR = (m_extBitMap.find("BPTX_plus_OR_minus.v0") != m_extBitMap.end());
201 
202  // Fill in some external conditions for testing
203  if (setBptxAND_ && foundBptxAND)
204  extCond_bx.setExternalDecision(m_extBitMap["BPTX_plus_AND_minus.v0"], true);
205  if (setBptxPlus_ && foundBptxPlus)
206  extCond_bx.setExternalDecision(m_extBitMap["BPTX_plus.v0"], true);
207  if (setBptxMinus_ && foundBptxMinus)
208  extCond_bx.setExternalDecision(m_extBitMap["BPTX_minus.v0"], true);
209  if (setBptxOR_ && foundBptxOR)
210  extCond_bx.setExternalDecision(m_extBitMap["BPTX_plus_OR_minus.v0"], true);
211 
212  //check for updated Bptx names as well
213  foundBptxAND = (m_extBitMap.find("ZeroBias_BPTX_AND_VME") != m_extBitMap.end());
214  foundBptxPlus = (m_extBitMap.find("BPTX_B1_VME") != m_extBitMap.end());
215  foundBptxMinus = (m_extBitMap.find("BPTX_B2_VME") != m_extBitMap.end());
216  foundBptxOR = (m_extBitMap.find("BPTX_OR_VME") != m_extBitMap.end());
217 
218  // Fill in some external conditions for testing
219  if (setBptxAND_ && foundBptxAND)
220  extCond_bx.setExternalDecision(m_extBitMap["ZeroBias_BPTX_AND_VME"], true);
221  if (setBptxPlus_ && foundBptxPlus)
222  extCond_bx.setExternalDecision(m_extBitMap["BPTX_B1_VME"], true);
223  if (setBptxMinus_ && foundBptxMinus)
224  extCond_bx.setExternalDecision(m_extBitMap["BPTX_B2_VME"], true);
225  if (setBptxOR_ && foundBptxOR)
226  extCond_bx.setExternalDecision(m_extBitMap["BPTX_OR_VME"], true);
227 
228  // set the bit for the TriggerRulePrefireVeto if true
229  if (TriggerRulePrefireVetoBit)
231 
232  // Fill Externals
233  for (int iBx = bxFirst_; iBx <= bxLast_; iBx++) {
234  extCond->push_back(iBx, extCond_bx);
235  }
236 
237  iEvent.put(std::move(extCond));
238 }

References edm::EventSetup::get(), l1t::TriggerMenuParser::getExternalSignals(), edm::EventSetup::getHandle(), iEvent, LogDebug, eostools::move(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), and GlobalExtBlk::setExternalDecision().

Member Data Documentation

◆ bxFirst_

int L1TExtCondProducer::bxFirst_
private

Definition at line 65 of file L1TExtCondProducer.cc.

◆ bxLast_

int L1TExtCondProducer::bxLast_
private

Definition at line 66 of file L1TExtCondProducer.cc.

◆ l1GtMenuToken_

edm::ESGetToken<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd> L1TExtCondProducer::l1GtMenuToken_
private

Definition at line 81 of file L1TExtCondProducer.cc.

◆ m_extBitMap

std::map<std::string, unsigned int> L1TExtCondProducer::m_extBitMap
private

Definition at line 74 of file L1TExtCondProducer.cc.

◆ m_l1GtMenuCacheID

unsigned long long L1TExtCondProducer::m_l1GtMenuCacheID
private

Definition at line 73 of file L1TExtCondProducer.cc.

Referenced by L1TExtCondProducer().

◆ m_triggerRulePrefireVetoBit

unsigned int L1TExtCondProducer::m_triggerRulePrefireVetoBit
private

Definition at line 76 of file L1TExtCondProducer.cc.

Referenced by L1TExtCondProducer().

◆ makeTriggerRulePrefireVetoBit_

bool L1TExtCondProducer::makeTriggerRulePrefireVetoBit_
private

Definition at line 78 of file L1TExtCondProducer.cc.

Referenced by L1TExtCondProducer().

◆ setBptxAND_

bool L1TExtCondProducer::setBptxAND_
private

Definition at line 68 of file L1TExtCondProducer.cc.

◆ setBptxMinus_

bool L1TExtCondProducer::setBptxMinus_
private

Definition at line 70 of file L1TExtCondProducer.cc.

◆ setBptxOR_

bool L1TExtCondProducer::setBptxOR_
private

Definition at line 71 of file L1TExtCondProducer.cc.

◆ setBptxPlus_

bool L1TExtCondProducer::setBptxPlus_
private

Definition at line 69 of file L1TExtCondProducer.cc.

◆ tcdsInputTag_

edm::InputTag L1TExtCondProducer::tcdsInputTag_
private

Definition at line 80 of file L1TExtCondProducer.cc.

Referenced by L1TExtCondProducer().

◆ tcdsRecordToken_

edm::EDGetTokenT<TCDSRecord> L1TExtCondProducer::tcdsRecordToken_
private

Definition at line 79 of file L1TExtCondProducer.cc.

Referenced by L1TExtCondProducer().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
l1t::TriggerMenuParser::getExternalSignals
std::map< std::string, unsigned int > getExternalSignals(const L1TUtmTriggerMenu *utmMenu)
Definition: TriggerMenuParser.cc:164
L1TExtCondProducer::tcdsInputTag_
edm::InputTag tcdsInputTag_
Definition: L1TExtCondProducer.cc:80
L1TExtCondProducer::m_l1GtMenuCacheID
unsigned long long m_l1GtMenuCacheID
Definition: L1TExtCondProducer.cc:73
edm::Handle::product
T const * product() const
Definition: Handle.h:70
L1TExtCondProducer::setBptxAND_
bool setBptxAND_
Definition: L1TExtCondProducer.cc:68
L1TUtmTriggerMenuRcd
Definition: L1TUtmTriggerMenuRcd.h:11
GlobalExtBlk::maxExternalConditions
const static unsigned int maxExternalConditions
Definition: GlobalExtBlk.h:43
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
L1TExtCondProducer::bxFirst_
int bxFirst_
Definition: L1TExtCondProducer.cc:65
L1TExtCondProducer::tcdsRecordToken_
edm::EDGetTokenT< TCDSRecord > tcdsRecordToken_
Definition: L1TExtCondProducer.cc:79
L1TExtCondProducer::m_triggerRulePrefireVetoBit
unsigned int m_triggerRulePrefireVetoBit
Definition: L1TExtCondProducer.cc:76
GlobalExtBlkBxCollection
BXVector< GlobalExtBlk > GlobalExtBlkBxCollection
Definition: GlobalExtBlk.h:29
edm::Handle
Definition: AssociativeIterator.h:50
L1TUtmTriggerMenu
Definition: L1TUtmTriggerMenu.h:25
L1TExtCondProducer::makeTriggerRulePrefireVetoBit_
bool makeTriggerRulePrefireVetoBit_
Definition: L1TExtCondProducer.cc:78
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::ESHandle
Definition: DTSurvey.h:22
L1TExtCondProducer::setBptxPlus_
bool setBptxPlus_
Definition: L1TExtCondProducer.cc:69
L1TExtCondProducer::bxLast_
int bxLast_
Definition: L1TExtCondProducer.cc:66
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
L1TExtCondProducer::setBptxMinus_
bool setBptxMinus_
Definition: L1TExtCondProducer.cc:70
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
GlobalExtBlk
Definition: GlobalExtBlk.h:34
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
L1TExtCondProducer::m_extBitMap
std::map< std::string, unsigned int > m_extBitMap
Definition: L1TExtCondProducer.cc:74
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
L1TExtCondProducer::setBptxOR_
bool setBptxOR_
Definition: L1TExtCondProducer.cc:71
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
L1TExtCondProducer::l1GtMenuToken_
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > l1GtMenuToken_
Definition: L1TExtCondProducer.cc:81
l1t::TriggerMenuParser
Definition: TriggerMenuParser.h:63
edm::InputTag
Definition: InputTag.h:15
GlobalExtBlk::setExternalDecision
void setExternalDecision(unsigned int bit, bool val)
Set decision bits.
Definition: GlobalExtBlk.cc:40