V

bricklayerbelchedInternet and Web Development

Feb 5, 2013 (4 years and 6 months ago)

196 views

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

1


Using ROOT for Large Data
Analysis in J
-
PARC MR

Shuei YAMADA

KEK / J
-
PARC

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

2

Contents

J
-
PARC

Data size in J
-
PARC MR

Introduction of ROOT

ROOT in J
-
PARC MR

Conclusion

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

3

J
-
PARC

©google

Hadron

Physics

Facility

LINAC

180MeV/c

RCS

3GeV/c

25Hz

Main Ring

30GeV/c

3 sec (FX) or 6 sec (SX)

In operation since 2008

Materials and

Life Science

Facility

Neutrino Facility

Pacific ocean

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

4

Data Size in J
-
PARC MR :
400GB/week

Operation of MR and data taking started in 2008

MR cycle : 3 sec (FX), 6 sec (SX)

Record all waveform data each cycle

As many waveform as possible

3
-
50BT BPM

MR Injection Error Monitor

MR BPM

MR DCCT

SX Spill

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

5

Introduction of ROOT

Object
-
Oriented data analysis framework

Developed by CERN


http://root.cern.ch

Cross platform; UNIX/Linux, OSX,


Windows 7/Vista/XP/2000

Collection of classes for:


Data container


2D & 3D Graphics and plotting


Fitting


Mathematical functions


Matrix algebra


GUI widgets


...

User interact with ROOT via:

GUI

C++ Interpreter (CLI)

Macro

Application

Python / Ruby

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

6

ROOT example

Starting ROOT


%

root

The ROOT prompt


root[]

log(5)


root[]

int I = 3


root[]

printf(“%d
\
n”, i)

Command history


-

Scans thru arrow keys




-

Search with

CTRL
-
R

Completion


root[]

new TH1D(<tab>


TH1D TH1D()


TH1D TH1D(const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t
xhigh)


...

Aborting wrong input


root[]

printf(“%d
\
n, i)


end with ‘;’, ‘@’: abort>@

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

7

ROOT macro
(script)

A macro is a C++ function

Running a macro


root[]

.x sample.C


$

root sample.C

Compiled macro


root[]

.x sample.C+

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

8

ROOT Application : DCCT

Intensity (100kS/s)

Acceleration pattern

2

0

4

6

8

10

X 10
13

protons

Kinetic energy [GeV/c]

Time [sec]

0

0.5

1

1.5

2

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

9

ROOT in J
-
PARC MR

ROOT
-
based


data acquisition tool :
cadump

Collects data from

EPICS
-
records each MR cycle

Save as ROOT
-
file

ROOT
-
file

Self describing


-

Definition of data classes
written in file

Backward and forward
compatible


-

Files created in 2010 should be
readable in 2020

Data analysis using ROOT

storage

EPICS record

trigger

Offline Analysis

Online Monitor

cadump

EPICS record

EPICS record

ROOT
-
file

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

10

Mapping EPICS
-
record

to ROOT data class

Data class for EPICS record

Derived from TObject, the base
class of classes in ROOT

Designed to be general

Naive copy of EPICS record


-

VAL field is copied into array of
double

Interpretation of Value is up to
analysis software

class TChannel :
public TObject

{

protected:


Int_t fStatus; // STAT


Int_t fSeverity; // SEVR


time_t fSec;


long fNsec;


UInt_t fType;


ULong_t fCount; // NELM


TArrayD* fValue; // VAL

public:


TChannel();


~TChannel();




2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

11

Tree Structured Data

ROOT file

TTree

Run #

Shot #

MR cycle

# of bunches

DCCT sampling freq

DCCT waveform

...

TTree class



ROOT’s main container for
data storage



It can store any class and
basic types (e.g. Double_t)

Each leaf
corresponds to
EPICS
-
record

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

12

Data file Organization

Data file can be retrieved by:


Date:

..../2011/03/10/12/MRDCCT/MRDCCT_Run38_Shot0
001234.root


run# & shot#:

..../run/run00038/shot0001xxx/MRDCCT/MRDCCT_R
un38_Shot0001234.root

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

13

Example : MR BPM


X
-
position [mm]

MR Orbit data

1.4MB / shot (186ch x
1000samples)

1
-
sec storage mode @ 3GeV

Orbit changes over time

Cause of variation might be
identified by Singular Value
Decomposition (SVD)

TDecopostion class in ROOT

injection

extraction

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

14

Singular Value Decomposition

The Singular Value Decomposition of an
m x n

matrix M is:



M = U x
S

x V
*


Where

-

U
and
V
:
m x m

and
n x n

unitary matrix

-

S

:
m x n

diagonal matrix


Diagonal entries of
S

are nonnegative and known as singular
values


2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

15

Application of SVD to Orbit data


































185
1
0
185
1
0
185
1
0
0
0
v
v
v
s
s
s
u
u
u
M



BPM data

(time vs. position)

u
i

: time
-
component

Relative intensity of i
-
th
component

s
0

>= s
1

>= … s
185

>= 0

v
i

: orbital component

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

16

Most Significant Component

Dump Septum

Injection Septum

Dump Septum excitation

Injection Septum excitation

v
0
:orbit

u
0
:time variation

Error source

time [ms]

0

1000

position

position

Frequency [Hz]

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

17

2
nd

most significant component

v
1
: orbit

u
1
: time variation

Error Source

Arc
-
A

Arc
-
B

Arc
-
C



BM?

Frequency Component

Ripple of BM power supply

time [ms]

Frequency [Hz]

0

1000

0

1000

position

position

Arc
-
A

Arc
-
B

Arc
-
C

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

18

Summary

J
-
PARC MR started operation and data taking in 2008

Its data size about 400 GB/week

ROOT is adopted to acquiring, storing and analyzing
large
-
sized EPICS waveform data

ROOT is very useful and powerful tool for analysis

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration
Meeting 2011 Spring @ NSRRC

19

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

20

Example : MR Orbit Data

Waveform record (669,600 elements)


186 ch * 3600 samples

5.1MB / shot

Orbit evolving over time

Time of Injection

3.6sec

X [mm]

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

21

Example : Orbit of MR


RMS of X
COD [mm]

RMS of X
COD [mm]

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

22


After Symmetrical Wiring of

B/Q Magnets

Ripple disappeared



effect of symmetrization
was confirmed

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

23

Tune Analysis Software


2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

24

Orbit oscillating at the beginning of
Acceleration

X
COD
RMS [mm]

Injection

Smoothing

(parabolic)

Acceleration

Dispersion subtracted

Raw COD

80Hz, 0.1mm

2011 Jun 13
-
17

Shuei YAMADA, EPICS Collaboration Meeting 2011 Spring @ NSRRC

25

Separation of Orbit Components
and Estimate of Error Source


Time variation

Error source

Frequency component

BM6

1/6 of MR
Dispersion shape

Ripple was observed in current
deviation at the beginning of
acceleration (BM6)

Orbital variation