77"""
88import copy
99import 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
1113
1214def repackProcess (** args ):
1315 """
@@ -18,31 +20,37 @@ def repackProcess(**args):
1820 supported options:
1921
2022 - 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.
2129
2230 """
2331 from Configuration .EventContent .EventContent_cff import RAWEventContent
2432 from Configuration .EventContent .EventContent_cff import HLTSCOUTEventContent
2533 from Configuration .EventContent .EventContent_cff import L1SCOUTEventContent
2634 process = cms .Process ("REPACK" )
2735 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 ))
3038
3139 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+ )
3644
3745 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+ )
4149
4250 process .source = cms .Source (
4351 "NewEventStreamFileReader" ,
44- fileNames = cms .untracked .vstring ()
45- )
52+ fileNames = cms .untracked .vstring ()
53+ )
4654
4755 defaultDataTier = "RAW"
4856
@@ -58,36 +66,56 @@ def repackProcess(**args):
5866
5967 if len (outputs ) > 0 :
6068 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+
6275 for output in outputs :
6376
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+
6497 moduleLabel = output ['moduleLabel' ]
65- selectEvents = output .get ('selectEvents' , None )
6698 maxSize = output .get ('maxSize' , None )
6799
68100 outputModule = cms .OutputModule (
69101 "PoolOutputModule" ,
70102 compressionAlgorithm = copy .copy (eventContent .compressionAlgorithm ),
71103 compressionLevel = copy .copy (eventContent .compressionLevel ),
72- fileName = cms .untracked .string ("%s.root" % moduleLabel )
73- )
74-
104+ fileName = cms .untracked .string ("%s.root" % moduleLabel )
105+ )
75106
76- outputModule .dataset = cms .untracked .PSet (dataTier = cms .untracked .string (dataTier ))
107+ outputModule .dataset = cms .untracked .PSet (dataTier = cms .untracked .string (dataTier ))
77108
78- if maxSize != None :
109+ if maxSize is not None :
79110 outputModule .maxSize = cms .untracked .int32 (maxSize )
80111
81- if selectEvents != None :
112+ if selectEvents is not None :
82113 outputModule .SelectEvents = cms .untracked .PSet (
83- SelectEvents = cms .vstring (selectEvents )
84- )
114+ SelectEvents = cms .vstring (selectEvents )
115+ )
85116
86117 setattr (process , moduleLabel , outputModule )
87118
88119 process .outputPath += outputModule
89120
90121 return process
91-
92-
93-
0 commit comments