オンライン解析用チュートリアル
artemisを使ってオンライン解析などをする際に必要な設定などをまとめておきます。
この記事ではartemisを使ったことのないユーザーに向けて、ひとまず解析できるようになり、各検出器で取得したデータの相関を確認できるようになるまでを目標にします。
解析用ディレクトリの整備・拡張方法や解析用のyamlファイルの作り方はおいておきます。
SSHクライアント用の設定ファイルの設定
artemisではVNCを使って解析サーバーのデスクトップ画面を表示させています。
毎回sshのコマンドを打ち込んでも良いのですが、一番手っ取り早いのは.ssh/config
に以下を追加することです。
host analysis_server
hostname analysis_server_name
user username
LocalForward 15901 analysis_server_name:5901
analysis_server_name
に解析サーバーの名前またはIPアドレスを書き、使用する解析環境が入っているユーザー名をusername
に書きます。(実験課題番号がユーザー名になっていることは多い気がします。)
また5091
と15901
も意味がある数字です。
前者は解析サーバーに立てるVNCサーバーのポート番号です。
後述しますがVNCサーバーの番号+5900の値を記入する必要があります。
後者は自分のPC側のポート番号です。
VNC viewerなどで画面を映す時に使います。
自分のPCから直接解析サーバーにアクセスできる場合は上記の記述だけで問題ないのですが、そうでない場合もよくあるような気がします。その場合はログインサーバーなどを経由した多段sshをする必要があります。その場合は以下のように書きます。
Host login_server
user username2
hostname login_server_name
host analysis_server
ProxyCommand ssh username@login_server_name -Y nc %h %p
hostname analysis_server_name
user username
LocalForward 15901 analysis_server_name:5901
VNCサーバーの建て方
tree->Draw()
などを使ってオンラインで解析する場合ははあらかじめVNCサーバーをたてる必要があります。
解析を行うサーバー内で以下のコマンドを実行しVNCサーバーを立てます。
vncserver :1 -geometry 900x900
コロンの後の番号はVNCディスプレイ番号に対応している。また-geometry XXXxYYY
をつけることでディスプレイの大きさを指定できます。
使用中の番号は指定できません。vncserver -list
で使用されているディスプレイ番号を確認してみてください。
無事VNCサーバーを建てたら自分のPCからアクセスします。Real VNCやTiger VNCなどのVNCビュワーをインストールし、起動します。
アクセス先に以下のようにして接続すればOK。
localhost:15901
解析ディレクトリの整備
実験開始時には解析ディレクトリの整備するコマンドやシェルスクリプトが用意されているはずです。
ひとまず解析サーバーで自分用の解析ディレクトリを作成するコマンドを実行します。
artlogin "user name"
実行すると以下のメッセージが生じされ、新しく解析用ディレクトリを生成するか聞かれるのでy
を入力します。
$ artlogin famichiki
artlogin
directory existence is checked
user 'famichiki' not found.
create new user? (y/n):
続いて名前とメールアドレスを聞かれるので、順番に入力していきます。
$ artlogin famichiki
artlogin
directory existence is checked
user 'famichiki' not found.
create new user? (y/n): y
Cloning into '/home/e585/art_analysis/user/famichiki'...
done.
input fullname: famichiki
OK? (y/n): y
input email address: famichiki
OK? (y/n): y
以下のディレクトリに移動できて入れば、解析用ディレクトリの作成ができています。
user at server in ~/art_analysis/user/famichiki (main)
次に以下のコマンドを実行し、前章で建てたVNCサーバーの値を設定してあげます。
echo 1 > .vncdisplay
ディスプレイ番号が1番でない場合は自分が建てた番号を入力してください。
最後に個々の実験ごとに生データの場所在処やパラメータファイル、アウトプットファイルの出力場所などのシンボリックリンクを貼ってあげれば完成です。
上記で紹介したコマンドの多くはartemisを使った解析サーバー用に作成したものであり、事前に誰かが設定してくれています。ここではその詳細は説明しません。一応リストしておくと~/.zshrc
や~/art_analysis/.artlogin.sh
、~/art_analysis/user/"user name"/setbldprm.sh
など
解析を行う
まずa
でartemisを起動します。
$ a
Registering art::TStreamingModuleDecoderLRTDC
Registering art::TStreamingModuleDecoderHRTDC
Registering art::TStreamingModuleDecoderLRTDC64
Use mass table inside root since Art.MassTable is not defined in .rootrc
Created art::TStreamingModuleDecoderHRTDC with decoder ID 2
Created art::TStreamingModuleDecoderLRTDC with decoder ID 1
Created art::TStreamingModuleDecoderLRTDC64 with decoder ID 3
artemis [0]
artemis起動後はadd
コマンドを使ってyamlファイルを登録して、res
で解析を開始します。
yamlファイルの名前や引数などは実験ごとに異なります。
下記に実行例を示します。
$ a
Registering art::TStreamingModuleDecoderLRTDC
Registering art::TStreamingModuleDecoderHRTDC
Registering art::TStreamingModuleDecoderLRTDC64
Use mass table inside root since Art.MassTable is not defined in .rootrc
Created art::TStreamingModuleDecoderHRTDC with decoder ID 2
Created art::TStreamingModuleDecoderLRTDC with decoder ID 1
Created art::TStreamingModuleDecoderLRTDC64 with decoder ID 3
artemis [0] add steering/chkstrone.yaml NUM=000486 IDX=00 DIR=tdcdata
timer
Info in <art::TStreamingEventStore::Register>: OutputData
Info in <art::TStreamingEventStore::Register>: OutputInfo
Info in <art::TStreamingEventStore::Register>: OutputData
MyTStreamingEventStore
mapper
Info in <art::TRawDataMappingProcessor::Register>: InputData
Info in <art::TRawDataMappingProcessor::Register>: OutputData
...
Info in <art::TTreeProjection::Sync>: synchronizing
Info in <art::TTreeProjection::Sync>: synchronizing group
Info in <art::TTreeProjectionProcessor::InitProc>: Done
Info in <art::TOutputTreeProcessor::InitProc>: Initilizing ...
Info in <art::TOutputTreeProcessor::InitProc>: Done
Info in <TCatCmdLoopAdd::Cmd>: replacement is given
artemis [1] res
artemis [2] resuming
Info in <art::TStreamingEventStore::Open>: DataSource with /home/e585/art_analysis/user/shift/./rawdata/tdcdata/00/run000486.dat is preapred
==============================
HeaderSize = 760432192
RunNumber = 486
Start = 1690489160
Stop = 0
Comments:
FileSinkHeader.h test
==============================
解析したデータの相関を描画する
上記でadd
したyamlファイルの中ではあらかじめ検出器の相関を確認できるヒストグラムが定義できます。
ls
で定義したヒストグラムのリストを確認でき、cd
でディレクトリを移動できます。
そして、ht
コマンドで定義したヒストグラムを描画できます。
下記に1例を示します。
artemis [2] ls
artemis
> 0 TDirectoryFile experimental experimental
1 art::TAnalysisInfo analysisInfo
artemis [3] cd 0
artemis [4] ls
experimental
> 0 TDirectoryFile hpla_str plastic (str)
1 TDirectoryFile hpla_att plastic (att)
2 TDirectoryFile vdc vdc
3 TDirectoryFile phys physics
artemis [5] cd 3
artemis [6] ls
phys
> 0 TH2F pid pid
1 TH2F hAX_cQx1Qx2Qps1 A vs X (|qave-50|<10 && |ps1q-80|<10)
2 TH2F hAX_cQx1Qx2Qps1 A vs X (|qave-50|<10 && |ps1q-80|<10)
3 TH1F hX_cQx1Qx2Qps1 X (|qave-50|<10 && |ps1q-80|<10)
artemis [7] ht 0 colz
TTreeを使って相関を描画する
定義していない相関を見たくなる時もあると思います。
その場合はTTree
のあるディレクトリに移動すればOKです。
いかに1例を示します。
artemis [7] sus
artemis [8] Info in <art::TTimerProcessor::PostLoop>: real = 7.33, cpu = 7.31 sec, total 9027 events, rate 1234.88 evts/sec
artemis [9] fls
files
0 TFile output/tdcdata/run000486.tree.root (CREATE)
artemis [10] fcd 0
artemis [11] .ls
TFile** output/tdcdata/run000486.tree.root
TFile* output/tdcdata/run000486.tree.root
OBJ: art::TAnalysisInfo analysisInfo : 0 at: 0x6f751f0
OBJ: art::TArtTree tree tree : 0 at: 0x715a5d0
KEY: TProcessID ProcessID0;1 06a3da78-2e03-11ee-b092-3602a8c0beef
KEY: art::TArtTree tree;1 tree
KEY: art::TAnalysisInfo analysisInfo;1
artemis [12] zone
artemis [13] tree->Draw("ps1q:qave>>(100,0,100,150,0,150)", "", "colz")
TTree
を使った解析をする際はsus
で解析を一時停止しないとセグフォしてしまいます。
ブランチ名がわからない時はbr
で確認できる。またbr "branch_name"
でメンバ関数あメンバ変数のリストも確認できる。ただし、このコマンドもsus
して、解析を一時中断してから実行しないとセグフォしてしまいます。