CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
MuonsGrabber Class Reference

#include <L1Trigger/RPCTrigger/interface/MuonsGrabber.h>

Public Member Functions

void addMuon (RPCTBMuon &mu, int lvl, int region, int hs, int index)
 
void setRPCBasicTrigConfig (RPCBasicTrigConfig *c)
 
void startNewEvent (int event, int bx)
 
void writeDataForRelativeBX (int bx)
 

Static Public Member Functions

static MuonsGrabberInstance ()
 

Private Member Functions

std::string IntToString (int i)
 
 MuonsGrabber ()
 
 MuonsGrabber (const MuonsGrabber &)=delete
 
const MuonsGrabberoperator= (const MuonsGrabber &)=delete
 
virtual ~MuonsGrabber ()
 

Private Attributes

int m_currentBX
 
int m_currentEvent
 
XERCES_CPP_NAMESPACE::DOMElement * m_currEvent
 
XERCES_CPP_NAMESPACE::DOMDocument * m_doc
 
XERCES_CPP_NAMESPACE::DOMImplementation * m_dom
 
std::vector< RPCMuonExtraStructm_muons
 
XERCES_CPP_NAMESPACE::DOMElement * m_rootElem
 
RPCBasicTrigConfigm_trigConfig
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 50 of file MuonsGrabber.h.

Constructor & Destructor Documentation

◆ MuonsGrabber() [1/2]

MuonsGrabber::MuonsGrabber ( )
private

Definition at line 56 of file MuonsGrabber.cc.

56  {
57  try {
59  } catch (const XMLException& toCatch) {
60  throw std::string("Error during Xerces-c Initialization: " +
61  std::string(XMLString::transcode(toCatch.getMessage())));
62  }
63 
64  m_dom = DOMImplementationRegistry::getDOMImplementation(X("Core"));
65  if (m_dom == nullptr)
66  throw cms::Exception("RPCMuonsGrabber") << "Cannot get DOM" << std::endl;
67 
68  m_doc = m_dom->createDocument(nullptr, // root element namespace URI.
69  X("rpctDataStream"), // root element name
70  nullptr); // document type object (DTD).
71 
72  m_rootElem = m_doc->getDocumentElement();
73 
74  m_currEvent = nullptr;
75 }

References Exception, m_currEvent, m_doc, m_dom, m_rootElem, AlCaHLTBitMon_QueryRunRegistry::string, X, and cms::concurrency::xercesInitialize().

◆ ~MuonsGrabber()

MuonsGrabber::~MuonsGrabber ( )
privatevirtual

Definition at line 82 of file MuonsGrabber.cc.

82  {
83  // save xmlfile
84  XMLCh tempStr[100];
85  XMLString::transcode("LS", tempStr, 99);
86  DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
87  DOMLSSerializer* theSerializer = ((DOMImplementationLS*)impl)->createLSSerializer();
88  DOMConfiguration* dc = theSerializer->getDomConfig();
89  dc->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
90  DOMLSOutput* outputDesc = ((DOMImplementationLS*)impl)->createLSOutput();
91  outputDesc->setEncoding(X("UTF-8"));
92 
93  XMLFormatTarget* myFormTarget = new LocalFileFormatTarget(X("testpulses.xml"));
94  outputDesc->setByteStream(myFormTarget);
95  DOMNode* xmlstylesheet =
96  m_doc->createProcessingInstruction(X("xml-stylesheet"), X("type=\"text/xsl\"href=\"default.xsl\""));
97 
98  m_doc->insertBefore(xmlstylesheet, m_rootElem);
99  theSerializer->write(m_doc, outputDesc);
100 
101  delete theSerializer;
102  delete myFormTarget;
103  m_doc->release();
105 }

References m_doc, m_rootElem, X, and cms::concurrency::xercesTerminate().

◆ MuonsGrabber() [2/2]

MuonsGrabber::MuonsGrabber ( const MuonsGrabber )
privatedelete

Member Function Documentation

◆ addMuon()

void MuonsGrabber::addMuon ( RPCTBMuon mu,
int  lvl,
int  region,
int  hs,
int  index 
)

◆ Instance()

MuonsGrabber & MuonsGrabber::Instance ( )
static

Definition at line 48 of file MuonsGrabber.cc.

48  {
49  static MuonsGrabber grabber;
50  return grabber;
51 }

Referenced by RPCTrigger::produce(), RPCHalfSorter::run(), RPCFinalSorter::run(), RPCTriggerBoard::runCone(), RPCPacTrigger::runEvent(), and RPCTriggerCrate::runTCGBSorter().

◆ IntToString()

std::string MuonsGrabber::IntToString ( int  i)
private

Definition at line 277 of file MuonsGrabber.cc.

277  {
278  std::stringstream ss;
279  ss << i;
280 
281  return ss.str();
282 }

References mps_fire::i, and contentValuesCheck::ss.

Referenced by startNewEvent(), and writeDataForRelativeBX().

◆ operator=()

const MuonsGrabber& MuonsGrabber::operator= ( const MuonsGrabber )
privatedelete

◆ setRPCBasicTrigConfig()

void MuonsGrabber::setRPCBasicTrigConfig ( RPCBasicTrigConfig c)
inline

Definition at line 57 of file MuonsGrabber.h.

57 { m_trigConfig = c; };

References HltBtagPostValidation_cff::c, and m_trigConfig.

Referenced by RPCTrigger::produce().

◆ startNewEvent()

void MuonsGrabber::startNewEvent ( int  event,
int  bx 
)

Definition at line 107 of file MuonsGrabber.cc.

107  {
108  //<event bx="0" num="0">
109  m_currEvent = m_doc->createElement(X("event"));
110  m_currEvent->setAttribute(X("num"), X(IntToString(event).c_str()));
111  m_currEvent->setAttribute(X("bx"), X(IntToString(bx).c_str()));
112  m_rootElem->appendChild(m_currEvent);
113 
115  m_currentBX = bx;
116 }

References l1GtPatternGenerator_cfi::bx, event(), IntToString(), m_currentBX, m_currentEvent, m_currEvent, m_doc, m_rootElem, and X.

Referenced by RPCTrigger::produce().

◆ writeDataForRelativeBX()

void MuonsGrabber::writeDataForRelativeBX ( int  bx)

Definition at line 123 of file MuonsGrabber.cc.

123  {
124  if (m_muons.empty())
125  return;
126 
127  //<bxData num="11">
128  DOMElement* currRelBx = m_doc->createElement(X("bxData"));
129  currRelBx->setAttribute(X("num"), X(IntToString(bx).c_str()));
130  m_currEvent->appendChild(currRelBx);
131 
132  //std::cout << "Writing out for relBx " << bx << std::endl;
133 
134  // <hs num="1" be="0">
135  // levels
136  // 0 - PAC
137  // 1 - tbgs
138  // 2 - tcgs
139  // 3 - hs
140  // 4 fs
141 
142  std::sort(m_muons.begin(), m_muons.end(), RPCMuonExtraStruct::lvlCompare);
143  for (int tcNum = 0; tcNum <= 11; ++tcNum) {
144  DOMElement* tc = nullptr;
145  DOMElement* tcgs = nullptr;
146  for (int tbNum = 0; tbNum <= 10; ++tbNum) { // check actual range, probably till 9 total
147  DOMElement* tb = nullptr;
148  DOMElement* tbgs = nullptr;
149  for (int PAC = 0; PAC <= 4; ++PAC) { // same here
150 
151  DOMElement* pac = nullptr;
152  // for (int segment = 0; segment <= 11; ++segment ) {
153  std::vector<RPCMuonExtraStruct>::iterator it = m_muons.begin();
154  while (it != m_muons.end()) {
155  int muSegment = it->_mu.getLogSegment();
156  //if
157 
158  int muTBno = m_trigConfig->getTBNum(it->_mu.getConeCrdnts());
159  int muPACChipNo = m_trigConfig->getTowerNumOnTb(it->_mu.getConeCrdnts());
160  int muTC = m_trigConfig->getTCNum(it->_mu.getConeCrdnts());
161 
162  if (!((int(it->_level) == 0 && tbNum == muTBno && muTC == tcNum && PAC == muPACChipNo) ||
163  (int(it->_level) == 1 && tbNum == muTBno && muTC == tcNum) || (int(it->_level) == 2 && muTC == tcNum)))
164 
165  {
166  ++it;
167  continue;
168  }
169  // std::cout << int(it->_level) << int(it->_region) << int(it->_hsHalf)
170  // << " " << int(it->_index)
171  // << " " << it->_mu.printDebugInfo(2) << std::endl;
172 
173  if (tc == nullptr) {
174  tc = m_doc->createElement(X("tc"));
175  currRelBx->appendChild(tc);
176  tc->setAttribute(X("num"), X(IntToString(tcNum).c_str()));
177 
178  tcgs = m_doc->createElement(X("tcgs"));
179  tc->appendChild(tcgs);
180  }
181  if (tb == nullptr && int(it->_level) <= 1) {
182  tb = m_doc->createElement(X("tb"));
183  tc->appendChild(tb);
184  tb->setAttribute(X("num"), X(IntToString(tbNum).c_str()));
185 
186  tbgs = m_doc->createElement(X("tbgs"));
187  tb->appendChild(tbgs);
188  }
189 
190  if (pac == nullptr && int(it->_level) == 0) {
191  pac = m_doc->createElement(X("pac"));
192  tb->appendChild(pac);
193  pac->setAttribute(X("num"), X(IntToString(muPACChipNo).c_str()));
194  }
195 
196  DOMElement* mu = m_doc->createElement(X("mu"));
197  mu->setAttribute(X("pt"), X(IntToString(int(it->_mu.getPtCode())).c_str()));
198  mu->setAttribute(X("qual"), X(IntToString(int(it->_mu.getQuality())).c_str()));
199  mu->setAttribute(X("sign"), X(IntToString(int(it->_mu.getSign())).c_str()));
200 
201  if (int(it->_level) == 0) {
202  mu->setAttribute(X("num"), X(IntToString(muSegment).c_str()));
203  pac->appendChild(mu);
204  } else {
205  mu->setAttribute(X("num"), X(IntToString(int(it->_index)).c_str()));
206  mu->setAttribute(X("phi"), X(IntToString(int(it->_mu.getPhiAddr())).c_str()));
207  mu->setAttribute(X("eta"), X(IntToString(int(it->_mu.getEtaAddr())).c_str()));
208  mu->setAttribute(X("gbD"), X(IntToString(int(it->_mu.getGBData())).c_str()));
209  if (int(it->_level) == 1) {
210  tbgs->appendChild(mu);
211  } else if (int(it->_level) == 2) {
212  tcgs->appendChild(mu);
213  } else {
214  throw cms::Exception("RPCMuonsGrabber") << "xx Unexpected level" << std::endl;
215  }
216  }
217 
218  it = m_muons.erase(it);
219 
220  } // muons iter
221  // } // segment
222  } // PAC
223  } // TB
224  } // TC
225 
226  for (int level = 3; level <= 4; ++level) {
227  for (int half = 0; half <= 1; ++half) {
228  for (int be = 0; be <= 1; ++be) { // brl/endcap
229 
230  std::vector<RPCMuonExtraStruct>::iterator it = m_muons.begin();
231  DOMElement* hs = nullptr;
232  while (it != m_muons.end()) {
233  if ((int(it->_level) != level) || int(it->_hsHalf) != half || int(it->_region) != be) {
234  ++it;
235  continue;
236  }
237 
238  if (hs == nullptr) {
239  if (level == 3) {
240  hs = m_doc->createElement(X("hs"));
241  hs->setAttribute(X("num"), X(IntToString(half).c_str()));
242  } else if (level == 4) {
243  hs = m_doc->createElement(X("fs"));
244  } else { // shoudlnt get here
245  throw cms::Exception("RPCMuonsGrabber") << "Problem writing out muons - lvl " << level << std::endl;
246  }
247  hs->setAttribute(X("be"), X(IntToString(be).c_str()));
248  currRelBx->appendChild(hs);
249  }
250 
251  DOMElement* mu = m_doc->createElement(X("mu"));
252  hs->appendChild(mu);
253  mu->setAttribute(X("num"), X(IntToString(int(it->_index)).c_str()));
254  mu->setAttribute(X("pt"), X(IntToString(int(it->_mu.getPtCode())).c_str()));
255  mu->setAttribute(X("qual"), X(IntToString(int(it->_mu.getQuality())).c_str()));
256  mu->setAttribute(X("sign"), X(IntToString(int(it->_mu.getSign())).c_str()));
257  mu->setAttribute(X("phi"), X(IntToString(int(it->_mu.getPhiAddr())).c_str()));
258  mu->setAttribute(X("eta"), X(IntToString(int(it->_mu.getEtaAddr())).c_str()));
259  mu->setAttribute(X("gbD"), X(IntToString(int(it->_mu.getGBData())).c_str()));
260 
261  //std::cout << int(it->_level) << int(it->_region) << int(it->_hsHalf)
262  // << " " << int(it->_index)
263  // << " " << it->_mu.printDebugInfo(2) << std::endl;
264 
265  it = m_muons.erase(it);
266 
267  } // muons iter
268  } // be iter
269  } //half iteration
270  } // lvl iteration
271 
272  if (!m_muons.empty()) {
273  throw cms::Exception("RPCMuonsGrabber") << " There are still some muons in muons vec" << std::endl;
274  }
275 }

References cms::cuda::be, l1GtPatternGenerator_cfi::bx, Exception, RPCBasicTrigConfig::getTBNum(), RPCBasicTrigConfig::getTCNum(), RPCBasicTrigConfig::getTowerNumOnTb(), createfilelist::int, IntToString(), personalPlayback::level, RPCMuonExtraStruct::lvlCompare(), m_currEvent, m_doc, m_muons, m_trigConfig, amptDefaultParameters_cff::mu, and X.

Referenced by RPCTrigger::produce().

Member Data Documentation

◆ m_currentBX

int MuonsGrabber::m_currentBX
private

Definition at line 75 of file MuonsGrabber.h.

Referenced by startNewEvent().

◆ m_currentEvent

int MuonsGrabber::m_currentEvent
private

Definition at line 74 of file MuonsGrabber.h.

Referenced by startNewEvent().

◆ m_currEvent

XERCES_CPP_NAMESPACE::DOMElement* MuonsGrabber::m_currEvent
private

Definition at line 79 of file MuonsGrabber.h.

Referenced by MuonsGrabber(), startNewEvent(), and writeDataForRelativeBX().

◆ m_doc

XERCES_CPP_NAMESPACE::DOMDocument* MuonsGrabber::m_doc
private

Definition at line 77 of file MuonsGrabber.h.

Referenced by MuonsGrabber(), startNewEvent(), writeDataForRelativeBX(), and ~MuonsGrabber().

◆ m_dom

XERCES_CPP_NAMESPACE::DOMImplementation* MuonsGrabber::m_dom
private

Definition at line 76 of file MuonsGrabber.h.

Referenced by MuonsGrabber().

◆ m_muons

std::vector<RPCMuonExtraStruct> MuonsGrabber::m_muons
private

Definition at line 71 of file MuonsGrabber.h.

Referenced by addMuon(), and writeDataForRelativeBX().

◆ m_rootElem

XERCES_CPP_NAMESPACE::DOMElement* MuonsGrabber::m_rootElem
private

Definition at line 78 of file MuonsGrabber.h.

Referenced by MuonsGrabber(), startNewEvent(), and ~MuonsGrabber().

◆ m_trigConfig

RPCBasicTrigConfig* MuonsGrabber::m_trigConfig
private

Definition at line 72 of file MuonsGrabber.h.

Referenced by setRPCBasicTrigConfig(), and writeDataForRelativeBX().

personalPlayback.level
level
Definition: personalPlayback.py:22
MuonsGrabber::m_trigConfig
RPCBasicTrigConfig * m_trigConfig
Definition: MuonsGrabber.h:72
MuonsGrabber
Definition: MuonsGrabber.h:50
mps_fire.i
i
Definition: mps_fire.py:355
RPCMuonExtraStruct
Definition: MuonsGrabber.h:39
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
X
#define X(str)
Definition: MuonsGrabber.cc:38
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
MuonsGrabber::m_doc
XERCES_CPP_NAMESPACE::DOMDocument * m_doc
Definition: MuonsGrabber.h:77
MuonsGrabber::m_dom
XERCES_CPP_NAMESPACE::DOMImplementation * m_dom
Definition: MuonsGrabber.h:76
MuonsGrabber::m_currentEvent
int m_currentEvent
Definition: MuonsGrabber.h:74
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
RPCMuonExtraStruct::lvlCompare
static bool lvlCompare(const RPCMuonExtraStruct &a, const RPCMuonExtraStruct &b)
Definition: MuonsGrabber.h:47
MuonsGrabber::m_currentBX
int m_currentBX
Definition: MuonsGrabber.h:75
RPCBasicTrigConfig::getTBNum
int getTBNum(const RPCConst::l1RpcConeCrdnts &coneCrdnts) override
Returns the index of TB (in TC) that should run given LogCone.
Definition: RPCBasicTrigConfig.cc:71
MuonsGrabber::m_currEvent
XERCES_CPP_NAMESPACE::DOMElement * m_currEvent
Definition: MuonsGrabber.h:79
RPCBasicTrigConfig::getTCNum
int getTCNum(const RPCConst::l1RpcConeCrdnts &coneCrdnts) override
Returns the index of TC that should run given LogCone.
Definition: RPCBasicTrigConfig.cc:44
RPCBasicTrigConfig::getTowerNumOnTb
int getTowerNumOnTb(const RPCConst::l1RpcConeCrdnts &coneCrdnts) override
Definition: RPCBasicTrigConfig.cc:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonsGrabber::m_muons
std::vector< RPCMuonExtraStruct > m_muons
Definition: MuonsGrabber.h:71
createfilelist.int
int
Definition: createfilelist.py:10
cms::concurrency::xercesTerminate
void xercesTerminate()
Definition: Xerces.cc:23
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
MuonsGrabber::IntToString
std::string IntToString(int i)
Definition: MuonsGrabber.cc:277
impl
Definition: trackAlgoPriorityOrder.h:18
Exception
Definition: hltDiff.cc:246
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
cms::cuda::be
int be
Definition: HistoContainer.h:126
event
Definition: event.py:1
event
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of "!*" before the partial wildcard feature was incorporated). The per-event "cost" of each negative criterion with multiple relevant triggers is about the same as ! *was in the past
cms::concurrency::xercesInitialize
void xercesInitialize()
Definition: Xerces.cc:18
MuonsGrabber::m_rootElem
XERCES_CPP_NAMESPACE::DOMElement * m_rootElem
Definition: MuonsGrabber.h:78