00001
00002 #include<stdio.h>
00003 #include<iostream>
00004 #include "db/DBInit.h"
00005 #include "configObjects/LdaConfiguration.h"
00006 #include "configObjects/DccConfiguration.h"
00007 #include "configObjects/DifConfiguration.h"
00008 #include "configObjects/AsicConfiguration.h"
00009 #include "configObjects/State.h"
00010 #include "configObjects/Setup.h"
00011 #include "daq/RunInfo.h"
00012 #include <boost/date_time/posix_time/posix_time_types.hpp>
00013 using namespace oracle::occi;
00014 using namespace std;
00015
00016
00017
00018
00019 int main (ub4 argc, char* argv[])
00020 {
00021 try{
00022
00023 unsigned int runId = 0 ;
00024 if ( argc != 2 ) { cout << "Usage: oracle runId" << endl; exit(-1); }
00025 else { runId = atoi(argv[1]); }
00026 cout << "Run Id[" << runId << "]" << endl;
00027 DBInit::init();
00028
00029
00030
00031 Setup * setup = Setup::getSetupFromRun(runId);
00032 if ( setup == NULL ) { cout << "Usage: not setup for this runId" << endl; exit(-1); }
00033
00034 vector<State *> states = setup->getStates();
00035 for ( vector<State*>::const_iterator it = states.begin(); it != states.end() ; it++ )
00036 {
00037 State * state = *it;
00038 cout << "State name: " << state->getName()<< endl;
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 DccConfiguration *dcc_conf = state->getDccConfiguration();
00052 vector<ConfigObject*> dccs = dcc_conf->getVector();
00053
00054 AsicConfiguration *asic_conf = state->getAsicConfiguration() ;
00055 vector<ConfigObject*> asics = asic_conf->getVector();
00056 cout<<"\t"<<asics.size()<<" asic"<<endl;
00057 for ( unsigned int i = 0 ; i < asics.size() ; i++ )
00058 {
00059
00060 string type = asics[i]->getString("ASIC_TYPE");
00061 string mask0 = asics[i]->getString("MASK0");
00062 string mask1 = asics[i]->getString("MASK1");
00063 string mask2 = asics[i]->getString("MASK2");
00064 cout << "mask0[" << mask0 << "]" << endl;
00065 int chipId = asics[i]->getInt("HEADER");
00066 int difId = asics[i]->getInt("DIF_ID");
00067 int dac0 = asics[i]->getInt("BB0");
00068 int dac1 = asics[i]->getInt("BB1");
00069 int dac2 = asics[i]->getInt("BB2");
00070 int shaperLg = asics[i]->getInt("SWLG");
00071 int shaperHg = asics[i]->getInt("SWHG");
00072 vector<int> pedestal_offset = asics[i]->getIntVector("B0B3");
00073 for ( unsigned int index = 0; index < pedestal_offset.size() ; index++)
00074 {
00075 cout << "pedestal_offset[" << index << "] = [" << pedestal_offset[index] << "]" << endl;
00076 }
00077 string stimulate = asics[i]->getString("CTEST");
00078 cout << "CTEST: [" << stimulate << "]" << endl ;
00079
00080
00081
00082
00083 }
00084 }
00085
00086 delete (setup);
00087
00088 }
00089 catch(Exception e){
00090 cout<<"ERROR: " << e.getMessage()<<endl;
00091 }
00092 DBInit::terminate();
00093 }
00094
00095