Commit 46e431f3 authored by Fabio Ravera's avatar Fabio Ravera
Browse files

Merge branch 'scope_devsPR' into 'Dev'

Developments for oscilloscopes measurements

See merge request cms_tk_ph2/Ph2_ACF!212
parents e3829cf7 3270381e
......@@ -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)
......
/*!
\file RD53EyeScanOptimizationHistograms.cc
\brief Implementation of data readback optimization histograms
\author Mauro DINARDO
\version 1.0
\date 28/06/18
Support: email to mauro.dinardo@cern.ch
*/
#include "RD53EyeScanOptimizationHistograms.h"
using namespace Ph2_HwDescription;
void EyeScanOptimizationHistograms::book(TFile* theOutputFile, const DetectorContainer& theDetectorStructure, const Ph2_System::SettingsMap& settingsMap)
{
ContainerFactory::copyStructure(theDetectorStructure, DetectorData);
// #######################
// # Retrieve parameters #
// #######################
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");
std::vector<uint16_t> dacListTAP0;
size_t nStepsTAP0 = (stopValueTAP0 - startValueTAP0 + 1 >= RD53Shared::MAXSTEPS ? RD53Shared::MAXSTEPS : stopValueTAP0 - startValueTAP0 + 1);
size_t nStepsTAP1 = (stopValueTAP1 - startValueTAP1 + 1 >= RD53Shared::MAXSTEPS ? RD53Shared::MAXSTEPS : stopValueTAP1 - startValueTAP1 + 1);
size_t nStepsTAP2 = (stopValueTAP2 - startValueTAP2 + 1 >= RD53Shared::MAXSTEPS ? RD53Shared::MAXSTEPS : stopValueTAP2 - startValueTAP2 + 1);
size_t step = floor((stopValueTAP0 - startValueTAP0 + 1) / nStepsTAP0);
for(auto i = 0u; i < nStepsTAP0; i++) dacListTAP0.push_back(startValueTAP0 + step * i);
for (auto & obs : observables){
TAP0scan[obs]=new DetectorDataContainer;
TAP1scan[obs]=new DetectorDataContainer;
TAP2scan[obs]=new DetectorDataContainer;
ThreeDscan[obs]=new DetectorDataContainer;
auto hTAP0scan = CanvasContainer<TH1F>(("TAP0scan_"+obs).c_str(), ("TAP0 scan " + obs).c_str(), nStepsTAP0, startValueTAP0, stopValueTAP0 + 1);
bookImplementer(theOutputFile, theDetectorStructure, *TAP0scan[obs], hTAP0scan, "TAP0 - driver ", obs.c_str());
auto hTAP1scan = CanvasContainer<TH1F>(("TAP1scan_"+obs).c_str(), ("TAP1 scan " + obs).c_str(), nStepsTAP1, startValueTAP1, stopValueTAP1 + 1);
bookImplementer(theOutputFile, theDetectorStructure, *TAP1scan[obs], hTAP1scan, "TAP1 - pre-emphasis-1", obs.c_str());
auto hTAP2scan = CanvasContainer<TH1F>(("TAP2scan_"+obs).c_str(), ("TAP2 scan " + obs).c_str(), nStepsTAP2, startValueTAP2, stopValueTAP2 + 1);
bookImplementer(theOutputFile, theDetectorStructure, *TAP2scan[obs], hTAP2scan, "TAP2 - pre-emphasis-2", obs.c_str());
auto hTAP3Dscan=CanvasContainer<TH3F>(("TAP012scan_" + obs).c_str(), ("TAP12 scan " + obs).c_str(), nStepsTAP0, startValueTAP0, stopValueTAP0 + 1,nStepsTAP1, startValueTAP1, stopValueTAP1 + 1, nStepsTAP2, startValueTAP2, stopValueTAP2 + 1);
bookImplementer(theOutputFile, theDetectorStructure, *ThreeDscan[obs], hTAP3Dscan, "TAP0 - driver", "TAP1 - pre-emphasis-1", "TAP2 - pre-emphasis-2");
}
}
bool EyeScanOptimizationHistograms::fill(std::vector<char>& dataBuffer)
{
const size_t TAPsize = RD53Shared::setBits(RD53Shared::MAXBITCHIPREG) + 1;
ChipContainerStream<EmptyContainer, GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>> theTAP0scanStreamer("TAP0scan");
ChipContainerStream<EmptyContainer, GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>> theTAP1scanStreamer("TAP1scan");
ChipContainerStream<EmptyContainer, GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>> theTAP2scanStreamer("TAP2scan");
ChipContainerStream<EmptyContainer, GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>> theTAP3DscanStreamer("TAP2scan");
if(theTAP0scanStreamer.attachBuffer(&dataBuffer))
{
theTAP0scanStreamer.decodeChipData(DetectorData);
EyeScanOptimizationHistograms::fillScanTAP0(DetectorData);
DetectorData.cleanDataStored();
return true;
}
else if(theTAP1scanStreamer.attachBuffer(&dataBuffer))
{
theTAP1scanStreamer.decodeChipData(DetectorData);
EyeScanOptimizationHistograms::fillScanTAP1(DetectorData);
DetectorData.cleanDataStored();
return true;
}
else if(theTAP2scanStreamer.attachBuffer(&dataBuffer))
{
theTAP2scanStreamer.decodeChipData(DetectorData);
EyeScanOptimizationHistograms::fillScanTAP2(DetectorData);
DetectorData.cleanDataStored();
return true;
}
else if(theTAP3DscanStreamer.attachBuffer(&dataBuffer))
{
theTAP3DscanStreamer.decodeChipData(DetectorData);
EyeScanOptimizationHistograms::fillScan3D(DetectorData);
DetectorData.cleanDataStored();
return true;
}
return false;
}
void EyeScanOptimizationHistograms::fillScanTAP0(const DetectorDataContainer& TAP0scanContainer)
{
const size_t TAPsize = RD53Shared::setBits(RD53Shared::MAXBITCHIPREG) + 1;
for(const auto cBoard: TAP0scanContainer)
for(const auto cOpticalGroup: *cBoard)
for(const auto cHybrid: *cOpticalGroup)
for(const auto cChip: *cHybrid)
{
for (auto &obs : observables){
if(cChip->getSummaryContainer<GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>>() == nullptr) continue;
auto* TAP0scanHist =
TAP0scan[obs]->at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
for(auto i = 0; i < TAP0scanHist->GetNbinsX(); i++){
TAP0scanHist->SetBinContent(i + 1, cChip->getSummary<GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>>().data[i][obs].at(0));
TAP0scanHist->SetBinError(i + 1, cChip->getSummary<GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>>().data[i][obs].at(5));
}
}
}
}
void EyeScanOptimizationHistograms::fillScanTAP1(const DetectorDataContainer& TAP1scanContainer)
{
const size_t TAPsize = RD53Shared::setBits(RD53Shared::MAXBITCHIPREG) + 1;
for(const auto cBoard: TAP1scanContainer)
for(const auto cOpticalGroup: *cBoard)
for(const auto cHybrid: *cOpticalGroup)
for(const auto cChip: *cHybrid)
{
for (auto &obs : observables){
if(cChip->getSummaryContainer<GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>>() == nullptr) continue;
auto* TAP1scanHist =
TAP1scan[obs]->at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
for(auto i = 0; i < TAP1scanHist->GetNbinsX(); i++){
TAP1scanHist->SetBinContent(i + 1, cChip->getSummary<GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>>().data[i][obs].at(0));
TAP1scanHist->SetBinError(i + 1, cChip->getSummary<GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>>().data[i][obs].at(5));
}
}
}
}
void EyeScanOptimizationHistograms::fillScanTAP2(const DetectorDataContainer& TAP2scanContainer)
{
const size_t TAPsize = RD53Shared::setBits(RD53Shared::MAXBITCHIPREG) + 1;
for(const auto cBoard: TAP2scanContainer)
for(const auto cOpticalGroup: *cBoard)
for(const auto cHybrid: *cOpticalGroup)
for(const auto cChip: *cHybrid)
{
for (auto &obs : observables){
if(cChip->getSummaryContainer<GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>>() == nullptr) continue;
auto* TAP2scanHist =
TAP2scan[obs]->at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH1F>>().fTheHistogram;
for(auto i = 0; i < TAP2scanHist->GetNbinsX(); i++){
TAP2scanHist->SetBinContent(i + 1, cChip->getSummary<GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>>().data[i][obs].at(0));
TAP2scanHist->SetBinError(i + 1, cChip->getSummary<GenericDataArray<TAPsize,std::unordered_map<std::string, std::array<float,7>>>>().data[i][obs].at(5));
}
}
}
}
void EyeScanOptimizationHistograms::fillScan3D(const DetectorDataContainer& the3DContainer)
{
const size_t TAPsize = RD53Shared::setBits(RD53Shared::MAXBITCHIPREG) + 1;
size_t nStepsTAP1 = (stopValueTAP1 - startValueTAP1 + 1 >= RD53Shared::MAXSTEPS ? RD53Shared::MAXSTEPS : stopValueTAP1 - startValueTAP1 + 1);
size_t nStepsTAP2 = (stopValueTAP2 - startValueTAP2 + 1 >= RD53Shared::MAXSTEPS ? RD53Shared::MAXSTEPS : stopValueTAP2 - startValueTAP2 + 1);
for(const auto cBoard: the3DContainer)
for(const auto cOpticalGroup: *cBoard)
for(const auto cHybrid: *cOpticalGroup)
for(const auto cChip: *cHybrid)
{
for (auto &obs : observables){
if(cChip->getSummaryContainer<GenericDataArray<TAPsize*TAPsize*TAPsize>>() == nullptr) continue;
auto* TAP3DscanHist =
ThreeDscan[obs]->at(cBoard->getIndex())->at(cOpticalGroup->getIndex())->at(cHybrid->getIndex())->at(cChip->getIndex())->getSummary<CanvasContainer<TH3F>>().fTheHistogram;
for(auto i = 0; i < TAP3DscanHist->GetNbinsX(); i++){
for(auto j = 0; j < TAP3DscanHist->GetNbinsX(); j++){
for(auto k = 0; k < TAP3DscanHist->GetNbinsX(); k++){
TAP3DscanHist->SetBinContent(i + 1, j+1, k+1, cChip->getSummary<GenericDataArray<TAPsize*TAPsize*TAPsize,std::unordered_map<std::string, std::array<float,7>>>>().data[i+j*nStepsTAP1+k*nStepsTAP1*nStepsTAP2][obs].at(0));
TAP3DscanHist->SetBinError(i + 1, j+1, k+1, cChip->getSummary<GenericDataArray<TAPsize*TAPsize*TAPsize,std::unordered_map<std::string, std::array<float,7>>>>().data[i+j*nStepsTAP1+k*nStepsTAP1*nStepsTAP2][obs].at(5));
}
}
}
}
}
}
void EyeScanOptimizationHistograms::process()
{
for (auto &obs : observables){
draw<TH1F>(*TAP0scan[obs]);
draw<TH1F>(*TAP1scan[obs]);
draw<TH1F>(*TAP2scan[obs]);
draw<TH3F>(*ThreeDscan[obs]);
}
}
/*!
\file RD53EyeScanOptimizationHistograms.h
\brief Header file of data readback optimization histograms
\author Mauro DINARDO
\version 1.0
\date 28/06/18
Support: email to mauro.dinardo@cern.ch
*/
#ifndef RD53EyeScanOptimizationHistograms_H
#define RD53EyeScanOptimizationHistograms_H
#include "../System/SystemController.h"
#include "../Utils/ContainerFactory.h"
#include "../Utils/ContainerStream.h"
#include "../Utils/GenericDataArray.h"
#include "../Utils/RD53Shared.h"
#include "DQMHistogramBase.h"
#include <TH1F.h>
#include <TH3F.h>
class EyeScanOptimizationHistograms : public DQMHistogramBase
{
public:
void book(TFile* theOutputFile, const DetectorContainer& theDetectorStructure, const Ph2_System::SettingsMap& settingsMap) override;
void process() override;
bool fill(std::vector<char>& dataBuffer) override;
void reset() override{};
void fillScanTAP0(const DetectorDataContainer& TAP0scanContainer);
void fillScanTAP1(const DetectorDataContainer& TAP1scanContainer);
void fillScanTAP2(const DetectorDataContainer& TAP2scanContainer);
void fillScan3D(const DetectorDataContainer& the3DContainer);
private:
DetectorDataContainer DetectorData;
std::unordered_map<std::string,DetectorDataContainer*> TAP0scan;
std::unordered_map<std::string,DetectorDataContainer*> TAP1scan;
std::unordered_map<std::string,DetectorDataContainer*> TAP2scan;
std::unordered_map<std::string,DetectorDataContainer*> ThreeDscan;
size_t startValueTAP0;
size_t stopValueTAP0;
size_t startValueTAP1;
size_t stopValueTAP1;
size_t startValueTAP2;
size_t stopValueTAP2;
std::vector<std::string> observables={"EHEight", "EWIDth","JITTer RMS","QFACtor","CROSsing"};
};
#endif
......@@ -2,25 +2,31 @@ if(NOT DEFINED ENV{OTSDAQ_CMSOUTERTRACKER_DIR})
MESSAGE(STATUS " ")
MESSAGE(STATUS " ${BoldYellow}========================================================================================================${Reset}")
MESSAGE(STATUS " ${BoldYellow}MIDDLEWARE${Reset} [stand-alone/middleware]: [${BoldCyan}Ph2_ACF/src/CMakeLists.txt${Reset}]. ${BoldRed}Begin...${Reset}")
MESSAGE(STATUS " ${BoldYellow}MIDDLEWARE${Reset} [stand-alone/middleware]: [${BoldCyan}Ph2_ACF/tools/CMakeLists.txt${Reset}]. ${BoldRed}Begin...${Reset}")
MESSAGE(STATUS " ")
# Includes
include_directories(${UHAL_UHAL_INCLUDE_PREFIX})
include_directories(${UHAL_GRAMMARS_INCLUDE_PREFIX})
include_directories(${UHAL_LOG_INCLUDE_PREFIX})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/HWDescription)
include_directories(${PROJECT_SOURCE_DIR}/HWInterface)
include_directories(${PROJECT_SOURCE_DIR}/Utils)
include_directories(${PROJECT_SOURCE_DIR}/System)
include_directories(${PROJECT_SOURCE_DIR}/tools)
include_directories(${PROJECT_SOURCE_DIR}/ProductionTools)
include_directories(${PROJECT_SOURCE_DIR}/DQMUtils)
include_directories(${PROJECT_SOURCE_DIR}/System)
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# Library dirs
link_directories(${UHAL_UHAL_LIB_PREFIX})
link_directories(${PROJECT_SOURCE_DIR/lib})
link_directories(${UHAL_LOG_LIB_PREFIX})
link_directories(${UHAL_GRAMMARS_LIB_PREFIX})
# Initial set of libraries
set(LIBS ${LIBS} Ph2_Description Ph2_Interface Ph2_Utils Ph2_System Ph2_Tools Ph2_DQMUtils NetworkUtils)
# Find source files
file(GLOB HEADERS *.h)
file(GLOB SOURCES *.cc)
# Check for ZMQ installed
if(ZMQ_FOUND)
......@@ -51,25 +57,36 @@ if(NOT DEFINED ENV{OTSDAQ_CMSOUTERTRACKER_DIR})
if(${PH2_ANTENNA_FOUND})
include_directories(${PH2_ANTENNA_INCLUDE_DIRS})
link_directories(${PH2_ANTENNA_LIBRARY_DIRS})
set(LIBS ${LIBS} ${PH2_ANTENNA_LIBRARIES} usb)
set(LIBS ${LIBS} usb ${PH2_ANTENNA_LIBRARIES})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{AntennaFlag}")
endif()
# Check for TestCard USBDriver
if(${PH2_TCUSB_FOUND})
include_directories(${PH2_TCUSB_INCLUDE_DIRS})
link_directories(${PH2_TCUSB_LIBRARY_DIRS})
set(LIBS ${LIBS} ${PH2_TCUSB_LIBRARIES} usb)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{TCUSBFlag}")
# Power supplt
if(${PH2_POWERSUPPLY_FOUND})
include_directories(${PH2_POWERSUPPLY_INCLUDE_DIRS})
link_directories(${PH2_POWERSUPPLY_LIBRARY_DIRS})
set(LIBS ${LIBS} ${PH2_POWERSUPPLY_LIBRARIES})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{PowerSupplyFlag}")
endif()
# Find root and link against it
# Check for TestCard USBDriver
if(${PH2_TCUSB_FOUND})
include_directories(${PH2_TCUSB_INCLUDE_DIRS})
link_directories(${PH2_TCUSB_LIBRARY_DIRS})
set(LIBS ${LIBS} usb ${PH2_TCUSB_LIBRARIES})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{TCUSBFlag}")
if($ENV{UseTCUSBforROH})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{TCUSBforROHFlag}")
else($ENV{UseTCUSBforROH})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{TCUSBforSEHFlag}")
endif($ENV{UseTCUSBforROH})
endif(${PH2_TCUSB_FOUND})
#last but not least, find root and link against it
if(${ROOT_FOUND})
include_directories(${ROOT_INCLUDE_DIRS})
set(LIBS ${LIBS} ${ROOT_LIBRARIES})
if(NoDataShipping)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{UseRootFlag}")
endif()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{UseRootFlag}")
#check for THttpServer
if(${ROOT_HAS_HTTP})
......@@ -77,11 +94,8 @@ if(NOT DEFINED ENV{OTSDAQ_CMSOUTERTRACKER_DIR})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{HttpFlag}")
endif()
endif()
# Check if the setup is based on the multiplexing backplane
if(DEFINED ENV{MultiplexingFlag})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{MultiplexingFlag}")
endif(DEFINED ENV{MultiplexingFlag})
set(LIBS ${LIBS} Ph2_Description Ph2_Interface Ph2_Utils Ph2_System Ph2_DQMUtils Ph2_Tools NetworkUtils)
# Build eudaq producer
if (USE_EUDAQ)
......@@ -93,34 +107,22 @@ if(NOT DEFINED ENV{OTSDAQ_CMSOUTERTRACKER_DIR})
## EXECUTABLES
####################################
file(GLOB BINARIES RELATIVE ${PROJECT_SOURCE_DIR}/src *.cc)
# Remove binaries
if(CompileForShep AND CompileForHerd)
list(REMOVE_ITEM BINARIES *.cc)
file(GLOB BINARIES RELATIVE ${PROJECT_SOURCE_DIR}/src supervisor.cc CMSITminiDAQ.cc fpgaconfig.cc)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{UseRootFlag}")
else()
list(REMOVE_ITEM BINARIES supervisor.cc)
endif()
message("-- ${BoldCyan}#### Building the following executables: ####${Reset}")
# Add the library
add_library(Ph2_ProductionTools STATIC ${SOURCES} ${HEADERS})
foreach(sourcefile ${BINARIES})
string(REPLACE ".cc" "" name ${sourcefile})
message(STATUS " ${name}")
add_executable(${name} ${sourcefile})
if (("${name}" STREQUAL "miniDAQ") OR ("${name}" STREQUAL "miniSLinkDQM"))
target_link_libraries(${name} ${LIBS} Ph2_RootUtils RootWeb)
else()
target_link_libraries(${name} ${LIBS})
endif()
endforeach(sourcefile ${BINARIES})
TARGET_LINK_LIBRARIES(Ph2_ProductionTools ${LIBS})
message("-- ${BoldCyan}#### End ####${Reset}")
MESSAGE(STATUS " ")
MESSAGE(STATUS " ${BoldYellow}MIDDLEWARE${Reset} [stand-alone/middleware]: [${BoldCyan}Ph2_ACF/src/CMakeLists.txt${Reset}]. ${BoldGreen}DONE!${Reset}")
MESSAGE(STATUS " ${BoldYellow}MIDDLEWARE${Reset} [stand-alone/middleware]: [${BoldCyan}Ph2_ACF/tools/CMakeLists.txt${Reset}]. ${BoldGreen}DONE!${Reset}")
MESSAGE(STATUS " ${BoldBlue}========================================================================================================${Reset}")
MESSAGE(STATUS " ")
......@@ -128,14 +130,31 @@ else()
MESSAGE(STATUS " ")
MESSAGE(STATUS " ${BoldBlue}========================================================================================================${Reset}")
MESSAGE(STATUS " ${BoldYellow}MIDDLEWARE${Reset} [otsdaq/middleware]: [${BoldCyan}Ph2_ACF/src/CMakeLists.txt${Reset}]. ${BoldRed}Begin...${Reset}")
MESSAGE(STATUS " ${BoldYellow}MIDDLEWARE${Reset} [otsdaq/middleware]: [${BoldCyan}Ph2_ACF/tools/CMakeLists.txt${Reset}]. ${BoldRed}Begin...${Reset}")
MESSAGE(STATUS " ")
link_directories(${UHAL_UHAL_LIB_PREFIX})
link_directories(${PROJECT_SOURCE_DIR/lib})
include_directories($ENV{OTSDAQ_CMSOUTERTRACKER_DIR}/uhal/uhal_2_7_5/uhal/uhal/include)
include_directories($ENV{OTSDAQ_CMSOUTERTRACKER_DIR}/uhal/uhal_2_7_5/uhal/log/include)
include_directories($ENV{OTSDAQ_CMSOUTERTRACKER_DIR}/uhal/uhal_2_7_5/uhal/grammars/include)
include_directories($ENV{PH2ACF_BASE_DIR}/Utils)
cet_set_compiler_flags(
EXTRA_FLAGS -Wno-reorder -Wl,--undefined
)
cet_make(LIBRARY_NAME Ph2_ProductionTools_${Ph2_ACF_Master}
LIBRARIES
pthread
${Boost_SYSTEM_LIBRARY}
EXCLUDE RD53eudaqProducer.h RD53eudaqProducer.cc
)
install_headers()
install_source()
MESSAGE(STATUS " ")
MESSAGE(STATUS " ${BoldYellow}MIDDLEWARE${Reset} [otsdaq/middleware]: [${BoldCyan}Ph2_ACF/src/CMakeLists.txt${Reset}]. ${BoldGreen}DONE!${Reset}")
MESSAGE(STATUS " ${BoldYellow}MIDDLEWARE${Reset} [otsdaq/middleware]: [${BoldCyan}Ph2_ACF/tool/CMakeLists.txt${Reset}]. ${BoldGreen}DONE!${Reset}")
MESSAGE(STATUS " ${BoldBlue}========================================================================================================${Reset}")
MESSAGE(STATUS " ")
......
/*!
\file RD53EyeDiag.h
\brief Implementaion of Bit Error Rate test
\author Mauro DINARDO
\version 1.0
\date 28/06/18
Support: email to mauro.dinardo@cern.ch
*/
#include "RD53EyeDiag.h"
#ifdef __POWERSUPPLY__
// Libraries
#include "Scope.h"
#include "ScopeAgilent.h"
#endif
using namespace Ph2_HwDescription;
using namespace Ph2_HwInterface;
EyeDiag::~EyeDiag()
{
}
void EyeDiag::ConfigureCalibration()
{
// #######################
// # Retrieve parameters #
// #######################
chain2test = this->findValueInSettings<double>("chain2Test");
given_time = this->findValueInSettings<double>("byTime");
frames_or_time = this->findValueInSettings<double>("framesORtime");
doDisplay = this->findValueInSettings<double>("DisplayHisto");
if(fPowerSupplyClient == nullptr)
{
LOG(ERROR) << BOLDRED << "Not connected to the oscilloscope!!! EyeDiag cannot be executed" << RESET;
throw std::runtime_error("RampPowerSupply cannot be executed");
}
std::stringstream observablesstring;
for (auto it = observables.begin(); it !=observables.end(); ++it){
observablesstring << *it;
if (std::next(it)!=observables.end())
observablesstring << "|";
}
fPowerSupplyClient->sendAndReceivePacket(std::string("Scope:main:setEOM=")+observablesstring.str());
// ############################################################
// # Create directory for: raw data, config files, histograms #
// ############################################################
this->CreateResultDirectory(RD53Shared::RESULTDIR, false, false);
}
void EyeDiag::Running()
{
theCurrentRun = this->fRunNumber;
LOG(INFO) << GREEN << "[EyeDiag::Running] Starting run: " << BOLDYELLOW << theCurrentRun << RESET;
EyeDiag::run();
EyeDiag::sendData();
}
void EyeDiag::sendData()
{
// for (auto & obs : observables){
// histos[obs]->SetBinContent(1, fResult[obs].at(0));
// histos[obs]->SetBinError(1, fResult[obs].at(5));
// }
}
void EyeDiag::Stop()
{
LOG(INFO) << GREEN << "[EyeDiag::Stop] Stopping" << RESET;
Tool::Stop();
EyeDiag::draw();
this->closeFileHandler();
RD53RunProgress::reset();
}
void EyeDiag::localConfigure(const std::string fileRes_, int currentRun)
{
#ifdef __USE_ROOT__
histos.clear();
#endif
if(currentRun >= 0)
{
theCurrentRun = currentRun;
LOG(INFO) << GREEN << "[EyeDiag::localConfigure] Starting run: " << BOLDYELLOW << theCurrentRun << RESET;
}
EyeDiag::ConfigureCalibration();
EyeDiag::initializeFiles(fileRes_, currentRun);
}
void EyeDiag::initializeFiles(const std::string fileRes_, int currentRun)
{
fileRes = fileRes_;
#ifdef __USE_ROOT__
for (auto & obs : observables){
histos[obs] = new TH1F(obs.c_str(), "", 1,0,1);
}
#endif
}
void EyeDiag::run(std::string runName)
{
std::unordered_map<std::string,std::string> kMeasurementMap = {
{"Crossing %(cg)" ,"CROSsing" },
{"Q-factor(cg)" ,"QFACtor" },
{"Eye jit RMS(cg)","JITTer RMS"},