ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/prepare_environment.py
Revision: 1.6
Committed: Wed May 23 11:44:41 2012 UTC (12 years, 11 months ago) by peller
Content type: text/x-python
Branch: MAIN
Changes since 1.5: +10 -7 lines
Log Message:
removed conflicts

File Contents

# User Rev Content
1 peller 1.1 #!/usr/bin/env python
2     from copytree import copytree
3     from printcolor import printc
4     from samplesclass import sample
5     import pickle
6 peller 1.6 import sys
7 peller 1.1
8 peller 1.6 prefix='ZllH.May23.'
9 peller 1.1
10 peller 1.6 lumi=4980
11 peller 1.1
12 peller 1.6 #pathIN='/scratch/May08/'
13     #pathOUT='/scratch/May08/env/'
14 peller 1.1
15 peller 1.6 pathIN=sys.argv[1]
16     pathOUT=sys.argv[2]
17 peller 1.1
18     weightexpression='((0.46502*PUweight+0.53498*PUweight2011B)*weightTrig)'
19    
20 peller 1.3 #this is only to speed it up, remove for final trees!
21     Precut='& V.pt > 50 & V.mass > 75. & V.mass < 105 & hJet_pt[0] > 20. & hJet_pt[1] > 20. & abs(hJet_eta[0]) < 2.4 & abs(hJet_eta[1]) < 2.4'
22 peller 1.2
23    
24 peller 1.1
25     #Montecarlos
26     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']
27     samplenames0 =['WW','WZ','ZZ','TT','ST_s','ST_t','ST_tW','STbar_s','STbar_t','STbar_tW','ZH110','ZH115','ZH120','ZH125','ZH130']
28     sampletypes0 =['BKG','BKG','BKG','BKG','BKG','BKG','BKG','BKG','BKG','BKG','SIG','SIG','SIG','SIG','SIG']
29     samplesgroup0=['VV','VV','VV','TT','ST','ST','ST','ST','ST','ST','ZH','ZH','ZH','ZH','ZH']
30     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]
31 peller 1.5 SF0=[1.0,1.0,1.0,1.04,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]
32 peller 1.1 Aprefix0 = ['']
33     cut0 = ['(Vtype == 1 || Vtype == 0) && EVENT.json && hbhe']
34    
35     #split DY in flavours
36     #genZpt < 120
37     InFiles1 = ['DYJetsToLL_TuneZ2_M-50_7TeV-madgraph-tauola']*3
38     samplenames1 =['Zudsg','Zbb','Zcc']
39     sampletypes1 =['BKG']*3
40     samplesgroup1=['DYlight','DYb','DYc']
41     xsecs1 = [3048]*3
42 peller 1.5 SF1=[1.00,0.95,1.24]
43 peller 1.2 Aprefix1 = ['udsg_120_', 'b_120_','c_120_']
44 peller 1.1 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.']
45    
46     #genZpt > 120
47     InFiles2 = ['DYJetsToLL_PtZ-100_TuneZ2_7TeV-madgraph-tauola']*3
48     samplenames2 =['Zudsg_pt120','Zbb_pt120','Zcc_pt120']
49     sampletypes2 =['BKG']*3
50     samplesgroup2=['DYlight','DYb','DYc']
51     xsecs2 = [30]*3
52 peller 1.5 SF2=[1.00,0.95,1.24]
53 peller 1.2 Aprefix2 = ['udsg_120_', 'b_120_','c_120_']
54 peller 1.1 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.']
55    
56     #The Data
57     dataFiles = ['DataZee', 'DataZmm']
58     datanames =['Zee','Zmm']
59     datatypes =['DATA','DATA']
60     datagroup=['DATA','DATA']
61     AdataPrefix = ['']
62     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)))']
63    
64 peller 1.2
65    
66    
67    
68 peller 1.1 info = []
69    
70     #prepare the files:
71    
72     # i>1 because no WW sample!!! only temporary fix
73    
74 peller 1.3 for i in range(0,len(InFiles0)):
75 peller 1.6 #copytree(pathIN,pathOUT,prefix,InFiles0[i],Aprefix0[0],cut0[0]+Precut)
76 peller 1.1 info.append(sample(samplenames0[i],sampletypes0[i]))
77     info[-1].path=pathOUT
78     info[-1].identifier=Aprefix0[0]+InFiles0[i]
79     info[-1].weightexpression=weightexpression
80     info[-1].group=samplesgroup0[i]
81     info[-1].lumi=lumi
82     info[-1].prefix=prefix
83     info[-1].xsec=xsecs0[i]
84 peller 1.2 info[-1].sf=SF0[i]
85 peller 1.1 info[-1].addtreecut(cut0[0])
86    
87     for i in range(3):
88 peller 1.6 #copytree(pathIN,pathOUT,prefix,InFiles1[i],Aprefix1[i],cut1[i]+Precut)
89 peller 1.1 info.append(sample(samplenames1[i],sampletypes1[i]))
90     info[-1].path=pathOUT
91     info[-1].identifier=Aprefix1[i]+InFiles1[i]
92     info[-1].weightexpression=weightexpression
93     info[-1].group=samplesgroup1[i]
94     info[-1].lumi=lumi
95     info[-1].prefix=prefix
96     info[-1].xsec=xsecs1[i]
97 peller 1.2 info[-1].sf=SF1[i]
98 peller 1.1 info[-1].addtreecut(cut1[i])
99    
100     for i in range(3):
101 peller 1.6 #copytree(pathIN,pathOUT,prefix,InFiles2[i],Aprefix2[i],cut2[i]+Precut)
102 peller 1.1 info.append(sample(samplenames2[i],sampletypes2[i]))
103     info[-1].path=pathOUT
104     info[-1].identifier=Aprefix2[i]+InFiles2[i]
105     info[-1].weightexpression=weightexpression
106     info[-1].group=samplesgroup2[i]
107     info[-1].lumi=lumi
108     info[-1].prefix=prefix
109     info[-1].xsec=xsecs2[i]
110 peller 1.2 info[-1].sf=SF2[i]
111 peller 1.1 info[-1].addtreecut(cut2[i])
112    
113     for i in range(0,len(dataFiles)):
114 peller 1.2 copytree(pathIN,pathOUT,prefix,dataFiles[i],AdataPrefix[0],datacuts[i]+Precut)
115 peller 1.1 info.append(sample(datanames[i],datatypes[i]))
116     info[-1].path=pathOUT
117     info[-1].identifier=AdataPrefix[0]+dataFiles[i]
118     info[-1].group=datagroup[i]
119     info[-1].lumi=lumi
120     info[-1].prefix=prefix
121     info[-1].addtreecut(datacuts[i])
122    
123    
124     #dump info
125     infofile = open(pathOUT+'/samples.info','w')
126     pickle.dump(info,infofile)
127     infofile.close()