Changeset 17727
- Timestamp:
- 04/29/14 16:15:57 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/viewer/index.php
r17722 r17727 111 111 switch ($format) 112 112 { 113 case 'd': $size = 8; break; 113 114 case 'L': $size = 4; break; 114 115 case 'S': $size = 2; break; … … 143 144 $filename = "/daq/raw/".$y."/".$m."/".$d."/".$y.$m.$d."_".$r.".fits.fz"; 144 145 146 if (!file_exists($filename)) 147 return header("HTTP/1.0 400 File '".$file."' not found."); 148 145 149 $file = popen("/home/fact/FACT++/getevent ".$filename." ".$event." 2> /dev/null", "r"); 146 150 if (!$file) 147 return header('HTTP/1.0 400 Could not open file.');151 return header('HTTP/1.0 400 Could not open pipe.'); 148 152 149 153 $evt = array(); 150 151 $evt['numEvents'] = get($file, "L"); 154 $fil = array(); 155 156 $fil['runType'] = fread($file, 80); 157 $fil['runStart'] = get($file, "d"); 158 $fil['runEnd'] = get($file, "d"); 159 $fil['drsFile'] = get($file, "s"); 160 $fil['numEvents'] = get($file, "L"); 152 161 $evt['numRoi'] = get($file, "L"); 153 162 $evt['numPix'] = get($file, "L"); … … 161 170 // Read the data and copy it from an associative array to an Array 162 171 // (this is just nicer and seems more logical) 163 //$data = array();164 172 $binary = array(); 165 173 for ($i=0; $i<$evt['numPix']; $i++) … … 176 184 } 177 185 178 //if (feof($file))179 // return;186 if (feof($file)) 187 return header('HTTP/1.0 400 Data from file incomplete.'); 180 188 181 189 pclose($file); 182 190 183 if ($ evt['numEvents']==0)191 if ($fil['numEvents']==0) 184 192 return header('HTTP/1.0 400 Could not read event.'); 185 193 186 // =============================== Copy waveform ============================= 187 194 // =========================== Decode trigger type =========================== 195 196 $typ = $evt['triggerType']; 197 $evt['trigger'] = array(); 198 if ($typ!=0 && ($typ & 0x8703)==0) 199 array_push($evt['trigger'], "PHYS"); 200 if (($typ&0x0100)!=0) 201 array_push($evt['trigger'], "LPext"); 202 if (($typ&0x0200)!=0) 203 array_push($evt['trigger'], "LPint"); 204 if (($typ&0x0400)!=0) 205 array_push($evt['trigger'], "PED"); 206 if (($typ&0x8000)!=0) 207 array_push($evt['trigger'], "TIM"); 208 if (($typ&0x0001)!=0) 209 array_push($evt['trigger'], "EXT1"); 210 if (($typ&0x0002)!=0) 211 array_push($evt['trigger'], "EXT2"); 212 213 // =============================== Some data ================================= 214 215 require_once("neighbors.php"); 216 217 $rc['neighbors'] = $neighbors; 188 218 $rc['event'] = $evt; 219 $rc['file'] = $fil; 189 220 $rc['event']['index'] = $event; 190 221 $rc['event']['pixel'] = $pixel; … … 237 268 //$v8->test = array();; 238 269 //$v8->data = array(); 239 $v8->event = $evt; 240 $v8->clone = function($data) { return $data; }; 241 $v8->unpack = function($i) 270 $v8->nroi = $evt['numRoi']; 271 $v8->npix = $evt['numPix']; 272 $v8->trigger = $evt['trigger']; 273 $v8->event = $evt; 274 $v8->file = $fil; 275 $v8->neighbors = $neighbors; 276 $v8->clone = function($data) { return $data; }; 277 $v8->unpack = function($i) 242 278 { 243 279 global $binary, $roi;
Note:
See TracChangeset
for help on using the changeset viewer.