CMS 3D CMS Logo

RunInfoHandler.cc

Go to the documentation of this file.
00001 #include "CondTools/RunInfo/interface/RunInfoHandler.h"
00002 #include "CondTools/RunInfo/interface/RunInfoRead.h"
00003 
00004 
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 #include "CondTools/RunInfo/interface/TestBase.h"
00009 
00010 
00011 #include<iostream>
00012 #include<sstream>
00013 #include<vector>
00014 
00015 namespace {
00016 
00017 
00018 
00019 RunInfoHandler::RunInfoHandler(const edm::ParameterSet& pset) :
00020   m_name(pset.getUntrackedParameter<std::string>("name","RunInfoHandler")),
00021   // m_connect(pset.getUntrackedParameter<std::string>("OnlineConn","")),
00022  
00023   m_user(pset.getUntrackedParameter<std::string>("OnlineDBUser","CMS_RUNINFO")), 
00024   m_pass(pset.getUntrackedParameter<std::string>("OnlineDBPass","XXXXXXX"))
00025 
00026 {
00027   m_connectionString= "oracle://cms_omds_lb/CMS_RUNINFO";
00028  
00029 }
00030 
00031 RunInfoHandler::~RunInfoHandler()
00032 {
00033  
00034 }
00035 
00036 void RunInfoHandler::getNewObjects() {
00037    edm::LogInfo   ("RunInfoHandler") << "------- " << m_name 
00038              << " - > getNewObjects\n" << 
00039   //check whats already inside of database
00040       "got offlineInfo"<<
00041     tagInfo().name << ", size " << tagInfo().size 
00042             << ", last object valid since " 
00043             << tagInfo().lastInterval.first << " token "   
00044             << tagInfo().lastPayloadToken << std::endl;
00045   
00046 
00047    unsigned int snc;
00048   
00049 
00050   std::cerr << "Source implementation test ::getNewObjects : enter runnumber as a first since !  \n";
00051   std::cin >> snc;
00052 
00053 
00054   std::cout<<"runnumber/first since = "<< snc <<std::endl;
00055   
00056  
00057  
00058  
00059    RunInfo  * r = new RunInfo(); 
00060   
00061   
00062  //fill with null runsummary if empty run are found beetween the two last validones 
00063  
00064  size_t  n_empty_run=0;
00065   if (tagInfo().size>0  && (tagInfo().lastInterval.first+1) < snc){
00066   n_empty_run = snc- tagInfo().lastInterval.first - 1; 
00067     edm::LogInfo   ("RunInfoHandler") << "------- " << "entering fake run from " << tagInfo().lastInterval.first + 1 <<  "to " << snc -1 << "- > getNewObjects" << std::endl;
00068  n_empty_run = snc- tagInfo().lastInterval.first - 1; 
00069 
00070   } 
00071    
00072 
00073    // reading from omds
00074    RunInfoRead rn( m_connectionString, m_user, m_pass);
00075 
00076    if (n_empty_run!=0) {
00077      m_to_transfer.push_back(std::make_pair((RunInfo*) (r->Fake_RunInfo()),tagInfo().lastInterval.first + 1));
00078    }
00079   
00080   *r = rn.readData("RUNSESSION_PARAMETER", "STRING_VALUE",(int)snc );
00081    m_to_transfer.push_back(std::make_pair((RunInfo*)r,snc));
00082    std::ostringstream ss;
00083    ss << "since =" << snc;
00084     
00085   
00086 
00087   m_userTextLog = ss.str()+";";
00088 
00089 
00090   edm::LogInfo   ("RunInfoHandler") << "------- " << m_name << " - > getNewObjects" << std::endl;
00091 
00092  
00093 }
00094 }
00095 
00096 
00097 
00098 

Generated on Tue Jun 9 17:26:57 2009 for CMSSW by  doxygen 1.5.4