public HistoHelper(ref Mu2e_FEB_client febClient, ushort accumulation_interval = 0xFFF, bool ext_mode = false) { this.febClient = febClient; this.accumulation_interval = accumulation_interval; Ext_mode = (ext_mode) ? (byte)0x10 : (byte)0x0;//if the mode is set to be qualified by an external gate, turn on the mode bit for the histo control register histo_controls = new Mu2e_Register[base_controls.Length]; }
static void Main() { FEB1Histo = new List <HISTO_curve>(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //myRun = new Run(); FEB1 = new Mu2e_FEB_client(); FEB1.name = "FEB1"; FEB1.host_name_prop = "172.16.10.10"; FEB2 = new Mu2e_FEB_client(); FEB2.name = "FEB2"; FEB2.host_name_prop = "DCRC3.fnal.gov"; //FEC = new Mu2e_FECC_client(); WC = new WC_client(); WC.name = "WC"; WC.host_name_prop = "FTBFWC03"; DAQ_server myDAQ_server = new DAQ_server(); myDAQ_server.StartRC(); myMain = new frmMain(); Application.Run(myMain); }
static void Main() { FEB1Histo = new List <HISTO_curve>(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //myRun = new Run(); FEB1 = new Mu2e_FEB_client(); FEB1.name = "FEB1"; //FEB1.host_name_prop = "128.143.196.217"; FEB1.host_name_prop = "131.225.52.177"; FEB2 = new Mu2e_FEB_client(); FEB2.name = "FEB2"; FEB2.host_name_prop = "DCRC5"; //FEC = new Mu2e_FECC_client(); /* For Mu2E Remove extra stuff */ WC = new WC_client(); WC.name = "WC"; WC.host_name_prop = "FTBFWC01.FNAL.GOV"; DAQ_server myDAQ_server = new DAQ_server(); // Does not appear to get used, DAQ_server doesn't even grab an IpEnd myDAQ_server.StartRC(); myMain = new frmMain(); Application.Run(myMain); }
static void Main() { FEB1Histo = new List <HISTO_curve>(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //myRun = new Run(); FEB1 = new Mu2e_FEB_client(); FEB1.name = "FEB1"; //FEB1.host_name_prop = "131.225.52.181"; //FEB1.host_name_prop = "128.143.196.218"; FEB1.host_name_prop = "128.143.196.54"; //FEB1.host_name_prop = "131.225.52.177"; FEB2 = new Mu2e_FEB_client(); FEB2.name = "FEB2"; FEB2.host_name_prop = "DCRC5"; //FEC = new Mu2e_FECC_client(); WC = new WC_client(); WC.name = "WC"; WC.host_name_prop = "FTBFWC01.FNAL.GOV"; DAQ_server myDAQ_server = new DAQ_server(); myDAQ_server.StartRC(); myMain = new frmMain(); Application.Run(myMain); }
//To just read trace data from the FEB and work only in memory, returns true if able to parse, false if not public static bool ReadFeb(ref Mu2e_FEB_client feb, ref SpillData spill, out long lret) { source_name = feb.name; if (feb.TNETSocket.Available > 0) { byte[] junk = new byte[feb.TNETSocket.Available]; feb.stream.Read(junk, 0, feb.TNETSocket.Available); } lret = 0; byte[] mem_buff; byte[] b = PP.GetBytes("RDB 1\r\n"); //get the spill header (and 1 word) & reset read pointers byte[] hdr_buf = new byte[18]; long spillwrdcnt = 0; //spill word count will be the total spill count for the FEB (which means BOTH FPGAs) feb.TNETSocket.Send(b); Thread.Sleep(10); if (feb.TNETSocket.Available > 0) //if we can snag the wordcount from the spill header, then we know how much we should be reading { feb.TNETSocket.Receive(hdr_buf); spillwrdcnt = (hdr_buf[0] * 256 * 256 * 256 + //spillwrdcnt is how many words there are for ALL fpgas in a given spill hdr_buf[1] * 256 * 256 + hdr_buf[2] * 256 + hdr_buf[3]); mem_buff = new byte[spillwrdcnt * 2]; //each word = 2 bytes, we are going to allocate a buffer in memory to read the FEB data into that is the correct size. int bytesread = 0; int bytesleft = (int)spillwrdcnt * 2; try { b = PP.GetBytes("RDB\r\n"); feb.TNETSocket.Send(b); Thread.Sleep(10); do { int bytes_now = feb.stream.Read(mem_buff, bytesread, feb.TNETSocket.Available); bytesread += bytes_now; bytesleft -= bytes_now; Thread.Sleep(100); } while (feb.stream.DataAvailable); lret = bytesread; } catch (System.IO.IOException) { feb.Close(); //IO exception thrown if socket was forcibly closed by FEB, so lets tell the C# FEB client it is closed } //something went wrong skip spill spill = new SpillData(); bool parse_ok = spill.ParseInput(mem_buff); return(parse_ok); } else { return(false); } }
public HistoHelper(ref Mu2e_FEB_client febClient, ushort accumulation_interval = 0xFFF, bool ext_mode = false) { this.febClient = febClient; this.accumulation_interval = accumulation_interval; Ext_mode = (ext_mode) ? (byte)0x10 : (byte)0x0; //if the mode is set to be qualified by an external gate, turn on the mode bit for the histo control register histo_controls = new Mu2e_Register[base_addrs.Length]; //(base_addrs.Length * 4) - 4]; //*4 for the 4 fpgas, -4 because 0x311 is a broadcast to all fpga histo control registers write_regs = new Mu2e_Register[write_addrs.Length]; GetRegisters(); }
static void Main() { FEB1Histo = new List <HISTO_curve>(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //myRun = new Run(); FEB1 = new Mu2e_FEB_client { name = "FEB1", //host_name_prop = "131.225.52.181"; //host_name_prop = "128.143.196.218"; host_name_prop = "128.143.196.58" //host_name_prop = "131.225.52.177"; //host_name_prop = "crvfeb01.fnal.gov" //host_name_prop = "131.225.176.32" //host_name_prop = "131.225.52.182" }; //FEB2 = new Mu2e_FEB_client //{ // name = "FEB2", // //host_name_prop = "DCRC5"; // host_name_prop = "crvfeb02.fnal.gov" // //host_name_prop = "131.225.176.34" // //host_name_prop = "131.225.52.181" //}; //FEC = new Mu2e_FECC_client(); //WC = new WC_client() //{ // host_name_prop = "FTBFWC01.FNAL.GOV", // name = "WC" //}; //DAQ_server myDAQ_server = new DAQ_server(); //myDAQ_server.StartRC(); myMain = new frmMain(); Application.Run(myMain); }
//To save trace data (from test beam spills) to file public static void ReadFeb(ref Mu2e_FEB_client feb, /*TcpClient feb_client Socket feb_socket,*/ out long lret) //out List<byte> buf, { lret = 0; //Socket feb_socket = feb.TNETSocket; //NetworkStream feb_stream = feb.stream; source_name = feb.name; //PP.myMain.SpillTimer.Enabled = false; //PP.myRun.ACTIVE = false; //Halt the status queries to the boards (single socket atm, so we cannot get data and status concurrently) if (feb.TNETSocket.Available > 0) { byte[] junk = new byte[feb.TNETSocket.Available]; feb.stream.Read(junk, 0, feb.TNETSocket.Available); } time_start = DateTime.Now; byte[] mem_buff; byte[] b = PP.GetBytes("RDB 1\r\n"); //get the spill header (and 1 word) & reset read pointers byte[] hdr_buf = new byte[18]; long spillwrdcnt = 0; //spill word count will be the total spill count for the FEB (which means BOTH FPGAs) feb.TNETSocket.Send(b); Thread.Sleep(50); if (feb.TNETSocket.Available > 0) //if we can snag the wordcount from the spill header, then we know how much we should be reading { PP.myRun.READING = true; Console.WriteLine("+ READ"); feb.TNETSocket.Receive(hdr_buf); spillwrdcnt = (hdr_buf[0] * 256 * 256 * 256 + //spillwrdcnt is how many words there are for ALL fpgas in a given spill hdr_buf[1] * 256 * 256 + hdr_buf[2] * 256 + hdr_buf[3]); mem_buff = new byte[spillwrdcnt * 2]; //each word = 2 bytes, we are going to allocate a buffer in memory to read the FEB data into that is the correct size. int bytesread = 0; int bytesleft = (int)spillwrdcnt * 2; try { b = PP.GetBytes("RDB\r\n"); feb.TNETSocket.Send(b); Thread.Sleep(100); int readattempts = 0; do { int bytes_now = feb.stream.Read(mem_buff, bytesread, feb.TNETSocket.Available); bytesread += bytes_now; bytesleft -= bytes_now; if (bytes_now == 0) { readattempts++; } else { readattempts = 0; } Console.WriteLine(" READ " + readattempts); //Console.WriteLine(source_name + " got " + bytesread + " / " + spillwrdcnt * 2); Thread.Sleep(100); } while (feb.stream.DataAvailable || (bytesleft > 0 && readattempts < 3)); lret = bytesread; } catch (System.IO.IOException) { PP.myRun.UpdateStatus(feb.name + " took too long to respond, continuing."); } //something went wrong skip spill TimeSpan elapsed = DateTime.Now.Subtract(time_start); PP.myRun.UpdateStatus(source_name + " read: " + bytesread.ToString() + " bytes out of " + (spillwrdcnt * 2).ToString() + " bytes in " + elapsed.TotalMilliseconds + " ms"); time_read_done = DateTime.Now; PP.myRun.READING = false; Console.WriteLine("- READ"); if (PP.myRun.validateParse) { SpillData new_spill = new SpillData(); bool parse_ok = new_spill.ParseInput(mem_buff); if (parse_ok) { if (PP.myRun != null) { if (PP.myRun.SaveAscii) { Thread save = new Thread(() => Save(new_spill)); save.Start(); } else { string savename = feb.name; Thread save = new Thread(() => Save(mem_buff, savename)); //Spawn a thread that will take care of writing the data to file save.Start(); } } } else //if it fails to parse, don't bother trying to save the spill, but notify the user { System.Console.WriteLine(source_name + " failed to parse! Skipping save!"); //PP.myRun.UpdateStatus(source_name + " failed to parse! Skipping save!"); } } else { if (PP.myRun != null) { if (PP.myRun.SaveAscii) { SpillData new_spill = new SpillData(); bool parse_ok = new_spill.ParseInput(mem_buff); Thread save = new Thread(() => Save(new_spill)); save.Start(); } else { string savename = feb.name; Thread save = new Thread(() => Save(mem_buff, savename)); //Spawn a thread that will take care of writing the data to file save.Start(); } } } } ////SpillData new_spill = new SpillData(); ////bool parse_ok = new_spill.ParseInput(mem_buff/*sock_buf*/); //if (true)//(parse_ok) //{ // //PP.myRun.Spills.AddLast(new_spill); // //if (PP.myRun.Spills.Count > 2) // //{ // // if (PP.myRun.Spills.First.Value.IsDisplayed) { PP.myRun.Spills.Remove(PP.myRun.Spills.First.Next); } // // else { PP.myRun.Spills.RemoveFirst(); } // //} //} //else //{ } //PP.myMain.SpillTimer.Enabled = true; }
public void ChangeClient(Mu2e_FEB_client feb_client) { feb = feb_client; }
public CurrentMeasurements(Mu2e_FEB_client feb_client, string _filename) { feb = feb_client; filename = _filename; currentMeasurements = new ConcurrentDictionary <int, double>(); }