CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/DQMServices/Components/src/DQMFileReader.cc

Go to the documentation of this file.
00001 #include "DQMServices/Components/src/DQMFileReader.h"
00002 #include "FWCore/Catalog/interface/InputFileCatalog.h"
00003 #include <iostream>
00004 
00005 DQMFileReader::DQMFileReader(const edm::ParameterSet& ps)  
00006 {   
00007 
00008   pset_ = ps;
00009 
00010   dbe_ = edm::Service<DQMStore>().operator->();
00011 
00012   filenames_.clear();
00013   filenames_=pset_.getUntrackedParameter<std::vector<std::string > >("FileNames");
00014   referenceFileName_=pset_.getUntrackedParameter<std::string>("referenceFileName","");
00015 }
00016 
00017 DQMFileReader::~DQMFileReader()
00018 {}
00019 
00020 void 
00021 DQMFileReader::beginJob()
00022 {
00023   
00024   if (referenceFileName_ != "") 
00025   {
00026     const std::string override = "";
00027     std::vector<std::string> in ; in.push_back(referenceFileName_);
00028     edm::InputFileCatalog catalog(in,override,true);
00029 
00030     std::string ff=catalog.fileNames()[0];
00031     std::cout << "DQMFileReader: reading reference file '" << ff << "'\n";
00032 
00033     // now open file, quietly continuing if it does not exist
00034     if (dbe_->open(ff, true, "", "Reference", DQMStore::StripRunDirs, false))
00035     {
00036       dbe_->cd(); dbe_->setCurrentFolder("Info/ProvInfo"); 
00037       dbe_->bookString("referenceFileName",ff);
00038       std::cout << "DQMFileReader: reference file '" << ff << "' successfully read in \n";
00039     }
00040     else      
00041     {
00042       dbe_->cd(); dbe_->setCurrentFolder("Info/ProvInfo"); 
00043       dbe_->bookString("referenceFileName","non-existent:"+ff);
00044       std::cout << "DQMFileReader: reference file '" << ff << "' does not exist \n";
00045     }
00046     dbe_->cd();
00047     return;
00048   }  
00049 
00050   dbe_->bookString("referenceFileName","no reference file specified");
00051   dbe_->cd();
00052   
00053   // read in files, stripping off Run Summary and Run <number> folders
00054   
00055   for (unsigned int i=0; i<filenames_.size(); i++)
00056   {
00057     std::cout << "DQMFileReader::beginJob: loading" << filenames_[i] << std::endl;
00058     if (dbe_) 
00059        dbe_->load(filenames_[i]);
00060   }
00061 }
00062 
00063 void 
00064 DQMFileReader::endJob() 
00065 {}
00066 
00067 void
00068 DQMFileReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00069 {}
00070