00001 /* @version $Revision: 1349 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2011-10-20 14:54:43 +0200 (Thu, 20 Oct 2011) $ */ 00002 #include <iostream> 00003 00004 #include "slowControl/SlowControlManager.hh" 00005 #include "slowControl/ChamberSlowControl.hh" 00006 00007 #include "tools/Log.hh" 00008 #include "tools/SteerDesc.hh" 00009 #include "xml/XMLTool.hh" 00010 #include "tools/MicroException.hh" 00011 00012 using namespace std; 00013 00014 int main(int argc, char **argv) 00015 { 00016 00017 FILELog::ReportingLevel() = FILELog::FromString(INFO); 00018 00019 string steerName = "SteerFiles/gassiplex_tb2009.xml"; 00020 FILE *file = fopen(steerName.c_str(), "r"); 00021 if(file == NULL){ 00022 FILE_LOG(logERROR) << "Steer file ["<< steerName << "] does not exist" << endl; 00023 exit(0); 00024 fclose(file); 00025 } 00026 else 00027 { 00028 // create Run, set detector and steerDesc from steer XML file 00029 SteerDesc steerDesc; 00030 XMLTool xml; 00031 xml.parse(steerDesc, steerName); // parse steer file and fill steerDesc 00032 // Set detector with xml file content 00033 fclose(file); 00034 00035 string slowControlPath = steerDesc.getSlowControlPath(); 00036 SlowControlManager sc; 00037 sc.build(steerDesc); 00038 00039 00040 sc.readDB("/lapp_data/LC/Detecteurs/MicroMegas/data/TB2009/May/SlowControl/slowControl_tb2009.txt"); 00041 00042 /* 00043 for (std::set<SlowControlEntry>::const_iterator p = sc.begin() ; p != sc.end() ; p++) 00044 { 00045 cout << fixed << p->timeStamp<< endl; 00046 } 00047 */ 00048 00049 // min: 1 243 334 681 469 00050 // max: 1 244 555 913 828 00051 // double search =1243446695252.0; // ok 00052 double search =1244360530734.000; // ok 00053 // double search =2243346695252.0; // + grand 00054 // double search =0243346695252.0; // + petit 00055 00056 const SlowControlEntry *entry = NULL; 00057 try { 00058 entry = sc.getEntry(search ); 00059 } 00060 catch ( MicroException e) 00061 { 00062 cout << e.getMessage() << " :" << fixed << search << endl; 00063 } 00064 if ( entry != NULL) 00065 { 00066 cout << "searched: " << fixed << search << endl; 00067 cout << "found : " << entry->getTimeStamp() << endl; 00068 float mesh = 0; 00069 float drift = 0; 00070 try { 00071 const ChamberSlowControl& chSC = entry->chMap.find(0)->second; 00072 mesh = chSC.getMesh().voltage; 00073 drift = chSC.getDrift().voltage; 00074 } 00075 catch ( MicroException e) { cout << e.getMessage(); } 00076 00077 cout << "found : " << entry->getTimeStamp() << endl; 00078 cout << "Mesh value : " << mesh << endl; 00079 cout << "Drift value : " << drift << endl; 00080 } 00081 00082 00083 } 00084 00085 return 0; 00086 }