CommentWindow::CommentWindow(QWidget *parent, ModelVideo model) :PostureWindow(parent) { m_mvModel.m_sDate = model.m_sDate; m_mvModel.m_sDescribe = model.m_sDescribe; m_mvModel.m_sDirectory = model.m_sDirectory; m_mvModel.m_sOutLine = model.m_sOutLine; m_mvModel.m_sPublisher = model.m_sPublisher; m_mvModel.m_sVideoID = model.m_sVideoID; m_mvModel.m_vCommendsName = model.m_vCommendsName; m_mvModel.m_vComments = model.m_vComments; m_mvModel.m_sFavor = model.m_sFavor; m_mvModel.m_sMode = model.m_sMode; m_iCurrPage = 0; InitWidgets(); BuildBottomRight(); BuildConnections(); }
DisplayWindow::DisplayWindow(QWidget *parent,ModelVideo model) :PostureWindow(parent) { m_mvModel.m_sDate = model.m_sDate; m_mvModel.m_sDescribe = model.m_sDescribe; m_mvModel.m_sDirectory = model.m_sDirectory; m_mvModel.m_sOutLine = model.m_sOutLine; m_mvModel.m_sPublisher = model.m_sPublisher; m_mvModel.m_sVideoID = model.m_sVideoID; m_mvModel.m_vCommendsName = model.m_vCommendsName; m_mvModel.m_vComments = model.m_vComments; m_mvModel.m_sFavor = model.m_sFavor; m_mvModel.m_sMode = model.m_sMode; m_qmbMsg = new QMessageBox(this); m_qmbMsg->setObjectName("msg"); m_qmbMsg->hide(); BuildBottomRight(); BuildConnections(); BuildMessage(); }
// copy constructor // it does not only copy the members, but also copy the connections between the // members PRadHyCalSystem::PRadHyCalSystem(const PRadHyCalSystem &that) : ConfigObject(that), hycal(nullptr), cal_period(that.cal_period) { // copy detector if(that.hycal) { hycal = new PRadHyCalDetector(*that.hycal); hycal->SetSystem(this, true); } // copy histogram energy_hist = new TH1D(*that.energy_hist); // copy reconstruction method for(auto &it : that.recon_map) { recon_map[it.first] = it.second->Clone(); } SetClusterMethod(that.GetClusterMethodName()); // copy tdc for(auto tdc : that.tdc_list) { AddTDCChannel(new PRadTDCChannel(*tdc)); } // copy adc for(auto adc : that.adc_list) { PRadADCChannel *new_adc = new PRadADCChannel(*adc); AddADCChannel(new_adc); // copy the connections between adc and tdc if(!adc->GetTDC()) continue; PRadTDCChannel *tdc = GetTDCChannel(adc->GetTDC()->GetName()); tdc->ConnectChannel(new_adc); } // build connections between adc channels and modules BuildConnections(); }
// read DAQ channel list void PRadHyCalSystem::ReadChannelList(const std::string &path) { if(path.empty()) return; ConfigParser c_parser; // set special splitter c_parser.SetSplitters(",: \t"); if(!c_parser.ReadFile(path)) { std::cerr << "PRad HyCal System Error: Failed to read channel list file " << "\"" << path << "\"." << std::endl; return; } // we accept 2 types of channels // tdc, adc std::vector<std::string> types = {"TDC", "ADC"}; // tdc args: name crate slot channel // adc args: name crate slot channel tdc std::vector<int> expect_args = {4, 4}; std::vector<int> option_args = {0, 1}; // this vector is to store all the following arguments std::vector<std::vector<ConfigValue>> ch_args[types.size()]; // read all the elements in while(c_parser.ParseLine()) { std::string type = c_parser.TakeFirst(); size_t i = 0; for(; i < types.size(); ++i) { if(ConfigParser::strcmp_case_insensitive(type, types.at(i))) { // only save elements from expected format if(c_parser.CheckElements(expect_args.at(i), option_args.at(i))) ch_args[i].push_back(c_parser.TakeAll<std::vector>()); break; } } if(i >= types.size()) { // did not find any type std::cout << "PRad HyCal System Warning: Undefined channel type " << type << " in channel list file " << "\"" << path << "\"" << std::endl; } } // create TDC first, since it will be needed by ADC channels for(auto &args : ch_args[0]) { std::string name(args[0]); ChannelAddress addr(args[1].UInt(), args[2].UInt(), args[3].UInt()); PRadTDCChannel *new_tdc = new PRadTDCChannel(name, addr); if(!AddTDCChannel(new_tdc)) // failed to add tdc delete new_tdc; } // create ADC channels, and add them to TDC groups for(auto &args : ch_args[1]) { std::string name(args[0]); ChannelAddress addr(args[1].UInt(), args[2].UInt(), args[3].UInt()); PRadADCChannel *new_adc = new PRadADCChannel(name, addr); if(!AddADCChannel(new_adc)) { // failed to add adc delete new_adc; continue; } // no tdc group specified if(args.size() < 5) continue; // add this adc to tdc group std::string tdc_name(args[4]); // this adc has no tdc connection if(ConfigParser::strcmp_case_insensitive(tdc_name, "NONE") || ConfigParser::strcmp_case_insensitive(tdc_name, "N/A")) continue; PRadTDCChannel *tdc = GetTDCChannel(tdc_name); if(tdc) { tdc->ConnectChannel(new_adc); } else { std::cout << "PRad HyCal System Warning: ADC Channel " << name << " belongs to TDC Group " << tdc_name << ", but the TDC Channel does not exist in the system." << std::endl; } } // build connection between modules and channels BuildConnections(); }