Commit ccb592fc authored by Emery Nibigira's avatar Emery Nibigira
Browse files

Merge remote-tracking branch 'upstream/Dev' into Dev

parents f433b988 46e431f3
*.bin filter=lfs diff=lfs merge=lfs -text
......@@ -193,6 +193,7 @@ if(NOT DEFINED ENV{OTSDAQ_CMSOUTERTRACKER_DIR})
MESSAGE(STATUS " ")
if(CompileForHerd OR NoDataShipping)
add_subdirectory(tools)
add_subdirectory(ProductionTools)
add_subdirectory(HWDescription)
add_subdirectory(HWInterface)
add_subdirectory(System)
......@@ -284,6 +285,7 @@ else() # ------------------------------- Compilation in the otsdaq environment -
endif()
add_subdirectory(tools)
add_subdirectory(ProductionTools)
add_subdirectory(DQMUtils)
add_subdirectory(Utils)
add_subdirectory(RootUtils)
......
......@@ -33,34 +33,63 @@ void CBCHistogramPulseShape::book(TFile* theOutputFile, const DetectorContainer&
ContainerFactory::copyStructure(theDetectorStructure, fDetectorData);
// SoC utilities only - END
fInitialVcth = findValueInSettings(pSettingsMap, "PulseShapeInitialVcth", 250);
fFinalVcth = findValueInSettings(pSettingsMap, "PulseShapeFinalVcth", 600);
fVcthStep = findValueInSettings(pSettingsMap, "PulseShapeVCthStep", 10);
fInitialDelay = findValueInSettings(pSettingsMap, "PulseShapeInitialDelay", 0);
fFinalDelay = findValueInSettings(pSettingsMap, "PulseShapeFinalDelay", 25);
fDelayStep = findValueInSettings(pSettingsMap, "PulseShapeDelayStep", 1);
int delayNbins = (fFinalDelay - fInitialDelay) / fDelayStep + 1;
fEffectiveFinalDelay = (delayNbins - 1) * fDelayStep + fInitialDelay;
fInitialVcth = findValueInSettings<double>(pSettingsMap, "PulseShapeInitialVcth", 250);
fInitialLatency = findValueInSettings<double>(pSettingsMap, "PulseShapeInitialLatency", 200);
fFinalVcth = findValueInSettings<double>(pSettingsMap, "PulseShapeFinalVcth", 600);
fVcthStep = findValueInSettings<double>(pSettingsMap, "PulseShapeVCthStep", 10);
fInitialDelay = findValueInSettings<double>(pSettingsMap, "PulseShapeInitialDelay", 0);
fFinalDelay = findValueInSettings<double>(pSettingsMap, "PulseShapeFinalDelay", 25);
fDelayStep = findValueInSettings<double>(pSettingsMap, "PulseShapeDelayStep", 1);
fPlotPulseShapeSCurves = findValueInSettings<double>(pSettingsMap, "PlotPulseShapeSCurves", 0);
uint32_t numberOfChannels = theDetectorStructure.at(0)->at(0)->at(0)->at(0)->size();
int delayNbins = (fFinalDelay - fInitialDelay) / fDelayStep + 1;
fEffectiveFinalDelay = (delayNbins - 1) * fDelayStep + fInitialDelay;
float delayHistogramMin = fInitialDelay - fDelayStep / 2.;
float delayHistogramMax = fEffectiveFinalDelay + fDelayStep / 2.;
HistContainer<TH1F> theTH1FPulseShapeContainer("PulseShapePerChannel", "PulseShape Per Channel", delayNbins, delayHistogramMin, delayHistogramMax);
theTH1FPulseShapeContainer.fTheHistogram->GetXaxis()->SetTitle("delay");
theTH1FPulseShapeContainer.fTheHistogram->GetXaxis()->SetTitle("time [ns]");
theTH1FPulseShapeContainer.fTheHistogram->GetYaxis()->SetTitle("Vcth");
theTH1FPulseShapeContainer.fTheHistogram->SetStats(false);
RootContainerFactory::bookChannelHistograms(theOutputFile, theDetectorStructure, fDetectorChannelPulseShapeHistograms, theTH1FPulseShapeContainer);
theTH1FPulseShapeContainer.fTheHistogram->SetNameTitle("PulseShapePerChip", "PulseShape Per Chip");
RootContainerFactory::bookChipHistograms(theOutputFile, theDetectorStructure, fDetectorChipPulseShapeHistograms, theTH1FPulseShapeContainer);
if(fPlotPulseShapeSCurves)
{
for(uint16_t delay = fInitialDelay; delay <= fFinalDelay; delay += fDelayStep)
{
uint16_t delayDAC = 25 - (delay % 25);
uint16_t latencyDAC = fInitialLatency - (delay / 25);
if(delayDAC == 25)
{
delayDAC = 0;
latencyDAC = latencyDAC + 1;
}
uint16_t nYbins = 1024;
float minY = -0.5;
float maxY = 1023.5;
std::string histogramName = "SCurve_latency_" + std::to_string(latencyDAC) + "_delay_" + std::to_string(delayDAC);
HistContainer<TH2F> theTH2FSCurve(histogramName.c_str(), histogramName.c_str(), numberOfChannels, -0.5, numberOfChannels - 0.5, nYbins, minY, maxY);
RootContainerFactory::bookChipHistograms<HistContainer<TH2F>>(theOutputFile, theDetectorStructure, fDetectorSCurveHistogramMap[std::make_tuple(latencyDAC, delayDAC)], theTH2FSCurve);
}
}
}
//========================================================================================================================
void CBCHistogramPulseShape::fillCBCPulseShapePlots(uint16_t delay, DetectorDataContainer& theThresholdAndNoiseContainer)
{
// float latencyStep = -int(delay/25);
float binCenterValue = ceil(fFinalDelay / 25.) * 25 - (delay / 25) * 25. - (25. - delay % 25);
// float binCenterValue = (delay % 25) + (ceil((fFinalDelay-delay) / 25.) -1 ) * 25;
// float binCenterValue = ceil(fFinalDelay / 25.) * 25 - (delay / 25) * 25. - (25. - delay % 25);
float binCenterValue = delay;
std::cout << binCenterValue << std::endl;
// std::cout<<delay << " - " << binCenterValue << std::endl;
for(auto board: theThresholdAndNoiseContainer) // for on boards - begin
......@@ -100,6 +129,41 @@ void CBCHistogramPulseShape::fillCBCPulseShapePlots(uint16_t delay, DetectorData
} // for on boards - end
}
//========================================================================================================================
void CBCHistogramPulseShape::fillSCurvePlots(uint16_t vcthr, uint16_t latency, uint16_t delay, DetectorDataContainer& fSCurveOccupancy)
{
for(auto board: fSCurveOccupancy)
{
for(auto opticalGroup: *board)
{
for(auto hybrid: *opticalGroup)
{
for(auto chip: *hybrid)
{
TH2F* chipSCurve = fDetectorSCurveHistogramMap.at(std::make_tuple(latency, delay))
.at(board->getIndex())
->at(opticalGroup->getIndex())
->at(hybrid->getIndex())
->at(chip->getIndex())
->getSummary<HistContainer<TH2F>>()
.fTheHistogram;
if(chip->getChannelContainer<Occupancy>() == nullptr) continue;
uint16_t channelNumber = 0;
for(auto channel: *chip->getChannelContainer<Occupancy>())
{
float tmpOccupancy = channel.fOccupancy;
float tmpOccupancyError = channel.fOccupancyError;
chipSCurve->SetBinContent(channelNumber + 1, vcthr + 1, tmpOccupancy);
chipSCurve->SetBinError(channelNumber + 1, vcthr + 1, tmpOccupancyError);
++channelNumber;
}
}
}
}
}
}
//========================================================================================================================
void CBCHistogramPulseShape::process()
{
......@@ -152,21 +216,30 @@ bool CBCHistogramPulseShape::fill(std::vector<char>& dataBuffer)
// IF YOU DO NOT WANT TO GO INTO THE SOC WITH YOUR CALIBRATION YOU DO NOT NEED THE FOLLOWING COMMENTED LINES
// I'm expecting to receive a data stream from an uint32_t contained from calibration "CalibrationExample"
ChipContainerStream<ThresholdAndNoise, ThresholdAndNoise, uint16_t> theOccupancyStreamer("CBCPulseShape");
ChipContainerStream<ThresholdAndNoise, ThresholdAndNoise, uint16_t> thePulseShapeStreamer("CBCPulseShape");
ChannelContainerStream<Occupancy, uint16_t, uint16_t, uint16_t> theSCurve("CBCPulseShapeSCurve");
// Try to see if the char buffer matched what I'm expection (container of uint32_t from CalibrationExample
// procedure)
if(theOccupancyStreamer.attachBuffer(&dataBuffer))
if(thePulseShapeStreamer.attachBuffer(&dataBuffer))
{
// It matched! Decoding chip data
theOccupancyStreamer.decodeChipData(fDetectorData);
thePulseShapeStreamer.decodeChipData(fDetectorData);
// Filling the histograms
fillCBCPulseShapePlots(theOccupancyStreamer.getHeaderElement<0>(), fDetectorData);
fillCBCPulseShapePlots(thePulseShapeStreamer.getHeaderElement<0>(), fDetectorData);
// Cleaning the data container to be ready for the next TCP string
fDetectorData.cleanDataStored();
return true;
}
else if(theSCurve.attachBuffer(&dataBuffer))
{
theSCurve.decodeChipData(fDetectorData);
fillSCurvePlots(theSCurve.getHeaderElement<0>(), theSCurve.getHeaderElement<1>(), theSCurve.getHeaderElement<2>(), fDetectorData);
fDetectorData.cleanDataStored();
return true;
}
// the stream does not match, the expected (DQM interface will try to check if other DQM istogrammers are looking
// for this stream)
return false;
......
......@@ -63,17 +63,21 @@ class CBCHistogramPulseShape : public DQMHistogramBase
* \param theHitContainer : Container with the hits you want to plot
*/
void fillCBCPulseShapePlots(uint16_t delay, DetectorDataContainer& theOccupancyContainer);
void fillSCurvePlots(uint16_t vcthr, uint16_t latency, uint16_t delay, DetectorDataContainer& fSCurveOccupancy);
private:
DetectorDataContainer fDetectorChannelPulseShapeHistograms;
DetectorDataContainer fDetectorChipPulseShapeHistograms;
DetectorDataContainer fDetectorData;
float fInitialVcth{0};
float fFinalVcth{0};
float fVcthStep{0};
float fInitialDelay{0};
float fFinalDelay{0};
float fDelayStep{0};
float fEffectiveFinalDelay{0};
DetectorDataContainer fDetectorChannelPulseShapeHistograms;
DetectorDataContainer fDetectorChipPulseShapeHistograms;
DetectorDataContainer fDetectorData;
std::map<std::tuple<uint16_t, uint16_t>, DetectorDataContainer> fDetectorSCurveHistogramMap;
float fInitialVcth{0};
float fInitialLatency{0};
float fFinalVcth{0};
float fVcthStep{0};
float fInitialDelay{0};
float fFinalDelay{0};
float fDelayStep{0};
float fEffectiveFinalDelay{0};
bool fPlotPulseShapeSCurves{false};
};
#endif
......@@ -11,6 +11,7 @@
#ifndef __DQMHISTOGRAMBASE_H__
#define __DQMHISTOGRAMBASE_H__
#include <boost/any.hpp>
#include <memory>
#include <string>
#include <vector>
......@@ -33,6 +34,44 @@ class DetectorContainer;
* \class DQMHistogramBase
* \brief Base class for monitoring histograms
*/
namespace user_detail
{
template <typename>
struct sfinae_true_DQMHistogramBase : std::true_type
{
};
template <typename T>
static auto test_SetZTitle(int) -> sfinae_true_DQMHistogramBase<decltype(std::declval<T>().SetZTitle(""))>;
template <typename>
static auto test_SetZTitle(long) -> std::false_type;
} // namespace user_detail
// SFINAE: check if object T has SetZTitle
template <typename T>
struct has_SetZTitle : decltype(user_detail::test_SetZTitle<T>(0))
{
};
// Functor for SetZTitle - default case
template <typename T, bool hasSetZTitle = false>
struct CallSetZTitle
{
void operator()(T* thePlot, const char* theTitle) { return; }
};
// Functor for SetZTitle - case when SetZTitle is defined
template <typename T>
struct CallSetZTitle<T, true>
{
void operator()(T* thePlot, const char* theTitle)
{
thePlot.SetZTitle(theTitle);
return;
}
};
class DQMHistogramBase
{
public:
......@@ -80,16 +119,22 @@ class DQMHistogramBase
DetectorDataContainer& dataContainer,
const CanvasContainer<Hist>& histContainer,
const char* XTitle = nullptr,
const char* YTitle = nullptr)
const char* YTitle = nullptr,
const char* ZTitle = nullptr)
{
if(XTitle != nullptr) histContainer.fTheHistogram->SetXTitle(XTitle);
if(YTitle != nullptr) histContainer.fTheHistogram->SetYTitle(YTitle);
if(XTitle != nullptr) histContainer.fTheHistogram->GetXaxis()->SetTitle(XTitle);
if(YTitle != nullptr) histContainer.fTheHistogram->GetYaxis()->SetTitle(YTitle);
if(ZTitle != nullptr)
{
CallSetZTitle<Hist, has_SetDirectory<Hist>::value> setZTitleFunctor;
setZTitleFunctor(histContainer.fTheHistogram, ZTitle);
}
RootContainerFactory::bookChipHistograms(theOutputFile, theDetectorStructure, dataContainer, histContainer);
}
template <typename Hist>
void draw(DetectorDataContainer& HistDataContainer, const char* opt = "", bool electronAxis = false, const char* electronAxisTitle = "", bool isNoise = false)
void draw(DetectorDataContainer& HistDataContainer, const char* opt = "", const std::string additionalAxisType = "", const char* additionalAxisTitle = "", bool isNoise = false)
{
for(auto cBoard: HistDataContainer)
for(auto cOpticalGroup: *cBoard)
......@@ -104,20 +149,31 @@ class DQMHistogramBase
canvas->Modified();
canvas->Update();
if(electronAxis == true)
if(additionalAxisType != "")
{
TPad* myPad = static_cast<TPad*>(canvas->GetPad(0));
myPad->SetTopMargin(0.16);
axes.emplace_back(new TGaxis(myPad->GetUxmin(),
myPad->GetUymax(),
myPad->GetUxmax(),
myPad->GetUymax(),
RD53chargeConverter::VCal2Charge(hist->GetXaxis()->GetBinLowEdge(1), isNoise),
RD53chargeConverter::VCal2Charge(hist->GetXaxis()->GetBinLowEdge(hist->GetXaxis()->GetNbins()), isNoise),
510,
"-"));
axes.back()->SetTitle(electronAxisTitle);
if(additionalAxisType == "electron")
axes.emplace_back(new TGaxis(myPad->GetUxmin(),
myPad->GetUymax(),
myPad->GetUxmax(),
myPad->GetUymax(),
RD53chargeConverter::VCal2Charge(hist->GetXaxis()->GetBinLowEdge(1), isNoise),
RD53chargeConverter::VCal2Charge(hist->GetXaxis()->GetBinLowEdge(hist->GetXaxis()->GetNbins()), isNoise),
510,
"-"));
else if(additionalAxisType == "frequency")
axes.emplace_back(new TGaxis(myPad->GetUxmin(),
myPad->GetUymax(),
myPad->GetUxmax(),
myPad->GetUymax(),
RD53FWconstants::CDR2Freq(hist->GetXaxis()->GetBinLowEdge(1)),
RD53FWconstants::CDR2Freq(hist->GetXaxis()->GetBinLowEdge(hist->GetXaxis()->GetNbins())),
510,
"-"));
axes.back()->SetTitle(additionalAxisTitle);
axes.back()->SetTitleOffset(1.2);
axes.back()->SetTitleSize(0.035);
axes.back()->SetTitleFont(40);
......@@ -134,10 +190,11 @@ class DQMHistogramBase
}
}
double findValueInSettings(const Ph2_System::SettingsMap& settingsMap, const std::string name, double defaultValue = 0.) const
template <typename T>
T findValueInSettings(const Ph2_System::SettingsMap& settingsMap, const std::string name, T defaultValue = T()) const
{
auto setting = settingsMap.find(name);
return (setting != std::end(settingsMap) ? setting->second : defaultValue);
return (setting != std::end(settingsMap) ? boost::any_cast<T>(setting->second) : defaultValue);
}
};
......
......@@ -220,13 +220,13 @@ void DQMHistogramLatencyScan::parseSettings(const Ph2_System::SettingsMap& pSett
{
auto cSetting = pSettingsMap.find("StartLatency");
if(cSetting != std::end(pSettingsMap))
fStartLatency = cSetting->second;
fStartLatency = boost::any_cast<double>(cSetting->second);
else
fStartLatency = 0;
cSetting = pSettingsMap.find("LatencyRange");
if(cSetting != std::end(pSettingsMap))
fLatencyRange = cSetting->second;
fLatencyRange = boost::any_cast<double>(cSetting->second);
else
fLatencyRange = 512;
}
......@@ -40,9 +40,9 @@ void DQMHistogramPedeNoise::book(TFile* theOutputFile, const DetectorContainer&
// == FrontEndType::SSA) NCH = NSSACHANNELS;
auto cSetting = pSettingsMap.find("PlotSCurves");
fPlotSCurves = (cSetting != std::end(pSettingsMap)) ? cSetting->second : 0;
fPlotSCurves = (cSetting != std::end(pSettingsMap)) ? boost::any_cast<double>(cSetting->second) : 0;
cSetting = pSettingsMap.find("FitSCurves");
fFitSCurves = (cSetting != std::end(pSettingsMap)) ? cSetting->second : 0;
fFitSCurves = (cSetting != std::end(pSettingsMap)) ? boost::any_cast<double>(cSetting->second) : 0;
if(fFitSCurves) fPlotSCurves = true;
ContainerFactory::copyStructure(theDetectorStructure, fDetectorData);
......
......@@ -11,6 +11,7 @@
#include "DQMHistogramPedestalEqualization.h"
#include "DQMInterface.h"
#include "RD53ClockDelayHistograms.h"
#include "RD53DataTransmissionTestGraphs.h"
#include "RD53GainHistograms.h"
#include "RD53GainOptimizationHistograms.h"
#include "RD53InjectionDelayHistograms.h"
......@@ -127,6 +128,8 @@ void DQMInterface::configure(std::string const& calibrationName, std::string con
fDQMHistogrammerVector.push_back(new PhysicsHistograms());
else if(calibrationName == "ssaphysics")
fDQMHistogrammerVector.push_back(new SSAPhysicsHistograms());
else if(calibrationName == "datatrtest")
fDQMHistogrammerVector.push_back(new DataTransmissionTestGraphs());
fOutputFile = new TFile("tmp.root", "RECREATE");
for(auto dqmHistogrammer: fDQMHistogrammerVector) dqmHistogrammer->book(fOutputFile, fDetectorStructure, pSettingsMap);
......
......@@ -42,8 +42,12 @@ void BERtestHistograms::fillBERtest(const DetectorDataContainer& BERtestContaine
{
if(cChip->getSummaryContainer<uint16_t>() == nullptr) continue;
auto* BERtestHist =
BERtest.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
auto* BERtestHist = BERtest.getObject(cBoard->getId())
->getObject(cOpticalGroup->getId())
->getObject(cHybrid->getId())
->getObject(cChip->getId())
->getSummary<CanvasContainer<TH1F>>()
.fTheHistogram;
BERtestHist->SetBinContent(1, cChip->getSummary<double>());
}
......
......@@ -64,8 +64,12 @@ void ClockDelayHistograms::fillOccupancy(const DetectorDataContainer& OccupancyC
{
if(cChip->getSummaryContainer<GenericDataArray<ClkDelaySize>>() == nullptr) continue;
auto* Occupancy1DHist =
Occupancy1D.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
auto* Occupancy1DHist = Occupancy1D.getObject(cBoard->getId())
->getObject(cOpticalGroup->getId())
->getObject(cHybrid->getId())
->getObject(cChip->getId())
->getSummary<CanvasContainer<TH1F>>()
.fTheHistogram;
for(size_t i = startValue; i <= stopValue; i++)
Occupancy1DHist->SetBinContent(Occupancy1DHist->FindBin(i), cChip->getSummary<GenericDataArray<ClkDelaySize>>().data[i - startValue]);
......@@ -81,8 +85,12 @@ void ClockDelayHistograms::fillClockDelay(const DetectorDataContainer& ClockDela
{
if(cChip->getSummaryContainer<uint16_t>() == nullptr) continue;
auto* ClockDelayHist =
ClockDelay.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
auto* ClockDelayHist = ClockDelay.getObject(cBoard->getId())
->getObject(cOpticalGroup->getId())
->getObject(cHybrid->getId())
->getObject(cChip->getId())
->getSummary<CanvasContainer<TH1F>>()
.fTheHistogram;
ClockDelayHist->Fill(cChip->getSummary<uint16_t>());
}
......
......@@ -18,12 +18,12 @@ void DataReadbackOptimizationHistograms::book(TFile* theOutputFile, const Detect
// #######################
// # Retrieve parameters #
// #######################
startValueTAP0 = this->findValueInSettings(settingsMap, "TAP0Start");
stopValueTAP0 = this->findValueInSettings(settingsMap, "TAP0Stop");
startValueTAP1 = this->findValueInSettings(settingsMap, "TAP1Start");
stopValueTAP1 = this->findValueInSettings(settingsMap, "TAP1Stop");
startValueTAP2 = this->findValueInSettings(settingsMap, "TAP2Start");
stopValueTAP2 = this->findValueInSettings(settingsMap, "TAP2Stop");
startValueTAP0 = this->findValueInSettings<double>(settingsMap, "TAP0Start");
stopValueTAP0 = this->findValueInSettings<double>(settingsMap, "TAP0Stop");
startValueTAP1 = this->findValueInSettings<double>(settingsMap, "TAP1Start");
stopValueTAP1 = this->findValueInSettings<double>(settingsMap, "TAP1Stop");
startValueTAP2 = this->findValueInSettings<double>(settingsMap, "TAP2Start");
stopValueTAP2 = this->findValueInSettings<double>(settingsMap, "TAP2Stop");
size_t nSteps = (stopValueTAP0 - startValueTAP0 + 1 >= RD53Shared::MAXSTEPS ? RD53Shared::MAXSTEPS : stopValueTAP0 - startValueTAP0 + 1);
auto hTAP0scan = CanvasContainer<TH1F>("TAP0scan", "TAP0 scan", nSteps, startValueTAP0, stopValueTAP0 + 1);
......@@ -112,8 +112,12 @@ void DataReadbackOptimizationHistograms::fillScanTAP0(const DetectorDataContaine
{
if(cChip->getSummaryContainer<GenericDataArray<TAPsize>>() == nullptr) continue;
auto* TAP0scanHist =
TAP0scan.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
auto* TAP0scanHist = TAP0scan.getObject(cBoard->getId())
->getObject(cOpticalGroup->getId())
->getObject(cHybrid->getId())
->getObject(cChip->getId())
->getSummary<CanvasContainer<TH1F>>()
.fTheHistogram;
for(auto i = 0; i < TAP0scanHist->GetNbinsX(); i++) TAP0scanHist->SetBinContent(i + 1, cChip->getSummary<GenericDataArray<TAPsize>>().data[i]);
}
......@@ -128,7 +132,8 @@ void DataReadbackOptimizationHistograms::fillTAP0(const DetectorDataContainer& T
{
if(cChip->getSummaryContainer<uint16_t>() == nullptr) continue;
auto* TAP0Hist = TAP0.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
auto* TAP0Hist =
TAP0.getObject(cBoard->getId())->getObject(cOpticalGroup->getId())->getObject(cHybrid->getId())->getObject(cChip->getId())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
TAP0Hist->Fill(cChip->getSummary<uint16_t>());
}
......@@ -145,8 +150,12 @@ void DataReadbackOptimizationHistograms::fillScanTAP1(const DetectorDataContaine
{
if(cChip->getSummaryContainer<GenericDataArray<TAPsize>>() == nullptr) continue;
auto* TAP1scanHist =
TAP1scan.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
auto* TAP1scanHist = TAP1scan.getObject(cBoard->getId())
->getObject(cOpticalGroup->getId())
->getObject(cHybrid->getId())
->getObject(cChip->getId())
->getSummary<CanvasContainer<TH1F>>()
.fTheHistogram;
for(auto i = 0; i < TAP1scanHist->GetNbinsX(); i++) TAP1scanHist->SetBinContent(i + 1, cChip->getSummary<GenericDataArray<TAPsize>>().data[i]);
}
......@@ -161,7 +170,8 @@ void DataReadbackOptimizationHistograms::fillTAP1(const DetectorDataContainer& T
{
if(cChip->getSummaryContainer<uint16_t>() == nullptr) continue;
auto* TAP1Hist = TAP1.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
auto* TAP1Hist =
TAP1.getObject(cBoard->getId())->getObject(cOpticalGroup->getId())->getObject(cHybrid->getId())->getObject(cChip->getId())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
TAP1Hist->Fill(cChip->getSummary<uint16_t>());
}
......@@ -178,8 +188,12 @@ void DataReadbackOptimizationHistograms::fillScanTAP2(const DetectorDataContaine
{
if(cChip->getSummaryContainer<GenericDataArray<TAPsize>>() == nullptr) continue;
auto* TAP2scanHist =
TAP2scan.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
auto* TAP2scanHist = TAP2scan.getObject(cBoard->getId())
->getObject(cOpticalGroup->getId())
->getObject(cHybrid->getId())
->getObject(cChip->getId())
->getSummary<CanvasContainer<TH1F>>()
.fTheHistogram;
for(auto i = 0; i < TAP2scanHist->GetNbinsX(); i++) TAP2scanHist->SetBinContent(i + 1, cChip->getSummary<GenericDataArray<TAPsize>>().data[i]);
}
......@@ -194,7 +208,8 @@ void DataReadbackOptimizationHistograms::fillTAP2(const DetectorDataContainer& T
{
if(cChip->getSummaryContainer<uint16_t>() == nullptr) continue;
auto* TAP2Hist = TAP2.at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
auto* TAP2Hist =
TAP2.getObject(cBoard->getId())->getObject(cOpticalGroup->getId())->getObject(cHybrid->getId())->getObject(cChip->getId())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
TAP2Hist->Fill(cChip->getSummary<uint16_t>());
}
......
/*!
\file RD53DataTransmissionTestGraphs.cc
\brief Implementation of TAP scan graphs
\author Marijus AMBROZAS
\version 1.0
\date 26/04/21
Support: email to marijus.ambrozas@cern.ch
*/
#include "RD53DataTransmissionTestGraphs.h"
using namespace Ph2_HwDescription;
using namespace Ph2_HwInterface;
void DataTransmissionTestGraphs::book(TFile* theOutputFile, const DetectorContainer& theDetectorStructure, const Ph2_System::SettingsMap& settingsMap)
{
ContainerFactory::copyStructure(theDetectorStructure, DetectorData);
// #######################
// # Retrieve parameters #
// #######################
BERtarget = this->findValueInSettings<double>(settingsMap, "BERtarget");
given_time = this->findValueInSettings<double>(settingsMap, "byTime");
frames_or_time = this->findValueInSettings<double>(settingsMap, "framesORtime");
auto gTAP0scan = CanvasContainer<TGraphAsymmErrors>(11);
bookImplementer(theOutputFile, theDetectorStructure, TAP0scan, gTAP0scan, "TAP0", "Bit Error Rate");
auto hTAP0tgt = CanvasContainer<TH1F>("TAP0tgt", "TAP0 at target BER", 1024, 0 - 0.5, 1024 - 0.5);
bookImplementer(theOutputFile, theDetectorStructure, TAP0tgt, hTAP0tgt, "TAP0 at target BER", "Value");
}
bool DataTransmissionTestGraphs::fill(std::vector<char>& dataBuffer)
{
ChipContainerStream<EmptyContainer, std::array<std::tuple<uint16_t, double, double, double>, 11>> theTAP0scanStreamer("DataTransmissionTestTAP0scan");
ChipContainerStream<EmptyContainer, uint16_t> theTAP0tgtStreamer("DataTransmissionTestTAP0tgteshold");
if(theTAP0scanStreamer.attachBuffer(&dataBuffer))
{
theTAP0scanStreamer.decodeChipData(DetectorData);
DataTransmissionTestGraphs::fillTAP0scan(DetectorData);
DetectorData.cleanDataStored();
return true;
}
else if(theTAP0tgtStreamer.attachBuffer(&dataBuffer))
{
theTAP0tgtStreamer.decodeChipData(DetectorData);
DataTransmissionTestGraphs::fillTAP0tgt(DetectorData);
DetectorData.cleanDataStored();
return true;
}
return false;
}
void DataTransmissionTestGraphs::fillTAP0scan(const DetectorDataContainer& TAP0scanContainer)
{