CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

edm::XMLOutputModule Class Reference

Inheritance diagram for edm::XMLOutputModule:
edm::OutputModule

List of all members.

Public Member Functions

 XMLOutputModule (ParameterSet const &)
virtual ~XMLOutputModule ()

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)

Private Member Functions

XMLOutputModule const & operator= (XMLOutputModule const &)
virtual void write (EventPrincipal const &e)
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &)
virtual void writeRun (RunPrincipal const &)
 XMLOutputModule (XMLOutputModule const &)

Private Attributes

std::string indentation_
std::ofstream stream_

Detailed Description

Definition at line 44 of file XMLOutputModule.cc.


Constructor & Destructor Documentation

edm::XMLOutputModule::XMLOutputModule ( ParameterSet const &  iPSet)

Definition at line 500 of file XMLOutputModule.cc.

References edm::errors::Configuration, Exception, edm::ParameterSet::getUntrackedParameter(), and stream_.

                                                            :
      OutputModule(iPSet),
      stream_(iPSet.getUntrackedParameter<std::string>("fileName").c_str()),
      indentation_("  ") {
    if(!stream_){
      throw edm::Exception(errors::Configuration) << "failed to open file " << iPSet.getUntrackedParameter<std::string>("fileName");
    }
    stream_ << "<cmsdata>" << std::endl;
  }
edm::XMLOutputModule::~XMLOutputModule ( ) [virtual]

Definition at line 515 of file XMLOutputModule.cc.

References stream_.

                                    {
    stream_ << "</cmsdata>" << std::endl;
  }
edm::XMLOutputModule::XMLOutputModule ( XMLOutputModule const &  ) [private]

Member Function Documentation

void edm::XMLOutputModule::fillDescriptions ( ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::OutputModule.

Definition at line 559 of file XMLOutputModule.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), edm::OutputModule::fillDescription(), and edm::ParameterSetDescription::setComment().

                                                                           {
    ParameterSetDescription desc;
    desc.setComment("Prints event information into a file in XML format.");
    desc.addUntracked<std::string>("fileName");
    OutputModule::fillDescription(desc);
    descriptions.add("XMLoutput", desc);
  }
XMLOutputModule const& edm::XMLOutputModule::operator= ( XMLOutputModule const &  ) [private]
void edm::XMLOutputModule::write ( EventPrincipal const &  e) [private, virtual]

Implements edm::OutputModule.

Definition at line 535 of file XMLOutputModule.cc.

References begin, end, event(), indentation_, edm::InEvent, edm::OutputModule::keptProducts(), and stream_.

                                                  {
    ModuleDescription desc;
    Event event(const_cast<EventPrincipal&>(iEP), desc);
    stream_ << "<event run=\"" << event.id().run() << "\" number=\"" << event.id().event() << "\" >\n";
    std::string startIndent = indentation_;
    for(Selections::const_iterator itBD = keptProducts()[InEvent].begin(), itBDEnd = keptProducts()[InEvent].end();
        itBD != itBDEnd;
        ++itBD) {
      stream_ << "<product type=\"" << (*itBD)->friendlyClassName()
             << "\" module=\"" << (*itBD)->moduleLabel()
      << "\" productInstance=\"" << (*itBD)->productInstanceName() << "\">\n";
      printObject(stream_,
                   event,
                  (*itBD)->className(),
                  (*itBD)->moduleLabel(),
                  (*itBD)->productInstanceName(),
                  startIndent,
                  indentation_);
      stream_ << "</product>\n";
    }
    stream_ << "</event>" << std::endl;
  }
virtual void edm::XMLOutputModule::writeLuminosityBlock ( LuminosityBlockPrincipal const &  ) [inline, private, virtual]

Implements edm::OutputModule.

Definition at line 59 of file XMLOutputModule.cc.

{}
virtual void edm::XMLOutputModule::writeRun ( RunPrincipal const &  ) [inline, private, virtual]

Implements edm::OutputModule.

Definition at line 60 of file XMLOutputModule.cc.

{}

Member Data Documentation

std::string edm::XMLOutputModule::indentation_ [private]

Definition at line 68 of file XMLOutputModule.cc.

Referenced by write().

std::ofstream edm::XMLOutputModule::stream_ [private]

Definition at line 67 of file XMLOutputModule.cc.

Referenced by write(), XMLOutputModule(), and ~XMLOutputModule().