CMS 3D CMS Logo

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

#include <XMLEventWriter.h>

Inheritance diagram for XMLEventWriter:
IOMTFEmulationObserver

Public Member Functions

void endJob () override
 
void observeEventBegin (const edm::Event &iEvent) override
 
void observeEventEnd (const edm::Event &iEvent, std::unique_ptr< l1t::RegionalMuonCandBxCollection > &finalCandidates) override
 
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
 
 XMLEventWriter (const OMTFConfiguration *aOMTFConfig, std::string fName)
 
 ~XMLEventWriter () override
 
- Public Member Functions inherited from IOMTFEmulationObserver
virtual void beginRun (edm::EventSetup const &eventSetup)
 
 IOMTFEmulationObserver ()
 
virtual ~IOMTFEmulationObserver ()
 

Private Attributes

xercesc::DOMElement * currentElement
 
unsigned int eventId = 0
 
unsigned int eventNum = 0
 
std::string fName
 
const OMTFConfigurationomtfConfig
 
XMLConfigWriter xmlWriter
 

Detailed Description

Definition at line 21 of file XMLEventWriter.h.

Constructor & Destructor Documentation

◆ XMLEventWriter()

XMLEventWriter::XMLEventWriter ( const OMTFConfiguration aOMTFConfig,
std::string  fName 
)

Definition at line 15 of file XMLEventWriter.cc.

References eventNum, XMLConfigWriter::initialiseXMLDocument(), and xmlWriter.

16  : omtfConfig(aOMTFConfig), xmlWriter(aOMTFConfig), currentElement(nullptr), fName(fName) {
17  //std::string fName = "OMTF";
19  eventNum = 0;
20 };
xercesc::DOMElement * currentElement
XMLConfigWriter xmlWriter
void initialiseXMLDocument(const std::string &docName)
unsigned int eventNum
std::string fName
const OMTFConfiguration * omtfConfig

◆ ~XMLEventWriter()

XMLEventWriter::~XMLEventWriter ( )
override

Definition at line 22 of file XMLEventWriter.cc.

22 {}

Member Function Documentation

◆ endJob()

void XMLEventWriter::endJob ( void  )
overridevirtual

Implements IOMTFEmulationObserver.

Definition at line 74 of file XMLEventWriter.cc.

References XMLConfigWriter::finaliseXMLDocument(), fName, and xmlWriter.

XMLConfigWriter xmlWriter
std::string fName
void finaliseXMLDocument(const std::string &fName)

◆ observeEventBegin()

void XMLEventWriter::observeEventBegin ( const edm::Event iEvent)
overridevirtual

Reimplemented from IOMTFEmulationObserver.

Definition at line 59 of file XMLEventWriter.cc.

References currentElement, eventId, eventNum, iEvent, XMLConfigWriter::writeEventHeader(), and xmlWriter.

59  {
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 }
xercesc::DOMElement * currentElement
XMLConfigWriter xmlWriter
int iEvent
Definition: GenABIO.cc:224
unsigned int eventNum
unsigned int eventId
xercesc::DOMElement * writeEventHeader(unsigned int eventId, unsigned int mixedEventId=0)

◆ observeEventEnd()

void XMLEventWriter::observeEventEnd ( const edm::Event iEvent,
std::unique_ptr< l1t::RegionalMuonCandBxCollection > &  finalCandidates 
)
overridevirtual

Reimplemented from IOMTFEmulationObserver.

Definition at line 69 of file XMLEventWriter.cc.

References currentElement.

70  {
71  currentElement = nullptr;
72 }
xercesc::DOMElement * currentElement

◆ observeProcesorEmulation()

void XMLEventWriter::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 
)
overridevirtual

Dump only regions, where a candidate was found

Implements IOMTFEmulationObserver.

Definition at line 24 of file XMLEventWriter.cc.

References currentElement, makeMuonMisalignmentScenario::endcap, eventNum, input, l1t::omtf_neg, l1t::omtf_pos, XMLConfigWriter::writeAlgoMuon(), XMLConfigWriter::writeCandMuon(), XMLConfigWriter::writeEventData(), and xmlWriter.

29  {
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 }
xercesc::DOMElement * currentElement
XMLConfigWriter xmlWriter
xercesc::DOMElement * writeEventData(xercesc::DOMElement *aTopElement, const OmtfName &board, const OMTFinput &aInput)
static std::string const input
Definition: EdmProvDump.cc:50
unsigned int eventNum
void writeCandMuon(xercesc::DOMElement *aTopElement, const l1t::RegionalMuonCand &aCand)
void writeAlgoMuon(xercesc::DOMElement *aTopElement, unsigned int iRefHit, const AlgoMuon &aMuon)

Member Data Documentation

◆ currentElement

xercesc::DOMElement* XMLEventWriter::currentElement
private

Definition at line 44 of file XMLEventWriter.h.

Referenced by observeEventBegin(), observeEventEnd(), and observeProcesorEmulation().

◆ eventId

unsigned int XMLEventWriter::eventId = 0
private

Definition at line 50 of file XMLEventWriter.h.

Referenced by ntupleDataFormat.Event::eventIdStr(), and observeEventBegin().

◆ eventNum

unsigned int XMLEventWriter::eventNum = 0
private

Definition at line 48 of file XMLEventWriter.h.

Referenced by observeEventBegin(), observeProcesorEmulation(), and XMLEventWriter().

◆ fName

std::string XMLEventWriter::fName
private

Definition at line 46 of file XMLEventWriter.h.

Referenced by endJob().

◆ omtfConfig

const OMTFConfiguration* XMLEventWriter::omtfConfig
private

Definition at line 42 of file XMLEventWriter.h.

◆ xmlWriter

XMLConfigWriter XMLEventWriter::xmlWriter
private