Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
LL1Mon.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file LL1Mon.cc
1
// use #include "" only for your local include and put
2
// those in the first line(s) before any #include <>
3
// otherwise you are asking for weird behavior
4
// (more info - check the difference in include path search when using "" versus <>)
5
6
#include "
LL1Mon.h
"
7
#include "
ll1setup.cc
"
8
9
#include <onlmon/OnlMon.h>
// for OnlMon
10
#include <onlmon/OnlMonDB.h>
11
#include <onlmon/OnlMonServer.h>
12
13
#include <Event/msg_profile.h>
14
15
#include <TH1.h>
16
#include <TH2.h>
17
#include <TRandom.h>
18
19
#include <cmath>
20
#include <cstdio>
// for printf
21
#include <fstream>
22
#include <iostream>
23
#include <sstream>
24
#include <string>
// for allocator, string, char_traits
25
26
27
enum
28
{
29
TRGMESSAGE
= 1,
30
FILLMESSAGE
= 2
31
};
32
33
LL1Mon::LL1Mon
(
const
std::string
&
name
)
34
:
OnlMon
(name)
35
{
36
// leave ctor fairly empty, its hard to debug if code crashes already
37
// during a new Bbcll1Mon()
38
return
;
39
}
40
41
LL1Mon::~LL1Mon
()
42
{
43
// you can delete NULL pointers it results in a NOOP (No Operation)
44
return
;
45
}
46
47
int
LL1Mon::Init
()
48
{
49
gRandom->SetSeed(rand());
50
// read our calibrations from LL1MonData.dat
51
const
char
*LL1calib = getenv(
"LL1CALIB"
);
52
if
(!LL1calib)
53
{
54
std::cout <<
"LL1CALIB environment variable not set"
<< std::endl;
55
exit(1);
56
}
57
std::string
fullfile =
std::string
(LL1calib) +
"/"
+
"LL1MonData.dat"
;
58
std::ifstream calib(fullfile);
59
calib.close();
60
// use printf for stuff which should go the screen but not into the message
61
// system (all couts are redirected)
62
printf
(
"doing the Init\n"
);
63
h_line_up
=
new
TH2D(
"h_line_up"
,
";Sample;Channel"
, 20, -0.5, 19.5, 60, -0.5, 59.5);
64
h_nhit_corr
=
new
TH2D(
"h_nhit_corr"
,
";N_{hit}^{north};N_{hit}^{south}"
,
nhitbins
,
binstart
,
binend
,
nhitbins
,
binstart
,
binend
);
65
//h_nhit_n_corr = new TH2D("h_nhit_n_corr",";N_{hit}^{N1};N_{hit}^{N2}",nhitbins/2 + 1,binstart,binend2,nhitbins/2+1,binstart,binend2);
66
//h_nhit_s_corr = new TH2D("h_nhit_s_corr",";N_{hit}^{S1};N_{hit}^{S2}",nhitbins/2 + 1,binstart,binend2, nhitbins/2+1,binstart,binend2);
67
h_nhit_n1
=
new
TH1D(
"h_nhit_n1"
,
";N_{hit}^{N1};counts"
,
nhitbins
/2 + 1,
binstart
,
binend2
);
68
h_nhit_n2
=
new
TH1D(
"h_nhit_n2"
,
";N_{hit}^{N2};counts"
,
nhitbins
/2 + 1,
binstart
,
binend2
);
69
h_nhit_s1
=
new
TH1D(
"h_nhit_s1"
,
";N_{hit}^{S1};counts"
,
nhitbins
/2 + 1,
binstart
,
binend2
);
70
h_nhit_s2
=
new
TH1D(
"h_nhit_s2"
,
";N_{hit}^{S2};counts"
,
nhitbins
/2 + 1,
binstart
,
binend2
);
71
//h_hit_check = new TH2D("h_hit_check",";N_{hit}^{north} sample index;N_{hit}^{south} sample index",3,8,11,3,8,11);
72
//h_time_diff = new TH1D("h_time_diff",";time_diff;counts", 50, -0.5, 300);
73
74
OnlMonServer
*se =
OnlMonServer::instance
();
75
// register histograms with server otherwise client won't get them
76
se->
registerHisto
(
this
,
h_line_up
);
77
se->
registerHisto
(
this
,
h_nhit_corr
);
78
se->
registerHisto
(
this
,
h_nhit_n1
);
79
se->
registerHisto
(
this
,
h_nhit_n2
);
80
se->
registerHisto
(
this
,
h_nhit_s1
);
81
se->
registerHisto
(
this
,
h_nhit_s2
);
82
Reset
();
83
return
0;
84
}
85
86
int
LL1Mon::BeginRun
(
const
int
/* runno */
)
87
{
88
// if you need to read calibrations on a run by run basis
89
// this is the place to do it
90
return
0;
91
}
92
93
int
LL1Mon::process_event
(
Event
* evt )
94
{
95
evtcnt
++;
96
// int ibd = 0;
97
LL1HEADER
*ll1h =
new
LL1HEADER
();
98
ll1setup
(evt,ll1h);
99
100
Packet
*p902 = evt->
getPacket
(920);
101
if
(p902)
102
{
103
thresh
= p902->
iValue
(0);
104
delete
p902;
105
}
106
107
int
id
=9;
108
if
(ll1h->
nhit_n
[9] >=
thresh
&& ll1h->
nhit_s
[9]>=
thresh
){
109
id
=9;
110
}
111
else
if
(ll1h->
nhit_n
[ll1h->
idxhitn
] >=
thresh
&& ll1h->
nhit_s
[ll1h->
idxhitn
] >=
thresh
){
112
id
= ll1h->
idxhitn
;
113
}
114
else
if
(ll1h->
nhit_n
[ll1h->
idxhits
] >=
thresh
&& ll1h->
nhit_s
[ll1h->
idxhits
] >=
thresh
){
115
id
= ll1h->
idxhits
;
116
}
117
118
h_nhit_corr
->Fill(ll1h->
nhit_n
[
id
], ll1h->
nhit_s
[
id
]);
119
h_nhit_n1
->Fill(ll1h->
nhit_n1
[
id
]);
120
h_nhit_n2
->Fill(ll1h->
nhit_n2
[
id
]);
121
h_nhit_s1
->Fill(ll1h->
nhit_s1
[
id
]);
122
h_nhit_s2
->Fill(ll1h->
nhit_s2
[
id
]);
123
for
(
int
is = 0; is <
nSamples
; is++)
124
{
125
for
(
int
ic = 0; ic <
nChannels
; ic++)
126
{
127
h_line_up
->Fill(is, 60 - ic, ll1h->
channel
[ic][is]);
128
}
129
for
(
int
ic = 0; ic < 8; ic++)
130
{
131
h_line_up
->Fill(is, 8 - ic, ll1h->
triggerwords
[ic][is]);
132
}
133
}
134
delete
ll1h;
135
136
return
0;
137
}
138
139
int
LL1Mon::Reset
()
140
{
141
// reset our internal counters
142
evtcnt
= 0;
143
idummy
= 0;
144
return
0;
145
}
146
OnlMon
blob
main
subsystems
ll1
LL1Mon.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:28
using
1.8.2 with
sPHENIX GitHub integration