Skip to content
Dennis Klein edited this page Feb 9, 2017 · 6 revisions

Getting Started

3. Data analysis

The FairRunAna class allows data analysis in the FairRoot. The input to the FairRunAna class is usually a root file with the tree (named “cbmsim”) that contains events with arrays of data to be analyzed. The input file is given to FairRoot by function: SetInputFile(TString file0Name). More input files with the same data structure can be added using AddFile(fileNName). Files with parallel input data may be added using AddFriend(parallelNName). The output of the data analysis is typically a root file with the output tree (named “cbmsim”) that contains events with arrays of analysed data. The process of the data analysis is performed by lists of user defined tasks, that derive from general FairTask. Each task works on a specified piece of data and usually produces one array of data. Each task may contain subtask(s). The output data from any task may be used by subsequent tasks and/or stored in the output file. Many (if not all) of the tasks need access to the parameters containers. This access is provided by the member of the FairRunAna, the object of FairRuntimeDb class.

Alt text

Few examples of input/output file combination:

  • simplest one with one input and one output:
fRunAna->SetInputFile(“file0”);
fRunAna->SetOutput(“output0”);
  • chain many input files with AddFile(). The events will be analysed from one file after another (file1, file2, and so on if more). The output file will contain as many events as the sum of events in all input files:
fRunAna->SetInputFile(“file1”);
fRunAna->AddFile(“file2”);
fRunAna->SetOutput(“output1”);
  • add friends to input file chain. Each friend file is checked against the folder structure of the existing friend chains. If the structure matches, the friend file is added to the matching friend chain. If the structure of the new friend file is not matching any friend chain, another friend chain is created:
fRunAna->SetInputFile(“file0”);
fRunAna->AddFile(“file1”);
fRunAna->AddFile(“file2”);
fRunAna->AddFriend(“output0”);
fRunAna->AddFriend(“output1”);
fRunAna->SetOutput(“finalOut”);
  • it is possible to analyse all or only some part of the input events with:
fRunAna->Run(firstEventToAnalyze,lastEventToAnalyze) 
fRunAna->Run(eventNumberToAnalyze);

but

fRunAna->Run(0,0); 

will analyse all events in input

  • if different sources of input has been simulated and have to be analysed together (f.e. background and signal have been generated separately and have to be mixed to obtain realistic results), FairRunAna may RunMixed(). The input is set:
fRunAna->SetBackgroundFile(“background_a”);
fRunAna->AddBackgroundFile(“background_b”);
fRunAna->SetSignalFile(“signal1_a”,1);
fRunAna->AddSignalFile(“signal1_b”,1);
fRunAna->SetSignalFile(“signal2_a”,2);
fRunAna->AddSignalFile(“signal2_b”,2);
fRunAna->SetOutput(“outputMixed”);
  • when mixing inputs from different sources, one should use:
fRunAna->RunMixed(firstEventToAnalyze,lastEventToAnalyze)

↪ Next step: [4. Time based simulation](Time based simulation)