Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Christian Dziwok
Ph2_ACF
Commits
b6cbde2c
Commit
b6cbde2c
authored
Nov 24, 2016
by
Georg Auzinger
Browse files
DQM bugfix
parent
29cb5389
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
HWDescription/Definition.h
View file @
b6cbde2c
...
...
@@ -15,7 +15,7 @@
//Glib Config Files
#define XML_DESCRIPTION_FILE_2CBC "settings/ICDescription.xml"
#define XML_DESCRIPTION_FILE_4CBC "settings/HWDescription_2CBC.xml"
#define XML_DESCRIPTION_FILE_4CBC "settings/HWDescription_2CBC
xml
.xml"
#define XML_DESCRIPTION_FILE_8CBC "settings/HWDescription_8CBC.xml"
#define XML_DESCRIPTION_FILE_16CBC "settings/Beamtest_Nov15.xml"
...
...
miniDAQ/DQMHistogrammer.cc
View file @
b6cbde2c
This diff is collapsed.
Click to expand it.
miniDAQ/DQMHistogrammer.h
View file @
b6cbde2c
...
...
@@ -26,112 +26,113 @@ class TTree;
* \class DQMHistogrammer
* \brief Class to create and fill monitoring histograms
*/
class
DQMHistogrammer
:
public
Tool
class
DQMHistogrammer
:
public
Tool
{
public:
/*!
* constructor
*/
DQMHistogrammer
(
bool
addTree
=
false
,
int
ncol
=
2
,
bool
eventFilter
=
true
,
bool
addDebugHisto
=
true
);
/*!
* destructor
*/
virtual
~
DQMHistogrammer
();
/*!
* Book histograms
*/
void
bookHistos
(
const
Ph2_HwInterface
::
EventDataMap
&
evmap
);
void
bookEventTrendHisto
(
TH1I
*&
th
,
const
TString
&
name
,
const
TString
&
title
,
int
size
);
/*!
* Fill histogram
*/
void
fillHistos
(
const
std
::
vector
<
Event
*>&
event_list
,
int
nevtp
);
void
saveHistos
(
const
std
::
string
&
out_file
);
void
resetHistos
();
void
fillSensorHistos
(
int
ncbc
,
const
std
::
vector
<
int
>&
even_values
,
const
std
::
vector
<
int
>&
odd_values
);
void
fillCBCHistos
(
unsigned
long
ievt
,
std
::
string
cbc_hid
,
uint32_t
error
,
uint32_t
address
,
int
nstub
,
const
std
::
vector
<
uint32_t
>&
channles
);
void
fillEventTrendHisto
(
TH1I
*
th
,
unsigned
long
ival
,
unsigned
int
val
);
bool
getEventFlag
(
const
unsigned
long
&
ievt
);
private:
bool
addTree_
;
int
nColumn_
;
bool
filterEvent_
;
bool
skipDebugHist_
;
uint32_t
dataBuffer_
;
// (32 bit words line)
long
pCounter_
;
// (get rid of first 47 events)
uint32_t
periodicity_
;
uint32_t
periodicityOffset_
;
uint32_t
eventBlock_
;
uint32_t
skipEvents_
;
TTree
*
tree_
;
// Following same convention as HitProfile histo naming
uint32_t
l1Accept_
;
uint32_t
tdcCounter_
;
uint32_t
totalHits_
;
uint32_t
totalStubs_
;
bool
eventFlag_
;
uint32_t
eventCountCBC_
;
std
::
vector
<
unsigned
int
>*
cbcErrorVal_
;
std
::
vector
<
unsigned
int
>*
cbcPLAddressVal_
;
std
::
vector
<
unsigned
int
>*
dut0C0chData_
;
std
::
vector
<
unsigned
int
>*
dut0C1chData_
;
std
::
vector
<
unsigned
int
>*
dut1C0chData_
;
std
::
vector
<
unsigned
int
>*
dut1C1chData_
;
struct
CBCHistos
{
TH1I
*
errBitH
;
TH1I
*
errBitVsEvtH
;
TH1I
*
plAddH
;
TH1I
*
plAddVsEvtH
;
TH1I
*
nStubsH
;
TH1I
*
evenChnOccuH
;
TH1I
*
oddChnOccuH
;
TProfile
*
tdcVsEvenChnOccuH
;
TProfile
*
tdcVsOddChnOccuH
;
};
std
::
map
<
std
::
string
,
CBCHistos
>
cbcHMap_
;
TH2I
*
hitCorrC0H_
;
TH2I
*
hitCorrC1H_
;
TH1D
*
hitDelCorrC0H
;
TH1D
*
hitDelCorrC1H
;
TH2I
*
dut0HitProfH_
;
TH2I
*
dut1HitProfH_
;
TH1I
*
dut0HitProfUnfoldedH_
;
TH1I
*
dut1HitProfUnfoldedH_
;
TH1I
*
dut0C0HitProfH_
;
TH1I
*
dut0C1HitProfH_
;
TH1I
*
dut1C0HitProfH_
;
TH1I
*
dut1C1HitProfH_
;
TH1I
*
sensCorrH_
;
TH1I
*
l1AcceptH_
;
TH1I
*
tdcCounterH_
;
TH1I
*
totalNumberHitsH_
;
TH1I
*
totalNumberStubsH_
;
TH1I
*
periodicityFlagVsEvtH_
;
TH1I
*
plAddPhaseDiffH_
;
TH2I
*
plAddPhaseCorrH_
;
TH2I
*
cbcErrorCorrH_
;
TH1I
*
plAddPhaseDiffVsEvtH_
;
TH1I
*
bunchCounterVsEvtH_
;
TH1I
*
orbitCounterVsEvtH_
;
TH1I
*
lumiCounterVsEvtH_
;
TH1I
*
l1AcceptVsEvtH_
;
TH1I
*
cbcCounterVsEvtH_
;
TH1I
*
tdcCounterVsEvtH_
;
/*!
* constructor
*/
DQMHistogrammer
(
bool
addTree
=
false
,
int
ncol
=
2
,
bool
eventFilter
=
true
,
bool
addDebugHisto
=
false
);
/*!
* destructor
*/
virtual
~
DQMHistogrammer
();
/*!
* Book histograms
*/
void
bookHistos
(
const
Ph2_HwInterface
::
EventDataMap
&
evmap
);
void
bookEventTrendHisto
(
TH1I
*&
th
,
const
TString
&
name
,
const
TString
&
title
,
int
size
);
/*!
* Fill histogram
*/
void
fillHistos
(
const
std
::
vector
<
Event
*>&
event_list
,
int
nevtp
,
const
int
data_size
);
void
saveHistos
(
const
std
::
string
&
out_file
);
void
resetHistos
();
void
fillSensorHistos
(
int
ncbc
,
const
std
::
vector
<
int
>
&
even_values
,
const
std
::
vector
<
int
>&
odd_values
);
void
fillCBCHistos
(
unsigned
long
ievt
,
std
::
string
cbc_hid
,
uint32_t
error
,
uint32_t
address
,
int
nstub
,
const
std
::
vector
<
uint32_t
>&
channles
);
void
fillEventTrendHisto
(
TH1I
*
th
,
unsigned
long
ival
,
unsigned
int
val
);
bool
getEventFlag
(
const
unsigned
long
&
ievt
,
const
int
data_size
);
private:
bool
addTree_
;
int
nColumn_
;
bool
filterEvent_
;
bool
skipDebugHist_
;
uint32_t
dataBuffer_
;
// (32 bit words line)
long
pCounter_
;
// (get rid of first 47 events)
uint32_t
periodicity_
;
uint32_t
periodicityOffset_
;
uint32_t
eventBlock_
;
uint32_t
skipEvents_
;
long
lineOffset_
;
TTree
*
tree_
;
// Following same convention as HitProfile histo naming
uint32_t
l1Accept_
;
uint32_t
tdcCounter_
;
uint32_t
totalHits_
;
uint32_t
totalStubs_
;
bool
eventFlag_
;
uint32_t
eventCountCBC_
;
std
::
vector
<
unsigned
int
>*
cbcErrorVal_
;
std
::
vector
<
unsigned
int
>*
cbcPLAddressVal_
;
std
::
vector
<
unsigned
int
>*
dut0C0chData_
;
std
::
vector
<
unsigned
int
>*
dut0C1chData_
;
std
::
vector
<
unsigned
int
>*
dut1C0chData_
;
std
::
vector
<
unsigned
int
>*
dut1C1chData_
;
struct
CBCHistos
{
TH1I
*
errBitH
;
TH1I
*
errBitVsEvtH
;
TH1I
*
plAddH
;
TH1I
*
plAddVsEvtH
;
TH1I
*
nStubsH
;
TH1I
*
evenChnOccuH
;
TH1I
*
oddChnOccuH
;
TProfile
*
tdcVsEvenChnOccuH
;
TProfile
*
tdcVsOddChnOccuH
;
};
std
::
map
<
std
::
string
,
CBCHistos
>
cbcHMap_
;
TH2I
*
hitCorrC0H_
;
TH2I
*
hitCorrC1H_
;
TH1D
*
hitDelCorrC0H
;
TH1D
*
hitDelCorrC1H
;
TH2I
*
dut0HitProfH_
;
TH2I
*
dut1HitProfH_
;
TH1I
*
dut0HitProfUnfoldedH_
;
TH1I
*
dut1HitProfUnfoldedH_
;
TH1I
*
dut0C0HitProfH_
;
TH1I
*
dut0C1HitProfH_
;
TH1I
*
dut1C0HitProfH_
;
TH1I
*
dut1C1HitProfH_
;
TH1I
*
sensCorrH_
;
TH1I
*
l1AcceptH_
;
TH1I
*
tdcCounterH_
;
TH1I
*
totalNumberHitsH_
;
TH1I
*
totalNumberStubsH_
;
TH1I
*
periodicityFlagVsEvtH_
;
TH1I
*
plAddPhaseDiffH_
;
TH2I
*
plAddPhaseCorrH_
;
TH2I
*
cbcErrorCorrH_
;
TH1I
*
plAddPhaseDiffVsEvtH_
;
TH1I
*
bunchCounterVsEvtH_
;
TH1I
*
orbitCounterVsEvtH_
;
TH1I
*
lumiCounterVsEvtH_
;
TH1I
*
l1AcceptVsEvtH_
;
TH1I
*
cbcCounterVsEvtH_
;
TH1I
*
tdcCounterVsEvtH_
;
};
#endif
miniDAQ/miniDQM.cc
View file @
b6cbde2c
...
...
@@ -46,15 +46,14 @@ void tokenize ( const std::string& str, std::vector<std::string>& tokens, const
}
}
void
dumpEvents
(
const
std
::
vector
<
Event
*>&
elist
)
void
dumpEvents
(
const
std
::
vector
<
Event
*>&
elist
,
size_t
evt_limit
)
{
for
(
int
i
=
0
;
i
<
elist
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
min
(
elist
.
size
()
,
evt_limit
)
;
i
++
)
{
std
::
cout
<<
"Event index: "
<<
i
+
1
<<
std
::
endl
;
std
::
cout
<<
*
elist
[
i
]
<<
std
::
endl
;
}
}
int
main
(
int
argc
,
char
*
argv
[]
)
{
ArgvParser
cmd
;
...
...
@@ -145,19 +144,20 @@ int main ( int argc, char* argv[] )
int
maxevt
=
(
cmd
.
foundOption
(
"nevt"
)
)
?
stoi
(
cmd
.
optionValue
(
"nevt"
)
)
:
100000
;
bool
skipHist
=
(
cmd
.
foundOption
(
"skipDebugHist"
)
)
?
true
:
false
;
// Create the Histogrammer object
DQMHistogrammer
*
dqmh
=
new
DQMHistogrammer
(
addTree
,
ncol
,
evtFilter
,
skipHist
);
// Add File handler
dqmh
->
addFileHandler
(
rawFilename
,
'r'
);
// Build the hardware setup
std
::
string
cHWFile
=
getenv
(
"BASE_DIR"
);
cHWFile
+=
"/"
;
cHWFile
+=
cbcTypeEvtSizeMap
[
cbcType
].
second
;
std
::
cout
<<
"HWfile="
<<
cHWFile
<<
std
::
endl
;
//dqmh->parseHWxml ( cHWFile );
dqmh
->
InitializeHw
(
cHWFile
);
//dqmh->fParser.parseHW (cHWFile, fBeBoardFWMap, fBoardVector, os);
const
BeBoard
*
pBoard
=
dqmh
->
getBoard
(
0
);
// Read the first event from the raw data file, needed to retrieve the event map
...
...
@@ -169,7 +169,7 @@ int main ( int argc, char* argv[] )
int
nEvents
=
dataVec
.
size
()
/
eventSize
;
Data
d
;
//call the Data::set() method - here is where i have to know the swap opitions
//
call the Data::set() method - here is where i have to know the swap opitions
d
.
Set
(
pBoard
,
dataVec
,
nEvents
,
cReverse
,
cSwap
);
const
std
::
vector
<
Event
*>&
elist
=
d
.
GetEvents
(
pBoard
);
...
...
@@ -181,7 +181,6 @@ int main ( int argc, char* argv[] )
// now read the whole file in chunks of maxevt
dqmh
->
getFileHandler
()
->
rewind
();
long
ntotevt
=
0
;
while
(
1
)
{
dataVec
.
clear
();
...
...
@@ -192,7 +191,7 @@ int main ( int argc, char* argv[] )
d
.
Set
(
pBoard
,
dataVec
,
nEvents
,
cReverse
,
cSwap
);
const
std
::
vector
<
Event
*>&
evlist
=
d
.
GetEvents
(
pBoard
);
dqmh
->
fillHistos
(
evlist
,
ntotevt
);
dqmh
->
fillHistos
(
evlist
,
ntotevt
,
eventSize
);
ntotevt
+=
nEvents
;
std
::
cout
<<
"eventSize = "
<<
eventSize
<<
", eventsRead = "
<<
nEvents
...
...
@@ -223,7 +222,6 @@ int main ( int argc, char* argv[] )
{
cDirBasePath
=
cmd
.
optionValue
(
"output"
);
cDirBasePath
+=
"/"
;
}
else
cDirBasePath
=
"Results/"
;
...
...
@@ -232,7 +230,7 @@ int main ( int argc, char* argv[] )
std
::
cout
<<
"Saving root file to "
<<
dqmFilename
<<
" and webpage to "
<<
cDirBasePath
<<
std
::
endl
;
}
else
dumpEvents
(
elist
);
else
dumpEvents
(
elist
,
maxevt
);
delete
dqmh
;
return
0
;
...
...
runDQM.sh
View file @
b6cbde2c
...
...
@@ -20,26 +20,23 @@ let "max_size = 500 * min_size" # MB
# Globals
WORKDIR
=
$(
pwd
)
TREEOUTDIR
=
/afs/cern.ch/work/c/cmstkph2/public/BeamTestDQM/
May
2016/root_files
TREEOUTDIR
=
/afs/cern.ch/work/c/cmstkph2/public/BeamTestDQM/
Oct
2016/root_files
# Define all types of available data
# Raw Data folder
declare
-a
rawFileFolders
=(
"/cmsuptrackernas/Raw/2016"
declare
-a
rawFileFolders
=(
"/cmsuptrackernas/Raw/2016
/October2016/xDAQ_runs
"
"/cmsuptrackernas/Raw/2016/imperial"
"/cmsuptrackernas/Raw/2016/
strasbourg
"
)
"/cmsuptrackernas/Raw/2016/
October2016/miniDAQ_runs
"
)
# Output web folder
declare
-a
webFolders
=(
"/afs/cern.ch/work/g/gauzinge/public/TB_DQM"
declare
-a
webFolders
=(
"/afs/cern.ch/work/g/gauzinge/public/TB_DQM
/Debug
"
"/afs/cern.ch/work/g/gauzinge/public/TB_DQM/LabTest"
"/afs/cern.ch/work/g/gauzinge/public/TB_DQM/
LabTest
"
)
"/afs/cern.ch/work/g/gauzinge/public/TB_DQM/
Oct2016/miniDAQ
"
)
# exclusive command line options
#declare -a optionList=(" --cbcType=4 --swap=2 --filter --tree"
#" --cbcType=2 --swap=1"
#" --cbcType=4 --swap=0")
declare
-a
optionList
=(
" --cbcType=4 --swap --filter --tree"
declare
-a
optionList
=(
" --cbcType=4 --swap --filter --skipDebugHist"
" --cbcType=2 --reverse"
" --cbcType=4"
)
" --cbcType=4
--filter --tree --skipDebugHist
"
)
# filename containing runs already processed
declare
-a
runProcList
=(
"run_processed.txt"
...
...
@@ -71,7 +68,7 @@ function runDQM() {
echo
"=> Most recent file is:
$lastfile
"
# now find the latest files (changed last hour)
for
rawfile
in
$(
find
$rawFileFolder
-maxdepth
1
-name
"*.raw"
-cmin
-30
)
;
do
for
rawfile
in
$(
find
$rawFileFolder
-maxdepth
1
-name
"*.raw"
-cmin
-30
0000
)
;
do
echo
"=> Processing
$rawfile
"
basefile
=
$(
basename
$rawfile
)
...
...
@@ -85,15 +82,15 @@ function runDQM() {
[
$?
-eq
0
]
&&
{
echo
"=>
$dqmfile
already available!"
;
continue
;
}
# find modification timestamp of the raw file to check if it is closed
lastmod
=
$(
stat
-c
"%Y"
$rawfile
)
size
=
$(
stat
-c
"%s"
$rawfile
)
let
"
lastmod
=
$(
stat
-c
"%Y"
$rawfile
)
"
let
"
size
=
$(
stat
-c
"%s"
$rawfile
)
"
[
$size
-lt
$min_size
]
&&
{
echo
"=> File
$rawfile
too small in size(
$size
bytes), skipping"
;
continue
;
}
# convert the file but do not finalize it, i.e do not add the filename in the list of already processed files
let
"checkout = 1"
# check if the file may still getting updated
if
[
"
$rawfile
"
==
"
$lastfile
"
]
;
then
now
=
$(
date
"+%s"
)
let
"now =
$(
date
"+%s"
)
"
let
"diff = now - lastmod"
if
[
$diff
-lt
300
]
;
then
echo
"=> Raw file
$rawfile
may still be updated, size=
$size
bytes."
...
...
@@ -109,21 +106,24 @@ function runDQM() {
$command
# bash seems to work this way
# for dev version we do not use the exit code yet
let
"ecode
=
$?
"
let
"ecode
=
$?
"
[
$ignore_ecode
-gt
0
]
&&
let
"ecode=0"
if
[
$ecode
-eq
0
]
;
then
[
$checkout
-eq
1
]
&&
echo
$dqmfile
>>
$RUNLIST
mv
Rawtuple
*
.root
$TREEOUTDIR
echo mv
Rawtuple_
$dqmfile
$TREEOUTDIR
mv
Rawtuple_
$dqmfile
$TREEOUTDIR
else
echo
"=>
$rawfile
: raw->dqm failed!"
fi
break
done
}
# Now run
# Simply comment out the other if you want to run over only one type
#
runDQM 0 # GlibSupervisor BT+Lab
runDQM 0
# GlibSupervisor BT+Lab
#runDQM 1 # miniDAQ Imperial Lab
#runDQM 2 # miniDAQ Strasbourg Lab
...
...
setup.sh
View file @
b6cbde2c
#!/bin/bash
export
CBCDAQ
=
$HOME
/CBCDAQ
#CACTUS
export
CACTUSBIN
=
/opt/cactus/bin
export
CACTUSLIB
=
/opt/cactus/lib
...
...
Write
Preview
Supports
Markdown
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