Revision 23 as of 2012-04-28 15:57:28

Clear message
Locked History Actions

ANAROOT/Manual/analoop

Abstract of AnaLoop

AnaLoop(Exact class name is TArtAnaLoop) is a abstract class to control flow of analysis. Developer can make a class inherit TArtAnaLoop and required to implement 4 functions, Construct(), Calculate(), Destruct(), and ClassName(). Maybe it's easier to understand to look source code like TAlDALIExample.cc and .hh.

Construct()

This function is for construct like TArtCalibNEBULA, namely "new TArtCalibNEBULA". Constructing like TH1 is better to do in global book function (override it), but this is not essential and construct TH1 in Construct() is ok. You can find example of this in TArtAnaLoopUser.C.

Calculate()

This function will be called every event loop, so write only one step.

Destruct()

Just delete object which you create in Construct(). This part is important when you book twice or more at one root session.

ClassName()

This function only exists to show name of current AnaLoop class in status().

2 usage of AnaLoop

built-in to library

Create TArtAnaLoop derived class in $TARTSYS/source/AnaLoop/include and src. This suit to user whom you want to provide as black box.

create macro in your analysis directory and load dynamically

You can load same code as built-in one in ROOT session.

root[i] .L macros/TArtAnaLoopUser.C+

With "+" at end of line, ROOT will compile macro so you can use native C++ grammar (.x is execute command, so it's not proper). This suit to user who wants to edit frequently or familiar to ROOT and use TH1.

Special TArtAnaLoop derived class "TAlEncExample"

In TAlEncExample, register class inherits TAlEncSub and analysis each EncSub derived class in order of registration. This make us able to use <analys> and <stop> command in AnaFile. Registering manually, do as follows.

root[i] TAlEncExample* alencexample = new TAlEncExample;
root[i] alencexample->Register(new TAlEncSAMURAIExample);
root[i] alencexample->Register(new TAlEncDALIExample);
root[i] alencexample->Register(new TAlEncNEBULAExample);
root[i] book(alencexample);
root[i] push("ridf/sm_com/sdaq02/run0140.ridf");
root[i] start();

If you are using AnaFile, <analys> command will register automatically.

# hoge.ana
<analys> 0,15,12,

Command in ROOT session is normal,

root[i] book(new TAlEncExample, "hoge.ana");
root[i] push("ridf/sm_com/sdaq02/run0140.ridf");
root[i] start();

built-in your own TAlEncSub class

Create class inherits TAlEncSub and register by your self. Pleas look TAlEncUser.C and TAlEncUser.hh for example. Then by following commands,

root[i] .L macros/analoop/TAlEncUser.C+
root[i] book(new TAlEncExample, "ana/hoge.ana")
root[i] push("ridf/run0140.ridf")
root[i] start()

analysis will start. In above example, registering is done inside statical class construction (but this is tricky), so you don't need to do manually.

anapaw: val[1][0] = auraw -> anaroot: Add(1, 0, auraw)

Use Add function instead of directly input to val. In ANAROOT, you don't need to Add anything if there is nodata. If you want to fill like over flow of TDC, it doesn't matter but performance will decrease.

EAnalyser and EWNum

EAnalyserとEWNumはAnaFileでIDで物理量を指定するための列挙体。

src/source/AnaLoop/include/EAnalyser.hh
src/source/AnaLoop/include/EWNum.hh

に書く。 わかりやすいように定義の後ろに数字を書いているが、 現在はroot上で

root[i] lv();

と打てば見れるので書かなくてもいい。 ただし、C++の文法に完全に対応した処理をしているわけではないのである程度EAnalyser.hhとEWNum.hhの書き方は限られる。