Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F10881157
FROG_View_LegoPlot_CaloHit.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
FROG_View_LegoPlot_CaloHit.h
View Options
// FROG_View.h: interface for the FROG_View class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _FROG_VIEW_LEGOPLOT_CALOHIT_H__
#define _FROG_VIEW_LEGOPLOT_CALOHIT_H__
#include
"FROG_View.h"
#include
"FROG_Coord.h"
class
FROG_View_LegoPlot_CaloHit
:
public
FROG_View
{
public
:
unsigned
int
grid_display_list_
;
public
:
// FROG_View_LegoPlot_CaloHit(char* Name, FROG_Objects_Extended* frogObjects) : FROG_View(Name, frogObjects){
FROG_View_LegoPlot_CaloHit
(
int
x
,
int
y
,
int
w
,
int
h
,
char
*
Name
=
NULL
,
FROG_Objects_Extended
*
frogObjects
=
NULL
)
:
FROG_View
(
x
,
y
,
w
,
h
,
Name
,
frogObjects
){
Type_
=
11
;
grid_display_list_
=
0
;
cam_
->
R
=
150
;
cam_
->
theta
=
0.5f
;
cam_
->
phi
=
4.3f
;
}
virtual
bool
Is2D
(){
return
false
;}
virtual
bool
Is3D
(){
return
true
;}
virtual
void
ProjectionMatrix
(){
gluPerspective
(
45.0
,
(
GLfloat
)
vw_
/
(
GLfloat
)
vh_
,
0.1
,
5000.0
);
}
virtual
void
Display_Begin
(){
glViewport
(
vx_
,
vy_
,
(
GLsizei
)
vw_
,
(
GLsizei
)
vh_
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
ProjectionMatrix
();
glMatrixMode
(
GL_MODELVIEW
);
glLoadIdentity
();
cam_
->
LookAt
();
cam_
->
SwitchCamLight_On
();
}
virtual
void
Display_End
(){
FROG_Light
::
SwitchLight_Off
();
}
virtual
void
Display
(){
if
(
!
displayFunc_
)
return
;
if
(
displayTexture_
>
0
&&
!
IsActive
){
DisplayTexture
();
}
else
{
ClearBackground
();
Display_Begin
();
Display_Core
();
Display_End
();
if
(
!
IsActive
)
RecordTexture
();
}
}
virtual
void
Display_Core
(){
if
(
frogObjects_
&&
frogObjects_
->
selectedObject_
&&
frogObjects_
->
selectedObject_DisplayFlag
){
FROG_Element_Event_CaloHit
*
hit
=
dynamic_cast
<
FROG_Element_Event_CaloHit
*>
(
frogObjects_
->
selectedObject_
);
if
(
hit
){
float
color
[
4
]
=
{
1
-
frogObjects_
->
selectedObject_
->
style_
->
color_
[
0
],
1
-
frogObjects_
->
selectedObject_
->
style_
->
color_
[
1
],
1
-
frogObjects_
->
selectedObject_
->
style_
->
color_
[
2
],
1
};
Draw_Hit_LegoPlot
(
hit
,
color
);
}
}
Display_Grid
();
Display_Hits
();
}
void
Display_Grid
(){
FROG_Light
::
SwitchLight_NoNormal
();
if
(
grid_display_list_
>
0
){
glCallList
(
grid_display_list_
);
}
else
{
FROG_Element_Base_With_DetId
*
Coll
=
(
FROG_Element_Base_With_DetId
*
)
frogObjects_
->
frogGeom_
->
FindByDetId
(
DETID_CALO
);
if
(
!
Coll
){
return
;}
std
::
vector
<
FROG_Element_Base
*>
CaloCells
;
Coll
->
GetFullDaughtersVector
(
&
CaloCells
);
float
P
;
float
Eta1
,
Phi1
;
float
Eta3
,
Phi3
;
grid_display_list_
=
glGenLists
(
1
);
glNewList
(
grid_display_list_
,
GL_COMPILE_AND_EXECUTE
);
glColor4f
(
0
,
1
,
1
,
1
);
glBegin
(
GL_LINES
);
for
(
unsigned
int
i
=
0
;
i
<
CaloCells
.
size
();
i
++
){
FROG_Element_Geom_CaloMod
*
cell
=
dynamic_cast
<
FROG_Element_Geom_CaloMod
*>
(
CaloCells
[
i
]);
if
(
!
cell
)
continue
;
FROG_COORD
::
CartesianToPhysical
(
cell
->
PosX
-
cell
->
WX
-
cell
->
HX
,
cell
->
PosY
-
cell
->
WY
-
cell
->
HY
,
cell
->
PosZ
-
cell
->
WZ
-
cell
->
HZ
,
P
,
Eta1
,
Phi1
);
FROG_COORD
::
CartesianToPhysical
(
cell
->
PosX
+
cell
->
WX
+
cell
->
HX
,
cell
->
PosY
+
cell
->
WY
+
cell
->
HY
,
cell
->
PosZ
+
cell
->
WZ
+
cell
->
HZ
,
P
,
Eta3
,
Phi3
);
//if(fabs(Phi1-Phi3)>6.2)Phi3-=6.2832;
if
(
Phi1
<-
2
&&
Phi3
>
2
)
Phi3
-=
6.2832f
;
Eta1
*=
10
;
Phi1
*=
10
;
Eta3
*=
10
;
Phi3
*=
10
;
glVertex3f
(
Eta1
,
0
,
Phi1
);
//--+
glVertex3f
(
Eta1
,
0
,
Phi3
);
//-++
glVertex3f
(
Eta1
,
0
,
Phi3
);
//-++
glVertex3f
(
Eta3
,
0
,
Phi3
);
//+++
glVertex3f
(
Eta3
,
0
,
Phi3
);
//+++
glVertex3f
(
Eta3
,
0
,
Phi1
);
//+-+
glVertex3f
(
Eta3
,
0
,
Phi1
);
//+-+
glVertex3f
(
Eta1
,
0
,
Phi1
);
//--+
}
glEnd
();
glBegin
(
GL_LINES
);
glVertex3f
(
0
,
0
,
0
);
glVertex3f
(
100
,
0
,
0
);
glVertex3f
(
0
,
0
,
0
);
glVertex3f
(
0
,
0
,
100
);
glEnd
();
glEndList
();
}
FROG_Light
::
SwitchLight_Normal
();
//glEnable(GL_LIGHTING);
}
void
Display_Hits
(){
if
(
!
frogObjects_
||
!
frogObjects_
->
frogEvent_
)
return
;
FROG_Element_Base_With_DetId
*
Coll
=
(
FROG_Element_Base_With_DetId
*
)
frogObjects_
->
frogEvent_
->
FindByDetId
(
22300001
);
if
(
!
Coll
){
return
;}
std
::
vector
<
FROG_Element_Base
*>
CaloHits
;
Coll
->
GetFullDaughtersVector
(
&
CaloHits
);
for
(
unsigned
int
i
=
0
;
i
<
CaloHits
.
size
();
i
++
){
FROG_Element_Event_CaloHit
*
hit
=
dynamic_cast
<
FROG_Element_Event_CaloHit
*>
(
CaloHits
[
i
]);
if
(
!
hit
)
continue
;
Draw_Hit_LegoPlot
(
hit
);
}
}
void
Draw_Hit_LegoPlot
(
FROG_Element_Event_CaloHit
*
hit
,
float
*
color
=
NULL
){
FROG_Element_Geom_CaloMod
*
cell
=
dynamic_cast
<
FROG_Element_Geom_CaloMod
*>
(
frogObjects_
->
frogGeom_
->
FindByDetId
(
hit
->
DetId
()));
if
(
!
cell
)
return
;
float
P
;
float
Eta1
,
Phi1
;
float
Eta3
,
Phi3
;
FROG_COORD
::
CartesianToPhysical
(
cell
->
PosX
-
cell
->
WX
-
cell
->
HX
,
cell
->
PosY
-
cell
->
WY
-
cell
->
HY
,
cell
->
PosZ
-
cell
->
WZ
-
cell
->
HZ
,
P
,
Eta1
,
Phi1
);
FROG_COORD
::
CartesianToPhysical
(
cell
->
PosX
+
cell
->
WX
+
cell
->
HX
,
cell
->
PosY
+
cell
->
WY
+
cell
->
HY
,
cell
->
PosZ
+
cell
->
WZ
+
cell
->
HZ
,
P
,
Eta3
,
Phi3
);
if
(
Phi1
<-
2
&&
Phi3
>
2
)
Phi3
-=
6.2832f
;
Eta1
*=
10
;
Phi1
*=
10
;
Eta3
*=
10
;
Phi3
*=
10
;
hit
->
init
(
NULL
);
if
(
hit
->
E
<
hit
->
style_
->
EMin_
)
return
;
P
=
25
*
log10
(
hit
->
E
/
hit
->
style_
->
EMin_
);
glLoadName
(
hit
->
nameId_
);
if
(
color
){
glColor4fv
(
color
);}
else
{
glColor4fv
(
hit
->
style_
->
color_
);}
DrawCube
(
Eta1
,
P
,
Phi1
,
Eta3
,
P
,
Phi1
,
Eta3
,
P
,
Phi3
,
Eta1
,
P
,
Phi3
,
Eta1
,
0
,
Phi1
,
Eta3
,
0
,
Phi1
,
Eta3
,
0
,
Phi3
,
Eta1
,
0
,
Phi3
);
}
};
#endif
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sat, May 3, 5:56 AM (15 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4982884
Default Alt Text
FROG_View_LegoPlot_CaloHit.h (5 KB)
Attached To
rFROGSVN frogsvn
Event Timeline
Log In to Comment