CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondTools/RunInfo/src/RunSummaryHandler.cc

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