コード例 #1
0
        //build jet from normalized csv scan of jet. x and r normalized to 1
        private void BuildJet(string csvFilename)
        {
            var stringArr = CSVFileParser.ParseFile(csvFilename);
            //x,mrr csvfilename
            int headerRowCount = 1;
            int rowCount       = stringArr.GetLength(0);
            int colCount       = stringArr.GetLength(1);

            mrrList = new List <Tuple <double, double> >();
            for (int i = headerRowCount; i < rowCount; i++)
            {
                double x = 0;

                double mrr = 0;
                if (double.TryParse(stringArr[i, 0], out x) && double.TryParse(stringArr[i, 1], out mrr))
                {
                    mrrList.Add(new Tuple <double, double>(x, mrr));
                }
            }
        }
コード例 #2
0
ファイル: XSection.cs プロジェクト: 1907931256/MasterProject
        public List <Vector2> ParseFile(string scanFilename, double minYValue, double maxYValue)
        {
            var stringArr  = CSVFileParser.ParseFile(scanFilename);
            var vectorList = new List <Vector2>();

            for (int i = 0; i < stringArr.GetLength(0); i++)
            {
                double x = 0;
                double y = maxYValue * 2;
                if (double.TryParse(stringArr[i, 0], out x) && double.TryParse(stringArr[i, 1], out y))
                {
                    if (y >= minYValue && y <= maxYValue)
                    {
                        var v = new Vector2(x, y);
                        vectorList.Add(v);
                    }
                }
            }
            return(vectorList);
        }