CMS 3D CMS Logo

Public Member Functions | Private Attributes

edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer Class Reference

Inheritance diagram for edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer:
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 &)
 DQMReferenceHistogramRootFileEventSetupAnalyzer (int i)
 DQMReferenceHistogramRootFileEventSetupAnalyzer (const edm::ParameterSet &pset)
virtual ~DQMReferenceHistogramRootFileEventSetupAnalyzer ()

Private Attributes

bool init_

Detailed Description

Definition at line 24 of file DQMReferenceHistogramRootFileEventSetupAnalyzer.cc.


Constructor & Destructor Documentation

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

Definition at line 35 of file DQMReferenceHistogramRootFileEventSetupAnalyzer.cc.

References funct::false, and init_.

                                                                                                                            {
    init_ = false ;
    //std::cout << "DQMReferenceHistogramRootFileEventSetupAnalyzer(const edm::ParameterSet &ps)" << std::endl;
  }
edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer::DQMReferenceHistogramRootFileEventSetupAnalyzer ( int  i) [explicit]

Definition at line 40 of file DQMReferenceHistogramRootFileEventSetupAnalyzer.cc.

References funct::false, and init_.

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

Definition at line 45 of file DQMReferenceHistogramRootFileEventSetupAnalyzer.cc.

References funct::false, and init_.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 51 of file DQMReferenceHistogramRootFileEventSetupAnalyzer.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file DQMReferenceHistogramRootFileEventSetupAnalyzer.cc.

References Exception, edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), DQMStore::getAllContents(), init_, DQMStore::open(), EdgesToViz::outfile, convertSQLitetoXML_cfg::output, funct::true, and edm::eventsetup::EventSetupRecordKey::type().

  {
    //std::cout << "DQMReferenceHistogramRootFileEventSetupAnalyzer::beginRun()" << std::endl;    
    if(!init_)
      {
        init_ = true ;
        edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DQMReferenceHistogramRootFileRcd"));
        if(recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
          throw cms::Exception ("Record not found") << "Record \"DQMReferenceHistogramRootFileRcd" 
                                                    << "\" does not exist!" << std::endl;
        }
        edm::ESHandle<FileBlob> rootgeo;
        iSetup.get<DQMReferenceHistogramRootFileRcd>().get(rootgeo);
        //std::cout<<"ROOT FILE IN MEMORY"<<std::endl;
        boost::scoped_ptr<std::vector<unsigned char> > tb( (*rootgeo).getUncompressedBlob() );
        // char filename[128];
        // sprintf(filename, "mem:%p,%ul", &(*tb)[0], (unsigned long) tb->size());
        // edm::Service<DQMStore>()->open(filename, false, "", "Reference");
        
        //here you can implement the stream for putting the TFile on disk...
        std::string outfile("dqmreference.root") ;
        ofstream output(outfile.c_str()) ;
        output.write((const char *)&(*tb)[0], tb->size());
        output.close() ;
        
        DQMStore *dqm = &*edm::Service<DQMStore>();
        dqm->open(outfile, false, "", "Reference");
        remove(outfile.c_str());
        
        std::vector<MonitorElement *> mes = dqm->getAllContents("");
        // for (std::vector<MonitorElement *>::iterator i = mes.begin(), e = mes.end(); i != e; ++i)
        //  std::cout << "ME '" << (*i)->getFullname() << "'\n";
        
        //std::cout<<"SIZE FILE = "<<tb->size()<<std::endl;
      }
  }

Member Data Documentation