-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleDetectorDraw.java
More file actions
executable file
·71 lines (60 loc) · 2.29 KB
/
SimpleDetectorDraw.java
File metadata and controls
executable file
·71 lines (60 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.clas.detector;
import javax.swing.JFrame;
import org.jlab.clas.detector.DetectorDescriptor;
import org.jlab.clas.detector.DetectorType;
import org.jlab.clas12.calib.DetectorShape2D;
import org.jlab.clas12.calib.DetectorShapeTabView;
import org.jlab.clas12.calib.DetectorShapeView2D;
import org.jlab.clas12.calib.IDetectorListener;
/**
*
* @author gavalian
*/
public class SimpleDetectorDraw extends JFrame implements IDetectorListener {
DetectorShapeTabView view = new DetectorShapeTabView();
public SimpleDetectorDraw(){
super();
initDetector();
this.setSize(500, 500);
this.add(view);
this.pack();
this.setVisible(true);
}
private void initDetector(){
DetectorShapeView2D dv2 = new DetectorShapeView2D("HTCC");
for(int sector = 0; sector < 6; sector++){
for(int paddle = 0; paddle < 4; paddle++){
DetectorShape2D shape = new DetectorShape2D(DetectorType.FTOF2,sector,1,paddle);
// create an Arc with
// inner radius = 40 + paddle*10
// outter radius = 50 + paddle*10
// starting angle -25.0 degrees
// ending angle 25.0 degrees
shape.createArc(40 + paddle*10, 40 + paddle*10 + 10, -25.0, 25.0);
shape.getShapePath().rotateZ(Math.toRadians(sector*60.0));
if(paddle%2==0){
shape.setColor(180, 255, 180);
} else {
shape.setColor(180, 180, 255);
}
dv2.addShape(shape);
}
}
this.view.addDetectorLayer(dv2);
view.addDetectorListener(this);
}
public void detectorSelected(DetectorDescriptor dd) {
System.out.println("--------->>>>> you clicked on : "
+ dd.getSector() + " " + dd.getLayer() + " " + dd.getComponent());
}
public void update(DetectorShape2D dsd) {
}
public static void main(String[] args){
SimpleDetectorDraw draw = new SimpleDetectorDraw();
}
}