std::string NetworkInterfaceASIO::_getDiagnosticString_inlock(AsyncOp* currentOp) { str::stream output; std::vector<TableRow> rows; output << "\nNetworkInterfaceASIO Operations' Diagnostic:\n"; rows.push_back({"Operation:", "Count:"}); rows.push_back({"Connecting", std::to_string(_inGetConnection.size())}); rows.push_back({"In Progress", std::to_string(_inProgress.size())}); rows.push_back({"Succeeded", std::to_string(getNumSucceededOps())}); rows.push_back({"Canceled", std::to_string(getNumCanceledOps())}); rows.push_back({"Failed", std::to_string(getNumFailedOps())}); rows.push_back({"Timed Out", std::to_string(getNumTimedOutOps())}); output << toTable(rows); if (_inProgress.size() > 0) { rows.clear(); rows.push_back(AsyncOp::kFieldLabels); // Push AsyncOps for (auto&& kv : _inProgress) { auto row = kv.first->getStringFields(); if (currentOp) { // If this is the AsyncOp we blew up on, mark with an asterisk if (*currentOp == *(kv.first)) { row[0] = "*"; } } rows.push_back(row); } // Format as a table output << "\n" << toTable(rows); } output << "\n"; return output; }
/*! * \brief Create new table item if it doesn't exist or existent one * * \param[in] ipSchemaName - Schema name * \param[in] ipTableName - Table name * \param[in] ipMenu - Context menu for new item * \param[in] ipPos - Position of new item * * \return Existent or new table item */ TableItem * GraphicsScene::newTableItem(const QString &ipSchemaName, const QString &ipTableName, QMenu *ipMenu, const QPoint &ipPos) { DbObjectItem *newItem = findItem(ipSchemaName, ipTableName); // if item is currently not on scene if (!toTable(newItem)) { newItem = 0; // try to find it in registered items QSet<DbObjectItem*>::const_iterator iter = mDbItems.constBegin(); while (0 == newItem && iter != mDbItems.constEnd()) { if (ipTableName == (*iter)->name() && ipSchemaName == (*iter)->schemaName()) { newItem = *iter; break; } ++iter; } // if found - just move to the given position (if position is correct) if (newItem) { if (ipPos.x() > 0 && ipPos.y() > 0) { newItem->setX(ipPos.x()); newItem->setY(ipPos.y()); newItem->adjustSize(); } // if not found } else { // create new table newItem = new TableItem(ipSchemaName, ipTableName, ipMenu, ipPos); // register this item mDbItems.insert(newItem); } } return toTable(newItem); }
int main(int argc, char ** argv) { QApplication app{argc, argv}; double const table[] { 78.0, 78.0, 78.0, 0.0, 0.0, 78.0, 69.0, 56.0, 0.0}; QTextEdit edit; setHtml(&edit, toTable(std::begin(table), std::end(table), 3, [](double arg){ return QString::number(arg, 'f', 1); }, "width=\"100%\"")); edit.setReadOnly(true); edit.show(); return app.exec(); }
void Table_Mazur(TString folder, TString Run="123456", TString tag="All"){ TCut M2 = "candM2>1"; if(tag.Contains("All")) basic += ee; else if(tag=="afterBestB") basic = ""; else if(tag.Contains("Mva")) basic += Mva; if(tag.Contains("M2")) basic += M2; // Loading files int nFiles = 0; TChain ch("ntp1"); TString directory = "AWG82/ntuples/"; directory += folder; TString filename = "AWG82/ntuples/small/Add_Truth30Rest_Run123456.root"; cout<<"Using "<<filename<<endl; ch.Add(filename); // for(int i=1; i<7; i++){ // TString irun = ""; irun += i; // if(Run.Contains(irun)){ // TString dirs = "/MergedRest/*Run"; dirs += irun; dirs+="*"; // filename=directory; // filename += dirs; // nFiles += ch.Add(filename); // cout<<"Added "<<nFiles<<" files from "<<filename<<" with entries: "<<ch.GetEntries()<<endl; // } // } TString taFile = "mycode/Mazurtables/tableM_"; taFile += folder; taFile += tag; taFile += ".txt"; fstream Table; Table.open(taFile,fstream::out); fstream tex; tex.open("mycode/Mazurtables/texM_"+folder+tag+".txt",fstream::out); TString otherTag = "M14"; int DYields[] = {133,8,2848,99,104,69,0}; int MYields[] = {135,16,2798,72,97,35,44}; TString TaNames[]={"D*0 Tau","D0 Tau","D*0 l","D0 l","D** l","Cross","Comb.","D*0"}; TString TeNames[]={"D^{*0} \\,\\tau \\,\\nu & ","D^{0} \\,\\tau \\,\\nu & ","D^{*0} \\,l \\,\\nu & ", "D^{0} \\,l \\,\\nu & ","D^{**} \\,l \\,\\nu & ","Crossfeed & ","Comb. & ","D^{*0}"}; TCut cuts[]={"MCType==6","MCType==5","(MCType==2||MCType==4)","(MCType==1||MCType==3)", "(MCType==13||MCType==14)","((MCType>6&&MCType<13))","(MCType==0)"}; toTable(2, ch, DYields, MYields, TaNames, TeNames, cuts, Table, tex, basic, folder, otherTag); int DYields2[] = {110,155,3875,1186,346,163,0}; int MYields2[] = {142,153,3010,1143,270,93,94}; TString TaNames2[]={"D0 Tau","D*0 Tau","D*0 l","D0 l","D** l","Cross","Comb.","D0"}; TString TeNames2[]={"D^{0} \\,\\tau \\,\\nu & ","D^{*0} \\,\\tau \\,\\nu & ","D^{*0} \\,l \\,\\nu & ", "D^{0} \\,l \\,\\nu & ","D^{**} \\,l \\,\\nu & ","Crossfeed & ","Comb. & ","D^{0}"}; TCut cuts2[]={"MCType==5","MCType==6","(MCType==2||MCType==4)","(MCType==1||MCType==3)", "(MCType==13||MCType==14)","((MCType>6&&MCType<13))","(MCType==0)"}; toTable(1, ch, DYields2, MYields2, TaNames2, TeNames2, cuts2, Table, tex, basic, folder, otherTag); int DYields3[] = {87,1,1866,9,92,65,0}; int MYields3[] = {92,4,1695,5,50,2,27}; TString TaNames3[]={"D*+ Tau","D+ Tau","D*+ l","D+ l","D** l","Cross","Comb.","D*+"}; TString TeNames3[]={"D^{*+} \\,\\tau \\,\\nu & ","D^{+} \\,\\tau \\,\\nu & ","D^{*+} \\,l \\,\\nu & ", "D^{+} \\,l \\,\\nu & ","D^{**} \\,l \\,\\nu & ","Crossfeed & ","Comb. & ","D^{*+}"}; TCut cuts3[]={"MCType==12","MCType==11","(MCType==8||MCType==10)","(MCType==7||MCType==9)", "(MCType==13||MCType==14)","(MCType>0&&MCType<7)","(MCType==0)"}; toTable(4, ch, DYields3, MYields3, TaNames3, TeNames3, cuts3, Table, tex, basic, folder, otherTag); int DYields4[] = {46,14,448,401,93,63,0}; int MYields4[] = {43,22,380,427,34,9,31}; TString TaNames4[]={"D+ Tau","D*+ Tau","D*+ l","D+ l","D** l","Cross","Comb.","D+"}; TString TeNames4[]={"D^{+} \\,\\tau \\,\\nu & ","D^{*+} \\,\\tau \\,\\nu & ","D^{*+} \\,l \\,\\nu & ", "D^{+} \\,l \\,\\nu & ","D^{**} \\,l \\,\\nu & ","Crossfeed & ","Comb. & ","D^{+}"}; TCut cuts4[]={"MCType==11","MCType==12","(MCType==8||MCType==10)","(MCType==7||MCType==9)", "(MCType==13||MCType==14)","(MCType>0&&MCType<7)","(MCType==0)"}; toTable(3, ch, DYields4, MYields4, TaNames4, TeNames4, cuts4, Table, tex, basic, folder, otherTag); cout<<taFile<<" written"<<endl; }