18 #include <xercesc/util/PlatformUtils.hpp>
19 #include <xercesc/util/XMLString.hpp>
20 #include <xercesc/dom/DOM.hpp>
21 #include <xercesc/framework/LocalFileFormatTarget.hpp>
25 XERCES_CPP_NAMESPACE_USE
30 XStr(
const char*
const toTranscode)
49 #define X(str) XStr(str).unicodeForm()
75 XMLPlatformUtils::Initialize();
77 catch(
const XMLException &toCatch) {
78 throw std::string(
"Error during Xerces-c Initialization: "
79 + std::string(XMLString::transcode(toCatch.getMessage())));
82 m_dom = DOMImplementationRegistry::getDOMImplementation(
X(
"Core"));
106 XMLString::transcode(
"LS", tempStr, 99);
107 DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
108 DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
110 theSerializer->setEncoding(
X(
"UTF-8"));
112 if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
113 theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
115 XMLFormatTarget *myFormTarget =
new LocalFileFormatTarget(
X(
"testpulses.xml"));
116 DOMNode* xmlstylesheet =
m_doc->createProcessingInstruction(
X(
"xml-stylesheet"),
117 X(
"type=\"text/xsl\"href=\"default.xsl\""));
120 theSerializer->writeNode(myFormTarget, *
m_doc);
122 delete theSerializer;
155 DOMElement* currRelBx =
m_doc->createElement(
X(
"bxData"));
156 currRelBx->setAttribute(
X(
"num"),
X(
IntToString(bx).c_str()));
170 for (
int tcNum = 0; tcNum <= 11; ++tcNum ) {
172 DOMElement* tcgs = 0;
173 for (
int tbNum = 0; tbNum <= 10; ++tbNum ) {
175 DOMElement* tbgs = 0;
176 for (
int PAC = 0; PAC <= 4; ++PAC ) {
180 std::vector< RPCMuonExtraStruct >::iterator it =
m_muons.begin();
182 int muSegment = it->_mu.getLogSegment();
191 (
int(it->_level) == 0 && tbNum == muTBno && muTC == tcNum && PAC == muPACChipNo)
192 || (
int(it->_level) == 1 && tbNum == muTBno && muTC == tcNum )
193 || (
int(it->_level) == 2 && muTC == tcNum )
207 tc =
m_doc->createElement(
X(
"tc"));
208 currRelBx->appendChild(tc);
211 tcgs =
m_doc->createElement(
X(
"tcgs"));
212 tc->appendChild(tcgs);
215 if (tb==0 &&
int(it->_level) <= 1) {
216 tb =
m_doc->createElement(
X(
"tb"));
220 tbgs =
m_doc->createElement(
X(
"tbgs"));
221 tb->appendChild(tbgs);
224 if (pac == 0 &&
int(it->_level) == 0) {
225 pac =
m_doc->createElement(
X(
"pac"));
226 tb->appendChild(pac);
227 pac->setAttribute(
X(
"num"),
X(
IntToString(muPACChipNo).c_str()));
230 DOMElement*
mu =
m_doc->createElement(
X(
"mu"));
231 mu->setAttribute(
X(
"pt"),
X(
IntToString(
int(it->_mu.getPtCode() ) ).c_str()));
232 mu->setAttribute(
X(
"qual"),
X(
IntToString(
int(it->_mu.getQuality() ) ).c_str()));
233 mu->setAttribute(
X(
"sign"),
X(
IntToString(
int(it->_mu.getSign() ) ).c_str()));
235 if (
int(it->_level) == 0 ) {
236 mu->setAttribute(
X(
"num"),
X(
IntToString( muSegment ).c_str()));
237 pac->appendChild(mu);
239 mu->setAttribute(
X(
"num"),
X(
IntToString(
int(it->_index) ).c_str()));
240 mu->setAttribute(
X(
"phi"),
X(
IntToString(
int(it->_mu.getPhiAddr() ) ).c_str()));
241 mu->setAttribute(
X(
"eta"),
X(
IntToString(
int(it->_mu.getEtaAddr() ) ).c_str()));
242 mu->setAttribute(
X(
"gbD"),
X(
IntToString(
int(it->_mu.getGBData() ) ).c_str()));
243 if (
int(it->_level) == 1 ) {
244 tbgs->appendChild(mu);
245 }
else if (
int(it->_level) == 2 ) {
246 tcgs->appendChild(mu);
248 throw cms::Exception(
"RPCMuonsGrabber") <<
"xx Unexpected level" << std::endl;
265 for (
int half =0; half <= 1; ++half){
266 for (
int be =0; be <= 1; ++be){
268 std::vector< RPCMuonExtraStruct >::iterator it =
m_muons.begin();
271 if ( (
int(it->_level) !=
level) || int(it->_hsHalf)!=half || int(it->_region)!=be ) {
278 hs =
m_doc->createElement(
X(
"hs"));
280 }
else if (
level ==4 ) {
281 hs =
m_doc->createElement(
X(
"fs"));
283 throw cms::Exception(
"RPCMuonsGrabber") <<
"Problem writing out muons - lvl " <<
level << std::endl;
286 currRelBx->appendChild(hs);
289 DOMElement*
mu =
m_doc->createElement(
X(
"mu"));
291 mu->setAttribute(
X(
"num"),
X(
IntToString(
int(it->_index) ).c_str()));
292 mu->setAttribute(
X(
"pt"),
X(
IntToString(
int(it->_mu.getPtCode() ) ).c_str()));
293 mu->setAttribute(
X(
"qual"),
X(
IntToString(
int(it->_mu.getQuality() ) ).c_str()));
294 mu->setAttribute(
X(
"sign"),
X(
IntToString(
int(it->_mu.getSign() ) ).c_str()));
295 mu->setAttribute(
X(
"phi"),
X(
IntToString(
int(it->_mu.getPhiAddr() ) ).c_str()));
296 mu->setAttribute(
X(
"eta"),
X(
IntToString(
int(it->_mu.getEtaAddr() ) ).c_str()));
297 mu->setAttribute(
X(
"gbD"),
X(
IntToString(
int(it->_mu.getGBData() ) ).c_str()));
311 throw cms::Exception(
"RPCMuonsGrabber") <<
" There are still some muons in muons vec" << std::endl;
320 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
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)