Commit in scripts/trunk on MAIN
makeTTreeFromTxtFile.C+21added 44
run_twoTrk.py+213added 44
+234
2 added files
Initial commit

scripts/trunk
makeTTreeFromTxtFile.C added at 44
--- scripts/trunk/makeTTreeFromTxtFile.C	                        (rev 0)
+++ scripts/trunk/makeTTreeFromTxtFile.C	2013-11-27 05:09:17 UTC (rev 44)
@@ -0,0 +1,21 @@
+void makeTTreeFromTxtFile(const char* txtfile="../../reco/run/twotrackAnlysisTuple.txt") {
+
+  TString file = gSystem->BaseName(txtfile);
+  TString outfile(file);
+  outfile.ReplaceAll(".txt",".root");
+  TString dir = txtfile;
+  dir.ReplaceAll(file,"");
+  if(dir.Length()==0) dir = "./";
+  cout << "Input file: " << file << endl;
+  cout << "Output file: " << outfile << endl;
+  cout << "output dir: " << dir << endl;
+  
+  TFile* f = new TFile(TString::Format("%s/%s",dir.Data(),outfile.Data()),"RECREATE");
+  TTree* T = new TTree("tree","data from ascii file");
+  Long64_t nline = T->ReadFile(txtfile,"",' ');
+  cout << "Read " << nline << " lines" << endl;
+  T->Write();
+  if(f->IsOpen()) f->Close();
+  
+
+}

scripts/trunk
run_twoTrk.py added at 44
--- scripts/trunk/run_twoTrk.py	                        (rev 0)
+++ scripts/trunk/run_twoTrk.py	2013-11-27 05:09:17 UTC (rev 44)
@@ -0,0 +1,213 @@
+#!/usr/bin/python
+
+import os,sys,glob
+
+
+test = True
+pat = []
+notpat = []
+for w in range(1,len(sys.argv)):
+    if not sys.argv[w]=='run':
+        if '!' in sys.argv[w]:
+            notpat.append(sys.argv[w].replace('!',''))
+        else:
+            pat.append(sys.argv[w])
+
+
+for w in sys.argv:
+    if w=='run':
+        test = False
+
+
+if test:
+    print 'TESTING'
+else:
+    print 'RUNNING'
+print 'pattern \"',pat,'\"'
+print 'no pattern \"',notpat,'\"'
+
+
+cmd = []
+steering =  'steering/users/phansson/TwoTrackAnalysis.lcsim'
+conv_script = 'scripts/makeTTreeFromTxtFile.C'
+jar = 'target/hps-java-1.8-SNAPSHOT-bin.jar'
+tag = '_%s' % os.path.splitext(os.path.basename(jar))[0]
+
+
+################################# twotrkfilt #################################
+
+
+path = '../data/mc/HPS-TestRun-v5/1.8-SNAPSHOT-gauss-101013'
+run = 1351
+infiles = glob.glob('%s/pairs*0.016x0*gauss*twotrkfilt*slcio' % path)
+outfile = 'twotrackAnlysisTuple_gauss_v5_0.016x0_500mb_90na_%dfiles_twotrkfilt%s.txt' % (len(infiles),tag)
+fstr = ''
+for f in infiles:
+    fstr = fstr + ' -i ' + f
+cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=true' % (jar,steering,fstr,run,outfile))
+cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+path = '/nfs/slac/g/hps2/hps_data/simulation/testrun/HPS-TestRun-v5/1.8-SNAPSHOT-recoil-101013'
+run = 1351
+infiles = glob.glob('%s/egs*0.016x0*recoil*readout*slcio' % path)
+outfile = 'twotrackAnlysisTuple_recoil_readout_v5_notrkcuts_0.016x0_500mb_90na_%dfiles%s.txt' % (len(infiles),tag)
+fstr = ''
+for f in infiles:
+    fstr = fstr + ' -i ' + f
+cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=true' % (jar,steering,fstr,run,outfile))
+cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+path = '../data/mc/HPS-TestRun-v5/1.8-SNAPSHOT-recoil-101013'
+run = 1351
+infiles = glob.glob('%s/egs*0.016x0*recoil*twotrkfilt*slcio' % path)
+outfile = 'twotrackAnlysisTuple_recoil_v5_0.016x0_500mb_90na_%dfiles_twotrkfilt%s.txt' % (len(infiles),tag)
+fstr = ''
+for f in infiles:
+    fstr = fstr + ' -i ' + f
+cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=true' % (jar,steering,fstr,run,outfile))
+cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+
+
+path = '../data/mc/HPS-TestRun-v6/1.8-SNAPSHOT-recoil-102413'
+run = 1351
+infiles = glob.glob('%s/egs*0.016x0*recoil*twotrkfilt*slcio' % path)
+outfile = 'twotrackAnlysisTuple_recoil_v6_0.016x0_500mb_90na_%dfiles_twotrkfilt%s.txt' % (len(infiles),tag)
+fstr = ''
+for f in infiles:
+    fstr = fstr + ' -i ' + f
+cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=true' % (jar,steering,fstr,run,outfile))
+cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+path = '../data/data/lcio/HPS-TestRun-v5/101613'
+for run in [1351,1353,1354]:
+    infiles = glob.glob('%s/hps_00%d.evio.*_recon_twotrkfilt.slcio' % (path, run) )
+    outfile = 'twotrackAnlysisTuple_pair%s_twotrkfilt%s.txt' % (run,tag)
+    fstr = ''
+    for f in infiles:
+        fstr = fstr + ' -i ' + f
+    cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=false' % (jar,steering,fstr,run,outfile))
+    cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+path = '../data/data/lcio/HPS-TestRun-v6/102413'
+for run in [1351,1353,1354,1358]:
+    infiles = glob.glob('%s/hps_00%d.evio.*_recon_twotrkfilt.slcio' % (path, run) )
+    outfile = 'twotrackAnlysisTuple_pair%s_v6_twotrkfilt%s.txt' % (run,tag)
+    fstr = ''
+    for f in infiles:
+        fstr = fstr + ' -i ' + f
+    cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=false' % (jar,steering,fstr,run,outfile))
+    cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+
+
+
+################################# single #################################
+
+
+#../data/mc/HPS-TestRun-v6/1.8-SNAPSHOT-default-102413'
+path = '/nfs/slac/g/hps2/hps_data/simulation/testrun/HPS-TestRun-v6'
+run = 1351
+infiles = glob.glob('%s/egs*0.016x0*readout*slcio' % path)
+outfile = 'twotrackAnlysisTuple_default_readout_v6_notrkcuts_0.016x0_500mb_90na_%dfiles%s.txt' % (len(infiles),tag)
+fstr = ''
+for f in infiles:
+    fstr = fstr + ' -i ' + f
+cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=true' % (jar,steering,fstr,run,outfile))
+cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+
+
+
+path = '../data/mc/HPS-TestRun-v6/1.8-SNAPSHOT-default-102413'
+run = 1351
+infiles = glob.glob('%s/g4*0.016x0*readout*slcio' % path)
+outfile = 'twotrackAnlysisTuple_default_readout_v6_g4_0.016x0_500mb_90na_%dfiles%s.txt' % (len(infiles),tag)
+fstr = ''
+for f in infiles:
+    fstr = fstr + ' -i ' + f
+cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=true' % (jar,steering,fstr,run,outfile))
+cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+
+
+path = '../data/mc/HPS-TestRun-v6/1.8-SNAPSHOT-recoil-102413'
+run = 1351
+infiles = glob.glob('%s/egs*0.016x0*recoil_readout*slcio' % path)
+outfile = 'twotrackAnlysisTuple_recoil_readout_v6_0.016x0_500mb_90na_%dfiles%s.txt' % (len(infiles),tag)
+fstr = ''
+for f in infiles:
+    fstr = fstr + ' -i ' + f
+cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=true' % (jar,steering,fstr,run,outfile))
+cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+
+
+
+
+path = '/nfs/slac/g/hps2/hps_data/simulation/testrun/HPS-TestRun-v5/1.8-SNAPSHOT-default-111213'
+for run in [1351]:
+	t = ''
+	b = ''
+	if run==1351:
+		t = '0.016'
+		b= '500mb_90na'
+	elif run==1353:
+		t = '0.0018'
+		b= '2bb_90na'
+	elif run==1354:
+		t = '0.0045'
+		b = '2bb_90na'
+	else:
+		print 'error'
+		sys.exit(1)
+	str = '%s/egs*%s*%s*readout*slcio' % (path,t,b)
+	infiles = glob.glob('%s/egs*%s*%s*readout*slcio' % (path,t,b))
+	outfile = 'twotrackAnlysisTuple_default_readout_v5_%sx0_%s_%dfiles%s.txt' % (t,b,len(infiles),tag)
+	fstr = ''
+	for f in infiles:
+		fstr = fstr + ' -i ' + f
+	cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=true' % (jar,steering,fstr,run,outfile))
+	cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+	#print 'hej ', outfile, str
+
+
+
+
+
+#path = '../data/data/lcio/HPS-TestRun-v5/101613'
+path = '/nfs/slac/g/hps2/hps_data/data/lcio/HPS-TestRun-v5/101613'
+for run in []:
+    infiles = glob.glob('%s/hps_00%d.evio.*_recon.slcio' % (path, run) )
+    outfile = 'twotrackAnlysisTuple_%s_recon_v5%s.txt' % (run,tag)
+    fstr = ''
+    for f in infiles:
+        fstr = fstr + ' -i ' + f
+    cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=false' % (jar,steering,fstr,run,outfile))
+    cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+path = '/nfs/slac/g/hps2/hps_data/data/lcio/HPS-TestRun-v6/102413'
+for run in [1351,1358]:
+    infiles = glob.glob('%s/hps_00%d.evio.*_recon.slcio' % (path, run) )
+    outfile = 'twotrackAnlysisTuple_%s_recon_v6_notrkcuts%s.txt' % (run,tag)
+    fstr = ''
+    for f in infiles:
+        fstr = fstr + ' -i ' + f
+    cmd.append('java -jar %s %s %s -DrunNumber=%d -DoutputFile=%s -DisMC=false' % (jar,steering,fstr,run,outfile))
+    cmd.append('root -l -q %s\(\\"%s\\"\)'%(conv_script,outfile))
+
+
+
+for c in cmd:
+    ok = True
+    for w in pat:
+        if not w in c:
+            ok = False
+    for w in notpat:
+        if w in c:
+            ok = False
+    if ok:
+        print c
+        if not test:
+            print 'execute command'
+            os.system(c)
SVNspam 0.1