#include <CondTools/DT/interface/DTMtimeHandler.h>
Public Member Functions | |
DTMtimeHandler (const edm::ParameterSet &ps) | |
Constructor. | |
void | getNewObjects () |
Operations. | |
std::string | id () const |
virtual | ~DTMtimeHandler () |
Destructor. | |
Private Attributes | |
std::string | dataTag |
std::string | fileName |
unsigned int | runNumber |
Definition at line 35 of file DTMtimeHandler.h.
DTMtimeHandler::DTMtimeHandler | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 34 of file DTMtimeHandler.cc.
00034 : 00035 dataTag( ps.getParameter<std::string> ( "tag" ) ), 00036 fileName( ps.getParameter<std::string> ( "file" ) ), 00037 runNumber( ps.getParameter<unsigned int> ( "run" ) ) { 00038 }
DTMtimeHandler::~DTMtimeHandler | ( | ) | [virtual] |
void DTMtimeHandler::getNewObjects | ( | ) | [virtual] |
Operations.
Implements popcon::PopConSourceHandler< DTMtime >.
Definition at line 49 of file DTMtimeHandler.cc.
References GenMuonPlsPt100GeV_cfg::cout, dataTag, lat::endl(), fileName, indexGen::ifile, prof2calltree::last, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< DTMtime >::m_to_transfer, runNumber, DTMtime::set(), StDecayID::status, popcon::PopConSourceHandler< DTMtime >::tagInfo(), and ti.
00049 { 00050 00051 //to access the information on the tag inside the offline database: 00052 cond::TagInfo const & ti = tagInfo(); 00053 unsigned int last = ti.lastInterval.first; 00054 00055 //to access the information on last successful log entry for this tag: 00056 // cond::LogDBEntry const & lde = logDBEntry(); 00057 00058 //to access the lastest payload (Ref is a smart pointer) 00059 // Ref payload = lastPayload(); 00060 00061 /* 00062 int irun = event.id().run(); 00063 int ievt = event.id().event(); 00064 std::cout << "================ " 00065 << irun << " " << ievt << std::endl; 00066 00067 // edm::Service<cond::service::PoolDBOutputService> dbservice; 00068 00069 std::map<std::string, popcon::PayloadIOV> mp = getOfflineInfo(); 00070 std::map<std::string, popcon::PayloadIOV>::iterator iter = mp.begin(); 00071 std::map<std::string, popcon::PayloadIOV>::iterator iend = mp.end(); 00072 std::cout << "list of all tags: " << std::endl; 00073 while ( iter != iend ) { 00074 std::cout << "Tag: " << iter->first 00075 << " , last object valid since " << iter->second.last_since 00076 << " to " << iter->second.last_till 00077 << std::endl; 00078 iter++; 00079 } 00080 00081 std::cout << "look for tag " << dataTag << std::endl; 00082 std::map<std::string, popcon::PayloadIOV>::iterator itag = 00083 mp.find( dataTag ); 00084 */ 00085 00086 DTMtime* mTime = new DTMtime( dataTag ); 00087 00088 int status = 0; 00089 std::ifstream ifile( fileName.c_str() ); 00090 int whe; 00091 int sta; 00092 int sec; 00093 int qua; 00094 float mti; 00095 float rms; 00096 while ( ifile >> whe 00097 >> sta 00098 >> sec 00099 >> qua 00100 >> mti 00101 >> rms ) { 00102 status = mTime->set( whe, sta, sec, qua, mti, rms ); 00103 std::cout << whe << " " 00104 << sta << " " 00105 << sec << " " 00106 << qua << " " 00107 << mti << " " 00108 << rms << " -> "; 00109 std::cout << "insert status: " << status << std::endl; 00110 } 00111 00112 /* 00113 unsigned int runf = irun; 00114 unsigned int runl = 0xffffffff; 00115 popcon::IOVPair iop = { runf, runl }; 00116 std::cout << "APPEND NEW OBJECT: " 00117 << runf << " " << runl << " " << mTime << std::endl; 00118 m_to_transfer->push_back( std::make_pair( mTime, iop ) ); 00119 */ 00120 00121 //for each payload provide IOV information (say in this case we use since) 00122 cond::Time_t snc = runNumber; 00123 if ( runNumber > last ) 00124 m_to_transfer.push_back( std::make_pair( mTime, snc ) ); 00125 else 00126 std::cout << "More recent data already present - skipped" << std::endl; 00127 00128 return; 00129 00130 }
std::string DTMtimeHandler::id | ( | void | ) | const [virtual] |
Implements popcon::PopConSourceHandler< DTMtime >.
Definition at line 133 of file DTMtimeHandler.cc.
References dataTag.
00133 { 00134 return dataTag; 00135 }
std::string DTMtimeHandler::dataTag [private] |
std::string DTMtimeHandler::fileName [private] |
unsigned int DTMtimeHandler::runNumber [private] |