INSTITUTE OF HIGH ENERGY PHYSICS

Slides:



Advertisements
Similar presentations
1 StringBuffer & StringTokenizer Classes Chapter 5 - Other String Classes.
Advertisements

Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
James Tam Simple File Input And Output Types of Java Files Simple File Output in Java Simple File Input in Java.
James Tam Exception handling in Java Java Exception Handling Dealing with errors using Java’s exception handling mechanism.
James Tam Simple file handling in Java Simple File Input And Output Types of Java files Simple file output in Java Simple file input in Java.
 We can use a combination of the File and FileOutputStream to write a series of bytes to a file.
James Tam Simple File Input And Output Types of Java Files Simple File Output in Java Simple File Input in Java.
Java Review 2. The Agenda The following topics were highlighted to me as issues: –File IO (Rem) –Wrappers (Rem) –Interfaces (Rem) –Asymptotic Notation.
Performance measurements for inter-process communication.
Java Programming: I/O1 Java I/O Reference: java.sun.com/docs/books/tutorial/essential/io/
Java File I/O (Continued). File I/O in Java Like every other programming language, Java supports the writing to and reading from different files with.
Prepared by : A.Alzubair Hassan Kassala university Dept. Computer Science Lecture 2 I/O Streams 1.
Java I18n and Unicode JaxJug lightning talk 4/15/09.
2D-Arrays Quratulain. Learning Objectives Two-dimensional arrays Declaration Initialization Applications.
Exceptions CSC 171 FALL 2004 LECTURE 24. READING Read Horstmann Chapter 14 This course covered Horstmann Chapters
File IO Basics By Dan Fleck Coming up: Data Streams.
The IR lattice design and optimization of the dynamic aperture for the ring Yiwei Wang, Huiping Geng, Yuan Zhang, Sha Bai, Dou Wang, Tianjian, Jie Gao.
 Learn about computer files  Use the Path class  Learn about  Streams  Buffers  file organization  Use Java’s IO classes to write to and read from.
Networking Code CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Simple Java I/O Part I General Principles. Streams All modern I/O is stream-based A stream is a connection to a source of data or to a destination for.
CEPC Interaction Region design and Dynamic Aperture Optimization Yiwei Wang, Yuan Zhang, Dou Wang, Huiping Geng, Xiaohao Cui, Sha Bai, Tianjian Bian, Feng.
CEPC DA due to magnets' error Sha Bai, Dengjie Xiao, Yiwei Wang, Huiping Geng, Dou Wang, Tianjian Bian, Feng Su, Jie Gao The first IHEP-BINP CEPC Accelerator.
Reading Parameters CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D.
INSTITUTE OF HIGH ENERGY PHYSICS
CEPC parameter choice and partial double ring design
Interaction region design for the partial double ring scheme
CSE 341, S. Tanimoto Java networking-
100km CEPC parameter and lattice design
RADE new features via JAVA
Sha Bai CEPC AP meeting Local double ring MDI Sha Bai CEPC AP meeting
Optimization of CEPC Dynamic Aperture
CS Week 11 Jim Williams, PhD.
CEPC Partial Double Ring Lattice Design and DA Study
הרצאה 12: קבצים וחריגות (Exceptions)
CEPC Partial Double Ring Lattice Design and DA Study
CEPC Partial Double Ring Lattice Design and DA Study
Exercise 11.1 Write a code fragment that performs the same function as the statement below without using the crash method Toolbox.crash(amount < 0,
DA study for CEPC Main Ring
Text File Read and Write Method
CEPC partial double ring scheme and crab-waist parameters
CEPC parameter optimization and lattice design
Interaction region design for the partial double ring scheme
CEPC partial double ring scheme and crab-waist parameters
CEPC main ring magnets’ error effect on DA and MDI issues
Adapter Pattern Context:
class PrintOnetoTen { public static void main(String args[]) {
CEPC APDR and PDR scheme
CEPC partial double ring FFS design
CEPC advanced partial double ring scheme
CEPC partial double ring FFS design
Optics Design of the CEPC Interaction Region
Design study of CEPC Alternating Magnetic Field Booster
CEPC DA optimization with downhill Simplex
Sadalage & Fowler (Amazon)
CEPC Partial Double Ring Lattice Design and DA Study
CEPC Partial Double Ring Lattice Design and DA Study
CEPC Partial Double Ring Lattice Design and DA Study
Sawtooth effect in CEPC PDR
Optimization of partial double ring optics
Update of DA Study for the CEPC Partial Double Ring Scheme
CEPC Partial Double Ring Lattice Design and DA Study
CEPC parameter and DA optimization
CEPC Partial Double Ring Parameter Update
Lattice design for double ring scheme of CEPC main ring
Sawtooth effect in CEPC APDR
Lattice design for CEPC
CEPC APDR and PDR scheme
CEPC Parameter /DA optimization with downhill Simplex
INSTITUTE OF HIGH ENERGY PHYSICS
Presentation transcript:

INSTITUTE OF HIGH ENERGY PHYSICS 中国科学院高能物理研究所 INSTITUTE OF HIGH ENERGY PHYSICS Program for sorting the magnet Dengjie Xiao Jie Gao Sha Bai Dou Wang Yiwei Wang Tianjian Bian Feng Su Huiping Geng CEPC AP meeting, 2016.03.25

The instrument for the program 1. Mathematica 9 2. Eclipse+Java

The code in Mathematica 9 ClearAll["`*"] SetDirectory[NotebookDirectory[]]; t = Import["./cepc.txt", "Words"]; Import["./cepc.txt", "Elements"] a = VS22FFS_RN; b = B0; c = B2; d = B3; e = B4; f = B5; g = QDF; h = QDH; m = QDHFFS; n = SD; j = 1; For[i = 1, i <= 15381, i++, y = ToString[a] <> ToString[j] <> ","; If[t[[i]] == a, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == a, j++, 0]]; Export["cepc.txt", Table[x[i], {i, 1, 15381}]]; y = ToString[b] <> ToString[j] <> ","; If[t[[i]] == b, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == b, j++, 0]]; y = ToString[c] <> ToString[j] <> ","; If[t[[i]] == c, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == c, j++, 0]]; y = ToString[d] <> ToString[j] <> ","; If[t[[i]] == d, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == d, j++, 0]]; Export["cepc.txt", Table[x[i], {i, 1, 15381}]]; j = 1; For[i = 1, i <= 15381, i++, y = ToString[e] <> ToString[j] <> ","; If[t[[i]] == e, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == e, j++, 0]]; y = ToString[f] <> ToString[j] <> ","; If[t[[i]] == f, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == f, j++, 0]]; y = ToString[g] <> ToString[j] <> ","; If[t[[i]] == g, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == g, j++, 0]]; y = ToString[h] <> ToString[j] <> ","; If[t[[i]] == h, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == h, j++, 0]]; y = ToString[m] <> ToString[j] <> ","; If[t[[i]] == m, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == m, j++, 0]]; y = ToString[n] <> ToString[j] <> ","; If[t[[i]] == n, x[i] = y, x[i] = t[[i]]]; If[t[[i]] == n, j++, 0]];

Result

Problem 1.需要手动输入每个磁铁名称,过程繁琐。 2.失去原来的转行标记,不方便查阅lattice。 3.步骤较多,仍需大量时间去编号,且容易出错。

The code in JAVA import java.io.File; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; //import java.io.FileNotFoundException; //import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class ChangeFile { public static void main(String[] argv) { try { BufferedReader bufReader = new BufferedReader( new InputStreamReader( new FileInputStream( new File("D:/123.txt")))); StringBuffer strBuf = new StringBuffer(); int cnt=1; for (String tmp = null; (tmp = bufReader.readLine()) != null; tmp = null) { int pos=0; while ((pos = tmp.indexOf("B0", pos)) >= 0) { tmp = tmp.substring(0, pos) + ("B0" + (cnt++)) + tmp.substring((pos += "B0".length())); }// 在这里做替换操作 tmp = tmp.replaceAll("\\*", "#"); tmp = tmp.replaceFirst("===", "\\* "); tmp = tmp.replaceAll("===", ""); tmp = tmp.replaceAll("==", "==="); strBuf.append(tmp); strBuf.append(System.getProperty("line.separator")); } bufReader.close(); PrintWriter printWriter = new PrintWriter("D:/123.txt"); printWriter.write(strBuf.toString().toCharArray()); printWriter.flush(); printWriter.close(); } catch (IOException e) { e.printStackTrace();

Result

Summary 原先lattice磁铁的命名规则不是很好, 对编号过程产生了麻烦,以后可以在 允许的条件下先改磁铁命名再编号。 编号过程了解了两种工具,对接下来 做madx扫孔径的程序也很有帮助。

Thanks!