7
7
"""
8
8
import copy
9
9
import FWCore .ParameterSet .Config as cms
10
-
10
+ import HLTrigger .HLTfilters .hltHighLevel_cfi as hlt
11
+ import Configuration .Skimming .RAWSkims_cff as RawSkims
12
+ from Configuration .AlCa .GlobalTag import GlobalTag
11
13
12
14
def repackProcess (** args ):
13
15
"""
@@ -18,31 +20,37 @@ def repackProcess(**args):
18
20
supported options:
19
21
20
22
- outputs : defines output modules
23
+ - globalTag : contains trigger paths for the selected raw skims in outputs
24
+
25
+ Additional comments:
26
+
27
+ The selectEvents parameter within the outputs option is of type list, provided by T0.
28
+ The paths in the list have an added ":HLT" to the string, which needs to be removed for propper use of the raw skim machinery.
21
29
22
30
"""
23
31
from Configuration .EventContent .EventContent_cff import RAWEventContent
24
32
from Configuration .EventContent .EventContent_cff import HLTSCOUTEventContent
25
33
from Configuration .EventContent .EventContent_cff import L1SCOUTEventContent
26
34
process = cms .Process ("REPACK" )
27
35
process .load ("FWCore.MessageLogger.MessageLogger_cfi" )
28
-
29
- process .maxEvents = cms .untracked .PSet ( input = cms .untracked .int32 (- 1 ) )
36
+
37
+ process .maxEvents = cms .untracked .PSet (input = cms .untracked .int32 (- 1 ))
30
38
31
39
process .configurationMetadata = cms .untracked .PSet (
32
- name = cms .untracked .string ("repack-config" ),
33
- version = cms .untracked .string ("none" ),
34
- annotation = cms .untracked .string ("auto generated configuration" )
35
- )
40
+ name = cms .untracked .string ("repack-config" ),
41
+ version = cms .untracked .string ("none" ),
42
+ annotation = cms .untracked .string ("auto generated configuration" )
43
+ )
36
44
37
45
process .options = cms .untracked .PSet (
38
- Rethrow = cms .untracked .vstring ("ProductNotFound" ,"TooManyProducts" ,"TooFewProducts" ),
39
- wantSummary = cms .untracked .bool (False )
40
- )
46
+ Rethrow = cms .untracked .vstring ("ProductNotFound" , "TooManyProducts" , "TooFewProducts" ),
47
+ wantSummary = cms .untracked .bool (False )
48
+ )
41
49
42
50
process .source = cms .Source (
43
51
"NewEventStreamFileReader" ,
44
- fileNames = cms .untracked .vstring ()
45
- )
52
+ fileNames = cms .untracked .vstring ()
53
+ )
46
54
47
55
defaultDataTier = "RAW"
48
56
@@ -58,36 +66,56 @@ def repackProcess(**args):
58
66
59
67
if len (outputs ) > 0 :
60
68
process .outputPath = cms .EndPath ()
61
-
69
+
70
+ globalTag = args .get ('globalTag' , None )
71
+ if globalTag :
72
+ process .load ('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff' )
73
+ process .GlobalTag = GlobalTag (process .GlobalTag , globalTag , '' )
74
+
62
75
for output in outputs :
63
76
77
+ selectEventsBase = output .get ('selectEvents' , None )
78
+ rawSkim = output .get ('rawSkim' , None )
79
+
80
+ if rawSkim :
81
+
82
+ selectEventsBase = [item .replace (":HLT" , "" ) for item in selectEventsBase ]
83
+
84
+ process .baseSelection = hlt .hltHighLevel .clone (
85
+ TriggerResultsTag = "TriggerResults::HLT" ,
86
+ HLTPaths = cms .vstring (selectEventsBase )
87
+ )
88
+ skim = getattr (RawSkims , rawSkim )
89
+ setattr (process , rawSkim , skim )
90
+ path = cms .Path (skim + process .baseSelection )
91
+ selectEvents = f"{ rawSkim } Path"
92
+ setattr (process , selectEvents , path )
93
+
94
+ else :
95
+ selectEvents = selectEventsBase
96
+
64
97
moduleLabel = output ['moduleLabel' ]
65
- selectEvents = output .get ('selectEvents' , None )
66
98
maxSize = output .get ('maxSize' , None )
67
99
68
100
outputModule = cms .OutputModule (
69
101
"PoolOutputModule" ,
70
102
compressionAlgorithm = copy .copy (eventContent .compressionAlgorithm ),
71
103
compressionLevel = copy .copy (eventContent .compressionLevel ),
72
- fileName = cms .untracked .string ("%s.root" % moduleLabel )
73
- )
74
-
104
+ fileName = cms .untracked .string ("%s.root" % moduleLabel )
105
+ )
75
106
76
- outputModule .dataset = cms .untracked .PSet (dataTier = cms .untracked .string (dataTier ))
107
+ outputModule .dataset = cms .untracked .PSet (dataTier = cms .untracked .string (dataTier ))
77
108
78
- if maxSize != None :
109
+ if maxSize is not None :
79
110
outputModule .maxSize = cms .untracked .int32 (maxSize )
80
111
81
- if selectEvents != None :
112
+ if selectEvents is not None :
82
113
outputModule .SelectEvents = cms .untracked .PSet (
83
- SelectEvents = cms .vstring (selectEvents )
84
- )
114
+ SelectEvents = cms .vstring (selectEvents )
115
+ )
85
116
86
117
setattr (process , moduleLabel , outputModule )
87
118
88
119
process .outputPath += outputModule
89
120
90
121
return process
91
-
92
-
93
-
0 commit comments