Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:24:30

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 maxevents=10
0005 isMC=False
0006 #isMC=True
0007 
0008 
0009 process = cms.Process('TEST')
0010 
0011 #process.load('JetMETAnalysis.PromptAnalysis.ntuple_cff')
0012 
0013 process.load('Configuration.StandardSequences.Services_cff')
0014 process.load('Configuration/StandardSequences/GeometryExtended_cff')
0015 process.load('Configuration/StandardSequences/Reconstruction_cff')
0016 process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff")
0017 
0018 # GLOBAL TAGS:  REPLACE WITH WHATEVER IS APPROPRIATE FOR YOUR WORK!
0019 
0020 #MC (Summer09-V16D_900GeV-v1)
0021 if (isMC):
0022     process.GlobalTag.globaltag ='START3X_V16D::All'
0023 
0024 #DATA (Feb9ReReco)  
0025 else:
0026     process.GlobalTag.globaltag ='GR09_R_34X_V5::All'
0027 
0028 #process.TFileService = cms.Service("TFileService",
0029     #fileName = cms.string( THISROOTFILE ),
0030     #closeFileFast = cms.untracked.bool(True)
0031 #)
0032 
0033 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(maxevents) )
0034 process.source = cms.Source (
0035     "PoolSource",
0036     fileNames = cms.untracked.vstring(
0037        '/store/data/BeamCommissioning09/ZeroBias/RECO/Feb9ReReco_v2/0027/F08E9178-7016-DF11-82B4-00163E0101D2.root',
0038     ),
0039     duplicateCheckMode = cms.untracked.string("noDuplicateCheck"),
0040     secondaryFileNames = cms.untracked.vstring()
0041 )
0042 
0043 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0044 process.MessageLogger.cerr.FwkReport.reportEvery = 1
0045 process.MessageLogger.cerr.default.limit = 100
0046 
0047 # summary
0048 process.options   = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
0049 process.load("hcalrechitreflagger_cfi")
0050 #process.hcalrecoReflagged = cms.EDProducer("RecHitReflagger")
0051 #process.hcalrechitReflagger.debug=4
0052 process.towerMakerPET = process.towerMaker.clone()
0053 process.towerMakerPET.hfInput = cms.InputTag("hcalrechitReflagger")
0054 process.metPET = process.met.clone()
0055 process.metPET.src = cms.InputTag("towerMakerPET")
0056 process.ak5CaloJetsPET = process.ak5CaloJets.clone()
0057 process.ak5CaloJetsPET.src = cms.InputTag("towerMakerPET")
0058 
0059 # Output definition
0060 process.output = cms.OutputModule("PoolOutputModule",
0061     splitLevel = cms.untracked.int32(0),
0062     #outputCommands = process.RECOSIMEventContent.outputCommands,
0063     fileName = cms.untracked.string('output_file.root')
0064 )
0065 
0066 
0067 #New SeverityLevelComputer that forces RecHits with UserDefinedBit0 set to be excluded from new rechit collection
0068 
0069 #process.hcalRecAlgos.SeverityLevels.append(cms.PSet(Level = cms.int32(2),
0070 #                                                    RecHitFlags = cms.vstring('HFPET','HFS9S1'),
0071 #                                                    ChannelStatus = cms.vstring('')))
0072 
0073 print("STARTING SL:")
0074 for i in process.hcalRecAlgos.SeverityLevels:
0075         print(i)
0076         
0077 
0078 
0079 severitylevels=[]  # Store all severity levels
0080 AddedFlag=False
0081 NewSevLevel=10
0082 for i in range(len(process.hcalRecAlgos.SeverityLevels)):  # loop over each severity level
0083     severitylevels.append(process.hcalRecAlgos.SeverityLevels[i].Level.value())  # store severity value
0084     flagvec=process.hcalRecAlgos.SeverityLevels[i].RecHitFlags.value()  # Get vector of rechit flags for this severity level
0085     flaglevel=process.hcalRecAlgos.SeverityLevels[i].Level.value()
0086     if "UserDefinedBit0" in flagvec and flaglevel!=10:  # remove HFLongShort from its default position
0087         flagvec.remove("UserDefinedBit0")
0088         process.hcalRecAlgos.SeverityLevels[i].RecHitFlags=flagvec
0089         print("Removed 'UserDefinedBit0' from severity level %i"%(process.hcalRecAlgos.SeverityLevels[i].Level.value()))
0090     if (flaglevel==NewSevLevel):  # Set UserDefinedBit0 severity to 10, which will exclude such rechits from CaloTower
0091         print("FOUND LEVEL %i!"%NewSevLevel)
0092         if "UserDefinedBit0" not in flagvec:
0093             if (flagvec!=['']):
0094                 flagvec.append("UserDefinedBit0")
0095             else:
0096                 flagvec=["UserDefinedBit0"]
0097             process.hcalRecAlgos.SeverityLevels[i].RecHitFlags=flagvec
0098             AddedFlag=True
0099 if (AddedFlag==False):
0100     print("Found no Severity Level = %i; Adding it now"%NewSevLevel)
0101     process.hcalRecAlgos.SeverityLevels.append(cms.PSet(Level=cms.int32(NewSevLevel),
0102                                                         RecHitFlags=cms.vstring("UserDefinedBit0"),
0103                                                         ChannelStatus=cms.vstring("")))
0104 
0105 print("New Severity Levels:")
0106 for i in process.hcalRecAlgos.SeverityLevels:
0107     print(i)
0108 
0109 #print process.hbhereco.firstSample, "  FIRST"
0110 
0111 process.reflagging_step = cms.Path(process.hcalrechitReflagger)
0112 process.reconstruction_step = cms.Path(process.towerMakerPET*(process.metPET+process.ak5CaloJetsPET))
0113 process.out_step = cms.EndPath(process.output)
0114 
0115 process.schedule = cms.Schedule(process.reflagging_step,process.reconstruction_step,process.out_step)
0116