CMS 3D CMS Logo

RunSummaryHandler.cc

Go to the documentation of this file.
00001 #include "CondTools/RunInfo/interface/RunSummaryHandler.h"
00002 #include "CondTools/RunInfo/interface/RunSummaryRead.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 RunSummaryHandler::RunSummaryHandler(const edm::ParameterSet& pset) :
00020   m_name(pset.getUntrackedParameter<std::string>("name","RunSummaryHandler")),
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 RunSummaryHandler::~RunSummaryHandler()
00032 {
00033  
00034 }
00035 
00036 void RunSummaryHandler::getNewObjects() {
00037    edm::LogInfo   ("RunSummaryHandler") << "------- " << 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    if (tagInfo().size>0) {
00048      Ref payload = lastPayload();
00049      //edm::LogInfo   ("RunSummaryHandler")<<"size of last payload  "<< 
00050       //   payload->..........size()<<std::endl;
00051   }
00052    */   
00053    unsigned int snc;
00054   
00055 
00056   std::cerr << "Source implementation test ::getNewObjects : enter runnumber as a first since !  \n";
00057   std::cin >> snc;
00058 
00059 
00060   std::cout<<"runnumber/first since = "<< snc <<std::endl;
00061   
00062  
00063  
00064  
00065    RunSummary  * r = new RunSummary(); 
00066   
00067   
00068  //fill with null runsummary if empty run are found beetween the two last validones 
00069  
00070  size_t  n_empty_run=0;
00071   if (tagInfo().size>0  && (tagInfo().lastInterval.first+1) < snc){
00072   n_empty_run = snc- tagInfo().lastInterval.first - 1; 
00073     edm::LogInfo   ("RunSummaryHandler") << "------- " << "entering fake run from " << tagInfo().lastInterval.first + 1 <<  "to " << snc -1 << "- > getNewObjects" << std::endl;
00074  n_empty_run = snc- tagInfo().lastInterval.first - 1; 
00075  // for (size_t i=1; i<= n_empty_run ; i++){
00076   
00077  // r->summary.push_back(empty->fake_Run());   
00078  // } 
00079   } 
00080    
00081 
00082    // reading from omds
00083    RunSummaryRead rn( m_connectionString, m_user, m_pass);
00084    //  RunSummary::RunSummary sum;
00085 
00086    // table to be  cms_runinfo.runsession_parameter
00087    //column to be string_value;
00088    // run to be 43623 
00089 
00090 
00091 
00092 //r->summary.push_back(sum);   
00093    // transfer also empty run if tag already existing 
00094    if (n_empty_run!=0) {
00095      m_to_transfer.push_back(std::make_pair((RunSummary*) (r->Fake_RunSummary()),tagInfo().lastInterval.first + 1));
00096    }
00097   
00098   *r = rn.readData("RUNSESSION_PARAMETER", "STRING_VALUE",(int)snc );
00099    m_to_transfer.push_back(std::make_pair((RunSummary*)r,snc));
00100    std::ostringstream ss;
00101    ss << "since =" << snc;
00102     
00103   
00104 
00105   m_userTextLog = ss.str()+";";
00106 
00107 
00108   edm::LogInfo   ("RunSummaryHandler") << "------- " << m_name << " - > getNewObjects" << std::endl;
00109 
00110  
00111 }
00112 }
00113 
00114 
00115 
00116 

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