Logo ROOT   6.21/01
Reference Guide
run_h1analysis.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_tree
3 /// \notebook -nodraw
4 /// Macro driving the analysis can specify file name and type
5 ///
6 /// .- type == 0 : normal
7 /// - type = 1 : use AClic to compile selector
8 /// - type = 2 : use a fill list and then process the fill list///
9 ///
10 /// \macro_code
11 ///
12 /// \author
13 
14 //----------------------------------------
15 
16 void run_h1analysis(int type = 0, const char * h1dir = 0) {
17 
18  std::cout << "Run h1 analysis " << std::endl;
19 
20  // create first the chain with all the files
21 
22  TChain chain("h42");
23 
24  if (h1dir) {
25  gSystem->Setenv("H1",h1dir);
26  }
27  else
28  gSystem->Setenv("H1","http://root.cern.ch/files/h1/");
29 
30 
31  std::cout << "Creating the chain" << std::endl;
32 
33  chain.SetCacheSize(20*1024*1024);
34  chain.Add("$H1/dstarmb.root");
35  chain.Add("$H1/dstarp1a.root");
36  chain.Add("$H1/dstarp1b.root");
37  chain.Add("$H1/dstarp2.root");
38 
39  TString selectionMacro = gSystem->GetDirName(__FILE__) + "/h1analysis.C";
40 
41  if (type == 0)
42  chain.Process(selectionMacro);
43  else if (type == 1) {
44  // use AClic ( add a + at the end
45  selectionMacro += "+";
46  chain.Process(selectionMacro);
47  }
48  else if (type == 2) {
49  chain.Process(selectionMacro,"fillList");
50  chain.Process(selectionMacro,"useList");
51  }
52 }
53 
54 
55 
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
Definition: TSystem.cxx:1015
Basic string class.
Definition: TString.h:131
virtual void Setenv(const char *name, const char *value)
Set environment variable.
Definition: TSystem.cxx:1630
R__EXTERN TSystem * gSystem
Definition: TSystem.h:557
int type
Definition: TGX11.cxx:120
A chain is a collection of files containing TTree objects.
Definition: TChain.h:34