#include <CondCore/Utilities/interface/CondBasicIter.h>
Public Member Functions | |
CondBasicIter () | |
void | create (const std::string &NameDB, const std::string &File, const std::string &User="", const std::string &Pass="", const std::string &nameBlob="") |
tell Iter to point to a database. | |
unsigned int | getMax () |
Get the maximum of the range of interest of the Iterator of the IOVs. | |
unsigned int | getMin () |
Get the minimum of the range of interest of the Iterator of the IOVs. | |
void | getRange (unsigned int *, unsigned int *) |
Get the minimum and the maximum of the range of interest of the Iterator of the IOVs. | |
unsigned int | getStartTime () |
Get the SINCE TIME of the Interval of Validity. | |
unsigned int | getStopTime () |
Get the TILL TIME of the Interval of Validity. | |
unsigned int | getTime () |
Get the mean time of the Iterval of Validity. | |
void | setMax (int max) |
void | setMax (unsigned int max) |
Set the maximum of the range of interest of the Iterator of the IOVs. | |
void | setMin (int min) |
void | setMin (unsigned int min) |
Set the minimum of the range of interest of the Iterator of the IOVs. | |
void | setRange (int min, int max) |
void | setRange (unsigned int min, unsigned int max) |
Set the range of interest of the Iterator of the IOVs. | |
void | setStartTime (unsigned int start) |
Set the SINCE TIME of the IOV just analized inside the class CondBasicIter. | |
void | setStopTime (unsigned int stop) |
Set the TILL TIME of the IOV just analized inside the class CondBasicIter. | |
void | setTime (unsigned int time) |
Set the avarage time of the IOV just analized inside the class CondBasicIter. | |
~CondBasicIter () | |
Private Attributes | |
cond::IOVIterator * | ioviterator |
unsigned int | iter_Max |
unsigned int | iter_Min |
unsigned int | m_startTime |
unsigned int | m_stopTime |
unsigned int | m_time |
cond::Connection * | myconnection |
std::string | payloadContainer |
cond::PoolTransaction * | pooldb |
Friends | |
class | CondIter |
Definition at line 16 of file CondBasicIter.h.
CondBasicIter::CondBasicIter | ( | ) |
Definition at line 3 of file CondBasicIter.cc.
References ioviterator, myconnection, and pooldb.
00003 { 00004 ioviterator = 0; 00005 pooldb = 0; 00006 myconnection = 0; 00007 }
CondBasicIter::~CondBasicIter | ( | ) |
Definition at line 9 of file CondBasicIter.cc.
References cond::PoolTransaction::commit(), ioviterator, myconnection, and pooldb.
00009 { 00010 if (pooldb) { 00011 pooldb->commit(); 00012 } 00013 if (ioviterator) delete ioviterator; 00014 if (myconnection) delete myconnection; 00015 }
void CondBasicIter::create | ( | const std::string & | NameDB, | |
const std::string & | File, | |||
const std::string & | User = "" , |
|||
const std::string & | Pass = "" , |
|||
const std::string & | nameBlob = "" | |||
) |
tell Iter to point to a database.
After this call Iter can be used. Direct Access to database through frontier It needs:
NameDB
-> name of the database File
-> Tag human-readable of the content of the database User
-> name of the User (if you don't need to authenticate don't write anything here) Pass
-> Password to access database (if you don't need to authenticate don't write anything here) nameBlob
-> to handle blob type of data (if it is not needed this field has to be left empty) Definition at line 30 of file CondBasicIter.cc.
References cond::CoralTransaction::commit(), cond::DBSession::configuration(), cond::Connection::connect(), HLT_VtxMuL3::connect, cond::Connection::coralTransaction(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), cond::Env, cond::Error, cond::MetaData::getToken(), ioviterator, iter_Max, iter_Min, myconnection, cond::IOVService::newIOVIterator(), cond::DBSession::open(), payloadContainer, cond::IOVService::payloadContainerName(), pooldb, cond::Connection::poolTransaction(), python::TagTree::session, cond::SessionConfiguration::setAuthenticationMethod(), cond::SessionConfiguration::setBlobStreamer(), cond::SessionConfiguration::setMessageLevel(), cond::IOVIterator::size(), cond::CoralTransaction::start(), cond::PoolTransaction::start(), ecalRecalibSequence_cff::tag, parsecf::pyparsing::test(), and cmsBenchmark::user.
Referenced by CondIter< T >::create().
00030 { 00031 00032 00033 00034 std::string Command1; 00035 Command1 = NameDB; 00036 //You need to write all the sintax like "oracle://cms_orcoff_int2r/SOMETHING" 00037 std::string Command4 = " -t "; 00038 std::string Command5 = File; 00039 std::string Command6 = " -u " + User; 00040 std::string Command7 = " -p " + Pass; 00041 00042 00043 std::cout << "Instructions " << Command1 << Command4 << Command5 << Command6 << Command7 << std::endl; 00044 std::cout << "Blob name = " << nameBlob << std::endl; 00045 00046 std::string tag; 00047 std::string connect; 00048 std::string user = User; 00049 std::string pass = Pass; 00050 00051 connect=Command1; 00052 00053 tag=Command5; 00054 00055 00056 cond::DBSession* session=new cond::DBSession; 00057 session->configuration().setAuthenticationMethod( cond::Env ); 00058 00059 if (nameBlob.size()) { 00060 session->configuration().setBlobStreamer(nameBlob.c_str()); 00061 } 00062 00063 session->configuration().setMessageLevel( cond::Error ); 00064 //session->configuration().connectionConfiguration()->setConnectionRetrialTimeOut( 600 ); 00065 //session->configuration().connectionConfiguration()->enableConnectionSharing(); 00066 //session->configuration().connectionConfiguration()->enableReadOnlySessionOnUpdateConnections(); 00067 std::string userenv(std::string("CORAL_AUTH_USER=")+user); 00068 std::string passenv(std::string("CORAL_AUTH_PASSWORD=")+pass); 00069 00070 if (!myconnection){ 00071 myconnection = new cond::Connection(connect,5000000); 00072 } 00073 if (!pooldb) { 00074 putenv(const_cast<char*>(userenv.c_str())); 00075 putenv(const_cast<char*>(passenv.c_str())); 00076 } 00077 00078 00079 session->open(); 00080 myconnection->connect(session); 00081 cond::CoralTransaction& coraldb=myconnection->coralTransaction(); 00082 cond::MetaData metadata_svc(coraldb); 00083 std::string token; 00084 coraldb.start(true); 00085 00086 token=metadata_svc.getToken(tag); 00087 coraldb.commit(); 00088 int test = 0; 00089 if (!pooldb) { 00090 pooldb = &(myconnection->poolTransaction()); 00091 test = 1; 00092 } 00093 00094 // timetype irrelevant 00095 cond::IOVService iovservice(*pooldb); 00096 //----------------------------------------- 00097 if (ioviterator) { 00098 delete ioviterator; 00099 ioviterator = 0; 00100 } 00101 //----------------------------------------- 00102 00103 ioviterator=iovservice.newIOVIterator(token); 00104 00105 00106 if (test==1){ 00107 pooldb->start(true); 00108 } 00109 00110 // printing out the iteratot size 00111 std::cout<< " ioviterator->size() == " << ioviterator->size() << std::endl; 00112 payloadContainer=iovservice.payloadContainerName(token); 00113 00114 00115 00116 delete session; 00117 00118 00119 //---- inizializer 00120 iter_Min = 0; 00121 iter_Max = 0; 00122 00123 }
unsigned int CondBasicIter::getMax | ( | ) |
Get the maximum of the range of interest of the Iterator of the IOVs.
Definition at line 176 of file CondBasicIter.cc.
References iter_Max.
Referenced by CondIter< T >::getMax(), CondIter< T >::getRange(), and CondIter< T >::next().
00176 {return iter_Max;}
unsigned int CondBasicIter::getMin | ( | ) |
Get the minimum of the range of interest of the Iterator of the IOVs.
Definition at line 174 of file CondBasicIter.cc.
References iter_Min.
Referenced by CondIter< T >::getMin(), CondIter< T >::getRange(), CondIter< T >::jump(), and CondIter< T >::next().
00174 {return iter_Min;}
unsigned int CondBasicIter::getStartTime | ( | ) |
Get the SINCE TIME of the Interval of Validity.
Definition at line 186 of file CondBasicIter.cc.
References m_startTime.
Referenced by CondIter< T >::getStartTime(), and CondIter< T >::next().
00186 {return m_startTime;}
unsigned int CondBasicIter::getStopTime | ( | ) |
Get the TILL TIME of the Interval of Validity.
Definition at line 188 of file CondBasicIter.cc.
References m_stopTime.
Referenced by CondIter< T >::getStopTime(), and CondIter< T >::next().
00188 {return m_stopTime;}
Get the mean time of the Iterval of Validity.
Definition at line 184 of file CondBasicIter.cc.
References m_time.
Referenced by CondIter< T >::getTime().
00184 {return m_time;}
Definition at line 168 of file CondBasicIter.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), iter_Max, and iter_Min.
00168 { 00169 if (((unsigned int) max)<iter_Min) std::cout << "Not possible: Maximum < Minimum"; 00170 else iter_Max = (unsigned int) max; 00171 std::cout << "min = " << iter_Min << " and max = " << iter_Max<< std::endl; 00172 }
Set the maximum of the range of interest of the Iterator of the IOVs.
Definition at line 141 of file CondBasicIter.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), iter_Max, and iter_Min.
Referenced by CondIter< T >::setMax().
00141 { 00142 if (((unsigned int) max)>=iter_Min) iter_Max = (unsigned int) max; 00143 else std::cout << "Not possible: Maximum < Minimum"; 00144 00145 std::cout << "min = " << iter_Min << " and max = " << iter_Max<< std::endl; 00146 00147 }
Definition at line 162 of file CondBasicIter.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), iter_Max, and iter_Min.
00162 { 00163 if (((unsigned int) min)>iter_Max) std::cout << "Not possible: Minimum > Maximum"; 00164 else iter_Min = (unsigned int) min; 00165 std::cout << "min = " << iter_Min << " and max = " << iter_Max<< std::endl; 00166 }
Set the minimum of the range of interest of the Iterator of the IOVs.
Definition at line 134 of file CondBasicIter.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), iter_Max, and iter_Min.
Referenced by CondIter< T >::setMin().
00134 { 00135 if (((unsigned int) min)>iter_Max) std::cout << "Not possible: Minimum > Maximum"; 00136 else iter_Min = (unsigned int) min; 00137 std::cout << "min = " << iter_Min << " and max = " << iter_Max<< std::endl; 00138 00139 }
Definition at line 149 of file CondBasicIter.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), Exception, int, iter_Max, and iter_Min.
00149 { 00150 try{ 00151 if (min<max) { 00152 iter_Min = (unsigned int) min; 00153 iter_Max = (unsigned int) max; 00154 std::cout << "min = " << iter_Min << " and max = " << iter_Max << std::endl; 00155 } 00156 else throw 1; 00157 }catch(int) { 00158 throw cond::Exception("Not possible: Minimum > Maximum"); 00159 } 00160 }
Set the range of interest of the Iterator of the IOVs.
Definition at line 125 of file CondBasicIter.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), int, iter_Max, and iter_Min.
Referenced by CondIter< T >::setRange().
00125 { 00126 if (min<max) { 00127 iter_Min = (unsigned int) min; 00128 iter_Max = (unsigned int) max; 00129 std::cout << "min = " << iter_Min << " and max = " << iter_Max << std::endl; 00130 } 00131 else std::cout << "Not possible: Minimum > Maximum" <<std::endl; 00132 }
Set the SINCE TIME of the IOV just analized inside the class CondBasicIter.
Definition at line 17 of file CondBasicIter.cc.
References m_startTime.
Referenced by CondIter< T >::next().
00017 { 00018 m_startTime = start; 00019 }
Set the TILL TIME of the IOV just analized inside the class CondBasicIter.
Definition at line 21 of file CondBasicIter.cc.
References m_stopTime.
Referenced by CondIter< T >::next().
00021 { 00022 m_stopTime = stop; 00023 }
Set the avarage time of the IOV just analized inside the class CondBasicIter.
Definition at line 25 of file CondBasicIter.cc.
References m_time.
Referenced by CondIter< T >::next().
00025 { 00026 m_time = time; 00027 }
friend class CondIter [friend] |
Definition at line 39 of file CondBasicIter.h.
cond::IOVIterator* CondBasicIter::ioviterator [private] |
Definition at line 20 of file CondBasicIter.h.
Referenced by CondBasicIter(), create(), CondIter< T >::jump(), CondIter< T >::next(), and ~CondBasicIter().
unsigned int CondBasicIter::iter_Max [private] |
Definition at line 26 of file CondBasicIter.h.
Referenced by create(), getMax(), getRange(), CondIter< T >::next(), setMax(), setMin(), and setRange().
unsigned int CondBasicIter::iter_Min [private] |
Definition at line 25 of file CondBasicIter.h.
Referenced by create(), getMin(), getRange(), CondIter< T >::next(), setMax(), setMin(), and setRange().
unsigned int CondBasicIter::m_startTime [private] |
unsigned int CondBasicIter::m_stopTime [private] |
unsigned int CondBasicIter::m_time [private] |
cond::Connection* CondBasicIter::myconnection [private] |
Definition at line 23 of file CondBasicIter.h.
Referenced by CondBasicIter(), create(), and ~CondBasicIter().
std::string CondBasicIter::payloadContainer [private] |
cond::PoolTransaction* CondBasicIter::pooldb [private] |
Definition at line 22 of file CondBasicIter.h.
Referenced by CondBasicIter(), create(), CondIter< T >::next(), and ~CondBasicIter().