CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/CondTools/RPC/src/RPCFebmapSH.cc

Go to the documentation of this file.
00001 /*
00002  *  See headers for a description
00003  *
00004  *  \author D. Pagano - Dip. Fis. Nucl. e Teo. & INFN Pavia
00005  */
00006 
00007 #include "CondTools/RPC/interface/RPCFebmapSH.h"
00008 #include "FWCore/ServiceRegistry/interface/Service.h"
00009 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 
00012 #include<iostream>
00013 
00014 popcon::RpcDataFebmap::RpcDataFebmap(const edm::ParameterSet& pset) :
00015   m_name(pset.getUntrackedParameter<std::string>("name","RpcData")),
00016   host(pset.getUntrackedParameter<std::string>("host", "source db host")),
00017   user(pset.getUntrackedParameter<std::string>("user", "source username")),
00018   passw(pset.getUntrackedParameter<std::string>("passw", "source password")),
00019   m_since(pset.getUntrackedParameter<unsigned long long>("since",5)),
00020   m_till(pset.getUntrackedParameter<unsigned long long>("till",0)){
00021 }
00022 
00023 popcon::RpcDataFebmap::~RpcDataFebmap()
00024 {
00025 }
00026 
00027 void popcon::RpcDataFebmap::getNewObjects() {
00028 
00029   std::cout << "------- " << m_name << " - > getNewObjects\n" 
00030             << "got offlineInfo"<< tagInfo().name 
00031             << ", size " << tagInfo().size << ", last object valid since " 
00032             << tagInfo().lastInterval.first << " token "   
00033             << tagInfo().lastPayloadToken << std::endl;
00034 
00035   std::cout << " ------ last entry info regarding the payload (if existing): " 
00036             << logDBEntry().usertext << "last record with the correct tag has been written in the db: "
00037             << logDBEntry().destinationDB << std::endl; 
00038   
00039   //  snc = tagInfo().lastInterval.first;
00040 
00041 
00042    std::cout << std::endl << "=============================================" << std::endl;
00043    std::cout << std::endl << "===================  FEB   ==================" << std::endl;
00044    std::cout << std::endl << "=============================================" << std::endl << std::endl;
00045    snc = m_since;
00046    std::cout << ">> Range mode [" << snc << ", " << m_till << "]" << std::endl;
00047    std::cout << std::endl << "=============================================" << std::endl << std::endl;
00048    
00049 
00050   
00051   RPCFw caen ( host, user, passw );
00052   std::vector<RPCObFebmap::Feb_Item> Febmapcheck;
00053 
00054   Febmapcheck = caen.createFEB(snc, m_till);
00055   Febdata = new RPCObFebmap();
00056   RPCObFebmap::Feb_Item Febfill;
00057   std::vector<RPCObFebmap::Feb_Item>::iterator Febit;
00058   for(Febit = Febmapcheck.begin(); Febit != Febmapcheck.end(); Febit++)
00059     {
00060       Febfill = *(Febit);
00061       Febdata->ObFebMap_rpc.push_back(Febfill);
00062     }
00063   std::cout << " >> Final object size: " << Febdata->ObFebMap_rpc.size() << std::endl;
00064 
00065    if (Febdata->ObFebMap_rpc.size() > 0) {
00066      niov = snc;
00067    } else {
00068      niov = snc;
00069      std::cout << "NO DATA TO BE STORED" << std::endl;
00070    }
00071 
00072 
00073    ::timeval tv;
00074    tv.tv_sec = niov;
00075    tv.tv_usec = 0;
00076    edm::Timestamp tmstamp((unsigned long long)tv.tv_sec*1000000+(unsigned long long)tv.tv_usec);
00077    std::cout << "UNIX time = " << tmstamp.value() << std::endl;
00078 
00079    edm::TimeValue_t daqtime=0LL;
00080    daqtime=tv.tv_sec;
00081    daqtime=(daqtime<<32)+tv.tv_usec;
00082    edm::Timestamp daqstamp(daqtime);
00083    edm::TimeValue_t dtime = daqstamp.value();
00084    std::cout<<"DAQ time = " << dtime <<std::endl;
00085 
00086    niov = dtime;
00087 
00088    std::cout << "===> New IOV: since is = " << niov << std::endl;
00089    m_to_transfer.push_back(std::make_pair((RPCObFebmap*)Febdata,niov));
00090 
00091 }
00092