CMS 3D CMS Logo

Public Member Functions | Private Attributes

edmtest::DQMXMLFileEventSetupAnalyzer Class Reference

Inheritance diagram for edmtest::DQMXMLFileEventSetupAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup)
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 DQMXMLFileEventSetupAnalyzer (int i)
 DQMXMLFileEventSetupAnalyzer (const edm::ParameterSet &pset)
virtual ~DQMXMLFileEventSetupAnalyzer ()

Private Attributes

bool init_
std::string labelToGet_

Detailed Description

Definition at line 24 of file DQMXMLFileEventSetupAnalyzer.cc.


Constructor & Destructor Documentation

edmtest::DQMXMLFileEventSetupAnalyzer::DQMXMLFileEventSetupAnalyzer ( const edm::ParameterSet pset) [explicit]

Definition at line 36 of file DQMXMLFileEventSetupAnalyzer.cc.

References funct::false, and init_.

                                                                                     :labelToGet_(ps.getParameter<std::string>("labelToGet")) {
    init_ = false ;
    //std::cout << "DQMXMLFileEventSetupAnalyzer(const edm::ParameterSet &ps)" << std::endl;
  }
edmtest::DQMXMLFileEventSetupAnalyzer::DQMXMLFileEventSetupAnalyzer ( int  i) [explicit]

Definition at line 41 of file DQMXMLFileEventSetupAnalyzer.cc.

References funct::false, and init_.

                                                                  {
    init_ = false ;
    //std::cout << "DQMXMLFileEventSetupAnalyzer(int i) " << i << std::endl;
  }
edmtest::DQMXMLFileEventSetupAnalyzer::~DQMXMLFileEventSetupAnalyzer ( ) [virtual]

Definition at line 46 of file DQMXMLFileEventSetupAnalyzer.cc.

References funct::false, and init_.

  {
    init_ = false ;
    //std::cout << "~DQMXMLFileEventSetupAnalyzer" << std::endl;
  }

Member Function Documentation

void edmtest::DQMXMLFileEventSetupAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 52 of file DQMXMLFileEventSetupAnalyzer.cc.

  {
    return ;
  }
void edmtest::DQMXMLFileEventSetupAnalyzer::beginRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file DQMXMLFileEventSetupAnalyzer.cc.

References Exception, edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), init_, labelToGet_, funct::true, and edm::eventsetup::EventSetupRecordKey::type().

  {
    //std::cout << "DQMXMLFileEventSetupAnalyzer::beginRun()" << std::endl;    
    if(!init_)
      {
        init_ = true ;
        edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DQMXMLFileRcd"));
        if(recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
          throw cms::Exception ("Record not found") << "Record \"DQMXMLFileRcd" 
                                                    << "\" does not exist!" << std::endl;
        }
        edm::ESHandle<FileBlob> rootgeo;
        iSetup.get<DQMXMLFileRcd>().get(labelToGet_,rootgeo);
        //std::cout<<"XML FILE IN MEMORY 1 with label " << labelToGet_ <<std::endl;
        boost::scoped_ptr<std::vector<unsigned char> > tb1( (*rootgeo).getUncompressedBlob() );
        //here you can implement the stream for putting the TFile on disk...
        std::string outfile1("XML1_retrieved.xml") ;
        ofstream output1(outfile1.c_str()) ;
        output1.write((const char *)&(*tb1)[0], tb1->size());
        output1.close() ;
        
//      iSetup.get<DQMXMLFileRcd>().get("XML2_mio",rootgeo);
//      std::cout<<"ROOT FILE IN MEMORY 2"<<std::endl;
//      boost::scoped_ptr<std::vector<unsigned char> > tb2( (*rootgeo).getUncompressedBlob() );
//      //here you can implement the stream for putting the TFile on disk...
//      std::string outfile2("XML2_retrieved.xml") ;
//      ofstream output2(outfile2.c_str()) ;
//      output2.write((const char *)&(*tb2)[0], tb2->size());
//      output2.close() ;
        //      boost::scoped_ptr<std::vector<unsigned char> > tb( (*rootgeo).getUncompressedBlob() );
      }
  }

Member Data Documentation

Definition at line 33 of file DQMXMLFileEventSetupAnalyzer.cc.

Referenced by beginRun().