- Timestamp:
- 05/10/14 13:46:03 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/getevent.cc
r17771 r17820 32 32 control.add_options() 33 33 ("target,t", var<string>()->required(), "") 34 ("event,e", var<uint32_t>() ->required(), "")34 ("event,e", var<uint32_t>(), "") 35 35 ; 36 36 … … 161 161 } 162 162 */ 163 const uint32_t event = conf. Get<uint32_t>("event");163 const uint32_t event = conf.Has("event") ? conf.Get<uint32_t>("event") : 0; 164 164 165 165 zfits file(name); … … 176 176 const uint32_t nPix = file.GetUInt("NPIX"); 177 177 178 const double start = file.GetUInt("TSTARTI")+file.GetFloat("TSTARTF"); 179 const double stop = file.GetUInt("TSTOPI")+file.GetFloat("TSTOPF"); 180 181 const bool isDrsCalib = file.GetStr("DRSCALIB")=="T"; 182 const int16_t drsStep = isDrsCalib ? file.GetUInt("DRSSTEP") : -1; 183 const string runType = file.GetStr("RUNTYPE"); 184 const uint16_t scale = file.HasKey("SCALE") ? file.GetUInt("SCALE") : 0; 185 186 vector<char> run(80); 187 strncpy(run.data(), runType.c_str(), 79); 188 178 const bool isMC = file.HasKey("ISMC") && file.GetStr("ISMC")=="T"; 179 180 // Is drs calibration file? 181 const int8_t step = file.HasKey("STEP") ? file.GetUInt("STEP") : -1; 182 183 const string strbeg = isMC ? "DATE" : "RUN"+to_string(step)+"-BEG"; 184 const string strend = isMC ? "DATE" : "RUN"+to_string(step)+"-END"; 185 186 const double start = step==-1 && !isMC ? file.GetUInt("TSTARTI")+file.GetFloat("TSTARTF") : Time(file.GetStr(strbeg)).UnixDate(); 187 const double stop = step==-1 && !isMC ? file.GetUInt("TSTOPI")+file.GetFloat("TSTOPF") : Time(file.GetStr(strend)).UnixDate(); 188 189 const bool isDrsCalib = file.HasKey("DRSCALIB") && file.GetStr("DRSCALIB")=="T"; 190 const int16_t drsStep = isDrsCalib ? file.GetUInt("DRSSTEP") : step; 191 const string runType = step==-1 ? file.GetStr("RUNTYPE") : ""; 192 const uint16_t scale = file.HasKey("SCALE") ? file.GetUInt("SCALE") : (step==-1?0:10); 193 194 vector<char> run(80); 189 195 vector<int16_t> data(nRoi*nPix); 196 vector<float> mean(nRoi*nPix); 190 197 vector<uint32_t> unixTimeUTC(2); 191 198 … … 198 205 uint16_t triggerType; 199 206 200 file.SetRefAddress("EventNum", eventNum); 201 //file.SetRefAddress("TriggerNum", triggerNum); 202 file.SetRefAddress("TriggerType", triggerType); 203 file.SetVecAddress("UnixTimeUTC", unixTimeUTC); 204 file.SetVecAddress("Data", data); 205 206 if (!file.GetRow(event)) 207 if (step==-1) 208 { 209 file.SetRefAddress("EventNum", eventNum); 210 //file.SetRefAddress("TriggerNum", triggerNum); 211 file.SetRefAddress("TriggerType", triggerType); 212 if (!isMC) 213 file.SetVecAddress("UnixTimeUTC", unixTimeUTC); 214 } 215 216 switch (step) 217 { 218 case 0: file.SetVecAddress("BaselineMean", mean); strcpy( run.data(), "DRS (pedestal 1024)"); break; 219 case 1: file.SetVecAddress("GainMean", mean); strcpy( run.data(), "DRS (gain)"); break; 220 case 2: file.SetVecAddress("TriggerOffsetMean", mean); strcpy( run.data(), "DRS (pedestal roi)"); break; 221 default: file.SetVecAddress("Data", data); strncpy(run.data(), runType.c_str(), 79); break; 222 } 223 224 if (!file.GetRow(step==-1 ? event : 0)) 207 225 return 2; 226 227 if (step!=-1) 228 for (uint32_t i=0; i<nRoi*nPix; i++) 229 data[i] = round(mean[i]*10); 208 230 209 231 cout.write(run.data(), 80);
Note:
See TracChangeset
for help on using the changeset viewer.