Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ana Ventura Barroso
Ph2_ACF
Commits
ca93d222
Commit
ca93d222
authored
Dec 14, 2020
by
Mauro Dinardo
Browse files
Merge branch 'myDev' into 'master'
Periodic merge with OT See merge request cmsinnertracker/Ph2_ACF!49
parents
8a199046
b90f1b07
Changes
75
Expand all
Hide whitespace changes
Inline
Side-by-side
DQMUtils/RD53GainOptimizationHistograms.cc
View file @
ca93d222
...
...
@@ -16,7 +16,7 @@ void GainOptimizationHistograms::book(TFile* theOutputFile, const DetectorContai
{
ContainerFactory
::
copyStructure
(
theDetectorStructure
,
DetectorData
);
uint16_t
rangeKrumCurr
=
RD53Shared
::
setBits
(
static_cast
<
RD53
*>
(
theDetectorStructure
.
at
(
0
)
->
at
(
0
)
->
at
(
0
)
->
at
(
0
))
->
getNumberOfBits
(
"KRUM_CURR_LIN"
))
+
1
;
const
uint16_t
rangeKrumCurr
=
RD53Shared
::
setBits
(
static_cast
<
RD53
*>
(
theDetectorStructure
.
at
(
0
)
->
at
(
0
)
->
at
(
0
)
->
at
(
0
))
->
getNumberOfBits
(
"KRUM_CURR_LIN"
))
+
1
;
auto
hKrumCurr
=
CanvasContainer
<
TH1F
>
(
"KrumCurr"
,
"KrumCurr"
,
rangeKrumCurr
,
0
,
rangeKrumCurr
);
bookImplementer
(
theOutputFile
,
theDetectorStructure
,
KrumCurr
,
hKrumCurr
,
"Krummenacher Current"
,
"Entries"
);
...
...
DQMUtils/RD53PhysicsHistograms.cc
View file @
ca93d222
...
...
@@ -15,9 +15,9 @@ void PhysicsHistograms::book(TFile* theOutputFile, const DetectorContainer& theD
{
ContainerFactory
::
copyStructure
(
theDetectorStructure
,
DetectorData
);
size_t
ToTsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_TOT
/
RD53Constants
::
NPIX_REGION
)
+
1
;
size_t
BCIDsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_BCID
)
+
1
;
size_t
TrgIDsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_TRIGID
)
+
1
;
const
size_t
ToTsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_TOT
/
RD53Constants
::
NPIX_REGION
)
+
1
;
const
size_t
BCIDsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_BCID
)
+
1
;
const
size_t
TrgIDsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_TRIGID
)
+
1
;
auto
hToT1D
=
CanvasContainer
<
TH1F
>
(
"ToT1D"
,
"ToT Distribution"
,
ToTsize
,
0
,
ToTsize
);
bookImplementer
(
theOutputFile
,
theDetectorStructure
,
ToT1D
,
hToT1D
,
"ToT"
,
"Entries"
);
...
...
DQMUtils/RD53PixelAliveHistograms.cc
View file @
ca93d222
...
...
@@ -16,12 +16,16 @@ void PixelAliveHistograms::book(TFile* theOutputFile, const DetectorContainer& t
{
ContainerFactory
::
copyStructure
(
theDetectorStructure
,
DetectorData
);
size_t
ToTsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_TOT
/
RD53Constants
::
NPIX_REGION
)
+
1
;
size_t
BCIDsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_BCID
)
+
1
;
size_t
TrgIDsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_TRIGID
)
+
1
;
// #######################
// # Retrieve parameters #
// #######################
nEvents
=
this
->
findValueInSettings
(
settingsMap
,
"nEvents"
);
const
size_t
ToTsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_TOT
/
RD53Constants
::
NPIX_REGION
)
+
1
;
const
size_t
BCIDsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_BCID
)
+
1
;
const
size_t
TrgIDsize
=
RD53Shared
::
setBits
(
RD53EvtEncoder
::
NBIT_TRIGID
)
+
1
;
auto
hOcc1D
=
CanvasContainer
<
TH1F
>
(
"Occ1D"
,
"Occ1D"
,
200
+
1
,
0
,
1
+
1.
/
200
);
bookImplementer
(
theOutputFile
,
theDetectorStructure
,
Occupancy1D
,
hOcc1D
,
"
Number of hits
"
,
"Entries"
);
auto
hOcc1D
=
CanvasContainer
<
TH1F
>
(
"Occ1D"
,
"Occ1D"
,
nEvents
+
1
,
0
,
1
+
1.
/
nEvents
);
bookImplementer
(
theOutputFile
,
theDetectorStructure
,
Occupancy1D
,
hOcc1D
,
"
Efficiency
"
,
"Entries"
);
auto
hOcc2D
=
CanvasContainer
<
TH2F
>
(
"PixelAlive"
,
"Pixel Alive"
,
RD53
::
nCols
,
0
,
RD53
::
nCols
,
RD53
::
nRows
,
0
,
RD53
::
nRows
);
bookImplementer
(
theOutputFile
,
theDetectorStructure
,
Occupancy2D
,
hOcc2D
,
"Columns"
,
"Rows"
);
...
...
@@ -93,9 +97,9 @@ void PixelAliveHistograms::fill(const DetectorDataContainer& DataContainer)
for
(
auto
row
=
0u
;
row
<
RD53
::
nRows
;
row
++
)
for
(
auto
col
=
0u
;
col
<
RD53
::
nCols
;
col
++
)
{
if
(
cChip
->
getChannel
<
OccupancyAndPh
>
(
row
,
col
).
fOccupancy
!=
0
)
if
(
cChip
->
getChannel
<
OccupancyAndPh
>
(
row
,
col
).
fOccupancy
!=
RD53Shared
::
ISDISABLED
)
{
Occupancy1DHist
->
Fill
(
cChip
->
getChannel
<
OccupancyAndPh
>
(
row
,
col
).
fOccupancy
);
Occupancy1DHist
->
Fill
(
cChip
->
getChannel
<
OccupancyAndPh
>
(
row
,
col
).
fOccupancy
+
Occupancy1DHist
->
GetBinWidth
(
0
)
/
2
);
Occupancy2DHist
->
SetBinContent
(
col
+
1
,
row
+
1
,
cChip
->
getChannel
<
OccupancyAndPh
>
(
row
,
col
).
fOccupancy
);
ToTHist
->
Fill
(
cChip
->
getChannel
<
OccupancyAndPh
>
(
row
,
col
).
fPh
);
}
...
...
DQMUtils/RD53PixelAliveHistograms.h
View file @
ca93d222
...
...
@@ -40,6 +40,8 @@ class PixelAliveHistograms : public DQMHistogramBase
DetectorDataContainer
ToT
;
DetectorDataContainer
BCID
;
DetectorDataContainer
TriggerID
;
size_t
nEvents
;
};
#endif
DQMUtils/RD53SCurveHistograms.cc
View file @
ca93d222
...
...
@@ -25,7 +25,7 @@ void SCurveHistograms::book(TFile* theOutputFile, const DetectorContainer& theDe
stopValue
=
this
->
findValueInSettings
(
settingsMap
,
"VCalHstop"
);
offset
=
this
->
findValueInSettings
(
settingsMap
,
"VCalMED"
);
auto
hOcc2D
=
CanvasContainer
<
TH2F
>
(
"SCurves"
,
"SCurves"
,
nSteps
,
startValue
-
offset
,
stopValue
-
offset
,
nEvents
+
1
,
0
,
1
+
1.
/
nEvents
);
auto
hOcc2D
=
CanvasContainer
<
TH2F
>
(
"SCurves"
,
"SCurves"
,
nSteps
,
startValue
-
offset
,
stopValue
-
offset
,
2
*
nEvents
+
1
,
0
,
2
+
1.
/
nEvents
);
bookImplementer
(
theOutputFile
,
theDetectorStructure
,
Occupancy2D
,
hOcc2D
,
"#DeltaVCal"
,
"Efficiency"
);
auto
hErrorReadOut2D
=
CanvasContainer
<
TH2F
>
(
"ReadoutErrors"
,
"Readout Errors"
,
RD53
::
nCols
,
0
,
RD53
::
nCols
,
RD53
::
nRows
,
0
,
RD53
::
nRows
);
...
...
@@ -90,6 +90,8 @@ void SCurveHistograms::fillOccupancy(const DetectorDataContainer& OccupancyConta
hOcc2D
->
Fill
(
DELTA_VCAL
,
cChip
->
getChannel
<
OccupancyAndPh
>
(
row
,
col
).
fOccupancy
+
hOcc2D
->
GetYaxis
()
->
GetBinWidth
(
0
)
/
2.
);
if
(
cChip
->
getChannel
<
OccupancyAndPh
>
(
row
,
col
).
readoutError
==
true
)
ErrorReadOut2DHist
->
Fill
(
col
+
1
,
row
+
1
);
}
hOcc2D
->
GetYaxis
()
->
SetRangeUser
(
0
,
1
+
1.
/
nEvents
);
}
}
...
...
DQMUtils/RD53ThrEqualizationHistograms.cc
View file @
ca93d222
...
...
@@ -19,10 +19,14 @@ void ThrEqualizationHistograms::book(TFile* theOutputFile, const DetectorContain
// #######################
// # Retrieve parameters #
// #######################
nEvents
=
this
->
findValueInSettings
(
settingsMap
,
"nEvents"
);
nEvents
=
this
->
findValueInSettings
(
settingsMap
,
"nEvents"
);
size_t
TDACsize
=
RD53Shared
::
setBits
(
RD53Constants
::
NBIT_TDAC
)
+
1
;
const
size_t
colStart
=
this
->
findValueInSettings
(
settingsMap
,
"COLstart"
);
const
size_t
colStop
=
this
->
findValueInSettings
(
settingsMap
,
"COLstop"
);
frontEnd
=
RD53
::
getMajorityFE
(
colStart
,
colStop
);
if
(
frontEnd
==
&
RD53
::
DIFF
)
TDACsize
*=
2
;
auto
hThrEqualization
=
CanvasContainer
<
TH1F
>
(
"ThrEqualization"
,
"ThrEqualization"
,
nEvents
+
1
,
0
,
1
+
1.
/
nEvents
);
bookImplementer
(
theOutputFile
,
theDetectorStructure
,
ThrEqualization
,
hThrEqualization
,
"Efficiency"
,
"Entries"
);
...
...
@@ -75,6 +79,7 @@ void ThrEqualizationHistograms::fillOccupancy(const DetectorDataContainer& Occup
void
ThrEqualizationHistograms
::
fillTDAC
(
const
DetectorDataContainer
&
TDACContainer
)
{
size_t
TDACsize
=
RD53Shared
::
setBits
(
RD53Constants
::
NBIT_TDAC
)
+
1
;
if
(
frontEnd
==
&
RD53
::
DIFF
)
TDACsize
*=
2
;
for
(
const
auto
cBoard
:
TDACContainer
)
for
(
const
auto
cOpticalGroup
:
*
cBoard
)
...
...
DQMUtils/RD53ThrEqualizationHistograms.h
View file @
ca93d222
...
...
@@ -39,6 +39,8 @@ class ThrEqualizationHistograms : public DQMHistogramBase
size_t
nEvents
;
size_t
VCalHnsteps
;
const
Ph2_HwDescription
::
RD53
::
FrontEnd
*
frontEnd
;
};
#endif
DQMUtils/RD53ThresholdHistograms.cc
View file @
ca93d222
...
...
@@ -16,7 +16,7 @@ void ThresholdHistograms::book(TFile* theOutputFile, const DetectorContainer& th
{
ContainerFactory
::
copyStructure
(
theDetectorStructure
,
DetectorData
);
uint16_t
rangeThreshold
=
RD53Shared
::
setBits
(
static_cast
<
RD53
*>
(
theDetectorStructure
.
at
(
0
)
->
at
(
0
)
->
at
(
0
)
->
at
(
0
))
->
getNumberOfBits
(
"Vthreshold_LIN"
))
+
1
;
const
uint16_t
rangeThreshold
=
RD53Shared
::
setBits
(
static_cast
<
RD53
*>
(
theDetectorStructure
.
at
(
0
)
->
at
(
0
)
->
at
(
0
)
->
at
(
0
))
->
getNumberOfBits
(
"Vthreshold_LIN"
))
+
1
;
auto
hThrehsold
=
CanvasContainer
<
TH1F
>
(
"Threhsold"
,
"Threhsold"
,
rangeThreshold
,
0
,
rangeThreshold
);
bookImplementer
(
theOutputFile
,
theDetectorStructure
,
Threhsold
,
hThrehsold
,
"Threhsold"
,
"Entries"
);
...
...
HWDescription/RD53.cc
View file @
ca93d222
...
...
@@ -380,6 +380,11 @@ void RD53::injectPixel(unsigned int row, unsigned int col, bool inject) { fPixel
void
RD53
::
setTDAC
(
unsigned
int
row
,
unsigned
int
col
,
uint8_t
TDAC
)
{
fPixelsMask
[
col
].
TDAC
[
row
]
=
TDAC
;
}
void
RD53
::
resetTDAC
()
{
for
(
auto
col
=
0u
;
col
<
fPixelsMask
.
size
();
col
++
)
fPixelsMask
[
col
].
TDAC
.
fill
(
RD53Shared
::
setBits
(
RD53Constants
::
NBIT_TDAC
)
/
2
);
}
uint8_t
RD53
::
getTDAC
(
unsigned
int
row
,
unsigned
int
col
)
{
return
fPixelsMask
[
col
].
TDAC
[
row
];
}
uint32_t
RD53
::
getNumberOfChannels
()
const
{
return
nRows
*
nCols
;
}
...
...
HWDescription/RD53.h
View file @
ca93d222
...
...
@@ -29,16 +29,19 @@
// #########################
namespace
RD53Constants
{
const
uint8_t
BROADCAST_CHIPID
=
0x8
;
// Broadcast chip ID used to send the command to multiple chips
const
uint8_t
NREGIONS_LONGCMD
=
6
;
// Number of regions to program with long write commands
const
uint8_t
FIELDS_SHORTCMD
=
8
;
// Number of fields for the short write command
const
uint8_t
FIELDS_LONGCMD
=
24
;
// Number of fields for the long write command
const
uint8_t
NBIT_TDAC
=
4
;
// Number of TDAC bits
const
uint8_t
NBIT_MAXREG
=
16
;
// Maximum number of bits for a chip register
const
uint8_t
NPIX_REGION
=
4
;
// Number of pixels in a region (1x4)
const
uint8_t
NROW_CORE
=
8
;
// Number of rows in a core
const
uint8_t
NBIT_ADDR
=
9
;
// Number of address bits
const
uint8_t
NSYNC_WORS
=
32
;
// Number of Sync words for synchronization
const
uint8_t
BROADCAST_CHIPID
=
0x8
;
// Broadcast chip ID used to send the command to multiple chips
const
uint8_t
NREGIONS_LONGCMD
=
6
;
// Number of regions to program with long write commands
const
uint8_t
FIELDS_SHORTCMD
=
8
;
// Number of fields for the short write command
const
uint8_t
FIELDS_LONGCMD
=
24
;
// Number of fields for the long write command
const
uint8_t
NBIT_TDAC
=
4
;
// Number of TDAC bits
const
uint8_t
NBIT_MAXREG
=
16
;
// Maximum number of bits for a chip register
const
uint8_t
NPIX_REGION
=
4
;
// Number of pixels in a region (1x4)
const
uint8_t
NROW_CORE
=
8
;
// Number of rows in a core
const
uint8_t
NBIT_ADDR
=
9
;
// Number of address bits
const
uint8_t
NSYNC_WORS
=
32
;
// Number of Sync words for synchronization
const
uint8_t
CDRCONFIG_ADDR
=
0x40
;
// Address of CDR_CONFIG register
const
uint16_t
CDRCONFIG_1Gbit
=
1048
;
// Value for 1.28 Gbit/s
const
uint16_t
CDRCONFIG_640Mbit
=
1049
;
// Value for 640 Mbit/s
}
// namespace RD53Constants
// ############
...
...
@@ -153,6 +156,7 @@ class RD53 : public ReadoutChip
void
enablePixel
(
unsigned
int
row
,
unsigned
int
col
,
bool
enable
);
void
injectPixel
(
unsigned
int
row
,
unsigned
int
col
,
bool
inject
);
void
setTDAC
(
unsigned
int
row
,
unsigned
int
col
,
uint8_t
TDAC
);
void
resetTDAC
();
uint8_t
getTDAC
(
unsigned
int
row
,
unsigned
int
col
);
uint8_t
getChipLane
()
const
{
return
myChipLane
;
}
...
...
HWInterface/D19clpGBTInterface.cc
View file @
ca93d222
...
...
@@ -22,7 +22,7 @@ bool D19clpGBTInterface::ConfigureChip(Ph2_HwDescription::Chip* pChip, bool pVer
{
LOG
(
INFO
)
<<
BOLDBLUE
<<
"Configuring lpGBT"
<<
RESET
;
setBoard
(
pChip
->
getBeBoardId
());
//Load register map from configuration file
//
Load register map from configuration file
ChipRegMap
clpGBTRegMap
=
pChip
->
getRegMap
();
for
(
const
auto
&
cRegItem
:
clpGBTRegMap
)
{
...
...
HWInterface/RD53FWInterface.cc
View file @
ca93d222
This diff is collapsed.
Click to expand it.
HWInterface/RD53FWInterface.h
View file @
ca93d222
...
...
@@ -36,26 +36,21 @@
#define NBIT_FWVER 16 // Number of bits for the firmware version
#define IPBUS_FASTDURATION 1 // Duration of a fast command in terms of 40 MHz clk cycles
// #################
// # READOUT BLOCK #
// #################
#define HANDSHAKE_EN false
#define L1A_TIMEOUT 4000
namespace
RD53FWEvtEncoder
{
// ################
// # Event header #
// ################
const
uint16_t
EVT_HEADER
=
0xFFFF
;
const
uint8_t
NBIT_EVTHEAD
=
16
;
// Number of bits for the Error Code
const
uint8_t
NBIT_BLOCKSIZE
=
16
;
// Number of bits for the Block Size
const
uint8_t
NBIT_TRIGID
=
16
;
// Number of bits for the TLU Trigger ID
const
uint8_t
NBIT_FMTVER
=
8
;
// Number of bits for the Format Version
const
uint8_t
NBIT_DUMMY
=
8
;
// Number of bits for the Dummy Size
const
uint8_t
NBIT_TDC
=
8
;
// Number of bits for the TDC
const
uint8_t
NBIT_L1ACNT
=
24
;
// Number of bits for the L1A Counter (Event number)
const
uint8_t
NBIT_BXCNT
=
32
;
// Number of bits for the BX Counter
const
uint16_t
EVT_HEADER
=
0xFFFF
;
const
uint16_t
EVT_HEADER_SIZE
=
4
;
// Number of words in event header
const
uint8_t
NBIT_EVTHEAD
=
16
;
// Number of bits for the Error Code
const
uint8_t
NBIT_BLOCKSIZE
=
16
;
// Number of bits for the Block Size
const
uint8_t
NBIT_TRIGID
=
16
;
// Number of bits for the TLU Trigger ID
const
uint8_t
NBIT_FMTVER
=
8
;
// Number of bits for the Format Version
const
uint8_t
NBIT_DUMMY
=
8
;
// Number of bits for the Dummy Size
const
uint8_t
NBIT_TDC
=
8
;
// Number of bits for the TDC
const
uint8_t
NBIT_L1ACNT
=
24
;
// Number of bits for the L1A Counter (Event number)
const
uint8_t
NBIT_BXCNT
=
32
;
// Number of bits for the BX Counter
// ###############
// # Chip header #
...
...
@@ -108,7 +103,12 @@ class RD53FWInterface : public BeBoardFWInterface
void
ChipReset
()
override
;
void
ChipReSync
()
override
;
// #############################################
// # hybridId < 0 --> broadcast to all hybrids #
// #############################################
void
WriteChipCommand
(
const
std
::
vector
<
uint16_t
>&
data
,
int
hybridId
);
void
ComposeAndPackChipCommands
(
const
std
::
vector
<
uint16_t
>&
data
,
int
hybridId
,
std
::
vector
<
uint32_t
>&
commandList
);
void
SendChipCommandsPack
(
const
std
::
vector
<
uint32_t
>&
commandList
);
std
::
vector
<
std
::
pair
<
uint16_t
,
uint16_t
>>
ReadChipRegisters
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
);
struct
ChipFrame
...
...
@@ -189,7 +189,7 @@ class RD53FWInterface : public BeBoardFWInterface
uint32_t
delay_after_ecr
=
0
;
uint32_t
delay_after_autozero
=
0
;
// @TMP@
uint32_t
delay_after_inject
=
0
;
uint
16
_t
delay_after_trigger
=
0
;
uint
32
_t
delay_after_trigger
=
0
;
uint32_t
delay_after_prime
=
0
;
};
...
...
@@ -211,7 +211,12 @@ class RD53FWInterface : public BeBoardFWInterface
};
void
ConfigureFromXML
(
const
Ph2_HwDescription
::
BeBoard
*
pBoard
);
void
SetAndConfigureFastCommands
(
const
Ph2_HwDescription
::
BeBoard
*
pBoard
,
size_t
nTRIGxEvent
,
size_t
injType
,
uint32_t
nClkDelays
=
0
,
bool
enableAutozero
=
false
);
void
SetAndConfigureFastCommands
(
const
Ph2_HwDescription
::
BeBoard
*
pBoard
,
const
uint32_t
nTRIGxEvent
,
const
size_t
injType
,
const
uint32_t
injLatency
=
0
,
const
uint32_t
nClkDelays
=
0
,
const
bool
enableAutozero
=
false
);
struct
DIO5Config
{
...
...
@@ -302,6 +307,7 @@ class RD53FWInterface : public BeBoardFWInterface
D19cFpgaConfig
*
fpgaConfig
;
size_t
ddr3Offset
;
bool
singleChip
;
unsigned
int
auroraSpeed
;
uint16_t
enabledHybrids
;
};
...
...
HWInterface/RD53Interface.cc
View file @
ca93d222
...
...
@@ -181,53 +181,53 @@ void RD53Interface::InitRD53Aurora(ReadoutChip* pChip, int nActiveLanes)
usleep
(
DEEPSLEEP
);
}
bool
RD53Interface
::
WriteChipReg
(
Chip
*
pChip
,
const
std
::
string
&
pR
egN
od
e
,
const
uint16_t
data
,
bool
pVerifLoop
)
bool
RD53Interface
::
WriteChipReg
(
Chip
*
pChip
,
const
std
::
string
&
r
egN
am
e
,
const
uint16_t
data
,
bool
pVerifLoop
)
{
this
->
setBoard
(
pChip
->
getBeBoardId
());
RD53Interface
::
sendCommand
(
static_cast
<
RD53
*>
(
pChip
),
RD53Cmd
::
WrReg
(
pChip
->
getId
(),
pChip
->
getRegItem
(
pR
egN
od
e
).
fAddress
,
data
));
if
((
pR
egN
od
e
==
"VCAL_HIGH"
)
||
(
pR
egN
od
e
==
"VCAL_MED"
))
usleep
(
VCALSLEEP
);
// @TMP@
RD53Interface
::
sendCommand
(
static_cast
<
RD53
*>
(
pChip
),
RD53Cmd
::
WrReg
(
pChip
->
getId
(),
pChip
->
getRegItem
(
r
egN
am
e
).
fAddress
,
data
));
if
((
r
egN
am
e
==
"VCAL_HIGH"
)
||
(
r
egN
am
e
==
"VCAL_MED"
))
usleep
(
VCALSLEEP
);
// @TMP@
if
(
pVerifLoop
==
true
)
{
if
(
pR
egN
od
e
==
"PIX_PORTAL"
)
if
(
r
egN
am
e
==
"PIX_PORTAL"
)
{
auto
pixMode
=
RD53Interface
::
ReadChipReg
(
pChip
,
"PIX_MODE"
);
if
(
pixMode
==
0
)
{
auto
regReadback
=
RD53Interface
::
ReadRD53Reg
(
static_cast
<
RD53
*>
(
pChip
),
pR
egN
od
e
);
auto
regReadback
=
RD53Interface
::
ReadRD53Reg
(
static_cast
<
RD53
*>
(
pChip
),
r
egN
am
e
);
auto
row
=
RD53Interface
::
ReadChipReg
(
pChip
,
"REGION_ROW"
);
if
(
regReadback
.
size
()
==
0
/* @TMP@ */
||
regReadback
[
0
].
first
!=
row
||
regReadback
[
0
].
second
!=
data
)
{
LOG
(
ERROR
)
<<
BOLDRED
<<
"Error while writing into RD53 reg. "
<<
BOLDYELLOW
<<
pR
egN
od
e
<<
RESET
;
LOG
(
ERROR
)
<<
BOLDRED
<<
"Error while writing into RD53 reg. "
<<
BOLDYELLOW
<<
r
egN
am
e
<<
RESET
;
return
false
;
}
}
}
else
if
(
data
!=
RD53Interface
::
ReadChipReg
(
pChip
,
pR
egN
od
e
))
else
if
(
data
!=
RD53Interface
::
ReadChipReg
(
pChip
,
r
egN
am
e
))
return
false
;
}
pChip
->
setReg
(
pR
egN
od
e
,
data
);
pChip
->
setReg
(
r
egN
am
e
,
data
);
return
true
;
}
void
RD53Interface
::
WriteBoardBroadcastChipReg
(
const
BeBoard
*
pBoard
,
const
std
::
string
&
pR
egN
od
e
,
const
uint16_t
data
)
void
RD53Interface
::
WriteBoardBroadcastChipReg
(
const
BeBoard
*
pBoard
,
const
std
::
string
&
r
egN
am
e
,
const
uint16_t
data
)
{
this
->
setBoard
(
pBoard
->
getId
());
const
uint16_t
address
=
static_cast
<
RD53
*>
(
pBoard
->
at
(
0
)
->
at
(
0
)
->
at
(
0
))
->
getRegItem
(
pR
egN
od
e
).
fAddress
;
const
uint16_t
address
=
static_cast
<
RD53
*>
(
pBoard
->
at
(
0
)
->
at
(
0
)
->
at
(
0
))
->
getRegItem
(
r
egN
am
e
).
fAddress
;
static_cast
<
RD53FWInterface
*>
(
fBoardFW
)
->
WriteChipCommand
(
RD53Cmd
::
WrReg
(
RD53Constants
::
BROADCAST_CHIPID
,
address
,
data
).
getFrames
(),
-
1
);
}
uint16_t
RD53Interface
::
ReadChipReg
(
Chip
*
pChip
,
const
std
::
string
&
pR
egN
od
e
)
uint16_t
RD53Interface
::
ReadChipReg
(
Chip
*
pChip
,
const
std
::
string
&
r
egN
am
e
)
{
this
->
setBoard
(
pChip
->
getBeBoardId
());
const
int
nAttempts
=
2
;
for
(
auto
attempt
=
0
;
attempt
<
nAttempts
;
attempt
++
)
{
auto
regReadback
=
RD53Interface
::
ReadRD53Reg
(
static_cast
<
RD53
*>
(
pChip
),
pR
egN
od
e
);
auto
regReadback
=
RD53Interface
::
ReadRD53Reg
(
static_cast
<
RD53
*>
(
pChip
),
r
egN
am
e
);
if
(
regReadback
.
size
()
==
0
)
{
LOG
(
WARNING
)
<<
BLUE
<<
"Empty register readback, attempt n. "
<<
YELLOW
<<
attempt
<<
RESET
;
...
...
@@ -242,11 +242,11 @@ uint16_t RD53Interface::ReadChipReg(Chip* pChip, const std::string& pRegNode)
return
0
;
}
std
::
vector
<
std
::
pair
<
uint16_t
,
uint16_t
>>
RD53Interface
::
ReadRD53Reg
(
ReadoutChip
*
pChip
,
const
std
::
string
&
pR
egN
od
e
)
std
::
vector
<
std
::
pair
<
uint16_t
,
uint16_t
>>
RD53Interface
::
ReadRD53Reg
(
ReadoutChip
*
pChip
,
const
std
::
string
&
r
egN
am
e
)
{
this
->
setBoard
(
pChip
->
getBeBoardId
());
RD53Interface
::
sendCommand
(
pChip
,
RD53Cmd
::
RdReg
(
pChip
->
getId
(),
pChip
->
getRegItem
(
pR
egN
od
e
).
fAddress
));
RD53Interface
::
sendCommand
(
pChip
,
RD53Cmd
::
RdReg
(
pChip
->
getId
(),
pChip
->
getRegItem
(
r
egN
am
e
).
fAddress
));
auto
regReadback
=
static_cast
<
RD53FWInterface
*>
(
fBoardFW
)
->
ReadChipRegisters
(
pChip
);
for
(
auto
i
=
0u
;
i
<
regReadback
.
size
();
i
++
)
...
...
@@ -291,7 +291,7 @@ void RD53Interface::WriteRD53Mask(RD53* pRD53, bool doSparse, bool doDefault, bo
const
uint16_t
PIX_PORTAL_ADDR
=
pRD53
->
getRegItem
(
"PIX_PORTAL"
).
fAddress
;
const
uint8_t
highGain
=
pRD53
->
getRegItem
(
"HighGain_LIN"
).
fValue
;
const
uint8_t
chipID
=
pRD53
->
getId
();
std
::
vector
<
perColumnPixelData
>&
mask
=
doDefault
?
*
pRD53
->
getPixelsMaskDefault
()
:
*
pRD53
->
getPixelsMask
();
std
::
vector
<
perColumnPixelData
>&
mask
=
doDefault
==
true
?
*
pRD53
->
getPixelsMaskDefault
()
:
*
pRD53
->
getPixelsMask
();
// ##########################
// # Disable default config #
...
...
@@ -437,6 +437,21 @@ void RD53Interface::ReadChipAllLocalReg(ReadoutChip* pChip, const std::string& r
for
(
auto
col
=
0u
;
col
<
RD53
::
nCols
;
col
++
)
pValue
.
getChannel
<
uint16_t
>
(
row
,
col
)
=
pRD53
->
getTDAC
(
row
,
col
);
}
void
RD53Interface
::
PackChipCommands
(
ReadoutChip
*
pChip
,
const
std
::
string
&
regName
,
uint16_t
data
,
std
::
vector
<
uint16_t
>&
chipCommandList
,
bool
updateReg
)
{
RD53Cmd
::
WrReg
(
pChip
->
getId
(),
pChip
->
getRegItem
(
regName
).
fAddress
,
data
).
appendTo
(
chipCommandList
);
if
(
updateReg
==
true
)
pChip
->
setReg
(
regName
,
data
);
}
void
RD53Interface
::
SendChipCommandsPack
(
const
std
::
vector
<
uint16_t
>&
chipCommandList
,
int
hybridId
)
{
static_cast
<
RD53FWInterface
*>
(
fBoardFW
)
->
WriteChipCommand
(
chipCommandList
,
hybridId
);
}
void
RD53Interface
::
PackHybridCommands
(
const
std
::
vector
<
uint16_t
>&
chipCommandList
,
int
hybridId
,
std
::
vector
<
uint32_t
>&
hybridCommandList
)
{
static_cast
<
RD53FWInterface
*>
(
fBoardFW
)
->
ComposeAndPackChipCommands
(
chipCommandList
,
hybridId
,
hybridCommandList
);
}
void
RD53Interface
::
SendHybridCommandsPack
(
const
std
::
vector
<
uint32_t
>&
hybridCommandList
)
{
static_cast
<
RD53FWInterface
*>
(
fBoardFW
)
->
SendChipCommandsPack
(
hybridCommandList
);
}
// ###########################
// # Dedicated to minitoring #
// ###########################
...
...
HWInterface/RD53Interface.h
View file @
ca93d222
...
...
@@ -30,17 +30,23 @@ class RD53Interface : public ReadoutChipInterface
int
CheckChipID
(
Ph2_HwDescription
::
Chip
*
pChip
,
int
chipIDfromDB
);
bool
ConfigureChip
(
Ph2_HwDescription
::
Chip
*
pChip
,
bool
pVerifLoop
=
true
,
uint32_t
pBlockSize
=
310
)
override
;
bool
WriteChipReg
(
Ph2_HwDescription
::
Chip
*
pChip
,
const
std
::
string
&
pR
egN
od
e
,
uint16_t
data
,
bool
pVerifLoop
=
true
)
override
;
void
WriteBoardBroadcastChipReg
(
const
Ph2_HwDescription
::
BeBoard
*
pBoard
,
const
std
::
string
&
pR
egN
od
e
,
uint16_t
data
)
override
;
bool
WriteChipReg
(
Ph2_HwDescription
::
Chip
*
pChip
,
const
std
::
string
&
r
egN
am
e
,
uint16_t
data
,
bool
pVerifLoop
=
true
)
override
;
void
WriteBoardBroadcastChipReg
(
const
Ph2_HwDescription
::
BeBoard
*
pBoard
,
const
std
::
string
&
r
egN
am
e
,
uint16_t
data
)
override
;
bool
WriteChipAllLocalReg
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
,
const
std
::
string
&
regName
,
ChipContainer
&
pValue
,
bool
pVerifLoop
=
true
)
override
;
void
ReadChipAllLocalReg
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
,
const
std
::
string
&
regName
,
ChipContainer
&
pValue
)
override
;
uint16_t
ReadChipReg
(
Ph2_HwDescription
::
Chip
*
pChip
,
const
std
::
string
&
pR
egN
od
e
)
override
;
uint16_t
ReadChipReg
(
Ph2_HwDescription
::
Chip
*
pChip
,
const
std
::
string
&
r
egN
am
e
)
override
;
bool
ConfigureChipOriginalMask
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
,
bool
pVerifLoop
=
true
,
uint32_t
pBlockSize
=
310
)
override
;
bool
MaskAllChannels
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
,
bool
mask
,
bool
pVerifLoop
=
true
)
override
;
bool
maskChannelsAndSetInjectionSchema
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
,
const
ChannelGroupBase
*
group
,
bool
mask
,
bool
inject
,
bool
pVerifLoop
=
false
)
override
;
void
PackChipCommands
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
,
const
std
::
string
&
regName
,
uint16_t
data
,
std
::
vector
<
uint16_t
>&
chipCommandList
,
bool
updateReg
=
false
);
void
SendChipCommandsPack
(
const
std
::
vector
<
uint16_t
>&
chipCommandList
,
int
hybridId
);
void
PackHybridCommands
(
const
std
::
vector
<
uint16_t
>&
chipCommandList
,
int
hybridId
,
std
::
vector
<
uint32_t
>&
hybridCommandList
);
void
SendHybridCommandsPack
(
const
std
::
vector
<
uint32_t
>&
hybridCommandList
);
private:
std
::
vector
<
std
::
pair
<
uint16_t
,
uint16_t
>>
ReadRD53Reg
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
,
const
std
::
string
&
pR
egN
od
e
);
std
::
vector
<
std
::
pair
<
uint16_t
,
uint16_t
>>
ReadRD53Reg
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
,
const
std
::
string
&
r
egN
am
e
);
void
WriteRD53Mask
(
Ph2_HwDescription
::
RD53
*
pRD53
,
bool
doSparse
,
bool
doDefault
,
bool
pVerifLoop
=
false
);
void
InitRD53Aurora
(
Ph2_HwDescription
::
ReadoutChip
*
pChip
,
int
nActiveLanes
=
1
);
...
...
System/FileParser.cc
View file @
ca93d222
...
...
@@ -182,7 +182,7 @@ void FileParser::parseBeBoard(pugi::xml_node pBeBordNode, BeBoardFWMap& pBeBoard
if
(
std
::
string
(
cBeBoardRegNode
.
name
())
==
"Register"
)
{
std
::
string
cNameString
;
uint32_t
cValue
;
double
cValue
;
this
->
parseRegister
(
cBeBoardRegNode
,
cNameString
,
cValue
,
cBeBoard
,
os
);
}
}
...
...
@@ -303,7 +303,7 @@ void FileParser::parseOpticalGroupContainer(pugi::xml_node pOpticalGroupNode, Be
}
}
void
FileParser
::
parseRegister
(
pugi
::
xml_node
pRegisterNode
,
std
::
string
&
pAttributeString
,
uint32_t
&
pValue
,
BeBoard
*
pBoard
,
std
::
ostream
&
os
)
void
FileParser
::
parseRegister
(
pugi
::
xml_node
pRegisterNode
,
std
::
string
&
pAttributeString
,
double
&
pValue
,
BeBoard
*
pBoard
,
std
::
ostream
&
os
)
{
if
(
std
::
string
(
pRegisterNode
.
name
())
==
"Register"
)
{
...
...
@@ -324,7 +324,7 @@ void FileParser::parseRegister(pugi::xml_node pRegisterNode, std::string& pAttri
if
(
!
pAttributeString
.
empty
())
pAttributeString
+=
"."
;
pAttributeString
+=
pRegisterNode
.
attribute
(
"name"
).
value
();
pValue
=
convertAny
Int
(
pRegisterNode
.
first_child
().
value
());
pValue
=
convertAny
Double
(
pRegisterNode
.
first_child
().
value
());
os
<<
GREEN
<<
"|
\t
|
\t
|"
<<
"----"
<<
pAttributeString
<<
": "
<<
BOLDYELLOW
<<
pValue
<<
RESET
<<
std
::
endl
;
pBoard
->
setReg
(
pAttributeString
,
pValue
);
...
...
System/FileParser.h
View file @
ca93d222
...
...
@@ -76,7 +76,7 @@ class FileParser
void
parseSettingsxml
(
const
std
::
string
&
pFilename
,
SettingsMap
&
pSettingsMap
,
std
::
ostream
&
os
,
bool
pIsFile
);
void
parseBeBoard
(
pugi
::
xml_node
pBeBordNode
,
BeBoardFWMap
&
pBeBoardFWMap
,
DetectorContainer
*
pDetectorContainer
,
std
::
ostream
&
os
);
void
parseRegister
(
pugi
::
xml_node
pRegisterNode
,
std
::
string
&
pAttributeString
,
uint32_t
&
pValue
,
Ph2_HwDescription
::
BeBoard
*
pBoard
,
std
::
ostream
&
os
);
void
parseRegister
(
pugi
::
xml_node
pRegisterNode
,
std
::
string
&
pAttributeString
,
double
&
pValue
,
Ph2_HwDescription
::
BeBoard
*
pBoard
,
std
::
ostream
&
os
);
void
parseSLink
(
pugi
::
xml_node
pSLinkNode
,
Ph2_HwDescription
::
BeBoard
*
pBoard
,
std
::
ostream
&
os
);
void
parseOpticalGroupContainer
(
pugi
::
xml_node
pOpticalGroupNode
,
Ph2_HwDescription
::
BeBoard
*
pBoard
,
std
::
ostream
&
os
);
void
parseHybridContainer
(
pugi
::
xml_node
pHybridNode
,
Ph2_HwDescription
::
OpticalGroup
*
pOpticalGroup
,
std
::
ostream
&
os
,
Ph2_HwDescription
::
BeBoard
*
pBoard
);
...
...
System/SystemController.cc
View file @
ca93d222
...
...
@@ -284,9 +284,12 @@ void SystemController::ConfigureHw(bool bIgnoreI2c)
// ###################
size_t
nTRIGxEvent
=
SystemController
::
findValueInSettings
(
"nTRIGxEvent"
);
size_t
injType
=
SystemController
::
findValueInSettings
(
"INJtype"
);
size_t
injLatency
=
SystemController
::
findValueInSettings
(
"InjLatency"
);
size_t
nClkDelays
=
SystemController
::
findValueInSettings
(
"nClkDelays"
);
size_t
colStart
=
SystemController
::
findValueInSettings
(
"COLstart"
);
static_cast
<
RD53FWInterface
*>
(
this
->
fBeBoardFWMap
[
cBoard
->
getId
()])
->
SetAndConfigureFastCommands
(
cBoard
,
nTRIGxEvent
,
injType
,
nClkDelays
,
colStart
<
RD53
::
LIN
.
colStart
);
bool
resetMask
=
SystemController
::
findValueInSettings
(
"ResetMask"
);
bool
resetTDAC
=
SystemController
::
findValueInSettings
(
"ResetTDAC"
);
static_cast
<
RD53FWInterface
*>
(
this
->
fBeBoardFWMap
[
cBoard
->
getId
()])
->
SetAndConfigureFastCommands
(
cBoard
,
nTRIGxEvent
,
injType
,
injLatency
,
nClkDelays
,
colStart
<
RD53
::
LIN
.
colStart
);
LOG
(
INFO
)
<<
GREEN
<<
"Configured FSM fast command block"
<<
RESET
;
// ########################
...
...
@@ -319,12 +322,15 @@ void SystemController::ConfigureHw(bool bIgnoreI2c)
for
(
auto
cHybrid
:
*
cOpticalGroup
)
{
LOG
(
INFO
)
<<
GREEN
<<
"Initializing communication to Hybrid: "
<<
RESET
<<
BOLDYELLOW
<<
+
cHybrid
->
getId
()
<<
RESET
;
for
(
const
auto
c
RD53
:
*
cHybrid
)
for
(
const
auto
c
Chip
:
*
cHybrid
)
{
LOG
(
INFO
)
<<
GREEN
<<
"Configuring RD53: "
<<
RESET
<<
BOLDYELLOW
<<
+
cRD53
->
getId
()
<<
RESET
;
static_cast
<
RD53Interface
*>
(
fReadoutChipInterface
)
->
ConfigureChip
(
static_cast
<
RD53
*>
(
cRD53
));
LOG
(
INFO
)
<<
GREEN
<<
"Number of masked pixels: "
<<
RESET
<<
BOLDYELLOW
<<
static_cast
<
RD53
*>
(
cRD53
)
->
getNbMaskedPixels
()
<<
RESET
;
// @TMP@ static_cast<RD53Interface*>(fReadoutChipInterface)->CheckChipID(static_cast<RD53*>(cRD53), 0);
LOG
(
INFO
)
<<
GREEN
<<
"Configuring RD53: "
<<
RESET
<<
BOLDYELLOW
<<
+
cChip
->
getId
()
<<
RESET
;
if
(
resetMask
==
true
)
static_cast
<
RD53
*>
(
cChip
)
->
enableAllPixels
();
if
(
resetTDAC
==
true
)
static_cast
<
RD53
*>
(
cChip
)
->
resetTDAC
();
static_cast
<
RD53
*>
(
cChip
)
->
copyMaskToDefault
();
static_cast
<
RD53Interface
*>
(
fReadoutChipInterface
)
->
ConfigureChip
(
static_cast
<
RD53
*>
(
cChip
));
LOG
(
INFO
)
<<
GREEN
<<
"Number of masked pixels: "
<<
RESET
<<
BOLDYELLOW
<<
static_cast
<
RD53
*>
(
cChip
)
->
getNbMaskedPixels
()
<<
RESET
;
// @TMP@ static_cast<RD53Interface*>(fReadoutChipInterface)->CheckChipID(static_cast<RD53*>(cChip), 0);
}
}
}
...
...
@@ -518,13 +524,12 @@ void SystemController::DecodeData(const BeBoard* pBoard, const std::vector<uint3
fEventList
.
clear
();
if
(
RD53FWInterface
::
decodedEvents
.
size
()
==
0
)
RD53FWInterface
::
DecodeEventsMultiThreads
(
pData
,
RD53FWInterface
::
decodedEvents
);
RD53FWInterface
::
Event
::
addBoardInfo2Events
(
pBoard
,
RD53FWInterface
::
decodedEvents
);
for
(
auto
i
=
0u
;
i
<
RD53FWInterface
::
decodedEvents
.
size
();
i
++
)
fEventList
.
push_back
(
&
RD53FWInterface
::
decodedEvents
[
i
]
);
for
(
auto
&
evt
:
RD53FWInterface
::
decodedEvents
)
fEventList
.
push_back
(
&
evt
);
}
else
if
(
pType
==
BoardType
::
D19C
)
{
for
(
auto
&
pevt
:
fEventList
)
delete
pevt
;
fEventList
.
clear
();
fCurrentEvent
=
0
;
if
(
pNevents
==
0
)
{
LOG
(
INFO
)
<<
BOLDRED
<<
"Asking to decode 0 events. . something might not be right here!!!"
<<
RESET
;
}
else
...
...
System/SystemController.h
View file @
ca93d222
...
...
@@ -229,24 +229,7 @@ class SystemController
const
Ph2_HwDescription
::
BeBoard
*
getBoard
(
int
index
)
const
{
return
(
index
<
static_cast
<
int
>
(
fDetectorContainer
->
size
())
?
fDetectorContainer
->
at
(
index
)
:
nullptr
);
}
/*!
* \brief Get next event from data buffer
* \param pBoard
* \return Next event
*/
const
Ph2_HwInterface
::
Event
*
GetNextEvent
(
const
Ph2_HwDescription
::
BeBoard
*
pBoard
)
{
if
(
fFuture
.
valid
()
==
true
)
fFuture
.
get
();
return
((
fCurrentEvent
>=
fEventList
.
size
())
?
nullptr
:
fEventList
.
at
(
fCurrentEvent
++
));
}
const
Ph2_HwInterface
::
Event
*
GetEvent
(
const
Ph2_HwDescription
::
BeBoard
*
pBoard
,
unsigned
int
i
)
{
if
(
fFuture
.
valid
()
==
true
)
fFuture
.
get
();
return
((
i
>=
fEventList
.
size
())
?
nullptr
:
fEventList
.
at
(
i
));
}
const
std
::
vector
<
Ph2_HwInterface
::
Event
*>&
GetEvents
(
const
Ph2_HwDescription
::
BeBoard
*
pBoard
)
const
std
::
vector
<
Ph2_HwInterface
::
Event
*>&
GetEvents
()
{
if
(
fFuture
.
valid
()
==
true
)
fFuture
.
get
();
return
fEventList
;
...
...
@@ -261,9 +244,7 @@ class SystemController
std
::
vector
<
Ph2_HwInterface
::
Event
*>
fEventList
;
std
::
future
<
void
>
fFuture
;
uint32_t
fCurrentEvent
;
uint32_t
fEventSize
;
uint32_t
fNevents
;
uint32_t
fNCbc
;
FileParser
fParser
;
};
...
...
Utils/OccupancyAndPh.cc
View file @
ca93d222
...
...
@@ -37,7 +37,7 @@ void OccupancyAndPh::makeSummaryAverage(const std::vector<OccupancyAndPh>* theOc
totalNumberOfEnableChannels
+=
theNumberOfEnabledChannelsList
[
iContainer
];
}
fOccupancy
/=
totalNumberOfEnableChannels
;
fOccupancy
/=
(
totalNumberOfEnableChannels
>
0
?
totalNumberOfEnableChannels
:
1
)
;
if
(
fPhError
>
0
)
{
...
...
Prev
1
2
3
4
Next
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