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 """
@@ -25,24 +27,24 @@ def repackProcess(**args):
2527 from Configuration .EventContent .EventContent_cff import L1SCOUTEventContent
2628 process = cms .Process ("REPACK" )
2729 process .load ("FWCore.MessageLogger.MessageLogger_cfi" )
28-
29- process .maxEvents = cms .untracked .PSet ( input = cms .untracked .int32 (- 1 ) )
30+
31+ process .maxEvents = cms .untracked .PSet (input = cms .untracked .int32 (- 1 ))
3032
3133 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- )
34+ name = cms .untracked .string ("repack-config" ),
35+ version = cms .untracked .string ("none" ),
36+ annotation = cms .untracked .string ("auto generated configuration" )
37+ )
3638
3739 process .options = cms .untracked .PSet (
38- Rethrow = cms .untracked .vstring ("ProductNotFound" ,"TooManyProducts" ,"TooFewProducts" ),
39- wantSummary = cms .untracked .bool (False )
40- )
40+ Rethrow = cms .untracked .vstring ("ProductNotFound" , "TooManyProducts" , "TooFewProducts" ),
41+ wantSummary = cms .untracked .bool (False )
42+ )
4143
4244 process .source = cms .Source (
4345 "NewEventStreamFileReader" ,
44- fileNames = cms .untracked .vstring ()
45- )
46+ fileNames = cms .untracked .vstring ()
47+ )
4648
4749 defaultDataTier = "RAW"
4850
@@ -58,36 +60,54 @@ def repackProcess(**args):
5860
5961 if len (outputs ) > 0 :
6062 process .outputPath = cms .EndPath ()
61-
63+
64+ globalTag = args .get ('globalTag' , None )
65+ if globalTag :
66+ process .load ('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff' )
67+ process .GlobalTag = GlobalTag (process .GlobalTag , globalTag , '' )
68+
6269 for output in outputs :
6370
71+ selectEventsBase = output .get ('selectEvents' , None )
72+ rawSkim = output .get ('rawSkim' , None )
73+ if rawSkim :
74+
75+ selectEventsBase = selectEventsBase .replace (":HLT" , "" )
76+ process .baseSelection = hlt .hltHighLevel .clone (
77+ TriggerResultsTag = "TriggerResults::HLT" ,
78+ HLTPaths = cms .vstring (selectEventsBase )
79+ )
80+ skim = getattr (RawSkims , rawSkim )
81+ setattr (process , rawSkim , skim )
82+ path = cms .Path (skim + process .baseSelection )
83+ selectEvents = f"{ rawSkim } Path"
84+ setattr (process , selectEvents , path )
85+
86+ else :
87+ selectEvents = selectEventsBase
88+
6489 moduleLabel = output ['moduleLabel' ]
65- selectEvents = output .get ('selectEvents' , None )
6690 maxSize = output .get ('maxSize' , None )
6791
6892 outputModule = cms .OutputModule (
6993 "PoolOutputModule" ,
7094 compressionAlgorithm = copy .copy (eventContent .compressionAlgorithm ),
7195 compressionLevel = copy .copy (eventContent .compressionLevel ),
72- fileName = cms .untracked .string ("%s.root" % moduleLabel )
73- )
74-
96+ fileName = cms .untracked .string ("%s.root" % moduleLabel )
97+ )
7598
76- outputModule .dataset = cms .untracked .PSet (dataTier = cms .untracked .string (dataTier ))
99+ outputModule .dataset = cms .untracked .PSet (dataTier = cms .untracked .string (dataTier ))
77100
78- if maxSize != None :
101+ if maxSize is not None :
79102 outputModule .maxSize = cms .untracked .int32 (maxSize )
80103
81- if selectEvents != None :
104+ if selectEvents is not None :
82105 outputModule .SelectEvents = cms .untracked .PSet (
83- SelectEvents = cms .vstring (selectEvents )
84- )
106+ SelectEvents = cms .vstring (selectEvents )
107+ )
85108
86109 setattr (process , moduleLabel , outputModule )
87110
88111 process .outputPath += outputModule
89112
90113 return process
91-
92-
93-
0 commit comments