#include <UberHeader.h>
Public Member Functions | |
| UberHeader () | |
| ~UberHeader () | |
| void | Print (Option_t *option="") const |
| Float_t | ReadTemperature () |
| Float_t | ReadBeamMomentum () |
| const char * | ReadComments () |
| const char * | ReadRunType () |
| const Int_t | GetRunNo () const |
| const char * | GetRunType () const |
| const time_t | GetStartTime () const |
| const Float_t | GetTemperature () const |
| const Float_t | GetBeamMomentum () const |
| const char * | GetComments () const |
| void | SetRunNo (Int_t r) |
| void | SetRunType (const char *rt) |
| void | SetStartTime (time_t t) |
| void | SetTemperature (Float_t temp) |
| void | SetBeamMomentum (Float_t p) |
| void | SetComments (const char *comm) |
Private Attributes | |
| Int_t | runno |
| char * | runtype |
| time_t | tstart |
| char * | tstartchar |
| Float_t | tmper |
| Float_t | beamp |
| char * | comments |
|
|
Definition at line 22 of file UberHeader.cxx. 00022 : 00023 runno(0), 00024 runtype(), 00025 tstart(0), 00026 tmper(0.), 00027 beamp(0.), 00028 comments() 00029 { 00030 tstartchar = new char[36]; 00031 }//end UberHeader() //_______________________________________________________________________________
|
|
|
Definition at line 33 of file UberHeader.cxx. References comments, MSG, runtype, and tstartchar. 00034 {
00035 MSG("UberHeader",Msg::kDebug)<<"Deleting UberHeader"<<endl;
00036 if(tstartchar!=0){
00037 delete tstartchar;
00038 tstartchar = 0;
00039 }
00040 if(comments!=0){
00041 delete comments;
00042 comments = 0;
00043 }
00044 if(runtype!=0){
00045 delete runtype;
00046 runtype = 0;
00047 }
00048
00049 }//end ~UberHeader()
|
|
|
Definition at line 51 of file UberHeader.h. 00051 {return beamp;}
|
|
|
Definition at line 52 of file UberHeader.h. Referenced by UberDST::EndJob(). 00052 {return comments;}
|
|
|
Definition at line 47 of file UberHeader.h. 00047 {return runno;}
|
|
|
Definition at line 48 of file UberHeader.h. 00048 {return runtype;}
|
|
|
Definition at line 49 of file UberHeader.h. Referenced by UberDST::Ana(). 00049 {return tstart;}
|
|
|
Definition at line 50 of file UberHeader.h. 00050 {return tmper;}
|
|
|
Definition at line 51 of file UberHeader.cxx. References beamp, comments, runno, runtype, tmper, and tstart. 00052 {
00053
00054 struct tm *t = localtime(&tstart);
00055 char date[33];
00056 strftime(date,32,"%B %d,%Y %X",t);
00057 cout<<"*******UberHeader:"<<endl
00058 <<"Run number "<<runno<<" Run Type "<<runtype<<endl
00059 <<"Start of run "<<date<<endl
00060 <<"Temperature "<<tmper<<" Beam Momentum "<<beamp<<endl
00061 <<"Comments "<<comments<<endl;
00062 }//end Print()
|
|
|
Definition at line 137 of file UberHeader.cxx. Referenced by UberDST::Ana(). 00138 {
00139 //parse Gordons kvp files which contain the runlog info
00140
00141 char *rldir = getenv("RUN_LOG_DIR");
00142 string runlogdir;
00143 if(rldir==NULL){
00144 runlogdir ="./";
00145 }
00146 else{
00147 runlogdir = rldir;
00148 }
00149
00150 stringstream rlf;
00151 rlf<<runlogdir<<"run-"<<runno<<".kvp"<<'\0';
00152 string runlogfile = rlf.str();
00153 // rlf.freeze(false);
00154 ifstream runlog(runlogfile.c_str());
00155 if(!runlog){
00156 MSG("UberHeader",Msg::kError)<<"Could not find file "
00157 <<runlogfile<<"Setting beam momentum to 0"<<endl;
00158 return 0.;
00159 }
00160
00161 char buffer[20480];
00162 string b;
00163 runlog.getline(buffer,20480,';');
00164 while(!runlog.eof()){
00165 MSG("UberHeader",Msg::kDebug)<<"buffer "<<buffer<<endl;
00166 b = buffer;
00167 if(b.substr(0,11)=="Beam Energy"){
00168 break;
00169 }
00170 runlog.getline(buffer,20480,';');
00171 }
00172
00173 string be = b.substr(b.find_first_of('=')+1,b.find_first_of('G')-1);
00174 MSG("UberHeader",Msg::kDebug)<<"beam energy "<<atof(be.c_str())<<endl;
00175 return atof(be.c_str());
00176
00177 }//end ReadBeamMomentum()
|
|
|
Definition at line 179 of file UberHeader.cxx. Referenced by UberDST::Ana(). 00180 {
00181 //parse Gordons kvp files which contain the runlog info
00182
00183 char *rldir = getenv("RUN_LOG_DIR");
00184 string runlogdir;
00185 if(rldir==NULL){
00186 runlogdir ="./";
00187 }
00188 else{
00189 runlogdir = rldir;
00190 }
00191
00192 stringstream rlf;
00193 rlf<<runlogdir<<"run-"<<runno<<".kvp"<<'\0';
00194 string runlogfile = rlf.str();
00195 // rlf.freeze(false);
00196 ifstream runlog(runlogfile.c_str());
00197 if(!runlog){
00198 MSG("UberHeader",Msg::kError)<<"Could not find file "
00199 <<runlogfile
00200 <<"Setting coments to empty string"<<endl;
00201 return ";";
00202 }
00203
00204 char buffer[20480];
00205 string b;
00206 string be="";
00207 runlog.getline(buffer,20480,';');
00208 while(!runlog.eof()){
00209 MSG("UberHeader",Msg::kDebug)<<"buffer "<<buffer<<endl;
00210 b = buffer;
00211 if(b.substr(0,8)=="comments"){
00212 // break;
00213 be += b.substr(b.find_first_of('=')+1);
00214 be+=";";
00215 }
00216
00217 runlog.getline(buffer,20480,';');
00218 }
00219
00220 MSG("UberHeader",Msg::kDebug)<<"comments "<<be.c_str()<<endl;
00221 return be.c_str();
00222
00223 }//end ReadComments()
|
|
|
Definition at line 242 of file UberHeader.cxx. Referenced by UberDST::Ana(). 00243 {
00244 //parse Gordons kvp files which contain the runlog info
00245
00246 char *rldir = getenv("RUN_LOG_DIR");
00247 string runlogdir;
00248 if(rldir==NULL){
00249 runlogdir ="./";
00250 }
00251 else{
00252 runlogdir = rldir;
00253 }
00254
00255 stringstream rlf;
00256 rlf<<runlogdir<<"run-"<<runno<<".kvp"<<'\0';
00257 string runlogfile = rlf.str();
00258 // rlf.freeze(false);
00259 ifstream runlog(runlogfile.c_str());
00260 if(!runlog){
00261 MSG("UberHeader",Msg::kError)<<"Could not find file "
00262 <<runlogfile
00263 <<"Setting coments to empty string"<<endl;
00264 return "";
00265 }
00266
00267 char buffer[20480];
00268 string b;
00269 runlog.getline(buffer,20480,';');
00270 while(!runlog.eof()){
00271 MSG("UberHeader",Msg::kDebug)<<"buffer "<<buffer<<endl;
00272 b = buffer;
00273 if(b.substr(0,11)=="runTypeName"){
00274 break;
00275 }
00276 runlog.getline(buffer,20480,';');
00277 }
00278
00279 string be = b.substr(b.find_first_of('=')+1);
00280
00281 MSG("UberHeader",Msg::kDebug)<<"RunType "<<(be.c_str())<<endl;
00282 return be.c_str();
00283
00284 }//end ReadRunType()
|
|
|
Definition at line 73 of file UberHeader.cxx. References TempReader::AddTemps(), TempReader::GetTempFromTime(), MSG, and tstart. Referenced by UberDST::Ana(). 00074 {
00075 TempReader tr;
00076
00077 char *tempdir = getenv("TEMPERATURE_REPROCESS_PATH");
00078 string tmd;
00079 if(tempdir==NULL){
00080 tmd="/data/0/Temperature/reprocessed/";
00081 }
00082 else{
00083 tmd = tempdir;
00084 }
00085 MSG("UberHeader",Msg::kDebug)<<"About to look for temp files in "<<tmd<<endl;
00086
00087 DIR *dfd;
00088 dirent *dp;
00089 if(!(dfd = opendir(tmd.c_str()))){
00090 MSG("UberHeader",Msg::kError)<<"Could not read directory "
00091 <<tmd<<" for temperature logs"<<endl;
00092 return 0.;
00093 }
00094
00095 set<string> tempnames;
00096 while((dp=readdir(dfd))!=NULL){
00097 if(strstr(dp->d_name,"-reprocessed.txt")!=NULL){
00098 tempnames.insert(dp->d_name);
00099 MSG("UberHeader",Msg::kDebug)<<"Added "<<dp->d_name<<" to set"<<endl;
00100 }
00101 }
00102
00103 stringstream fname;
00104 struct tm *ts = localtime(&(tstart));
00105 fname<<setw(4)<<setfill('0')<<ts->tm_year+1900
00106 <<"-"<<setw(2)<<setfill('0')<<ts->tm_mon+1
00107 <<"-"<<setw(2)<<setfill('0')<<ts->tm_mday<<"-reprocessed.txt"<<'\0';
00108 string filename = fname.str();
00109 // fname.freeze(false);
00110 MSG("UberHeader",Msg::kDebug)<<"Looking for "<<filename<<endl;
00111
00112 set<string>::iterator it(tempnames.lower_bound(filename));
00113 string firstfile ="";
00114 if(it!=tempnames.end()){
00115 firstfile = tmd+(*it);
00116 }
00117 MSG("UberHeader",Msg::kDebug)<<"firstfile "<<firstfile<<endl;
00118 string secondfile = "";
00119 if(it!=tempnames.begin()){
00120 secondfile = tmd+*(--it);
00121 }
00122 MSG("UberHeader",Msg::kDebug)<<"Current time filename "<<filename<<endl
00123 <<"Lower bound "<<firstfile<<endl
00124 <<"Previous "<<secondfile<<endl;
00125 tr.AddTemps(firstfile);
00126 tr.AddTemps(secondfile);
00127
00128 char date[33];
00129 strftime(date, 32, "%B %d,%Y %X", ts);
00130 MSG("UberHeader",Msg::kDebug)<<"DATE "<<date<<endl;
00131
00132 float temperature = tr.GetTempFromTime(tstart);
00133 MSG("UberHeader",Msg::kDebug)<<"Temperature "<<temperature<<endl;
00134 return temperature;
00135 }//end ReadTemperature()
|
|
|
Definition at line 55 of file UberHeader.h. References beamp. Referenced by UberDST::Ana(). 00055 {beamp = p;}
|
|
|
Definition at line 228 of file UberHeader.cxx. Referenced by UberDST::Ana(). 00229 {
00230 int i=0;
00231 while(comm[i]!='\0'){
00232 i++;
00233 }
00234 i++;
00235
00236 comments = new char[i];
00237 sprintf(comments, "%s",comm);
00238
00239 MSG("UberHeader",Msg::kDebug)<<"comments from set "<<comments<<endl;
00240 }//SetComments()
|
|
|
Definition at line 53 of file UberHeader.h. References runno. Referenced by UberDST::Get(). 00053 {runno = r;}
|
|
|
Definition at line 289 of file UberHeader.cxx. References runtype. Referenced by UberDST::Ana(). 00290 {
00291 int i=0;
00292 while(rt[i]!='\0'){
00293 i++;
00294 }
00295 i++;
00296 runtype = new char[i];
00297 sprintf(runtype, "%s",rt);
00298
00299 }//end SetRunType()
|
|
|
Definition at line 64 of file UberHeader.cxx. References tstart, and tstartchar. Referenced by UberDST::Ana(). 00065 {
00066
00067 // tstart = mktime(ts);
00068 tstart = t;
00069 struct tm *ts = gmtime(&t);
00070 strftime(tstartchar, 35, "%B %d,%Y %X", ts);
00071 }//end SetStartTime()
|
|
|
Definition at line 54 of file UberHeader.h. References tmper. Referenced by UberDST::Ana(). 00054 {tmper = temp;}
|
|
|
Definition at line 41 of file UberHeader.h. Referenced by Print(), and SetBeamMomentum(). |
|
|
Definition at line 42 of file UberHeader.h. Referenced by Print(), SetComments(), and ~UberHeader(). |
|
|
Definition at line 36 of file UberHeader.h. Referenced by Print(), ReadBeamMomentum(), ReadComments(), ReadRunType(), and SetRunNo(). |
|
|
Definition at line 37 of file UberHeader.h. Referenced by Print(), SetRunType(), and ~UberHeader(). |
|
|
Definition at line 40 of file UberHeader.h. Referenced by Print(), and SetTemperature(). |
|
|
Definition at line 38 of file UberHeader.h. Referenced by Print(), ReadTemperature(), and SetStartTime(). |
|
|
Definition at line 39 of file UberHeader.h. Referenced by SetStartTime(), and ~UberHeader(). |
1.3.9.1