gotthard: got rid of HV in settings file and changing the way macadd read from settings file

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@56 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2011-11-22 11:01:27 +00:00
parent b2723feb47
commit 1ecde6beeb

View File

@ -365,124 +365,112 @@ int gotthardDetector::retrieveDetectorSetup(string fname1, int level){
myMod=createModule(); myMod=createModule();
nflag=1; nflag=1;
} }
string myfname; string myfname;
string str; string str;
ifstream infile; ifstream infile;
ostringstream oss; ostringstream oss;
int iline=0; int iline=0;
string sargname,sargname2; string sargname,sargname2;
int ival; int ival;
int ichan=0, ichip=0, idac=0; int ichan=0, ichip=0, idac=0;
string::size_type pos=0; string::size_type pos=0;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "reading settings file for module number "<< myMod->module << std::endl; std::cout<< "reading settings file for module number "<< myMod->module << std::endl;
#endif #endif
myfname=fname; myfname=fname;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "settings file name is "<< myfname << std::endl; std::cout<< "settings file name is "<< myfname << std::endl;
#endif #endif
infile.open(myfname.c_str(), ios_base::in); infile.open(myfname.c_str(), ios_base::in);
if (infile.is_open()) { if (infile.is_open()) {
//dacs--------------- //---------------dacs---------------
for (int iarg=0; iarg<thisDetector->nDacs; iarg++) { for (int iarg=0; iarg<thisDetector->nDacs; iarg++) {
getline(infile,str); getline(infile,str);
iline++; iline++;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< str << std::endl; std::cout<< str << std::endl;
#endif #endif
istringstream ssstr(str); istringstream ssstr(str);
ssstr >> sargname >> ival; ssstr >> sargname >> ival;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< sargname << " dac nr. " << idac << " is " << ival << std::endl; std::cout<< sargname << " dac nr. " << idac << " is " << ival << std::endl;
#endif #endif
myMod->dacs[idac]=ival; myMod->dacs[idac]=ival;
idac++; idac++;
} }
//config--------------- //---------------config---------------
getline(infile,str); getline(infile,str);
iline++; iline++;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< str << std::endl; std::cout<< str << std::endl;
#endif #endif
istringstream ssstr(str); istringstream ssstr(str);
ssstr >> sargname >> ival; ssstr >> sargname >> ival;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< sargname << " is " << ival << std::endl; std::cout<< sargname << " is " << ival << std::endl;
#endif #endif
int configval = ival;//myMod->dacs[idac]=ival; int configval = ival;//myMod->dacs[idac]=ival;
//HV--------------- //---------------mac address----------
getline(infile,str); getline(infile,str);
iline++; iline++;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< str << std::endl; std::cout<< str << std::endl;
#endif #endif
ssstr.str(str); istringstream sstr(str);
ssstr >> sargname >> ival; sstr >> sargname >> sargname2;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< sargname << " is " << ival << std::endl; std::cout<< sargname << " is " << sargname2 << std::endl;
#endif #endif
int HVval = ival;//myMod->dacs[idac]=ival; //getting rid of dots
pos = sargname2.find(":");
while(pos != string::npos)
{
sargname2.erase( pos, 1 );
pos = sargname2.find(":");
}
strcpy(thisDetector->clientMacAddress,sargname2.c_str());
//sprintf(thisDetector->clientMacAddress,"%0llX",atoll(sargname2.c_str()));
cout<<"macaddress:"<<thisDetector->clientMacAddress<<endl;
//mac address---------- //---------------ip address---------------
getline(infile,str); getline(infile,str);
iline++; iline++;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< str << std::endl; std::cout<< str << std::endl;
#endif #endif
istringstream sstr(str); istringstream sssstr(str);
sstr >> sargname >> sargname2; sssstr >> sargname >> sargname2;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< sargname << " is " << sargname2 << std::endl; std::cout<< sargname << " is " << sargname2 << std::endl;
#endif #endif
//getting rid of dots //getting rid of dots
pos = sargname2.find("."); pos = sargname2.find(".");
while(pos != string::npos) while(pos != string::npos)
{ {
sargname2.erase( pos, 1 ); sargname2.erase( pos, 1 );
pos = sargname2.find("."); pos = sargname2.find(".");
} }
strcpy(thisDetector->clientMacAddress,sargname2.c_str()); strcpy(thisDetector->clientIPAddress,sargname2.c_str());
cout<<"macaddress:"<<thisDetector->clientMacAddress<<endl; cout<<"ipaddress:"<<thisDetector->clientIPAddress<<endl;
//ip address---------------
getline(infile,str);
iline++;
#ifdef VERBOSE
std::cout<< str << std::endl;
#endif
istringstream sssstr(str);
sssstr >> sargname >> sargname2;
#ifdef VERBOSE
std::cout<< sargname << " is " << sargname2 << std::endl;
#endif
//getting rid of dots
pos = sargname2.find(".");
while(pos != string::npos)
{
sargname2.erase( pos, 1 );
pos = sargname2.find(".");
}
strcpy(thisDetector->clientIPAddress,sargname2.c_str());
cout<<"ipaddress:"<<thisDetector->clientIPAddress<<endl;
infile.close(); infile.close();
strcpy(thisDetector->settingsFile,fname.c_str()); strcpy(thisDetector->settingsFile,fname.c_str());
return myMod; return myMod;
} else { } else {
std::cout<< "could not open settings file " << myfname << std::endl; std::cout<< "could not open settings file " << myfname << std::endl;
if (nflag) if (nflag)
deleteModule(myMod); deleteModule(myMod);
return NULL; return NULL;
} }
}; };
int gotthardDetector::writeSettingsFile(string fname, sls_detector_module mod){ int gotthardDetector::writeSettingsFile(string fname, sls_detector_module mod){