ana.py
Go to the documentation of this file.
1 #!/bin/env python
2 
3 import sys
4 from decay import Decay
5 from ancestor import Ancestor
6 from tgtexit import Tgtexit
7 from nuray import Nuray
8 from vdbl import Vdbl
9 from ROOT import TChain, TFile
10 
11 def load_Dk2Nu():
12  from ROOT import gSystem, gInterpreter
13  gSystem.Load("libCintex.so")
14  from ROOT import Cintex
15  Cintex.Enable()
16  gSystem.Load("$DK2NUDATA_LIB/libdk2nuTree.so")
17  return
18 
19 def process_list(fname, root_name):
20  print "=> inputs to process_list: ", fname, root_name
21  root_file = TFile(root_name, "RECREATE")
22  load_Dk2Nu()
23  detector = ["random", "minosnd", "novand", "minosfd", "novafd"]
24  hist_decay = []
25  hist_ancestor = []
26  hist_tgtexit = []
27  hist_nuray = []
28  hist_vdbl = []
29  for idet in range(len(detector)):
30  hist_decay.append(Decay(root_file, detector[idet]))
31  hist_ancestor.append(Ancestor(root_file, detector[idet]))
32  hist_tgtexit.append(Tgtexit( root_file, detector[idet]))
33  hist_nuray.append(Nuray( root_file, detector[idet]))
34  hist_vdbl.append(Vdbl( root_file, detector[idet]))
35 
36  with open(fname, 'r') as flist:
37  tchain = TChain('dk2nuTree')
38  i = 0
39  for iline in flist:
40  ifile = iline.strip()
41  print "=> fileIn : ",ifile
42  tchain.Add(ifile)
43  tn = tchain.GetEntries()
44  tn_0_1 = tn/20
45  print "=> entries: ",tn
46  for entry in tchain:
47  for idet in range(len(detector)):
48  hist_decay[idet].fill(entry)
49  hist_ancestor[idet].fill(entry)
50  hist_tgtexit[idet].fill(entry)
51  hist_nuray[idet].fill(entry)
52  hist_vdbl[idet].fill(entry)
53  i += 1
54  if i % tn_0_1==0:
55  print round(100 * float(i) /float(tn)),"% of total events"
56  for idet in range(len(detector)):
57  hist_decay[idet].save(root_file)
58  hist_ancestor[idet].save(root_file)
59  hist_tgtexit[idet].save(root_file)
60  hist_nuray[idet].save(root_file)
61  hist_vdbl[idet].save(root_file)
62  root_file.Close()
63  return
64 
def load_Dk2Nu()
Definition: ana.py:11
def process_list(fname, root_name)
Definition: ana.py:19
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
void save(bool IsData, bool Bad)
Definition: cellShifts.C:453
procfile open("FD_BRL_v0.txt")
void fill(std::vector< T > &x, const S &y)
Definition: fill.hpp:22