How to use detector method in wpt

Best JavaScript code snippet using wpt

_DetectorNavigator.js

Source:_DetectorNavigator.js Github

copy

Full Screen

1var DetectorNavigator = {};2DetectorNavigator.isFirstLoad = true;3DetectorNavigator.originX;4DetectorNavigator.originY;5DetectorNavigator.mx; //{x,y} mouse coords corresponding to pixel in image. {0,0} is top left.6DetectorNavigator.my;7DetectorNavigator.winObj;8DetectorNavigator.winPosX;9DetectorNavigator.winPosY;10DetectorNavigator.canvasOffX;11DetectorNavigator.canvasOffY;12DetectorNavigator.discs = new Array();13DetectorNavigator.barrels = new Array();14DetectorNavigator.discCaptions = new Array();15DetectorNavigator.barrelCaptions = new Array();16DetectorNavigator.discFlags = new Array();17DetectorNavigator.barrelFlags = new Array();18DetectorNavigator.rocHighlights = new Array();19DetectorNavigator.fedCaptions = new Array();20DetectorNavigator.fedCaptionTops = new Array(); //store y val so it only has to be calculated once21DetectorNavigator.fedCaptionLefts = new Array();//store x val so it only has to be calculated once22DetectorNavigator.fedViewMode;23DetectorNavigator.zoomedIndex = [-1,-1,-1]; //0,1 for Fpix,Bpix, 0-4,3 for disc,layer, 0,1 for left,right24DetectorNavigator.clickMask = [[[],[],[],[],[],[],[],[]],[[],[],[],[],[],[]]]; //[2][8,6][x]25DetectorNavigator.currentSummaryNode; //used for filling summary fields26DetectorNavigator.currentSummary = "-";27DetectorNavigator.currentSummaryField = "-";28DetectorNavigator.currentSummaryCaption;29DetectorNavigator.rocColorKeyImage;30DetectorNavigator.colorCodeImages = new Array();31DetectorNavigator.rocColorKeyValues = new Array();32DetectorNavigator.rocColorKeyValuesNumber = 5;33DetectorNavigator.summaryOvfPic;34DetectorNavigator.summaryOvfText;35DetectorNavigator.summaryUnfPic;36DetectorNavigator.summaryUnfText;37DetectorNavigator.summarySigma;38DetectorNavigator.summaryForm = 0;39DetectorNavigator.summaryFormField;40DetectorNavigator.summaryAverage;41DetectorNavigator.summaryTotalSamples;42DetectorNavigator.summaryMinValue;43DetectorNavigator.summaryMaxValue;44DetectorNavigator.summaryParameters = new Array(); //from ajax response45 //0 - total samples46 //1 - min value47 //2 - max value48 //3 - avg49 //4 - sigma (-1 if booleanOnly)50 //5 - min limit51 //6 - max limit52 //fpix naming53DetectorNavigator.disc;54DetectorNavigator.blade;55DetectorNavigator.panel;56DetectorNavigator.plaquette;57 //bpix naming58DetectorNavigator.sector;59DetectorNavigator.layer;60DetectorNavigator.ladder;61DetectorNavigator.module;62 //common naming63DetectorNavigator.plusMinus;64DetectorNavigator.inOut;65DetectorNavigator.roc; 66DetectorNavigator.rocPathDiv; //div with full string67DetectorNavigator.rocPath; //full string68 69 //fpix ROC location members70DetectorNavigator.oldHighlightIndex = -1;71 //bpix ROC location members72DetectorNavigator.endSectorRows = [3,3,5];73DetectorNavigator.otherSectorRows = [2,4,6];74DetectorNavigator.safariSubstractOne = 0;75DetectorNavigator.barrelCol;76DetectorNavigator.barrelRow;77 //start c++ constants input here78DetectorNavigator.WEB_LARGE_WIDTH = ##WEB_LARGE_WIDTH##;79DetectorNavigator.WEB_LARGE_HEIGHT = ##WEB_LARGE_HEIGHT##;80DetectorNavigator.WEB_MINI_WIDTH = ##WEB_MINI_WIDTH##;81DetectorNavigator.WEB_MINI_HEIGHT = ##WEB_MINI_HEIGHT##;82DetectorNavigator.WEB_BLARGE_WIDTH = ##WEB_BLARGE_WIDTH##;83DetectorNavigator.WEB_BLARGE_HEIGHT = ##WEB_BLARGE_HEIGHT##;84DetectorNavigator.WEB_BMINI_WIDTH = ##WEB_BMINI_WIDTH##;85DetectorNavigator.WEB_BMINI_HEIGHT = ##WEB_BMINI_HEIGHT##;86DetectorNavigator.WEB_XOFFSET = ##WEB_XOFFSET##;87DetectorNavigator.WEB_YOFFSET = ##WEB_YOFFSET##;88DetectorNavigator.WEB_ROC_SIZE = ##WEB_ROC_SIZE##;89DetectorNavigator.WEB_DISC_X = ##WEB_DISC_X##;90DetectorNavigator.WEB_DISC_Y = ##WEB_DISC_Y##;91DetectorNavigator.WEB_BLADE_HI = ##WEB_BLADE_HI##;92DetectorNavigator.WEB_BLADE_LO = ##WEB_BLADE_LO##;93DetectorNavigator.WEB_ROC_OFFSET = ##WEB_ROC_OFFSET##;94DetectorNavigator.WEB_BLYR_XOFF = ##WEB_BLYR_XOFF##;95DetectorNavigator.WEB_BLYR_YOFF = ##WEB_BLYR_YOFF##;96DetectorNavigator.WEB_BROC_WIDTH = ##WEB_BROC_WIDTH##;97DetectorNavigator.WEB_BROC_HEIGHT = ##WEB_BROC_HEIGHT##;98DetectorNavigator.WEB_BROW_OFFSET = ##WEB_BROW_OFFSET##;99DetectorNavigator.WEB_BCOL_OFFSET = ##WEB_BCOL_OFFSET##;100DetectorNavigator.BPIX_LYR_COLS = ##BPIX_LYR_COLS##;101DetectorNavigator.BPIX_LYR_ROWS = 102 [##BPIX_LYR1_ROWS##,##BPIX_LYR2_ROWS##,##BPIX_LYR3_ROWS##];103 //query Plaquette/ROC parameters from C++104 // [PlaqHighUpBoundary,PlaqLowUpBoundary,PlaqMiddleUpBoundary,105 // [[numOfRocs,rocOff,rocSign,upRocMult],106 // [numOfRocs,rocOff,rocSign,upRocMult]],107 // rocSizeMult,rocOffMult],108var q = 109 [ 110 [ //4-pplaquette panel type 1111 [##PNL1_PLAQ1_H##,##PNL1_PLAQ1_L##,0,112 [ [2,1,-1,(##PNL1_PLAQ1_H## + ##PNL1_PLAQ1_L##)/2] ,113 []] ,114 0.0, 0.5],115 [##PNL1_PLAQ2_H##,##PNL1_PLAQ2_L##,##PNL1_PLAQ2_M##,116 [ [3,2,-1,(##PNL1_PLAQ2_L## + ##PNL1_PLAQ2_M## - ##WEB_ROC_OFFSET##)/2] ,117 [3,3, 1,(##PNL1_PLAQ2_H## + ##PNL1_PLAQ2_M##)/2]] ,118 0.5, 1.0],119 [##PNL1_PLAQ3_H##,##PNL1_PLAQ3_L##,##PNL1_PLAQ3_M##,120 [ [4,3,-1,(##PNL1_PLAQ3_L## + ##PNL1_PLAQ3_M## - ##WEB_ROC_OFFSET##)/2] ,121 [4,4, 1,(##PNL1_PLAQ3_H## + ##PNL1_PLAQ3_M##)/2]] ,122 1.0, 1.5],123 [##PNL1_PLAQ4_H##,##PNL1_PLAQ4_L##,0,124 [ [5,4,-1,(##PNL1_PLAQ4_H## + ##PNL1_PLAQ4_L##)/2] ,125 []] ,126 1.5, 2.0]127 ],128 [ //3-pplaquette panel type 2129 [##PNL2_PLAQ1_H##,##PNL2_PLAQ1_L##,##PNL2_PLAQ1_M##,130 [ [3,2,-1,(##PNL2_PLAQ1_L## + ##PNL2_PLAQ1_M## - ##WEB_ROC_OFFSET##)/2] ,131 [3,3, 1,(##PNL2_PLAQ1_H## + ##PNL2_PLAQ1_M##)/2]] ,132 0.5, 1.0],133 [##PNL2_PLAQ2_H##,##PNL2_PLAQ2_L##,##PNL2_PLAQ2_M##,134 [ [4,3,-1,(##PNL2_PLAQ2_L## + ##PNL2_PLAQ2_M## - ##WEB_ROC_OFFSET##)/2] ,135 [4,4, 1,(##PNL2_PLAQ2_H## + ##PNL2_PLAQ2_M##)/2]] ,136 1.0, 1.5],137 [##PNL2_PLAQ3_H##,##PNL2_PLAQ3_L##,##PNL2_PLAQ3_M##,138 [ [5,4,-1,(##PNL2_PLAQ3_L## + ##PNL2_PLAQ3_M## - ##WEB_ROC_OFFSET##)/2] ,139 [5,5, 1,(##PNL2_PLAQ3_H## + ##PNL2_PLAQ3_M##)/2]] ,140 1.5, 2.0]141 ] 142 ];143 //end c++ constants section144 145 146 //saved code snippets147 //document.body.style.cursor='pointer';//hand148 //document.body.style.cursor='auto'; //normal149 //document.body.style.cursor='arrow'; //arrow 150 //document.forms['detNavForm'].mouseXDisplay.value = "-";151 //document.forms['detNavForm'].mouseYDisplay.value = "-";152 //document.forms['detNavForm'].mouseXDisplay.value = mx;153 //document.forms['detNavForm'].mouseYDisplay.value = my;154 //var time = (new Date()).getTime();155 //document.forms['detNavForm'].mouseXDisplay.value = (new Date()).getTime() - time;156 //document.forms['detNavForm'].mouseYDisplay.value = (new Date()).getTime() - time;157 //end saved code snippets158 159////////////////////////////////////////////////////////////////////////////////////////////////////////////160DetectorNavigator.init = function(dWin) {161 dWin.win.addListener('move',DetectorNavigator.updateWinPos);162 DetectorNavigator.winObj = dWin; 163}164////////////////////////////////////////////////////////////////////////////////////////////////////////////165DetectorNavigator.updateWinPos = function(w,x,y){166 DetectorNavigator.winPosX = DetectorNavigator.winObj.win.getPosition()[0];167 DetectorNavigator.winPosY = DetectorNavigator.winObj.win.body.getY(); 168}169////////////////////////////////////////////////////////////////////////////////////////////////////////////170DetectorNavigator.initObjects = function(){171 if(!DetectorNavigator.isFirstLoad) //prevent re-initialization when images are updated172 return;173 DetectorNavigator.isFirstLoad = false;174 175 DetectorNavigator.winPosX = DetectorNavigator.winObj.win.getPosition()[0];176 DetectorNavigator.winPosY = DetectorNavigator.winObj.win.body.getY(); 177 DetectorNavigator.rocPathDiv = document.getElementById('currentPath');178 179 for(i=0;i<8;++i){ //acquire highlight objects180 DetectorNavigator.discs[i] = document.getElementById('disc'+i);181 DetectorNavigator.discCaptions[i] = document.getElementById('discCaption'+i);182 DetectorNavigator.discFlags[i] = document.getElementById('discFlag'+i);183 }184 for(i=0;i<6;++i){ //acquire highlight objects185 DetectorNavigator.barrels[i] = document.getElementById('barrel'+i);186 DetectorNavigator.barrelCaptions[i] = document.getElementById('barrelCaption'+i);187 DetectorNavigator.barrelFlags[i] = document.getElementById('barrelFlag'+i);188 }189 for(i=0;i<6;++i){ //acquire highlight objects190 DetectorNavigator.rocHighlights[i] = document.getElementById('rocHighlight' + i);191 DetectorNavigator.rocHighlights[i].style.width = DetectorNavigator.WEB_ROC_SIZE*2+"px";192 DetectorNavigator.rocHighlights[i].style.height = DetectorNavigator.WEB_ROC_SIZE*2+"px";193 }194 DetectorNavigator.barrelHighlight = document.getElementById('rocHighlight');195 DetectorNavigator.barrelHighlight.style.width = DetectorNavigator.WEB_BROC_WIDTH+2+"px";196 DetectorNavigator.barrelHighlight.style.height = DetectorNavigator.WEB_BROC_HEIGHT+4+"px";197 //setup summary objects198 DetectorNavigator.colorCodeImages[0] = document.getElementById('rocColorKey');199 DetectorNavigator.colorCodeImages[0].style.top = '-100px';200 DetectorNavigator.colorCodeImages[1] = document.getElementById('rocColorKeyBool');201 DetectorNavigator.colorCodeImages[1].style.top = '-100px';202 DetectorNavigator.colorCodeImages[0].style.width = '300px';203 DetectorNavigator.colorCodeImages[0].style.height = '25px';204 DetectorNavigator.colorCodeImages[1].style.width = '300px';205 DetectorNavigator.colorCodeImages[1].style.height = '25px';206 DetectorNavigator.rocColorKeyImage = DetectorNavigator.colorCodeImages[0];207 208 DetectorNavigator.currentSummaryCaption = document.getElementById('summaryName'); 209 var tmpsummary = DetectorNavigator.currentSummary;210 while((i = tmpsummary.indexOf("/")) != -1){211 tmpsummary = tmpsummary.slice(i+1); 212 }213 DetectorNavigator.currentSummaryCaption.innerHTML = tmpsummary + " - " + DetectorNavigator.currentSummaryField;214 DetectorNavigator.currentSummaryCaption.style.left = 7 + //only top is changed215 DetectorNavigator.WEB_LARGE_WIDTH/2 - DetectorNavigator.currentSummaryCaption.offsetWidth/2 + "px";216 217 var tmpxoff = 10;218 DetectorNavigator.summarySigma = document.getElementById('summarySigma'); 219 DetectorNavigator.summarySigma.innerHTML = "&sigma;: " + DetectorNavigator.summaryParameters[4];220 DetectorNavigator.summarySigma.style.left = tmpxoff + "px";221 222 DetectorNavigator.summaryAverage = document.getElementById('summaryAvg'); 223 DetectorNavigator.summaryAverage.innerHTML = "Avg: " + DetectorNavigator.summaryParameters[3];224 DetectorNavigator.summaryAverage.style.left = tmpxoff + "px";225 226 DetectorNavigator.summaryTotalSamples = document.getElementById('summarySamples'); 227 DetectorNavigator.summaryTotalSamples.innerHTML = "Samples: " + DetectorNavigator.summaryParameters[0];228 DetectorNavigator.summaryTotalSamples.style.left = tmpxoff + "px";229 230 DetectorNavigator.summaryMinValue = document.getElementById('sumamryMin'); 231 DetectorNavigator.summaryMinValue.innerHTML = "Min: " + DetectorNavigator.summaryParameters[1];232 DetectorNavigator.summaryMinValue.style.left = tmpxoff + "px";233 234 DetectorNavigator.summaryMaxValue = document.getElementById('summaryMax'); 235 DetectorNavigator.summaryMaxValue.innerHTML = "Max: " + DetectorNavigator.summaryParameters[2];236 DetectorNavigator.summaryMaxValue.style.left = tmpxoff + "px";237 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i)238 DetectorNavigator.rocColorKeyValues[i] = document.getElementById('rocColorKeyValues'+i);239 if(DetectorNavigator.summaryParameters[4] == -1){ //boolean only summary 240 DetectorNavigator.rocColorKeyValues[0].innerHTML = "Fail";241 DetectorNavigator.rocColorKeyValues[1].innerHTML = "Pass";242 DetectorNavigator.rocColorKeyImage = DetectorNavigator.colorCodeImages[1];243 DetectorNavigator.summarySigma.style.left = '-1000px';244 //DetectorNavigator.summaryAverage.style.left = '-1000px';245 //DetectorNavigator.summaryMinValue.style.left = '-1000px';246 //DetectorNavigator.summaryMaxValue.style.left = '-1000px';247 }248 else{ //normal summary249 var p1 = parseFloat(DetectorNavigator.summaryParameters[5]);250 p1 *= 100;251 p1 = Math.round(p1);252 p1 /= 100;253 var p2 = parseFloat(DetectorNavigator.summaryParameters[6]);254 p2 *= 100;255 p2 = Math.round(p2);256 p2 /= 100;257 var p3 = (p1 + p2)/2;258 p3 *= 100;259 p3 = Math.round(p3);260 p3 /= 100;261 var p4 = (p1 + p3)/2;262 p4 *= 100;263 p4 = Math.round(p4);264 p4 /= 100;265 var p5 = (p3 + p2)/2;266 p5 *= 100;267 p5 = Math.round(p5);268 p5 /= 100;269 270 DetectorNavigator.rocColorKeyValues[0].innerHTML = p1;271 DetectorNavigator.rocColorKeyValues[4].innerHTML = p2;272 DetectorNavigator.rocColorKeyValues[2].innerHTML = p3;273 DetectorNavigator.rocColorKeyValues[1].innerHTML = p4;274 DetectorNavigator.rocColorKeyValues[3].innerHTML = p5;275 }276 277 DetectorNavigator.rocColorKeyImage.style.left = 7 + //only top is changed278 DetectorNavigator.WEB_LARGE_WIDTH/2 - DetectorNavigator.rocColorKeyImage.offsetWidth/2 + "px";279 280 if(DetectorNavigator.summaryParameters[4] == -1){ 281 DetectorNavigator.rocColorKeyValues[0].style.left = DetectorNavigator.rocColorKeyImage.offsetLeft282 + 1*DetectorNavigator.rocColorKeyImage.offsetWidth/(DetectorNavigator.rocColorKeyValuesNumber-1)283 - DetectorNavigator.rocColorKeyValues[0].offsetWidth/2 + "px";284 DetectorNavigator.rocColorKeyValues[1].style.left = DetectorNavigator.rocColorKeyImage.offsetLeft285 + 3*DetectorNavigator.rocColorKeyImage.offsetWidth/(DetectorNavigator.rocColorKeyValuesNumber-1)286 - DetectorNavigator.rocColorKeyValues[0].offsetWidth/2 + "px";287 for(i=2;i<DetectorNavigator.rocColorKeyValuesNumber;++i){288 DetectorNavigator.rocColorKeyValues[i].style.left = "-1000px";289 }290 }291 else{292 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i){293 DetectorNavigator.rocColorKeyValues[i].style.left = DetectorNavigator.rocColorKeyImage.offsetLeft294 + i*DetectorNavigator.rocColorKeyImage.offsetWidth/(DetectorNavigator.rocColorKeyValuesNumber-1)295 - DetectorNavigator.rocColorKeyValues[i].offsetWidth/2 + "px";296 }297 }298 299 DetectorNavigator.summaryOvfPic = document.getElementById('rocColorKeyOver');300 DetectorNavigator.summaryOvfPic.style.width = '10px';301 DetectorNavigator.summaryOvfPic.style.height = '10px';302 DetectorNavigator.summaryOvfText = document.getElementById('rocColorKeyOverText'); 303 DetectorNavigator.summaryOvfText.innerHTML = "Overflow";304 305 DetectorNavigator.summaryOvfText.style.left = 7 + 306 DetectorNavigator.WEB_LARGE_WIDTH/2 + 60 - 307 (DetectorNavigator.summaryOvfPic.offsetWidth + 308 DetectorNavigator.summaryOvfText.offsetWidth + 5)/2 + "px";309 DetectorNavigator.summaryOvfPic.style.left = DetectorNavigator.summaryOvfText.offsetLeft + 310 DetectorNavigator.summaryOvfText.offsetWidth + 5 + "px";311 312 DetectorNavigator.summaryUnfPic = document.getElementById('rocColorKeyUnder');313 DetectorNavigator.summaryUnfPic.style.width = '10px';314 DetectorNavigator.summaryUnfPic.style.height = '10px';315 DetectorNavigator.summaryUnfText = document.getElementById('rocColorKeyUnderText'); 316 DetectorNavigator.summaryUnfText.innerHTML = "Underflow";317 318 DetectorNavigator.summaryUnfText.style.left = 7 + 319 DetectorNavigator.WEB_LARGE_WIDTH/2 - 60 - 320 (DetectorNavigator.summaryUnfPic.offsetWidth +321 DetectorNavigator.summaryUnfText.offsetWidth + 5)/2 + "px";322 DetectorNavigator.summaryUnfPic.style.left = DetectorNavigator.summaryUnfText.offsetLeft + 323 DetectorNavigator.summaryUnfText.offsetWidth + 5 + "px"; 324 325 //capture mouse coordinates326 document.captureEvents(Event.MOUSEMOVE);327 document.onmousemove = DetectorNavigator.getMouseXY;328 329 if("Apple Computer, Inc." == navigator.vendor){ // fix for safari right click issue330 for(i=0;i<8;++i){331 DetectorNavigator.discs[i].oncontextmenu = function(){DetectorNavigator.zoom(false);};332 } 333 for(i=0;i<6;++i){334 DetectorNavigator.barrels[i].oncontextmenu = function(){DetectorNavigator.zoom(false);};335 }336 for(i=0;i<6;++i){337 DetectorNavigator.rocHighlights[i].oncontextmenu = function(){DetectorNavigator.zoom(false);};338 }339 DetectorNavigator.barrelHighlight.oncontextmenu = function(){DetectorNavigator.zoom(false);};340 //fix for weird pixel off problem on bpix highlight341 DetectorNavigator.safariSubstractOne = -1;342 }343 344 //sigma form for summary345 if(!DetectorNavigator.summaryForm){346 DetectorNavigator.summaryForm = new Ext.form.FormPanel({347 baseCls: 'x-plain',348 autoScroll: false,349 buttonAlign: 'right',350 labelAlign: 'top',351 style: "position:absolute;z-index:2",352 x: 490,353 y: 37-DetectorNavigator.safariSubstractOne,354 renderTo: "Detector Navigator",355 356 items: [{357 xtype: 'combo', 358 name: 'sigmas', 359 hideLabel: true, 360 style: 'width:101px', 361 fieldLabel: '', 362 tabIndex: 0, 363 mode: 'local', 364 triggerAction: 'all', 365 typeAhead: true, 366 emptyText: '<enter command>', 367 selectOnFocus: true, 368 displayField: 'commands', 369 store: new Ext.data.SimpleStore({ 370 fields: ['commands'], 371 data: [ 372 ['S p1'], 373 ['M > p1'], 374 ['M < p1'], 375 ['M > p1 < p2'], 376 ['B < p1'], 377 ['B <= p1'], 378 ['B > p1'], 379 ['B >= p1'], 380 ['B > p1 & < p2'], 381 ['B > p1 | < p2'], 382 ] 383 }) 384 }],385 buttons: [{386 text: 'Set', 387 listeners: {click: DetectorNavigator.SetSigmaThreshold} 388 }]389 });390 }391 DetectorNavigator.summaryFormField = document.getElementById('summaryFormField'); 392 DetectorNavigator.summaryFormField.innerHTML = "Filter String:";393 DetectorNavigator.summaryFormField.style.left = '500px';394 395 DetectorNavigator.summaryForm.setVisible(false);396 397 DetectorNavigator.initFedCaptions();398 399 //init view400 if(DetectorNavigator.zoomedIndex[0] < 0){401 DetectorNavigator.zoomedIndex[0] = -1;402 DetectorNavigator.zoomedIndex[1] = -1;403 DetectorNavigator.zoomedIndex[2] = -1;404 DetectorNavigator.displayMiniView();405 DetectorNavigator.canvasOffX = DetectorNavigator.discs[0].offsetLeft+1;406 }407 else{408 DetectorNavigator.displayLargeView();409 DetectorNavigator.canvasOffX = 8;410 }411}412////////////////////////////////////////////////////////////////////////////////////////////////////////////413//needs to be as fast as possible -- this is run all the time!!414DetectorNavigator.getMouseXY = function(e) { 415 416 DetectorNavigator.originX = DetectorNavigator.winPosX + DetectorNavigator.canvasOffX;417 DetectorNavigator.originY = DetectorNavigator.winPosY + DetectorNavigator.canvasOffY;418 //have correct origin---------------------------------------------------------------------------------419 420 var mx = DetectorNavigator.mx = e.pageX-DetectorNavigator.originX;421 var my = DetectorNavigator.my = e.pageY-DetectorNavigator.originY;422 423 DetectorNavigator.inOut = "-";424 DetectorNavigator.blade = "-";425 DetectorNavigator.plaquette = "-";426 DetectorNavigator.roc = "-";427 var rocNotFound = true;428 var highlightIndex = DetectorNavigator.oldHighlightIndex;429 if( mx >= 0 &&430 my >= 0 &&431 mx < DetectorNavigator.WEB_LARGE_WIDTH &&432 my < DetectorNavigator.WEB_LARGE_HEIGHT){ 433 434 if(DetectorNavigator.zoomedIndex[0] < 0){ //mini view435 return;436 }437 if(DetectorNavigator.zoomedIndex[0] == 1){ //bpix438 DetectorNavigator.searchBarrelForCoords(mx,my);439 DetectorNavigator.createCurrentPath();440 return;441 }442 443 //fpix 444 var sqDist;445 var angle;446 var angleMod;447 var up;448 var rt;449 var tmp;450 var invertCondUpDn;451 var invertCondLtRt;452 var slope;453 var vslope;454 var rel;455 var diff;456 var pnl;457 var numOfPlaqs;458 var plaqNotFound;459 var rowIndex;460 var plaq;461 var rocNotFound;462 var i;463 var rowParams;464 var rtRocMult;465 var rocPos;466 467 if(mx < DetectorNavigator.WEB_DISC_X){ 468 DetectorNavigator.inOut = 'O';469 }470 else{471 DetectorNavigator.inOut = 'I';472 }473 474 up = [-1,-1];475 rt = [-1,-1];476 diff = [mx - DetectorNavigator.WEB_DISC_X,my - DetectorNavigator.WEB_DISC_Y];477 478 sqDist = diff[0]*diff[0] + diff[1]*diff[1];479 angle = Math.atan2(diff[1],diff[0]);480 if(angle < 0) //correct negative angles481 angle += 2*Math.PI;482 angle = parseInt((angle*180/Math.PI + 90)%360); //calc angle in degrees in Z[0,359]483 angleMod = angle%15;484 if(angleMod >= 1 && angleMod < 14){ //eliminate dead space between blades485 if(sqDist >= DetectorNavigator.WEB_BLADE_LO && sqDist <= DetectorNavigator.WEB_BLADE_HI){486 //get up and rt vectors for blade487 if(angle > 180){ //half disc on left488 DetectorNavigator.blade = parseInt((360 - angle)/15) + 1;489 up = [-1,-Math.tan(13*Math.PI/24 + (12-DetectorNavigator.blade)*Math.PI/12)];490 }491 else{ //half-disc on right492 DetectorNavigator.blade = parseInt(angle/15) + 1;493 up = [1,Math.tan(-13*Math.PI/24 + DetectorNavigator.blade*Math.PI/12)];494 }495 496 //normalize up vector497 tmp = Math.sqrt(up[0]*up[0] + up[1]*up[1]);498 if(tmp != 0){499 up[0] /= tmp;500 up[1] /= tmp;501 }502 rt = [-up[1], up[0]];503 }504 }505 506 //at this point, have normalized up and rt vector if blade is valid507 508 if(DetectorNavigator.blade != "-"){ //locate plaquettes509 invertCondUpDn = 1; //comparisons switch on bottom half because looking at above and below lines510 if(DetectorNavigator.blade > 6)511 invertCondUpDn *= -1;512 invertCondLtRt = 1; //comparisons switch on left half because looking at left and right of lines513 if(angle > 180)514 invertCondLtRt *= -1;515 slope = rt[1]/rt[0];516 rel = [diff[0],diff[1]];517 518 vslope = up[1]/up[0]; 519 520 pnl = DetectorNavigator.panel-1;521 numOfPlaqs = 4-pnl; 522 plaqNotFound = true;523 rowIndex = -1;524 plaq = 0;525 526 //locate plaquette and row within plaquette527 while(plaqNotFound && plaq < numOfPlaqs){528 529 if(530 0 >= invertCondUpDn*((rel[1] - up[1]*q[pnl][plaq][1]) -531 slope*(rel[0] - up[0]*q[pnl][plaq][1])) &&532 0 <= invertCondUpDn*((rel[1] - up[1]*(q[pnl][plaq][0] + 4)) -533 slope*(rel[0] - up[0]*(q[pnl][plaq][0] + 4)))534 ){535 plaqNotFound = false; 536 537 if(pnl == 0 && (plaq == 0 || plaq == 3)){ //only one row538 rowIndex = 0;539 }540 else if(0 >= invertCondUpDn*((rel[1] - up[1]*q[pnl][plaq][2]) -541 slope*(rel[0] - up[0]*q[pnl][plaq][2])) ){ //top ROC row542 rowIndex = 1;543 }544 else if(0 <= invertCondUpDn*((rel[1] - up[1]*(q[pnl][plaq][2] + 4 - DetectorNavigator.WEB_ROC_OFFSET)) -545 slope*(rel[0] - up[0]*(q[pnl][plaq][2] + 4 - DetectorNavigator.WEB_ROC_OFFSET))) ){ //bottom ROC row546 rowIndex = 0;547 }548 else549 rowIndex = -1;550 }551 552 ++plaq;553 }554 555 if(!plaqNotFound){556 DetectorNavigator.plaquette = (--plaq)+1;557 }558 //find ROC559 if(rowIndex != -1){ 560 for(i=0;rocNotFound && i<q[pnl][plaq][3][rowIndex][0];++i){561 if(562 0 <= invertCondLtRt*((rel[1] - rt[1]*(DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] - i) +563 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i))) -564 vslope*(rel[0] - rt[0]*(DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] - i) +565 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i)))) &&566 0 >= invertCondLtRt*((rel[1] - rt[1]*(DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] + 1 - i) +567 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i))) -568 vslope*(rel[0] - rt[0]*(DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] + 1 - i) +569 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i))))570 ){571 572 DetectorNavigator.roc = q[pnl][plaq][3][rowIndex][1]+q[pnl][plaq][3][rowIndex][2]*i;573 574 //display highlight575 rtRocMult = ((DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] - i) + 576 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i)) +577 (DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] + 1 - i) +578 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i)))/2;579 580 rocPos = [DetectorNavigator.WEB_DISC_X + up[0] * q[pnl][plaq][3][rowIndex][3] + rt[0] * rtRocMult,581 DetectorNavigator.WEB_DISC_Y + up[1] * q[pnl][plaq][3][rowIndex][3] + rt[1] * rtRocMult];582 583 highlightIndex = (DetectorNavigator.blade-1)%6;584 if(angle > 180)585 highlightIndex = 5 - highlightIndex;586 DetectorNavigator.rocHighlights[highlightIndex].style.left = (DetectorNavigator.canvasOffX + rocPos[0] - DetectorNavigator.WEB_ROC_SIZE - 1 +587 DetectorNavigator.safariSubstractOne) + "px";588 DetectorNavigator.rocHighlights[highlightIndex].style.top = (DetectorNavigator.canvasOffY + rocPos[1] - DetectorNavigator.WEB_ROC_SIZE - 1) + "px";589 590 document.body.style.cursor='pointer';591 rocNotFound = false;592 }593 }594 }595 }596 DetectorNavigator.createCurrentPath();597 }598 599 //hide previous highlight600 if(rocNotFound || DetectorNavigator.oldHighlightIndex != highlightIndex){ 601 if(DetectorNavigator.oldHighlightIndex >= 0)602 DetectorNavigator.rocHighlights[DetectorNavigator.oldHighlightIndex].style.left = "-100px";603 DetectorNavigator.oldHighlightIndex = highlightIndex;604 }605}606////////////////////////////////////////////////////////////////////////////////////////////////////////////607DetectorNavigator.zoom = function(isIn,obj) {608 //---------- Get zoomOne and zoomTwo index for display positioning609 if(!isIn){ //zoom out request610 if(DetectorNavigator.zoomedIndex[0] == -1){ //currently mini view611 return;//Already fully zoomed out612 }613 else{ //currently large view 614 DetectorNavigator.zoomedIndex[0] = -1;615 DetectorNavigator.zoomedIndex[1] = -1;616 DetectorNavigator.zoomedIndex[2] = -1;617 }618 }619 else{ //zoom in request620 if(DetectorNavigator.zoomedIndex[0] == -1){ //currently mini view621 622 var idNum = parseInt(obj.id.charAt(obj.id.length-1));623 DetectorNavigator.zoomedIndex[1] = (idNum/2)|0;624 DetectorNavigator.zoomedIndex[2] = idNum%2;625 if(obj.id[0] == 'd'){626 DetectorNavigator.zoomedIndex[0] = 0; //FPix was clicked 627 }628 else{629 DetectorNavigator.zoomedIndex[0] = 1; //BPix was clicked630 }631 632 }633 else{ //currently large view634 return;//Already fully zoomed in635 } 636 }637 //---------- display positioning 638 if(DetectorNavigator.zoomedIndex[0] == -1){ //---------------- display mini639 DetectorNavigator.displayMiniView();640 }641 else{ //---------------- display large642 DetectorNavigator.displayLargeView();643 }644 645}646////////////////////////////////////////////////////////////////////////////////////////////////////////////647DetectorNavigator.displayLargeView = function(){648 649 var captionOff = [DetectorNavigator.WEB_LARGE_WIDTH-2,-23];650 var imgIndex = DetectorNavigator.zoomedIndex[1]*2 + DetectorNavigator.zoomedIndex[2];651 652 if(DetectorNavigator.zoomedIndex[0] == 0){ //zoom on a disc653 //zoom on disc654 DetectorNavigator.discs[imgIndex].onmouseover = function(){document.body.style.cursor='auto';};655 DetectorNavigator.discs[imgIndex].onmousemove = function(){document.body.style.cursor='auto';};656 DetectorNavigator.discs[imgIndex].style.position = 'relative';657 DetectorNavigator.discs[imgIndex].style.width = DetectorNavigator.WEB_LARGE_WIDTH + 'px';658 DetectorNavigator.discs[imgIndex].style.height = DetectorNavigator.WEB_LARGE_HEIGHT + 'px';659 DetectorNavigator.discs[imgIndex].style.left = DetectorNavigator.WEB_XOFFSET +'px';660 661 for(i=0;i<8;++i){ //hide other discs662 if(i != imgIndex){663 DetectorNavigator.discs[i].style.position = 'absolute';664 DetectorNavigator.discs[i].style.left = '-5000px';665 DetectorNavigator.discCaptions[i].style.top = '-100px';666 DetectorNavigator.discFlags[i].style.top = '-100px';667 }668 }669 for(i=0;i<6;++i){ //hide barrels670 DetectorNavigator.barrels[i].style.position = 'absolute';671 DetectorNavigator.barrels[i].style.left = '-5000px';672 DetectorNavigator.barrelCaptions[i].style.top = '-100px';673 DetectorNavigator.barrelFlags[i].style.top = '-100px';674 }675 //hide caption and flag for this disc676 DetectorNavigator.discCaptions[imgIndex].style.left = captionOff[0]-DetectorNavigator.discCaptions[imgIndex].offsetWidth;677 DetectorNavigator.discCaptions[imgIndex].style.top = captionOff[1];678 DetectorNavigator.discFlags[imgIndex].style.top = '-100px';679 680 DetectorNavigator.canvasOffY = 681 DetectorNavigator.discs[imgIndex].offsetTop + 1;//29; 682 683 if(DetectorNavigator.currentSummary != "-"){684 DetectorNavigator.rocColorKeyImage.style.top = DetectorNavigator.WEB_LARGE_HEIGHT/2 - 685 DetectorNavigator.rocColorKeyImage.offsetHeight/2 + "px";686 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i)687 DetectorNavigator.rocColorKeyValues[i].style.top = DetectorNavigator.WEB_LARGE_HEIGHT/2 + 688 DetectorNavigator.rocColorKeyImage.offsetHeight/2 + "px";689 DetectorNavigator.currentSummaryCaption.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 30 + "px";690 if(DetectorNavigator.summaryParameters[4] != -1){691 DetectorNavigator.summaryOvfPic.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 12 + "px";692 DetectorNavigator.summaryOvfText.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 12 + "px";693 DetectorNavigator.summaryUnfPic.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 12 + "px";694 DetectorNavigator.summaryUnfText.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 12 + "px";695 }696 }697 698 if(DetectorNavigator.fedViewMode)699 DetectorNavigator.displayFedCaptions();700 701 }702 else{ //zoom on a barrel703 704 //zoom on barrel705 DetectorNavigator.barrels[imgIndex].onmouseover = function(){document.body.style.cursor='auto';};706 DetectorNavigator.barrels[imgIndex].onmousemove = function(){document.body.style.cursor='auto';};707 DetectorNavigator.barrels[imgIndex].style.position = 'relative';708 DetectorNavigator.barrels[imgIndex].style.width = DetectorNavigator.WEB_BLARGE_WIDTH + 'px';709 DetectorNavigator.barrels[imgIndex].style.height = DetectorNavigator.WEB_BLARGE_HEIGHT + 'px';710 DetectorNavigator.barrels[imgIndex].style.left = DetectorNavigator.WEB_XOFFSET +'px';711 for(i=0;i<6;++i){ //hide other barrels712 if(i != imgIndex){713 DetectorNavigator.barrels[i].style.position = 'absolute';714 DetectorNavigator.barrels[i].style.left = '-5000px';715 DetectorNavigator.barrelCaptions[i].style.top = '-100px';716 DetectorNavigator.barrelFlags[i].style.top = '-100px';717 }718 }719 for(i=0;i<8;++i){ //hide discs720 DetectorNavigator.discs[i].style.position = 'absolute';721 DetectorNavigator.discs[i].style.left = '-5000px';722 DetectorNavigator.discCaptions[i].style.top = '-100px';723 DetectorNavigator.discFlags[i].style.top = '-100px';724 }725 //hide caption and flag for this barrel726 DetectorNavigator.barrelCaptions[imgIndex].style.left = captionOff[0]-DetectorNavigator.barrelCaptions[imgIndex].offsetWidth;727 DetectorNavigator.barrelCaptions[imgIndex].style.top = captionOff[1];728 DetectorNavigator.barrelFlags[imgIndex].style.top = '-100px';729 730 DetectorNavigator.canvasOffY = 731 DetectorNavigator.barrels[imgIndex].offsetTop + 1; 732 733 DetectorNavigator.rocColorKeyImage.style.top = '-100px';734 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i)735 DetectorNavigator.rocColorKeyValues[i].style.top = '-100px'; 736 DetectorNavigator.currentSummaryCaption.style.top = '-100px';737 738 DetectorNavigator.summaryOvfPic.style.top = '-100px';739 DetectorNavigator.summaryOvfText.style.top = '-100px';740 DetectorNavigator.summaryUnfPic.style.top = '-100px';741 DetectorNavigator.summaryUnfText.style.top = '-100px';742 743 DetectorNavigator.hideFedCaptions();744 }745 746 //hide summary details747 DetectorNavigator.summarySigma.style.top = '-100px';748 DetectorNavigator.summaryAverage.style.top = '-100px';749 DetectorNavigator.summaryTotalSamples.style.top = '-100px';750 DetectorNavigator.summaryMinValue.style.top = '-100px';751 DetectorNavigator.summaryMaxValue.style.top = '-100px';752 DetectorNavigator.summaryForm.setVisible(false);753 DetectorNavigator.summaryFormField.style.top = '-100px';754 755 //========= Handle Known Naming Fields ========//756 757 if(DetectorNavigator.zoomedIndex[0] == 0){ //fpix758 //set plus/minus and disc759 if(DetectorNavigator.zoomedIndex[1] < 2){760 DetectorNavigator.plusMinus = 'm';761 DetectorNavigator.disc = 2 - DetectorNavigator.zoomedIndex[1];762 }763 else{764 DetectorNavigator.plusMinus = 'p';765 DetectorNavigator.disc = DetectorNavigator.zoomedIndex[1] - 1;766 }767 //set panel type768 if(DetectorNavigator.zoomedIndex[2] == 0){769 DetectorNavigator.panel = 1;770 }771 else{772 DetectorNavigator.panel = 2;773 }774 }775 else{ //bpix776 //set plus/minus and layer777 if(DetectorNavigator.zoomedIndex[2] == 0){778 DetectorNavigator.plusMinus = 'm';779 }780 else{781 DetectorNavigator.plusMinus = 'p';782 }783 784 DetectorNavigator.layer = DetectorNavigator.zoomedIndex[1] + 1; 785 }786 787 DetectorNavigator.showCurrentPath(); 788}789////////////////////////////////////////////////////////////////////////////////////////////////////////////790DetectorNavigator.displayMiniView = function(){791 DetectorNavigator.hideCurrentPath();792 DetectorNavigator.barrelHighlight.style.top = '-100px'; //hide bpix highlight793 if(DetectorNavigator.oldHighlightIndex >= 0)794 DetectorNavigator.rocHighlights[DetectorNavigator.oldHighlightIndex].style.left = "-100px";795 796 var discCaptionOffset = [7 + DetectorNavigator.WEB_MINI_WIDTH/2,40 + DetectorNavigator.WEB_MINI_HEIGHT/2];797 var barrelCaptionOffset = [7 + DetectorNavigator.WEB_BMINI_WIDTH/2,798 30 + 2*DetectorNavigator.WEB_MINI_HEIGHT + DetectorNavigator.WEB_BMINI_HEIGHT/2];799 800 for(i=0;i<8;++i){ // discs801 DetectorNavigator.discs[i].onmouseover = function(){document.body.style.cursor='pointer';};//hand802 DetectorNavigator.discs[i].onmousemove = function(){document.body.style.cursor='pointer';};//hand803 DetectorNavigator.discs[i].onmouseout = function(){document.body.style.cursor='auto';};804 DetectorNavigator.discs[i].style.position = 'relative';805 DetectorNavigator.discs[i].style.width = DetectorNavigator.WEB_MINI_WIDTH + 'px';806 DetectorNavigator.discs[i].style.height = DetectorNavigator.WEB_MINI_HEIGHT + 'px';807 DetectorNavigator.discs[i].style.left = DetectorNavigator.WEB_XOFFSET + 'px';808 DetectorNavigator.discCaptions[i].style.left809 = discCaptionOffset[0] + DetectorNavigator.WEB_MINI_WIDTH *(i%4) - 810 parseInt(DetectorNavigator.discCaptions[i].offsetWidth)/2 + 'px';811 DetectorNavigator.discCaptions[i].style.top812 = discCaptionOffset[1] + DetectorNavigator.WEB_MINI_HEIGHT *((i/4)|0) + 'px';813 DetectorNavigator.discFlags[i].style.left814 = discCaptionOffset[0] + DetectorNavigator.WEB_MINI_WIDTH *(i%4) - 815 parseInt(DetectorNavigator.discFlags[i].offsetWidth)/2 + 'px';816 DetectorNavigator.discFlags[i].style.top817 = discCaptionOffset[1] + DetectorNavigator.WEB_MINI_HEIGHT *((i/4)|0) + 50 + 'px';818 }819 for(i=0;i<6;++i){ // barrels820 DetectorNavigator.barrels[i].onmouseover = function(){document.body.style.cursor='pointer';};//hand821 DetectorNavigator.barrels[i].onmousemove = function(){document.body.style.cursor='pointer';};//hand822 DetectorNavigator.barrels[i].onmouseout = function(){document.body.style.cursor='auto';};823 DetectorNavigator.barrels[i].style.position = 'relative';824 DetectorNavigator.barrels[i].style.width = DetectorNavigator.WEB_BMINI_WIDTH + 'px';825 DetectorNavigator.barrels[i].style.height = DetectorNavigator.WEB_BMINI_HEIGHT + 'px';826 DetectorNavigator.barrels[i].style.left = DetectorNavigator.WEB_XOFFSET + 'px';827 DetectorNavigator.barrelCaptions[i].style.left828 = barrelCaptionOffset[0] + DetectorNavigator.WEB_BMINI_WIDTH *i - 829 parseInt(DetectorNavigator.barrelCaptions[i].offsetWidth)/2 + 'px';830 DetectorNavigator.barrelCaptions[i].style.top = barrelCaptionOffset[1] + 'px';831 DetectorNavigator.barrelFlags[i].style.left832 = barrelCaptionOffset[0] + DetectorNavigator.WEB_BMINI_WIDTH *i - 833 parseInt(DetectorNavigator.barrelFlags[i].offsetWidth)/2 + 'px';834 DetectorNavigator.barrelFlags[i].style.top = barrelCaptionOffset[1] + 50 + 'px';835 }836 837 DetectorNavigator.canvasOffY = DetectorNavigator.discs[0].offsetTop;//79;838 839 if(DetectorNavigator.currentSummary != "-"){840 DetectorNavigator.rocColorKeyImage.style.top = '33px';841 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i)842 DetectorNavigator.rocColorKeyValues[i].style.top = 843 DetectorNavigator.rocColorKeyImage.offsetTop + 25 + "px";844 845 var tmpseparation = 14;846 var tmpyoff = 1;847 DetectorNavigator.currentSummaryCaption.style.top = tmpyoff + "px";848 DetectorNavigator.summarySigma.style.top = tmpyoff + "px";849 DetectorNavigator.summaryAverage.style.top = 1*tmpseparation + tmpyoff + "px";850 DetectorNavigator.summaryTotalSamples.style.top = 2*tmpseparation + tmpyoff + "px";851 DetectorNavigator.summaryMinValue.style.top = 3*tmpseparation + tmpyoff + "px";852 DetectorNavigator.summaryMaxValue.style.top = 4*tmpseparation + tmpyoff + "px";853 854 DetectorNavigator.summaryForm.setVisible(true); 855 DetectorNavigator.summaryFormField.style.top = '1px';856 857 if(DetectorNavigator.summaryParameters[4] != -1){ 858 DetectorNavigator.summaryOvfPic.style.top = "20px";859 DetectorNavigator.summaryOvfText.style.top = "20px";860 DetectorNavigator.summaryUnfPic.style.top = "20px";861 DetectorNavigator.summaryUnfText.style.top = "20px";862 } 863 }864 865 DetectorNavigator.hideFedCaptions();866} 867////////////////////////////////////////////////////////////////////////////////////////////////////////////868DetectorNavigator.createCurrentPath = function() {869 870 if(DetectorNavigator.zoomedIndex[0] < 0 || DetectorNavigator.inOut == undefined){ //nothing871 DetectorNavigator.rocPath = "";872 }873 else if(DetectorNavigator.zoomedIndex[0] == 0){ //fpix874 //plus/minus, disc, and panel are assumed available875 876 DetectorNavigator.rocPath = "FPix_B" + DetectorNavigator.plusMinus;877 878 if(DetectorNavigator.inOut != "-")879 DetectorNavigator.rocPath += DetectorNavigator.inOut;880 DetectorNavigator.rocPath += "_D" + DetectorNavigator.disc;881 if(DetectorNavigator.blade != "-")882 DetectorNavigator.rocPath += "_BLD" + DetectorNavigator.blade;883 DetectorNavigator.rocPath += "_PNL" + DetectorNavigator.panel;884 if(DetectorNavigator.plaquette != "-")885 DetectorNavigator.rocPath += "_PLQ" + DetectorNavigator.plaquette;886 if(DetectorNavigator.roc != "-")887 DetectorNavigator.rocPath += "_ROC" + DetectorNavigator.roc;888 }889 else{ //bpix890 //plus/minus and layer is assumed available891 892 DetectorNavigator.rocPath = "BPix_B" + DetectorNavigator.plusMinus;893 894 if(DetectorNavigator.inOut != "-")895 DetectorNavigator.rocPath += DetectorNavigator.inOut;896 if(DetectorNavigator.sector != "-")897 DetectorNavigator.rocPath += "_SEC" + DetectorNavigator.sector;898 DetectorNavigator.rocPath += "_LYR" + DetectorNavigator.layer;899 if(DetectorNavigator.ladder != "-")900 DetectorNavigator.rocPath += "_LDR" + DetectorNavigator.ladder;901 if(DetectorNavigator.module != "-")902 DetectorNavigator.rocPath += "_MOD" + DetectorNavigator.module;903 if(DetectorNavigator.roc != "-")904 DetectorNavigator.rocPath += "_ROC" + DetectorNavigator.roc;905 906 }907 908 DetectorNavigator.rocPathDiv.innerHTML = DetectorNavigator.rocPath;909}910////////////////////////////////////////////////////////////////////////////////////////////////////////////911DetectorNavigator.showCurrentPath = function() {912 DetectorNavigator.createCurrentPath();913 DetectorNavigator.rocPathDiv.style.left = '10px';914 DetectorNavigator.rocPathDiv.style.top = '0px';915}916////////////////////////////////////////////////////////////////////////////////////////////////////////////917DetectorNavigator.hideCurrentPath = function() {918 DetectorNavigator.rocPathDiv.style.top = '-100px';919}920////////////////////////////////////////////////////////////////////////////////////////////////////////////921DetectorNavigator.searchBarrelForCoords = function(x,y) {922 DetectorNavigator.inOut = "-";923 DetectorNavigator.sector = "-";924 DetectorNavigator.ladder = "-";925 DetectorNavigator.module = "-";926 DetectorNavigator.roc = "-";927 928 x -= DetectorNavigator.WEB_BLYR_XOFF; 929 y -= DetectorNavigator.WEB_BLYR_YOFF;930 if(x < 0 || y < 0){931 DetectorNavigator.barrelHighlight.style.top = '-100px'; //hide highlight932 return;933 }934 935 var p = [x%(DetectorNavigator.WEB_BROC_WIDTH + DetectorNavigator.WEB_BCOL_OFFSET),936 y%(DetectorNavigator.WEB_BROC_HEIGHT + DetectorNavigator.WEB_BROW_OFFSET)];937 938 var col = (x/ (DetectorNavigator.WEB_BROC_WIDTH + DetectorNavigator.WEB_BCOL_OFFSET)) | 0;939 var row = (y/ (DetectorNavigator.WEB_BROC_HEIGHT + DetectorNavigator.WEB_BROW_OFFSET)) | 0;940 941 942 DetectorNavigator.barrelCol = col;943 DetectorNavigator.barrelRow = row;944 945 var li = DetectorNavigator.zoomedIndex[1];946 var numOfRows = DetectorNavigator.BPIX_LYR_ROWS[li];947 948 if(col >= DetectorNavigator.BPIX_LYR_COLS || 949 row >= numOfRows){950 DetectorNavigator.barrelHighlight.style.top = '-100px'; //hide highlight951 return;952 }953 954 var moduloCmp = 0;955 if(DetectorNavigator.zoomedIndex[2] == 0){956 col = DetectorNavigator.BPIX_LYR_COLS - 1 - col;957 moduloCmp = 1;958 }959 //coordinate in valid region960 961 //find inner/outer962 if(row < numOfRows/2){963 DetectorNavigator.inOut = 'I';964 }965 else{966 DetectorNavigator.inOut = 'O'; 967 row = numOfRows - 1 - row;968 }969 //find sector970 if(row < DetectorNavigator.endSectorRows[li]){ //first sector971 DetectorNavigator.sector = 1; 972 }973 else{974 row -= DetectorNavigator.endSectorRows[li];975 DetectorNavigator.sector = 2 + ((row/DetectorNavigator.otherSectorRows[li])|0);976 if(DetectorNavigator.sector > 8)977 DetectorNavigator.sector = 8;978 979 if(li == 2 && DetectorNavigator.sector >= 4){980 row -= DetectorNavigator.otherSectorRows[li]*2;981 if(row < 8){ //in sector 4 or 5982 DetectorNavigator.sector = 4 + ((row/4)|0);983 row = row%4;984 }985 else{986 DetectorNavigator.sector = 6 + (((row-8)/DetectorNavigator.otherSectorRows[li])|0);987 row = (row-8)%DetectorNavigator.otherSectorRows[li]; 988 }989 }990 else{991 row -= DetectorNavigator.otherSectorRows[li]*(DetectorNavigator.sector-2); 992 }993 }994 //row now is the row withing the sector995 var doubleRow = ((row/2)|0);996 997 //find ladder998 if(DetectorNavigator.sector == 1){999 if(row == 0){1000 DetectorNavigator.ladder = '1H'1001 }1002 else{1003 DetectorNavigator.ladder = (2 + (((row-1)/2)|0)) + 'F'; 1004 }1005 }1006 else if(li == 2 && DetectorNavigator.sector >= 4){1007 if(DetectorNavigator.sector <= 5){1008 var startLadder = 10;1009 DetectorNavigator.ladder = (startLadder + (DetectorNavigator.sector-4)*2 + doubleRow) + 'F';1010 }1011 else{1012 var startLadder = 14;1013 DetectorNavigator.ladder = (startLadder +1014 (DetectorNavigator.sector-6)*DetectorNavigator.otherSectorRows[li]/2 + doubleRow) + 'F';1015 if(DetectorNavigator.ladder == "22F"){1016 DetectorNavigator.ladder = "22H";1017 }1018 }1019 }1020 else if(DetectorNavigator.sector == 8){1021 DetectorNavigator.ladder = ((DetectorNavigator.endSectorRows[li]/2)|0) + 1 +1022 (((numOfRows/2 - DetectorNavigator.endSectorRows[li])/2)|0) + doubleRow;1023 1024 if(row == DetectorNavigator.endSectorRows[li] - 1){1025 DetectorNavigator.ladder += 'H';1026 }1027 else{1028 DetectorNavigator.ladder += 'F';1029 }1030 } 1031 else{1032 DetectorNavigator.ladder = (((DetectorNavigator.endSectorRows[li]/2)|0) + 2 + 1033 (DetectorNavigator.sector-2)*DetectorNavigator.otherSectorRows[li]/2 + doubleRow) + 'F';1034 }1035 1036 //find module1037 DetectorNavigator.module = ((col/8)|0) + 1;1038 1039 //find ROC 1040 if(p[0] < DetectorNavigator.WEB_BROC_WIDTH && 1041 p[1] < DetectorNavigator.WEB_BROC_HEIGHT){1042 1043 if( (DetectorNavigator.inOut == 'I' && DetectorNavigator.sector == 1 && row != 0 && row%2 == moduloCmp) || 1044 (DetectorNavigator.inOut == 'I' && DetectorNavigator.sector == 8 && 1045 row != DetectorNavigator.endSectorRows[li] - 1 && row%2 == 1 - moduloCmp) || 1046 (DetectorNavigator.inOut == 'I' && DetectorNavigator.sector != 8 &&1047 DetectorNavigator.sector != 1 && row%2 == 1 - moduloCmp) || 1048 (DetectorNavigator.inOut == 'O' && DetectorNavigator.sector == 1 && row != 0 && row%2 == 1 - moduloCmp) || 1049 (DetectorNavigator.inOut == 'O' && DetectorNavigator.sector == 8 &&1050 row != DetectorNavigator.endSectorRows[li] - 1 && row%2 == moduloCmp) || 1051 (DetectorNavigator.inOut == 'O' && DetectorNavigator.sector != 8 &&1052 DetectorNavigator.sector != 1 && row%2 == moduloCmp)){1053 DetectorNavigator.roc = 8+(col%8);1054 }1055 else{1056 DetectorNavigator.roc = 7-(col%8);1057 } 1058 //place highlight1059 DetectorNavigator.barrelHighlight.style.left = DetectorNavigator.canvasOffX + DetectorNavigator.WEB_BLYR_XOFF - 1 +1060 DetectorNavigator.safariSubstractOne + 1061 DetectorNavigator.barrelCol*(DetectorNavigator.WEB_BROC_WIDTH + DetectorNavigator.WEB_BCOL_OFFSET) + 'px';1062 DetectorNavigator.barrelHighlight.style.top = DetectorNavigator.canvasOffY + DetectorNavigator.WEB_BLYR_YOFF - 2 +1063 DetectorNavigator.barrelRow*(DetectorNavigator.WEB_BROC_HEIGHT + DetectorNavigator.WEB_BROW_OFFSET) + 'px';1064 document.body.style.cursor='pointer';1065 }1066 else{1067 DetectorNavigator.barrelHighlight.style.top = '-100px'; //hide highlight1068 }1069}1070////////////////////////////////////////////////////////////////////////////////////////////////////////////1071DetectorNavigator.clickRoc = function() {1072 if(DetectorNavigator.roc == "-"){1073 alert("Illegal Roc Click Call.");1074 return;1075 }1076 1077 var detIndex = DetectorNavigator.zoomedIndex[1]*2 + DetectorNavigator.zoomedIndex[2];1078 var pushVal; //create an integer value that represents the ROC1079 if(DetectorNavigator.zoomedIndex[0] == 0){//fpix1080 DetectorNavigator.imageUpdateIndex = DetectorNavigator.zoomedIndex[1]*2 + DetectorNavigator.zoomedIndex[2];1081 1082 var bladeSize = DetectorNavigator.panel == 1 ? 21:24;1083 var blade = DetectorNavigator.inOut == 'O' ? 13+(12-DetectorNavigator.blade):DetectorNavigator.blade;1084 --blade;1085 1086 var plaqOff;1087 var rowSize;1088 if(DetectorNavigator.panel == 1){1089 plaqOff = [0,2,8,16];1090 rowSize = [2,3,4,5];1091 }1092 else{1093 plaqOff = [0,6,14]; 1094 rowSize = [3,4,5]; 1095 }1096 1097 var roc = DetectorNavigator.roc < rowSize[DetectorNavigator.plaquette-1] ? 1098 rowSize[DetectorNavigator.plaquette-1]-1-DetectorNavigator.roc : DetectorNavigator.roc;1099 pushVal = blade*bladeSize + (bladeSize-1) - (plaqOff[DetectorNavigator.plaquette-1] + roc);1100 }1101 else{//bpix1102 DetectorNavigator.imageUpdateIndex = -(DetectorNavigator.zoomedIndex[1]*2 + DetectorNavigator.zoomedIndex[2]) - 1;1103 1104 pushVal = DetectorNavigator.barrelRow*DetectorNavigator.BPIX_LYR_COLS + DetectorNavigator.barrelCol;1105 }1106 1107 if(DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].indexOf(pushVal) == -1){ //add if necessary1108 DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].push(pushVal);1109 DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].sort(function(a,b){return a - b});1110 }1111 1112 Ext.Ajax.request({1113 url: 'XGI_DetectorRocRequest',1114 success: DetectorNavigator.ajaxRocResponse,1115 failure: ajaxFailure,1116 params: {1117 rocpath: DetectorNavigator.rocPath,1118 clickmask: DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].toString(),1119 clicksize: DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].length,1120 summary: DetectorNavigator.currentSummary,1121 field: DetectorNavigator.currentSummaryField1122 }1123 });1124 1125 //open up directory1126 var expandStr = DetectorNavigator.createExpandString();1127 FileTreeWindow.contentTree.expandPath(expandStr,"text",DetectorNavigator.expandCallBack);1128}1129////////////////////////////////////////////////////////////////////////////////////////////////////////////1130DetectorNavigator.expandCallBack = function(success,rocFolder)1131{ 1132 if(success)1133 {1134 1135 var objects = "";1136 var count = 0;1137 var rocName = DetectorNavigator.rocPath;1138 rocFolder.eachChild(function(child)1139 {1140 if(child.id.indexOf(rocName) != -1)1141 {1142 var regExp=new RegExp(rocName+"[0-9]");1143 if(child.id.match(regExp) == null)1144 {1145 objects += child.id + "--"; 1146 ++count;1147 }//if 1148 }//if1149 });//rocFolder1150// rocFolder.eachChild(function(child){objects += child.id; ++count;});1151 1152 Canvas.add("Multi-Canvas",objects);1153 }//if success1154}1155////////////////////////////////////////////////////////////////////////////////////////////////////////////1156DetectorNavigator.createExpandString = function(){1157 var retStr = "/contentRoot/";1158 var recursiveStr;1159 var pathStr = DetectorNavigator.rocPath;1160 var i;1161 1162 recursiveStr = pathStr.slice(0,4);1163 retStr += recursiveStr + "/";1164 pathStr = pathStr.slice(5);1165 1166 while((i = pathStr.indexOf("_")) != -1){1167 //if(pathStr[i-1] == "I" || pathStr[i-1] == "O") --i;1168 1169 recursiveStr += "_" + pathStr.slice(0,i);1170// recursiveStr = pathStr.slice(0,i);1171 retStr += recursiveStr + "/";1172 1173 //if(pathStr[i] == "I" || pathStr[i] == "O"){ 1174 // ++i; recursiveStr += pathStr[i-1];1175 // retStr += recursiveStr + "/";1176 //}1177 1178 pathStr = pathStr.slice(i+1);1179 1180 }1181// recursiveStr += "_" + pathStr;1182// recursiveStr = pathStr;1183// retStr += recursiveStr;1184 retStr = retStr.slice(0,retStr.length-1);1185 return retStr;1186}1187////////////////////////////////////////////////////////////////////////////////////////////////////////////1188DetectorNavigator.clearClickMask = function() { 1189 //remove all ROC's from clickMask1190 for(i=0;i<8;++i){1191 if(DetectorNavigator.clickMask[0][i].length != 0)1192 DetectorNavigator.clickMask[0][i].splice(0,DetectorNavigator.clickMask[0][i].length);1193 }1194 for(i=0;i<6;++i){1195 if(DetectorNavigator.clickMask[1][i].length != 0)1196 DetectorNavigator.clickMask[1][i].splice(0,DetectorNavigator.clickMask[1][i].length);1197 }1198}1199////////////////////////////////////////////////////////////////////////////////////////////////////////////1200DetectorNavigator.ajaxRocResponse = function(ajaxObj) { 1201 1202 //DetectorNavigator.imageUpdateIndex is the positive index of the disc for FPix1203 //DetectorNavigator.imageUpdateIndex is the negative index minus 1 of the layer for BPix1204 if(ajaxObj.responseText == "[]"){1205 alert("Requested Producer not found. The producer's name may have changed - try refreshing the file list.");1206 return;1207 }1208 1209 if(DetectorNavigator.imageUpdateIndex >= 0){ // fpix1210 DetectorNavigator.discs[DetectorNavigator.imageUpdateIndex].src = ajaxObj.responseText;1211 }1212 else{ // bpix1213 ++DetectorNavigator.imageUpdateIndex;1214 DetectorNavigator.imageUpdateIndex *= -1;1215 DetectorNavigator.barrels[DetectorNavigator.imageUpdateIndex].src = ajaxObj.responseText;1216 }1217}1218////////////////////////////////////////////////////////////////////////////////////////////////////////////1219DetectorNavigator.paintWithTree = function(summaryNode)1220{1221// window.alert("DetectorNavigator.paintWithTree");1222// window.alert("DetectorNavigator.paintWithTree ---->summaryNode.text= " + summaryNode.text);1223 if(summaryNode.text.indexOf("Field - ") < 0)1224 { //is the summary root1225 //remove current children of summary node1226// window.alert("DetectorNavigator.paintWithTree--->if(summaryNode.text.indexOf(\"Field - \") < 0)");1227 var numOfChildren = summaryNode.childNodes.length;1228 1229 for(i=numOfChildren-1;i>=0;--i)1230 summaryNode.removeChild(summaryNode.childNodes[i]);1231 1232 DetectorNavigator.currentSummaryNode = summaryNode;1233 Ext.Ajax.request({1234 url: 'XGI_RequestHistogram',1235 success: DetectorNavigator.populateFieldNodes,1236 failure: ajaxFailure,1237 params: {1238 histoname: summaryNode.id,1239 field: ""1240 }//params1241 }); ////Ext.Ajax.request1242 }//if sumaryNode.text.indexOf1243 else1244 { //field is requested1245// window.alert("DetectorNavigator.paintWithTree--->else");1246 DetectorNavigator.currentSummary = summaryNode.id.slice(0,summaryNode.id.lastIndexOf("/"));1247// window.alert("DetectorNavigator.paintWithTree--->else--->currentSummary= " + summaryNode.id.slice(0,summaryNode.id.lastIndexOf("/")));1248 DetectorNavigator.currentSummaryField = summaryNode.id.slice(summaryNode.id.lastIndexOf("/")+1);1249// window.alert("DetectorNavigator.paintWithTree--->else--->currentSummaryField= " + summaryNode.id.lastIndexOf("/")+1);1250 Ext.Ajax.request({1251 url: 'XGI_RequestHistogram',1252 success: DetectorNavigator.reload,1253 failure: ajaxFailure,1254 params: {1255 histoname: DetectorNavigator.currentSummary,1256 field: DetectorNavigator.currentSummaryField,1257 requestId: escape(HistoViewer.globalRequestId)1258 }//params1259 });//Ext.Ajax.request 1260 }//else1261}//paintWithTree1262////////////////////////////////////////////////////////////////////////////////////////////////////////////1263DetectorNavigator.populateFieldNodes = function(ajaxObj)1264{1265// window.alert("DetectorNavigator.populatefieldNodes");1266 var fieldStr = ajaxObj.responseText.slice(1);1267//i window.alert("DetectorNavigator.populatefieldNodes------>ajaxObj.responseText= " + ajaxObj.responseText);1268// window.alert("DetectorNavigator.populatefieldNodes------>fieldStr= " + fieldStr);1269 var node;1270 var i;1271 var field;1272 while(((i = fieldStr.indexOf(",")) != -1 || (i = fieldStr.indexOf("]")) != -1) && i != 0)1273 {1274 field = fieldStr.slice(0,i);1275 if(i < fieldStr.length)1276 fieldStr = fieldStr.slice(i+1); 1277// window.alert("DetectorNavigator.populatefieldNodes--->field= " + field);1278 DetectorNavigator.currentSummaryNode.appendChild(node = new Ext.tree.TreeNode({1279 text: 'Field - ' + field,1280 id: DetectorNavigator.currentSummaryNode.id + "/" + field,1281 leaf: true,1282 cls: 'file',1283 }));1284 1285 node.addListener("click",FileTreeWindow.onContentClick); 1286 }//while1287 1288 DetectorNavigator.currentSummaryNode.expand(); 1289}//populateFieldNodes1290////////////////////////////////////////////////////////////////////////////////////////////////////////////1291DetectorNavigator.reload = function(ajaxObj){1292 1293 DetectorWindow.showWindow();1294 if(!DetectorNavigator.isFirstLoad){ //window already loaded so need to reload.1295 DetectorNavigator.isFirstLoad = true;1296 DetectorWindow.win.load({1297 url: "XGI_DetectorNavigator?requestId=" + 1298 escape(HistoViewer.globalRequestId),1299 });1300 } 1301 1302 DetectorNavigator.clearClickMask(); 1303 1304 if(ajaxObj){ //get stats for summary1305 var fieldStr = ajaxObj.responseText; 1306 var i;1307 var field;1308 var fieldNum = 0;1309 while((i = fieldStr.indexOf(",")) != -1){1310 field = fieldStr.slice(0,i);1311 fieldStr = fieldStr.slice(i+1);1312 DetectorNavigator.summaryParameters[fieldNum++] = field;1313 }1314 }1315}1316////////////////////////////////////////////////////////////////////////////////////////////////////////////1317DetectorNavigator.SetSigmaThreshold = function(){1318 Ext.Ajax.request({1319 url: 'XGI_RequestHistogram',1320 success: DetectorNavigator.reload,1321 failure: ajaxFailure,1322 params: {1323 histoname: DetectorNavigator.currentSummary,1324 field: DetectorNavigator.currentSummaryField,1325 requestId: escape(HistoViewer.globalRequestId),1326 filter: DetectorNavigator.summaryForm.items.items[0].getValue()1327 }1328 });1329}1330////////////////////////////////////////////////////////////////////////////////////////////////////////////1331DetectorNavigator.initFedCaptions = function(){1332 if(!DetectorNavigator.fedCaptionTops[0]){ //only initialize values once1333 var dir;1334 var radius = 195;1335 var ang = Math.PI/24 - Math.PI/2;1336 var tmp; 1337 var xoffset = -10;1338 var yoffset = 18;1339 1340 DetectorNavigator.fedViewMode = true;1341 1342 for(i=0;i<12;++i){1343 dir = [1,Math.tan(ang)];1344 tmp = Math.sqrt(dir[0]*dir[0] + dir[1]*dir[1]);1345 dir[0] /= tmp;1346 dir[1] /= tmp;1347 1348 DetectorNavigator.fedCaptionLefts[i] = DetectorNavigator.WEB_DISC_X + 1349 dir[0]*radius + xoffset - 1000 + "px";1350 DetectorNavigator.fedCaptionTops[i] = DetectorNavigator.WEB_DISC_Y + 1351 dir[1]*radius + yoffset + "px";1352 DetectorNavigator.fedCaptionLefts[i+12] = DetectorNavigator.WEB_DISC_X - 1353 dir[0]*radius + xoffset - 1000 + "px";1354 DetectorNavigator.fedCaptionTops[i+12] = DetectorNavigator.WEB_DISC_Y - 1355 dir[1]*radius + yoffset + "px";1356 ang += Math.PI/12;1357 }1358 }1359 1360 for(i=0;i<24;++i){1361 DetectorNavigator.fedCaptions[i] = document.getElementById('fedCaption'+i); 1362 DetectorNavigator.fedCaptions[i].style.top = DetectorNavigator.fedCaptionTops[i];1363 DetectorNavigator.fedCaptions[i].style.left = DetectorNavigator.fedCaptionLefts[i];1364 }1365}1366////////////////////////////////////////////////////////////////////////////////////////////////////////////1367DetectorNavigator.displayFedCaptions = function(){1368 if(DetectorNavigator.fedCaptions[0].offsetLeft > 0 || DetectorNavigator.zoomedIndex[0] != 0) //only show if hidden1369 return;1370 1371 //zoomedIndex: 0,1 for Fpix,Bpix, 0-4,3 for disc,layer, 0,1 for left,right1372 Ext.Ajax.request({1373 url: 'XGI_RequestFedAssignment',1374 success: DetectorNavigator.displayFedCallback,1375 failure: ajaxFailure,1376 params: {1377 disc: DetectorNavigator.zoomedIndex[1],1378 inner: DetectorNavigator.zoomedIndex[2]1379 }1380 });1381 1382}1383////////////////////////////////////////////////////////////////////////////////////////////////////////////1384DetectorNavigator.displayFedCallback = function(ajaxObj){1385 var ps = new Array();1386 if(ajaxObj){ //get stats for summary1387 var fieldStr = ajaxObj.responseText; 1388 var i;1389 var field;1390 var fieldNum = 0;1391 while((i = fieldStr.indexOf(",")) != -1){1392 field = fieldStr.slice(0,i);1393 fieldStr = fieldStr.slice(i+1);1394 ps[fieldNum++] = field;1395 }1396 }1397 1398 if(fieldNum != 24){1399 alert("DetectorNavigator.displayFedCallback: invalid field amount");return;} 1400 1401 for(i=0;i<24;++i){1402 DetectorNavigator.fedCaptions[i].innerHTML = ps[i];1403 DetectorNavigator.fedCaptions[i].style.left =1404 DetectorNavigator.fedCaptions[i].offsetLeft + 1000 + "px";1405 }1406}1407////////////////////////////////////////////////////////////////////////////////////////////////////////////1408DetectorNavigator.hideFedCaptions = function(){1409 if(DetectorNavigator.fedCaptions[0].offsetLeft > 0) //only hide if shown1410 for(i=0;i<24;++i){1411 DetectorNavigator.fedCaptions[i].style.left = 1412 DetectorNavigator.fedCaptions[i].offsetLeft - 1000 + "px";1413 }1414}1415////////////////////////////////////////////////////////////////////////////////////////////////////////////1416DetectorNavigator.expandFedPath = function(i){1417 i = DetectorNavigator.fedCaptions[i].innerHTML;1418 var c = i.indexOf(":");1419 var fed = i.slice(0,c);1420 var ch = i.slice(c+1);1421 var expandStr = "/contentRoot/" + "FED" + fed + "_Channel" + ch;1422 FileTreeWindow.contentTree.expandPath(expandStr,"text",DetectorNavigator.expandCallBack);1423}...

Full Screen

Full Screen

DetectorNavigator.js

Source:DetectorNavigator.js Github

copy

Full Screen

1var DetectorNavigator = {};2DetectorNavigator.isFirstLoad = true;3DetectorNavigator.originX;4DetectorNavigator.originY;5DetectorNavigator.mx; //{x,y} mouse coords corresponding to pixel in image. {0,0} is top left.6DetectorNavigator.my;7DetectorNavigator.winObj;8DetectorNavigator.winPosX;9DetectorNavigator.winPosY;10DetectorNavigator.canvasOffX;11DetectorNavigator.canvasOffY;12DetectorNavigator.discs = new Array();13DetectorNavigator.barrels = new Array();14DetectorNavigator.discCaptions = new Array();15DetectorNavigator.barrelCaptions = new Array();16DetectorNavigator.discFlags = new Array();17DetectorNavigator.barrelFlags = new Array();18DetectorNavigator.rocHighlights = new Array();19DetectorNavigator.fedCaptions = new Array();20DetectorNavigator.fedCaptionTops = new Array(); //store y val so it only has to be calculated once21DetectorNavigator.fedCaptionLefts = new Array();//store x val so it only has to be calculated once22DetectorNavigator.fedViewMode;23DetectorNavigator.zoomedIndex = [-1,-1,-1]; //0,1 for Fpix,Bpix, 0-4,3 for disc,layer, 0,1 for left,right24DetectorNavigator.clickMask = [[[],[],[],[],[],[],[],[]],[[],[],[],[],[],[]]]; //[2][8,6][x]25DetectorNavigator.currentSummaryNode; //used for filling summary fields26DetectorNavigator.currentSummary = "-";27DetectorNavigator.currentSummaryField = "-";28DetectorNavigator.currentSummaryCaption;29DetectorNavigator.rocColorKeyImage;30DetectorNavigator.colorCodeImages = new Array();31DetectorNavigator.rocColorKeyValues = new Array();32DetectorNavigator.rocColorKeyValuesNumber = 5;33DetectorNavigator.summaryOvfPic;34DetectorNavigator.summaryOvfText;35DetectorNavigator.summaryUnfPic;36DetectorNavigator.summaryUnfText;37DetectorNavigator.summarySigma;38DetectorNavigator.summaryForm = 0;39DetectorNavigator.summaryFormField;40DetectorNavigator.summaryAverage;41DetectorNavigator.summaryTotalSamples;42DetectorNavigator.summaryMinValue;43DetectorNavigator.summaryMaxValue;44DetectorNavigator.summaryParameters = new Array(); //from ajax response45 //0 - total samples46 //1 - min value47 //2 - max value48 //3 - avg49 //4 - sigma (-1 if booleanOnly)50 //5 - min limit51 //6 - max limit52 //fpix naming53DetectorNavigator.disc;54DetectorNavigator.blade;55DetectorNavigator.panel;56DetectorNavigator.plaquette;57 //bpix naming58DetectorNavigator.sector;59DetectorNavigator.layer;60DetectorNavigator.ladder;61DetectorNavigator.module;62 //common naming63DetectorNavigator.plusMinus;64DetectorNavigator.inOut;65DetectorNavigator.roc; 66DetectorNavigator.rocPathDiv; //div with full string67DetectorNavigator.rocPath; //full string68 69 //fpix ROC location members70DetectorNavigator.oldHighlightIndex = -1;71 //bpix ROC location members72DetectorNavigator.endSectorRows = [3,3,5];73DetectorNavigator.otherSectorRows = [2,4,6];74DetectorNavigator.safariSubstractOne = 0;75DetectorNavigator.barrelCol;76DetectorNavigator.barrelRow;77 //start c++ constants input here78DetectorNavigator.WEB_LARGE_WIDTH = 600;79DetectorNavigator.WEB_LARGE_HEIGHT = 600;80DetectorNavigator.WEB_MINI_WIDTH = 150;81DetectorNavigator.WEB_MINI_HEIGHT = 150;82DetectorNavigator.WEB_BLARGE_WIDTH = 600;83DetectorNavigator.WEB_BLARGE_HEIGHT = 600;84DetectorNavigator.WEB_BMINI_WIDTH = 100;85DetectorNavigator.WEB_BMINI_HEIGHT = 200;86DetectorNavigator.WEB_XOFFSET = 0;87DetectorNavigator.WEB_YOFFSET = 2;88DetectorNavigator.WEB_ROC_SIZE = 9;89DetectorNavigator.WEB_DISC_X = 300;90DetectorNavigator.WEB_DISC_Y = 300;91DetectorNavigator.WEB_BLADE_HI = 89401;92DetectorNavigator.WEB_BLADE_LO = 45369;93DetectorNavigator.WEB_ROC_OFFSET = 3;94DetectorNavigator.WEB_BLYR_XOFF = 14;95DetectorNavigator.WEB_BLYR_YOFF = 5;96DetectorNavigator.WEB_BROC_WIDTH = 14;97DetectorNavigator.WEB_BROC_HEIGHT = 5;98DetectorNavigator.WEB_BROW_OFFSET = 2;99DetectorNavigator.WEB_BCOL_OFFSET = 4;100DetectorNavigator.BPIX_LYR_COLS = 32;101DetectorNavigator.BPIX_LYR_ROWS = 102 [36,60,84];103 //query Plaquette/ROC parameters from C++104 // [PlaqHighUpBoundary,PlaqLowUpBoundary,PlaqMiddleUpBoundary,105 // [[numOfRocs,rocOff,rocSign,upRocMult],106 // [numOfRocs,rocOff,rocSign,upRocMult]],107 // rocSizeMult,rocOffMult],108var q = 109 [ 110 [ //4-pplaquette panel type 1111 [223,214,0,112 [ [2,1,-1,(223 + 214)/2] ,113 []] ,114 0.0, 0.5],115 [251,230,242,116 [ [3,2,-1,(230 + 242 - 3)/2] ,117 [3,3, 1,(251 + 242)/2]] ,118 0.5, 1.0],119 [279,258,270,120 [ [4,3,-1,(258 + 270 - 3)/2] ,121 [4,4, 1,(279 + 270)/2]] ,122 1.0, 1.5],123 [295,286,0,124 [ [5,4,-1,(295 + 286)/2] ,125 []] ,126 1.5, 2.0]127 ],128 [ //3-pplaquette panel type 2129 [239,218,230,130 [ [3,2,-1,(218 + 230 - 3)/2] ,131 [3,3, 1,(239 + 230)/2]] ,132 0.5, 1.0],133 [267,246,258,134 [ [4,3,-1,(246 + 258 - 3)/2] ,135 [4,4, 1,(267 + 258)/2]] ,136 1.0, 1.5],137 [295,274,286,138 [ [5,4,-1,(274 + 286 - 3)/2] ,139 [5,5, 1,(295 + 286)/2]] ,140 1.5, 2.0]141 ] 142 ];143 //end c++ constants section144 145 146 //saved code snippets147 //document.body.style.cursor='pointer';//hand148 //document.body.style.cursor='auto'; //normal149 //document.body.style.cursor='arrow'; //arrow 150 //document.forms['detNavForm'].mouseXDisplay.value = "-";151 //document.forms['detNavForm'].mouseYDisplay.value = "-";152 //document.forms['detNavForm'].mouseXDisplay.value = mx;153 //document.forms['detNavForm'].mouseYDisplay.value = my;154 //var time = (new Date()).getTime();155 //document.forms['detNavForm'].mouseXDisplay.value = (new Date()).getTime() - time;156 //document.forms['detNavForm'].mouseYDisplay.value = (new Date()).getTime() - time;157 //end saved code snippets158 159////////////////////////////////////////////////////////////////////////////////////////////////////////////160DetectorNavigator.init = function(dWin) {161 dWin.win.addListener('move',DetectorNavigator.updateWinPos);162 DetectorNavigator.winObj = dWin; 163}164////////////////////////////////////////////////////////////////////////////////////////////////////////////165DetectorNavigator.updateWinPos = function(w,x,y){166 DetectorNavigator.winPosX = DetectorNavigator.winObj.win.getPosition()[0];167 DetectorNavigator.winPosY = DetectorNavigator.winObj.win.body.getY(); 168}169////////////////////////////////////////////////////////////////////////////////////////////////////////////170DetectorNavigator.initObjects = function(){171 if(!DetectorNavigator.isFirstLoad) //prevent re-initialization when images are updated172 return;173 DetectorNavigator.isFirstLoad = false;174 175 DetectorNavigator.winPosX = DetectorNavigator.winObj.win.getPosition()[0];176 DetectorNavigator.winPosY = DetectorNavigator.winObj.win.body.getY(); 177 DetectorNavigator.rocPathDiv = document.getElementById('currentPath');178 179 for(i=0;i<8;++i){ //acquire highlight objects180 DetectorNavigator.discs[i] = document.getElementById('disc'+i);181 DetectorNavigator.discCaptions[i] = document.getElementById('discCaption'+i);182 DetectorNavigator.discFlags[i] = document.getElementById('discFlag'+i);183 }184 for(i=0;i<6;++i){ //acquire highlight objects185 DetectorNavigator.barrels[i] = document.getElementById('barrel'+i);186 DetectorNavigator.barrelCaptions[i] = document.getElementById('barrelCaption'+i);187 DetectorNavigator.barrelFlags[i] = document.getElementById('barrelFlag'+i);188 }189 for(i=0;i<6;++i){ //acquire highlight objects190 DetectorNavigator.rocHighlights[i] = document.getElementById('rocHighlight' + i);191 DetectorNavigator.rocHighlights[i].style.width = DetectorNavigator.WEB_ROC_SIZE*2+"px";192 DetectorNavigator.rocHighlights[i].style.height = DetectorNavigator.WEB_ROC_SIZE*2+"px";193 }194 DetectorNavigator.barrelHighlight = document.getElementById('rocHighlight');195 DetectorNavigator.barrelHighlight.style.width = DetectorNavigator.WEB_BROC_WIDTH+2+"px";196 DetectorNavigator.barrelHighlight.style.height = DetectorNavigator.WEB_BROC_HEIGHT+4+"px";197 //setup summary objects198 DetectorNavigator.colorCodeImages[0] = document.getElementById('rocColorKey');199 DetectorNavigator.colorCodeImages[0].style.top = '-100px';200 DetectorNavigator.colorCodeImages[1] = document.getElementById('rocColorKeyBool');201 DetectorNavigator.colorCodeImages[1].style.top = '-100px';202 DetectorNavigator.colorCodeImages[0].style.width = '300px';203 DetectorNavigator.colorCodeImages[0].style.height = '25px';204 DetectorNavigator.colorCodeImages[1].style.width = '300px';205 DetectorNavigator.colorCodeImages[1].style.height = '25px';206 DetectorNavigator.rocColorKeyImage = DetectorNavigator.colorCodeImages[0];207 208 DetectorNavigator.currentSummaryCaption = document.getElementById('summaryName'); 209 var tmpsummary = DetectorNavigator.currentSummary;210 while((i = tmpsummary.indexOf("/")) != -1){211 tmpsummary = tmpsummary.slice(i+1); 212 }213 DetectorNavigator.currentSummaryCaption.innerHTML = tmpsummary + " - " + DetectorNavigator.currentSummaryField;214 DetectorNavigator.currentSummaryCaption.style.left = 7 + //only top is changed215 DetectorNavigator.WEB_LARGE_WIDTH/2 - DetectorNavigator.currentSummaryCaption.offsetWidth/2 + "px";216 217 var tmpxoff = 10;218 DetectorNavigator.summarySigma = document.getElementById('summarySigma'); 219 DetectorNavigator.summarySigma.innerHTML = "&sigma;: " + DetectorNavigator.summaryParameters[4];220 DetectorNavigator.summarySigma.style.left = tmpxoff + "px";221 222 DetectorNavigator.summaryAverage = document.getElementById('summaryAvg'); 223 DetectorNavigator.summaryAverage.innerHTML = "Avg: " + DetectorNavigator.summaryParameters[3];224 DetectorNavigator.summaryAverage.style.left = tmpxoff + "px";225 226 DetectorNavigator.summaryTotalSamples = document.getElementById('summarySamples'); 227 DetectorNavigator.summaryTotalSamples.innerHTML = "Samples: " + DetectorNavigator.summaryParameters[0];228 DetectorNavigator.summaryTotalSamples.style.left = tmpxoff + "px";229 230 DetectorNavigator.summaryMinValue = document.getElementById('sumamryMin'); 231 DetectorNavigator.summaryMinValue.innerHTML = "Min: " + DetectorNavigator.summaryParameters[1];232 DetectorNavigator.summaryMinValue.style.left = tmpxoff + "px";233 234 DetectorNavigator.summaryMaxValue = document.getElementById('summaryMax'); 235 DetectorNavigator.summaryMaxValue.innerHTML = "Max: " + DetectorNavigator.summaryParameters[2];236 DetectorNavigator.summaryMaxValue.style.left = tmpxoff + "px";237 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i)238 DetectorNavigator.rocColorKeyValues[i] = document.getElementById('rocColorKeyValues'+i);239 if(DetectorNavigator.summaryParameters[4] == -1){ //boolean only summary 240 DetectorNavigator.rocColorKeyValues[0].innerHTML = "Fail";241 DetectorNavigator.rocColorKeyValues[1].innerHTML = "Pass";242 DetectorNavigator.rocColorKeyImage = DetectorNavigator.colorCodeImages[1];243 DetectorNavigator.summarySigma.style.left = '-1000px';244 //DetectorNavigator.summaryAverage.style.left = '-1000px';245 //DetectorNavigator.summaryMinValue.style.left = '-1000px';246 //DetectorNavigator.summaryMaxValue.style.left = '-1000px';247 }248 else{ //normal summary249 var p1 = parseFloat(DetectorNavigator.summaryParameters[5]);250 p1 *= 100;251 p1 = Math.round(p1);252 p1 /= 100;253 var p2 = parseFloat(DetectorNavigator.summaryParameters[6]);254 p2 *= 100;255 p2 = Math.round(p2);256 p2 /= 100;257 var p3 = (p1 + p2)/2;258 p3 *= 100;259 p3 = Math.round(p3);260 p3 /= 100;261 var p4 = (p1 + p3)/2;262 p4 *= 100;263 p4 = Math.round(p4);264 p4 /= 100;265 var p5 = (p3 + p2)/2;266 p5 *= 100;267 p5 = Math.round(p5);268 p5 /= 100;269 270 DetectorNavigator.rocColorKeyValues[0].innerHTML = p1;271 DetectorNavigator.rocColorKeyValues[4].innerHTML = p2;272 DetectorNavigator.rocColorKeyValues[2].innerHTML = p3;273 DetectorNavigator.rocColorKeyValues[1].innerHTML = p4;274 DetectorNavigator.rocColorKeyValues[3].innerHTML = p5;275 }276 277 DetectorNavigator.rocColorKeyImage.style.left = 7 + //only top is changed278 DetectorNavigator.WEB_LARGE_WIDTH/2 - DetectorNavigator.rocColorKeyImage.offsetWidth/2 + "px";279 280 if(DetectorNavigator.summaryParameters[4] == -1){ 281 DetectorNavigator.rocColorKeyValues[0].style.left = DetectorNavigator.rocColorKeyImage.offsetLeft282 + 1*DetectorNavigator.rocColorKeyImage.offsetWidth/(DetectorNavigator.rocColorKeyValuesNumber-1)283 - DetectorNavigator.rocColorKeyValues[0].offsetWidth/2 + "px";284 DetectorNavigator.rocColorKeyValues[1].style.left = DetectorNavigator.rocColorKeyImage.offsetLeft285 + 3*DetectorNavigator.rocColorKeyImage.offsetWidth/(DetectorNavigator.rocColorKeyValuesNumber-1)286 - DetectorNavigator.rocColorKeyValues[0].offsetWidth/2 + "px";287 for(i=2;i<DetectorNavigator.rocColorKeyValuesNumber;++i){288 DetectorNavigator.rocColorKeyValues[i].style.left = "-1000px";289 }290 }291 else{292 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i){293 DetectorNavigator.rocColorKeyValues[i].style.left = DetectorNavigator.rocColorKeyImage.offsetLeft294 + i*DetectorNavigator.rocColorKeyImage.offsetWidth/(DetectorNavigator.rocColorKeyValuesNumber-1)295 - DetectorNavigator.rocColorKeyValues[i].offsetWidth/2 + "px";296 }297 }298 299 DetectorNavigator.summaryOvfPic = document.getElementById('rocColorKeyOver');300 DetectorNavigator.summaryOvfPic.style.width = '10px';301 DetectorNavigator.summaryOvfPic.style.height = '10px';302 DetectorNavigator.summaryOvfText = document.getElementById('rocColorKeyOverText'); 303 DetectorNavigator.summaryOvfText.innerHTML = "Overflow";304 305 DetectorNavigator.summaryOvfText.style.left = 7 + 306 DetectorNavigator.WEB_LARGE_WIDTH/2 + 60 - 307 (DetectorNavigator.summaryOvfPic.offsetWidth + 308 DetectorNavigator.summaryOvfText.offsetWidth + 5)/2 + "px";309 DetectorNavigator.summaryOvfPic.style.left = DetectorNavigator.summaryOvfText.offsetLeft + 310 DetectorNavigator.summaryOvfText.offsetWidth + 5 + "px";311 312 DetectorNavigator.summaryUnfPic = document.getElementById('rocColorKeyUnder');313 DetectorNavigator.summaryUnfPic.style.width = '10px';314 DetectorNavigator.summaryUnfPic.style.height = '10px';315 DetectorNavigator.summaryUnfText = document.getElementById('rocColorKeyUnderText'); 316 DetectorNavigator.summaryUnfText.innerHTML = "Underflow";317 318 DetectorNavigator.summaryUnfText.style.left = 7 + 319 DetectorNavigator.WEB_LARGE_WIDTH/2 - 60 - 320 (DetectorNavigator.summaryUnfPic.offsetWidth +321 DetectorNavigator.summaryUnfText.offsetWidth + 5)/2 + "px";322 DetectorNavigator.summaryUnfPic.style.left = DetectorNavigator.summaryUnfText.offsetLeft + 323 DetectorNavigator.summaryUnfText.offsetWidth + 5 + "px"; 324 325 //capture mouse coordinates326 document.captureEvents(Event.MOUSEMOVE);327 document.onmousemove = DetectorNavigator.getMouseXY;328 329 if("Apple Computer, Inc." == navigator.vendor){ // fix for safari right click issue330 for(i=0;i<8;++i){331 DetectorNavigator.discs[i].oncontextmenu = function(){DetectorNavigator.zoom(false);};332 } 333 for(i=0;i<6;++i){334 DetectorNavigator.barrels[i].oncontextmenu = function(){DetectorNavigator.zoom(false);};335 }336 for(i=0;i<6;++i){337 DetectorNavigator.rocHighlights[i].oncontextmenu = function(){DetectorNavigator.zoom(false);};338 }339 DetectorNavigator.barrelHighlight.oncontextmenu = function(){DetectorNavigator.zoom(false);};340 //fix for weird pixel off problem on bpix highlight341 DetectorNavigator.safariSubstractOne = -1;342 }343 344 //sigma form for summary345 if(!DetectorNavigator.summaryForm){346 DetectorNavigator.summaryForm = new Ext.form.FormPanel({347 baseCls: 'x-plain',348 autoScroll: false,349 buttonAlign: 'right',350 labelAlign: 'top',351 style: "position:absolute;z-index:2",352 x: 490,353 y: 37-DetectorNavigator.safariSubstractOne,354 renderTo: "Detector Navigator",355 356 items: [{357 xtype: 'combo', 358 name: 'sigmas', 359 hideLabel: true, 360 style: 'width:101px', 361 fieldLabel: '', 362 tabIndex: 0, 363 mode: 'local', 364 triggerAction: 'all', 365 typeAhead: true, 366 emptyText: '<enter command>', 367 selectOnFocus: true, 368 displayField: 'commands', 369 store: new Ext.data.SimpleStore({ 370 fields: ['commands'], 371 data: [ 372 ['S p1'], 373 ['M > p1'], 374 ['M < p1'], 375 ['M > p1 < p2'], 376 ['B < p1'], 377 ['B <= p1'], 378 ['B > p1'], 379 ['B >= p1'], 380 ['B > p1 & < p2'], 381 ['B > p1 | < p2'], 382 ] 383 }) 384 }],385 buttons: [{386 text: 'Set', 387 listeners: {click: DetectorNavigator.SetSigmaThreshold} 388 }]389 });390 }391 DetectorNavigator.summaryFormField = document.getElementById('summaryFormField'); 392 DetectorNavigator.summaryFormField.innerHTML = "Filter String:";393 DetectorNavigator.summaryFormField.style.left = '500px';394 395 DetectorNavigator.summaryForm.setVisible(false);396 397 DetectorNavigator.initFedCaptions();398 399 //init view400 if(DetectorNavigator.zoomedIndex[0] < 0){401 DetectorNavigator.zoomedIndex[0] = -1;402 DetectorNavigator.zoomedIndex[1] = -1;403 DetectorNavigator.zoomedIndex[2] = -1;404 DetectorNavigator.displayMiniView();405 DetectorNavigator.canvasOffX = DetectorNavigator.discs[0].offsetLeft+1;406 }407 else{408 DetectorNavigator.displayLargeView();409 DetectorNavigator.canvasOffX = 8;410 }411}412////////////////////////////////////////////////////////////////////////////////////////////////////////////413//needs to be as fast as possible -- this is run all the time!!414DetectorNavigator.getMouseXY = function(e) { 415 416 DetectorNavigator.originX = DetectorNavigator.winPosX + DetectorNavigator.canvasOffX;417 DetectorNavigator.originY = DetectorNavigator.winPosY + DetectorNavigator.canvasOffY;418 //have correct origin---------------------------------------------------------------------------------419 420 var mx = DetectorNavigator.mx = e.pageX-DetectorNavigator.originX;421 var my = DetectorNavigator.my = e.pageY-DetectorNavigator.originY;422 423 DetectorNavigator.inOut = "-";424 DetectorNavigator.blade = "-";425 DetectorNavigator.plaquette = "-";426 DetectorNavigator.roc = "-";427 var rocNotFound = true;428 var highlightIndex = DetectorNavigator.oldHighlightIndex;429 if( mx >= 0 &&430 my >= 0 &&431 mx < DetectorNavigator.WEB_LARGE_WIDTH &&432 my < DetectorNavigator.WEB_LARGE_HEIGHT){ 433 434 if(DetectorNavigator.zoomedIndex[0] < 0){ //mini view435 return;436 }437 if(DetectorNavigator.zoomedIndex[0] == 1){ //bpix438 DetectorNavigator.searchBarrelForCoords(mx,my);439 DetectorNavigator.createCurrentPath();440 return;441 }442 443 //fpix 444 var sqDist;445 var angle;446 var angleMod;447 var up;448 var rt;449 var tmp;450 var invertCondUpDn;451 var invertCondLtRt;452 var slope;453 var vslope;454 var rel;455 var diff;456 var pnl;457 var numOfPlaqs;458 var plaqNotFound;459 var rowIndex;460 var plaq;461 var rocNotFound;462 var i;463 var rowParams;464 var rtRocMult;465 var rocPos;466 467 if(mx < DetectorNavigator.WEB_DISC_X){ 468 DetectorNavigator.inOut = 'O';469 }470 else{471 DetectorNavigator.inOut = 'I';472 }473 474 up = [-1,-1];475 rt = [-1,-1];476 diff = [mx - DetectorNavigator.WEB_DISC_X,my - DetectorNavigator.WEB_DISC_Y];477 478 sqDist = diff[0]*diff[0] + diff[1]*diff[1];479 angle = Math.atan2(diff[1],diff[0]);480 if(angle < 0) //correct negative angles481 angle += 2*Math.PI;482 angle = parseInt((angle*180/Math.PI + 90)%360); //calc angle in degrees in Z[0,359]483 angleMod = angle%15;484 if(angleMod >= 1 && angleMod < 14){ //eliminate dead space between blades485 if(sqDist >= DetectorNavigator.WEB_BLADE_LO && sqDist <= DetectorNavigator.WEB_BLADE_HI){486 //get up and rt vectors for blade487 if(angle > 180){ //half disc on left488 DetectorNavigator.blade = parseInt((360 - angle)/15) + 1;489 up = [-1,-Math.tan(13*Math.PI/24 + (12-DetectorNavigator.blade)*Math.PI/12)];490 }491 else{ //half-disc on right492 DetectorNavigator.blade = parseInt(angle/15) + 1;493 up = [1,Math.tan(-13*Math.PI/24 + DetectorNavigator.blade*Math.PI/12)];494 }495 496 //normalize up vector497 tmp = Math.sqrt(up[0]*up[0] + up[1]*up[1]);498 if(tmp != 0){499 up[0] /= tmp;500 up[1] /= tmp;501 }502 rt = [-up[1], up[0]];503 }504 }505 506 //at this point, have normalized up and rt vector if blade is valid507 508 if(DetectorNavigator.blade != "-"){ //locate plaquettes509 invertCondUpDn = 1; //comparisons switch on bottom half because looking at above and below lines510 if(DetectorNavigator.blade > 6)511 invertCondUpDn *= -1;512 invertCondLtRt = 1; //comparisons switch on left half because looking at left and right of lines513 if(angle > 180)514 invertCondLtRt *= -1;515 slope = rt[1]/rt[0];516 rel = [diff[0],diff[1]];517 518 vslope = up[1]/up[0]; 519 520 pnl = DetectorNavigator.panel-1;521 numOfPlaqs = 4-pnl; 522 plaqNotFound = true;523 rowIndex = -1;524 plaq = 0;525 526 //locate plaquette and row within plaquette527 while(plaqNotFound && plaq < numOfPlaqs){528 529 if(530 0 >= invertCondUpDn*((rel[1] - up[1]*q[pnl][plaq][1]) -531 slope*(rel[0] - up[0]*q[pnl][plaq][1])) &&532 0 <= invertCondUpDn*((rel[1] - up[1]*(q[pnl][plaq][0] + 4)) -533 slope*(rel[0] - up[0]*(q[pnl][plaq][0] + 4)))534 ){535 plaqNotFound = false; 536 537 if(pnl == 0 && (plaq == 0 || plaq == 3)){ //only one row538 rowIndex = 0;539 }540 else if(0 >= invertCondUpDn*((rel[1] - up[1]*q[pnl][plaq][2]) -541 slope*(rel[0] - up[0]*q[pnl][plaq][2])) ){ //top ROC row542 rowIndex = 1;543 }544 else if(0 <= invertCondUpDn*((rel[1] - up[1]*(q[pnl][plaq][2] + 4 - DetectorNavigator.WEB_ROC_OFFSET)) -545 slope*(rel[0] - up[0]*(q[pnl][plaq][2] + 4 - DetectorNavigator.WEB_ROC_OFFSET))) ){ //bottom ROC row546 rowIndex = 0;547 }548 else549 rowIndex = -1;550 }551 552 ++plaq;553 }554 555 if(!plaqNotFound){556 DetectorNavigator.plaquette = (--plaq)+1;557 }558 //find ROC559 if(rowIndex != -1){ 560 for(i=0;rocNotFound && i<q[pnl][plaq][3][rowIndex][0];++i){561 if(562 0 <= invertCondLtRt*((rel[1] - rt[1]*(DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] - i) +563 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i))) -564 vslope*(rel[0] - rt[0]*(DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] - i) +565 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i)))) &&566 0 >= invertCondLtRt*((rel[1] - rt[1]*(DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] + 1 - i) +567 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i))) -568 vslope*(rel[0] - rt[0]*(DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] + 1 - i) +569 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i))))570 ){571 572 DetectorNavigator.roc = q[pnl][plaq][3][rowIndex][1]+q[pnl][plaq][3][rowIndex][2]*i;573 574 //display highlight575 rtRocMult = ((DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] - i) + 576 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i)) +577 (DetectorNavigator.WEB_ROC_SIZE*(q[pnl][plaq][4] + 1 - i) +578 DetectorNavigator.WEB_ROC_OFFSET*(q[pnl][plaq][5] - i)))/2;579 580 rocPos = [DetectorNavigator.WEB_DISC_X + up[0] * q[pnl][plaq][3][rowIndex][3] + rt[0] * rtRocMult,581 DetectorNavigator.WEB_DISC_Y + up[1] * q[pnl][plaq][3][rowIndex][3] + rt[1] * rtRocMult];582 583 highlightIndex = (DetectorNavigator.blade-1)%6;584 if(angle > 180)585 highlightIndex = 5 - highlightIndex;586 DetectorNavigator.rocHighlights[highlightIndex].style.left = (DetectorNavigator.canvasOffX + rocPos[0] - DetectorNavigator.WEB_ROC_SIZE - 1 +587 DetectorNavigator.safariSubstractOne) + "px";588 DetectorNavigator.rocHighlights[highlightIndex].style.top = (DetectorNavigator.canvasOffY + rocPos[1] - DetectorNavigator.WEB_ROC_SIZE - 1) + "px";589 590 document.body.style.cursor='pointer';591 rocNotFound = false;592 }593 }594 }595 }596 DetectorNavigator.createCurrentPath();597 }598 599 //hide previous highlight600 if(rocNotFound || DetectorNavigator.oldHighlightIndex != highlightIndex){ 601 if(DetectorNavigator.oldHighlightIndex >= 0)602 DetectorNavigator.rocHighlights[DetectorNavigator.oldHighlightIndex].style.left = "-100px";603 DetectorNavigator.oldHighlightIndex = highlightIndex;604 }605}606////////////////////////////////////////////////////////////////////////////////////////////////////////////607DetectorNavigator.zoom = function(isIn,obj) {608 //---------- Get zoomOne and zoomTwo index for display positioning609 if(!isIn){ //zoom out request610 if(DetectorNavigator.zoomedIndex[0] == -1){ //currently mini view611 return;//Already fully zoomed out612 }613 else{ //currently large view 614 DetectorNavigator.zoomedIndex[0] = -1;615 DetectorNavigator.zoomedIndex[1] = -1;616 DetectorNavigator.zoomedIndex[2] = -1;617 }618 }619 else{ //zoom in request620 if(DetectorNavigator.zoomedIndex[0] == -1){ //currently mini view621 622 var idNum = parseInt(obj.id.charAt(obj.id.length-1));623 DetectorNavigator.zoomedIndex[1] = (idNum/2)|0;624 DetectorNavigator.zoomedIndex[2] = idNum%2;625 if(obj.id[0] == 'd'){626 DetectorNavigator.zoomedIndex[0] = 0; //FPix was clicked 627 }628 else{629 DetectorNavigator.zoomedIndex[0] = 1; //BPix was clicked630 }631 632 }633 else{ //currently large view634 return;//Already fully zoomed in635 } 636 }637 //---------- display positioning 638 if(DetectorNavigator.zoomedIndex[0] == -1){ //---------------- display mini639 DetectorNavigator.displayMiniView();640 }641 else{ //---------------- display large642 DetectorNavigator.displayLargeView();643 }644 645}646////////////////////////////////////////////////////////////////////////////////////////////////////////////647DetectorNavigator.displayLargeView = function(){648 649 var captionOff = [DetectorNavigator.WEB_LARGE_WIDTH-2,-23];650 var imgIndex = DetectorNavigator.zoomedIndex[1]*2 + DetectorNavigator.zoomedIndex[2];651 652 if(DetectorNavigator.zoomedIndex[0] == 0){ //zoom on a disc653 //zoom on disc654 DetectorNavigator.discs[imgIndex].onmouseover = function(){document.body.style.cursor='auto';};655 DetectorNavigator.discs[imgIndex].onmousemove = function(){document.body.style.cursor='auto';};656 DetectorNavigator.discs[imgIndex].style.position = 'relative';657 DetectorNavigator.discs[imgIndex].style.width = DetectorNavigator.WEB_LARGE_WIDTH + 'px';658 DetectorNavigator.discs[imgIndex].style.height = DetectorNavigator.WEB_LARGE_HEIGHT + 'px';659 DetectorNavigator.discs[imgIndex].style.left = DetectorNavigator.WEB_XOFFSET +'px';660 661 for(i=0;i<8;++i){ //hide other discs662 if(i != imgIndex){663 DetectorNavigator.discs[i].style.position = 'absolute';664 DetectorNavigator.discs[i].style.left = '-5000px';665 DetectorNavigator.discCaptions[i].style.top = '-100px';666 DetectorNavigator.discFlags[i].style.top = '-100px';667 }668 }669 for(i=0;i<6;++i){ //hide barrels670 DetectorNavigator.barrels[i].style.position = 'absolute';671 DetectorNavigator.barrels[i].style.left = '-5000px';672 DetectorNavigator.barrelCaptions[i].style.top = '-100px';673 DetectorNavigator.barrelFlags[i].style.top = '-100px';674 }675 //hide caption and flag for this disc676 DetectorNavigator.discCaptions[imgIndex].style.left = captionOff[0]-DetectorNavigator.discCaptions[imgIndex].offsetWidth;677 DetectorNavigator.discCaptions[imgIndex].style.top = captionOff[1];678 DetectorNavigator.discFlags[imgIndex].style.top = '-100px';679 680 DetectorNavigator.canvasOffY = 681 DetectorNavigator.discs[imgIndex].offsetTop + 1;//29; 682 683 if(DetectorNavigator.currentSummary != "-"){684 DetectorNavigator.rocColorKeyImage.style.top = DetectorNavigator.WEB_LARGE_HEIGHT/2 - 685 DetectorNavigator.rocColorKeyImage.offsetHeight/2 + "px";686 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i)687 DetectorNavigator.rocColorKeyValues[i].style.top = DetectorNavigator.WEB_LARGE_HEIGHT/2 + 688 DetectorNavigator.rocColorKeyImage.offsetHeight/2 + "px";689 DetectorNavigator.currentSummaryCaption.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 30 + "px";690 if(DetectorNavigator.summaryParameters[4] != -1){691 DetectorNavigator.summaryOvfPic.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 12 + "px";692 DetectorNavigator.summaryOvfText.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 12 + "px";693 DetectorNavigator.summaryUnfPic.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 12 + "px";694 DetectorNavigator.summaryUnfText.style.top = DetectorNavigator.rocColorKeyImage.offsetTop - 12 + "px";695 }696 }697 698 if(DetectorNavigator.fedViewMode)699 DetectorNavigator.displayFedCaptions();700 701 }702 else{ //zoom on a barrel703 704 //zoom on barrel705 DetectorNavigator.barrels[imgIndex].onmouseover = function(){document.body.style.cursor='auto';};706 DetectorNavigator.barrels[imgIndex].onmousemove = function(){document.body.style.cursor='auto';};707 DetectorNavigator.barrels[imgIndex].style.position = 'relative';708 DetectorNavigator.barrels[imgIndex].style.width = DetectorNavigator.WEB_BLARGE_WIDTH + 'px';709 DetectorNavigator.barrels[imgIndex].style.height = DetectorNavigator.WEB_BLARGE_HEIGHT + 'px';710 DetectorNavigator.barrels[imgIndex].style.left = DetectorNavigator.WEB_XOFFSET +'px';711 for(i=0;i<6;++i){ //hide other barrels712 if(i != imgIndex){713 DetectorNavigator.barrels[i].style.position = 'absolute';714 DetectorNavigator.barrels[i].style.left = '-5000px';715 DetectorNavigator.barrelCaptions[i].style.top = '-100px';716 DetectorNavigator.barrelFlags[i].style.top = '-100px';717 }718 }719 for(i=0;i<8;++i){ //hide discs720 DetectorNavigator.discs[i].style.position = 'absolute';721 DetectorNavigator.discs[i].style.left = '-5000px';722 DetectorNavigator.discCaptions[i].style.top = '-100px';723 DetectorNavigator.discFlags[i].style.top = '-100px';724 }725 //hide caption and flag for this barrel726 DetectorNavigator.barrelCaptions[imgIndex].style.left = captionOff[0]-DetectorNavigator.barrelCaptions[imgIndex].offsetWidth;727 DetectorNavigator.barrelCaptions[imgIndex].style.top = captionOff[1];728 DetectorNavigator.barrelFlags[imgIndex].style.top = '-100px';729 730 DetectorNavigator.canvasOffY = 731 DetectorNavigator.barrels[imgIndex].offsetTop + 1; 732 733 DetectorNavigator.rocColorKeyImage.style.top = '-100px';734 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i)735 DetectorNavigator.rocColorKeyValues[i].style.top = '-100px'; 736 DetectorNavigator.currentSummaryCaption.style.top = '-100px';737 738 DetectorNavigator.summaryOvfPic.style.top = '-100px';739 DetectorNavigator.summaryOvfText.style.top = '-100px';740 DetectorNavigator.summaryUnfPic.style.top = '-100px';741 DetectorNavigator.summaryUnfText.style.top = '-100px';742 743 DetectorNavigator.hideFedCaptions();744 }745 746 //hide summary details747 DetectorNavigator.summarySigma.style.top = '-100px';748 DetectorNavigator.summaryAverage.style.top = '-100px';749 DetectorNavigator.summaryTotalSamples.style.top = '-100px';750 DetectorNavigator.summaryMinValue.style.top = '-100px';751 DetectorNavigator.summaryMaxValue.style.top = '-100px';752 DetectorNavigator.summaryForm.setVisible(false);753 DetectorNavigator.summaryFormField.style.top = '-100px';754 755 //========= Handle Known Naming Fields ========//756 757 if(DetectorNavigator.zoomedIndex[0] == 0){ //fpix758 //set plus/minus and disc759 if(DetectorNavigator.zoomedIndex[1] < 2){760 DetectorNavigator.plusMinus = 'm';761 DetectorNavigator.disc = 2 - DetectorNavigator.zoomedIndex[1];762 }763 else{764 DetectorNavigator.plusMinus = 'p';765 DetectorNavigator.disc = DetectorNavigator.zoomedIndex[1] - 1;766 }767 //set panel type768 if(DetectorNavigator.zoomedIndex[2] == 0){769 DetectorNavigator.panel = 1;770 }771 else{772 DetectorNavigator.panel = 2;773 }774 }775 else{ //bpix776 //set plus/minus and layer777 if(DetectorNavigator.zoomedIndex[2] == 0){778 DetectorNavigator.plusMinus = 'm';779 }780 else{781 DetectorNavigator.plusMinus = 'p';782 }783 784 DetectorNavigator.layer = DetectorNavigator.zoomedIndex[1] + 1; 785 }786 787 DetectorNavigator.showCurrentPath(); 788}789////////////////////////////////////////////////////////////////////////////////////////////////////////////790DetectorNavigator.displayMiniView = function(){791 DetectorNavigator.hideCurrentPath();792 DetectorNavigator.barrelHighlight.style.top = '-100px'; //hide bpix highlight793 if(DetectorNavigator.oldHighlightIndex >= 0)794 DetectorNavigator.rocHighlights[DetectorNavigator.oldHighlightIndex].style.left = "-100px";795 796 var discCaptionOffset = [7 + DetectorNavigator.WEB_MINI_WIDTH/2,40 + DetectorNavigator.WEB_MINI_HEIGHT/2];797 var barrelCaptionOffset = [7 + DetectorNavigator.WEB_BMINI_WIDTH/2,798 30 + 2*DetectorNavigator.WEB_MINI_HEIGHT + DetectorNavigator.WEB_BMINI_HEIGHT/2];799 800 for(i=0;i<8;++i){ // discs801 DetectorNavigator.discs[i].onmouseover = function(){document.body.style.cursor='pointer';};//hand802 DetectorNavigator.discs[i].onmousemove = function(){document.body.style.cursor='pointer';};//hand803 DetectorNavigator.discs[i].onmouseout = function(){document.body.style.cursor='auto';};804 DetectorNavigator.discs[i].style.position = 'relative';805 DetectorNavigator.discs[i].style.width = DetectorNavigator.WEB_MINI_WIDTH + 'px';806 DetectorNavigator.discs[i].style.height = DetectorNavigator.WEB_MINI_HEIGHT + 'px';807 DetectorNavigator.discs[i].style.left = DetectorNavigator.WEB_XOFFSET + 'px';808 DetectorNavigator.discCaptions[i].style.left809 = discCaptionOffset[0] + DetectorNavigator.WEB_MINI_WIDTH *(i%4) - 810 parseInt(DetectorNavigator.discCaptions[i].offsetWidth)/2 + 'px';811 DetectorNavigator.discCaptions[i].style.top812 = discCaptionOffset[1] + DetectorNavigator.WEB_MINI_HEIGHT *((i/4)|0) + 'px';813 DetectorNavigator.discFlags[i].style.left814 = discCaptionOffset[0] + DetectorNavigator.WEB_MINI_WIDTH *(i%4) - 815 parseInt(DetectorNavigator.discFlags[i].offsetWidth)/2 + 'px';816 DetectorNavigator.discFlags[i].style.top817 = discCaptionOffset[1] + DetectorNavigator.WEB_MINI_HEIGHT *((i/4)|0) + 50 + 'px';818 }819 for(i=0;i<6;++i){ // barrels820 DetectorNavigator.barrels[i].onmouseover = function(){document.body.style.cursor='pointer';};//hand821 DetectorNavigator.barrels[i].onmousemove = function(){document.body.style.cursor='pointer';};//hand822 DetectorNavigator.barrels[i].onmouseout = function(){document.body.style.cursor='auto';};823 DetectorNavigator.barrels[i].style.position = 'relative';824 DetectorNavigator.barrels[i].style.width = DetectorNavigator.WEB_BMINI_WIDTH + 'px';825 DetectorNavigator.barrels[i].style.height = DetectorNavigator.WEB_BMINI_HEIGHT + 'px';826 DetectorNavigator.barrels[i].style.left = DetectorNavigator.WEB_XOFFSET + 'px';827 DetectorNavigator.barrelCaptions[i].style.left828 = barrelCaptionOffset[0] + DetectorNavigator.WEB_BMINI_WIDTH *i - 829 parseInt(DetectorNavigator.barrelCaptions[i].offsetWidth)/2 + 'px';830 DetectorNavigator.barrelCaptions[i].style.top = barrelCaptionOffset[1] + 'px';831 DetectorNavigator.barrelFlags[i].style.left832 = barrelCaptionOffset[0] + DetectorNavigator.WEB_BMINI_WIDTH *i - 833 parseInt(DetectorNavigator.barrelFlags[i].offsetWidth)/2 + 'px';834 DetectorNavigator.barrelFlags[i].style.top = barrelCaptionOffset[1] + 50 + 'px';835 }836 837 DetectorNavigator.canvasOffY = DetectorNavigator.discs[0].offsetTop;//79;838 839 if(DetectorNavigator.currentSummary != "-"){840 DetectorNavigator.rocColorKeyImage.style.top = '33px';841 for(i=0;i<DetectorNavigator.rocColorKeyValuesNumber;++i)842 DetectorNavigator.rocColorKeyValues[i].style.top = 843 DetectorNavigator.rocColorKeyImage.offsetTop + 25 + "px";844 845 var tmpseparation = 14;846 var tmpyoff = 1;847 DetectorNavigator.currentSummaryCaption.style.top = tmpyoff + "px";848 DetectorNavigator.summarySigma.style.top = tmpyoff + "px";849 DetectorNavigator.summaryAverage.style.top = 1*tmpseparation + tmpyoff + "px";850 DetectorNavigator.summaryTotalSamples.style.top = 2*tmpseparation + tmpyoff + "px";851 DetectorNavigator.summaryMinValue.style.top = 3*tmpseparation + tmpyoff + "px";852 DetectorNavigator.summaryMaxValue.style.top = 4*tmpseparation + tmpyoff + "px";853 854 DetectorNavigator.summaryForm.setVisible(true); 855 DetectorNavigator.summaryFormField.style.top = '1px';856 857 if(DetectorNavigator.summaryParameters[4] != -1){ 858 DetectorNavigator.summaryOvfPic.style.top = "20px";859 DetectorNavigator.summaryOvfText.style.top = "20px";860 DetectorNavigator.summaryUnfPic.style.top = "20px";861 DetectorNavigator.summaryUnfText.style.top = "20px";862 } 863 }864 865 DetectorNavigator.hideFedCaptions();866} 867////////////////////////////////////////////////////////////////////////////////////////////////////////////868DetectorNavigator.createCurrentPath = function() {869 870 if(DetectorNavigator.zoomedIndex[0] < 0 || DetectorNavigator.inOut == undefined){ //nothing871 DetectorNavigator.rocPath = "";872 }873 else if(DetectorNavigator.zoomedIndex[0] == 0){ //fpix874 //plus/minus, disc, and panel are assumed available875 876 DetectorNavigator.rocPath = "FPix_B" + DetectorNavigator.plusMinus;877 878 if(DetectorNavigator.inOut != "-")879 DetectorNavigator.rocPath += DetectorNavigator.inOut;880 DetectorNavigator.rocPath += "_D" + DetectorNavigator.disc;881 if(DetectorNavigator.blade != "-")882 DetectorNavigator.rocPath += "_BLD" + DetectorNavigator.blade;883 DetectorNavigator.rocPath += "_PNL" + DetectorNavigator.panel;884 if(DetectorNavigator.plaquette != "-")885 DetectorNavigator.rocPath += "_PLQ" + DetectorNavigator.plaquette;886 if(DetectorNavigator.roc != "-")887 DetectorNavigator.rocPath += "_ROC" + DetectorNavigator.roc;888 }889 else{ //bpix890 //plus/minus and layer is assumed available891 892 DetectorNavigator.rocPath = "BPix_B" + DetectorNavigator.plusMinus;893 894 if(DetectorNavigator.inOut != "-")895 DetectorNavigator.rocPath += DetectorNavigator.inOut;896 if(DetectorNavigator.sector != "-")897 DetectorNavigator.rocPath += "_SEC" + DetectorNavigator.sector;898 DetectorNavigator.rocPath += "_LYR" + DetectorNavigator.layer;899 if(DetectorNavigator.ladder != "-")900 DetectorNavigator.rocPath += "_LDR" + DetectorNavigator.ladder;901 if(DetectorNavigator.module != "-")902 DetectorNavigator.rocPath += "_MOD" + DetectorNavigator.module;903 if(DetectorNavigator.roc != "-")904 DetectorNavigator.rocPath += "_ROC" + DetectorNavigator.roc;905 906 }907 908 DetectorNavigator.rocPathDiv.innerHTML = DetectorNavigator.rocPath;909}910////////////////////////////////////////////////////////////////////////////////////////////////////////////911DetectorNavigator.showCurrentPath = function() {912 DetectorNavigator.createCurrentPath();913 DetectorNavigator.rocPathDiv.style.left = '10px';914 DetectorNavigator.rocPathDiv.style.top = '0px';915}916////////////////////////////////////////////////////////////////////////////////////////////////////////////917DetectorNavigator.hideCurrentPath = function() {918 DetectorNavigator.rocPathDiv.style.top = '-100px';919}920////////////////////////////////////////////////////////////////////////////////////////////////////////////921DetectorNavigator.searchBarrelForCoords = function(x,y) {922 DetectorNavigator.inOut = "-";923 DetectorNavigator.sector = "-";924 DetectorNavigator.ladder = "-";925 DetectorNavigator.module = "-";926 DetectorNavigator.roc = "-";927 928 x -= DetectorNavigator.WEB_BLYR_XOFF; 929 y -= DetectorNavigator.WEB_BLYR_YOFF;930 if(x < 0 || y < 0){931 DetectorNavigator.barrelHighlight.style.top = '-100px'; //hide highlight932 return;933 }934 935 var p = [x%(DetectorNavigator.WEB_BROC_WIDTH + DetectorNavigator.WEB_BCOL_OFFSET),936 y%(DetectorNavigator.WEB_BROC_HEIGHT + DetectorNavigator.WEB_BROW_OFFSET)];937 938 var col = (x/ (DetectorNavigator.WEB_BROC_WIDTH + DetectorNavigator.WEB_BCOL_OFFSET)) | 0;939 var row = (y/ (DetectorNavigator.WEB_BROC_HEIGHT + DetectorNavigator.WEB_BROW_OFFSET)) | 0;940 941 942 DetectorNavigator.barrelCol = col;943 DetectorNavigator.barrelRow = row;944 945 var li = DetectorNavigator.zoomedIndex[1];946 var numOfRows = DetectorNavigator.BPIX_LYR_ROWS[li];947 948 if(col >= DetectorNavigator.BPIX_LYR_COLS || 949 row >= numOfRows){950 DetectorNavigator.barrelHighlight.style.top = '-100px'; //hide highlight951 return;952 }953 954 var moduloCmp = 0;955 if(DetectorNavigator.zoomedIndex[2] == 0){956 col = DetectorNavigator.BPIX_LYR_COLS - 1 - col;957 moduloCmp = 1;958 }959 //coordinate in valid region960 961 //find inner/outer962 if(row < numOfRows/2){963 DetectorNavigator.inOut = 'I';964 }965 else{966 DetectorNavigator.inOut = 'O'; 967 row = numOfRows - 1 - row;968 }969 //find sector970 if(row < DetectorNavigator.endSectorRows[li]){ //first sector971 DetectorNavigator.sector = 1; 972 }973 else{974 row -= DetectorNavigator.endSectorRows[li];975 DetectorNavigator.sector = 2 + ((row/DetectorNavigator.otherSectorRows[li])|0);976 if(DetectorNavigator.sector > 8)977 DetectorNavigator.sector = 8;978 979 if(li == 2 && DetectorNavigator.sector >= 4){980 row -= DetectorNavigator.otherSectorRows[li]*2;981 if(row < 8){ //in sector 4 or 5982 DetectorNavigator.sector = 4 + ((row/4)|0);983 row = row%4;984 }985 else{986 DetectorNavigator.sector = 6 + (((row-8)/DetectorNavigator.otherSectorRows[li])|0);987 row = (row-8)%DetectorNavigator.otherSectorRows[li]; 988 }989 }990 else{991 row -= DetectorNavigator.otherSectorRows[li]*(DetectorNavigator.sector-2); 992 }993 }994 //row now is the row withing the sector995 var doubleRow = ((row/2)|0);996 997 //find ladder998 if(DetectorNavigator.sector == 1){999 if(row == 0){1000 DetectorNavigator.ladder = '1H'1001 }1002 else{1003 DetectorNavigator.ladder = (2 + (((row-1)/2)|0)) + 'F'; 1004 }1005 }1006 else if(li == 2 && DetectorNavigator.sector >= 4){1007 if(DetectorNavigator.sector <= 5){1008 var startLadder = 10;1009 DetectorNavigator.ladder = (startLadder + (DetectorNavigator.sector-4)*2 + doubleRow) + 'F';1010 }1011 else{1012 var startLadder = 14;1013 DetectorNavigator.ladder = (startLadder +1014 (DetectorNavigator.sector-6)*DetectorNavigator.otherSectorRows[li]/2 + doubleRow) + 'F';1015 if(DetectorNavigator.ladder == "22F"){1016 DetectorNavigator.ladder = "22H";1017 }1018 }1019 }1020 else if(DetectorNavigator.sector == 8){1021 DetectorNavigator.ladder = ((DetectorNavigator.endSectorRows[li]/2)|0) + 1 +1022 (((numOfRows/2 - DetectorNavigator.endSectorRows[li])/2)|0) + doubleRow;1023 1024 if(row == DetectorNavigator.endSectorRows[li] - 1){1025 DetectorNavigator.ladder += 'H';1026 }1027 else{1028 DetectorNavigator.ladder += 'F';1029 }1030 } 1031 else{1032 DetectorNavigator.ladder = (((DetectorNavigator.endSectorRows[li]/2)|0) + 2 + 1033 (DetectorNavigator.sector-2)*DetectorNavigator.otherSectorRows[li]/2 + doubleRow) + 'F';1034 }1035 1036 //find module1037 DetectorNavigator.module = ((col/8)|0) + 1;1038 1039 //find ROC 1040 if(p[0] < DetectorNavigator.WEB_BROC_WIDTH && 1041 p[1] < DetectorNavigator.WEB_BROC_HEIGHT){1042 1043 if( (DetectorNavigator.inOut == 'I' && DetectorNavigator.sector == 1 && row != 0 && row%2 == moduloCmp) || 1044 (DetectorNavigator.inOut == 'I' && DetectorNavigator.sector == 8 && 1045 row != DetectorNavigator.endSectorRows[li] - 1 && row%2 == 1 - moduloCmp) || 1046 (DetectorNavigator.inOut == 'I' && DetectorNavigator.sector != 8 &&1047 DetectorNavigator.sector != 1 && row%2 == 1 - moduloCmp) || 1048 (DetectorNavigator.inOut == 'O' && DetectorNavigator.sector == 1 && row != 0 && row%2 == 1 - moduloCmp) || 1049 (DetectorNavigator.inOut == 'O' && DetectorNavigator.sector == 8 &&1050 row != DetectorNavigator.endSectorRows[li] - 1 && row%2 == moduloCmp) || 1051 (DetectorNavigator.inOut == 'O' && DetectorNavigator.sector != 8 &&1052 DetectorNavigator.sector != 1 && row%2 == moduloCmp)){1053 DetectorNavigator.roc = 8+(col%8);1054 }1055 else{1056 DetectorNavigator.roc = 7-(col%8);1057 } 1058 //place highlight1059 DetectorNavigator.barrelHighlight.style.left = DetectorNavigator.canvasOffX + DetectorNavigator.WEB_BLYR_XOFF - 1 +1060 DetectorNavigator.safariSubstractOne + 1061 DetectorNavigator.barrelCol*(DetectorNavigator.WEB_BROC_WIDTH + DetectorNavigator.WEB_BCOL_OFFSET) + 'px';1062 DetectorNavigator.barrelHighlight.style.top = DetectorNavigator.canvasOffY + DetectorNavigator.WEB_BLYR_YOFF - 2 +1063 DetectorNavigator.barrelRow*(DetectorNavigator.WEB_BROC_HEIGHT + DetectorNavigator.WEB_BROW_OFFSET) + 'px';1064 document.body.style.cursor='pointer';1065 }1066 else{1067 DetectorNavigator.barrelHighlight.style.top = '-100px'; //hide highlight1068 }1069}1070////////////////////////////////////////////////////////////////////////////////////////////////////////////1071DetectorNavigator.clickRoc = function() {1072 if(DetectorNavigator.roc == "-"){1073 alert("Illegal Roc Click Call.");1074 return;1075 }1076 1077 var detIndex = DetectorNavigator.zoomedIndex[1]*2 + DetectorNavigator.zoomedIndex[2];1078 var pushVal; //create an integer value that represents the ROC1079 if(DetectorNavigator.zoomedIndex[0] == 0){//fpix1080 DetectorNavigator.imageUpdateIndex = DetectorNavigator.zoomedIndex[1]*2 + DetectorNavigator.zoomedIndex[2];1081 1082 var bladeSize = DetectorNavigator.panel == 1 ? 21:24;1083 var blade = DetectorNavigator.inOut == 'O' ? 13+(12-DetectorNavigator.blade):DetectorNavigator.blade;1084 --blade;1085 1086 var plaqOff;1087 var rowSize;1088 if(DetectorNavigator.panel == 1){1089 plaqOff = [0,2,8,16];1090 rowSize = [2,3,4,5];1091 }1092 else{1093 plaqOff = [0,6,14]; 1094 rowSize = [3,4,5]; 1095 }1096 1097 var roc = DetectorNavigator.roc < rowSize[DetectorNavigator.plaquette-1] ? 1098 rowSize[DetectorNavigator.plaquette-1]-1-DetectorNavigator.roc : DetectorNavigator.roc;1099 pushVal = blade*bladeSize + (bladeSize-1) - (plaqOff[DetectorNavigator.plaquette-1] + roc);1100 }1101 else{//bpix1102 DetectorNavigator.imageUpdateIndex = -(DetectorNavigator.zoomedIndex[1]*2 + DetectorNavigator.zoomedIndex[2]) - 1;1103 1104 pushVal = DetectorNavigator.barrelRow*DetectorNavigator.BPIX_LYR_COLS + DetectorNavigator.barrelCol;1105 }1106 1107 if(DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].indexOf(pushVal) == -1){ //add if necessary1108 DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].push(pushVal);1109 DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].sort(function(a,b){return a - b});1110 }1111 1112 Ext.Ajax.request({1113 url: 'XGI_DetectorRocRequest',1114 success: DetectorNavigator.ajaxRocResponse,1115 failure: ajaxFailure,1116 params: {1117 rocpath: DetectorNavigator.rocPath,1118 clickmask: DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].toString(),1119 clicksize: DetectorNavigator.clickMask[DetectorNavigator.zoomedIndex[0]][detIndex].length,1120 summary: DetectorNavigator.currentSummary,1121 field: DetectorNavigator.currentSummaryField1122 }1123 });1124 1125 //open up directory1126 var expandStr = DetectorNavigator.createExpandString();1127 FileTreeWindow.contentTree.expandPath(expandStr,"text",DetectorNavigator.expandCallBack);1128}1129////////////////////////////////////////////////////////////////////////////////////////////////////////////1130DetectorNavigator.expandCallBack = function(success,rocFolder)1131{ 1132 if(success)1133 {1134 1135 var objects = "";1136 var count = 0;1137 var rocName = DetectorNavigator.rocPath;1138 rocFolder.eachChild(function(child)1139 {1140 if(child.id.indexOf(rocName) != -1)1141 {1142 var regExp=new RegExp(rocName+"[0-9]");1143 if(child.id.match(regExp) == null)1144 {1145 objects += child.id + "--"; 1146 ++count;1147 }//if 1148 }//if1149 });//rocFolder1150// rocFolder.eachChild(function(child){objects += child.id; ++count;});1151 1152 Canvas.add("Multi-Canvas",objects);1153 }//if success1154}1155////////////////////////////////////////////////////////////////////////////////////////////////////////////1156DetectorNavigator.createExpandString = function(){1157 var retStr = "/contentRoot/";1158 var recursiveStr;1159 var pathStr = DetectorNavigator.rocPath;1160 var i;1161 1162 recursiveStr = pathStr.slice(0,4);1163 retStr += recursiveStr + "/";1164 pathStr = pathStr.slice(5);1165 1166 while((i = pathStr.indexOf("_")) != -1){1167 //if(pathStr[i-1] == "I" || pathStr[i-1] == "O") --i;1168 1169 recursiveStr += "_" + pathStr.slice(0,i);1170// recursiveStr = pathStr.slice(0,i);1171 retStr += recursiveStr + "/";1172 1173 //if(pathStr[i] == "I" || pathStr[i] == "O"){ 1174 // ++i; recursiveStr += pathStr[i-1];1175 // retStr += recursiveStr + "/";1176 //}1177 1178 pathStr = pathStr.slice(i+1);1179 1180 }1181// recursiveStr += "_" + pathStr;1182// recursiveStr = pathStr;1183// retStr += recursiveStr;1184 retStr = retStr.slice(0,retStr.length-1);1185 return retStr;1186}1187////////////////////////////////////////////////////////////////////////////////////////////////////////////1188DetectorNavigator.clearClickMask = function() { 1189 //remove all ROC's from clickMask1190 for(i=0;i<8;++i){1191 if(DetectorNavigator.clickMask[0][i].length != 0)1192 DetectorNavigator.clickMask[0][i].splice(0,DetectorNavigator.clickMask[0][i].length);1193 }1194 for(i=0;i<6;++i){1195 if(DetectorNavigator.clickMask[1][i].length != 0)1196 DetectorNavigator.clickMask[1][i].splice(0,DetectorNavigator.clickMask[1][i].length);1197 }1198}1199////////////////////////////////////////////////////////////////////////////////////////////////////////////1200DetectorNavigator.ajaxRocResponse = function(ajaxObj) { 1201 1202 //DetectorNavigator.imageUpdateIndex is the positive index of the disc for FPix1203 //DetectorNavigator.imageUpdateIndex is the negative index minus 1 of the layer for BPix1204 if(ajaxObj.responseText == "[]"){1205 alert("Requested Producer not found. The producer's name may have changed - try refreshing the file list.");1206 return;1207 }1208 1209 if(DetectorNavigator.imageUpdateIndex >= 0){ // fpix1210 DetectorNavigator.discs[DetectorNavigator.imageUpdateIndex].src = ajaxObj.responseText;1211 }1212 else{ // bpix1213 ++DetectorNavigator.imageUpdateIndex;1214 DetectorNavigator.imageUpdateIndex *= -1;1215 DetectorNavigator.barrels[DetectorNavigator.imageUpdateIndex].src = ajaxObj.responseText;1216 }1217}1218////////////////////////////////////////////////////////////////////////////////////////////////////////////1219DetectorNavigator.paintWithTree = function(summaryNode)1220{1221// window.alert("DetectorNavigator.paintWithTree");1222// window.alert("DetectorNavigator.paintWithTree ---->summaryNode.text= " + summaryNode.text);1223 if(summaryNode.text.indexOf("Field - ") < 0)1224 { //is the summary root1225 //remove current children of summary node1226// window.alert("DetectorNavigator.paintWithTree--->if(summaryNode.text.indexOf(\"Field - \") < 0)");1227 var numOfChildren = summaryNode.childNodes.length;1228 1229 for(i=numOfChildren-1;i>=0;--i)1230 summaryNode.removeChild(summaryNode.childNodes[i]);1231 1232 DetectorNavigator.currentSummaryNode = summaryNode;1233 Ext.Ajax.request({1234 url: 'XGI_RequestHistogram',1235 success: DetectorNavigator.populateFieldNodes,1236 failure: ajaxFailure,1237 params: {1238 histoname: summaryNode.id,1239 field: ""1240 }//params1241 }); ////Ext.Ajax.request1242 }//if sumaryNode.text.indexOf1243 else1244 { //field is requested1245// window.alert("DetectorNavigator.paintWithTree--->else");1246 DetectorNavigator.currentSummary = summaryNode.id.slice(0,summaryNode.id.lastIndexOf("/"));1247// window.alert("DetectorNavigator.paintWithTree--->else--->currentSummary= " + summaryNode.id.slice(0,summaryNode.id.lastIndexOf("/")));1248 DetectorNavigator.currentSummaryField = summaryNode.id.slice(summaryNode.id.lastIndexOf("/")+1);1249// window.alert("DetectorNavigator.paintWithTree--->else--->currentSummaryField= " + summaryNode.id.lastIndexOf("/")+1);1250 Ext.Ajax.request({1251 url: 'XGI_RequestHistogram',1252 success: DetectorNavigator.reload,1253 failure: ajaxFailure,1254 params: {1255 histoname: DetectorNavigator.currentSummary,1256 field: DetectorNavigator.currentSummaryField,1257 requestId: escape(HistoViewer.globalRequestId)1258 }//params1259 });//Ext.Ajax.request 1260 }//else1261}//paintWithTree1262////////////////////////////////////////////////////////////////////////////////////////////////////////////1263DetectorNavigator.populateFieldNodes = function(ajaxObj)1264{1265// window.alert("DetectorNavigator.populatefieldNodes");1266 var fieldStr = ajaxObj.responseText.slice(1);1267//i window.alert("DetectorNavigator.populatefieldNodes------>ajaxObj.responseText= " + ajaxObj.responseText);1268// window.alert("DetectorNavigator.populatefieldNodes------>fieldStr= " + fieldStr);1269 var node;1270 var i;1271 var field;1272 while(((i = fieldStr.indexOf(",")) != -1 || (i = fieldStr.indexOf("]")) != -1) && i != 0)1273 {1274 field = fieldStr.slice(0,i);1275 if(i < fieldStr.length)1276 fieldStr = fieldStr.slice(i+1); 1277// window.alert("DetectorNavigator.populatefieldNodes--->field= " + field);1278 DetectorNavigator.currentSummaryNode.appendChild(node = new Ext.tree.TreeNode({1279 text: 'Field - ' + field,1280 id: DetectorNavigator.currentSummaryNode.id + "/" + field,1281 leaf: true,1282 cls: 'file',1283 }));1284 1285 node.addListener("click",FileTreeWindow.onContentClick); 1286 }//while1287 1288 DetectorNavigator.currentSummaryNode.expand(); 1289}//populateFieldNodes1290////////////////////////////////////////////////////////////////////////////////////////////////////////////1291DetectorNavigator.reload = function(ajaxObj){1292 1293 DetectorWindow.showWindow();1294 if(!DetectorNavigator.isFirstLoad){ //window already loaded so need to reload.1295 DetectorNavigator.isFirstLoad = true;1296 DetectorWindow.win.load({1297 url: "XGI_DetectorNavigator?requestId=" + 1298 escape(HistoViewer.globalRequestId),1299 });1300 } 1301 1302 DetectorNavigator.clearClickMask(); 1303 1304 if(ajaxObj){ //get stats for summary1305 var fieldStr = ajaxObj.responseText; 1306 var i;1307 var field;1308 var fieldNum = 0;1309 while((i = fieldStr.indexOf(",")) != -1){1310 field = fieldStr.slice(0,i);1311 fieldStr = fieldStr.slice(i+1);1312 DetectorNavigator.summaryParameters[fieldNum++] = field;1313 }1314 }1315}1316////////////////////////////////////////////////////////////////////////////////////////////////////////////1317DetectorNavigator.SetSigmaThreshold = function(){1318 Ext.Ajax.request({1319 url: 'XGI_RequestHistogram',1320 success: DetectorNavigator.reload,1321 failure: ajaxFailure,1322 params: {1323 histoname: DetectorNavigator.currentSummary,1324 field: DetectorNavigator.currentSummaryField,1325 requestId: escape(HistoViewer.globalRequestId),1326 filter: DetectorNavigator.summaryForm.items.items[0].getValue()1327 }1328 });1329}1330////////////////////////////////////////////////////////////////////////////////////////////////////////////1331DetectorNavigator.initFedCaptions = function(){1332 if(!DetectorNavigator.fedCaptionTops[0]){ //only initialize values once1333 var dir;1334 var radius = 195;1335 var ang = Math.PI/24 - Math.PI/2;1336 var tmp; 1337 var xoffset = -10;1338 var yoffset = 18;1339 1340 DetectorNavigator.fedViewMode = true;1341 1342 for(i=0;i<12;++i){1343 dir = [1,Math.tan(ang)];1344 tmp = Math.sqrt(dir[0]*dir[0] + dir[1]*dir[1]);1345 dir[0] /= tmp;1346 dir[1] /= tmp;1347 1348 DetectorNavigator.fedCaptionLefts[i] = DetectorNavigator.WEB_DISC_X + 1349 dir[0]*radius + xoffset - 1000 + "px";1350 DetectorNavigator.fedCaptionTops[i] = DetectorNavigator.WEB_DISC_Y + 1351 dir[1]*radius + yoffset + "px";1352 DetectorNavigator.fedCaptionLefts[i+12] = DetectorNavigator.WEB_DISC_X - 1353 dir[0]*radius + xoffset - 1000 + "px";1354 DetectorNavigator.fedCaptionTops[i+12] = DetectorNavigator.WEB_DISC_Y - 1355 dir[1]*radius + yoffset + "px";1356 ang += Math.PI/12;1357 }1358 }1359 1360 for(i=0;i<24;++i){1361 DetectorNavigator.fedCaptions[i] = document.getElementById('fedCaption'+i); 1362 DetectorNavigator.fedCaptions[i].style.top = DetectorNavigator.fedCaptionTops[i];1363 DetectorNavigator.fedCaptions[i].style.left = DetectorNavigator.fedCaptionLefts[i];1364 }1365}1366////////////////////////////////////////////////////////////////////////////////////////////////////////////1367DetectorNavigator.displayFedCaptions = function(){1368 if(DetectorNavigator.fedCaptions[0].offsetLeft > 0 || DetectorNavigator.zoomedIndex[0] != 0) //only show if hidden1369 return;1370 1371 //zoomedIndex: 0,1 for Fpix,Bpix, 0-4,3 for disc,layer, 0,1 for left,right1372 Ext.Ajax.request({1373 url: 'XGI_RequestFedAssignment',1374 success: DetectorNavigator.displayFedCallback,1375 failure: ajaxFailure,1376 params: {1377 disc: DetectorNavigator.zoomedIndex[1],1378 inner: DetectorNavigator.zoomedIndex[2]1379 }1380 });1381 1382}1383////////////////////////////////////////////////////////////////////////////////////////////////////////////1384DetectorNavigator.displayFedCallback = function(ajaxObj){1385 var ps = new Array();1386 if(ajaxObj){ //get stats for summary1387 var fieldStr = ajaxObj.responseText; 1388 var i;1389 var field;1390 var fieldNum = 0;1391 while((i = fieldStr.indexOf(",")) != -1){1392 field = fieldStr.slice(0,i);1393 fieldStr = fieldStr.slice(i+1);1394 ps[fieldNum++] = field;1395 }1396 }1397 1398 if(fieldNum != 24){1399 alert("DetectorNavigator.displayFedCallback: invalid field amount");return;} 1400 1401 for(i=0;i<24;++i){1402 DetectorNavigator.fedCaptions[i].innerHTML = ps[i];1403 DetectorNavigator.fedCaptions[i].style.left =1404 DetectorNavigator.fedCaptions[i].offsetLeft + 1000 + "px";1405 }1406}1407////////////////////////////////////////////////////////////////////////////////////////////////////////////1408DetectorNavigator.hideFedCaptions = function(){1409 if(DetectorNavigator.fedCaptions[0].offsetLeft > 0) //only hide if shown1410 for(i=0;i<24;++i){1411 DetectorNavigator.fedCaptions[i].style.left = 1412 DetectorNavigator.fedCaptions[i].offsetLeft - 1000 + "px";1413 }1414}1415////////////////////////////////////////////////////////////////////////////////////////////////////////////1416DetectorNavigator.expandFedPath = function(i){1417 i = DetectorNavigator.fedCaptions[i].innerHTML;1418 var c = i.indexOf(":");1419 var fed = i.slice(0,c);1420 var ch = i.slice(c+1);1421 var expandStr = "/contentRoot/" + "FED" + fed + "_Channel" + ch;1422 FileTreeWindow.contentTree.expandPath(expandStr,"text",DetectorNavigator.expandCallBack);1423}...

Full Screen

Full Screen

SizeMonitor.js

Source:SizeMonitor.js Github

copy

Full Screen

1/**2 * @private3 */4Ext.define('Ext.util.SizeMonitor', {5 extend: 'Ext.Evented',6 config: {7 element: null,8 detectorCls: Ext.baseCSSPrefix + 'size-change-detector',9 callback: Ext.emptyFn,10 scope: null,11 args: []12 },13 constructor: function(config) {14 this.initConfig(config);15 this.doFireSizeChangeEvent = Ext.Function.bind(this.doFireSizeChangeEvent, this);16 var me = this,17 element = this.getElement().dom,18 cls = this.getDetectorCls(),19 expandDetector = Ext.Element.create({20 classList: [cls, cls + '-expand'],21 children: [{}]22 }, true),23 shrinkDetector = Ext.Element.create({24 classList: [cls, cls + '-shrink'],25 children: [{}]26 }, true),27 expandListener = function(e) {28 me.onDetectorScroll('expand', e);29 },30 shrinkListener = function(e) {31 me.onDetectorScroll('shrink', e);32 };33 element.appendChild(expandDetector);34 element.appendChild(shrinkDetector);35 this.detectors = {36 expand: expandDetector,37 shrink: shrinkDetector38 };39 this.position = {40 expand: {41 left: 0,42 top: 043 },44 shrink: {45 left: 0,46 top: 047 }48 };49 this.listeners = {50 expand: expandListener,51 shrink: shrinkListener52 };53 this.refresh();54 expandDetector.addEventListener('scroll', expandListener, true);55 shrinkDetector.addEventListener('scroll', shrinkListener, true);56 },57 applyElement: function(element) {58 if (element) {59 return Ext.get(element);60 }61 },62 updateElement: function(element) {63 element.on('destroy', 'destroy', this);64 },65 refreshPosition: function(name) {66 var detector = this.detectors[name],67 position = this.position[name],68 left, top;69 position.left = left = detector.scrollWidth - detector.offsetWidth;70 position.top = top = detector.scrollHeight - detector.offsetHeight;71 detector.scrollLeft = left;72 detector.scrollTop = top;73 },74 refresh: function() {75 this.refreshPosition('expand');76 this.refreshPosition('shrink');77 },78 onDetectorScroll: function(name) {79 var detector = this.detectors[name],80 position = this.position[name];81 if (detector.scrollLeft !== position.left || detector.scrollTop !== position.top) {82 this.refresh();83 this.fireSizeChangeEvent();84 }85 },86 fireSizeChangeEvent: function() {87 clearTimeout(this.sizeChangeThrottleTimer);88 this.sizeChangeThrottleTimer = setTimeout(this.doFireSizeChangeEvent, 1);89 },90 doFireSizeChangeEvent: function() {91 this.getCallback().apply(this.getScope(), this.getArgs());92 },93 destroyDetector: function(name) {94 var detector = this.detectors[name],95 listener = this.listeners[name];96 detector.removeEventListener('scroll', listener, true);97 Ext.removeNode(detector);98 },99 destroy: function() {100 this.callParent(arguments);101 this.destroyDetector('expand');102 this.destroyDetector('shrink');103 delete this.listeners;104 delete this.detectors;105 }...

Full Screen

Full Screen

DetectorWindow.js

Source:DetectorWindow.js Github

copy

Full Screen

1var DetectorWindow = {};2DetectorWindow.win = 0; //window element object3////////////////////////////////////4DetectorWindow.showWindow = function(){5 if(DetectorWindow.win){6 DetectorWindow.win.setVisible(true);7 DetectorWindow.win.show(); 8 if(DetectorWindow.win.getPosition()[0] < 0 || DetectorWindow.win.getPosition()[1] < 0){9 DetectorWindow.win.setPosition(0,0); //in case window gets offscreen10 }11 }12 else{13 DetectorWindow.createWindow();14 } 15};16////////////////////////////////////17DetectorWindow.createWindow = function(){18 if(!DetectorWindow.win){19 var win; 20 21 win = new Ext.Window({22 title: 'Detector Navigator',23 id: 'Detector Navigator',24 closable: false,25 maximizable: false,26 minimizable: true,27 collapsible: false,28 autoScroll: false,29 resizable: false,30 width: DetectorNavigator.WEB_LARGE_WIDTH+15,31 height: DetectorNavigator.WEB_LARGE_HEIGHT+56+32 (navigator.platform.indexOf("Mac") < 0?8:0), //add 8 pixels if not MAC33 border: true,34 plain: true,35 autoLoad: "XGI_DetectorNavigator?requestId=" + 36 escape(HistoViewer.globalRequestId)37 });38 win.addListener("minimize",DetectorWindow.minimizeMaximizeWindow);39 DetectorWindow.win = win; 40 41 DetectorNavigator.init(this);42 }43};44////////////////////////////////////45DetectorWindow.minimizeMaximizeWindow = function(){46 if(DetectorWindow.win){47 if(DetectorWindow.win.isVisible()){48 DetectorWindow.win.setVisible(false); 49 }50 else{51// DetectorWindow.win.expand();52 DetectorWindow.showWindow(); 53 //DetectorWindow.win.setVisible(true);54 }55 }56 else{57 alert("DetectorWindow.minimizeMaximizeWindow: No Window!");58 } ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');3 if (err) return console.error(err);4 console.log('Test Results: ' + data.data.testId);5 wpt.getTestResults(data.data.testId, function(err, data) {6 if (err) return console.error(err);7 console.log('Test Results: ' + JSON.stringify(data));8 });9});

Full Screen

Using AI Code Generation

copy

Full Screen

1module.exports = async function (browser, scenario, vp) {2 console.log('SCENARIO > ' + scenario.label);3 const page = await browser.newPage();4 await page.goto(scenario.url);5 await page.setViewport(vp);6 await page.waitForTimeout(5000);7 await page.evaluate(() => {8 window.callPhantom('takeShot');9 });10};11- [BackstopJS](

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const detector = require('wptools/lib/detector');3detector.detect('Hello World', (err, res) => {4 if (err) {5 console.log('Error: ' + err);6 } else {7 console.log(res);8 }9});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var webpagetest = new wpt('A.0d8f7d1f5a5a3c9b3e8b7f3d0d3a0f40');3webpagetest.runTest('www.google.com', function(err, data) {4 if (err) return console.error(err);5 console.log('Test submitted to WebPagetest for %s', data.data.testUrl);6 console.log('Test ID: %s', data.data.testId);7});8var wpt = require('webpagetest');9var webpagetest = new wpt('A.0d8f7d1f5a5a3c9b3e8b7f3d0d3a0f40');10webpagetest.runTest('www.google.com', function(err, data) {11 if (err) return console.error(err);12 console.log('Test submitted to WebPagetest for %s', data.data.testUrl);13 console.log('Test ID: %s', data.data.testId);14});15var wpt = require('webpagetest');16var webpagetest = new wpt('A.0d8f7d1f5a5a3c9b3e8b7f3d0d3a0f40');17webpagetest.runTest('www.google.com', function(err, data) {18 if (err) return console.error(err);19 console.log('Test submitted to WebPagetest for %s', data.data.testUrl);20 console.log('Test ID: %s', data.data.testId);21});22var wpt = require('webpagetest');23var webpagetest = new wpt('A.0d8f7d1f5a5a3c9b3e8b7f3d0d3a0f40');24webpagetest.runTest('www.google.com', function(err, data) {25 if (err) return console.error(err);26 console.log('Test submitted to WebPagetest for %s', data.data.testUrl);27 console.log('Test ID: %s',

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful