CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
RPCFw Class Reference

#include <RPCFw.h>

Inheritance diagram for RPCFw:
RPCDBCom

Public Member Functions

std::vector
< RPCObFebmap::Feb_Item
createFEB (long long since, long long till)
 
std::vector< RPCObGas::ItemcreateGAS (long long since, long long till)
 
std::vector< RPCObPVSSmap::ItemcreateIDMAP ()
 
std::vector< RPCObImon::I_ItemcreateIMON (long long since, long long till)
 
std::vector< RPCObGasMix::ItemcreateMix (long long since, long long till)
 
std::vector< RPCObStatus::S_ItemcreateSTATUS (long long since, long long till)
 
std::vector< RPCObTemp::T_ItemcreateT (long long since, long long till)
 
std::vector< RPCObUXC::ItemcreateUXC (long long since, long long till)
 
std::vector< RPCObVmon::V_ItemcreateVMON (long long from, long long till)
 
bool isMajor (const coral::TimeStamp &fir, const coral::TimeStamp &sec)
 
 RPCFw (const std::string &connectionString, const std::string &userName, const std::string &password)
 
void run ()
 
unsigned long long TtoUT (const coral::TimeStamp &time)
 
coral::TimeStamp UTtoT (long long utime)
 
virtual ~RPCFw ()
 
- Public Member Functions inherited from RPCDBCom
 RPCDBCom ()
 
void setVerbosityLevel (coral::MsgLevel level)
 
virtual ~RPCDBCom ()
 

Public Attributes

unsigned long long N_IOV
 
coral::TimeStamp tMAX
 
coral::TimeStamp tMIN
 

Private Attributes

std::string m_connectionString
 
std::string m_password
 
std::string m_userName
 

Additional Inherited Members

- Protected Member Functions inherited from RPCDBCom
coral::ISession * connect (const std::string &connectionString, const std::string &userName, const std::string &password)
 

Detailed Description

Definition at line 32 of file RPCFw.h.

Constructor & Destructor Documentation

RPCFw::RPCFw ( const std::string &  connectionString,
const std::string &  userName,
const std::string &  password 
)

Definition at line 30 of file RPCFw.cc.

32  :
33  RPCDBCom(),
34  m_connectionString( connectionString ),
35  m_userName( userName ),
36  m_password( password )
37 {}
std::string m_userName
Definition: RPCFw.h:61
std::string m_password
Definition: RPCFw.h:62
std::string m_connectionString
Definition: RPCFw.h:60
RPCDBCom()
Definition: RPCDBCom.cc:8
RPCFw::~RPCFw ( )
virtual

Definition at line 40 of file RPCFw.cc.

41 {}

Member Function Documentation

std::vector< RPCObFebmap::Feb_Item > RPCFw::createFEB ( long long  since,
long long  till 
)

Definition at line 634 of file RPCFw.cc.

References RPCDBCom::connect(), gather_cfg::cout, RPCObFebmap::Feb_Item::day, RPCObFebmap::Feb_Item::dpid, m_connectionString, m_password, m_userName, RPCObFebmap::Feb_Item::noise1, RPCObFebmap::Feb_Item::noise2, RPCObFebmap::Feb_Item::noise3, RPCObFebmap::Feb_Item::noise4, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, RPCObFebmap::Feb_Item::temp1, RPCObFebmap::Feb_Item::temp2, RPCObFebmap::Feb_Item::thr1, RPCObFebmap::Feb_Item::thr2, RPCObFebmap::Feb_Item::thr3, RPCObFebmap::Feb_Item::thr4, RPCObFebmap::Feb_Item::time, tMAX, tMIN, UTtoT(), RPCObFebmap::Feb_Item::vmon1, RPCObFebmap::Feb_Item::vmon2, RPCObFebmap::Feb_Item::vmon3, and RPCObFebmap::Feb_Item::vmon4.

Referenced by popcon::RpcDataFebmap::getNewObjects().

635 {
636  tMIN = UTtoT(since);
637  std::cout <<">> Processing since: "<<tMIN.day()<<"/"<<tMIN.month()<<"/"<<tMIN.year()<<" "<<tMIN.hour()<<":"<<tMIN.minute()<<"."<<tMIN.second()<< std::endl;
638 
639  coral::ISession* session = this->connect( m_connectionString,
641  session->transaction().start( true );
642  coral::ISchema& schema = session->nominalSchema();
643  std::cout << ">> creating FEB object..." << std::endl;
644 
645  // VTH1
646  coral::IQuery* queryFVTH1 = schema.newQuery();
647  queryFVTH1->addToTableList( "RPCFEB");
648  queryFVTH1->addToOutputList( "RPCFEB.DPID", "DPID" );
649  queryFVTH1->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
650  queryFVTH1->addToOutputList( "RPCFEB.VTH1", "VTH1" );
651 
652  // VTH2
653  coral::IQuery* queryFVTH2 = schema.newQuery();
654  queryFVTH2->addToTableList( "RPCFEB");
655  queryFVTH2->addToOutputList( "RPCFEB.DPID", "DPID" );
656  queryFVTH2->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
657  queryFVTH2->addToOutputList( "RPCFEB.VTH2", "VTH2" );
658 
659  // VTH3
660  coral::IQuery* queryFVTH3 = schema.newQuery();
661  queryFVTH3->addToTableList( "RPCFEB");
662  queryFVTH3->addToOutputList( "RPCFEB.DPID", "DPID" );
663  queryFVTH3->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
664  queryFVTH3->addToOutputList( "RPCFEB.VTH3", "VTH3" );
665 
666  // VTH4
667  coral::IQuery* queryFVTH4 = schema.newQuery();
668  queryFVTH4->addToTableList( "RPCFEB");
669  queryFVTH4->addToOutputList( "RPCFEB.DPID", "DPID" );
670  queryFVTH4->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
671  queryFVTH4->addToOutputList( "RPCFEB.VTH4", "VTH4" );
672 
673  // VMON1
674  coral::IQuery* queryFVMON1 = schema.newQuery();
675  queryFVMON1->addToTableList( "RPCFEB");
676  queryFVMON1->addToOutputList( "RPCFEB.DPID", "DPID" );
677  queryFVMON1->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
678  queryFVMON1->addToOutputList( "RPCFEB.VMON1", "VMON1" );
679 
680  // VMON2
681  coral::IQuery* queryFVMON2 = schema.newQuery();
682  queryFVMON2->addToTableList( "RPCFEB");
683  queryFVMON2->addToOutputList( "RPCFEB.DPID", "DPID" );
684  queryFVMON2->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
685  queryFVMON2->addToOutputList( "RPCFEB.VMON2", "VMON2" );
686 
687  // VMON3
688  coral::IQuery* queryFVMON3 = schema.newQuery();
689  queryFVMON3->addToTableList( "RPCFEB");
690  queryFVMON3->addToOutputList( "RPCFEB.DPID", "DPID" );
691  queryFVMON3->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
692  queryFVMON3->addToOutputList( "RPCFEB.VMON3", "VMON3" );
693 
694  // VMON4
695  coral::IQuery* queryFVMON4 = schema.newQuery();
696  queryFVMON4->addToTableList( "RPCFEB");
697  queryFVMON4->addToOutputList( "RPCFEB.DPID", "DPID" );
698  queryFVMON4->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
699  queryFVMON4->addToOutputList( "RPCFEB.VMON4", "VMON4" );
700 
701  // TEMP1
702  coral::IQuery* queryFTEMP1 = schema.newQuery();
703  queryFTEMP1->addToTableList( "RPCFEB");
704  queryFTEMP1->addToOutputList( "RPCFEB.DPID", "DPID" );
705  queryFTEMP1->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
706  queryFTEMP1->addToOutputList( "RPCFEB.TEMPERATURE1", "TEMP1" );
707 
708  // TEMP2
709  coral::IQuery* queryFTEMP2 = schema.newQuery();
710  queryFTEMP2->addToTableList( "RPCFEB");
711  queryFTEMP2->addToOutputList( "RPCFEB.DPID", "DPID" );
712  queryFTEMP2->addToOutputList( "RPCFEB.CHANGE_DATE", "TSTAMP" );
713  queryFTEMP2->addToOutputList( "RPCFEB.TEMPERATURE2", "TEMP2" );
714 
715  RPCObFebmap::Feb_Item Itemp;
716  std::vector<RPCObFebmap::Feb_Item> febarray;
717  coral::TimeStamp tlast = tMIN;
718  if (till > since) {
719  tMAX = UTtoT(till);
720  std::cout <<">> Processing till: "<<tMAX.day()<<"/"<<tMAX.month()<<"/"<<tMAX.year()<<" "<<tMAX.hour()<<":"<<tMAX.minute()<<"."<<tMAX.second()<< std::endl;
721  std::cout << "Processing VTH1..." << std::endl;
722  coral::AttributeList conditionData;
723  conditionData.extend<coral::TimeStamp>( "tmin" );
724  conditionData.extend<coral::TimeStamp>( "tmax" );
725  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
726  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
727  std::string conditionVTH1 = "RPCFEB.VTH1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
728  queryFVTH1->setCondition( conditionVTH1, conditionData );
729  coral::ICursor& cursorFVTH1 = queryFVTH1->execute();
730  while ( cursorFVTH1.next() ) {
731  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
732  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
733  const coral::AttributeList& row = cursorFVTH1.currentRow();
734  float idoub = row["DPID"].data<float>();
735  int id = static_cast<int>(idoub);
736  float vth1 = row["VTH1"].data<float>();
737  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
738  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
739  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
740  Itemp.dpid = id;
741  Itemp.thr1 = vth1;
742  Itemp.day = ndate;
743  Itemp.time = ntime;
744  febarray.push_back(Itemp);
745  }
746  }else {
747  std::cout << ">> Processing VTH1..." << std::endl;
748  coral::AttributeList conditionData;
749  conditionData.extend<coral::TimeStamp>( "tmin" );
750  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
751  std::string conditionVTH1 = "RPCFEB.VTH1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
752  queryFVTH1->setCondition( conditionVTH1, conditionData );
753  coral::ICursor& cursorFVTH1 = queryFVTH1->execute();
754  while ( cursorFVTH1.next() ) {
755  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
756  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
757  const coral::AttributeList& row = cursorFVTH1.currentRow();
758  float idoub = row["DPID"].data<float>();
759  int id = static_cast<int>(idoub);
760  float vth1 = row["VTH1"].data<float>();
761  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
762  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
763  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
764  Itemp.dpid = id;
765  Itemp.thr1 = vth1;
766  Itemp.day = ndate;
767  Itemp.time = ntime;
768  febarray.push_back(Itemp);
769  }
770  }
771 
772  if (till > since) {
773  tMAX = UTtoT(till);
774  std::cout << "Processing VTH2..." << std::endl;
775  coral::AttributeList conditionData;
776  conditionData.extend<coral::TimeStamp>( "tmin" );
777  conditionData.extend<coral::TimeStamp>( "tmax" );
778  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
779  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
780  std::string conditionVTH2 = "RPCFEB.VTH2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
781  queryFVTH2->setCondition( conditionVTH2, conditionData );
782  coral::ICursor& cursorFVTH2 = queryFVTH2->execute();
783  while ( cursorFVTH2.next() ) {
784  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
785  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
786  const coral::AttributeList& row = cursorFVTH2.currentRow();
787  float idoub = row["DPID"].data<float>();
788  int id = static_cast<int>(idoub);
789  float vth2 = row["VTH2"].data<float>();
790  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
791  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
792  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
793  Itemp.dpid = id;
794  Itemp.thr2 = vth2;
795  Itemp.day = ndate;
796  Itemp.time = ntime;
797  febarray.push_back(Itemp);
798  }
799  } else {
800  std::cout << ">> Processing VTH2..." << std::endl;
801  coral::AttributeList conditionData;
802  conditionData.extend<coral::TimeStamp>( "tmin" );
803  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
804  std::string conditionVTH2 = "RPCFEB.VTH2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
805  queryFVTH2->setCondition( conditionVTH2, conditionData );
806  coral::ICursor& cursorFVTH2 = queryFVTH2->execute();
807  while ( cursorFVTH2.next() ) {
808  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
809  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
810  const coral::AttributeList& row = cursorFVTH2.currentRow();
811  float idoub = row["DPID"].data<float>();
812  int id = static_cast<int>(idoub);
813  float vth2 = row["VTH2"].data<float>();
814  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
815  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
816  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
817  Itemp.dpid = id;
818  Itemp.thr2 = vth2;
819  Itemp.day = ndate;
820  Itemp.time = ntime;
821  febarray.push_back(Itemp);
822  }
823  }
824 
825 
826  if (till > since) {
827  tMAX = UTtoT(till);
828  std::cout << "Processing VTH3..." << std::endl;
829  coral::AttributeList conditionData;
830  conditionData.extend<coral::TimeStamp>( "tmin" );
831  conditionData.extend<coral::TimeStamp>( "tmax" );
832  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
833  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
834  std::string conditionVTH3 = "RPCFEB.VTH3 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
835  queryFVTH3->setCondition( conditionVTH3, conditionData );
836  coral::ICursor& cursorFVTH3 = queryFVTH3->execute();
837  while ( cursorFVTH3.next() ) {
838  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
839  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
840  const coral::AttributeList& row = cursorFVTH3.currentRow();
841  float idoub = row["DPID"].data<float>();
842  int id = static_cast<int>(idoub);
843  float vth3 = row["VTH3"].data<float>();
844  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
845  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
846  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
847  Itemp.dpid = id;
848  Itemp.thr3 = vth3;
849  Itemp.day = ndate;
850  Itemp.time = ntime;
851  febarray.push_back(Itemp);
852  }
853  } else {
854  std::cout << ">> Processing VTH3..." << std::endl;
855  coral::AttributeList conditionData;
856  conditionData.extend<coral::TimeStamp>( "tmin" );
857  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
858  std::string conditionVTH3 = "RPCFEB.VTH3 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
859  queryFVTH3->setCondition( conditionVTH3, conditionData );
860  coral::ICursor& cursorFVTH3 = queryFVTH3->execute();
861  while ( cursorFVTH3.next() ) {
862  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
863  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
864  const coral::AttributeList& row = cursorFVTH3.currentRow();
865  float idoub = row["DPID"].data<float>();
866  int id = static_cast<int>(idoub);
867  float vth3 = row["VTH3"].data<float>();
868  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
869  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
870  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
871  Itemp.dpid = id;
872  Itemp.thr3 = vth3;
873  Itemp.day = ndate;
874  Itemp.time = ntime;
875  febarray.push_back(Itemp);
876  }
877  }
878 
879 
880  if (till > since) {
881  tMAX = UTtoT(till);
882  std::cout << "Processing VTH4..." << std::endl;
883  coral::AttributeList conditionData;
884  conditionData.extend<coral::TimeStamp>( "tmin" );
885  conditionData.extend<coral::TimeStamp>( "tmax" );
886  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
887  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
888  std::string conditionVTH4 = "RPCFEB.VTH4 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
889  queryFVTH4->setCondition( conditionVTH4, conditionData );
890  coral::ICursor& cursorFVTH4 = queryFVTH4->execute();
891  while ( cursorFVTH4.next() ) {
892  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
893  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
894  const coral::AttributeList& row = cursorFVTH4.currentRow();
895  float idoub = row["DPID"].data<float>();
896  int id = static_cast<int>(idoub);
897  float vth4 = row["VTH4"].data<float>();
898  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
899  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
900  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
901  Itemp.dpid = id;
902  Itemp.thr4 = vth4;
903  Itemp.day = ndate;
904  Itemp.time = ntime;
905  febarray.push_back(Itemp);
906  }
907  } else {
908  std::cout << ">> Processing VTH4..." << std::endl;
909  coral::AttributeList conditionData;
910  conditionData.extend<coral::TimeStamp>( "tmin" );
911  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
912  std::string conditionVTH4 = "RPCFEB.VTH4 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
913  queryFVTH4->setCondition( conditionVTH4, conditionData );
914  coral::ICursor& cursorFVTH4 = queryFVTH4->execute();
915  while ( cursorFVTH4.next() ) {
916  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
917  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
918  const coral::AttributeList& row = cursorFVTH4.currentRow();
919  float idoub = row["DPID"].data<float>();
920  int id = static_cast<int>(idoub);
921  float vth4 = row["VTH4"].data<float>();
922  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
923  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
924  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
925  Itemp.dpid = id;
926  Itemp.thr4 = vth4;
927  Itemp.day = ndate;
928  Itemp.time = ntime;
929  febarray.push_back(Itemp);
930  }
931  }
932 
933  if (till > since) {
934  tMAX = UTtoT(till);
935  std::cout << "Processing VMON1..." << std::endl;
936  coral::AttributeList conditionData;
937  conditionData.extend<coral::TimeStamp>( "tmin" );
938  conditionData.extend<coral::TimeStamp>( "tmax" );
939  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
940  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
941  std::string conditionVMON1 = "RPCFEB.VMON1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
942  queryFVMON1->setCondition( conditionVMON1, conditionData );
943  coral::ICursor& cursorFVMON1 = queryFVMON1->execute();
944  while ( cursorFVMON1.next() ) {
945  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
946  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
947  const coral::AttributeList& row = cursorFVMON1.currentRow();
948  float idoub = row["DPID"].data<float>();
949  int id = static_cast<int>(idoub);
950  float vmon1 = row["VMON1"].data<float>();
951  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
952  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
953  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
954  Itemp.dpid = id;
955  Itemp.vmon1 = vmon1;
956  Itemp.day = ndate;
957  Itemp.time = ntime;
958  febarray.push_back(Itemp);
959  }
960  } else {
961  std::cout << ">> Processing VMON1..." << std::endl;
962  coral::AttributeList conditionData;
963  conditionData.extend<coral::TimeStamp>( "tmin" );
964  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
965  std::string conditionVMON1 = "RPCFEB.VMON1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
966  queryFVMON1->setCondition( conditionVMON1, conditionData );
967  coral::ICursor& cursorFVMON1 = queryFVMON1->execute();
968  while ( cursorFVMON1.next() ) {
969  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
970  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
971  const coral::AttributeList& row = cursorFVMON1.currentRow();
972  float idoub = row["DPID"].data<float>();
973  int id = static_cast<int>(idoub);
974  float vmon1 = row["VMON1"].data<float>();
975  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
976  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
977  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
978  Itemp.dpid = id;
979  Itemp.vmon1 = vmon1;
980  Itemp.day = ndate;
981  Itemp.time = ntime;
982  febarray.push_back(Itemp);
983  }
984  }
985 
986 
987 
988  if (till > since) {
989  tMAX = UTtoT(till);
990  std::cout << "Processing VMON2..." << std::endl;
991  coral::AttributeList conditionData;
992  conditionData.extend<coral::TimeStamp>( "tmin" );
993  conditionData.extend<coral::TimeStamp>( "tmax" );
994  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
995  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
996  std::string conditionVMON2 = "RPCFEB.VMON2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
997  queryFVMON2->setCondition( conditionVMON2, conditionData );
998  coral::ICursor& cursorFVMON2 = queryFVMON2->execute();
999  while ( cursorFVMON2.next() ) {
1000  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1001  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1002  const coral::AttributeList& row = cursorFVMON2.currentRow();
1003  float idoub = row["DPID"].data<float>();
1004  int id = static_cast<int>(idoub);
1005  float vmon2 = row["VMON2"].data<float>();
1006  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1007  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1008  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1009  Itemp.dpid = id;
1010  Itemp.vmon2 = vmon2;
1011  Itemp.day = ndate;
1012  Itemp.time = ntime;
1013  febarray.push_back(Itemp);
1014  }
1015  } else {
1016  std::cout << ">> Processing VMON2..." << std::endl;
1017  coral::AttributeList conditionData;
1018  conditionData.extend<coral::TimeStamp>( "tmin" );
1019  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1020  std::string conditionVMON2 = "RPCFEB.VMON2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1021  queryFVMON2->setCondition( conditionVMON2, conditionData );
1022  coral::ICursor& cursorFVMON2 = queryFVMON2->execute();
1023  while ( cursorFVMON2.next() ) {
1024  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1025  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1026  const coral::AttributeList& row = cursorFVMON2.currentRow();
1027  float idoub = row["DPID"].data<float>();
1028  int id = static_cast<int>(idoub);
1029  float vmon2 = row["VMON2"].data<float>();
1030  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1031  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1032  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1033  Itemp.dpid = id;
1034  Itemp.vmon2 = vmon2;
1035  Itemp.day = ndate;
1036  Itemp.time = ntime;
1037  febarray.push_back(Itemp);
1038  }
1039  }
1040 
1041 
1042  if (till > since) {
1043  tMAX = UTtoT(till);
1044  std::cout << "Processing VMON3..." << std::endl;
1045  coral::AttributeList conditionData;
1046  conditionData.extend<coral::TimeStamp>( "tmin" );
1047  conditionData.extend<coral::TimeStamp>( "tmax" );
1048  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1049  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1050  std::string conditionVMON3 = "RPCFEB.VMON3 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1051  queryFVMON3->setCondition( conditionVMON3, conditionData );
1052  coral::ICursor& cursorFVMON3 = queryFVMON3->execute();
1053  while ( cursorFVMON3.next() ) {
1054  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1055  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1056  const coral::AttributeList& row = cursorFVMON3.currentRow();
1057  float idoub = row["DPID"].data<float>();
1058  int id = static_cast<int>(idoub);
1059  float vmon3 = row["VMON3"].data<float>();
1060  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1061  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1062  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1063  Itemp.dpid = id;
1064  Itemp.vmon3 = vmon3;
1065  Itemp.day = ndate;
1066  Itemp.time = ntime;
1067  febarray.push_back(Itemp);
1068  }
1069  } else {
1070  std::cout << ">> Processing VMON3..." << std::endl;
1071  coral::AttributeList conditionData;
1072  conditionData.extend<coral::TimeStamp>( "tmin" );
1073  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1074  std::string conditionVMON3 = "RPCFEB.VMON3 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1075  queryFVMON3->setCondition( conditionVMON3, conditionData );
1076  coral::ICursor& cursorFVMON3 = queryFVMON3->execute();
1077  while ( cursorFVMON3.next() ) {
1078  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1079  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1080  const coral::AttributeList& row = cursorFVMON3.currentRow();
1081  float idoub = row["DPID"].data<float>();
1082  int id = static_cast<int>(idoub);
1083  float vmon3 = row["VMON3"].data<float>();
1084  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1085  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1086  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1087  Itemp.dpid = id;
1088  Itemp.vmon3 = vmon3;
1089  Itemp.day = ndate;
1090  Itemp.time = ntime;
1091  febarray.push_back(Itemp);
1092  }
1093  }
1094 
1095 
1096  if (till > since) {
1097  tMAX = UTtoT(till);
1098  std::cout << "Processing VMON4..." << std::endl;
1099  coral::AttributeList conditionData;
1100  conditionData.extend<coral::TimeStamp>( "tmin" );
1101  conditionData.extend<coral::TimeStamp>( "tmax" );
1102  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1103  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1104  std::string conditionVMON4 = "RPCFEB.VMON4 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1105  queryFVMON4->setCondition( conditionVMON4, conditionData );
1106  coral::ICursor& cursorFVMON4 = queryFVMON4->execute();
1107  while ( cursorFVMON4.next() ) {
1108  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1109  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1110  const coral::AttributeList& row = cursorFVMON4.currentRow();
1111  float idoub = row["DPID"].data<float>();
1112  int id = static_cast<int>(idoub);
1113  float vmon4 = row["VMON4"].data<float>();
1114  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1115  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1116  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1117  Itemp.dpid = id;
1118  Itemp.vmon4 = vmon4;
1119  Itemp.day = ndate;
1120  Itemp.time = ntime;
1121  febarray.push_back(Itemp);
1122  }
1123  } else {
1124  std::cout << ">> Processing VMON4..." << std::endl;
1125  coral::AttributeList conditionData;
1126  conditionData.extend<coral::TimeStamp>( "tmin" );
1127  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1128  std::string conditionVMON4 = "RPCFEB.VMON4 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1129  queryFVMON4->setCondition( conditionVMON4, conditionData );
1130  coral::ICursor& cursorFVMON4 = queryFVMON4->execute();
1131  while ( cursorFVMON4.next() ) {
1132  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1133  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1134  const coral::AttributeList& row = cursorFVMON4.currentRow();
1135  float idoub = row["DPID"].data<float>();
1136  int id = static_cast<int>(idoub);
1137  float vmon4 = row["VMON4"].data<float>();
1138  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1139  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1140  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1141  Itemp.dpid = id;
1142  Itemp.vmon4 = vmon4;
1143  Itemp.day = ndate;
1144  Itemp.time = ntime;
1145  febarray.push_back(Itemp);
1146  }
1147  }
1148 
1149 
1150  if (till > since) {
1151  tMAX = UTtoT(till);
1152  std::cout << "Processing TEMP1..." << std::endl;
1153  coral::AttributeList conditionData;
1154  conditionData.extend<coral::TimeStamp>( "tmin" );
1155  conditionData.extend<coral::TimeStamp>( "tmax" );
1156  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1157  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1158  std::string conditionTEMP1 = "RPCFEB.TEMPERATURE1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1159  queryFTEMP1->setCondition( conditionTEMP1, conditionData );
1160  coral::ICursor& cursorFTEMP1 = queryFTEMP1->execute();
1161  while ( cursorFTEMP1.next() ) {
1162  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1163  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1164  const coral::AttributeList& row = cursorFTEMP1.currentRow();
1165  float idoub = row["DPID"].data<float>();
1166  int id = static_cast<int>(idoub);
1167  float temp1 = row["TEMP1"].data<float>();
1168  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1169  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1170  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1171  Itemp.dpid = id;
1172  Itemp.temp1 = temp1;
1173  Itemp.day = ndate;
1174  Itemp.time = ntime;
1175  febarray.push_back(Itemp);
1176  }
1177  } else {
1178  std::cout << ">> Processing TEMP1..." << std::endl;
1179  coral::AttributeList conditionData;
1180  conditionData.extend<coral::TimeStamp>( "tmin" );
1181  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1182  std::string conditionTEMP1 = "RPCFEB.TEMPERATURE1 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1183  queryFTEMP1->setCondition( conditionTEMP1, conditionData );
1184  coral::ICursor& cursorFTEMP1 = queryFTEMP1->execute();
1185  while ( cursorFTEMP1.next() ) {
1186  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1187  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1188  const coral::AttributeList& row = cursorFTEMP1.currentRow();
1189  float idoub = row["DPID"].data<float>();
1190  int id = static_cast<int>(idoub);
1191  float temp1 = row["TEMP1"].data<float>();
1192  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1193  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1194  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1195  Itemp.dpid = id;
1196  Itemp.temp1 = temp1;
1197  Itemp.day = ndate;
1198  Itemp.time = ntime;
1199  febarray.push_back(Itemp);
1200  }
1201  }
1202 
1203 
1204  if (till > since) {
1205  tMAX = UTtoT(till);
1206  std::cout << "Processing TEMP2..." << std::endl;
1207  coral::AttributeList conditionData;
1208  conditionData.extend<coral::TimeStamp>( "tmin" );
1209  conditionData.extend<coral::TimeStamp>( "tmax" );
1210  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1211  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1212  std::string conditionTEMP2 = "RPCFEB.TEMPERATURE2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin AND RPCFEB.CHANGE_DATE <:tmax";
1213  queryFTEMP2->setCondition( conditionTEMP2, conditionData );
1214  coral::ICursor& cursorFTEMP2 = queryFTEMP2->execute();
1215  while ( cursorFTEMP2.next() ) {
1216  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1217  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1218  const coral::AttributeList& row = cursorFTEMP2.currentRow();
1219  float idoub = row["DPID"].data<float>();
1220  int id = static_cast<int>(idoub);
1221  float temp2 = row["TEMP2"].data<float>();
1222  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1223  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1224  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1225  Itemp.dpid = id;
1226  Itemp.temp2 = temp2;
1227  Itemp.day = ndate;
1228  Itemp.time = ntime;
1229  febarray.push_back(Itemp);
1230  }
1231  } else {
1232  std::cout << ">> Processing TEMP2..." << std::endl;
1233  coral::AttributeList conditionData;
1234  conditionData.extend<coral::TimeStamp>( "tmin" );
1235  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1236  std::string conditionTEMP2 = "RPCFEB.TEMPERATURE2 IS NOT NULL AND RPCFEB.CHANGE_DATE >:tmin";
1237  queryFTEMP2->setCondition( conditionTEMP2, conditionData );
1238  coral::ICursor& cursorFTEMP2 = queryFTEMP2->execute();
1239  while ( cursorFTEMP2.next() ) {
1240  Itemp.thr1=0;Itemp.thr2=0;Itemp.thr3=0;Itemp.thr4=0;Itemp.vmon1=0;Itemp.vmon2=0;Itemp.vmon3=0;
1241  Itemp.vmon4=0;Itemp.temp1=0;Itemp.temp2=0;Itemp.noise1=0;Itemp.noise2=0;Itemp.noise3=0;Itemp.noise4=0;
1242  const coral::AttributeList& row = cursorFTEMP2.currentRow();
1243  float idoub = row["DPID"].data<float>();
1244  int id = static_cast<int>(idoub);
1245  float temp2 = row["TEMP2"].data<float>();
1246  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1247  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
1248  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
1249  Itemp.dpid = id;
1250  Itemp.temp2 = temp2;
1251  Itemp.day = ndate;
1252  Itemp.time = ntime;
1253  febarray.push_back(Itemp);
1254  }
1255  }
1256 
1257  std::cout << ">> FEB array --> size: " << febarray.size() << " >> done." << std::endl;
1258  delete queryFVTH1;
1259  delete queryFVTH2;
1260  delete queryFVTH3;
1261  delete queryFVTH4;
1262  delete queryFTEMP1;
1263  session->transaction().commit();
1264  delete session;
1265  return febarray;
1266 }
std::string m_userName
Definition: RPCFw.h:61
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
coral::TimeStamp tMAX
Definition: RPCFw.h:45
std::string m_password
Definition: RPCFw.h:62
coral::ISession * connect(const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: RPCDBCom.cc:27
tuple cout
Definition: gather_cfg.py:121
std::string m_connectionString
Definition: RPCFw.h:60
coral::TimeStamp tMIN
Definition: RPCFw.h:44
std::vector< RPCObGas::Item > RPCFw::createGAS ( long long  since,
long long  till 
)

Definition at line 297 of file RPCFw.cc.

References RPCDBCom::connect(), gather_cfg::cout, RPCObGas::Item::day, RPCObGas::Item::dpid, RPCObGas::Item::flowin, RPCObGas::Item::flowout, m_connectionString, m_password, m_userName, N_IOV, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, RPCObGas::Item::time, tMAX, tMIN, TtoUT(), and UTtoT().

Referenced by popcon::RpcObGasData::getNewObjects().

298 {
299  tMIN = UTtoT(since);
300  std::cout <<">> Processing since: "<<tMIN.day()<<"/"<<tMIN.month()<<"/"<<tMIN.year()<<" "<<tMIN.hour()<<":"<<tMIN.minute()<<"."<<tMIN.second()<< std::endl;
301 
302  coral::ISession* session = this->connect( m_connectionString,
304  session->transaction().start( true );
305  coral::ISchema& schema = session->nominalSchema();
306 
307  coral::TimeStamp tlast = tMIN;
308 
309  // FLOWIN
310  coral::IQuery* querySIN = schema.newQuery();
311  querySIN->addToTableList( "RPCGASCHANNEL" );
312  querySIN->addToOutputList( "RPCGASCHANNEL.DPID", "DPID" );
313  querySIN->addToOutputList( "RPCGASCHANNEL.CHANGE_DATE", "TSTAMP" );
314  querySIN->addToOutputList( "RPCGASCHANNEL.FLOWIN", "FLOWIN" );
315 
316  // FLOWOUT
317  coral::IQuery* querySOUT = schema.newQuery();
318  querySOUT->addToTableList( "RPCGASCHANNEL" );
319  querySOUT->addToOutputList( "RPCGASCHANNEL.DPID", "DPID" );
320  querySOUT->addToOutputList( "RPCGASCHANNEL.CHANGE_DATE", "TSTAMP" );
321  querySOUT->addToOutputList( "RPCGASCHANNEL.FLOWOUT", "FLOWOUT" );
322 
323 
324  RPCObGas::Item gastemp;
325  std::vector<RPCObGas::Item> gasarray;
326 
327  if (till > since) {
328  tMAX = UTtoT(till);
329  std::cout <<">> Processing till: "<<tMAX.day()<<"/"<<tMAX.month()<<"/"<<tMAX.year()<<" "<<tMAX.hour()<<":"<<tMAX.minute()<<"."<<tMAX.second()<< std::endl;
330  std::cout << ">> creating GAS object..." << std::endl;
331  std::cout << ">> processing FLOWIN..." << std::endl;
332  coral::AttributeList conditionData;
333  conditionData.extend<coral::TimeStamp>( "tmin" );
334  conditionData.extend<coral::TimeStamp>( "tmax" );
335  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
336  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
337  std::string conditionIN = "RPCGASCHANNEL.FLOWIN IS NOT NULL AND CHANGE_DATE >:tmin AND CHANGE_DATE <:tmax";
338 
339  querySIN->setCondition( conditionIN, conditionData );
340  coral::ICursor& cursorSIN = querySIN->execute();
341  while ( cursorSIN.next() ) {
342  gastemp.dpid=0;gastemp.flowin=0;gastemp.flowout=0;gastemp.day=0;gastemp.time=0;
343  const coral::AttributeList& row = cursorSIN.currentRow();
344  float idoub = row["DPID"].data<float>();
345  int id = static_cast<int>(idoub);
346  float val = row["FLOWIN"].data<float>();
347  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
348  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
349  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
350  gastemp.dpid = id;
351  gastemp.flowin = val;
352  gastemp.day = ndate;
353  gastemp.time = ntime;
354  gasarray.push_back(gastemp);
355  }
356  } else {
357  std::cout << ">> creating GAS object..." << std::endl;
358  std::cout << ">> processing FLOWIN..." << std::endl;
359  coral::AttributeList conditionData;
360  conditionData.extend<coral::TimeStamp>( "tmin" );
361  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
362  std::string conditionIN = "RPCGASCHANNEL.FLOWIN IS NOT NULL AND CHANGE_DATE >:tmin";
363  std::cout << "processing FLOWIN..." << std::endl;
364  querySIN->setCondition( conditionIN, conditionData );
365  coral::ICursor& cursorSIN = querySIN->execute();
366  while ( cursorSIN.next() ) {
367  gastemp.dpid=0;gastemp.flowin=0;gastemp.flowout=0;gastemp.day=0;gastemp.time=0;
368  const coral::AttributeList& row = cursorSIN.currentRow();
369  float idoub = row["DPID"].data<float>();
370  int id = static_cast<int>(idoub);
371  float val = row["FLOWIN"].data<float>();
372  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
373  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
374  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
375  gastemp.dpid = id;
376  gastemp.flowin = val;
377  gastemp.day = ndate;
378  gastemp.time = ntime;
379  gasarray.push_back(gastemp);
380  }
381  }
382 
383 
384  if (till > since) {
385  tMAX = UTtoT(till);
386  // std::cout <<">> Processing till: "<<tMAX.day()<<"/"<<tMAX.month()<<"/"<<tMAX.year()<<" "<<tMAX.hour()<<":"<<tMAX.minute()<<"."<<tMAX.second()<< std::endl;
387  std::cout << ">> processing FLOWOUT..." << std::endl;
388  coral::AttributeList conditionData;
389  conditionData.extend<coral::TimeStamp>( "tmin" );
390  conditionData.extend<coral::TimeStamp>( "tmax" );
391  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
392  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
393  std::string conditionOUT = "RPCGASCHANNEL.FLOWOUT IS NOT NULL AND CHANGE_DATE >:tmin AND CHANGE_DATE <:tmax";
394 
395  querySOUT->setCondition( conditionOUT, conditionData );
396  coral::ICursor& cursorSOUT = querySOUT->execute();
397  while ( cursorSOUT.next() ) {
398  gastemp.dpid=0;gastemp.flowin=0;gastemp.flowout=0;gastemp.day=0;gastemp.time=0;
399  const coral::AttributeList& row = cursorSOUT.currentRow();
400  float idoub = row["DPID"].data<float>();
401  int id = static_cast<int>(idoub);
402  float val = row["FLOWOUT"].data<float>();
403  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
404  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
405  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
406  gastemp.dpid = id;
407  gastemp.flowout = val;
408  gastemp.day = ndate;
409  gastemp.time = ntime;
410  gasarray.push_back(gastemp);
411  }
412  } else {
413  std::cout << ">> processing FLOWOUT..." << std::endl;
414  coral::AttributeList conditionData;
415  conditionData.extend<coral::TimeStamp>( "tmin" );
416  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
417  std::string conditionOUT = "RPCGASCHANNEL.FLOWOUT IS NOT NULL AND CHANGE_DATE >:tmin";
418  querySOUT->setCondition( conditionOUT, conditionData );
419  coral::ICursor& cursorSOUT = querySOUT->execute();
420  while ( cursorSOUT.next() ) {
421  gastemp.dpid=0;gastemp.flowin=0;gastemp.flowout=0;gastemp.day=0;gastemp.time=0;
422  const coral::AttributeList& row = cursorSOUT.currentRow();
423  float idoub = row["DPID"].data<float>();
424  int id = static_cast<int>(idoub);
425  float val = row["FLOWOUT"].data<float>();
426  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
427  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
428  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
429  gastemp.dpid = id;
430  gastemp.flowout = val;
431  gastemp.day = ndate;
432  gastemp.time = ntime;
433  gasarray.push_back(gastemp);
434  }
435  }
436 
437 
438  N_IOV = TtoUT(tlast);
439  if (till > since) N_IOV = till;
440  std::cout << ">> Gas array --> size: " << gasarray.size() << " >> done." << std::endl << std::endl << std::endl;
441 
442  delete querySIN;
443  delete querySOUT;
444  session->transaction().commit();
445  delete session;
446 
447  return gasarray;
448 
449 }
unsigned long long TtoUT(const coral::TimeStamp &time)
Definition: RPCFw.cc:1621
std::string m_userName
Definition: RPCFw.h:61
unsigned long long N_IOV
Definition: RPCFw.h:46
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
coral::TimeStamp tMAX
Definition: RPCFw.h:45
float flowout
Definition: RPCObGas.h:20
float flowin
Definition: RPCObGas.h:19
std::string m_password
Definition: RPCFw.h:62
coral::ISession * connect(const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: RPCDBCom.cc:27
tuple cout
Definition: gather_cfg.py:121
std::string m_connectionString
Definition: RPCFw.h:60
coral::TimeStamp tMIN
Definition: RPCFw.h:44
std::vector< RPCObPVSSmap::Item > RPCFw::createIDMAP ( )

Definition at line 541 of file RPCFw.cc.

References RPCDBCom::connect(), gather_cfg::cout, RPCObPVSSmap::Item::dpid, RPCObPVSSmap::Item::layer, m_connectionString, m_password, m_userName, RPCObPVSSmap::Item::region, RPCObPVSSmap::Item::ring, python.IdGenerator::schema, RPCObPVSSmap::Item::sector, python.CommonUtils::session, RPCObPVSSmap::Item::since, RPCObPVSSmap::Item::station, AlCaHLTBitMon_QueryRunRegistry::string, RPCObPVSSmap::Item::subsector, and RPCObPVSSmap::Item::suptype.

Referenced by popcon::RPCObPVSSmapData::getNewObjects().

542 {
543  // float tMINi = 0;
544  std::cout <<">> Processing data..." << std::endl;
545 
546  coral::ISession* session = this->connect( m_connectionString,
548  session->transaction().start( true );
549  coral::ISchema& schema = session->nominalSchema();
550  int nRows = 0;
551  std::cout << ">> creating IDMAP object..." << std::endl;
552  coral::IQuery* queryM = schema.newQuery();
553  queryM->addToTableList( "RPCPVSSDETID");
554  queryM->addToOutputList( "RPCPVSSDETID.SINCE", "SINCE" );
555  queryM->addToOutputList( "RPCPVSSDETID.PVSS_ID", "PVSS_ID" );
556  queryM->addToOutputList( "RPCPVSSDETID.REGION", "REGION" );
557  queryM->addToOutputList( "RPCPVSSDETID.RING", "RING" );
558  queryM->addToOutputList( "RPCPVSSDETID.STATION", "STATION" );
559  queryM->addToOutputList( "RPCPVSSDETID.SECTOR", "SECTOR" );
560  queryM->addToOutputList( "RPCPVSSDETID.LAYER", "LAYER" );
561  queryM->addToOutputList( "RPCPVSSDETID.SUBSECTOR", "SUBSECTOR" );
562  queryM->addToOutputList( "RPCPVSSDETID.SUPPLYTYPE", "SUPPLYTYPE" );
563 
564  std::string condM = "RPCPVSSDETID.PVSS_ID is not NULL";
565 
566  // queryM->setCondition(condM);
567  coral::ICursor& cursorM = queryM->execute();
568 
569  RPCObPVSSmap::Item Itemp;
570  std::vector<RPCObPVSSmap::Item> idmaparray;
571  while ( cursorM.next() ) {
572  const coral::AttributeList& row = cursorM.currentRow();
573  int id = row["PVSS_ID"].data<int>();
574  std::string reg_s = row["REGION"].data<std::string>();
575  std::string rin_s = row["RING"].data<std::string>();
576  std::string sta_s = row["STATION"].data<std::string>();
577  std::string sec_s = row["SECTOR"].data<std::string>();
578  std::string lay_s = row["LAYER"].data<std::string>();
579  std::string sub_s = row["SUBSECTOR"].data<std::string>();
580  std::string sup_s = row["SUPPLYTYPE"].data<std::string>();
581 
582  int reg = atoi(reg_s.c_str());
583  int rin = atoi(rin_s.c_str());
584  int sta = atoi(sta_s.c_str());
585  int sec = atoi(sec_s.c_str());
586  int lay = atoi(lay_s.c_str());
587  int sub = atoi(sub_s.c_str());
588  int sup = 5;
589 
590  if (sup_s == "HV") sup = 0;
591  if (sup_s == "LVA") sup = 1;
592  if (sup_s == "LVD") sup = 2;
593  if (sup_s == "LB") sup = 3;
594  if (sup_s == "T") sup = 4;
595 
596 
597  coral::TimeStamp ts = row["SINCE"].data<coral::TimeStamp>();
598 
599  std::ostringstream dday;
600  std::ostringstream dmon;
601  std::ostringstream dyea;
602  dday << ts.day();
603  dmon << ts.month();
604  dyea << ts.year();
605  std::string date = dday.str() + "-" + dmon.str() + "-" + dyea.str();
606 
607  Itemp.since = atoi(date.c_str());
608  Itemp.dpid = id;
609  Itemp.region = reg;
610  Itemp.ring = rin;
611  Itemp.station = sta;
612  Itemp.sector = sec;
613  Itemp.layer = lay;
614  Itemp.subsector = sub;
615  Itemp.suptype = sup;
616 
617  idmaparray.push_back(Itemp);
618 
619  ++nRows;
620  }
621 
622 
623  std::cout << ">> IDMAP array --> size: " << idmaparray.size() << " >> done." << std::endl;
624  delete queryM;
625  session->transaction().commit();
626  delete session;
627  return idmaparray;
628 }
std::string m_userName
Definition: RPCFw.h:61
std::string m_password
Definition: RPCFw.h:62
coral::ISession * connect(const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: RPCDBCom.cc:27
tuple cout
Definition: gather_cfg.py:121
std::string m_connectionString
Definition: RPCFw.h:60
std::vector< RPCObImon::I_Item > RPCFw::createIMON ( long long  since,
long long  till 
)

Definition at line 50 of file RPCFw.cc.

References RPCDBCom::connect(), gather_cfg::cout, RPCObImon::I_Item::day, RPCObImon::I_Item::dpid, isMajor(), m_connectionString, m_password, m_userName, N_IOV, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, RPCObImon::I_Item::time, tMAX, tMIN, TtoUT(), UTtoT(), and RPCObImon::I_Item::value.

Referenced by popcon::RpcDataI::getNewObjects().

51 {
52  tMIN = UTtoT(since);
53  std::cout <<">> Processing since: "<<tMIN.day()<<"/"<<tMIN.month()<<"/"<<tMIN.year()<<" "<<tMIN.hour()<<":"<<tMIN.minute()<<"."<<tMIN.second()<< std::endl;
54 
55  coral::ISession* session = this->connect( m_connectionString,
57  session->transaction().start( true );
58  coral::ISchema& schema = session->nominalSchema();
59  int nRows = 0;
60  coral::IQuery* queryI = schema.newQuery();
61  queryI->addToTableList( "FWCAENCHANNEL" );
62  queryI->addToOutputList( "FWCAENCHANNEL.DPID", "DPID" );
63  queryI->addToOutputList( "FWCAENCHANNEL.CHANGE_DATE", "TSTAMP" );
64  queryI->addToOutputList( "FWCAENCHANNEL.ACTUAL_IMON", "IMON" );
65 
66  RPCObImon::I_Item Itemp;
67  std::vector<RPCObImon::I_Item> imonarray;
68  coral::TimeStamp tlast = tMIN;
69  if (till > since) {
70  tMAX = UTtoT(till);
71  std::cout <<">> Processing till: "<<tMAX.day()<<"/"<<tMAX.month()<<"/"<<tMAX.year()<<" "<<tMAX.hour()<<":"<<tMAX.minute()<<"."<<tMAX.second()<< std::endl;
72  std::cout << ">> creating IMON object..." << std::endl;
73  coral::AttributeList conditionData;
74  conditionData.extend<coral::TimeStamp>( "tmin" );
75  conditionData.extend<coral::TimeStamp>( "tmax" );
76  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
77  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
78  std::string condition = "FWCAENCHANNEL.ACTUAL_IMON IS NOT NULL AND CHANGE_DATE >:tmin AND CHANGE_DATE <:tmax";
79  queryI->setCondition( condition , conditionData );
80  coral::ICursor& cursorI = queryI->execute();
81  while ( cursorI.next() ) {
82  const coral::AttributeList& row = cursorI.currentRow();
83  float idoub = row["DPID"].data<float>();
84  int id = static_cast<int>(idoub);
85  float val = row["IMON"].data<float>();
86  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
87  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
88  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
89  Itemp.dpid = id;
90  Itemp.value = val;
91  Itemp.day = ndate;
92  Itemp.time = ntime;
93  imonarray.push_back(Itemp);
94  ++nRows;
95  }
96  } else {
97  std::cout << ">> creating IMON object..." << std::endl;
98  coral::AttributeList conditionData;
99  conditionData.extend<coral::TimeStamp>( "tmin" );
100  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
101  std::string condition = "FWCAENCHANNEL.ACTUAL_IMON IS NOT NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin";
102  queryI->setCondition( condition , conditionData );
103  coral::ICursor& cursorI = queryI->execute();
104  while ( cursorI.next() ) {
105  const coral::AttributeList& row = cursorI.currentRow();
106  float idoub = row["DPID"].data<float>();
107  int id = static_cast<int>(idoub);
108  float val = row["IMON"].data<float>();
109  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
110  if (isMajor(ts, tlast)) tlast = ts;
111  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
112  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
113  Itemp.dpid = id;
114  Itemp.value = val;
115  Itemp.day = ndate;
116  Itemp.time = ntime;
117  imonarray.push_back(Itemp);
118  ++nRows;
119  }
120  }
121  N_IOV = TtoUT(tlast);
122  if (till > since) N_IOV = till;
123  std::cout << ">> Imon array --> size: " << imonarray.size() << " >> done." << std::endl;
124  delete queryI;
125  session->transaction().commit();
126  delete session;
127  return imonarray;
128 }
unsigned long long TtoUT(const coral::TimeStamp &time)
Definition: RPCFw.cc:1621
std::string m_userName
Definition: RPCFw.h:61
bool isMajor(const coral::TimeStamp &fir, const coral::TimeStamp &sec)
Definition: RPCFw.cc:1643
unsigned long long N_IOV
Definition: RPCFw.h:46
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
coral::TimeStamp tMAX
Definition: RPCFw.h:45
std::string m_password
Definition: RPCFw.h:62
coral::ISession * connect(const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: RPCDBCom.cc:27
tuple cout
Definition: gather_cfg.py:121
std::string m_connectionString
Definition: RPCFw.h:60
coral::TimeStamp tMIN
Definition: RPCFw.h:44
std::vector< RPCObGasMix::Item > RPCFw::createMix ( long long  since,
long long  till 
)

Definition at line 1380 of file RPCFw.cc.

References RPCDBCom::connect(), gather_cfg::cout, RPCObGasMix::Item::gas1, RPCObGasMix::Item::gas2, RPCObGasMix::Item::gas3, m_connectionString, m_password, m_userName, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, tMAX, tMIN, TtoUT(), RPCObGasMix::Item::unixtime, UTtoT(), and relativeConstraints::value.

Referenced by popcon::RpcDataGasMix::getNewObjects().

1381 {
1382  tMIN = UTtoT(since);
1383  std::cout <<">> Processing since: "<<tMIN.day()<<"/"<<tMIN.month()<<"/"<<tMIN.year()<<" "<<tMIN.hour()<<":"<<tMIN.minute()<<"."<<tMIN.second()<< std::endl;
1384 
1385  coral::ISession* session = this->connect( m_connectionString,
1387  session->transaction().start( true );
1388  coral::ISchema& schema = session->nominalSchema();
1389  std::cout << ">> creating UXC object..." << std::endl;
1390 
1391  coral::IQuery* queryMix = schema.newQuery();
1392  queryMix->addToTableList( "RPCGASPARAMETERS");
1393  queryMix->addToTableList( "DP_NAME2ID" );
1394  queryMix->addToOutputList( "DP_NAME2ID.DPNAME", "DPNAME" );
1395  queryMix->addToOutputList("DP_NAME2ID.ID","ID");
1396  queryMix->addToOutputList( "RPCGASPARAMETERS.DPID", "DPID" );
1397  queryMix->addToOutputList( "RPCGASPARAMETERS.CHANGE_DATE", "TSTAMP" );
1398  queryMix->addToOutputList( "RPCGASPARAMETERS.VALUE", "VALUE" );
1399 
1400  coral::IQuery* queryMix2 = schema.newQuery();
1401  queryMix2->addToTableList( "RPCGASPARAMETERS");
1402  queryMix2->addToTableList( "DP_NAME2ID" );
1403  queryMix2->addToOutputList( "DP_NAME2ID.DPNAME", "DPNAME" );
1404  queryMix2->addToOutputList("DP_NAME2ID.ID","ID");
1405  queryMix2->addToOutputList( "RPCGASPARAMETERS.DPID", "DPID" );
1406  queryMix2->addToOutputList( "RPCGASPARAMETERS.CHANGE_DATE", "TSTAMP" );
1407  queryMix2->addToOutputList( "RPCGASPARAMETERS.VALUE", "VALUE" );
1408 
1409  coral::IQuery* queryMix3 = schema.newQuery();
1410  queryMix3->addToTableList( "RPCGASPARAMETERS");
1411  queryMix3->addToTableList( "DP_NAME2ID" );
1412  queryMix3->addToOutputList( "DP_NAME2ID.DPNAME", "DPNAME" );
1413  queryMix3->addToOutputList("DP_NAME2ID.ID","ID");
1414  queryMix3->addToOutputList( "RPCGASPARAMETERS.DPID", "DPID" );
1415  queryMix3->addToOutputList( "RPCGASPARAMETERS.CHANGE_DATE", "TSTAMP" );
1416  queryMix3->addToOutputList( "RPCGASPARAMETERS.VALUE", "VALUE" );
1417 
1418  RPCObGasMix::Item Mtemp;
1419  std::vector<RPCObGasMix::Item> marray;
1420  coral::TimeStamp tlast = tMIN;
1421  if (till > since) {
1422  tMAX = UTtoT(till);
1423  std::cout <<">> Processing till: "<<tMAX.day()<<"/"<<tMAX.month()<<"/"<<tMAX.year()<<" "<<tMAX.hour()<<":"<<tMAX.minute()<<"."<<tMAX.second()<< std::endl;
1424  std::cout << "Processing UXC..." << std::endl;
1425  coral::AttributeList conditionData;
1426  conditionData.extend<coral::TimeStamp>( "tmin" );
1427  conditionData.extend<coral::TimeStamp>( "tmax" );
1428  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1429  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1430  std::string conditionM1 = "RPCGASPARAMETERS.DPID = DP_NAME2ID.ID AND RPCGASPARAMETERS.CHANGE_DATE >:tmin AND RPCGASPARAMETERS.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%IC4H10Ratio%')";
1431  queryMix->setCondition( conditionM1, conditionData );
1432  coral::ICursor& cursorMix = queryMix->execute();
1433  while ( cursorMix.next() ) {
1434  Mtemp.gas1=0;Mtemp.gas2=0;Mtemp.gas3=0;
1435  const coral::AttributeList& row = cursorMix.currentRow();
1436  float value = row["VALUE"].data<float>();
1437  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1438  unsigned long long ut_time = TtoUT(ts);
1439  Mtemp.gas1 = value;
1440  Mtemp.unixtime = ut_time;
1441  marray.push_back(Mtemp);
1442  }
1443  std::string conditionM2 = "RPCGASPARAMETERS.DPID = DP_NAME2ID.ID AND RPCGASPARAMETERS.CHANGE_DATE >:tmin AND RPCGASPARAMETERS.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%C2H2F4Ratio%')";
1444  queryMix2->setCondition( conditionM2, conditionData );
1445  coral::ICursor& cursorMix2 = queryMix2->execute();
1446  while ( cursorMix2.next() ) {
1447  Mtemp.gas1=0;Mtemp.gas2=0;Mtemp.gas3=0;
1448  const coral::AttributeList& row = cursorMix2.currentRow();
1449  float value = row["VALUE"].data<float>();
1450  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1451  unsigned long long ut_time = TtoUT(ts);
1452  Mtemp.gas2 = value;
1453  Mtemp.unixtime = ut_time;
1454  marray.push_back(Mtemp);
1455  }
1456  std::string conditionM3 = "RPCGASPARAMETERS.DPID = DP_NAME2ID.ID AND RPCGASPARAMETERS.CHANGE_DATE >:tmin AND RPCGASPARAMETERS.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%SF6Ratio%')";
1457  queryMix3->setCondition( conditionM3, conditionData );
1458  coral::ICursor& cursorMix3 = queryMix3->execute();
1459  while ( cursorMix3.next() ) {
1460  Mtemp.gas1=0;Mtemp.gas2=0;Mtemp.gas3=0;
1461  const coral::AttributeList& row = cursorMix3.currentRow();
1462  float value = row["VALUE"].data<float>();
1463  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1464  unsigned long long ut_time = TtoUT(ts);
1465  Mtemp.gas3 = value;
1466  Mtemp.unixtime = ut_time;
1467  marray.push_back(Mtemp);
1468  }
1469  } else {
1470 
1471  std::cout << "This objects cannot be copied in this mode. Use RANGE mode!" << std::endl;
1472 
1473  }
1474 
1475 
1476  std::cout << ">> GasMix array --> size: " << marray.size() << " >> done." << std::endl;
1477  delete queryMix;
1478  session->transaction().commit();
1479  delete session;
1480  return marray;
1481 
1482 }
unsigned long long TtoUT(const coral::TimeStamp &time)
Definition: RPCFw.cc:1621
std::string m_userName
Definition: RPCFw.h:61
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
coral::TimeStamp tMAX
Definition: RPCFw.h:45
std::string m_password
Definition: RPCFw.h:62
coral::ISession * connect(const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: RPCDBCom.cc:27
tuple cout
Definition: gather_cfg.py:121
std::string m_connectionString
Definition: RPCFw.h:60
coral::TimeStamp tMIN
Definition: RPCFw.h:44
std::vector< RPCObStatus::S_Item > RPCFw::createSTATUS ( long long  since,
long long  till 
)

Definition at line 214 of file RPCFw.cc.

References RPCDBCom::connect(), gather_cfg::cout, RPCObStatus::S_Item::day, RPCObStatus::S_Item::dpid, m_connectionString, m_password, m_userName, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, RPCObStatus::S_Item::time, tMAX, tMIN, UTtoT(), and RPCObStatus::S_Item::value.

Referenced by popcon::RpcDataS::getNewObjects().

215 {
216  tMIN = UTtoT(since);
217  std::cout <<">> Processing since: "<<tMIN.day()<<"/"<<tMIN.month()<<"/"<<tMIN.year()<<" "<<tMIN.hour()<<":"<<tMIN.minute()<<"."<<tMIN.second()<< std::endl;
218 
219  coral::ISession* session = this->connect( m_connectionString,
221  session->transaction().start( true );
222  coral::ISchema& schema = session->nominalSchema();
223  int nRows = 0;
224  std::cout << ">> creating STATUS object..." << std::endl;
225  coral::IQuery* queryS = schema.newQuery();
226  queryS->addToTableList( "FWCAENCHANNEL" );
227  queryS->addToOutputList( "FWCAENCHANNEL.DPID", "DPID" );
228  queryS->addToOutputList( "FWCAENCHANNEL.CHANGE_DATE", "TSTAMP" );
229  queryS->addToOutputList( "FWCAENCHANNEL.ACTUAL_STATUS", "STATUS" );
230  RPCObStatus::S_Item Stemp;
231  std::vector<RPCObStatus::S_Item> statusarray;
232  coral::TimeStamp tlast = tMIN;
233  if (till > since) {
234  tMAX = UTtoT(till);
235  std::cout <<">> Processing till: "<<tMAX.day()<<"/"<<tMAX.month()<<"/"<<tMAX.year()<<" "<<tMAX.hour()<<":"<<tMAX.minute()<<"."<<tMAX.second()<< std::endl;
236  std::cout << ">> creating STATUS object..." << std::endl;
237  coral::AttributeList conditionData;
238  conditionData.extend<coral::TimeStamp>( "tmin" );
239  conditionData.extend<coral::TimeStamp>( "tmax" );
240  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
241  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
242  std::string condition = " NOT FWCAENCHANNEL.ACTUAL_STATUS IS NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin AND FWCAENCHANNEL.CHANGE_DATE <:tmax";
243  queryS->setCondition( condition , conditionData );
244  coral::ICursor& cursorS = queryS->execute();
245  while ( cursorS.next() ) {
246  const coral::AttributeList& row = cursorS.currentRow();
247  float idoub = row["DPID"].data<float>();
248  int id = static_cast<int>(idoub);
249  float val = row["STATUS"].data<float>();
250  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
251  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
252  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
253  Stemp.dpid = id;
254  Stemp.value = val;
255  Stemp.day = ndate;
256  Stemp.time = ntime;
257  statusarray.push_back(Stemp);
258  ++nRows;
259  }
260  }else {
261  std::cout << ">> creating STATUS object..." << std::endl;
262  coral::AttributeList conditionData;
263  conditionData.extend<coral::TimeStamp>( "tmin" );
264  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
265  std::string condition = " NOT FWCAENCHANNEL.ACTUAL_STATUS IS NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin";
266  queryS->setCondition( condition , conditionData );
267  coral::ICursor& cursorS = queryS->execute();
268  while ( cursorS.next() ) {
269  const coral::AttributeList& row = cursorS.currentRow();
270  float idoub = row["DPID"].data<float>();
271  int id = static_cast<int>(idoub);
272  float val = row["STATUS"].data<float>();
273  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
274  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
275  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
276  Stemp.dpid = id;
277  Stemp.value = val;
278  Stemp.day = ndate;
279  Stemp.time = ntime;
280  statusarray.push_back(Stemp);
281  ++nRows;
282  }
283  }
284  std::cout << ">> Staus array --> size: " << statusarray.size() << " >> done." << std::endl << std::endl << std::endl;
285 
286  delete queryS;
287  session->transaction().commit();
288  delete session;
289 
290  return statusarray;
291 
292 }
std::string m_userName
Definition: RPCFw.h:61
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
coral::TimeStamp tMAX
Definition: RPCFw.h:45
std::string m_password
Definition: RPCFw.h:62
coral::ISession * connect(const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: RPCDBCom.cc:27
tuple cout
Definition: gather_cfg.py:121
std::string m_connectionString
Definition: RPCFw.h:60
coral::TimeStamp tMIN
Definition: RPCFw.h:44
std::vector< RPCObTemp::T_Item > RPCFw::createT ( long long  since,
long long  till 
)

Definition at line 454 of file RPCFw.cc.

References RPCDBCom::connect(), gather_cfg::cout, RPCObTemp::T_Item::day, RPCObTemp::T_Item::dpid, m_connectionString, m_password, m_userName, N_IOV, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, RPCObTemp::T_Item::time, tMAX, tMIN, TtoUT(), UTtoT(), and RPCObTemp::T_Item::value.

Referenced by popcon::RpcDataT::getNewObjects().

455 {
456  tMIN = UTtoT(since);
457  std::cout <<">> Processing since: "<<tMIN.day()<<"/"<<tMIN.month()<<"/"<<tMIN.year()<<" "<<tMIN.hour()<<":"<<tMIN.minute()<<"."<<tMIN.second()<< std::endl;
458 
459  coral::ISession* session = this->connect( m_connectionString,
461  session->transaction().start( true );
462  coral::ISchema& schema = session->nominalSchema();
463  int nRows = 0;
464  coral::IQuery* queryS = schema.newQuery();
465  queryS->addToTableList( "FWCAENCHANNELADC" );
466  queryS->addToOutputList( "FWCAENCHANNELADC.DPID", "DPID" );
467  queryS->addToOutputList( "FWCAENCHANNELADC.CHANGE_DATE", "TSTAMP" );
468  queryS->addToOutputList( "FWCAENCHANNELADC.ACTUAL_TEMPERATURE", "TEMPERATURE" );
469  RPCObTemp::T_Item Ttemp;
470  std::vector<RPCObTemp::T_Item> temparray;
471  coral::TimeStamp tlast = tMIN;
472  if (till > since) {
473  tMAX = UTtoT(till);
474  std::cout <<">> Processing till: "<<tMAX.day()<<"/"<<tMAX.month()<<"/"<<tMAX.year()<<" "<<tMAX.hour()<<":"<<tMAX.minute()<<"."<<tMAX.second()<< std::endl;
475  std::cout << ">> creating TEMPERATURE object..." << std::endl;
476  coral::AttributeList conditionData;
477  conditionData.extend<coral::TimeStamp>( "tmin" );
478  conditionData.extend<coral::TimeStamp>( "tmax" );
479  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
480  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
481  std::string condition = "FWCAENCHANNELADC.ACTUAL_TEMPERATURE IS NOT NULL AND CHANGE_DATE >:tmin AND CHANGE_DATE <:tmax";
482  queryS->setCondition( condition , conditionData );
483  coral::ICursor& cursorS = queryS->execute();
484  while ( cursorS.next() ) {
485  const coral::AttributeList& row = cursorS.currentRow();
486  float idoub = row["DPID"].data<float>();
487  int id = static_cast<int>(idoub);
488  float val = row["TEMPERATURE"].data<float>();
489  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
490  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
491  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
492 
493  Ttemp.dpid = id;
494  Ttemp.value = val;
495  Ttemp.day = ndate;
496  Ttemp.time = ntime;
497  temparray.push_back(Ttemp);
498 
499  ++nRows;
500  }
501  } else {
502  std::cout << ">> creating TEMPERATURE object..." << std::endl;
503  coral::AttributeList conditionData;
504  conditionData.extend<coral::TimeStamp>( "tmin" );
505  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
506  std::string condition = "FWCAENCHANNELADC.ACTUAL_TEMPERATURE IS NOT NULL AND CHANGE_DATE >:tmin";
507  queryS->setCondition( condition , conditionData );
508  coral::ICursor& cursorS = queryS->execute();
509  while ( cursorS.next() ) {
510  const coral::AttributeList& row = cursorS.currentRow();
511  float idoub = row["DPID"].data<float>();
512  int id = static_cast<int>(idoub);
513  float val = row["TEMPERATURE"].data<float>();
514  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
515  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
516  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
517 
518  Ttemp.dpid = id;
519  Ttemp.value = val;
520  Ttemp.day = ndate;
521  Ttemp.time = ntime;
522  temparray.push_back(Ttemp);
523 
524  ++nRows;
525  }
526  }
527  N_IOV = TtoUT(tlast);
528  if (till > since) N_IOV = till;
529  std::cout << ">> Temperature array --> size: " << temparray.size() << " >> done." << std::endl << std::endl << std::endl;
530 
531  delete queryS;
532  session->transaction().commit();
533  delete session;
534 
535  return temparray;
536 
537 }
unsigned long long TtoUT(const coral::TimeStamp &time)
Definition: RPCFw.cc:1621
std::string m_userName
Definition: RPCFw.h:61
unsigned long long N_IOV
Definition: RPCFw.h:46
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
coral::TimeStamp tMAX
Definition: RPCFw.h:45
std::string m_password
Definition: RPCFw.h:62
coral::ISession * connect(const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: RPCDBCom.cc:27
tuple cout
Definition: gather_cfg.py:121
std::string m_connectionString
Definition: RPCFw.h:60
coral::TimeStamp tMIN
Definition: RPCFw.h:44
std::vector< RPCObUXC::Item > RPCFw::createUXC ( long long  since,
long long  till 
)

Definition at line 1271 of file RPCFw.cc.

References RPCDBCom::connect(), gather_cfg::cout, RPCObUXC::Item::dewpoint, m_connectionString, m_password, m_userName, RPCObUXC::Item::pressure, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, RPCObUXC::Item::temperature, tMAX, tMIN, TtoUT(), RPCObUXC::Item::unixtime, UTtoT(), and relativeConstraints::value.

Referenced by popcon::RpcDataUXC::getNewObjects().

1272 {
1273  tMIN = UTtoT(since);
1274  std::cout <<">> Processing since: "<<tMIN.day()<<"/"<<tMIN.month()<<"/"<<tMIN.year()<<" "<<tMIN.hour()<<":"<<tMIN.minute()<<"."<<tMIN.second()<< std::endl;
1275 
1276  coral::ISession* session = this->connect( m_connectionString,
1278  session->transaction().start( true );
1279  coral::ISchema& schema = session->nominalSchema();
1280  std::cout << ">> creating UXC object..." << std::endl;
1281 
1282  // UXCT
1283  coral::IQuery* queryUXCP = schema.newQuery();
1284  queryUXCP->addToTableList( "RPCGASPARAMETERS");
1285  queryUXCP->addToTableList( "DP_NAME2ID" );
1286  queryUXCP->addToOutputList( "DP_NAME2ID.DPNAME", "DPNAME" );
1287  queryUXCP->addToOutputList("DP_NAME2ID.ID","ID");
1288  queryUXCP->addToOutputList( "RPCGASPARAMETERS.DPID", "DPID" );
1289  queryUXCP->addToOutputList( "RPCGASPARAMETERS.CHANGE_DATE", "TSTAMP" );
1290  queryUXCP->addToOutputList( "RPCGASPARAMETERS.VALUE", "VALUE" );
1291  coral::IQuery* queryUXCT = schema.newQuery();
1292  queryUXCT->addToTableList( "RPCCOOLING");
1293  queryUXCT->addToTableList( "DP_NAME2ID" );
1294  queryUXCT->addToOutputList( "DP_NAME2ID.DPNAME", "DPNAME" );
1295  queryUXCT->addToOutputList("DP_NAME2ID.ID","ID");
1296  queryUXCT->addToOutputList( "RPCCOOLING.DPID", "DPID" );
1297  queryUXCT->addToOutputList( "RPCCOOLING.CHANGE_DATE", "TSTAMP" );
1298  queryUXCT->addToOutputList( "RPCCOOLING.VALUE", "VALUE" );
1299  coral::IQuery* queryUXCH = schema.newQuery();
1300  queryUXCH->addToTableList( "RPCCOOLING");
1301  queryUXCH->addToTableList( "DP_NAME2ID" );
1302  queryUXCH->addToOutputList( "DP_NAME2ID.DPNAME", "DPNAME" );
1303  queryUXCH->addToOutputList("DP_NAME2ID.ID","ID");
1304  queryUXCH->addToOutputList( "RPCCOOLING.DPID", "DPID" );
1305  queryUXCH->addToOutputList( "RPCCOOLING.CHANGE_DATE", "TSTAMP" );
1306  queryUXCH->addToOutputList( "RPCCOOLING.VALUE", "VALUE" );
1307 
1308 
1309  RPCObUXC::Item Itemp;
1310  std::vector<RPCObUXC::Item> uxcarray;
1311  coral::TimeStamp tlast = tMIN;
1312  if (till > since) {
1313  tMAX = UTtoT(till);
1314  std::cout <<">> Processing till: "<<tMAX.day()<<"/"<<tMAX.month()<<"/"<<tMAX.year()<<" "<<tMAX.hour()<<":"<<tMAX.minute()<<"."<<tMAX.second()<< std::endl;
1315  std::cout << "Processing UXC..." << std::endl;
1316  coral::AttributeList conditionData;
1317  conditionData.extend<coral::TimeStamp>( "tmin" );
1318  conditionData.extend<coral::TimeStamp>( "tmax" );
1319  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
1320  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
1321  std::string conditionUXCP = "RPCGASPARAMETERS.DPID = DP_NAME2ID.ID AND RPCGASPARAMETERS.CHANGE_DATE >:tmin AND RPCGASPARAMETERS.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%UXCPressure%')";
1322  queryUXCP->setCondition( conditionUXCP, conditionData );
1323  coral::ICursor& cursorUXCP = queryUXCP->execute();
1324  while ( cursorUXCP.next() ) {
1325  Itemp.temperature=0;Itemp.pressure=0;Itemp.dewpoint=0;
1326  const coral::AttributeList& row = cursorUXCP.currentRow();
1327  float value = row["VALUE"].data<float>();
1328  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1329  unsigned long long ut_time = TtoUT(ts);
1330  Itemp.pressure = value;
1331  Itemp.unixtime = ut_time;
1332  uxcarray.push_back(Itemp);
1333  }
1334  std::string conditionUXCT = "RPCCOOLING.DPID = DP_NAME2ID.ID AND RPCCOOLING.CHANGE_DATE >:tmin AND RPCCOOLING.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%TempUXC%')";
1335  queryUXCT->setCondition( conditionUXCT, conditionData );
1336  coral::ICursor& cursorUXCT = queryUXCT->execute();
1337  while ( cursorUXCT.next() ) {
1338  Itemp.temperature=0;Itemp.pressure=0;Itemp.dewpoint=0;
1339  const coral::AttributeList& row = cursorUXCT.currentRow();
1340  float value = row["VALUE"].data<float>();
1341  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1342  unsigned long long ut_time = TtoUT(ts);
1343  Itemp.temperature = value;
1344  Itemp.unixtime = ut_time;
1345  uxcarray.push_back(Itemp);
1346  }
1347  std::string conditionUXCH = "RPCCOOLING.DPID = DP_NAME2ID.ID AND RPCCOOLING.CHANGE_DATE >:tmin AND RPCCOOLING.CHANGE_DATE <:tmax AND (DP_NAME2ID.DPNAME like '%DewpointUXC%')";
1348  queryUXCH->setCondition( conditionUXCH, conditionData );
1349  coral::ICursor& cursorUXCH = queryUXCH->execute();
1350  while ( cursorUXCH.next() ) {
1351  Itemp.temperature=0;Itemp.pressure=0;Itemp.dewpoint=0;
1352  const coral::AttributeList& row = cursorUXCH.currentRow();
1353  float value = row["VALUE"].data<float>();
1354  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
1355  unsigned long long ut_time = TtoUT(ts);
1356  Itemp.dewpoint = value;
1357  Itemp.unixtime = ut_time;
1358  uxcarray.push_back(Itemp);
1359  }
1360  }else {
1361 
1362  std::cout << "This objects cannot be copied in this mode. Use RANGE mode!" << std::endl;
1363 
1364  }
1365 
1366 
1367  std::cout << ">> UXC array --> size: " << uxcarray.size() << " >> done." << std::endl;
1368  delete queryUXCT;
1369  delete queryUXCP;
1370  delete queryUXCH;
1371  session->transaction().commit();
1372  delete session;
1373  return uxcarray;
1374 
1375 }
unsigned long long TtoUT(const coral::TimeStamp &time)
Definition: RPCFw.cc:1621
std::string m_userName
Definition: RPCFw.h:61
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
coral::TimeStamp tMAX
Definition: RPCFw.h:45
float temperature
Definition: RPCObUXC.h:18
float pressure
Definition: RPCObUXC.h:19
std::string m_password
Definition: RPCFw.h:62
coral::ISession * connect(const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: RPCDBCom.cc:27
tuple cout
Definition: gather_cfg.py:121
std::string m_connectionString
Definition: RPCFw.h:60
float dewpoint
Definition: RPCObUXC.h:20
coral::TimeStamp tMIN
Definition: RPCFw.h:44
std::vector< RPCObVmon::V_Item > RPCFw::createVMON ( long long  from,
long long  till 
)

Definition at line 133 of file RPCFw.cc.

References RPCDBCom::connect(), gather_cfg::cout, RPCObVmon::V_Item::day, RPCObVmon::V_Item::dpid, isMajor(), m_connectionString, m_password, m_userName, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, RPCObVmon::V_Item::time, tMAX, tMIN, UTtoT(), and RPCObVmon::V_Item::value.

Referenced by popcon::RpcDataV::getNewObjects().

134 {
135  tMIN = UTtoT(since);
136  std::cout <<">> Processing since: "<<tMIN.day()<<"/"<<tMIN.month()<<"/"<<tMIN.year()<<" "<<tMIN.hour()<<":"<<tMIN.minute()<<"."<<tMIN.second()<< std::endl;
137 
138  coral::ISession* session = this->connect( m_connectionString,
140  session->transaction().start( true );
141  coral::ISchema& schema = session->nominalSchema();
142  int nRows = 0;
143  coral::IQuery* queryV = schema.newQuery();
144  queryV->addToTableList( "FWCAENCHANNEL" );
145  queryV->addToOutputList( "FWCAENCHANNEL.DPID", "DPID" );
146  queryV->addToOutputList( "FWCAENCHANNEL.CHANGE_DATE", "TSTAMP" );
147  queryV->addToOutputList( "FWCAENCHANNEL.ACTUAL_VMON", "VMON" );
148  RPCObVmon::V_Item Vtemp;
149  std::vector<RPCObVmon::V_Item> vmonarray;
150  coral::TimeStamp tlast = tMIN;
151  if (till > since) {
152  tMAX = UTtoT(till);
153  std::cout <<">> Processing till: "<<tMAX.day()<<"/"<<tMAX.month()<<"/"<<tMAX.year()<<" "<<tMAX.hour()<<":"<<tMAX.minute()<<"."<<tMAX.second()<< std::endl;
154  std::cout << ">> creating VMON object..." << std::endl;
155  coral::AttributeList conditionData;
156  conditionData.extend<coral::TimeStamp>( "tmin" );
157  conditionData.extend<coral::TimeStamp>( "tmax" );
158  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
159  conditionData["tmax"].data<coral::TimeStamp>() = tMAX;
160  std::string condition = " NOT FWCAENCHANNEL.ACTUAL_VMON IS NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin AND FWCAENCHANNEL.CHANGE_DATE <:tmax";
161  queryV->setCondition( condition , conditionData );
162  coral::ICursor& cursorV = queryV->execute();
163  while ( cursorV.next() ) {
164  const coral::AttributeList& row = cursorV.currentRow();
165  float idoub = row["DPID"].data<float>();
166  int id = static_cast<int>(idoub);
167  float val = row["VMON"].data<float>();
168  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
169  if (isMajor(ts, tlast)) tlast = ts;
170  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
171  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
172  Vtemp.dpid = id;
173  Vtemp.value = val;
174  Vtemp.day = ndate;
175  Vtemp.time = ntime;
176  vmonarray.push_back(Vtemp);
177  ++nRows;
178  }
179  } else {
180  std::cout << ">> creating VMON object..." << std::endl;
181  coral::AttributeList conditionData;
182  conditionData.extend<coral::TimeStamp>( "tmin" );
183  conditionData["tmin"].data<coral::TimeStamp>() = tMIN;
184  std::string condition = " NOT FWCAENCHANNEL.ACTUAL_VMON IS NULL AND FWCAENCHANNEL.CHANGE_DATE >:tmin";
185  queryV->setCondition( condition , conditionData );
186  coral::ICursor& cursorV = queryV->execute();
187  while ( cursorV.next() ) {
188  const coral::AttributeList& row = cursorV.currentRow();
189  float idoub = row["DPID"].data<float>();
190  int id = static_cast<int>(idoub);
191  float val = row["VMON"].data<float>();
192  coral::TimeStamp ts = row["TSTAMP"].data<coral::TimeStamp>();
193  if (isMajor(ts, tlast)) tlast = ts;
194  int ndate = (ts.day() * 10000) + (ts.month() * 100) + (ts.year()-2000);
195  int ntime = (ts.hour() * 10000) + (ts.minute() * 100) + ts.second();
196  Vtemp.dpid = id;
197  Vtemp.value = val;
198  Vtemp.day = ndate;
199  Vtemp.time = ntime;
200  vmonarray.push_back(Vtemp);
201  ++nRows;
202  }
203  }
204 
205  std::cout << ">> Vmon array --> size: " << vmonarray.size() << " >> done." << std::endl;
206  delete queryV;
207  session->transaction().commit();
208  delete session;
209  return vmonarray;
210 }
std::string m_userName
Definition: RPCFw.h:61
bool isMajor(const coral::TimeStamp &fir, const coral::TimeStamp &sec)
Definition: RPCFw.cc:1643
coral::TimeStamp UTtoT(long long utime)
Definition: RPCFw.cc:1487
coral::TimeStamp tMAX
Definition: RPCFw.h:45
std::string m_password
Definition: RPCFw.h:62
coral::ISession * connect(const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: RPCDBCom.cc:27
tuple cout
Definition: gather_cfg.py:121
std::string m_connectionString
Definition: RPCFw.h:60
coral::TimeStamp tMIN
Definition: RPCFw.h:44
bool RPCFw::isMajor ( const coral::TimeStamp &  fir,
const coral::TimeStamp &  sec 
)

Definition at line 1643 of file RPCFw.cc.

References reco::e2, first, and edm::second().

Referenced by createIMON(), and createVMON().

1644 {
1645 
1646  double first = fir.year()*1e10+fir.month()+1e8+fir.day()*1e6+fir.hour()*1e4+fir.minute()*1e2+fir.second();
1647  double second = sec.year()*1e10+sec.month()+1e8+sec.day()*1e6+sec.hour()*1e4+sec.minute()*1e2+sec.second();
1648 
1649  if (first > second) return true;
1650 
1651  return false;
1652 }
U second(std::pair< T, U > const &p)
bool first
Definition: L1TdeRCT.cc:75
Float e2
Definition: deltaR.h:23
void RPCFw::run ( )
virtual

Implements RPCDBCom.

Definition at line 44 of file RPCFw.cc.

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

45 {
46 }
unsigned long long RPCFw::TtoUT ( const coral::TimeStamp &  time)

Definition at line 1621 of file RPCFw.cc.

References estimatePileup_makeJSON::trunc.

Referenced by createGAS(), createIMON(), createMix(), createT(), createUXC(), RPCRunIOV::filterIMON(), and RPCRunIOV::toUNIX().

1622 {
1623 
1624  long long utime = (time.year()-1970)*31536000+static_cast<int>(trunc((time.year()-1972)/4))*86400+
1625  (((time.month()-1)*31)*86400)+((time.day()-1)*86400)+time.hour()*3600+time.minute()*60+time.second();
1626 
1627  if (time.month() == 3) utime = utime - 3*86400;
1628  if (time.month() == 4) utime = utime - 3*86400;
1629  if (time.month() == 5) utime = utime - 4*86400;
1630  if (time.month() == 6) utime = utime - 4*86400;
1631  if (time.month() == 7) utime = utime - 5*86400;
1632  if (time.month() == 8) utime = utime - 5*86400;
1633  if (time.month() == 9) utime = utime - 5*86400;
1634  if (time.month() == 10) utime = utime - 6*86400;
1635  if (time.month() == 11) utime = utime - 6*86400;
1636  if (time.month() == 12) utime = utime - 7*86400;
1637 
1638  return utime;
1639 }
coral::TimeStamp RPCFw::UTtoT ( long long  utime)

Definition at line 1487 of file RPCFw.cc.

References cond::rpcobgas::day, bookConverter::min, LaserDQM_cfi::mon, and estimatePileup_makeJSON::trunc.

Referenced by CondReader::analyze(), createFEB(), createGAS(), createIMON(), createMix(), createSTATUS(), createT(), createUXC(), and createVMON().

1488 {
1489 
1490 
1491  int yea = static_cast<int>(trunc(utime/31536000) + 1970);
1492  int yes = (yea-1970)*31536000;
1493  int cony = ((yea-1972)%4)+1;
1494  if (cony == 0) yes = yes + (yea-1972)/4*86400;
1495  else yes = yes + static_cast<int>(trunc((yea-1972)/4))*86400;
1496  int day = static_cast<int>(trunc((utime - yes)/86400));
1497  int rest = static_cast<int>(utime - yes - day*86400);
1498  int mon = 0;
1499  // BISESTILE YEAR
1500  if (cony == 0) {
1501  day = day + 1;
1502  if (day < 32){
1503  mon = 1;
1504  day = day - 0;
1505  }
1506  if (day >= 32 && day < 61){
1507  mon = 2;
1508  day = day - 31;
1509  }
1510  if (day >= 61 && day < 92){
1511  mon = 3;
1512  day = day - 60;
1513  }
1514  if (day >= 92 && day < 122){
1515  mon = 4;
1516  day = day - 91;
1517  }
1518  if (day >= 122 && day < 153){
1519  mon = 5;
1520  day = day - 121;
1521  }
1522  if (day >= 153 && day < 183){
1523  mon = 6;
1524  day = day - 152;
1525  }
1526  if (day >= 183 && day < 214){
1527  mon = 7;
1528  day = day - 182;
1529  }
1530  if (day >= 214 && day < 245){
1531  mon = 8;
1532  day = day - 213;
1533  }
1534  if (day >= 245 && day < 275){
1535  mon = 9;
1536  day = day - 244;
1537  }
1538  if (day >= 275 && day < 306){
1539  mon = 10;
1540  day = day - 274;
1541  }
1542  if (day >= 306 && day < 336){
1543  mon = 11;
1544  day = day - 305;
1545  }
1546  if (day >= 336){
1547  mon = 12;
1548  day = day - 335;
1549  }
1550  }
1551  // NOT BISESTILE YEAR
1552  else {
1553  if (day < 32){
1554  mon = 1;
1555  day = day - 0;
1556  }
1557  if (day >= 32 && day < 60){
1558  mon = 2;
1559  day = day - 31;
1560  }
1561  if (day >= 60 && day < 91){
1562  mon = 3;
1563  day = day - 59;
1564  }
1565  if (day >= 91 && day < 121){
1566  mon = 4;
1567  day = day - 90;
1568  }
1569  if (day >= 121 && day < 152){
1570  mon = 5;
1571  day = day - 120;
1572  }
1573  if (day >= 152 && day < 182){
1574  mon = 6;
1575  day = day - 151;
1576  }
1577  if (day >= 182 && day < 213){
1578  mon = 7;
1579  day = day - 181;
1580  }
1581  if (day >= 213 && day < 244){
1582  mon = 8;
1583  day = day - 212;
1584  }
1585  if (day >= 244 && day < 274){
1586  mon = 9;
1587  day = day - 243;
1588  }
1589  if (day >= 274 && day < 305){
1590  mon = 10;
1591  day = day - 273;
1592  }
1593  if (day >= 305 && day < 335){
1594  mon = 11;
1595  day = day - 304;
1596  }
1597  if (day >= 335){
1598  mon = 12;
1599  day = day - 334;
1600  }
1601  }
1602 
1603  int hou = static_cast<int>(trunc(rest/3600));
1604  rest = rest - hou*3600;
1605  int min = static_cast<int>(trunc(rest/60));
1606  rest = rest - min*60;
1607  int sec = rest;
1608  int nan = 0;
1609 
1610  // std::cout <<">> Processing since: "<<day<<"/"<<mon<<"/"<<yea<<" "<<hou<<":"<<min<<"."<<sec<< std::endl;
1611 
1612  coral::TimeStamp Tthr;
1613 
1614  Tthr = coral::TimeStamp(yea, mon, day, hou, min, sec, nan);
1615  return Tthr;
1616 }

Member Data Documentation

std::string RPCFw::m_connectionString
private
std::string RPCFw::m_password
private
std::string RPCFw::m_userName
private
unsigned long long RPCFw::N_IOV

Definition at line 46 of file RPCFw.h.

Referenced by createGAS(), createIMON(), and createT().

coral::TimeStamp RPCFw::tMAX
coral::TimeStamp RPCFw::tMIN