Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F9501645
FROG_Element_Tools.cpp
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
17 KB
Subscribers
None
FROG_Element_Tools.cpp
View Options
// FrogReadElements.h.h: TO EDIT
// TO EDIT
// TO EDIT
//////////////////////////////////////////////////////////////////////
#include
"FROG_Element_Tools.h"
namespace
FROG_ELEMENT
{
unsigned
int
Read
(
FILE
*
pFile
,
FROG_Element_Base
*
mother
,
unsigned
int
NBytes_ToRead
){
unsigned
int
NBytes_Read
=
0
;
FROG_Element_Base
*
TemporyElement
=
NULL
;
int
NObjs
;
if
(
mother
==
NULL
)
return
0
;
if
(
mother
->
type
()
!=
C_PRIMARY
&&
NBytes_ToRead
==
0
)
return
0
;
// take care of case where there is no more bytes to read
do
{
unsigned
short
chunk_type
=
0
;
unsigned
int
chunk_size
=
0
;
unsigned
int
chunk_read
=
0
;
chunk_read
=
fread
(
&
chunk_type
,
1
,
sizeof
(
unsigned
short
),
pFile
);
chunk_read
+=
fread
(
&
chunk_size
,
1
,
sizeof
(
unsigned
int
)
,
pFile
);
if
(
NBytes_ToRead
==
0
)
NBytes_ToRead
=
chunk_size
;
//printf("Begin : type = %7i From Mother = %7i Read = %5i of %5i\n",chunk_type,mother->type(),chunk_read,chunk_size);
switch
(
chunk_type
){
case
C_PRIMARY
:
chunk_read
+=
Read
(
pFile
,
mother
,
chunk_size
-
chunk_read
);
break
;
case
C_FEB_DETID
:
TemporyElement
=
new
FROG_Element_Base_With_DetId
(
chunk_type
,
pFile
);
mother
->
addDaughter
(
TemporyElement
);
chunk_read
+=
FROG_Element_Base_With_DetId
::
sizeOf
()
-
6
;
chunk_read
+=
Read
(
pFile
,
TemporyElement
,
chunk_size
-
chunk_read
);
break
;
case
C_FEB_DETID_COMPACT
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Base_With_DetId
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
TemporyElement
=
new
FROG_Element_Base_With_DetId
(
chunk_type
,
pFile
);
mother
->
addDaughter
(
TemporyElement
);
chunk_read
+=
FROG_Element_Base_With_DetId
::
sizeOf
()
-
6
;
//chunk_read += Read(pFile,TemporyElement,chunk_size-chunk_read);
}
break
;
case
C_FEB_DETID_NAME
:
TemporyElement
=
new
FROG_Element_Base_With_DetId_And_Name
(
pFile
);
mother
->
addDaughter
(
TemporyElement
);
chunk_read
+=
TemporyElement
->
size
()
-
6
;
chunk_read
+=
Read
(
pFile
,
TemporyElement
,
chunk_size
-
chunk_read
);
break
;
case
C_GEOMETRY
:
case
C_TRACKER
:
case
C_ECAL
:
case
C_HCAL
:
case
C_MUON
:
TemporyElement
=
new
FROG_Element_Base
(
chunk_type
);
mother
->
addDaughter
(
TemporyElement
);
chunk_read
+=
Read
(
pFile
,
TemporyElement
,
chunk_size
-
chunk_read
);
break
;
case
C_TRACKER_MOD
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Geom_TrackerMod
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Geom_TrackerMod
(
pFile
));
chunk_read
+=
FROG_Element_Geom_TrackerMod
::
sizeOf
()
-
6
;
}
break
;
case
C_CALO_MOD
:
case
C_ECAL_MOD
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Geom_CaloMod
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Geom_CaloMod
(
pFile
,
chunk_type
));
chunk_read
+=
FROG_Element_Geom_CaloMod
::
sizeOf
()
-
6
;
}
case
C_HCAL_MOD
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Geom_CaloMod
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Geom_CaloMod
(
pFile
,
chunk_type
));
chunk_read
+=
FROG_Element_Geom_CaloMod
::
sizeOf
()
-
6
;
}
break
;
case
C_MUON_MOD
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Geom_TrackerMod
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Geom_TrackerMod
(
pFile
));
chunk_read
+=
FROG_Element_Geom_TrackerMod
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_CUSTOM_CUBE
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_CustomCube
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_CustomCube
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_CustomCube
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_CUBE
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_Cube
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_Cube
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_Cube
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_SPHERE
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_Sphere
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_Sphere
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_Sphere
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_PARTIALSPHERE
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_PartialSphere
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_PartialSphere
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_PartialSphere
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_CYLINDER
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_Cylinder
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_Cylinder
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_Cylinder
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_CUSTOM_SURFACE
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_CustomSurface
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_CustomSurface
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_CustomSurface
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_RECTANGLE
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_Rectangle
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_Rectangle
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_Rectangle
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_DISC
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_Disc
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_Disc
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_Disc
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_LINE
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_Line
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_Line
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_Line
::
sizeOf
()
-
6
;
}
break
;
case
C_PRIMITIVE_CIRCLE
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Primitive_Circle
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Primitive_Circle
(
pFile
));
chunk_read
+=
FROG_Element_Primitive_Circle
::
sizeOf
()
-
6
;
}
break
;
// EVENT related classes :
case
C_EVENT
:
TemporyElement
=
new
FROG_Element_Event
(
pFile
,
C_EVENT
);
mother
->
addDaughter
(
TemporyElement
);
chunk_read
+=
FROG_Element_Event
::
sizeOf
()
-
6
;
//chunk_read += Read(pFile,TemporyElement,chunk_size-chunk_read);
chunk_read
+=
((
FROG_Element_Event
*
)
TemporyElement
)
->
PostPonedEventReading
(
pFile
,
chunk_size
-
chunk_read
);
break
;
case
C_EVENTR
:
TemporyElement
=
new
FROG_Element_Event
(
pFile
,
C_EVENTR
);
mother
->
addDaughter
(
TemporyElement
);
chunk_read
+=
2
*
sizeof
(
unsigned
int
);
//chunk_read += Read(pFile,TemporyElement,chunk_size-chunk_read);
chunk_read
+=
((
FROG_Element_Event
*
)
TemporyElement
)
->
PostPonedEventReading
(
pFile
,
chunk_size
-
chunk_read
);
break
;
case
C_EVENTRT
:
TemporyElement
=
new
FROG_Element_Event
(
pFile
,
C_EVENTRT
);
mother
->
addDaughter
(
TemporyElement
);
chunk_read
+=
FROG_Element_Event
::
sizeOf
()
-
6
;
//chunk_read += Read(pFile,TemporyElement,chunk_size-chunk_read);
chunk_read
+=
((
FROG_Element_Event
*
)
TemporyElement
)
->
PostPonedEventReading
(
pFile
,
chunk_size
-
chunk_read
);
break
;
case
C_RECO_TRACK
:
TemporyElement
=
new
FROG_Element_Event_Track
(
pFile
);
mother
->
addDaughter
((
FROG_Element_Event_Track
*
)
TemporyElement
);
chunk_read
+=
FROG_Element_Event_Track
::
sizeOf
()
-
6
;
chunk_read
+=
Read
(
pFile
,
TemporyElement
,
chunk_size
-
chunk_read
);
break
;
case
C_RECO_HIT
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Event_Hit
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Event_Hit
(
pFile
));
chunk_read
+=
FROG_Element_Event_Hit
::
sizeOf
()
-
6
;
}
break
;
case
C_RECO_CLUSTER_SISTRIP
:
TemporyElement
=
new
FROG_Element_Event_Cluster_SiStrip
(
pFile
);
mother
->
addDaughter
((
FROG_Element_Event_Cluster_SiStrip
*
)
TemporyElement
);
chunk_read
+=
FROG_Element_Event_Cluster_SiStrip
::
sizeOf
()
-
6
;
chunk_read
+=
((
FROG_Element_Event_Cluster_SiStrip
*
)
TemporyElement
)
->
ReadComponents
(
pFile
,
chunk_size
-
chunk_read
);
break
;
case
C_RECO_SEGMENT
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Event_Segment
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Event_Segment
(
pFile
));
chunk_read
+=
FROG_Element_Event_Segment
::
sizeOf
()
-
6
;
}
break
;
case
C_RECO_CALOHIT
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Event_CaloHit
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Event_CaloHit
(
pFile
));
chunk_read
+=
FROG_Element_Event_CaloHit
::
sizeOf
()
-
6
;
}
break
;
case
C_RECO_CALOTOWER
:
TemporyElement
=
new
FROG_Element_Event_CaloTower
(
pFile
);
mother
->
addDaughter
((
FROG_Element_Event_CaloTower
*
)
TemporyElement
);
chunk_read
+=
FROG_Element_Event_CaloTower
::
sizeOf
()
-
6
;
chunk_read
+=
((
FROG_Element_Event_CaloTower
*
)
TemporyElement
)
->
ReadComponents
(
pFile
,
chunk_size
-
chunk_read
);
break
;
case
C_SIM_TRACK
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Event_Sim_Track
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Event_Sim_Track
(
pFile
));
chunk_read
+=
FROG_Element_Event_Sim_Track
::
sizeOf
()
-
6
;
}
break
;
case
C_SIM_VERTEX
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Event_Sim_Vertex
::
sizeOf
()
-
6
);
// printf("%i-%i)/%i = %i\n",chunk_size,chunk_read,FROG_Element_Event_Sim_Vertex::sizeOf()-6,NObjs);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Event_Sim_Vertex
(
pFile
));
chunk_read
+=
FROG_Element_Event_Sim_Vertex
::
sizeOf
()
-
6
;
}
break
;
case
C_SIM_HIT
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Event_Sim_Hit
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Event_Sim_Hit
(
pFile
));
chunk_read
+=
FROG_Element_Event_Sim_Hit
::
sizeOf
()
-
6
;
}
break
;
case
C_RECO_NUCL
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Event_NuclInt
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Event_NuclInt
(
pFile
));
chunk_read
+=
FROG_Element_Event_NuclInt
::
sizeOf
()
-
6
;
}
break
;
case
C_RECO_JET
:
TemporyElement
=
new
FROG_Element_Event_Jet
(
pFile
);
mother
->
addDaughter
((
FROG_Element_Event_Jet
*
)
TemporyElement
);
chunk_read
+=
FROG_Element_Event_Jet
::
sizeOf
()
-
6
;
chunk_read
+=
((
FROG_Element_Event_Jet
*
)
TemporyElement
)
->
ReadComponents
(
pFile
,
chunk_size
-
chunk_read
);
break
;
case
C_RECO_MET
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Event_MET
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Event_MET
(
pFile
));
chunk_read
+=
FROG_Element_Event_MET
::
sizeOf
()
-
6
;
}
break
;
case
C_RECO_CANDIDATE
:
NObjs
=
(
chunk_size
-
chunk_read
)
/
(
FROG_Element_Event_Candidate
::
sizeOf
()
-
6
);
for
(
int
i
=
0
;
i
<
NObjs
;
i
++
){
mother
->
addDaughter
(
new
FROG_Element_Event_Candidate
(
pFile
));
chunk_read
+=
FROG_Element_Event_Candidate
::
sizeOf
()
-
6
;
}
break
;
default
:
printf
(
"Unknown ChunkID (%i)
\n
"
,
chunk_type
);
printf
(
"Chunk will be skipped
\n
"
);
printf
(
"The program may be not running properly
\n
"
);
fseek
(
pFile
,
chunk_size
-
chunk_read
,
SEEK_CUR
);
chunk_read
+=
chunk_size
-
chunk_read
;
break
;
}
//printf("End : type = %7i From Mother = %7i Read = %5i of %5i\n",chunk_type,mother->type(),chunk_read,chunk_size);
NBytes_Read
+=
chunk_read
;
}
while
(
NBytes_Read
<
NBytes_ToRead
);
mother
->
clearData
();
return
NBytes_Read
;
}
void
PrintTree
(
FROG_Element_Base
*
mother
,
unsigned
int
level
){
if
(
mother
==
NULL
)
return
;
for
(
unsigned
int
l
=
0
;
l
<
level
;
l
++
){
printf
(
" - "
);}
if
(
FROG_Element_Base_With_DetId_And_Name
*
mother_DetId_Name
=
dynamic_cast
<
FROG_Element_Base_With_DetId_And_Name
*>
(
mother
)
){
printf
(
"%i (detId=%i Name=%s)
\n
"
,
mother
->
type
(),
mother_DetId_Name
->
DetId
(),
mother_DetId_Name
->
Name
());
}
else
if
(
FROG_Element_Base_With_DetId
*
mother_DetId
=
dynamic_cast
<
FROG_Element_Base_With_DetId
*>
(
mother
)
){
printf
(
"%i (detId=%i)
\n
"
,
mother
->
type
(),
mother_DetId
->
DetId
());
}
else
{
printf
(
"%i D%i
\n
"
,
mother
->
type
(),
mother
->
getDisplay
());
}
for
(
unsigned
int
i
=
0
;
i
<
mother
->
daughters
().
size
();
i
++
){
PrintTree
(
mother
->
daughters
()[
i
],
level
+
1
);
}
}
void
PrintTree
(
FILE
*
pfile
,
FROG_Element_Base
*
mother
,
unsigned
int
level
){
if
(
mother
==
NULL
)
return
;
for
(
unsigned
int
l
=
0
;
l
<
level
;
l
++
){
fprintf
(
pfile
,
" - "
);}
if
(
FROG_Element_Base_With_DetId_And_Name
*
mother_DetId_Name
=
dynamic_cast
<
FROG_Element_Base_With_DetId_And_Name
*>
(
mother
)
){
fprintf
(
pfile
,
"%i (detId=%i Name=%s)
\n
"
,
mother
->
type
(),
mother_DetId_Name
->
DetId
(),
mother_DetId_Name
->
Name
());
}
else
if
(
FROG_Element_Base_With_DetId
*
mother_DetId
=
dynamic_cast
<
FROG_Element_Base_With_DetId
*>
(
mother
)
){
fprintf
(
pfile
,
"%i (detId=%i)
\n
"
,
mother
->
type
(),
mother_DetId
->
DetId
());
}
else
{
fprintf
(
pfile
,
"%i D%i
\n
"
,
mother
->
type
(),
mother
->
getDisplay
());
}
for
(
unsigned
int
i
=
0
;
i
<
mother
->
daughters
().
size
();
i
++
){
PrintTree
(
pfile
,
mother
->
daughters
()[
i
],
level
+
1
);
}
}
void
PrintSelection
(
FILE
*
pfile
,
FROG_Element_Base
*
mother
,
unsigned
int
level
,
double
zmin
,
double
zmax
){
if
(
mother
==
NULL
)
return
;
FROG_Element_Base_With_DetId
*
mother_DetId
=
dynamic_cast
<
FROG_Element_Base_With_DetId
*>
(
mother
);
if
(
mother_DetId
){
/* if(mother->getPosZ()>=zmin && mother->getPosZ()<=zmax){
fprintf(pfile,"%i, ", mother_DetId->DetId());
printf("%i \\ %g < %f < %g\n",mother_DetId->DetId(),zmin,mother->getPosZ(), zmax );
}
*/
if
(
mother
->
getPosX
()
>=
zmin
&&
mother
->
getPosX
()
<=
zmax
){
fprintf
(
pfile
,
"%i, "
,
mother_DetId
->
DetId
());
printf
(
"%i
\\
%g < %f < %g
\n
"
,
mother_DetId
->
DetId
(),
zmin
,
mother
->
getPosX
(),
zmax
);
}
}
for
(
unsigned
int
i
=
0
;
i
<
mother
->
daughters
().
size
();
i
++
){
PrintSelection
(
pfile
,
mother
->
daughters
()[
i
],
level
+
1
,
zmin
,
zmax
);
}
}
void
PrintSelection2
(
FILE
*
pfile
,
FROG_Element_Base
*
mother
,
int
component
,
double
x
,
double
y
,
double
z
){
if
(
mother
==
NULL
)
return
;
for
(
unsigned
int
i
=
0
;
i
<
mother
->
daughters
().
size
();
i
++
){
PrintSelection2
(
pfile
,
mother
->
daughters
()[
i
],
component
,
x
,
y
,
z
);
}
FROG_Element_Geom_TrackerMod
*
tracker
=
dynamic_cast
<
FROG_Element_Geom_TrackerMod
*>
(
mother
);
if
(
tracker
){
float
P
[
3
],
PMax
[
3
],
PMin
[
3
];
P
[
0
]
=
x
;
//tracker->getPosX();
P
[
1
]
=
y
;
//tracker->getPosY();
P
[
2
]
=
z
;
//tracker->getPosZ();
PMax
[
0
]
=
tracker
->
PosX
+
tracker
->
WidthX
*
tracker
->
TrapezoidalParam
+
tracker
->
LengthX
+
tracker
->
ThickX
;
PMax
[
1
]
=
tracker
->
PosY
+
tracker
->
WidthY
*
tracker
->
TrapezoidalParam
+
tracker
->
LengthY
+
tracker
->
ThickY
;
PMax
[
2
]
=
tracker
->
PosZ
+
tracker
->
WidthZ
*
tracker
->
TrapezoidalParam
+
tracker
->
LengthZ
+
tracker
->
ThickZ
;
PMin
[
0
]
=
tracker
->
PosX
-
tracker
->
WidthX
*
tracker
->
TrapezoidalParam
-
tracker
->
LengthX
-
tracker
->
ThickX
;
PMin
[
1
]
=
tracker
->
PosY
-
tracker
->
WidthY
*
tracker
->
TrapezoidalParam
-
tracker
->
LengthY
-
tracker
->
ThickY
;
PMin
[
2
]
=
tracker
->
PosZ
-
tracker
->
WidthZ
*
tracker
->
TrapezoidalParam
-
tracker
->
LengthZ
-
tracker
->
ThickZ
;
if
((
P
[
0
]
>=
PMin
[
0
]
&&
P
[
0
]
<=
PMax
[
0
])
||
(
P
[
1
]
>=
PMin
[
0
]
&&
P
[
1
]
<=
PMax
[
0
])
||
(
P
[
2
]
>=
PMin
[
0
]
&&
P
[
2
]
<=
PMax
[
0
])
){
fprintf
(
pfile
,
"%i, "
,
tracker
->
DetId
());
printf
(
"%i
\\
%g < %f < %g
\n
"
,
tracker
->
DetId
(),
PMin
[
0
],
P
[
0
],
PMax
[
0
]
);
}
}
}
#ifdef FROG_OPENGL
bool
CreateSubMenu
(
unsigned
int
mother_menu
,
FROG_Element_Base
*
mother
,
void
(
*
func
)(
int
value
),
unsigned
int
level
=
0
){
if
(
mother
==
NULL
){
return
true
;}
if
(
mother
->
getDaughterSize
()
==
0
){
return
true
;}
char
Name
[
255
];
bool
DeepestLevel
=
true
;
for
(
unsigned
int
i
=
0
;
i
<
mother
->
getDaughterSize
();
i
++
){
FROG_Element_Base_With_DetId
*
daughter_DetId
=
dynamic_cast
<
FROG_Element_Base_With_DetId
*>
(
mother
->
getDaughter
(
i
));
if
(
!
daughter_DetId
){
continue
;}
if
(
daughter_DetId
->
type
()
!=
C_FEB_DETID
){
continue
;}
switch
(
daughter_DetId
->
getDisplay
()){
case
0
:
sprintf
(
Name
,
"%i OFF"
,
daughter_DetId
->
DetId
());
break
;
case
1
:
sprintf
(
Name
,
"%i ON "
,
daughter_DetId
->
DetId
());
break
;
case
2
:
sprintf
(
Name
,
"%i ..."
,
daughter_DetId
->
DetId
());
break
;
}
//sprintf(Name,"%i",daughter_DetId->DetId());
unsigned
int
temp
=
glutCreateMenu
(
func
);
if
(
!
CreateSubMenu
(
temp
,
daughter_DetId
,
func
)){
//printf("ADD SUBMENU %i MOTHER = %i\n",daughter_DetId->DetId(),mother->DetId());
glutAddMenuEntry
(
"All"
,
daughter_DetId
->
DetId
());
glutSetMenu
(
mother_menu
);
glutAddSubMenu
(
Name
,
temp
);
}
else
{
//printf("ADD SUBMENU %i MOTHER = %i\n",daughter_DetId->DetId(),mother->DetId());
glutDestroyMenu
(
temp
);
//sprintf(Name,"Test %i",daughter_DetId->DetId());
glutSetMenu
(
mother_menu
);
glutAddMenuEntry
(
Name
,
daughter_DetId
->
DetId
());
}
DeepestLevel
=
false
;
}
return
DeepestLevel
;
}
#else
bool
CreateSubMenu
(
unsigned
int
mother_menu
,
FROG_Element_Base
*
mother
,
void
(
*
func
)(
int
value
),
unsigned
int
level
=
0
){
return
false
;}
#endif
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Feb 23, 2:52 PM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4486725
Default Alt Text
FROG_Element_Tools.cpp (17 KB)
Attached To
rFROGSVN frogsvn
Event Timeline
Log In to Comment