Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:24

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0003 #include "CondTools/RunInfo/interface/L1TriggerScalerHandler.h"
0004 #include "CondTools/RunInfo/interface/L1TriggerScalerRead.h"
0005 #include <iostream>
0006 #include <vector>
0007 
0008 L1TriggerScalerHandler::L1TriggerScalerHandler(const edm::ParameterSet& pset)
0009     : m_name(pset.getUntrackedParameter<std::string>("name", "L1TriggerScalerHandler")),
0010       // m_connect(pset.getUntrackedParameter<std::string>("OnlineConn","")),
0011       //m_authpath(pset.getUntrackedParameter<std::string>("OnlineAuthPath",".")),
0012       //m_host(pset.getUntrackedParameter<std::string>("OnlineDBHost","cmsor1-v.cern.ch")),
0013       // m_sid(pset.getUntrackedParameter<std::string>("OnlineDBSID","omds")),
0014 
0015       m_user(pset.getUntrackedParameter<std::string>("OnlineDBUser", "CMS_RUNINFO")),
0016       m_pass(pset.getUntrackedParameter<std::string>("OnlineDBPass", "XXXXXXX"))
0017 // m_port(pset.getUntrackedParameter<int>("OnlineDBPort",10121))
0018 {
0019   m_connectionString = "oracle://cms_omds_lb/CMS_RUNINFO";
0020 }
0021 
0022 L1TriggerScalerHandler::~L1TriggerScalerHandler() {}
0023 
0024 void L1TriggerScalerHandler::getNewObjects() {
0025   edm::LogInfo("L1TriggerScalerHandler") << "------- " << m_name << " - > getNewObjects\n"
0026                                          <<
0027       //check whats already inside of database
0028       "got offlineInfo" << tagInfo().name << ", size " << tagInfo().size << ", last object valid since "
0029                                          << tagInfo().lastInterval.since << " token "
0030                                          << tagInfo().lastInterval.payloadId << std::endl;
0031 
0032   if (tagInfo().size > 0) {
0033     Ref payload = lastPayload();
0034     edm::LogInfo("L1TriggerScalerHandler") << "size of last payload  " << payload->m_run.size() << std::endl;
0035   }
0036 
0037   int snc;
0038 
0039   std::cerr << "Source implementation test ::getNewObjects : enter runnumber as a first since !  \n";
0040   std::cin >> snc;
0041 
0042   std::cout << "runnumber/first since = " << snc << std::endl;
0043 
0044   ///... understand how  to know in advise the lumisection_number
0045 
0046   L1TriggerScaler* r = new L1TriggerScaler();
0047 
0048   // reading from omds
0049   L1TriggerScalerRead rn(m_connectionString, m_user, m_pass);
0050   std::vector<L1TriggerScaler::Lumi> l1lumiscaler_array;
0051 
0052   l1lumiscaler_array = rn.readData((int)snc);
0053 
0054   L1TriggerScaler::Lumi rnfill;
0055   std::vector<L1TriggerScaler::Lumi>::iterator Iit;
0056   for (Iit = l1lumiscaler_array.begin(); Iit != l1lumiscaler_array.end(); Iit++) {
0057     rnfill = *(Iit);
0058     r->m_run.push_back(rnfill);
0059   }
0060 
0061   m_to_transfer.push_back(std::make_pair((L1TriggerScaler*)r, snc));
0062   std::ostringstream ss;
0063   ss << "since =" << snc;
0064 
0065   m_userTextLog = ss.str() + ";";
0066 
0067   edm::LogInfo("L1TriggerScalerHandler") << "------- " << m_name << " - > getNewObjects" << std::endl;
0068 }