ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/prepare_environment.py
Revision: 1.1
Committed: Tue May 8 10:37:17 2012 UTC (13 years ago) by peller
Content type: text/x-python
Branch: MAIN
Log Message:
updated code

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
7
8 prefix='ZllH.May5Reg.'
9
10 lumi=4700
11
12 pathIN='/scratch/May05/'
13 pathOUT='/scratch/May05/env/'
14
15 weightexpression='((0.46502*PUweight+0.53498*PUweight2011B)*weightTrig)'
16
17
18 #Montecarlos
19 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']
20 samplenames0 =['WW','WZ','ZZ','TT','ST_s','ST_t','ST_tW','STbar_s','STbar_t','STbar_tW','ZH110','ZH115','ZH120','ZH125','ZH130']
21 sampletypes0 =['BKG','BKG','BKG','BKG','BKG','BKG','BKG','BKG','BKG','BKG','SIG','SIG','SIG','SIG','SIG']
22 samplesgroup0=['VV','VV','VV','TT','ST','ST','ST','ST','ST','ST','ZH','ZH','ZH','ZH','ZH']
23 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]
24 Aprefix0 = ['']
25 cut0 = ['(Vtype == 1 || Vtype == 0) && EVENT.json && hbhe']
26
27 #split DY in flavours
28 #genZpt < 120
29 InFiles1 = ['DYJetsToLL_TuneZ2_M-50_7TeV-madgraph-tauola']*3
30 samplenames1 =['Zudsg','Zbb','Zcc']
31 sampletypes1 =['BKG']*3
32 samplesgroup1=['DYlight','DYb','DYc']
33 xsecs1 = [3048]*3
34 Aprefix1 = ['udscg_120_', 'b_120_','c_120_']
35 cut1 = ['(Vtype == 1 || Vtype == 0) & EVENT.json & hbhe & eventFlav != 5 & eventFlav != 4 & genZpt <= 120.','(Vtype == 1 || Vtype == 0) & EVENT.json & hbhe & eventFlav == 5 & genZpt <= 120.','(Vtype == 1 || Vtype == 0) & EVENT.json & hbhe & eventFlav == 4 & genZpt <= 120.']
36
37 #genZpt > 120
38 InFiles2 = ['DYJetsToLL_PtZ-100_TuneZ2_7TeV-madgraph-tauola']*3
39 samplenames2 =['Zudsg_pt120','Zbb_pt120','Zcc_pt120']
40 sampletypes2 =['BKG']*3
41 samplesgroup2=['DYlight','DYb','DYc']
42 xsecs2 = [30]*3
43 Aprefix2 = ['udscg_120_', 'b_120_','c_120_']
44 cut2 = ['(Vtype == 1 || Vtype == 0) & EVENT.json & hbhe & eventFlav != 5 & eventFlav != 4 & genZpt > 120.','(Vtype == 1 || Vtype == 0) & EVENT.json & hbhe & eventFlav == 5 & genZpt > 120.','(Vtype == 1 || Vtype == 0) & EVENT.json & hbhe & eventFlav == 4 & genZpt > 120.']
45
46 #The Data
47 dataFiles = ['DataZee', 'DataZmm']
48 datanames =['Zee','Zmm']
49 datatypes =['DATA','DATA']
50 datagroup=['DATA','DATA']
51 AdataPrefix = ['']
52 datacuts=['(Vtype==1 && EVENT.json && hbhe) && (triggerFlags[5] | triggerFlags[6])','(Vtype==0 && EVENT.json && hbhe)&&((EVENT.run<173198 && (triggerFlags[0]>0 || triggerFlags[13]>0 || triggerFlags[14]>0 || triggerFlags[20]>0 || triggerFlags[21]>0)) || (EVENT.run>=173198 && EVENT.run<175832 && (triggerFlags[13]>0 ||triggerFlags[14]>0 || triggerFlags[22]>0 || triggerFlags[23]>0))|| (EVENT.run>=175832 && EVENT.run<178390 && (triggerFlags[13]>0 ||triggerFlags[14]>0 ||triggerFlags[15]>0 || triggerFlags[21]>0 || triggerFlags[22]>0 || triggerFlags[23]>0)) || (EVENT.run>=178390 && (triggerFlags[14]>0 ||triggerFlags[15]>0 || triggerFlags[21]>0 || triggerFlags[22]>0 || triggerFlags[23]>0 || triggerFlags[24]>0 || triggerFlags[25]>0 || triggerFlags[26]>0 || triggerFlags[27]>0)))']
53
54 info = []
55
56 #prepare the files:
57
58 # i>1 because no WW sample!!! only temporary fix
59
60 for i in range(1,len(InFiles0)):
61 copytree(pathIN,pathOUT,prefix,InFiles0[i],Aprefix0[0],cut0[0])
62 info.append(sample(samplenames0[i],sampletypes0[i]))
63 info[-1].path=pathOUT
64 info[-1].identifier=Aprefix0[0]+InFiles0[i]
65 info[-1].weightexpression=weightexpression
66 info[-1].group=samplesgroup0[i]
67 info[-1].lumi=lumi
68 info[-1].prefix=prefix
69 info[-1].xsec=xsecs0[i]
70 info[-1].addtreecut(cut0[0])
71
72 for i in range(3):
73 #copytree(pathIN,pathOUT,prefix,InFiles1[i],Aprefix1[i],cut1[i])
74 info.append(sample(samplenames1[i],sampletypes1[i]))
75 info[-1].path=pathOUT
76 info[-1].identifier=Aprefix1[i]+InFiles1[i]
77 info[-1].weightexpression=weightexpression
78 info[-1].group=samplesgroup1[i]
79 info[-1].lumi=lumi
80 info[-1].prefix=prefix
81 info[-1].xsec=xsecs1[i]
82 info[-1].addtreecut(cut1[i])
83
84 for i in range(3):
85 #copytree(pathIN,pathOUT,prefix,InFiles2[i],Aprefix2[i],cut2[i])
86 info.append(sample(samplenames2[i],sampletypes2[i]))
87 info[-1].path=pathOUT
88 info[-1].identifier=Aprefix2[i]+InFiles2[i]
89 info[-1].weightexpression=weightexpression
90 info[-1].group=samplesgroup2[i]
91 info[-1].lumi=lumi
92 info[-1].prefix=prefix
93 info[-1].xsec=xsecs2[i]
94 info[-1].addtreecut(cut2[i])
95
96 for i in range(0,len(dataFiles)):
97 #copytree(pathIN,pathOUT,prefix,dataFiles[i],AdataPrefix[0],datacuts[i])
98 info.append(sample(datanames[i],datatypes[i]))
99 info[-1].path=pathOUT
100 info[-1].identifier=AdataPrefix[0]+dataFiles[i]
101 info[-1].group=datagroup[i]
102 info[-1].lumi=lumi
103 info[-1].prefix=prefix
104 info[-1].addtreecut(datacuts[i])
105
106
107 #dump info
108 infofile = open(pathOUT+'/samples.info','w')
109 pickle.dump(info,infofile)
110 infofile.close()