Changeset 17145
- Timestamp:
- 09/07/13 17:28:31 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/fact/processing/drstemp.C
r15225 r17145 1 void drstemp (const char *fname, double beg=0, double end=100000)1 void drstemp82(fits &file, double beg, double end) 2 2 { 3 fits file(fname);4 5 //file.PrintColumns();6 //file.PrintKeys();7 8 Double_t time;9 Float_t temp[82];10 file.SetPtrAddress("Time", &time);11 file.SetPtrAddress("temp", temp);12 13 3 UInt_t offset = file.GetUInt("MJDREF"); 14 4 if (beg < 30000) … … 16 6 if (end < 30000) 17 7 end+=offset; 8 9 double time; 10 file.SetPtrAddress("Time", &time); 11 12 float *temp = file.SetPtrAddress("temp"); 18 13 19 14 double avgmin = 0; … … 90 85 cout << "result " << avgmin << " " << avgmax << " " << rmsmin << " " << rmsmax << endl; 91 86 } 87 88 void drstemp160(fits &file, double beg, double end) 89 { 90 UInt_t offset = file.GetUInt("MJDREF"); 91 if (beg < 30000) 92 beg+=offset; 93 if (end < 30000) 94 end+=offset; 95 96 double time; 97 file.SetPtrAddress("Time", &time); 98 99 float *temp = file.SetPtrAddress("temp"); 100 101 double avg = 0; 102 double rms = 0; 103 104 int cnt = 0; 105 106 double lastavg = -1; 107 double lastrms = -1; 108 109 double diff = -1; 110 111 while (file.GetNextRow()) 112 { 113 time += offset; 114 115 if (time>end) 116 break; 117 118 double mn = 0; 119 double rn = 0; 120 for (int i=0; i<=160; i++) 121 { 122 mn += temp[i]; 123 rn += temp[i]*temp[i]; 124 } 125 mn /= 160; 126 rn /= 160; 127 128 if (time<beg) 129 { 130 lastavg = mn; 131 lastrms = sqrt(rn-mn*mn); 132 diff = beg-time; 133 continue; 134 } 135 136 avg += mn; 137 rms += sqrt(rn-mn*mn); 138 139 cnt ++; 140 } 141 142 if (cnt==0) 143 { 144 if (diff<5./24/3600) 145 return; 146 147 cout << "result " << lastavg << " " << lastavg << " " << lastrms << " " << lastrms << endl; 148 return; 149 } 150 151 avg /= cnt; 152 rms /= cnt; 153 154 cout << "result " << avg << " " << avg << " " << rms << " " << rms << endl; 155 } 156 157 void drstemp(const char *fname, double beg=0, double end=100000) 158 { 159 fits file(fname); 160 161 //file.PrintColumns(); 162 //file.PrintKeys(); 163 164 float temp[160]; 165 if (file.SetPtrAddress("temp", temp, 82)) 166 { 167 drstemp82(file, beg, end); 168 return; 169 } 170 171 file.SetPtrAddress("temp", temp, 160); 172 drstemp160(file, beg, end); 173 }
Note:
See TracChangeset
for help on using the changeset viewer.