CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/CondTools/RunInfo/src/L1TriggerScalerHandler.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/L1TriggerScalerHandler.h"
00004 #include "CondTools/RunInfo/interface/L1TriggerScalerRead.h"
00005 #include<iostream>
00006 #include<vector>
00007 
00008 L1TriggerScalerHandler::L1TriggerScalerHandler(const edm::ParameterSet& pset) :
00009   m_name(pset.getUntrackedParameter<std::string>("name","L1TriggerScalerHandler")),
00010   // m_connect(pset.getUntrackedParameter<std::string>("OnlineConn","")),
00011   //m_authpath(pset.getUntrackedParameter<std::string>("OnlineAuthPath",".")),
00012   //m_host(pset.getUntrackedParameter<std::string>("OnlineDBHost","cmsor1-v.cern.ch")),
00013   // m_sid(pset.getUntrackedParameter<std::string>("OnlineDBSID","omds")),
00014   
00015   m_user(pset.getUntrackedParameter<std::string>("OnlineDBUser","CMS_RUNINFO")), 
00016   m_pass(pset.getUntrackedParameter<std::string>("OnlineDBPass","XXXXXXX"))
00017   // m_port(pset.getUntrackedParameter<int>("OnlineDBPort",10121))
00018 {
00019   m_connectionString= "oracle://cms_omds_lb/CMS_RUNINFO";
00020  
00021 }
00022 
00023 L1TriggerScalerHandler::~L1TriggerScalerHandler()
00024 {
00025  
00026 }
00027 
00028 void L1TriggerScalerHandler::getNewObjects() {
00029    edm::LogInfo   ("L1TriggerScalerHandler") << "------- " << m_name 
00030              << " - > getNewObjects\n" << 
00031   //check whats already inside of database
00032       "got offlineInfo"<<
00033     tagInfo().name << ", size " << tagInfo().size 
00034             << ", last object valid since " 
00035             << tagInfo().lastInterval.first << " token "   
00036             << tagInfo().lastPayloadToken << std::endl;
00037   
00038 
00039   if (tagInfo().size>0) {
00040     Ref payload = lastPayload();
00041     edm::LogInfo   ("L1TriggerScalerHandler")<<"size of last payload  "<< 
00042       payload->m_run.size()<<std::endl;
00043   }
00044 
00045   int snc;
00046   
00047   std::cerr << "Source implementation test ::getNewObjects : enter runnumber as a first since !  \n";
00048   std::cin >> snc;
00049 
00050 
00051 
00052 
00053   std::cout<<"runnumber/first since = "<< snc <<std::endl;
00054   
00055  
00057  
00058    L1TriggerScaler  * r = new L1TriggerScaler(); 
00059 
00060    
00061    
00062    // reading from omds
00063    L1TriggerScalerRead rn( m_connectionString, m_user, m_pass);
00064    std::vector<L1TriggerScaler::Lumi> l1lumiscaler_array;
00065 
00066    
00067 
00068  l1lumiscaler_array = rn.readData((int)snc );
00069 
00070   L1TriggerScaler::Lumi rnfill;
00071   std::vector<L1TriggerScaler::Lumi>::iterator Iit;
00072   for(Iit = l1lumiscaler_array.begin() ; Iit != l1lumiscaler_array.end(); Iit++)
00073     {
00074       rnfill = *(Iit);
00075       r->m_run.push_back(rnfill);   
00076     }
00077   
00078    m_to_transfer.push_back(std::make_pair((L1TriggerScaler*)r,snc));
00079    std::ostringstream ss; 
00080    ss << "since =" << snc;
00081     
00082   
00083 
00084   m_userTextLog = ss.str()+";";
00085 
00086 
00087   edm::LogInfo   ("L1TriggerScalerHandler") << "------- " << m_name << " - > getNewObjects" << std::endl;
00088 
00089  
00090 }
00091 
00092 
00093 
00094