18 #include <xercesc/util/XMLString.hpp>
19 #include <xercesc/dom/DOM.hpp>
20 #include <xercesc/framework/LocalFileFormatTarget.hpp>
24 XERCES_CPP_NAMESPACE_USE
29 XStr(
const char*
const toTranscode)
48 #define X(str) XStr(str).unicodeForm()
76 catch(
const XMLException &toCatch) {
77 throw std::string(
"Error during Xerces-c Initialization: "
81 m_dom = DOMImplementationRegistry::getDOMImplementation(
X(
"Core"));
106 DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
107 DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
109 theSerializer->setEncoding(
X(
"UTF-8"));
111 if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
112 theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
114 XMLFormatTarget *myFormTarget =
new LocalFileFormatTarget(
X(
"testpulses.xml"));
115 DOMNode* xmlstylesheet =
m_doc->createProcessingInstruction(
X(
"xml-stylesheet"),
116 X(
"type=\"text/xsl\"href=\"default.xsl\""));
119 theSerializer->writeNode(myFormTarget, *
m_doc);
121 delete theSerializer;
154 DOMElement* currRelBx =
m_doc->createElement(
X(
"bxData"));
155 currRelBx->setAttribute(
X(
"num"),
X(
IntToString(bx).c_str()));
169 for (
int tcNum = 0; tcNum <= 11; ++tcNum ) {
171 DOMElement* tcgs = 0;
172 for (
int tbNum = 0; tbNum <= 10; ++tbNum ) {
174 DOMElement* tbgs = 0;
175 for (
int PAC = 0; PAC <= 4; ++PAC ) {
179 std::vector< RPCMuonExtraStruct >::iterator it =
m_muons.begin();
181 int muSegment = it->_mu.getLogSegment();
190 (
int(it->_level) == 0 && tbNum == muTBno && muTC == tcNum && PAC == muPACChipNo)
191 || (
int(it->_level) == 1 && tbNum == muTBno && muTC == tcNum )
192 || (
int(it->_level) == 2 && muTC == tcNum )
206 tc =
m_doc->createElement(
X(
"tc"));
207 currRelBx->appendChild(tc);
210 tcgs =
m_doc->createElement(
X(
"tcgs"));
211 tc->appendChild(tcgs);
214 if (tb==0 &&
int(it->_level) <= 1) {
215 tb =
m_doc->createElement(
X(
"tb"));
219 tbgs =
m_doc->createElement(
X(
"tbgs"));
220 tb->appendChild(tbgs);
223 if (pac == 0 &&
int(it->_level) == 0) {
224 pac =
m_doc->createElement(
X(
"pac"));
225 tb->appendChild(pac);
226 pac->setAttribute(
X(
"num"),
X(
IntToString(muPACChipNo).c_str()));
229 DOMElement*
mu =
m_doc->createElement(
X(
"mu"));
230 mu->setAttribute(
X(
"pt"),
X(
IntToString(
int(it->_mu.getPtCode() ) ).c_str()));
231 mu->setAttribute(
X(
"qual"),
X(
IntToString(
int(it->_mu.getQuality() ) ).c_str()));
232 mu->setAttribute(
X(
"sign"),
X(
IntToString(
int(it->_mu.getSign() ) ).c_str()));
234 if (
int(it->_level) == 0 ) {
235 mu->setAttribute(
X(
"num"),
X(
IntToString( muSegment ).c_str()));
236 pac->appendChild(mu);
238 mu->setAttribute(
X(
"num"),
X(
IntToString(
int(it->_index) ).c_str()));
239 mu->setAttribute(
X(
"phi"),
X(
IntToString(
int(it->_mu.getPhiAddr() ) ).c_str()));
240 mu->setAttribute(
X(
"eta"),
X(
IntToString(
int(it->_mu.getEtaAddr() ) ).c_str()));
241 mu->setAttribute(
X(
"gbD"),
X(
IntToString(
int(it->_mu.getGBData() ) ).c_str()));
242 if (
int(it->_level) == 1 ) {
243 tbgs->appendChild(mu);
244 }
else if (
int(it->_level) == 2 ) {
245 tcgs->appendChild(mu);
247 throw cms::Exception(
"RPCMuonsGrabber") <<
"xx Unexpected level" << std::endl;
264 for (
int half =0; half <= 1; ++half){
265 for (
int be =0; be <= 1; ++be){
267 std::vector< RPCMuonExtraStruct >::iterator it =
m_muons.begin();
270 if ( (
int(it->_level) !=
level) || int(it->_hsHalf)!=half || int(it->_region)!=be ) {
277 hs =
m_doc->createElement(
X(
"hs"));
279 }
else if (
level ==4 ) {
280 hs =
m_doc->createElement(
X(
"fs"));
282 throw cms::Exception(
"RPCMuonsGrabber") <<
"Problem writing out muons - lvl " <<
level << std::endl;
285 currRelBx->appendChild(hs);
288 DOMElement*
mu =
m_doc->createElement(
X(
"mu"));
290 mu->setAttribute(
X(
"num"),
X(
IntToString(
int(it->_index) ).c_str()));
291 mu->setAttribute(
X(
"pt"),
X(
IntToString(
int(it->_mu.getPtCode() ) ).c_str()));
292 mu->setAttribute(
X(
"qual"),
X(
IntToString(
int(it->_mu.getQuality() ) ).c_str()));
293 mu->setAttribute(
X(
"sign"),
X(
IntToString(
int(it->_mu.getSign() ) ).c_str()));
294 mu->setAttribute(
X(
"phi"),
X(
IntToString(
int(it->_mu.getPhiAddr() ) ).c_str()));
295 mu->setAttribute(
X(
"eta"),
X(
IntToString(
int(it->_mu.getEtaAddr() ) ).c_str()));
296 mu->setAttribute(
X(
"gbD"),
X(
IntToString(
int(it->_mu.getGBData() ) ).c_str()));
310 throw cms::Exception(
"RPCMuonsGrabber") <<
" There are still some muons in muons vec" << std::endl;
319 std::stringstream
ss;
XERCES_CPP_NAMESPACE::DOMImplementation * m_dom
const XMLCh * unicodeForm() const
std::string IntToString(int i)
virtual int getTowerNumOnTb(const RPCConst::l1RpcConeCrdnts &coneCrdnts)
static MuonsGrabber & Instance()
void startNewEvent(int event, int bx)
RPCBasicTrigConfig * m_trigConfig
XMLCh * transcode(const T &fInput)
XStr(const char *const toTranscode)
XERCES_CPP_NAMESPACE::DOMElement * m_rootElem
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
XERCES_CPP_NAMESPACE::DOMDocument * m_doc
std::vector< RPCMuonExtraStruct > m_muons
XERCES_CPP_NAMESPACE::DOMElement * m_currEvent
void addMuon(RPCTBMuon &mu, int lvl, int region, int hs, int index)
virtual int getTBNum(const RPCConst::l1RpcConeCrdnts &coneCrdnts)
Returns the index of TB (in TC) that should run given LogCone.
virtual int getTCNum(const RPCConst::l1RpcConeCrdnts &coneCrdnts)
Returns the index of TC that should run given LogCone.
void writeDataForRelativeBX(int bx)