Python
AnalyseThat.py
Go to the documentation of this file.
1 import ROOT,os,sys,getopt
2 import rootUtils as ut
3 import shipunit as u
4 import numpy as n
5 from ShipGeoConfig import ConfigRegistry
6 chi2CutOff = 4.
7 PDG = ROOT.TDatabasePDG.Instance()
8 inputFile = None
9 geoFile = None
10 dy = None
11 nEvents = 99999
12 fiducialCut = False
13 measCut = 25
14 
15 try:
16  opts, args = getopt.getopt(sys.argv[1:], "n:f:g:A:Y:i", ["nEvents=","geoFile="])
17 except getopt.GetoptError:
18  # print help information and exit:
19  print ' enter file name'
20  sys.exit()
21 for o, a in opts:
22  if o in ("-f"):
23  inputFile = a
24  if o in ("-g", "--geoFile"):
25  geoFile = a
26  if o in ("-Y"):
27  dy = float(a)
28  if o in ("-n", "--nEvents="):
29  nEvents = int(a)
30 
31 if not dy:
32  # try to extract from input file name
33  tmp = inputFile.split('.')
34  try:
35  dy = float( tmp[1]+'.'+tmp[2] )
36  except:
37  dy = None
38 else:
39  inputFile = 'ship.'+str(dy)+'.Pythia8-TGeant4_rec.root'
40 
41 if not geoFile:
42  geoFile = inputFile.replace('ship.','geofile_full.').replace('_rec.','.')
43 
44 f = ROOT.TFile(inputFile)
45 sTree = f.cbmsim
46 
47 
48 
49 from LoopAnalyse import LoopAnalyse
50 la = LoopAnalyse(sTree, dy, geoFile, debug=0,
51  plotField = False,
52  plotTracking = False,
53  plotVertex = True,
54  plotVertexDetailed = False,
55  plotMomentum = True,
56  compareFits = True)
57 la.Loop(nEvents)