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
RPCTrigger Class Reference

Implements RPC trigger emulation. More...

#include <RPCTrigger.h>

Inheritance diagram for RPCTrigger:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 RPCTrigger (const edm::ParameterSet &)
 
 ~RPCTrigger ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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

std::vector< L1MuRegionalCandgiveFinallCandindates (const L1RpcTBMuonsVec &finalMuons, int type, int bx, edm::Handle< RPCDigiCollection > rpcDigis, std::vector< RPCDigiL1Link > &retRPCDigiLink)
 Returns vector of L1MuRegionalCand (input of L1GMT) More...
 

Private Attributes

unsigned long long m_cacheID
 
bool m_firstRun
 
std::string m_label
 
RPCPacManager< RPCPacDatam_pacManager
 
RPCPacTriggerm_pacTrigger
 
RPCConeBuilderFromES m_theLinksystemFromES
 
RPCBasicTrigConfigm_trigConfig
 
int m_triggerDebug
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::EDProducer
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

Implements RPC trigger emulation.

Author
Tomasz Fruboes

Definition at line 48 of file RPCTrigger.h.

Constructor & Destructor Documentation

RPCTrigger::RPCTrigger ( const edm::ParameterSet iConfig)
explicit

Definition at line 25 of file RPCTrigger.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_cacheID, m_firstRun, m_label, m_triggerDebug, and AlCaHLTBitMon_QueryRunRegistry::string.

25  :
27 {
28  produces<std::vector<L1MuRegionalCand> >("RPCb");
29  produces<std::vector<L1MuRegionalCand> >("RPCf");
30 
31  produces<std::vector<RPCDigiL1Link> >("RPCb");
32  produces<std::vector<RPCDigiL1Link> >("RPCf");
33 
34  m_firstRun = true;
35  m_cacheID = 0;
36 
37 
38  m_triggerDebug = iConfig.getUntrackedParameter<int>("RPCTriggerDebug",0);
39 
40  // 0 - no debug
41  // 1 - dump to xml
42  if ( m_triggerDebug != 1){
43  m_triggerDebug = 0;
44  }
45 
46 
47  m_label = iConfig.getParameter<std::string>("label");
48  consumes<RPCDigiCollection>(m_label);
49 }
RPCBasicTrigConfig * m_trigConfig
Definition: RPCTrigger.h:63
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool m_firstRun
Definition: RPCTrigger.h:67
std::string m_label
Definition: RPCTrigger.h:74
int m_triggerDebug
Definition: RPCTrigger.h:68
RPCPacTrigger * m_pacTrigger
Definition: RPCTrigger.h:65
unsigned long long m_cacheID
Definition: RPCTrigger.h:69
RPCTrigger::~RPCTrigger ( )

Definition at line 54 of file RPCTrigger.cc.

References m_pacTrigger, and m_trigConfig.

54  {
55  if (m_pacTrigger != 0) delete m_pacTrigger;
56  if (m_trigConfig != 0) delete m_trigConfig;
57 }
RPCBasicTrigConfig * m_trigConfig
Definition: RPCTrigger.h:63
RPCPacTrigger * m_pacTrigger
Definition: RPCTrigger.h:65

Member Function Documentation

std::vector< L1MuRegionalCand > RPCTrigger::giveFinallCandindates ( const L1RpcTBMuonsVec finalMuons,
int  type,
int  bx,
edm::Handle< RPCDigiCollection rpcDigis,
std::vector< RPCDigiL1Link > &  retRPCDigiLink 
)
private

Returns vector of L1MuRegionalCand (input of L1GMT)

Note
- type is defined in L1MuRegionalCand 1 - barell, 3 - forward

Definition at line 217 of file RPCTrigger.cc.

Referenced by produce().

219 {
220 
221  std::vector<L1MuRegionalCand> RPCCand;
222 
223  for(unsigned int iMu = 0; iMu < finalMuons.size(); iMu++)
224  {
225 
226  if (finalMuons[iMu].getPtCode()==0){
227  continue;
228  }
229 
230  RPCDigiL1Link newDigiLink;
231 
232  //std::cout << "######################################## " << std::endl;
233  //std::cout << finalMuons[iMu].getPhiAddr() << " " << finalMuons[iMu].getEtaAddr() << std::endl;
234  RPCMuon::TDigiLinkVec digiIVec = finalMuons[iMu].getDigiIdxVec();
235  // Here the iteration has to be the same as in
236  short int digiIndex = 0;
238  for (detUnitIt=rpcDigis->begin();
239  detUnitIt!=rpcDigis->end();
240  ++detUnitIt)
241  {
242 
243  const RPCDetId& id = (*detUnitIt).first;
244  uint32_t rawId = id.rawId();
245  const RPCDigiCollection::Range& range = (*detUnitIt).second;
246 
247 
248  for (RPCDigiCollection::const_iterator digiIt = range.first;
249  digiIt!=range.second;
250  ++digiIt)
251  {
252  ++digiIndex;
253 
254  RPCMuon::TDigiLinkVec::iterator it = digiIVec.begin();
255  for(;it!=digiIVec.end();++it) {
256  if (digiIndex==it->m_digiIdx) {
257  newDigiLink.setLink(it->m_layer+1, rawId, digiIt->strip(), digiIt->bx() );
258  //std::cout << type << " " << iMu << " layer: " << it->m_layer << " index " << it->m_digiIdx << std::endl;
259  //std::cout << " " << id << " " << " |bx " << digiIt->bx() << " strip " << digiIt->strip() << std::endl;
260  }
261  }
262  }
263  }
264  retRPCDigiLink.push_back(newDigiLink);
265 
266 
267  L1MuRegionalCand l1Cand;
268 
269  l1Cand.setBx(bx);
270 
271 
272  l1Cand.setQualityPacked(finalMuons[iMu].getQuality());
273  l1Cand.setPtPacked(finalMuons[iMu].getPtCode());
274 
275  l1Cand.setType(type);
276 
277  int charge=finalMuons[iMu].getSign();
278 
279  if (charge == 0) // negative
280  l1Cand.setChargePacked(1);
281  else
282  l1Cand.setChargePacked(0);
283 
284  //RPCConst::l1RpcConeCrdnts cone = finalMuons[iMu].getConeCrdnts();
285 
286  /*
287  int pac = cone.m_LogSector*12+cone.m_LogSegment;
288  const float pi = 3.14159265;
289  const float offset = 5*(2*pi/360); // redefinition! Defined also in RPCRingFromRolls::phiMapCompare
290  float phi = 2*pi*pac/144-offset;
291  if (phi<0)
292  phi+=2*pi;
293 
294  l1Cand.setPhiValue(phi);
295  */
296 
297  //Note: pac numbering begins at 5 deg and goes from 1 to 144.
298  // we want phi values from 0 to 2.5 deg to be phiPacked=0
299  // max phiPacked value is 143 (see CMS IN 2004-022)
300  //int phiPacked = (finalMuons[iMu].getPhiAddr()+2)%144;
301  int phiPacked = finalMuons[iMu].getPhiAddr();
302  l1Cand.setPhiPacked(phiPacked);
303 /*
304  float eta = RPCConst::etaFromTowerNum(cone.m_Tower);
305  l1Cand.setEtaValue(eta);
306 */
307  //Note: etaAddr is packed in special way: see CMS IN 2004-022
308  signed short etaAddr = finalMuons[iMu].getEtaAddr(); //
309 // signed short etaAddr = finalMuons[iMu].getEtaAddr()-16; // -16..16
310 // bool etaNegative = false;
311 // if (etaAddr < 0){
312 // etaNegative = true;
313 // etaAddr = ~(-etaAddr)+1; // convert to negative :)
314 // }
315 
316 // etaAddr &= 63; // 6 bits only
317 
318  l1Cand.setEtaPacked(etaAddr);
319  l1Cand.setChargeValid(true);
320 
321  /*
322  std::cout<< std::endl << "RBMuon::" << finalMuons[iMu].getEtaAddr() << " "
323  << finalMuons[iMu].getPhiAddr() << std::endl ;
324  std::cout<< "cand " << l1Cand.eta_packed() << " "
325  << l1Cand.phi_packed() << std::endl ;
326  */
327 
328  RPCCand.push_back(l1Cand);
329 
330  LogDebug("RPCTrigger") << "Found muonf of pt "
331  << finalMuons[iMu].getPtCode()
332  << " bx " << l1Cand.bx()
333  << " L1Charge " << l1Cand.charge_packed()
334  << " ql " << l1Cand.quality()
335  << " fp " << finalMuons[iMu].getFiredPlanes()
336  << " b/f " << l1Cand.type_idx()
337  << " phi " << l1Cand.phi_packed()
338  << " eta " << l1Cand.eta_packed()
339  //<< " eta l1 " << l1Cand.etaValue() // will drop out soon
340  << " killed " << finalMuons[iMu].wasKilled();
341 
342 
343  }
344 
345  return RPCCand;
346 }
#define LogDebug(id)
type
Definition: HCALResponse.h:21
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void setBx(int bx)
Set Bunch Crossing.
unsigned eta_packed() const
return eta packed as in hardware
void setType(unsigned type)
Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC.
void setChargePacked(unsigned ch)
Set Charge (0=pos, 1=neg)
std::vector< TDigiLink > TDigiLinkVec
Definition: RPCMuon.h:77
void setPtPacked(unsigned pt)
Set Pt: 0..31.
std::vector< RPCDigi >::const_iterator const_iterator
unsigned int quality() const
return quality
void setPhiPacked(unsigned phi)
Set Phi: 0..143.
int bx() const
return bunch crossing identifier
void setQualityPacked(unsigned qual)
Set Quality: 0..7.
void setEtaPacked(unsigned eta)
Set Eta: 6-bit code.
std::pair< const_iterator, const_iterator > Range
void setChargeValid(bool valid)
Set Charge Valid.
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
unsigned phi_packed() const
return phi packed as in hardware
void RPCTrigger::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 62 of file RPCTrigger.cc.

References edm::EventBase::bunchCrossing(), edm::eventsetup::EventSetupRecord::cacheIdentifier(), edm::EventID::event(), edm::EventSetup::get(), edm::Event::getByLabel(), RPCConeBuilderFromES::getConesFromES(), giveFinallCandindates(), edm::EventBase::id(), RPCPacManager< TPacType >::init(), MuonsGrabber::Instance(), edm::HandleBase::isValid(), LogDebug, m_cacheID, m_firstRun, m_label, m_pacManager, m_pacTrigger, m_theLinksystemFromES, m_trigConfig, m_triggerDebug, edm::ESHandle< class >::product(), edm::Event::put(), L1RPCConfig_cff::rpcconf, RPCPacTrigger::runEvent(), RPCTriggerConfiguration::setDebugLevel(), MuonsGrabber::setRPCBasicTrigConfig(), MuonsGrabber::startNewEvent(), and MuonsGrabber::writeDataForRelativeBX().

63 {
64 
65  //static int ev=1;
66  //std::cout << "----------------------------------- " << ev++ << std::endl;
67  if ( m_triggerDebug == 1) MuonsGrabber::Instance().startNewEvent(iEvent.id().event(), iEvent.bunchCrossing());
68 
69  if (m_firstRun){
70 
71  m_cacheID = iSetup.get<L1RPCConfigRcd>().cacheIdentifier();
72  m_firstRun = false;
74  iSetup.get<L1RPCConfigRcd>().get(conf);
75  const L1RPCConfig *rpcconf = conf.product();
76 
77 
78  m_pacManager.init(rpcconf);
83 
84 
85  }
86 
87  if (m_cacheID != iSetup.get<L1RPCConfigRcd>().cacheIdentifier()) {
88 
89  //std::cout << " New pats: " << iSetup.get<L1RPCConfigRcd>().cacheIdentifier() << std::endl ;
90  m_cacheID = iSetup.get<L1RPCConfigRcd>().cacheIdentifier();
91 
93  iSetup.get<L1RPCConfigRcd>().get(conf);
94  const L1RPCConfig *rpcconf = conf.product();
95 
96  m_pacManager.init(rpcconf);
97  delete m_trigConfig;
100 
101  delete m_pacTrigger;
103 
105 
106 
107  }
108 
109 
110 
112 // iEvent.getByType(rpcDigis);
113  //iEvent.getByLabel("muonRPCDigis",rpcDigis);
114  iEvent.getByLabel(m_label, rpcDigis);
115 
116  std::auto_ptr<std::vector<L1MuRegionalCand> > candBarell(new std::vector<L1MuRegionalCand>);
117  std::auto_ptr<std::vector<L1MuRegionalCand> > candForward(new std::vector<L1MuRegionalCand>);
118  if (!rpcDigis.isValid())
119  {
120  LogDebug("RPCTrigger")
121  << "\nWarning: RPCDigiCollection with input tag " << m_label
122  << "\nrequested in configuration, but not found in the event. Emulator will produce empty collection \n ";
123 
124  iEvent.put(candBarell, "RPCb");
125  iEvent.put(candForward, "RPCf");
126 
127  return;
128  }
129 
130 
131  if (rpcDigis->begin() == rpcDigis->end() )
132  {
133  LogDebug("RPCTrigger")
134  << "\nWarning: RPCDigiCollection with input tag " << m_label
135  << "\n seems to be empty for this event. Emulator will run on empty collection ";
136 
137  }
138 
139 
140 
141  std::auto_ptr<std::vector<RPCDigiL1Link> > brlLinks(new std::vector<RPCDigiL1Link>);
142  std::auto_ptr<std::vector<RPCDigiL1Link> > fwdLinks(new std::vector<RPCDigiL1Link>);
143 
144  for (int iBx = -1; iBx < 2; ++ iBx) {
145 
146  L1RpcLogConesVec ActiveCones;
147 
149  iSetup.get<L1RPCConeBuilderRcd>().get(coneBuilder);
150 
151  edm::ESHandle<L1RPCConeDefinition> l1RPCConeDefinition;
152  iSetup.get<L1RPCConeDefinitionRcd>().get(l1RPCConeDefinition);
153 
155  iSetup.get<L1RPCHwConfigRcd>().get(hwConfig);
156 
158  iSetup.get<L1RPCBxOrConfigRcd>().get(bxOrConfig);
159 
160 
161 
162  ActiveCones = m_theLinksystemFromES.getConesFromES(rpcDigis, coneBuilder, l1RPCConeDefinition, bxOrConfig, hwConfig, iBx);
163 
165  iSetup.get<L1RPCHsbConfigRcd>().get(hsbConfig);
166 
167  L1RpcTBMuonsVec2 finalMuons = m_pacTrigger->runEvent(ActiveCones, hsbConfig);
168 
169  //int maxFiredPlanes = 0;
170 
171  /*
172  for (unsigned int i=0;i<ActiveCones.size();i++){
173  int fpCnt = ActiveCones[i].getFiredPlanesCnt();
174  if (fpCnt > maxFiredPlanes)
175  maxFiredPlanes = fpCnt;
176  }
177 
178  // Fill out the products
179  // finalMuons[0]=barell, finalMuons[1]=endcap
180  LogDebug("RPCTrigger") << "---Filling candindates in new event--- "
181  << maxFiredPlanes << std::endl;
182 <<<<<<< RPCTrigger.cc
183  */
184 
185 // std::vector<L1MuRegionalCand> RPCb = giveFinallCandindates(finalMuons[0],1, iBx);
186 // std::vector<L1MuRegionalCand> RPCf = giveFinallCandindates(finalMuons[1],3, iBx);
187  std::vector<RPCDigiL1Link> dlBrl;
188  std::vector<RPCDigiL1Link> dlFwd;
189  std::vector<L1MuRegionalCand> RPCb = giveFinallCandindates(finalMuons[0],1, iBx, rpcDigis, dlBrl);
190  std::vector<L1MuRegionalCand> RPCf = giveFinallCandindates(finalMuons[1],3, iBx, rpcDigis, dlFwd);
191 
192 
193  brlLinks->insert(brlLinks->end(), dlBrl.begin(), dlBrl.end() );
194  fwdLinks->insert(fwdLinks->end(), dlFwd.begin(), dlFwd.end() );
195 
196  candBarell->insert(candBarell->end(), RPCb.begin(), RPCb.end());
197  candForward->insert(candForward->end(), RPCf.begin(), RPCf.end());
198 
200  }
201 
202  iEvent.put(fwdLinks, "RPCf");
203  iEvent.put(brlLinks, "RPCb");
204  iEvent.put(candBarell, "RPCb");
205  iEvent.put(candForward, "RPCf");
206 
207 }
#define LogDebug(id)
RPCBasicTrigConfig * m_trigConfig
Definition: RPCTrigger.h:63
EventNumber_t event() const
Definition: EventID.h:41
unsigned long long cacheIdentifier() const
bool m_firstRun
Definition: RPCTrigger.h:67
L1RpcLogConesVec getConesFromES(edm::Handle< RPCDigiCollection > rpcDigis, edm::ESHandle< L1RPCConeBuilder > coneBuilder, edm::ESHandle< L1RPCConeDefinition > coneDef, edm::ESHandle< L1RPCBxOrConfig > bxOrDef, edm::ESHandle< L1RPCHwConfig > hwConfig, int bx)
int bunchCrossing() const
Definition: EventBase.h:65
std::string m_label
Definition: RPCTrigger.h:74
std::vector< L1MuRegionalCand > giveFinallCandindates(const L1RpcTBMuonsVec &finalMuons, int type, int bx, edm::Handle< RPCDigiCollection > rpcDigis, std::vector< RPCDigiL1Link > &retRPCDigiLink)
Returns vector of L1MuRegionalCand (input of L1GMT)
Definition: RPCTrigger.cc:217
static MuonsGrabber & Instance()
Definition: MuonsGrabber.cc:58
void setRPCBasicTrigConfig(RPCBasicTrigConfig *c)
Definition: MuonsGrabber.h:61
void startNewEvent(int event, int bx)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
RPCPacManager< RPCPacData > m_pacManager
Definition: RPCTrigger.h:61
std::vector< L1RpcTBMuonsVec > L1RpcTBMuonsVec2
Definition: RPCTBMuon.h:207
bool isValid() const
Definition: HandleBase.h:75
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
RPCConeBuilderFromES m_theLinksystemFromES
Definition: RPCTrigger.h:59
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void init(std::string patFilesDirectory, L1RpcPACsCntEnum _PACsCnt)
Definition: RPCPacManager.h:61
void setDebugLevel(int debgLevel)
edm::EventID id() const
Definition: EventBase.h:59
int m_triggerDebug
Definition: RPCTrigger.h:68
RPCPacTrigger * m_pacTrigger
Definition: RPCTrigger.h:65
L1RpcTBMuonsVec2 runEvent(const L1RpcLogConesVec &logConesVec, edm::ESHandle< L1RPCHsbConfig > hsbConf)
void writeDataForRelativeBX(int bx)
std::vector< RPCLogCone > L1RpcLogConesVec
Definition: RPCLogCone.h:126
unsigned long long m_cacheID
Definition: RPCTrigger.h:69

Member Data Documentation

unsigned long long RPCTrigger::m_cacheID
private

Definition at line 69 of file RPCTrigger.h.

Referenced by produce(), and RPCTrigger().

bool RPCTrigger::m_firstRun
private

Definition at line 67 of file RPCTrigger.h.

Referenced by produce(), and RPCTrigger().

std::string RPCTrigger::m_label
private

Definition at line 74 of file RPCTrigger.h.

Referenced by produce(), and RPCTrigger().

RPCPacManager<RPCPacData> RPCTrigger::m_pacManager
private

Definition at line 61 of file RPCTrigger.h.

Referenced by produce().

RPCPacTrigger* RPCTrigger::m_pacTrigger
private

Definition at line 65 of file RPCTrigger.h.

Referenced by produce(), and ~RPCTrigger().

RPCConeBuilderFromES RPCTrigger::m_theLinksystemFromES
private

Definition at line 59 of file RPCTrigger.h.

Referenced by produce().

RPCBasicTrigConfig* RPCTrigger::m_trigConfig
private

Definition at line 63 of file RPCTrigger.h.

Referenced by produce(), and ~RPCTrigger().

int RPCTrigger::m_triggerDebug
private

Definition at line 68 of file RPCTrigger.h.

Referenced by produce(), and RPCTrigger().