Commit fc3c2201 authored by Fabio Ravera's avatar Fabio Ravera
Browse files

Merge branch 'master' into 'Dev'

Periodic merge with OT

See merge request cms_tk_ph2/Ph2_ACF!167
parents 71584e6d 1219382a
......@@ -36,7 +36,7 @@ build:
run_on_IT:
stage: run
dependencies:
- build
- build
before_script:
- printf $USER_PASS | base64 -d | kinit $USER_NAME
- xrdcp -r root://eosuser.cern.ch//eos/user/c/cmstkph2/ci_repo/ci_tools .
......@@ -53,7 +53,7 @@ run_on_IT:
- cp ci_tools/Results/Run000001_ThrEqualization.root .
- cp ci_tools/Results/Run000002_SCurve.root .
artifacts:
paths:
paths:
- Run000000_PixelAlive.root
- Run000001_ThrEqualization.root
- Run000002_SCurve.root
......@@ -65,9 +65,9 @@ check_run_on_IT:
stage: check
needs: [run_on_IT]
script:
- python ci_tools/plot_canvas.py Run000000_PixelAlive.root "Detector/Board_0/OpticalGroup_0/Hybrid_0/Chip_0/D_B(0)_O(0)_M(0)_PixelAlive_Chip(0)" -o plots
- python ci_tools/plot_canvas.py Run000001_ThrEqualization.root "Detector/Board_0/OpticalGroup_0/Hybrid_0/Chip_0/D_B(0)_O(0)_M(0)_ThrEqualization_Chip(0)" -o plots
- python ci_tools/plot_canvas.py Run000002_SCurve.root "Detector/Board_0/OpticalGroup_0/Hybrid_0/Chip_0/D_B(0)_O(0)_M(0)_SCurves_Chip(0)" -o plots
- python ci_tools/plot_canvas.py Run000000_PixelAlive.root "Detector/Board_0/OpticalGroup_0/Hybrid_0/Chip_0/D_B(0)_O(0)_H(0)_PixelAlive_Chip(0)" -o plots
- python ci_tools/plot_canvas.py Run000001_ThrEqualization.root "Detector/Board_0/OpticalGroup_0/Hybrid_0/Chip_0/D_B(0)_O(0)_H(0)_ThrEqualization_Chip(0)" -o plots
- python ci_tools/plot_canvas.py Run000002_SCurve.root "Detector/Board_0/OpticalGroup_0/Hybrid_0/Chip_0/D_B(0)_O(0)_H(0)_SCurves_Chip(0)" -o plots
artifacts:
paths:
- plots
......@@ -91,7 +91,7 @@ run_on_2S:
- cp Results/*/Hybrid.root .
artifacts:
paths:
- Hybrid.root
- Hybrid.root
- ci_tools/plot_hist.py
expire_in: 1 week
......@@ -105,7 +105,6 @@ check_run_on_2S:
- plots
expire_in: 1 week
## 2S hybrid
run_on_2S_FNAL:
tags:
......@@ -124,7 +123,7 @@ run_on_2S_FNAL:
- cp Results/*/Hybrid.root .
artifacts:
paths:
- Hybrid.root
- Hybrid.root
- ci_tools/plot_hist.py
expire_in: 1 week
......@@ -137,5 +136,3 @@ check_run_on_2S_FNAL:
paths:
- plots
expire_in: 1 week
......@@ -339,6 +339,11 @@ bool RD53FWInterface::CheckChipCommunication()
LOG(ERROR) << BOLDRED << "\t--> Some data lanes are enabled but inactive" << RESET;
return false;
}
else if(chips_en == 0)
{
LOG(ERROR) << BOLDRED << "\t--> No data lane is enabled: aborting" << RESET;
exit(EXIT_FAILURE);
}
LOG(INFO) << BOLDBLUE << "\t--> All enabled data lanes are active" << RESET;
return true;
......@@ -1231,8 +1236,8 @@ void RD53FWInterface::SetAndConfigureFastCommands(const BeBoard* pBoard, size_t
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_first_prime = 0;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_ecr = 0;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_inject = 0;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_trigger = INJdelay::BeforePrimeCal;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_prime = (nClkDelays == 0 ? (uint32_t)INJdelay::Loop : nClkDelays);
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_trigger = (nClkDelays == 0 ? (uint32_t)INJdelay::Loop : nClkDelays);
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_prime = 0;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.first_cal_en = false;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.second_cal_en = false;
......@@ -1243,8 +1248,8 @@ void RD53FWInterface::SetAndConfigureFastCommands(const BeBoard* pBoard, size_t
if(enableAutozero == true)
{
RD53FWInterface::localCfgFastCmd.autozero_source = AutozeroSource::FastCMDFSM;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_autozero = RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_prime;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_prime = 0;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_autozero = RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_trigger;
RD53FWInterface::localCfgFastCmd.fast_cmd_fsm.delay_after_trigger = 0;
}
}
else
......@@ -1794,8 +1799,10 @@ bool RD53FWInterface::RunPRBStest(bool given_time, unsigned long long frames_or_
unsigned time_per_step =
std::min(std::max((unsigned)time2run / n_prints, (unsigned)1), (unsigned)3600); // The runtime of the PRBS test will have a precision of one step (at most 1h and at least 1s)
// Reset counter
WriteStackReg({{"user.ctrl_regs.PRBS_checker.reset_cntr", 1}, {"user.ctrl_regs.PRBS_checker.reset_cntr", 0}});
WriteStackReg({{"user.ctrl_regs.PRBS_checker.module_addr", hybrid_id},
{"user.ctrl_regs.PRBS_checker.chip_address", chip_id},
{"user.ctrl_regs.PRBS_checker.reset_cntr", 1},
{"user.ctrl_regs.PRBS_checker.reset_cntr", 0}});
// Set PRBS frames to run
uint32_t lowFrames, highFrames;
......@@ -1834,15 +1841,7 @@ bool RD53FWInterface::RunPRBStest(bool given_time, unsigned long long frames_or_
}
LOG(INFO) << BOLDGREEN << "===== Run finished =====" << RESET;
WriteStackReg({
// Stop PRBS
{"user.ctrl_regs.PRBS_checker.stop_checker", 1},
{"user.ctrl_regs.PRBS_checker.stop_checker", 0},
// Select hybrid and chip
{"user.ctrl_regs.PRBS_checker.module_addr", hybrid_id},
{"user.ctrl_regs.PRBS_checker.chip_address", chip_id}});
WriteStackReg({{"user.ctrl_regs.PRBS_checker.stop_checker", 1}, {"user.ctrl_regs.PRBS_checker.stop_checker", 0}});
// Read PRBS frame counter
uint32_t PRBScntrLO = ReadReg("user.stat_regs.prbs_frame_cntr_low");
......
......@@ -51,15 +51,7 @@ bool RD53Interface::ConfigureChip(Chip* pChip, bool pVerifLoop, uint32_t pBlockS
// ###############################
// # Programmig global registers #
// ###############################
static const char* registerBlackList[] = {"HighGain_LIN",
"INJECTION_SELECT_DELAY",
"CLK_DATA_DELAY_CLK_DELAY",
"CLK_DATA_DELAY_DATA_DELAY",
"I_MONITOR_SELECT",
"V_MONITOR_SELECT",
"ADC_OFFSET_VOLT",
"ADC_MAXIMUM_VOLT",
"TEMPSENS_IDEAL_FACTOR"};
static const char* registerBlackList[] = {"HighGain_LIN", "ADC_OFFSET_VOLT", "ADC_MAXIMUM_VOLT", "TEMPSENS_IDEAL_FACTOR"};
for(const auto& cRegItem: pRD53RegMap)
if(cRegItem.second.fPrmptCfg == true)
......@@ -75,19 +67,58 @@ bool RD53Interface::ConfigureChip(Chip* pChip, bool pVerifLoop, uint32_t pBlockS
// #################
// # Special cases #
// #################
if(cRegItem.first == "ADC_MONITOR_CONFIG")
if(cRegItem.first == "MONITOR_CONFIG_ADC")
{
value =
cRegItem.second.fValue | (pRD53RegMap["MONITOR_CONFIG"].fValue & (RD53Shared::setBits(pRD53RegMap["MONITOR_CONFIG"].fBitSize) ^ RD53Shared::setBits(cRegItem.second.fBitSize)));
cRegItem.second.fValue | (pRD53RegMap["MONITOR_CONFIG"].fValue & (RD53Shared::setBits(pRD53RegMap["MONITOR_CONFIG"].fBitSize) - RD53Shared::setBits(cRegItem.second.fBitSize)));
regName = "MONITOR_CONFIG";
}
else if(cRegItem.first == "BG_MONITOR_CONFIG")
else if(cRegItem.first == "MONITOR_CONFIG_BG")
{
value = (cRegItem.second.fValue << pRD53RegMap["ADC_MONITOR_CONFIG"].fBitSize) |
value = (cRegItem.second.fValue << pRD53RegMap["MONITOR_CONFIG_ADC"].fBitSize) |
(pRD53RegMap["MONITOR_CONFIG"].fValue &
(RD53Shared::setBits(pRD53RegMap["MONITOR_CONFIG"].fBitSize) ^ (RD53Shared::setBits(cRegItem.second.fBitSize) << pRD53RegMap["ADC_MONITOR_CONFIG"].fBitSize)));
(RD53Shared::setBits(pRD53RegMap["MONITOR_CONFIG"].fBitSize) - (RD53Shared::setBits(cRegItem.second.fBitSize) << pRD53RegMap["MONITOR_CONFIG_ADC"].fBitSize)));
regName = "MONITOR_CONFIG";
}
if(cRegItem.first == "VOLTAGE_TRIM_DIG")
{
value = cRegItem.second.fValue | (pRD53RegMap["VOLTAGE_TRIM"].fValue & (RD53Shared::setBits(pRD53RegMap["VOLTAGE_TRIM"].fBitSize) - RD53Shared::setBits(cRegItem.second.fBitSize)));
regName = "VOLTAGE_TRIM";
}
else if(cRegItem.first == "VOLTAGE_TRIM_ANA")
{
value = (cRegItem.second.fValue << pRD53RegMap["VOLTAGE_TRIM_DIG"].fBitSize) |
(pRD53RegMap["VOLTAGE_TRIM"].fValue &
(RD53Shared::setBits(pRD53RegMap["VOLTAGE_TRIM"].fBitSize) - (RD53Shared::setBits(cRegItem.second.fBitSize) << pRD53RegMap["VOLTAGE_TRIM_DIG"].fBitSize)));
regName = "VOLTAGE_TRIM";
}
else if(cRegItem.first == "INJECTION_SELECT_DELAY")
{
value = cRegItem.second.fValue |
(pRD53RegMap["INJECTION_SELECT"].fValue & (RD53Shared::setBits(pRD53RegMap["INJECTION_SELECT"].fBitSize) - RD53Shared::setBits(cRegItem.second.fBitSize)));
regName = "INJECTION_SELECT";
}
else if(cRegItem.first == "CLK_DATA_DELAY_DATA_DELAY")
{
value =
cRegItem.second.fValue | (pRD53RegMap["CLK_DATA_DELAY"].fValue & (RD53Shared::setBits(pRD53RegMap["CLK_DATA_DELAY"].fBitSize) - RD53Shared::setBits(cRegItem.second.fBitSize)));
regName = "CLK_DATA_DELAY";
}
else if(cRegItem.first == "CLK_DATA_DELAY_CLK_DELAY")
{
value = (cRegItem.second.fValue << pRD53RegMap["CLK_DATA_DELAY_DATA_DELAY"].fBitSize) |
(pRD53RegMap["CLK_DATA_DELAY"].fValue &
(RD53Shared::setBits(pRD53RegMap["CLK_DATA_DELAY"].fBitSize) - (RD53Shared::setBits(cRegItem.second.fBitSize) << pRD53RegMap["CLK_DATA_DELAY_DATA_DELAY"].fBitSize)));
regName = "CLK_DATA_DELAY";
}
else if(cRegItem.first == "CLK_DATA_DELAY_CLK_PHASE")
{
value = (cRegItem.second.fValue << (pRD53RegMap["CLK_DATA_DELAY_DATA_DELAY"].fBitSize + pRD53RegMap["CLK_DATA_DELAY_CLK_DELAY"].fBitSize)) |
(pRD53RegMap["CLK_DATA_DELAY"].fValue &
(RD53Shared::setBits(pRD53RegMap["CLK_DATA_DELAY"].fBitSize) -
(RD53Shared::setBits(cRegItem.second.fBitSize) << (pRD53RegMap["CLK_DATA_DELAY_DATA_DELAY"].fBitSize + pRD53RegMap["CLK_DATA_DELAY_CLK_DELAY"].fBitSize))));
regName = "CLK_DATA_DELAY";
}
RD53Interface::WriteChipReg(pChip, regName, value, true);
}
......@@ -472,7 +503,7 @@ uint32_t RD53Interface::measureADC(ReadoutChip* pChip, uint32_t data)
{
const uint16_t GLOBAL_PULSE_ROUTE = pChip->getRegItem("GLOBAL_PULSE_ROUTE").fAddress;
const uint8_t chipID = pChip->getId();
const uint16_t trimADC = bits::pack<1, 5, 6>(true, pChip->getRegItem("BG_MONITOR_CONFIG").fValue, pChip->getRegItem("ADC_MONITOR_CONFIG").fValue);
const uint16_t trimADC = bits::pack<1, 5, 6>(true, pChip->getRegItem("MONITOR_CONFIG_BG").fValue, pChip->getRegItem("MONITOR_CONFIG_ADC").fValue);
// [10:6] band-gap trim [5:0] ADC trim. According to wafer probing they should give an average VrefADC of 0.9 V
const uint16_t GlbPulseVal = RD53Interface::ReadChipReg(pChip, "GLOBAL_PULSE_ROUTE");
......
......@@ -26,11 +26,11 @@ More informations can be found at https://indico.cern.ch/event/842824/attachment
## Middleware for the Inner-Tracker (IT) system
```diff
+ Last change made to this section: 09/10/2020
+ Last change made to this section: 06/11/2020
```
**Suggested software and firmware versions:**
- Software git branch / tag : `master` / `IT-v3.9.7`
- Software git branch / tag : `master` / `IT-v3.9.8`
- Firmware tag: `3.4`
- Mattermost forum: `cms-it-daq` (https://mattermost.web.cern.ch/cms-it-daq/)
......@@ -172,7 +172,7 @@ else
echo "Argument not recognized: $1"
fi
```
**N.B.:** steps **4** and **5** are meant to measure the so called "in-time threhsold", to be compared with the threshold measured at step **3**, which is the so called "absoulte threshold"
**N.B.:** steps **4** and **5** are meant to measure the so called "in-time threshold", to be compared with the threshold measured at step **3**, which is the so called "absoulte threshold"
### ~=-=~ End of Inner-Tracker section ~=-=~
<hr>
......
......@@ -166,8 +166,8 @@ void bookHistogramsFromStructure(TFile* theOutputFile,
SC theChipSummary;
initializePlot(&theChipSummary,
Form("D_B(%d)_O(%d)_M(%d)_%s_Chip(%d)", board->getId(), opticalGroup->getId(), hybrid->getId(), chipSummaryHistogramGenericName.c_str(), chip->getId()),
Form("D_B(%d)_O(%d)_M(%d)_%s_Chip(%d)", board->getId(), opticalGroup->getId(), hybrid->getId(), chipSummaryHistogramGenericTitle.c_str(), chip->getId()),
Form("D_B(%d)_O(%d)_H(%d)_%s_Chip(%d)", board->getId(), opticalGroup->getId(), hybrid->getId(), chipSummaryHistogramGenericName.c_str(), chip->getId()),
Form("D_B(%d)_O(%d)_H(%d)_%s_Chip(%d)", board->getId(), opticalGroup->getId(), hybrid->getId(), chipSummaryHistogramGenericTitle.c_str(), chip->getId()),
&chipSummary);
copyChip->getSummary<SC, T>() = std::move(theChipSummary);
......@@ -188,13 +188,13 @@ void bookHistogramsFromStructure(TFile* theOutputFile,
if(chip->getNumberOfCols() == 1)
{
histogramName = Form(
"D_B(%d)_O(%d)_M(%d)_C(%d)_%s_Channel(%d)", board->getId(), opticalGroup->getId(), hybrid->getId(), chip->getId(), channelHistogramGenericName.data(), row);
"D_B(%d)_O(%d)_H(%d)_C(%d)_%s_Channel(%d)", board->getId(), opticalGroup->getId(), hybrid->getId(), chip->getId(), channelHistogramGenericName.data(), row);
histogramTitle = Form(
"D_B(%d)_O(%d)_M(%d)_C(%d)_%s_Channel(%d)", board->getId(), opticalGroup->getId(), hybrid->getId(), chip->getId(), channelHistogramGenericTitle.data(), row);
"D_B(%d)_O(%d)_H(%d)_C(%d)_%s_Channel(%d)", board->getId(), opticalGroup->getId(), hybrid->getId(), chip->getId(), channelHistogramGenericTitle.data(), row);
}
else
{
histogramName = Form("D_B(%d)_O(%d)_M(%d)_C(%d)_%s_Row(%d)_Col(%d)",
histogramName = Form("D_B(%d)_O(%d)_H(%d)_C(%d)_%s_Row(%d)_Col(%d)",
board->getId(),
opticalGroup->getId(),
hybrid->getId(),
......@@ -202,7 +202,7 @@ void bookHistogramsFromStructure(TFile* theOutputFile,
channelHistogramGenericName.data(),
row,
col);
histogramTitle = Form("D_B(%d)_O(%d)_M(%d)_C(%d)_%s_Row(%d)_Col(%d)",
histogramTitle = Form("D_B(%d)_O(%d)_H(%d)_C(%d)_%s_Row(%d)_Col(%d)",
board->getId(),
opticalGroup->getId(),
hybrid->getId(),
......
......@@ -60,16 +60,17 @@
CLK_DATA_DELAY = "0"
INJECTION_SELECT = "9"
VOLTAGE_TRIM = "528"
VOLTAGE_TRIM_DIG = "16"
VOLTAGE_TRIM_ANA = "16"
ADC_MONITOR_CONFIG = "5"
BG_MONITOR_CONFIG = "12"
MONITOR_CONFIG_ADC = "5"
MONITOR_CONFIG_BG = "12"
ADC_OFFSET_VOLT = "63"
ADC_MAXIMUM_VOLT = "839"
TEMPSENS_IDEAL_FACTOR = "1225"
/>
<!--
Monitoring: ADC_MONITOR_CONFIG, BG_MONITOR_CONFIG, ADC_OFFSET_VOLT, ADC_MAXIMUM_VOLT, TEMPSENS_IDEAL_FACTOR
Monitoring: MONITOR_CONFIG_ADC, MONITOR_CONFIG_BG, ADC_OFFSET_VOLT, ADC_MAXIMUM_VOLT, TEMPSENS_IDEAL_FACTOR
CLK_DATA_DELAY: [8] clk phase; [7:4] clk delay; [3:0] data delay
-->
</RD53>
......
......@@ -197,15 +197,17 @@ SELF_TRIGGER_ENABLE 0x89 0b0000 0b0000
*-------------------------------------------------------------------------------------------------------
HighGain_LIN 0xA0 0b1 0b1 1
INJECTION_SELECT_DELAY 0xA1 0b0000 0b0000 4
CLK_DATA_DELAY_CLK_DELAY 0xA2 0b0000 0b0000 4
CLK_DATA_DELAY_DATA_DELAY 0xA3 0b0000 0b0000 4
I_MONITOR_SELECT 0xA4 0x00 0x00 6
V_MONITOR_SELECT 0xA5 0x00 0x00 7
ADC_MONITOR_CONFIG 0xA6 0d5 0d5 6
BG_MONITOR_CONFIG 0xA7 0d12 0d12 5
ADC_OFFSET_VOLT 0xA8 0d63 0d63 16
ADC_MAXIMUM_VOLT 0xA9 0d839 0d839 16
TEMPSENS_IDEAL_FACTOR 0xAA 0d1225 0d1225 16
VOLTAGE_TRIM_DIG 0xA2 0b10000 0b10000 5
VOLTAGE_TRIM_ANA 0xA3 0b10000 0b10000 5
CLK_DATA_DELAY_DATA_DELAY 0xA4 0b0000 0b0000 4
CLK_DATA_DELAY_CLK_DELAY 0xA5 0b0000 0b0000 4
CLK_DATA_DELAY_CLK_PHASE 0xA6 0b0 0b0 1
MONITOR_CONFIG_ADC 0xA7 0d5 0d5 6
MONITOR_CONFIG_BG 0xA8 0d12 0d12 5
ADC_OFFSET_VOLT 0xA9 0d63 0d63 16
ADC_MAXIMUM_VOLT 0xAA 0d839 0d839 16
TEMPSENS_IDEAL_FACTOR 0xAB 0d1225 0d1225 16
 
*-------------------------------------------------------------------------------------------------------
PIXELCONFIGURATION
......
......@@ -87,13 +87,6 @@ void readBinaryData(std::string binaryFile, SystemController& mySysCntr, std::ve
int main(int argc, char** argv)
{
// ########################
// # Configure the logger #
// ########################
el::Configurations conf("../settings/logger.conf");
conf.set(el::Level::Global, el::ConfigurationType::Format, "|%thread|%levshort| %msg");
el::Loggers::reconfigureAllLoggers(conf);
// #############################
// # Initialize command parser #
// #############################
......@@ -103,32 +96,32 @@ int main(int argc, char** argv)
cmd.setHelpOption("h", "help", "Print this help page");
cmd.defineOption("file", "Hardware description file. Default value: CMSIT.xml", CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOption("file", "Hardware description file", CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOptionAlternative("file", "f");
cmd.defineOption("calib",
"Which calibration to run [latency pixelalive noise scurve gain threqu gainopt thrmin thradj "
"injdelay clockdelay physics eudaq prbstime prbsframes]. Default: pixelalive",
"injdelay clockdelay physics eudaq prbstime prbsframes]",
CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOptionAlternative("calib", "c");
cmd.defineOption("binary", "Binary file to decode.", CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOption("binary", "Binary file to decode", CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOptionAlternative("binary", "b");
cmd.defineOption("prog", "Program the system components.", CommandLineProcessing::ArgvParser::NoOptionAttribute);
cmd.defineOption("prog", "Just program the system components", CommandLineProcessing::ArgvParser::NoOptionAttribute);
cmd.defineOptionAlternative("prog", "p");
cmd.defineOption("sup", "Run in producer(Middleware) - consumer(DQM) mode.", CommandLineProcessing::ArgvParser::NoOptionAttribute);
cmd.defineOption("sup", "Run in producer(Middleware) - consumer(DQM) mode", CommandLineProcessing::ArgvParser::NoOptionAttribute);
cmd.defineOptionAlternative("sup", "s");
cmd.defineOption("eudaqRunCtr", "EUDA-IT run control address. Defaut: tcp://localhost:44000", CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOption("eudaqRunCtr", "EUDAQ-IT run control address [e.g. tcp://localhost:44000]", CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOption("reset", "Reset the backend board", CommandLineProcessing::ArgvParser::NoOptionAttribute);
cmd.defineOptionAlternative("reset", "r");
cmd.defineOption("capture", "Capture communication with board (extension .raw).", CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOption("capture", "Capture communication with board (extension .raw)", CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOption("replay", "Replay previously captured communication (extension .raw).", CommandLineProcessing::ArgvParser::OptionRequiresValue);
cmd.defineOption("replay", "Replay previously captured communication (extension .raw)", CommandLineProcessing::ArgvParser::OptionRequiresValue);
int result = cmd.parse(argc, argv);
if(result != CommandLineProcessing::ArgvParser::NoParserError)
......@@ -150,8 +143,8 @@ int main(int argc, char** argv)
// ####################
// # Retrieve options #
// ####################
std::string configFile = cmd.foundOption("file") == true ? cmd.optionValue("file") : "CMSIT.xml";
std::string whichCalib = cmd.foundOption("calib") == true ? cmd.optionValue("calib") : "pixelalive";
std::string configFile = cmd.foundOption("file") == true ? cmd.optionValue("file") : "";
std::string whichCalib = cmd.foundOption("calib") == true ? cmd.optionValue("calib") : "";
std::string binaryFile = cmd.foundOption("binary") == true ? cmd.optionValue("binary") : "";
bool program = cmd.foundOption("prog") == true ? true : false;
bool supervisor = cmd.foundOption("sup") == true ? true : false;
......@@ -162,6 +155,18 @@ int main(int argc, char** argv)
RegManager::enableReplay(cmd.optionValue("replay"));
std::string eudaqRunCtr = cmd.foundOption("eudaqRunCtr") == true ? cmd.optionValue("eudaqRunCtr") : "tcp://localhost:44000";
// ########################
// # Configure the logger #
// ########################
std::string fileName("logs/CMSITminiDAQ" + RD53Shared::fromInt2Str(runNumber));
if(whichCalib != "") fileName += "_" + whichCalib;
fileName += ".log";
el::Configurations conf(std::string(std::getenv("PH2ACF_BASE_DIR")) + "/settings/logger.conf");
conf.set(el::Level::Global, el::ConfigurationType::Format, "|%thread|%levshort| %msg");
conf.set(el::Level::Global, el::ConfigurationType::Filename, fileName);
el::Loggers::reconfigureAllLoggers(conf);
// el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Filename, fileName);
// ######################
// # Supervisor section #
// ######################
......@@ -182,7 +187,7 @@ int main(int argc, char** argv)
else if(runControllerPid == 0)
{
char* argv[] = {(char*)"RunController", NULL};
execv((std::string(getenv("PH2ACF_BASE_DIR")) + "/bin/RunController").c_str(), argv);
execv((std::string(std::getenv("PH2ACF_BASE_DIR")) + "/bin/RunController").c_str(), argv);
LOG(ERROR) << BOLDRED << "I can't run RunController, error occured" << RESET;
exit(EXIT_FAILURE);
}
......@@ -309,11 +314,6 @@ int main(int argc, char** argv)
LOG(INFO) << BOLDMAGENTA << "@@@ Initializing the Hardware @@@" << RESET;
mySysCntr.Configure(configFile);
LOG(INFO) << BOLDMAGENTA << "@@@ Hardware initialization done @@@" << RESET;
if(program == true)
{
LOG(INFO) << BOLDMAGENTA << "@@@ End of CMSIT miniDAQ @@@" << RESET;
exit(EXIT_SUCCESS);
}
}
std::cout << std::endl;
......@@ -602,7 +602,7 @@ int main(int argc, char** argv)
mySysCntr.fReadoutChipInterface->WriteChipReg(static_cast<RD53*>(cChip), "SER_SEL_OUT", 1, true);
}
}
else
else if(program == false)
{
LOG(ERROR) << BOLDRED << "Option not recognized: " << BOLDYELLOW << whichCalib << RESET;
exit(EXIT_FAILURE);
......
......@@ -217,11 +217,11 @@ void ClockDelay::draw()
histos->book(fResultFile, *fDetectorContainer, fSettingsMap);
ClockDelay::fillHisto();
histos->process();
this->WriteRootFile();
this->CloseResultFile();
if(doDisplay == true) myApp->Run(true);
this->CloseResultFile();
#endif
}
......
......@@ -209,14 +209,11 @@ void Gain::draw(bool saveData)
histos->book(fResultFile, *fDetectorContainer, fSettingsMap);
Gain::fillHisto();
histos->process();
if(saveData == true)
{
this->WriteRootFile();
this->CloseResultFile();
}
if(saveData == true) this->WriteRootFile();
if(doDisplay == true) myApp->Run(true);
if(saveData == true) this->CloseResultFile();
#endif
// #####################
......
......@@ -166,11 +166,11 @@ void GainOptimization::draw()
histos->book(fResultFile, *fDetectorContainer, fSettingsMap);
GainOptimization::fillHisto();
histos->process();
this->WriteRootFile();
this->CloseResultFile();
if(doDisplay == true) myApp->Run(true);
this->CloseResultFile();
#endif
}
......
......@@ -215,11 +215,11 @@ void InjectionDelay::draw()
histos->book(fResultFile, *fDetectorContainer, fSettingsMap);
InjectionDelay::fillHisto();
histos->process();
this->WriteRootFile();
this->CloseResultFile();
if(doDisplay == true) myApp->Run(true);
this->CloseResultFile();
#endif
}
......
......@@ -150,11 +150,11 @@ void Latency::draw(bool saveData)
histos->book(fResultFile, *fDetectorContainer, fSettingsMap);
Latency::fillHisto();
histos->process();
this->WriteRootFile();
this->CloseResultFile();
if(doDisplay == true) myApp->Run(true);
this->CloseResultFile();
#endif
}
......
......@@ -174,11 +174,11 @@ void Physics::draw()
histos->book(fResultFile, *fDetectorContainer, fSettingsMap);
Physics::fillHisto();
histos->process();
this->WriteRootFile();
this->CloseResultFile();
if(doDisplay == true) myApp->Run(true);
this->CloseResultFile();
#endif
}
......
......@@ -183,14 +183,11 @@ void PixelAlive::draw(bool saveData)
histos->book(fResultFile, *fDetectorContainer, fSettingsMap);
PixelAlive::fillHisto();
histos->process();
if(saveData == true)
{
this->WriteRootFile();
this->CloseResultFile();
}
if(saveData == true) this->WriteRootFile();
if(doDisplay == true) myApp->Run(true);
if(saveData == true) this->CloseResultFile();
#endif
}
......
......@@ -206,11 +206,11 @@ void SCurve::draw()
histos->book(fResultFile, *fDetectorContainer, fSettingsMap);
SCurve::fillHisto();
histos->process();
this->WriteRootFile();
this->CloseResultFile();
if(doDisplay == true) myApp->Run(true);
this->CloseResultFile();
#endif
// #####################
......
......@@ -166,9 +166,10 @@ void ThrAdjustment::draw()
PixelAlive::draw(false);
this->WriteRootFile();
this->CloseResultFile();
if(doDisplay == true) myApp->Run(true);
this->CloseResultFile();
#endif
}
......
......@@ -211,9 +211,10 @@ void ThrEqualization::draw()
PixelAlive::draw(false);
this->WriteRootFile();
this->CloseResultFile();
if(doDisplay == true) myApp->Run(true);
this->CloseResultFile();
#endif
}
......
......@@ -164,9 +164,10 @@ void ThrMinimization::draw()
PixelAlive::draw(false);
this->WriteRootFile();
this->CloseResultFile();
if(doDisplay == true) myApp->Run(true);
this->CloseResultFile();
#endif
}