CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
XMLEventWriter.cc
Go to the documentation of this file.
1 /*
2  * XMLEventWriter.cc
3  *
4  * Created on: Oct 12, 2017
5  * Author: kbunkow
6  */
7 
14 
16  : omtfConfig(aOMTFConfig), xmlWriter(aOMTFConfig), currentElement(nullptr), fName(fName) {
17  //std::string fName = "OMTF";
19  eventNum = 0;
20 };
21 
23 
24 void XMLEventWriter::observeProcesorEmulation(unsigned int iProcessor,
25  l1t::tftype mtfType,
26  const std::shared_ptr<OMTFinput>& input,
27  const AlgoMuons& algoCandidates,
28  const AlgoMuons& gbCandidates,
29  const std::vector<l1t::RegionalMuonCand>& candMuons) {
30  if (eventNum > 5000)
31  return;
32 
33  int endcap = (mtfType == l1t::omtf_neg) ? -1 : ((mtfType == l1t::omtf_pos) ? +1 : 0);
34  OmtfName board(iProcessor, endcap);
35 
36  if (candMuons.empty())
37  return;
38 
39  //if(currentElement == nullptr)
40  // currentElement = xmlWriter.writeEventHeader(eventId);
41 
42  xercesc::DOMElement* aProcElement = xmlWriter.writeEventData(currentElement, board, *(input.get()));
43 
44  for (auto& algoCand : algoCandidates) {
46  if (algoCand->isValid()) {
47  xmlWriter.writeAlgoMuon(aProcElement, *algoCand);
48  /*if(dumpDetailedResultToXML){
49  for(auto & itKey: results[iRefHit])
50  xmlWriter.writeResultsData(aProcElement, iRefHit, itKey.first,itKey.second);
51  }*/
52  }
53  }
54 
55  for (auto& candMuon : candMuons)
56  xmlWriter.writeCandMuon(aProcElement, candMuon);
57 }
58 
60  eventNum++;
61  if (eventNum > 5000)
62  //due to some bug if more events is written the memory consumption s very big and program crashes
63  return;
64  //currentElement = xmlWriter.writeEventHeader(iEvent.id().event());
65  eventId = iEvent.id().event();
67 }
68 
70  std::unique_ptr<l1t::RegionalMuonCandBxCollection>& finalCandidates) {
71  currentElement = nullptr;
72 }
73 
EventNumber_t event() const
Definition: EventID.h:40
xercesc::DOMElement * currentElement
XMLConfigWriter xmlWriter
void initialiseXMLDocument(const std::string &docName)
xercesc::DOMElement * writeEventData(xercesc::DOMElement *aTopElement, const OmtfName &board, const OMTFinput &aInput)
void observeProcesorEmulation(unsigned int iProcessor, l1t::tftype mtfType, const std::shared_ptr< OMTFinput > &input, const AlgoMuons &algoCandidates, const AlgoMuons &gbCandidates, const std::vector< l1t::RegionalMuonCand > &candMuons) override
omtfConfig(omtfConfig)
static std::string const input
Definition: EdmProvDump.cc:47
int iEvent
Definition: GenABIO.cc:224
unsigned int eventNum
void writeCandMuon(xercesc::DOMElement *aTopElement, const l1t::RegionalMuonCand &aCand)
std::string fName
edm::EventID id() const
Definition: EventBase.h:59
std::vector< AlgoMuonPtr > AlgoMuons
Definition: AlgoMuon.h:102
void endJob() override
void finaliseXMLDocument(const std::string &fName)
unsigned int eventId
void writeAlgoMuon(xercesc::DOMElement *aTopElement, unsigned int iRefHit, const AlgoMuon &aMuon)
void observeEventEnd(const edm::Event &iEvent, std::unique_ptr< l1t::RegionalMuonCandBxCollection > &finalCandidates) override
XMLEventWriter(const OMTFConfiguration *aOMTFConfig, std::string fName)
xercesc::DOMElement * writeEventHeader(unsigned int eventId, unsigned int mixedEventId=0)
void observeEventBegin(const edm::Event &iEvent) override
~XMLEventWriter() override