AlcapDAQ
1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
analyzer
src
FADC
MOctalFADCBufferOverflow.cpp
Go to the documentation of this file.
1
/********************************************************************\
2
3
Name: MOctalFADCBufferOverflow
4
Created by: Andrew Edmonds
5
6
Contents: Module to plot the boards that overflowed in each event
7
8
\********************************************************************/
9
10
/* Standard includes */
11
#include <stdio.h>
12
#include <stdlib.h>
13
#include <string>
14
#include <map>
15
#include <utility>
16
17
/* MIDAS includes */
18
#include "midas.h"
19
20
/* ROOT includes */
21
#include <TH1.h>
22
23
/* AlCap includes */
24
#include "
TOctalFADCIsland.h
"
25
#include "
TOctalFADCBankReader.h
"
26
#include "
TGlobalData.h
"
27
#include "
TSetupData.h
"
28
29
using
std::string;
30
using
std::map;
31
using
std::vector;
32
using
std::pair;
33
34
/*-- Module declaration --------------------------------------------*/
35
INT
MOctalFADCBufferOverflow_init
(
void
);
36
INT
MOctalFADCBufferOverflow
(EVENT_HEADER*,
void
*);
37
static
INT
module_bor
(INT
run_number
);
38
39
extern
HNDLE
hDB
;
40
extern
TGlobalData
*
gData
;
41
extern
TSetupData
*
gSetup
;
42
43
static
TH1*
hNOctalFADCBufferOverflow
;
44
static
TH1*
hNOctalFADCBufferOverflowPercent
;
45
static
int
midas_events
;
46
47
ANA_MODULE
MOctalFADCBufferOverflow_module
=
48
{
49
"MOctalFADCBufferOverflow"
,
/* module name */
50
"Andrew Edmonds"
,
/* author */
51
MOctalFADCBufferOverflow
,
/* event routine */
52
module_bor
,
/* BOR routine */
53
NULL,
/* EOR routine */
54
MOctalFADCBufferOverflow_init
,
/* init routine */
55
NULL,
/* exit routine */
56
NULL,
/* parameter structure */
57
0,
/* structure size */
58
NULL,
/* initial parameters */
59
};
60
63
INT
MOctalFADCBufferOverflow_init
()
64
{
65
// This histogram has the bank names labeled on the X-axis, and the midas
66
// block number on the Y-axis.
67
// This uses the TH1::kCanRebin mechanism to expand automatically to the
68
// number of FADC banks.
69
hNOctalFADCBufferOverflow
=
new
TH1F(
70
"hNOctalFADCBufferOverflow"
,
71
"Total Number of Events in which the FADC Overflowed"
,
72
4,128, 132);
73
hNOctalFADCBufferOverflow
->SetBit(TH1::kCanRebin);
74
hNOctalFADCBufferOverflow
->GetXaxis()->SetTitle(
"FADC Board Number"
);
75
hNOctalFADCBufferOverflow
->GetYaxis()->SetTitle(
"Total Number of Buffer Overflows"
);
76
77
hNOctalFADCBufferOverflowPercent
=
new
TH1F(
78
"hNOctalFADCBufferOverflowPercent"
,
79
"Fraction of MIDAS Events in which the FADC Overflowed"
,
80
4,128, 132);
81
hNOctalFADCBufferOverflowPercent
->GetXaxis()->SetTitle(
"FADC Board Number"
);
82
hNOctalFADCBufferOverflowPercent
->GetYaxis()->SetTitle(
"Fraction of events with Buffer Overflows"
);
83
84
return
SUCCESS
;
85
}
86
90
INT
module_bor
(INT
run_number
)
91
{
92
midas_events
= 1;
93
94
return
SUCCESS
;
95
}
96
100
INT
MOctalFADCBufferOverflow
(EVENT_HEADER *pheader,
void
*pevent)
101
{
102
// Get the event number
103
104
unsigned
int
* raw;
// Points at the raw data
105
int
bankSize = bk_locate(pevent,
"NBUF"
,&raw);
106
107
if
(bankSize != 0) {
108
for
(
int
i
= 0;
i
< bankSize;
i
++) {
109
hNOctalFADCBufferOverflow
->Fill(*(raw+
i
));
110
int
bin =
hNOctalFADCBufferOverflowPercent
->FindBin(*(raw+
i
));
111
hNOctalFADCBufferOverflowPercent
->SetBinContent(bin,
hNOctalFADCBufferOverflow
->GetBinContent(bin) /
midas_events
);
112
}
113
}
114
++
midas_events
;
115
116
return
SUCCESS
;
117
}
Generated by
1.8.4