ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/prepare_environment.py
Revision: 1.11
Committed: Wed Jan 16 16:22:46 2013 UTC (12 years, 3 months ago) by peller
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +0 -0 lines
State: FILE REMOVED
Log Message:
reorganized the whole repository. Macros im myutils, config files in subdirectories. Config file split in parts. Path config file restructured. Moved all path options to the path config. Changed the code accordingly.

File Contents

# Content
1 #!/usr/bin/env python
2 from copytree import copytree
3 from printcolor import printc
4 from samplesclass import sample
5 import pickle
6 import sys
7
8 prefix='ZllH.May5.'
9
10 lumi=4983.4
11
12 pathIN=sys.argv[1]
13 pathOUT=sys.argv[2]
14
15 weightexpression='((0.46502*PUweight+0.53498*PUweight2011B)*weightTrig)'
16
17 #this is only to speed it up, remove for final trees!
18 Precut=''
19
20
21
22 #Montecarlos
23 InFiles0 = ['WW_TuneZ2_7TeV_pythia6_tauola', 'WZ_TuneZ2_7TeV_pythia6_tauola','ZZ_TuneZ2_7TeV_pythia6_tauola','TTJets_TuneZ2_7TeV-madgraph-tauola','T_TuneZ2_s-channel_7TeV-powheg-tauola','T_TuneZ2_t-channel_7TeV-powheg-tauola', 'T_TuneZ2_tW-channel-DR_7TeV-powheg-tauola','Tbar_TuneZ2_s-channel_7TeV-powheg-tauola','Tbar_TuneZ2_t-channel_7TeV-powheg-tauola', 'Tbar_TuneZ2_tW-channel-DR_7TeV-powheg-tauola','ZH_ZToLL_HToBB_M-110_7TeV-powheg-herwigpp','ZH_ZToLL_HToBB_M-115_7TeV-powheg-herwigpp','ZH_ZToLL_HToBB_M-120_7TeV-powheg-herwigpp','ZH_ZToLL_HToBB_M-125_7TeV-powheg-herwigpp','ZH_ZToLL_HToBB_M-130_7TeV-powheg-herwigpp','ZH_ZToLL_HToBB_M-135_7TeV-powheg-herwigpp']
24 samplenames0 =['WW','WZ','ZZ','TT','ST_s','ST_t','ST_tW','STbar_s','STbar_t','STbar_tW','ZH110','ZH115','ZH120','ZH125','ZH130','ZH135']
25 sampletypes0 =['BKG','BKG','BKG','BKG','BKG','BKG','BKG','BKG','BKG','BKG','SIG','SIG','SIG','SIG','SIG','SIG']
26 samplesgroup0=['VV','VV','VV','TT','ST','ST','ST','ST','ST','ST','ZH','ZH','ZH','ZH','ZH','ZH']
27 xsecs0 = [42.9, 18.3, 5.9, 165, 3.19, 41.92, 7.87, 1.44, 22.65, 7.87, 0.4721*0.100974*0.745, 0.4107*0.100974*0.704, 0.3598*0.100974*0.648, 0.3158*0.100974*0.577, 0.2778*0.100974*0.493,0.2453*0.100974*0.403]
28 SF0=[1.0,1.0,1.0,1.032,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]
29 Aprefix0 = ['']
30 cut0 = ['(Vtype == 1 || Vtype == 0)']
31
32 #split DY in flavours
33 #genZpt < 120
34 InFiles1 = ['DYJetsToLL_TuneZ2_M-50_7TeV-madgraph-tauola']*3
35 samplenames1 =['Zudsg','Zbb','Zcc']
36 sampletypes1 =['BKG']*3
37 samplesgroup1=['DYlight','DYb','DYc']
38 xsecs1 = [3048]*3
39 SF1=[1.108,0.984,1.108]
40 Aprefix1 = ['udsg_120_', 'b_120_','c_120_']
41 cut1 = ['(Vtype == 1 || Vtype == 0) & EVENT.json & eventFlav != 5 & eventFlav != 4 & genZpt <= 120.','(Vtype == 1 || Vtype == 0) & EVENT.json & eventFlav == 5 & genZpt <= 120.','(Vtype == 1 || Vtype == 0) & EVENT.json & eventFlav == 4 & genZpt <= 120.']
42
43 #genZpt > 120
44 InFiles2 = ['DYJetsToLL_PtZ-100_TuneZ2_7TeV-madgraph-tauola']*3
45 samplenames2 =['Zudsg_pt120','Zbb_pt120','Zcc_pt120']
46 sampletypes2 =['BKG']*3
47 samplesgroup2=['DYlight','DYb','DYc']
48 xsecs2 = [30]*3
49 SF2=[1.108,0.984,1.108]
50 Aprefix2 = ['udsg_120_', 'b_120_','c_120_']
51 cut2 = ['(Vtype == 1 || Vtype == 0) & EVENT.json & eventFlav != 5 & eventFlav != 4 & genZpt > 120.','(Vtype == 1 || Vtype == 0) & EVENT.json & eventFlav == 5 & genZpt > 120.','(Vtype == 1 || Vtype == 0) & EVENT.json & eventFlav == 4 & genZpt > 120.']
52
53 #The Data
54 dataFiles = ['DataZee', 'DataZmm']
55 datanames =['Zee','Zmm']
56 datatypes =['DATA','DATA']
57 datagroup=['DATA','DATA']
58 AdataPrefix = ['']
59 datacuts=['(Vtype==1)','(Vtype==0)']
60
61
62
63
64
65 info = []
66
67 #prepare the files:
68
69 # i>1 because no WW sample!!! only temporary fix
70
71 for i in range(0,len(InFiles0)):
72 copytree(pathIN,pathOUT,prefix,InFiles0[i],Aprefix0[0],cut0[0]+Precut)
73 info.append(sample(samplenames0[i],sampletypes0[i]))
74 info[-1].path=pathOUT
75 info[-1].identifier=Aprefix0[0]+InFiles0[i]
76 info[-1].weightexpression=weightexpression
77 info[-1].group=samplesgroup0[i]
78 info[-1].lumi=lumi
79 info[-1].prefix=prefix
80 info[-1].xsec=xsecs0[i]
81 info[-1].sf=SF0[i]
82 info[-1].addtreecut(cut0[0])
83
84 for i in range(3):
85 copytree(pathIN,pathOUT,prefix,InFiles1[i],Aprefix1[i],cut1[i]+Precut)
86 info.append(sample(samplenames1[i],sampletypes1[i]))
87 info[-1].path=pathOUT
88 info[-1].identifier=Aprefix1[i]+InFiles1[i]
89 info[-1].weightexpression=weightexpression
90 info[-1].group=samplesgroup1[i]
91 info[-1].lumi=lumi
92 info[-1].prefix=prefix
93 info[-1].xsec=xsecs1[i]
94 info[-1].sf=SF1[i]
95 info[-1].addtreecut(cut1[i])
96
97 for i in range(3):
98 copytree(pathIN,pathOUT,prefix,InFiles2[i],Aprefix2[i],cut2[i]+Precut)
99 info.append(sample(samplenames2[i],sampletypes2[i]))
100 info[-1].path=pathOUT
101 info[-1].identifier=Aprefix2[i]+InFiles2[i]
102 info[-1].weightexpression=weightexpression
103 info[-1].group=samplesgroup2[i]
104 info[-1].lumi=lumi
105 info[-1].prefix=prefix
106 info[-1].xsec=xsecs2[i]
107 info[-1].sf=SF2[i]
108 info[-1].addtreecut(cut2[i])
109
110 for i in range(0,len(dataFiles)):
111 copytree(pathIN,pathOUT,prefix,dataFiles[i],AdataPrefix[0],datacuts[i]+Precut)
112 info.append(sample(datanames[i],datatypes[i]))
113 info[-1].path=pathOUT
114 info[-1].identifier=AdataPrefix[0]+dataFiles[i]
115 info[-1].group=datagroup[i]
116 info[-1].lumi=lumi
117 info[-1].prefix=prefix
118 info[-1].addtreecut(datacuts[i])
119
120
121 #dump info
122 infofile = open(pathOUT+'/samples.info','w')
123 pickle.dump(info,infofile)
124 infofile.close()