| 1 | <!DOCTYLE HTML> | 
|---|
| 2 | <html> | 
|---|
| 3 | <head> | 
|---|
| 4 | <link rel="stylesheet" href="jquery-ui-1.10.4.custom/css/smoothness/jquery-ui-1.10.4.custom.min.css"/> | 
|---|
| 5 | <script src="jquery-2.1.0.min.js"></script> | 
|---|
| 6 | <script src="jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.min.js"></script> | 
|---|
| 7 |  | 
|---|
| 8 | <link rel="stylesheet" href="codemirror-4.1/lib/codemirror.css"/> | 
|---|
| 9 | <!--<link rel="stylesheet" href="codemirror-4.1/theme/myblackboard.css"/>--> | 
|---|
| 10 | <!--<link rel="stylesheet" href="codemirror-4.1/theme/blackboard.css">--> | 
|---|
| 11 | <!--<link rel="stylesheet" href="codemirror-4.1/theme/3024-night.css">--> | 
|---|
| 12 | <link rel="stylesheet" href="codemirror-4.1/addon/display/fullscreen.css"/> | 
|---|
| 13 | <link rel="stylesheet" href="codemirror-4.1/addon/dialog/dialog.css"/> | 
|---|
| 14 | <link rel="stylesheet" href="codemirror-4.1/addon/fold/foldgutter.css"/> | 
|---|
| 15 | <link rel="stylesheet" href="codemirror-4.1/addon/lint/lint.css"/> | 
|---|
| 16 | <script src="codemirror-4.1.min.js"></script> | 
|---|
| 17 | <!-- | 
|---|
| 18 | <script src="codemirror-4.1/lib/codemirror.js"></script> | 
|---|
| 19 | <script src="codemirror-4.1/mode/javascript/javascript.js"></script> | 
|---|
| 20 | <script src="codemirror-4.1/addon/selection/active-line.js"></script> | 
|---|
| 21 | <script src="codemirror-4.1/addon/fold/brace-fold.js"></script> | 
|---|
| 22 | <script src="codemirror-4.1/addon/runmode/colorize.js"></script> | 
|---|
| 23 | <script src="codemirror-4.1/addon/fold/comment-fold.js"></script> | 
|---|
| 24 | <script src="codemirror-4.1/addon/dialog/dialog.js"></script> | 
|---|
| 25 | <script src="codemirror-4.1/addon/fold/foldcode.js"></script> | 
|---|
| 26 | <script src="codemirror-4.1/addon/fold/foldgutter.js"></script> | 
|---|
| 27 | <script src="codemirror-4.1/addon/display/fullscreen.js"></script> | 
|---|
| 28 | <script src="codemirror-4.1/addon/hint/javascript-hint.js"></script> | 
|---|
| 29 | <script src="codemirror-4.1/addon/lint/lint.js"></script> | 
|---|
| 30 | <script src="codemirror-4.1/addon/lint/javascript-lint.js"></script> | 
|---|
| 31 | <script src="codemirror-4.1/addon/search/match-highlighter.js"></script> | 
|---|
| 32 | <script src="codemirror-4.1/addon/edit/matchbrackets.js"></script> | 
|---|
| 33 | <script src="codemirror-4.1/addon/runmode/runmode.js"></script> | 
|---|
| 34 | <script src="codemirror-4.1/addon/search/search.js"></script> | 
|---|
| 35 | <script src="codemirror-4.1/addon/search/searchcursor.js"></script> | 
|---|
| 36 | <script src="codemirror-4.1/addon/hint/show-hint.js"></script> | 
|---|
| 37 | --> | 
|---|
| 38 | <script src="flot-0.8.3/jquery.flot.min.js"></script> | 
|---|
| 39 | <script src="flot-0.8.3/jquery.flot.selection.min.js"></script> | 
|---|
| 40 | <script src="flot-0.8.3/jquery.flot.symbol.min.js"></script> | 
|---|
| 41 | <script src="flot-0.8.3/jquery.flot.resize.js"></script> | 
|---|
| 42 | <script src="jshint.js"></script> | 
|---|
| 43 | <script src="index.js"></script> | 
|---|
| 44 |  | 
|---|
| 45 | <link rel="stylesheet" href="index.css"/> | 
|---|
| 46 | </head> | 
|---|
| 47 |  | 
|---|
| 48 | <body> | 
|---|
| 49 |  | 
|---|
| 50 | <div id='tooltip' style="z-index:1000;position:absolute;display:none;border:1px solid #fdd;padding;2px;background-color:#fee;opacity:0.8"></div> | 
|---|
| 51 |  | 
|---|
| 52 | <div class="myaccordion" id="accordion5"> | 
|---|
| 53 | <h3><a href="#">Editor 1 (proc)</a></h3> | 
|---|
| 54 | <div id="editorcontainer1fake" style="position:absolute;border:0;opacity:0"></div> | 
|---|
| 55 | </div> | 
|---|
| 56 | <div id="editorcontainer1" style="z-index:600;"> | 
|---|
| 57 | <form action="index.php" method="post" style="margin-bottom:0px"> | 
|---|
| 58 | <div id="textcontainer1"> | 
|---|
| 59 | <textarea id="editor1" name="editor1" type="textarea"> | 
|---|
| 60 | return $.data[pixel]; | 
|---|
| 61 | </textarea> | 
|---|
| 62 | </div> | 
|---|
| 63 | <div class="ui-widget-content" style="background:#333;color:#eef;border-top-width:0;padding-top:2px;"> | 
|---|
| 64 | <input type="submit" value="Save"></input> | 
|---|
| 65 | <input type="file" name="files[]" id="selectfile1"></input><output id="file1"></output> | 
|---|
| 66 | </div> | 
|---|
| 67 | </form> | 
|---|
| 68 | </div> | 
|---|
| 69 |  | 
|---|
| 70 | <div class="myaccordion" id="accordion1"> | 
|---|
| 71 | <h3><a href="#">Editor 2 (main)</a></h3> | 
|---|
| 72 | <div id="editorcontainer2fake" style="position:absolute;border:0;opacity:0"></div> | 
|---|
| 73 | </div> | 
|---|
| 74 | <div id="editorcontainer2"> | 
|---|
| 75 | <form action="index.php" method="post" style="margin-bottom:0px"> | 
|---|
| 76 | <div id="textcontainer2"> | 
|---|
| 77 | <textarea id="editor2" name="editor2" type="textarea"> | 
|---|
| 78 | print("This output will go to the virtual Console.\n"); | 
|---|
| 79 |  | 
|---|
| 80 | // The four first values of pixel 1 | 
|---|
| 81 | var arr = [ $.data[1][0], $.data[1][1], $.data[1][2], $.data[1][3] ]; | 
|---|
| 82 | print("Pixel 1: [ "+arr+" ]\n"); | 
|---|
| 83 |  | 
|---|
| 84 | // Get the maximum sample from each pixel | 
|---|
| 85 | var rc = [new Array(1440),new Array(1440)]; | 
|---|
| 86 | for (var p=0; p<$.event.numPix; p++) | 
|---|
| 87 | { | 
|---|
| 88 | var max =  0; | 
|---|
| 89 | var idx = -1; | 
|---|
| 90 | for (var s=5; s<$.event.numRoi-60; s++) | 
|---|
| 91 | { | 
|---|
| 92 | // spike suppression | 
|---|
| 93 | var h = ($.data[p][s]-$.data[p][s-1]) + ($.data[p][s]-$.data[p][s+1]); | 
|---|
| 94 |  | 
|---|
| 95 | if ($.data[p][s]>max && h<20) | 
|---|
| 96 | { | 
|---|
| 97 | max = $.data[p][s]; | 
|---|
| 98 | idx = s; | 
|---|
| 99 | } | 
|---|
| 100 | } | 
|---|
| 101 | rc[0][p]=idx<0 ? null : max; | 
|---|
| 102 | rc[1][p]=idx<0 ? null : idx; | 
|---|
| 103 | } | 
|---|
| 104 |  | 
|---|
| 105 | return rc; | 
|---|
| 106 | </textarea> | 
|---|
| 107 | </div> | 
|---|
| 108 | <div class="ui-widget-content" style="background:#333;color:white;border-top-width:0;padding-top:2px;"> | 
|---|
| 109 | <input type="submit" value="Save"></input> | 
|---|
| 110 | <input type="file" name="files[]" id="selectfile2"></input><output id="file2"></output> | 
|---|
| 111 | </div> | 
|---|
| 112 | </form> | 
|---|
| 113 | </div> | 
|---|
| 114 |  | 
|---|
| 115 | <div class="myaccordion" id="accordion" style="margin-bottom:1ex"> | 
|---|
| 116 | <h3><a  style="color:red" href="#">Runtime error</a></h3> | 
|---|
| 117 | <div> | 
|---|
| 118 | <pre id="error" style="color:red"></pre> | 
|---|
| 119 | </div> | 
|---|
| 120 | <h3><a href="#">Console</a></h3> | 
|---|
| 121 | <div> | 
|---|
| 122 | <pre style="color:green" id="console"></pre> | 
|---|
| 123 | </div> | 
|---|
| 124 | <h3><a href="#">Run info</a></h3> | 
|---|
| 125 | <div> | 
|---|
| 126 | <pre id="runinfo"></pre> | 
|---|
| 127 | </div> | 
|---|
| 128 | <h3><a href="#">Debug</a></h3> | 
|---|
| 129 | <div id="debug"> | 
|---|
| 130 | </div> | 
|---|
| 131 | </div> | 
|---|
| 132 |  | 
|---|
| 133 | <div class="ui-widget-content" style="background:#eee;margin-top:-10px"> | 
|---|
| 134 | <input id="submit"  type="button" onclick="onSubmit();" value="Submit"></input> | 
|---|
| 135 | <span style="float:right;white-space:nowrap;"> | 
|---|
| 136 | <span id="txtmontecarlo" style="color:darkgrey;">MC</span> | 
|---|
| 137 | <input id="montecarlo" style="margin-left:0px;margin-right:5px;" type="checkbox" onclick="onSubmit();" disabled="true"></input> | 
|---|
| 138 | <span id="txtdrsfile">DRS</span> | 
|---|
| 139 | <input id="drsfile" style="margin-left:0px;margin-right:5px;" type="checkbox" onclick="onSubmit();"></input> | 
|---|
| 140 | <span id="txtcalibrated">Cal</span> | 
|---|
| 141 | <input id="calibrated" style="margin-left:0px;margin-right:5px;" type="checkbox" onclick="onSubmit();"></input> | 
|---|
| 142 | Run | 
|---|
| 143 | <input id="file" style="width:100px"></input> | 
|---|
| 144 | </span> | 
|---|
| 145 |   | 
|---|
| 146 | <span style="white-space:nowrap"> | 
|---|
| 147 | Evt | 
|---|
| 148 | <input id="event" style="text-align:right;" type="number" onchange="onEvent();"  value="0" min="0" max="0"    step="1"></input>/<span id="numevents">---</span> | 
|---|
| 149 | </span> | 
|---|
| 150 |   | 
|---|
| 151 | <span style="white-space:nowrap"> | 
|---|
| 152 | Pix | 
|---|
| 153 | <input id="pixel" style="text-align:right;width:50px;" type="number" onchange="onPixel();"  value="0" min="0" max="1439" step="1"></input> | 
|---|
| 154 | </span> | 
|---|
| 155 |   | 
|---|
| 156 | <span style="white-space:nowrap"> | 
|---|
| 157 | CBPX | 
|---|
| 158 | <input id="cbpx-c" style="text-align:right;width:30px;" type="number" onchange="onCBPX();"  value="1" min="0" max="3" step="1"></input> | 
|---|
| 159 | <input id="cbpx-b" style="text-align:right;width:30px;" type="number" onchange="onCBPX();"  value="0" min="0" max="9" step="1"></input> | 
|---|
| 160 | <input id="cbpx-p" style="text-align:right;width:30px;" type="number" onchange="onCBPX();"  value="3" min="0" max="3" step="1"></input> | 
|---|
| 161 | <input id="cbpx-x" style="text-align:right;width:30px;" type="number" onchange="onCBPX();"  value="6" min="0" max="8" step="1"></input> | 
|---|
| 162 | = | 
|---|
| 163 | <input id="cbpx"   style="text-align:right;width:50px;" type="number" onchange="onHW();"  value="393" min="0" max="1439" step="1"></input> | 
|---|
| 164 | </span> | 
|---|
| 165 | </div> | 
|---|
| 166 |  | 
|---|
| 167 | <div class="myaccordion" id="accordion2"> | 
|---|
| 168 | <h3><a href="#">Camera display</a></h3> | 
|---|
| 169 | </div> | 
|---|
| 170 | <div id="cameracontainer" class="ui-widget-content"> | 
|---|
| 171 | <table width="100%"> | 
|---|
| 172 | <colgroup> | 
|---|
| 173 | <col style="width:38.5%;"> | 
|---|
| 174 | <col style="width:23%;"> | 
|---|
| 175 | <col style="width:38.5%;"> | 
|---|
| 176 | </colgroup> | 
|---|
| 177 | <tr> | 
|---|
| 178 | <td> | 
|---|
| 179 | <span style="white-space:nowrap;margin-right:2px;"> | 
|---|
| 180 | Min | 
|---|
| 181 | <input id="cameramin1"   style="text-align:right;width:100px;" type="number"   onchange="onCameraMinMax(1);"  value="0" disabled="true"></input> | 
|---|
| 182 | <input id="cameraminon1" style="margin-left:0px;" type="checkbox" onclick="onCameraMinMaxOn(1);" checked="true"></input> | 
|---|
| 183 | </span> | 
|---|
| 184 | <span style="white-space:nowrap"> | 
|---|
| 185 | Max | 
|---|
| 186 | <input id="cameramax1"   style="text-align:right;width:100px;" type="number"   onchange="onCameraMinMax(1);"  value="0" disabled="true"></input> | 
|---|
| 187 | <input id="cameramaxon1" style="margin-left:0px;" type="checkbox" onclick="onCameraMinMaxOn(1);" checked="true"></input> | 
|---|
| 188 | </span> | 
|---|
| 189 | </td> | 
|---|
| 190 | <td style="text-align:center" id="eventinfo"> | 
|---|
| 191 | </td> | 
|---|
| 192 | <td style="text-align:right"> | 
|---|
| 193 | <span style="white-space:nowrap"> | 
|---|
| 194 | Min | 
|---|
| 195 | <input id="cameramin2"   style="text-align:right;width:100px;" type="number"   onchange="onCameraMinMax(2);"  value="0" disabled="true"></input> | 
|---|
| 196 | <input id="cameraminon2" style="margin-left:0px;" type="checkbox" onclick="onCameraMinMaxOn(2);" checked="true"></input> | 
|---|
| 197 | </span> | 
|---|
| 198 | <span style="white-space:nowrap;margin-left:2px;"> | 
|---|
| 199 | Max | 
|---|
| 200 | <input id="cameramax2"   style="text-align:right;width:100px;" type="number"   onchange="onCameraMinMax(2);"  value="0" disabled="true"></input> | 
|---|
| 201 | <input id="cameramaxon2" style="margin-left:0px;" type="checkbox" onclick="onCameraMinMaxOn(2);" checked="true"></input> | 
|---|
| 202 | </span> | 
|---|
| 203 | </td> | 
|---|
| 204 | <td> | 
|---|
| 205 | </td> | 
|---|
| 206 | </tr> | 
|---|
| 207 | </table> | 
|---|
| 208 |  | 
|---|
| 209 | <table id="table" width="100%" border="0" style="border:0;margin:0;padding:0;"> | 
|---|
| 210 | <tr style="margin:0;padding:0;"> | 
|---|
| 211 | <td style="margin:0;padding:0;"> | 
|---|
| 212 | <table border="0" style="margin:0;padding:0;"> | 
|---|
| 213 | <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="contcamera1"></tr> | 
|---|
| 214 | <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="contcamera3"><canvas id="camera3" width="1" height="1"></canvas></td></tr> | 
|---|
| 215 | </table> | 
|---|
| 216 | </td> | 
|---|
| 217 | <td style="margin:0;padding:0;" id="centercamera"><canvas id="camera1" width="1" height="1"></canvas></td> | 
|---|
| 218 | <td style="margin:0;padding:0;"> | 
|---|
| 219 | <table border="0" style="margin:0;padding:0;"> | 
|---|
| 220 | <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="contcamera2"><canvas id="camera2" width="1" height="1"></canvas></td></tr> | 
|---|
| 221 | <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="contcamera4"><canvas id="camera4" width="1" height="1"></canvas></td></tr> | 
|---|
| 222 | </table> | 
|---|
| 223 | </td> | 
|---|
| 224 | </tr> | 
|---|
| 225 | </table> | 
|---|
| 226 |  | 
|---|
| 227 | <table width="100%"> | 
|---|
| 228 | <colgroup> | 
|---|
| 229 | <col style="width:38.5%;"> | 
|---|
| 230 | <col style="width:23%;"> | 
|---|
| 231 | <col style="width:38.5%;"> | 
|---|
| 232 | </colgroup> | 
|---|
| 233 | <tr> | 
|---|
| 234 | <td> | 
|---|
| 235 | <span style="white-space:nowrap;margin-right:2px;"> | 
|---|
| 236 | Min | 
|---|
| 237 | <input id="cameramin3"   style="text-align:right;width:100px;" type="number"   onchange="onCameraMinMax(3);"  value="0" disabled="true"></input> | 
|---|
| 238 | <input id="cameraminon3" style="margin-left:0px;" type="checkbox" onclick="onCameraMinMaxOn(3);" checked="true"></input> | 
|---|
| 239 | </span> | 
|---|
| 240 | <span style="white-space:nowrap"> | 
|---|
| 241 | Max | 
|---|
| 242 | <input id="cameramax3"   style="text-align:right;width:100px;" type="number"   onchange="onCameraMinMax(3);"  value="0" disabled="true"></input> | 
|---|
| 243 | <input id="cameramaxon3" style="margin-left:0px;" type="checkbox" onclick="onCameraMinMaxOn(3);" checked="true"></input> | 
|---|
| 244 | </span> | 
|---|
| 245 | </td> | 
|---|
| 246 | <td style="text-align:center;"> | 
|---|
| 247 | <span style="white-space:nowrap;margin-left:1px;margin-right:1px;"><input id="grid"   type="checkbox" onclick="refreshCameras();" checked="true">Grid</input></span> | 
|---|
| 248 | <span style="white-space:nowrap;margin-left:1px;margin-right:1px;"><input id="marker" type="checkbox" onclick="refreshCameras();" checked="true">Marker</input></span> | 
|---|
| 249 | <span style="white-space:nowrap;margin-left:1px;margin-right:1px;"><input id="image"  type="checkbox" onclick="refreshCameras();">Image</input></span> | 
|---|
| 250 | <!--Pixel value: | 
|---|
| 251 | <input id="value" type="text" readonly="true"  value="0" style="text-align:right;width:100px"></input>--> | 
|---|
| 252 | </td> | 
|---|
| 253 | <td style="text-align:right"> | 
|---|
| 254 | <span style="white-space:nowrap"> | 
|---|
| 255 | Min | 
|---|
| 256 | <input id="cameramin4"   style="text-align:right;width:100px;" type="number"   onchange="onCameraMinMax(4);"  value="0" disabled="true"></input> | 
|---|
| 257 | <input id="cameraminon4" style="margin-left:0px;" type="checkbox" onclick="onCameraMinMaxOn(4);" checked="true"></input> | 
|---|
| 258 | </span> | 
|---|
| 259 | <span style="white-space:nowrap;margin-left:2px;"> | 
|---|
| 260 | Max | 
|---|
| 261 | <input id="cameramax4"   style="text-align:right;width:100px;" type="number"   onchange="onCameraMinMax(4);"  value="0" disabled="true"></input> | 
|---|
| 262 | <input id="cameramaxon4" style="margin-left:0px;" type="checkbox" onclick="onCameraMinMaxOn(4);" checked="true"></input> | 
|---|
| 263 | </span> | 
|---|
| 264 | </td> | 
|---|
| 265 | </tr> | 
|---|
| 266 | </table> | 
|---|
| 267 | </div> | 
|---|
| 268 |  | 
|---|
| 269 | <div class="myaccordion" id="accordion7"> | 
|---|
| 270 | <h3><a href="#">Histograms</a></h3> | 
|---|
| 271 | </div> | 
|---|
| 272 | <div id="histcontainer" class="ui-widget-content"> | 
|---|
| 273 | <table width="100%"> | 
|---|
| 274 | <colgroup> | 
|---|
| 275 | <col style="width:40%;"> | 
|---|
| 276 | <col style="width:20%;"> | 
|---|
| 277 | <col style="width:40%;"> | 
|---|
| 278 | </colgroup> | 
|---|
| 279 | <tr> | 
|---|
| 280 | <td> | 
|---|
| 281 | <span style="white-space:nowrap;margin-right:2px;"> | 
|---|
| 282 | Min | 
|---|
| 283 | <input id="histmin1"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(1);"  value="0" disabled="true"></input> | 
|---|
| 284 | <input id="histminon1" style="margin-left:0px;" type="checkbox" onclick="onHistMinMaxOn(1);" checked="true"></input> | 
|---|
| 285 | </span> | 
|---|
| 286 | <span style="white-space:nowrap"> | 
|---|
| 287 | Max | 
|---|
| 288 | <input id="histmax1"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(1);"  value="0" disabled="true"></input> | 
|---|
| 289 | <input id="histmaxon1" style="margin-left:0px;" type="checkbox" onclick="onHistMinMaxOn(1);" checked="true"></input> | 
|---|
| 290 | </span> | 
|---|
| 291 | </td> | 
|---|
| 292 | <td style="text-align:center" id="eventinfo"> | 
|---|
| 293 | </td> | 
|---|
| 294 | <td style="text-align:right"> | 
|---|
| 295 | <span style="white-space:nowrap"> | 
|---|
| 296 | Min | 
|---|
| 297 | <input id="histmin2"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(2);"  value="0" disabled="true"></input> | 
|---|
| 298 | <input id="histminon2" style="margin-left:0px;" type="checkbox" onclick="onHistMinMaxOn(2);" checked="true"></input> | 
|---|
| 299 | </span> | 
|---|
| 300 | <span style="white-space:nowrap;margin-left:2px;"> | 
|---|
| 301 | Max | 
|---|
| 302 | <input id="histmax2"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(2);"  value="0" disabled="true"></input> | 
|---|
| 303 | <input id="histmaxon2" style="margin-left:0px;" type="checkbox" onclick="onHistMinMaxOn(2);" checked="true"></input> | 
|---|
| 304 | </span> | 
|---|
| 305 | </td> | 
|---|
| 306 | <td> | 
|---|
| 307 | </td> | 
|---|
| 308 | </tr> | 
|---|
| 309 | </table> | 
|---|
| 310 |  | 
|---|
| 311 | <table id="table" width="100%" border="0" style="border:0;margin:0;padding:0;"> | 
|---|
| 312 | <tr style="margin:0;padding:0;"> | 
|---|
| 313 | <td style="margin:0;padding:0;"> | 
|---|
| 314 | <table border="0" style="margin:0;padding:0;"> | 
|---|
| 315 | <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="conthist1"></tr> | 
|---|
| 316 | <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="conthist3"><div style="width:1px;height:1px;" id="hist3"></div></td></tr> | 
|---|
| 317 | </table> | 
|---|
| 318 | </td> | 
|---|
| 319 | <td style="margin:0;padding:0;" id="centerhist"><div style="width:1px;height:1px;" id="hist1"></div></td> | 
|---|
| 320 | <td style="margin:0;padding:0;"> | 
|---|
| 321 | <table border="0" style="margin:0;padding:0;"> | 
|---|
| 322 | <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="conthist2"><div style="width:1px;height:1px;" id="hist2"></div></td></tr> | 
|---|
| 323 | <tr style="margin:0;padding:0;"><td style="margin:0;padding:0;" id="conthist4"><div style="width:1px;height:1px;" id="hist4"></div></td></tr> | 
|---|
| 324 | </table> | 
|---|
| 325 | </td> | 
|---|
| 326 | </tr> | 
|---|
| 327 | </table> | 
|---|
| 328 |  | 
|---|
| 329 | <table width="100%"> | 
|---|
| 330 | <colgroup> | 
|---|
| 331 | <col style="width:50%;"> | 
|---|
| 332 | <col style="width:50%;"> | 
|---|
| 333 | </colgroup> | 
|---|
| 334 | <tr> | 
|---|
| 335 | <td> | 
|---|
| 336 | <span style="white-space:nowrap;margin-right:2px;"> | 
|---|
| 337 | Min | 
|---|
| 338 | <input id="histmin3"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(3);"  value="0" disabled="true"></input> | 
|---|
| 339 | <input id="histminon3" style="margin-left:0px;" type="checkbox" onclick="onHistMinMaxOn(3);" checked="true"></input> | 
|---|
| 340 | </span> | 
|---|
| 341 | <span style="white-space:nowrap"> | 
|---|
| 342 | Max | 
|---|
| 343 | <input id="histmax3"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(3);"  value="0" disabled="true"></input> | 
|---|
| 344 | <input id="histmaxon3" style="margin-left:0px;" type="checkbox" onclick="onHistMinMaxOn(3);" checked="true"></input> | 
|---|
| 345 | </span> | 
|---|
| 346 | </td> | 
|---|
| 347 | <td style="text-align:right"> | 
|---|
| 348 | <span style="white-space:nowrap"> | 
|---|
| 349 | Min | 
|---|
| 350 | <input id="histmin4"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(4);"  value="0" disabled="true"></input> | 
|---|
| 351 | <input id="histminon4" style="margin-left:0px;" type="checkbox" onclick="onHistMinMaxOn(4);" checked="true"></input> | 
|---|
| 352 | </span> | 
|---|
| 353 | <span style="white-space:nowrap;margin-left:2px;"> | 
|---|
| 354 | Max | 
|---|
| 355 | <input id="histmax4"   style="text-align:right;width:100px;" type="number"   onchange="onHistMinMax(4);"  value="0" disabled="true"></input> | 
|---|
| 356 | <input id="histmaxon4" style="margin-left:0px;" type="checkbox" onclick="onHistMinMaxOn(4);" checked="true"></input> | 
|---|
| 357 | </span> | 
|---|
| 358 | </td> | 
|---|
| 359 | </tr> | 
|---|
| 360 | </table> | 
|---|
| 361 | </div> | 
|---|
| 362 |  | 
|---|
| 363 | <div class="myaccordion" id="accordion3"> | 
|---|
| 364 | <h3><a href="#">Waveform</a></h3> | 
|---|
| 365 | </div> | 
|---|
| 366 | <div id="waveformcontainer"  class="ui-widget-content"> | 
|---|
| 367 | <div id="waveform" style="width:100%;height:300px;"></div> | 
|---|
| 368 | <table style="width:100%"> | 
|---|
| 369 | <colgroup> | 
|---|
| 370 | <col style="width:33%;"> | 
|---|
| 371 | <col style="width:66%;"> | 
|---|
| 372 | </colgroup> | 
|---|
| 373 | <tr> | 
|---|
| 374 | <td style="text-align:left;margin-right:2px;"> | 
|---|
| 375 | <span style="white-space:nowrap;float:left"> | 
|---|
| 376 | Xmin | 
|---|
| 377 | <input id="waveformxmin"   style="width:55px;text-align:right"type="number"   onchange="onWaveformMinMax();"  value="0" disabled="true"></input> | 
|---|
| 378 | <input id="waveformxminon" style="margin-left:0px;" type="checkbox" onclick="onWaveformMinMaxOn();" checked="true"></input> | 
|---|
| 379 | </span> | 
|---|
| 380 | <span style="white-space:nowrap;float:left"> | 
|---|
| 381 | Xmax | 
|---|
| 382 | <input id="waveformxmax"   style="width:55px;text-align:right"type="number"   onchange="onWaveformMinMax();"  value="0" disabled="true"></input> | 
|---|
| 383 | <input id="waveformxmaxon" style="margin-left:0px;" type="checkbox" onclick="onWaveformMinMaxOn();" checked="true"></input> | 
|---|
| 384 | </span> | 
|---|
| 385 | </td> | 
|---|
| 386 | <td style="text-align:right"> | 
|---|
| 387 | <span style="white-space:nowrap;"> | 
|---|
| 388 | Ymin | 
|---|
| 389 | <input id="waveformmin"   style="text-align:right"type="number"   onchange="onWaveformMinMax();"  value="0" disabled="true"></input> | 
|---|
| 390 | <input id="waveformminon" style="margin-left:0px;" type="checkbox" onclick="onWaveformMinMaxOn();" checked="true"></input> | 
|---|
| 391 | </span> | 
|---|
| 392 | <span style="white-space:nowrap;margin-left:2px;"> | 
|---|
| 393 | Ymax | 
|---|
| 394 | <input id="waveformmax"   style="text-align:right"type="number"   onchange="onWaveformMinMax();"  value="0" disabled="true"></input> | 
|---|
| 395 | <input id="waveformmaxon" style="margin-left:0px;" type="checkbox" onclick="onWaveformMinMaxOn();" checked="true"></input> | 
|---|
| 396 | </span> | 
|---|
| 397 | </td> | 
|---|
| 398 | </tr> | 
|---|
| 399 | </table> | 
|---|
| 400 | </div> | 
|---|
| 401 |  | 
|---|
| 402 | <div class="myaccordion" id="accordion6"> | 
|---|
| 403 | <h3><a href="#">Additional controls</a></h3> | 
|---|
| 404 | </div> | 
|---|
| 405 | <div id="ctrlcontainer" class="ui-widget-content"> | 
|---|
| 406 | <form id="controls" method="POST" style="margin-bottom:0"> | 
|---|
| 407 | <input id="getgeometry" type="button" onclick="onGetGeometry();" value="Get geometry"></input> | 
|---|
| 408 | <input id="getcamera"   type="button" onclick="onGetCameras();" value="Get camera data"></input> | 
|---|
| 409 | <input id="getwaveform" type="button" onclick="onGetWaveforms();" value="Get waveforms"></input> | 
|---|
| 410 | <input id="data" name="data" type="hidden"></input> | 
|---|
| 411 | <input id="name" name="name" type="hidden"></input> | 
|---|
| 412 | </form> | 
|---|
| 413 | </div> | 
|---|
| 414 |  | 
|---|
| 415 | <div class="myaccordion" id="accordion4"> | 
|---|
| 416 | <h3><a href="#">Help</a></h3> | 
|---|
| 417 | </div> | 
|---|
| 418 | <div id="helpcontainer" class="ui-widget-content" style="padding-left:40px;padding-right:40px;padding-bottom:40px;"> | 
|---|
| 419 | <H1>HELP</H1> | 
|---|
| 420 |  | 
|---|
| 421 | <H3>How does it work?</H3> | 
|---|
| 422 | When you submit a javascript to the server, it will be executed | 
|---|
| 423 | on a sandbox on the server. Before the event is loaded from a file | 
|---|
| 424 | and made available within the sandbox. Generally, the sandbox | 
|---|
| 425 | can easily be enhanced, e.g. with algorithms available in php. | 
|---|
| 426 | This can be done on request. After execution, the result returned | 
|---|
| 427 | by the script is then displayed in the camera display. | 
|---|
| 428 |  | 
|---|
| 429 | <H3>Why Javascript?</H3> | 
|---|
| 430 | Simply for security reasons. To avoid tranferring the event to the client's | 
|---|
| 431 | browser, the script must be executed on the server side. Also Python | 
|---|
| 432 | and PHP offer the possibility to execute scripts within a program, | 
|---|
| 433 | they do not have any security feature to avoid for exmple access to the | 
|---|
| 434 | local disk. The V8 Javascript engine however, is very limited in | 
|---|
| 435 | functionality and therefore ideally suited for a sandboxed and | 
|---|
| 436 | therefore safe excution on the server. Any other solution is welcome. | 
|---|
| 437 |  | 
|---|
| 438 | <H3>Javascript hints!</H3> | 
|---|
| 439 | Please note that in Javascript only basic data typed (number, etc) | 
|---|
| 440 | are copied in an assignment. In all other cases, only a reference | 
|---|
| 441 | is copied. For example, the following code snippet does not return 2 | 
|---|
| 442 | as you might expect but 7! | 
|---|
| 443 | <pre> | 
|---|
| 444 | var arr = [ 0, 1, 2, 3 ]; | 
|---|
| 445 | var cpy = arr; | 
|---|
| 446 | cpy[2] = 7; | 
|---|
| 447 | print(arr[2]); | 
|---|
| 448 | </pre> | 
|---|
| 449 | To avoid that, the global namespace implements a clone function. | 
|---|
| 450 | For exmaple, the following code snippet will return the expected output: | 
|---|
| 451 | <pre> | 
|---|
| 452 | var arr = [ 0, 1, 2, 3 ]; | 
|---|
| 453 | var cpy = $.clone(arr); | 
|---|
| 454 | cpy[2] = 7; | 
|---|
| 455 | print(arr[2]); | 
|---|
| 456 | </pre> | 
|---|
| 457 |  | 
|---|
| 458 | <H3>Javascript arrays</H3> | 
|---|
| 459 | Note that javascript arrays have some very powerful member functions. | 
|---|
| 460 | For a description see for example | 
|---|
| 461 | <A HREF="http://www.tutorialspoint.com/javascript/javascript_arrays_object.htm">here</A> | 
|---|
| 462 | or search google for function like <i>map</i> or <i>reduce</i>. | 
|---|
| 463 |  | 
|---|
| 464 | <H3>The global object $</H3> | 
|---|
| 465 |  | 
|---|
| 466 | The environment provides a global object (namesapce) called $ with the following members: | 
|---|
| 467 | <table> | 
|---|
| 468 | <tr><td>$.file.numEvents</td><td>Number of events in the file</td></tr> | 
|---|
| 469 | <tr><td>$.file.runStart</td><td>MJD of run start minus 40587 (unix time in days)</td></tr> | 
|---|
| 470 | <tr><td>$.file.runEnd</td><td>MJD of run end minus 40587 (unix time in days)</td></tr> | 
|---|
| 471 | <tr><td>$.file.drsFile</td><td>If this is a DRS calibration file, the step id, otherwise -1</td></tr> | 
|---|
| 472 | <tr><td>$.file.isMC</td><td>True is this was requested as Monte Carlo file</td></tr> | 
|---|
| 473 | <tr><td>$.file.isDRS</td><td>True if DRS calibration constants were requested</td></tr> | 
|---|
| 474 | <tr><td>$.file.isCalibrated</td><td>True if a calibrated file was requested</td></tr> | 
|---|
| 475 | <tr><td>$.event</td><td>The event header information as obtained from the file</td></tr> | 
|---|
| 476 | <tr><td>$.event.numRoi</td><td>Number of samples per pixel</td></tr> | 
|---|
| 477 | <tr><td>$.event.numPix</td><td>Number of pixels</td></tr> | 
|---|
| 478 | <tr><td>$.event.eventNumber</td><td>Event number</td></tr> | 
|---|
| 479 | <tr><td>$.event.triggerNumber</td><td>Trigger number</td></tr> | 
|---|
| 480 | <tr><td>$.event.triggerType</td><td>Trigger type</td></tr> | 
|---|
| 481 | <tr><td>$.event.trigger</td><td>Decoded trigger information</td></tr> | 
|---|
| 482 | <tr><td>$.event.unixTime[2]</td><td>Timestamp when the event arrived at the event builder</td></tr> | 
|---|
| 483 | <tr><td>$.data[numPix][numRoi]</td><td>The event data</td></tr> | 
|---|
| 484 | <tr><td>$.nroi</td><td>Shortcut to $.event.numRoi</td></tr> | 
|---|
| 485 | <tr><td>$.npix</td><td>Shortcut to $.event.numPix</td></tr> | 
|---|
| 486 | <tr><td>$.trigger</td><td>Shortcut to $.event.trigger</td></tr> | 
|---|
| 487 | <tr><td>$.neighbors</td><td>Array of 1440 arrays each containing the corresponding neighbors</td></tr> | 
|---|
| 488 | <tr><td>$.map</td><td>Array of 1440 entries (software index) containing the hardware indices.</td></tr> | 
|---|
| 489 | <tr><td>$.geom</td><td>Array of 1440 entries. Each an array with two entries, x and y. The distance between two neighbors is 1.</td></tr> | 
|---|
| 490 | <tr><td>$.dist(i,j)</td><td>Calculated the distance of two pixels in degree.</td></tr> | 
|---|
| 491 | <tr><td>$.conv</td><td>Conversion factor to convert geom and dist to degree.</td></tr> | 
|---|
| 492 | </table> | 
|---|
| 493 |  | 
|---|
| 494 | <H3>Stack traces</H3> | 
|---|
| 495 | Please note that due to some interna, the line numbers in the | 
|---|
| 496 | stack trace shown in case of runtime errors are by one line too high. | 
|---|
| 497 |  | 
|---|
| 498 | <H3>Editor 1 (proc)</H3> | 
|---|
| 499 |  | 
|---|
| 500 | <I>proc</I> can return an array with numRoi entries or an array with up to | 
|---|
| 501 | four sub-arrays each of nRoi entries. They will be displayed in the graph. | 
|---|
| 502 | The chosel pixel is available as <I>pixel</I>. | 
|---|
| 503 | The most simple is to just return the selected pixel data unprocssed: | 
|---|
| 504 | <pre> | 
|---|
| 505 | return $.data[pixel]; | 
|---|
| 506 | </pre> | 
|---|
| 507 |  | 
|---|
| 508 | <H3>Editor 2 (main)</H3> | 
|---|
| 509 | <I>main</I> should return extracted data per pixel. As <I>proc</I> it can | 
|---|
| 510 | return a single array or an array with up to four sub-arrays each with | 
|---|
| 511 | numPix entries. They are displayed in the camera displays. The function | 
|---|
| 512 | implemented as <I>proc</I> is accessible as <I>proc(i)</I> with <I>i</I> | 
|---|
| 513 | being available in <I>proc</I> as <I>pixel</I>. A very simple extractor | 
|---|
| 514 | could be to return just the sample at the trigger position | 
|---|
| 515 | <pre> | 
|---|
| 516 | var rc = []; | 
|---|
| 517 | for (var i=0; i<$.event.numPix; i++) | 
|---|
| 518 | rc[i] = $.data[i][60]; | 
|---|
| 519 | return rc; | 
|---|
| 520 | </pre> | 
|---|
| 521 | or taking the data pre-procesed by the code of the <I>proc</I>-function: | 
|---|
| 522 | <pre> | 
|---|
| 523 | var rc = []; | 
|---|
| 524 | for (var i=0; i<$.event.numPix; i++) | 
|---|
| 525 | rc[i] = proc(i)[60]; | 
|---|
| 526 | return rc; | 
|---|
| 527 | </pre> | 
|---|
| 528 |  | 
|---|
| 529 | Note that the precise access to the result of proc might depend on what | 
|---|
| 530 | exactly is retruned by proc (an array, or an array with sub-arrays). | 
|---|
| 531 |  | 
|---|
| 532 | Pixel which are not returned (<tt>undefind</tt> or <tt>null</tt>) are | 
|---|
| 533 | not displayed. This allows to show cleaned images as well or test | 
|---|
| 534 | image cleaning algorithms. | 
|---|
| 535 |  | 
|---|
| 536 | <H3>What is the data?</H3> | 
|---|
| 537 | The data are all data files found in disks in La Palma (to be precise: | 
|---|
| 538 | on daq's disks). The data is raw-data but with the most recent | 
|---|
| 539 | DRS calibration (only the 1024-cell offset calibration) | 
|---|
| 540 | applied, while the application is done in intergers, i.e. the | 
|---|
| 541 | fractional part of the calibration constant is removed. | 
|---|
| 542 | (This is basically what is written in our FITS files as part of the | 
|---|
| 543 | lossless compression process). No spike or jump removal is applied. | 
|---|
| 544 |  | 
|---|
| 545 | <H3>The editor</H3> | 
|---|
| 546 | Key bindings of the editor can be found at | 
|---|
| 547 | <A HREF="http://codemirror.net/doc/manual.html#commands">Codemirror</A>. | 
|---|
| 548 | In addition the following binding are defined: Tab - Auto indent; | 
|---|
| 549 | F11 - Switch to fullscreen; Esc - In fullscreen mode to | 
|---|
| 550 | leave fullscreen; Ctrl-r - replace; Ctrl-y - Delete the line under the cursor; | 
|---|
| 551 | Ctrl-. (dot) - Fold code; Ctrl-Down (cursor down) - Autocomplete. | 
|---|
| 552 |  | 
|---|
| 553 | <H3>How to change the file?</H3> | 
|---|
| 554 | Start typing the date in the filename field. The available files | 
|---|
| 555 | will be filtered as you type. To select a file you need to select | 
|---|
| 556 | it fom the pull down. | 
|---|
| 557 |  | 
|---|
| 558 | <H3>What is the meaning of the DRS and Cal checkboxes?</H3> | 
|---|
| 559 | For some files, files which contain calibrated data are available. | 
|---|
| 560 | This means that the DRS calibration (offset (1024), gain and offset | 
|---|
| 561 | (roi)) has been applied. Enabling the checkbox will show this data | 
|---|
| 562 | instead of the raw data. Note that the precision is limited to 0.1mV. | 
|---|
| 563 | In some cases files were taken to deduce this calibration constants | 
|---|
| 564 | (DRS files). This is done in four steps: offset, gain, offset (1024), | 
|---|
| 565 | offset (roi). These steps are called 0, 1, 2 and 2 respectively. If the | 
|---|
| 566 | checkbox Drs is enabled, the corresponding calibration constants as | 
|---|
| 567 | stored in the .drs.fits file, are shown, which is | 
|---|
| 568 | <I>BaselineMean</I> [0], <I>GainMean</I> [1] and <I>TriggerOffsetMean</I> [2]. | 
|---|
| 569 |  | 
|---|
| 570 | <H3>What is the meaning of the MC checkbox?</h3> | 
|---|
| 571 | Currently, it is only to indicate whether the chosen file | 
|---|
| 572 | is a Monte Carlo file or not. At the moment, all available | 
|---|
| 573 | Monte Carlo file have a four-digit <I>year</I> starting with | 
|---|
| 574 | a 0. | 
|---|
| 575 |  | 
|---|
| 576 | <H3>Are there Monte Carlo files available?</H3> | 
|---|
| 577 | Yes, there are. Monte Carlo files have the date 0000/00/00 and  the | 
|---|
| 578 | praticle ID as run-number (1: gamma, 6: muon, 14: proton). To my | 
|---|
| 579 | understanding, the run-numbers 100, 101 and 102 refer to pedestals with | 
|---|
| 580 | closed shutter (100 and 101) and open shutter (102). | 
|---|
| 581 |  | 
|---|
| 582 | <H3>How to change the displayed pixel?</H3> | 
|---|
| 583 | Enter the pixel number on the corresponding field or its hwardware | 
|---|
| 584 | address. As soon as you acknowledge your change (e.g. remove focus | 
|---|
| 585 | by clicking somewhere else) the pixel contents gets displayed. | 
|---|
| 586 |  | 
|---|
| 587 | <H3>How to Save/Load a script?</H3> | 
|---|
| 588 | To load a file choose a file fro your local hard drive via the | 
|---|
| 589 | file selection dialog. To save the contents of the editor, press | 
|---|
| 590 | Save. | 
|---|
| 591 |  | 
|---|
| 592 | <H3>Submit</H3> | 
|---|
| 593 | If you have changed the script and you want to run it on the current event | 
|---|
| 594 | press Submit. The Javascript will be executed for this event on | 
|---|
| 595 | the server. | 
|---|
| 596 |  | 
|---|
| 597 | <!--<H3>Autosubmit</H3> | 
|---|
| 598 | If Autosumit is enabled, the script will be submitted each time | 
|---|
| 599 | the file name or the event number is changed and executed.--> | 
|---|
| 600 |  | 
|---|
| 601 | <H3>Pixel value</H3> | 
|---|
| 602 | To display the value returned for a pixel just click on the pixel. | 
|---|
| 603 | The value will be displayed in the Pixel field. This will also | 
|---|
| 604 | display the corresponding waveform in the graph. | 
|---|
| 605 |  | 
|---|
| 606 | <H3>Min/max values</H3> | 
|---|
| 607 | Min and max values for the plot and the graph can be determined | 
|---|
| 608 | automatically or manully. To set the to a fixed value, enable the | 
|---|
| 609 | min and/or max field and enter the value of your choice. It will | 
|---|
| 610 | survive changing files, events or pixel. | 
|---|
| 611 |  | 
|---|
| 612 | <H3>What is the meaning of the image?</H3> | 
|---|
| 613 | The image is a representation of the first and second moment of the | 
|---|
| 614 | distribution of the pixel values. The first moment is the center-of-gravity | 
|---|
| 615 | of the distirbution, the major and minor axis represent the standard | 
|---|
| 616 | deviation around the center-of-gravity (<i>width</I> and <i>length</I>). | 
|---|
| 617 | The line represents an estimate for the distance of the center-of-gravity | 
|---|
| 618 | to the origin of the primary particle (<i>disp</i>). Due to the lack | 
|---|
| 619 | of more information, it is a very simple estimate using | 
|---|
| 620 | disp=1.42*(1-width/length). | 
|---|
| 621 |  | 
|---|
| 622 | <H3>What are the additional controls</H3> | 
|---|
| 623 | <i>Get geometry</i>: You will get a file with the pixel positions in arbitrary units. | 
|---|
| 624 | The three columns are the pixel index, and the x and y coordinate | 
|---|
| 625 | in degree.<br> | 
|---|
| 626 | <i>Get camera data</i>: You will get a file with the data from the currently | 
|---|
| 627 | displayed cameras. The columns are pixel index and value of the cameras | 
|---|
| 628 | 1, 2, 3 and 4.<br> | 
|---|
| 629 | <i>Get waveforms</i>: You will get a file with the data from the currently | 
|---|
| 630 | displayed waveforms. The columns are sample index and amplitude  of the waveforms | 
|---|
| 631 | 1, 2, 3 and 4. | 
|---|
| 632 |  | 
|---|
| 633 | <H3>Why is loading the page so slow?</H3> | 
|---|
| 634 | The total contents of the javascript libraries is about 1MB which | 
|---|
| 635 | all have to be treasferred to the browser. In addition the loading | 
|---|
| 636 | and processing of the event takes up to 1s so that the loading | 
|---|
| 637 | time of the page might be untypically slow. Once finished, | 
|---|
| 638 | the amaount of code to load can be decreased. | 
|---|
| 639 |  | 
|---|
| 640 | <H3>How to unzoom the plot?</H3> | 
|---|
| 641 | Double click on the plot. | 
|---|
| 642 |  | 
|---|
| 643 | </div> | 
|---|
| 644 |  | 
|---|
| 645 |  | 
|---|
| 646 | </body> | 
|---|
| 647 | </html> | 
|---|