Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
vpalladi
HgcTpgSim
Commits
2aa896b7
Commit
2aa896b7
authored
Jul 06, 2017
by
dauncey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Buffer modelling
parent
703027d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
214 additions
and
14 deletions
+214
-14
src/BufferTest.cpp
src/BufferTest.cpp
+191
-0
src/GeometryTest.cpp
src/GeometryTest.cpp
+23
-14
No files found.
src/BufferTest.cpp
0 → 100644
View file @
2aa896b7
//#include <unistd.h>
#include <signal.h>
#include <cassert>
#include <iomanip>
#include <fstream>
#include <sstream>
#include "TFile.h"
#include "TH1D.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TProfile.h"
//#include "TMath.h"
#include "TRandom3.h"
#include "TFileHandler.hh"
#include "Geometry.hh"
#include "Calibration.hh"
#include "Event.hh"
#include "SimHit.hh"
#include "RecHit.hh"
#include "TrgHit.hh"
unsigned
numberOfBits
(
unsigned
pack
,
double
nTc
)
{
if
(
pack
==
0
)
return
42
+
14
*
nTc
;
if
(
pack
==
1
)
{
if
(
nTc
<
24
)
return
42
+
14
*
nTc
;
else
return
42
+
8
*
nTc
+
6
*
(
48
-
nTc
);
}
return
84
+
8
*
nTc
;
}
int
main
(
int
argc
,
const
char
**
argv
)
{
const
unsigned
nBx
(
10000
);
const
unsigned
nLatency
(
4
);
TFileHandler
tfh
(
"BufferTest"
);
unsigned
bInp
(
999
);
std
::
ostringstream
sout0
;
sout0
<<
"Binp"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
bInp
;
for
(
unsigned
pack
(
0
);
pack
<
3
;
pack
++
)
{
unsigned
nBitMax
(
numberOfBits
(
pack
,
48
));
std
::
ostringstream
sout1
;
sout1
<<
"Binp"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
bInp
<<
"Pack"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
pack
;
std
::
cout
<<
sout1
.
str
()
<<
", nBitMax = "
<<
nBitMax
<<
std
::
endl
;
TH1F
*
hL1
[
10
];
hL1
[
0
]
=
new
TH1F
((
sout1
.
str
()
+
"_DataVsTCs"
).
c_str
(),
";Average number of TCs;Average data size (bits)"
,
48
,
0.0
,
48.0
);
hL1
[
1
]
=
new
TH1F
((
sout1
.
str
()
+
"_MinBoutTrc"
).
c_str
(),
";Average number of TCs;Minimum bandwidth (bits/BX)"
,
48
,
0.0
,
48.0
);
hL1
[
2
]
=
new
TH1F
((
sout1
.
str
()
+
"_MinBoutCut"
).
c_str
(),
";Average number of TCs;Minimum bandwidth (bits/BX)"
,
48
,
0.0
,
48.0
);
for
(
unsigned
nAvg
(
5
);
nAvg
<
480
;
nAvg
+=
10
)
{
double
dAvg
(
0.1
*
nAvg
);
hL1
[
0
]
->
Fill
(
dAvg
,
numberOfBits
(
pack
,
dAvg
));
std
::
ostringstream
sout2
;
sout2
<<
"Binp"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
bInp
<<
"Pack"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
pack
<<
"Navg"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
nAvg
;
TH1F
*
hL2
[
10
];
hL2
[
0
]
=
new
TH1F
((
sout2
.
str
()
+
"_OccMax"
).
c_str
(),
";Bandwidth out (bits/BX);Buffer depth"
,
100
,
0.0
,
800
);
hL2
[
1
]
=
new
TH1F
((
sout2
.
str
()
+
"_OccCut"
).
c_str
(),
";Bandwidth out (bits/BX);Buffer danger level"
,
100
,
0.0
,
800
);
hL2
[
2
]
=
new
TH1F
((
sout2
.
str
()
+
"_AvgOccVsBout"
).
c_str
(),
";Bandwidth out (bits/BX);Fractional buffer occupancy"
,
100
,
0.0
,
800
);
hL2
[
3
]
=
new
TH1F
((
sout2
.
str
()
+
"_FractionTruncVsBout"
).
c_str
(),
";Bandwidth out (bits/BX);Fraction of BX truncated"
,
100
,
0.0
,
800
);
hL2
[
4
]
=
new
TH1F
((
sout2
.
str
()
+
"_FractionDangerVsBout"
).
c_str
(),
";Bandwidth out (bits/BX);Fraction of BX almost full"
,
100
,
0.0
,
800
);
std
::
cout
<<
sout2
.
str
()
<<
std
::
endl
;
unsigned
bOutTrc
(
999999999
);
unsigned
bOutCut
(
999999999
);
for
(
unsigned
bOut
(
4
);
bOut
<
800
;
bOut
+=
8
)
{
unsigned
nOccMax
(
nLatency
*
bOut
);
unsigned
nOccCut
(
nBitMax
>
nOccMax
?
0
:
nOccMax
-
nBitMax
);
hL2
[
0
]
->
Fill
(
bOut
,
nOccMax
);
hL2
[
1
]
->
Fill
(
bOut
,
nOccCut
);
std
::
ostringstream
sout3
;
sout3
<<
"Binp"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
bInp
<<
"Pack"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
pack
<<
"Navg"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
nAvg
<<
"Bout"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
bOut
;
std
::
cout
<<
sout3
.
str
()
<<
", nOccMax = "
<<
nOccMax
<<
", nOccCut = "
<<
nOccCut
<<
std
::
endl
;
TH1F
*
hL3
[
10
];
hL3
[
0
]
=
new
TH1F
((
sout3
.
str
()
+
"_DataInpVsBx"
).
c_str
(),
";BX;Data in (bits)"
,
nBx
,
0.0
,
nBx
);
hL3
[
1
]
=
new
TH1F
((
sout3
.
str
()
+
"_DataOutVsBx"
).
c_str
(),
";BX;Data out (bits)"
,
nBx
,
0.0
,
nBx
);
hL3
[
2
]
=
new
TH1F
((
sout3
.
str
()
+
"_BufferOccupancyAVsBx"
).
c_str
(),
";BX;Buffer occupancy pre-out (bits)"
,
nBx
,
0.0
,
nBx
);
hL3
[
3
]
=
new
TH1F
((
sout3
.
str
()
+
"_BufferOccupancyBVsBx"
).
c_str
(),
";BX;Buffer occupancy post-out (bits)"
,
nBx
,
0.0
,
nBx
);
hL3
[
4
]
=
new
TH1F
((
sout3
.
str
()
+
"_NumberOfTCs"
).
c_str
(),
";Number of trigger cells"
,
49
,
0.0
,
49.0
);
hL3
[
5
]
=
new
TH1F
((
sout3
.
str
()
+
"_NumberOfBits"
).
c_str
(),
";Number of bits"
,
1000
,
0.0
,
1000
);
hL3
[
6
]
=
new
TH1F
((
sout3
.
str
()
+
"_DataInp"
).
c_str
(),
";Data in (bits)"
,
1000
,
0.0
,
1000
);
hL3
[
7
]
=
new
TH1F
((
sout3
.
str
()
+
"_DataOut"
).
c_str
(),
";Data out (bits)"
,
1000
,
0.0
,
1000
);
hL3
[
8
]
=
new
TH1F
((
sout3
.
str
()
+
"_BufferOccupancyA"
).
c_str
(),
";Buffer occupancy pre-out (bits)"
,
nOccMax
/
8
,
0.0
,
nOccMax
);
hL3
[
9
]
=
new
TH1F
((
sout3
.
str
()
+
"_BufferOccupancyB"
).
c_str
(),
";Buffer occupancy post-out (bits)"
,
nOccMax
/
8
,
0.0
,
nOccMax
);
unsigned
nOcc
(
0
);
unsigned
nOccCutBx
(
0
);
unsigned
nOccTrcBx
(
0
);
for
(
unsigned
iBx
(
0
);
iBx
<
nBx
;
iBx
++
)
{
unsigned
nTc
(
Random
::
random
().
Binomial
(
48
,
dAvg
/
48.0
));
hL3
[
4
]
->
Fill
(
nTc
);
unsigned
dTc
(
numberOfBits
(
pack
,
nTc
));
hL3
[
5
]
->
Fill
(
dTc
);
unsigned
dInp
(
dTc
);
hL3
[
0
]
->
Fill
(
iBx
,
dInp
);
hL3
[
6
]
->
Fill
(
dInp
);
nOcc
+=
dInp
;
if
(
nOcc
>
nOccMax
)
{
nOcc
=
nOccMax
;
nOccTrcBx
++
;
}
hL3
[
2
]
->
Fill
(
iBx
,
nOcc
);
hL3
[
8
]
->
Fill
(
nOcc
);
unsigned
dOut
(
nOcc
>
bOut
?
bOut
:
nOcc
);
hL3
[
1
]
->
Fill
(
iBx
,
dOut
);
hL3
[
7
]
->
Fill
(
dOut
);
nOcc
-=
dOut
;
if
(
nOcc
>
nOccCut
)
nOccCutBx
++
;
hL3
[
3
]
->
Fill
(
iBx
,
nOcc
);
hL3
[
9
]
->
Fill
(
nOcc
);
}
hL2
[
2
]
->
Fill
(
bOut
,
hL3
[
9
]
->
GetMean
()
/
nOccMax
);
hL2
[
3
]
->
Fill
(
bOut
,
double
(
nOccTrcBx
)
/
nBx
);
hL2
[
4
]
->
Fill
(
bOut
,
double
(
nOccCutBx
)
/
nBx
);
if
(
bOutTrc
==
999999999
&&
nOccTrcBx
==
0
)
bOutTrc
=
bOut
;
if
(
bOutCut
==
999999999
&&
nOccCutBx
==
0
)
bOutCut
=
bOut
;
}
hL1
[
1
]
->
Fill
(
dAvg
,
bOutTrc
);
hL1
[
2
]
->
Fill
(
dAvg
,
bOutCut
);
}
}
return
0
;
}
src/GeometryTest.cpp
View file @
2aa896b7
...
...
@@ -360,9 +360,10 @@ int main(int argc, const char **argv) {
unsigned
w
(
Geometry
::
point2DToWafer
(
l
,
pxy
));
if
(
w
<
0xffffffff
)
{
unsigned
lo
(
Geometry
::
waferLayout
(
l
,
w
));
unsigned
s
(
Geometry
::
numberOfSublayers
(
l
,
w
)
-
1
);
if
(
l
>=
40
)
{
SciInt2D
ws
(
Geometry
::
waferToSciInt2D
(
l
,
w
));
unsigned
wp
(
Geometry
::
sciInt2DToWafer
(
l
,
ws
));
...
...
@@ -374,11 +375,11 @@ int main(int argc, const char **argv) {
std
::
cout
<<
" and regives "
<<
wp
<<
std
::
endl
;
}
}
Point2D
p2
(
Geometry
::
waferToPoint2D
(
l
,
w
));
hWaferDXY
[
l
][
lo
]
->
Fill
(
pxy
.
x
()
-
p2
.
x
(),
pxy
.
y
()
-
p2
.
y
());
hWaferDRF
[
l
][
lo
]
->
Fill
(
pxy
.
deltaRho
(
p2
),
pxy
.
rhoDeltaPhi
(
p2
));
unsigned
col
(
0
);
if
(
lo
<
2
)
{
//std::pair<int,int> wPair(Geometry::waferToPair(l,w));
...
...
@@ -389,20 +390,28 @@ int main(int argc, const char **argv) {
sp
=
Geometry
::
waferToSciInt2D
(
l
,
w
);
col
=
sp
.
f
();
}
//hWaferT[l][lo]->Fill(x,y,(w%7)+1);
hWaferT
[
l
][
lo
]
->
SetBinContent
(
hWaferT
[
l
][
lo
]
->
FindBin
(
x
,
y
),((
col
+
lo
)
%
4
)
+
1
);
hWaferS
[
l
][
s
]
->
SetBinContent
(
hWaferT
[
l
][
lo
]
->
FindBin
(
x
,
y
),((
col
+
lo
)
%
4
)
+
1
);
if
(
Geometry
::
inAcceptance
(
l
,
pxy
.
rho
()))
{
hWaferAcc
[
l
]
->
SetBinContent
(
hWaferT
[
l
][
lo
]
->
FindBin
(
x
,
y
),(
col
%
4
)
+
1
);
}
else
{
if
(
!
Geometry
::
inAcceptance
(
l
,
pxy
.
rho
()))
{
hWaferUna
[
l
]
->
SetBinContent
(
hWaferT
[
l
][
lo
]
->
FindBin
(
x
,
y
),(
col
%
4
)
+
1
);
}
else
{
hWaferAcc
[
l
]
->
SetBinContent
(
hWaferT
[
l
][
lo
]
->
FindBin
(
x
,
y
),(
col
%
4
)
+
1
);
//hWaferT[l][lo]->Fill(x,y,(w%7)+1);
hWaferT
[
l
][
lo
]
->
SetBinContent
(
hWaferT
[
l
][
lo
]
->
FindBin
(
x
,
y
),((
col
+
lo
)
%
4
)
+
1
);
hWaferS
[
l
][
s
]
->
SetBinContent
(
hWaferT
[
l
][
lo
]
->
FindBin
(
x
,
y
),((
col
+
lo
)
%
4
)
+
1
);
/*
if(Geometry::inAcceptance(l,pxy.rho())) {
hWaferAcc[l]->SetBinContent(hWaferT[l][lo]->FindBin(x,y),(col%4)+1);
} else {
hWaferUna[l]->SetBinContent(hWaferT[l][lo]->FindBin(x,y),(col%4)+1);
}
*/
hPanel
[
l
]
->
Fill
(
x
,
y
,((
Geometry
::
waferToPanel
(
l
,
w
)
/
6
)
%
7
)
+
1
);
//hPanel[l]->Fill(x,y,Geometry::waferToPanel(l,w)+1);
}
hPanel
[
l
]
->
Fill
(
x
,
y
,((
Geometry
::
waferToPanel
(
l
,
w
)
/
6
)
%
7
)
+
1
);
//hPanel[l]->Fill(x,y,Geometry::waferToPanel(l,w)+1);
}
else
{
// No wafer found
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment