def makeLatestJSON(jsonsPath,aDataSet,runRegCfg="runregTemplate.cfg",runRegPy="runregparse.py"): ##Check last analysed run number maxRun = 0 for fname in os.listdir(jsonsPath): jsonFile = jsonsPath+"/"+fname jsonList = LumiList(filename = jsonFile) runList = jsonList.getRuns() for run in runList: if int(run)>maxRun: maxRun = int(run) print "Last analysed run is:",maxRun print "Preparinng JSON for runs:",maxRun+1,999999 file = open(runRegCfg, "r") #Opens the file in read-mode text = file.read() file.close() text1 = text.replace("RunMin=","RunMin=" + str(maxRun+1)) text2 = text1.replace("DBS_PDS=","DBS_PDS=" + aDataSet) # enable cross check with DBS file = open("runreg.cfg", "w") file.write(text2) file.close() ##Create the JSON os.system(runRegPy) # os.system(os.getenv("CMSSW_BASE")+"/src/UserCode/L1RpcTriggerAnalysis/test/runregparse.py") ##Rename JSON file to include run range jsonFile = "GoodRuns.json" jsonList = LumiList(filename = jsonFile) runList = jsonList.getRuns() minRun = int(runList[0]) maxRun = int(runList[len(runList)-1]) jsonFileName = "GoodRuns_"+str(minRun)+"-"+str(maxRun)+".json" os.system("mv GoodRuns.json "+jsonsPath+"/"+jsonFileName) return jsonsPath+"/"+jsonFileName
def countFiles(jsonFile,samplePath): jsonList = LumiList(filename = jsonFile) runList = jsonList.getRuns() base="/castor/cern.ch/cms/" counter = 0 for run in runList: path = base+"/"+samplePath+"/"+run[0:3]+"/"+run[3:len(run)] #command = "nsls "+path+" | grep .root | wc -l" command1 = "nsls "+path if commands.getstatusoutput(command1)[0] != 0: print "Skipping run: "+run continue command = command1+" | grep .root | wc -l" files = commands.getstatusoutput(command)[1] counter+=int(files) return counter
process.load("HeavyIonsAnalysis.Configuration.hfCoincFilter_cff") process.load("HeavyIonsAnalysis.Configuration.analysisFilters_cff") process.load("HeavyIonsAnalysis.Configuration.collisionEventSelection_cff") process.load("QWAna.QWNtrkOfflineProducer.QWNoff_cfi") process.load("HeavyIonsAnalysis.VNAnalysis/vnanalyzer_cfi") from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, '80X_dataRun2_Prompt_v16', '') process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(-1)) process.MessageLogger.cerr.FwkReport.reportEvery = 500 import FWCore.PythonUtilities.LumiList as LumiList goodLumiSecs = LumiList.LumiList( filename=ivars.lumifile).getCMSSWString().split(',') readFiles = cms.untracked.vstring() secFiles = cms.untracked.vstring() #process.source = cms.Source ("PoolSource",fileNames = cms.untracked.vstring(), # inputCommands=cms.untracked.vstring( # 'keep *', # 'drop *_hiEvtPlane_*_*' #) # ) process.source = cms.Source( "PoolSource", fileNames=cms.untracked.vstring( "root://cmsxrootd.fnal.gov//store/user/davidlw/PAHighMultiplicity0/RecoSkim2016_pPb_V0Cascade_v1/170301_201930/0000/pPb_HM_28.root"
# sept reprocessing process.GlobalTag.globaltag = '80X_dataRun2_2016SeptRepro_v4' else: ## tranch IV v6 ... is this correct? #process.GlobalTag.globaltag = '80X_mcRun2_asymptotic_2016_miniAODv2' # for 8011 MC? process.GlobalTag.globaltag = '80X_mcRun2_asymptotic_2016_TrancheIV_v6' ### LOAD DATABASE from CondCore.DBCommon.CondDBSetup_cfi import * #from CondCore.CondDB.CondDB_cfi import * ######## LUMI MASK #if isData and not options.isGrid and False: ## dont load the lumiMaks, will be called by crab if isData: import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename='Cert_271036-284044_13TeV_23Sep2016ReReco_Collisions16_JSON.txt').getVLuminosityBlockRange() print "Using local JSON" ### LOAD CONFIGURATION process.load('PandaProd.Filter.infoProducerSequence_cff') process.load('PandaProd.Filter.MonoXFilterSequence_cff') process.load('PandaProd.Ntupler.PandaProd_cfi') #process.load('PandaProd.Ntupler.VBF_cfi') #-----------------------JES/JER---------------------------------- if isData: jeclabel = 'Spring16_23Sep2016AllV2_DATA' else: jeclabel = 'Spring16_23Sep2016V2_MC' process.jec = cms.ESSource("PoolDBESSource", CondDBSetup,
) runboundary = 1 process.source.firstRun = cms.untracked.uint32(int(runboundary)) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) ) ################################################################### # JSON Filtering ################################################################### if isMC: print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is Simulation!") runboundary = 1 else: print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is DATA!") import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename ='None').getVLuminosityBlockRange() ################################################################### # Messages ################################################################### process.load('FWCore.MessageService.MessageLogger_cfi') process.MessageLogger.categories.append("PrimaryVertexValidation") process.MessageLogger.categories.append("FilterOutLowPt") process.MessageLogger.destinations = cms.untracked.vstring("cout") process.MessageLogger.cout = cms.untracked.PSet( threshold = cms.untracked.string("INFO"), default = cms.untracked.PSet(limit = cms.untracked.int32(0)), FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1), reportEvery = cms.untracked.int32(1000) ), PrimaryVertexValidation = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
packedCandidates = cms.InputTag("packedPFCandidates"), rho = cms.InputTag("fixedGridRhoFastjetAll"), met = cms.InputTag(metCollection), jets = cms.InputTag("selectedUpdatedPatJetsUpdatedJEC"), jetsSmeared = cms.InputTag("selectedUpdatedPatJetsUpdatedJEC" if isData else "slimmedJetsCorrectedAndSmeared"), jetsSmearedUp = cms.InputTag("selectedUpdatedPatJetsUpdatedJEC" if isData else "slimmedJetsCorrectedAndSmearedUp"), jetsSmearedDown = cms.InputTag("selectedUpdatedPatJetsUpdatedJEC" if isData else "slimmedJetsCorrectedAndSmearedDown"), jecUncertaintyFile = cms.FileInPath("heavyNeutrino/multilep/data/Summer16_23Sep2016V3_MC_Uncertainty_AK4PFchs.txt"), prescales = cms.InputTag("patTrigger"), triggers = cms.InputTag("TriggerResults::HLT"), recoResults = cms.InputTag("TriggerResults::RECO"), badPFMuonFilter = cms.InputTag("BadPFMuonFilter"), badChargedCandFilter = cms.InputTag("BadChargedCandidateFilter"), skim = cms.untracked.string(outputFile.split('/')[-1].split('.')[0].split('_')[0]), isData = cms.untracked.bool(isData), is2017 = cms.untracked.bool(is2017), isSUSY = cms.untracked.bool(isSUSY) ) if isData: import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename = "../data/JSON/" + getJSON(is2017)).getVLuminosityBlockRange() process.p = cms.Path(process.goodOfflinePrimaryVertices * process.BadPFMuonFilter * process.BadChargedCandidateFilter * process.egmSequence * process.jetSequence * process.fullPatMetSequence * process.blackJackAndHookers)
process.load(inputScript) else: print 'need an input script' exit(8889) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32 (maxEvents) ) if skipEvents > 0: process.source.skipEvents = cms.untracked.uint32(skipEvents) if not runOnMC and not (json=="nojson"): import FWCore.PythonUtilities.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList(filename = json).getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) #################################################################### ## Configure message logger process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.destinations = ['cout', 'cerr'] process.MessageLogger.cerr.threshold = 'INFO' #process.MessageLogger.suppressWarning=['particleFlowDisplacedVertexCandidate','The interpolated laser correction is <= zero! (0). Using 1. as correction factor.'] process.MessageLogger.cerr.FwkReport.reportEvery = reportEvery
## Single Muon #'', ## Double Electron #'', ## Electron Muon #'', ## Double Muon #'', ) ) import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename = 'data/JSON/2017/Cert_294927-306462_13TeV_EOY2017ReReco_Collisions17_JSON.txt').getVLuminosityBlockRange() # initialize MessageLogger and output report process.load("FWCore.MessageLogger.MessageLogger_cfi") process.MessageLogger.cerr.FwkReport.reportEvery = 1000 process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi") process.load('Configuration.Geometry.GeometryRecoDB_cff') #process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Configuration.StandardSequences.MagneticField_38T_cff") process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff" ) process.GlobalTag.globaltag = '94X_dataRun2_v6' process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True))
process.GlobalTag.globaltag = globalTag # ///////////////////////////////////////////////////////////// # ------------ PoolSource ------------- # ///////////////////////////////////////////////////////////// readFiles = cms.untracked.vstring(); process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.source = cms.Source("PoolSource",fileNames = readFiles) process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange() # use a JSON file when locally executing cmsRun if thisIsData: import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename = s.jsonfiles[1]).getVLuminosityBlockRange() # ///////////////////////////////////////////////////////////// # Save output with TFileService # ///////////////////////////////////////////////////////////// process.TFileService = cms.Service("TFileService", fileName = cms.string("stage_1_"+s.name+".root") ) # ///////////////////////////////////////////////////////////// # Load UFDiMuonAnalyzer # ///////////////////////////////////////////////////////////// if thisIsData: process.load("UfHMuMuCode.UFDiMuonsAnalyzer.UFDiMuonsAnalyzer_cff") else: process.load("UfHMuMuCode.UFDiMuonsAnalyzer.UFDiMuonsAnalyzer_MC_cff")
process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff" ) process.GlobalTag = GlobalTag( process.GlobalTag, '92X_upgrade2017_realistic_Candidate_forECALStudies', '') # input process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(100)) outputFile = "electron_ntuple_2016B_MINIAOD.root" process.source = cms.Source( "PoolSource", fileNames=cms.untracked.vstring('file:step3_2016B.root')) import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList( filename='goodList2016B.json').getVLuminosityBlockRange() process.ntupler = cms.EDAnalyzer( 'ElectronPlots', beamSpot=cms.InputTag('offlineBeamSpot'), genEventInfoProduct=cms.InputTag('generator'), electrons=cms.InputTag("gedGsfElectrons"), # electrons = cms.InputTag("slimmedElectrons"), genParticles=cms.InputTag("genParticles"), vertices=cms.InputTag("offlinePrimaryVertices"), # vertices = cms.InputTag("offlineSlimmedPrimaryVertices"), conversions=cms.InputTag('allConversions'), isMC=cms.bool(True)) process.TFileService = cms.Service("TFileService", fileName=cms.string(outputFile))
fileNames = cms.untracked.vstring( # '/store/hidata/HIRun2013A/PAHighPt/RECO/PromptReco-v1/000/210/634/FA4E6B7E-7366-E211-8DD0-0019B9F581C9.root' # 'file:/cms/store/hidata/HIRun2013/PAHighPt/RECO/PromptReco-v1/000/210/498/00000/1E825832-FA64-E211-8F9C-003048CF9B28.root' ), ) filename = "filelist"+sys.argv[3]+".dat" mylist = FileUtils.loadListFromFile (filename) for fname in mylist[int(sys.argv[4]):int(sys.argv[5])]: process.source.fileNames.append('file:%s' % (fname)) # =============== Other Statements ===================== process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1)) process.options = cms.untracked.PSet(wantSummary = cms.untracked.bool(True)) process.GlobalTag.globaltag = 'GR_P_V43F::All' if sys.argv[3] == "pPbReReco": process.source.lumisToProcess = LumiList.LumiList(filename = 'Cert_210498-210658_HI_PromptReco_Collisions13_JSON_v2.txt').getVLuminosityBlockRange() elif sys.argv[3] == "pPb": process.source.lumisToProcess = LumiList.LumiList(filename = 'Cert_210676-211256_HI_PromptReco_Collisions13_JSON_v2.txt').getVLuminosityBlockRange() elif sys.argv[3] == "Pbp": process.source.lumisToProcess = LumiList.LumiList(filename = 'Cert_211313-211631_HI_PromptReco_Collisions13_JSON_v2.txt').getVLuminosityBlockRange() # =============== Import Sequences ===================== process.load('Appeltel.RpPbAnalysis.PAPileUpVertexFilter_cff') #Trigger Selection ### Comment out for the timing being assuming running on secondary dataset with trigger bit selected already import HLTrigger.HLTfilters.hltHighLevel_cfi process.hltHM = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone() process.hltHM.HLTPaths = [ # "HLT_*PAPixelTracks_Multiplicity*_v*" "HLT_PAPixelTracks_Multiplicity100_v*", #120-150
), HLTBitNames_MuL2Mu=cms.vstring(), # TWO FILTER NAMES PER PATH (FIRST is L3, SECOND is L2) HLTLastFilterNames_MuL2Mu=cms.vstring(), HLTBitNames_MuTrack=cms.vstring(), # ONE FILTER NAME PER PATH HLTLastFilterNames_MuTrack=cms.vstring(), HLTBitNames_MuTkMu=cms.vstring(), # ONE FILTER NAME PER PATH HLTLastFilterNames_MuTkMu=cms.vstring(), ) ## no filter # process.p = cms.Path(process.demo) ## filter on vertex process.p = cms.Path(process.primaryVertexFilter * process.demo) #import PhysicsTools.PythonAnalysis.LumiList as LumiList import FWCore.PythonUtilities.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList( filename='Cert_190456-191859_8TeV_PromptReco_Collisions12_JSON_MuonPhys.txt' ).getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked( CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) ## filter on vertex and HLT # process.p = cms.Path(process.primaryVertexFilter*process.hltMuF*process.demo)
options.parseArguments() # Input source process.source = cms.Source( "PoolSource", #fileNames = cms.untracked.vstring('root://cmsxrootd.cms.infn.it///store/data/Run2016D/DoubleEG/RAW-RECO/ZElectron-PromptReco-v2/000/276/315/00000/12C9D229-0545-E611-8F5B-02163E0129BD.root'), fileNames=cms.untracked.vstring( 'root://cms-xrd-global.cern.ch//store/data/Run2016D/DoubleEG/RAW-RECO/ZElectron-PromptReco-v2/000/276/315/00000/12C9D229-0545-E611-8F5B-02163E0129BD.root' ), #fileNames = cms.untracked.vstring(options.inputFiles), #secondaryFileNames = cms.untracked.vstring() ) import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList( filename= '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions16/13TeV/Cert_271036-276811_13TeV_PromptReco_Collisions16_JSON_NoL1T.txt' ).getVLuminosityBlockRange() # Production Info process.configurationMetadata = cms.untracked.PSet( annotation=cms.untracked.string('l1NtupleRECO nevts:200'), name=cms.untracked.string('Applications'), version=cms.untracked.string('$Revision: 1.19 $')) # Output definition # Additional output definition # Other statements from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag.globaltag = '80X_dataRun2_Prompt_v9'
process.BadChargedCandidateFilter.PFCandidates = cms.InputTag( "packedPFCandidates") process.load('RecoMET.METFilters.BadPFMuonFilter_cfi') ## for miniAOD running process.BadPFMuonFilter.muons = cms.InputTag("slimmedMuons") process.BadPFMuonFilter.PFCandidates = cms.InputTag("packedPFCandidates") if isMC: process.p = cms.Path( process.goodOfflinePrimaryVertices * process.BadChargedCandidateFilter * process.BadPFMuonFilter # *process.electronMVAValueMapProducer * process.egmGsfElectronIDSequence * process.FakeLeptons) else: import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList( filename= '/cms/data/store/user/t2/users/lesya/CMSSW_8_0_20_patch1/src/SUSYAnalyzer/PatAnalyzer/test/JSON/Cert_271036-282037_13TeV_PromptReco_Collisions16_JSON_NoL1T.txt' ).getVLuminosityBlockRange() process.p = cms.Path( process.goodOfflinePrimaryVertices # *process.eeBadScFilter * process.HBHENoiseFilterResultProducer * process.ApplyBaselineHBHENoiseFilter * process.ApplyBaselineHBHEIsoNoiseFilter * process.BadChargedCandidateFilter * process.BadPFMuonFilter # *process.electronMVAValueMapProducer * process.egmGsfElectronIDSequence * process.FakeLeptons)
import os d = os.getcwd() while d != "/": t, d = os.path.join(d,fname), os.path.dirname(d) if os.path.exists(t): return t if opts.goldenjson and find_up(opts.goldenjson): goldenjson = find_up(opts.goldenjson) # if we filter in the process.source, then the events are just skipped # so we use a custom lumiFilter to skip *after* the EventMaker to keep # total event counts in agreement with DBS, but also have evt_event,run,lumiBlock # for babymakers to filter skip_event = False import FWCore.PythonUtilities.LumiList as LumiList # JSONfile = "Cert_314472-325175_13TeV_PromptReco_Collisions18_JSON.txt" lumilist = LumiList.LumiList(filename=goldenjson).getCMSSWString().split(',') print("Found json list of lumis to process with {} lumi sections from {}".format(len(lumilist),goldenjson)) print("Skipping {} if they're not in the lumi list".format("events entirely" if skip_event else "anything after eventMaker")) if skip_event: process.source.lumisToProcess = cms.untracked(cms.VLuminosityBlockRange()+lumilist) else: process.lumiFilter.lumisToProcess = cms.untracked(cms.VLuminosityBlockRange()+lumilist) #Max Events process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(opts.nevents) ) process.outpath = cms.EndPath(process.out) process.out.outputCommands = cms.untracked.vstring( 'drop *' ) extra = {} if opts.metrecipe:
process.options = cms.untracked.PSet( ) # Production Info process.configurationMetadata = cms.untracked.PSet( version = cms.untracked.string('$Revision: 1.20 $'), annotation = cms.untracked.string('RelVal nevts:100'), name = cms.untracked.string('Applications') ) # JSON import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename = 'Cert_271036-273730_13TeV_PromptReco_Collisions16_JSON.txt').getVLuminosityBlockRange() # skim definitions process.highptMuons = cms.EDFilter("PtMinCandViewSelector", src = cms.InputTag("slimmedMuons"), ptMin = cms.double(20) ) process.dimuonFilter = cms.EDFilter("CandViewCountFilter", src = cms.InputTag("highptMuons"), minNumber = cms.uint32(2), ) process.dimu_filter_step = cms.Path(process.highptMuons + process.dimuonFilter)
) #Output process.TFileService = cms.Service("TFileService", fileName=cms.string(options.outputFile)) #from Configuration.AlCa.GlobalTag import GlobalTag process.load( 'Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff' ) process.GlobalTag.globaltag = 'GR_P_V56' import FWCore.PythonUtilities.LumiList as LumiList #process.source.lumisToProcess = LumiList.LumiList(filename = '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions15/13TeV/DCSOnly/json_DCSONLY_Run2015B.txt').getVLuminosityBlockRange() process.source.lumisToProcess = LumiList.LumiList( filename= 'https://cms-service-dqm.web.cern.ch/cms-service-dqm/CAF/certification/Collisions15/13TeV/Cert_246908-251883_13TeV_PromptReco_Collisions15_JSON_v2.txt' ).getVLuminosityBlockRange() ######################### from L1Trigger.L1TCalorimeter.caloStage1Params_cfi import * process.load("L1Trigger.L1TCalorimeter.caloStage1Params_cfi") process.caloStage1Params.tauSeedThreshold = cms.double( options.tauThresh) #pre-RCT Calibration 7GeV process.caloStage1Params.tauNeighbourThreshold = cms.double( options.tauNThresh) #pre-RCT Calibration 0GeV process.caloStage1Params.tauMaxPtTauVeto = cms.double( options.tauMaxPtTauVeto) #pre-RCT Calibration 64GeV process.caloStage1Params.tauIsoLUTFile = cms.FileInPath( options.tauIsoLUTFile) #pre-RCT Calibration 0.1 process.caloStage1Params.tauCalibrationLUTFile = cms.FileInPath( options.tauCalibLUTFile) #pre-RCT Calibration 0.1
JERdown=cms.bool(False)) ####################################################### # # Input files # process.inputs = cms.PSet( nEvents=cms.int32(-1), skipEvents=cms.int32(0), lumisToProcess=CfgTypes.untracked(CfgTypes.VLuminosityBlockRange()), fileNames=cms.vstring( 'file:/data1/avetisya/temp/T53T53_750_Summer12_8TeV_PAT_1.root')) # JSON JsonFile = '/data1/speer/tblsm/cmssw/CMSSW_5_3_3/src/LJMet/Com/data/json/Cert_190456-202016_8TeV_PromptReco_Collisions12_JSON_MuonPhys.txt' myList = LumiList.LumiList(filename=JsonFile).getCMSSWString().split(',') if not process.ljmet.isMc: process.inputs.lumisToProcess.extend(myList) ####################################################### # # Output # process.outputs = cms.PSet( outputName=cms.string('ljmet_tree'), treeName=cms.string('ljmet'), ) ####################################################### # # Object selector options
process.tpPairs ) if options.isMC : process.tpPairSeq += process.muMcMatch process.tpPairSeq += process.tpPairsMCEmbedded process.muonEffs.isMC = cms.bool(True) process.muonEffs.eventWeight = cms.InputTag("generator") process.muonEffs.PUWeightSrc = cms.InputTag("pileupReweightingProducer","pileupWeights") setattr(process.muonEffs.pairVariables, 'mc_mass', cms.string("userFloat('mc_mass')")) process.muonEffs.tagProbePairs = cms.InputTag("tpPairsMCEmbedded") process.tpPairSeq += process.pileupReweightingProducer if not options.isMC : import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename = '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions15/13TeV/'+config['json']).getVLuminosityBlockRange() process.p = cms.Path( process.muonInitialSequence * (process.tagMuons + process.probeMuons) * (process.tagMuonsTriggerMatched + process.probeTriggerSeq) * process.tpPairSeq * process.muonEffs ) process.out = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string('debug.root'), SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring("p")) ) if config['DEBUG'] : process.outpath = cms.EndPath(process.out)
print 'Running on', ('data' if isData else 'MC'), ', sample is', sample if isReHLT: print '-> re-HLT sample' if isDibosonInclusive: print '-> Pythia LO sample' #isData = False #-----------------------# # FILTERS # #-----------------------# # JSON filter import FWCore.PythonUtilities.LumiList as LumiList if isData: #process.source.lumisToProcess = LumiList.LumiList(filename = '%s/src/Analysis/ALPHA/data/JSON/Cert_271036-275125_13TeV_PromptReco_Collisions16_JSON.txt' % os.environ['CMSSW_BASE']).getVLuminosityBlockRange() #4.34 #process.source.lumisToProcess = LumiList.LumiList(filename = '%s/src/Analysis/ALPHA/data/JSON/Cert_271036-275783_13TeV_PromptReco_Collisions16_JSON.txt' % os.environ['CMSSW_BASE']).getVLuminosityBlockRange() #6.26 process.source.lumisToProcess = LumiList.LumiList( filename= '%s/src/Analysis/ALPHA/data/JSON/Cert_271036-276811_13TeV_PromptReco_Collisions16_JSON_NoL1T.txt' % os.environ['CMSSW_BASE']).getVLuminosityBlockRange() #12.9 process.counter = cms.EDAnalyzer( 'CounterAnalyzer', lheProduct=cms.InputTag( 'externalLHEProducer' if not isCustom else 'source'), pythiaLOSample=cms.bool(True if isDibosonInclusive else False), ) # Trigger filter import HLTrigger.HLTfilters.hltHighLevel_cfi triggerTag = 'HLT2' if isReHLT else 'HLT' process.HLTFilter = cms.EDFilter( 'HLTHighLevel',
## |_| \___/ \___/|_|____/ \___/ \__,_|_| \___\___| ## process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( $inputFileNames #'file:/hdfs/store/data/Run2012A/DoubleElectron/AOD/13Jul2012-v1/00000/FE1CBE0B-03DA-E111-A2AD-00266CFAE20C.root' ), #eventsToProcess = cms.untracked.VEventRange( #'193557:8215621', #'193557:35284992') ) #if not MC_flag: import FWCore.PythonUtilities.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes myLumis = LumiList.LumiList(filename = '/afs/hep.wisc.edu/home/anil79/TnP/CMSSW_5_3_5/src/PhysicsTools/TagAndProbe/test/Cert_190456-208686_8TeV_PromptReco_Collisions12_JSON.txt').getCMSSWString().split(',') process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange()) process.source.lumisToProcess.extend(myLumis) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.source.inputCommands = cms.untracked.vstring("keep *","drop *_MEtoEDMConverter_*_*") #process.load('RecoJets.JetProducers.kt4PFJets_cfi') #process.kt6PFJets = process.kt4PFJets.clone( rParam = 0.6, doRhoFastjet = True ) #process.kt6PFJets.Rho_EtaMax = cms.double(2.5) #process.JetsForRho = cms.Sequence( process.kt6PFJets ) ## ==== Fast Filters ==== process.goodVertexFilter = cms.EDFilter("VertexSelector",
process.source.firstRun = cms.untracked.uint32(int(runboundary)) process.maxEvents = cms.untracked.PSet( input=cms.untracked.int32(MAXEVENTSTEMPLATE)) ################################################################### # JSON Filtering ################################################################### if isMC: print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is simulation!" runboundary = 1 else: print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: This is real DATA!" if ('LUMILISTTEMPLATE'): print ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: JSON filtering with: LUMILISTTEMPLATE" import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList( filename='LUMILISTTEMPLATE').getVLuminosityBlockRange() ################################################################### # Messages ################################################################### process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.destinations = ['cout', 'cerr'] process.MessageLogger.cerr.FwkReport.reportEvery = 1000 #################################################################### # Produce the Transient Track Record in the event #################################################################### process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi") #################################################################### # Get the Magnetic Field
if not (options.job < theSample.MakeJobs(options.nFilesPerJob, options.output)): raise NameError( "Job %d is not in the list of the jobs of sample %s with %d files per run" % (options.job, options.sample, options.nFilesPerJob)) job = theSample.Jobs[options.job] process.source.fileNames.extend(job.Inputs) process.TFileService.fileName = job.Output process.maxEvents.input = options.maxEvents if theSample.IsData: import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList( filename=(process.TTll.SetupDir.value() + '/JSON.txt')).getVLuminosityBlockRange() process.GlobalTag.globaltag = '76X_dataRun2_v15' process.p = cms.Path(process.TTll) for v in range(0, 10): process.TTll.HLT.HLT_To_Or.append( 'HLT_Mu17_TrkIsoVVL_TkMu8_TrkIsoVVL_DZ_v%d' % (v)) process.TTll.HLT.HLT_To_Or.append( 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v%d' % (v)) else: process.GlobalTag.globaltag = '76X_dataRun2_16Dec2015_v0' #76X_mcRun2_asymptotic_RunIIFall15DR76_v1 from PhysicsTools.PatAlgos.producersLayer1.jetUpdater_cff import * process.patJetCorrFactorsReapplyJEC = updatedPatJetCorrFactors.clone( src=cms.InputTag("slimmedJets"), levels=['L1FastJet', 'L2Relative', 'L3Absolute'],
# do we need this? # process.load("RecoTracker.IterativeTracking.MuonSeededStep_cff") # process.load("RecoTracker.CkfPattern.GroupedCkfTrajectoryBuilder_cfi") # import RecoTracker.CkfPattern.GroupedCkfTrajectoryBuilder_cfi process.load("RecoTracker.CkfPattern.GroupedCkfTrajectoryBuilder_cff") process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(-1)) process.source = cms.Source( "PoolSource", fileNames=cms.untracked.vstring( '/store/data/Run2016E/RPCMonitor/RAW/v2/000/277/420/00000/6C537B3E-B052-E611-A44F-02163E013958.root' )) import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList( filename= '/afs/cern.ch/user/c/carrillo/efficiency/CMSSW_8_0_1/src/DQM/RPCMonitorModule/test/parallel/Cert_271036-284044_13TeV_PromptReco_Collisions16_JSON_NoL1T_MuonPhys.json' ).getVLuminosityBlockRange() process.dTandCSCSegmentsinTracks = cms.EDProducer( "DTandCSCSegmentsinTracks", cscSegments=cms.untracked.InputTag("hltCscSegments"), dt4DSegments=cms.untracked.InputTag("hltDt4DSegments"), tracks=cms.untracked.InputTag("standAloneMuons", "")) process.rpcPointProducer = cms.EDProducer( 'RPCPointProducer', incldt=cms.untracked.bool(True), inclcsc=cms.untracked.bool(True), incltrack=cms.untracked.bool(False), debug=cms.untracked.bool(False), rangestrips=cms.untracked.double(4.),
def customize(self,process): self.parse() isFwlite = False hasOutput = False hasTFile = False sp_unused = "" if hasattr(process,"fwliteInput"): isFwlite = True if not isFwlite: hasOutput = hasattr(process,"out") hasTFile = hasattr(process,"TFileService") if hasOutput and hasTFile: tfile = self.outputFile.replace(".root","_histos.root") else: tfile = self.outputFile if self.dryRun: import sys if self.dataset and self.dataset != "": name,xsec,totEvents,files,maxEvents,sp_unused = self.dataset if self.getMaxJobs: print "maxJobs:%d" % ( min(len(files),self.nJobs) ) if len(files) != 0: if isFwlite: print "hadd:%s" % self.outputFile else: if hasOutput: print "edm:%s" % self.outputFile if hasTFile or self.tfileOut: print "hadd:%s" % tfile ## sys.exit(0) else: sys.exit(1) files = self.inputFiles if self.dataset and self.dataset != "": dsetname,xsec,totEvents,files,maxEvents,sp_unused = self.dataset if type(xsec) == float or xsec == None: print print "Error: cross section not found for dataset %s" % dsetname print self.maxEvents = int(maxEvents) putarget = None samplepu = None if self.puTarget != "": putarget = map(float, self.puTarget.split(",")) processId = self.getProcessId(dsetname) self.processId = processId #---------- if self.options.processIndex != None: self.processIndex = self.options.processIndex else: # not specified on the command line, try to take it # from the cross section file, otherwise use smallest int32 as default value # in order not to confuse it with data (index 0) if isinstance(xsec, dict): self.processIndex = xsec.get('itype', -0x7FFFFFFF) else: # note that in some cases (process not defined in cross_sections.json ?) # this can still be a float self.processIndex = -0x7FFFFFFF #---------- if isinstance(xsec, dict) and "itype" in xsec: for name,obj in process.__dict__.iteritems(): if hasattr(obj, "sampleIndex"): obj.sampleIndex = xsec["itype"] isdata = self.processType == "data" if isdata or self.targetLumi > 0. or putarget: ## look for analyzers which have lumiWeight as attribute for name,obj in process.__dict__.iteritems(): if hasattr(obj,"lumiWeight"): if isdata: obj.lumiWeight = 1. else: wei = xsec["xs"]/float(totEvents)*self.targetLumi wei *= xsec.get("br",1.) wei *= xsec.get("kf",1.) obj.lumiWeight = wei if hasattr(obj,"intLumi"): if isdata: obj.intLumi= 0 # should not be used in final fits. # setting to 0 will cause error if someone tries to use #it for normalization downsteram else: obj.intLumi=self.targetLumi if putarget and not isdata: puObj = None if hasattr(obj,"puReWeight"): puObj = obj elif hasattr(obj,"globalVariables") and hasattr(obj.globalVariables,"puReWeight"): puObj = obj.globalVariables if puObj: if not samplepu: matches = filter(lambda x: x in dsetname, self.pu_distribs.keys() ) print matches if len(matches) > 1: print "Multiple matches, check if they're all the same" allsame = True for i in range(1,len(matches)): if self.pu_distribs[matches[0]] != self.pu_distribs[matches[i]]: allsame = False if allsame: print "They're all the same so we just take the 0th one:",matches[0] matches = [matches[0]] else: print "Not all the same... so we return to the old behavior and take an exact match, otherwise leave empty..." matches = filter(lambda x: x == dsetname, matches) if len(matches) != 1: raise Exception("Could not determine sample pu distribution for reweighting. Possible matches are [%s]. Selected [%s]\n dataset: %s" % ( ",".join(self.pu_distribs.keys()), ",".join(matches), dsetname ) ) samplepu = self.pu_distribs[matches[0]] puObj.puReWeight = True puObj.puBins = cms.vdouble( map(float, samplepu.probFunctionVariable) ) puObj.mcPu = samplepu.probValue puObj.dataPu = cms.vdouble(putarget) puObj.useTruePu = cms.bool(True) for name,obj in process.__dict__.iteritems(): if hasattr(obj,"processId"): obj.processId = str(processId) for name,obj in process.__dict__.iteritems(): if hasattr(obj,"processIndex"): obj.processIndex = int(self.processIndex) lumisToSkip = None if isdata: lumisToSkip = self.samplesMan.getLumisToSkip(dsetname) process.source.lumisToSkip = lumisToSkip.getVLuminosityBlockRange() if isdata and self.lumiMask != "": if isFwlite: sys.exit("Lumi mask not supported in FWlite",-1) import FWCore.PythonUtilities.LumiList as LumiList target = LumiList.LumiList(filename = self.lumiMask) if lumisToSkip: target = target.__sub__(lumisToSkip) process.source.lumisToProcess = target.getVLuminosityBlockRange() if isdata: print process.source.lumisToProcess flist = [] for f in files: if len(f.split(":",1))>1: flist.append(str(f)) else: flist.append(str("%s%s" % (self.filePrepend,f))) if len(flist) > 0: ## fwlite if isFwlite: ## process.fwliteInput.fileNames.extend([ str("%s%s" % (self.filePrepend,f)) for f in files]) process.fwliteInput.fileNames = flist ## full framework else: ## process.source.fileNames.extend([ str("%s%s" % (self.filePrepend,f)) for f in files]) process.source.fileNames = flist ## fwlite if isFwlite: process.fwliteInput.maxEvents = self.maxEvents process.fwliteOutput.fileName = self.outputFile ## full framework else: process.maxEvents.input = self.maxEvents if hasOutput: process.out.fileName = self.outputFile if hasTFile: process.TFileService.fileName = tfile if self.tfileOut: if hasTFile: print "Could not run with both TFileService and custom tfileOut" sys.exit(-1) name,attr = self.tfileOut setattr( getattr( process, name ), attr, tfile ) if self.dumpPython != "": from gzip import open pyout = open("%s.gz" % self.dumpPython,"w+") pyout.write( process.dumpPython() ) pyout.close()
Debug=cms.bool(options.Debug), InputRefitter=cms.bool(options.InputRefitter), DrawMagField=cms.bool(options.DrawMagField), PrintPosition=cms.bool(options.PrintPosition), PrintMatrix=cms.bool(options.PrintMatrix), CalculateESorigin=cms.bool(options.CalculateESorigin), CalculateESaxes=cms.bool(options.CalculateESaxes), OverwriteRotationM=cms.bool(options.OverwriteRotationM), StoreDetail=cms.bool(options.StoreDetail), ReSetRfromOutside=cms.bool(options.ReSetRfromOutside), e_xxlimit=cms.double(1.), e_yylimit=cms.double(1.), e_yxlimit=cms.double(1.), winlimit=cms.double(3.), Selected_idee=cms.uint32(0), Selected_RUNmin=cms.int32(0), Selected_RUNmax=cms.int32(0), DefaultESLocation=DefaultESLocation.clone(), MatrixElements=MatrixElementsTmp.clone(), ) ### Input JSON if options.JSONFilename != "": import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList( filename=options.JSONFilename).getVLuminosityBlockRange() process.load("RecoLocalCalo.EcalRecProducers.ecalPreshowerRecHit_cfi" ) # For ES ALCA RECO dataset process.p = cms.Path(process.ecalPreshowerRecHit * process.ESAlignmentTool)
options.parseArguments() process.source = cms.Source( "PoolSource", fileNames=cms.untracked.vstring(options.inputFiles), ) process.maxEvents = cms.untracked.PSet( input=cms.untracked.int32(options.maxEvents)) ##############JSON file############## import FWCore.PythonUtilities.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes process.source.lumisToProcess = CfgTypes.untracked( CfgTypes.VLuminosityBlockRange()) JSONfile = 'Cert_246908-258159_13TeV_PromptReco_Collisions15_25ns_JSON_v3.txt' myLumis = LumiList.LumiList(filename=JSONfile).getCMSSWString().split(',') process.source.lumisToProcess.extend(myLumis) #################################### ## SELECT WHAT DATASET YOU'RE RUNNING ON TRIGGER = "SingleMu" #TRIGGER="DoubleMu" ## ==== Fast Filters ==== process.goodVertexFilter = cms.EDFilter( "VertexSelector", src=cms.InputTag("offlinePrimaryVertices"), cut=cms.string("!isFake && ndof > 4 && abs(z) <= 25 && position.Rho <= 2"), filter=cms.bool(True), )
process.MessageLogger.cerr.FwkReport.limit = 99999999 configXsecs = { "MET_Run2015D_v4" : 1.0, } configNevents = { "MET_Run2015D_v4" :1, } usedXsec = configXsecs[SAMPLE] usedNevents = configNevents[SAMPLE] #*********************************** JSON file ****************************************************# # https://cms-service-dqm.web.cern.ch/cms-service-dqm/CAF/certification/Collisions15/13TeV/ # last modified 19-Oct-2015 import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename = 'Cert_246908-258750_13TeV_PromptReco_Collisions15_25ns_JSON.txt').getVLuminosityBlockRange() #*******************************************************************************************************# ### Hadronic and leptonic boson. process.load("ExoDiBosonResonances.EDBRCommon.leptonicZ_cff") process.load("ExoDiBosonResonances.EDBRCommon.hadronicZ_cff") process.load("ExoDiBosonResonances.EDBRCommon.hadronicZnu_cff") #process.load("ExoDiBosonResonances.EDBRCommon.leptonicW_cff") #process.load("ExoDiBosonResonances.EDBRCommon.hadronicW_cff") WBOSONCUT = "pt > 200. & sqrt(2.0*daughter(0).pt()*daughter(1).pt()*(1.0-cos(daughter(0).phi()-daughter(1).phi()))) > 50." ZBOSONCUT = "pt > 20. & 70. < mass < 110." process.leptonicVFilter = cms.EDFilter( "CandViewCountFilter", src = cms.InputTag("leptonicV"), minNumber = cms.uint32(1),
if config["RUNONMC"]: GT = '80X_mcRun2_asymptotic_2016_miniAODv2' elif not (config["RUNONMC"]): GT = '80X_dataRun2_Prompt_v8' print "*************************************** GLOBAL TAG *************************************************" print GT print "****************************************************************************************************" process.GlobalTag = GlobalTag(process.GlobalTag, GT) ######### read JSON file for data ########## if not (config["RUNONMC"]) and config["USEJSON"]: import FWCore.PythonUtilities.LumiList as LumiList import FWCore.ParameterSet.Types as CfgTypes process.source.lumisToProcess = CfgTypes.untracked( CfgTypes.VLuminosityBlockRange()) myLumis = LumiList.LumiList( filename=config["JSONFILE"]).getCMSSWString().split(',') process.source.lumisToProcess.extend(myLumis) ####### Redo Jet clustering sequence ########## betapar = cms.double(0.0) fatjet_ptmin = 100.0 from RecoJets.Configuration.RecoPFJets_cff import * from RecoJets.JetProducers.AnomalousCellParameters_cfi import * from RecoJets.JetProducers.PFJetParameters_cfi import * process.chs = cms.EDFilter("CandPtrSelector", src=cms.InputTag('packedPFCandidates'), cut=cms.string('fromPV')) process.ak4PFJetsCHS = ak4PFJetsCHS.clone(src='chs')
for entry in dasinfo['data']: if len(entry[entryTitle]) > 0: yield entry[entryTitle][0] def getSecondaryFiles(primaryFileList): import re secondaryFiles = [] for primaryFile in primaryFileList: lfn = re.search('/store/.*', primaryFile).group() query = 'parent file=%s' % lfn for entry in dasQuery(query, 'parent'): secondaryFiles.append(entry['name'].encode('ascii', 'ignore')) print secondaryFiles return secondaryFiles process.source.secondaryFileNames = cms.untracked.vstring( getSecondaryFiles(process.source.fileNames)) import FWCore.PythonUtilities.LumiList as LumiList #process.source.lumisToProcess = LumiList.LumiList(filename = '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions15/13TeV/Cert_246908-256869_13TeV_PromptReco_Collisions15_25ns_JSON.txt').getVLuminosityBlockRange() process.source.lumisToProcess = LumiList.LumiList( filename= '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions15/13TeV/Cert_246908-257599_13TeV_PromptReco_Collisions15_25ns_JSON.txt' ).getVLuminosityBlockRange() # Spit out filter efficiency at the end. process.options = cms.untracked.PSet(wantSummary=cms.untracked.bool(False))
def myLumiList(process): import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList( compactList = {"273158": [[1, 1279]], "273302": [[1, 459]], "273402": [[100, 292]], "273403": [[1, 53]], "273404": [[1, 18]], "273405": [[2, 25]], "273406": [[1, 112]], "273408": [[1, 6]], "273409": [[1, 309]], "273410": [[1, 90]], "273411": [[1, 29]], "273425": [[62, 352], [354, 733]], "273446": [[1, 33]], "273447": [[1, 113], [115, 412]], "273448": [[1, 391]], "273449": [[1, 214]], "273450": [[1, 214], [219, 647]], "273492": [[71, 71], [73, 282], [284, 325], [327, 338]], "273493": [[1, 233]], "273494": [[1, 192]], "273502": [[73, 256], [258, 318], [320, 813], [815, 1064]], "273503": [[1, 598]], "273554": [[77, 437]], "273555": [[1, 173]], "273725": [[83, 252], [254, 2545]], "273728": [[1, 100]], "273730": [[1, 1814], [1820, 2126]], "274094": [[108, 332]], "274146": [[1, 67]], "274159": [[1, 43]], "274160": [[1, 207]], "274161": [[1, 516]], "274172": [[31, 95]], "274198": [[81, 191]], "274199": [[1, 623]], "274200": [[1, 678]], "274240": [[1, 40], [42, 82]], "274241": [[1, 1152], [1161, 1176]], "274244": [[1, 607]], "274250": [[1, 701]], "274251": [[1, 546]], "274283": [[2, 19]], "274284": [[1, 210]], "274286": [[1, 154]], "274314": [[97, 97], [99, 158]], "274315": [[1, 424]], "274316": [[1, 959]], "274317": [[1, 3]], "274319": [[1, 225]], "274335": [[60, 1003]], "274336": [[1, 14]], "274337": [[3, 17]], "274338": [[1, 698]], "274339": [[1, 29], [31, 31], [33, 33], [35, 93]], "274344": [[1, 632]], "274345": [[1, 170]], "274382": [[94, 144]], "274387": [[88, 439]], "274388": [[1, 1820]], "274420": [[94, 268]], "274421": [[1, 342]], "274422": [[1, 2207]], "274440": [[92, 493]], "274441": [[1, 431]], "274442": [[1, 752]], "274954": [[37, 37], [39, 57]], "274955": [[1, 91]], "274968": [[1, 1192]], "274969": [[1, 1003]], "274970": [[1, 47]], "274971": [[1, 905]], "274998": [[64, 782]], "274999": [[1, 1241]], "275000": [[1, 136]], "275001": [[1, 1781], [1786, 2061]], "275059": [[78, 81], [105, 137]], "275066": [[1, 96]], "275067": [[1, 392]], "275068": [[1, 915]], "275073": [[1, 517]], "275074": [[1, 442], [444, 647]], "275124": [[106, 106], [108, 431]], "275125": [[1, 989]], "275282": [[91, 180]], "275283": [[1, 132]], "275284": [[1, 74]], "275290": [[96, 143]], "275291": [[1, 347]], "275292": [[1, 121]], "275293": [[1, 142], [144, 201]], "275309": [[55, 617]], "275310": [[1, 1929]], "275311": [[1, 1253]], "275319": [[141, 282]], "275337": [[1, 427]], "275338": [[1, 520]], "275344": [[76, 356]], "275345": [[1, 353]], "275370": [[81, 365]], "275371": [[1, 22], [28, 569]], "275375": [[127, 1449]], "275376": [[1, 2667], [2669, 3096]], "275657": [[1, 105]], "275658": [[1, 337]], "275659": [[1, 17]], "275761": [[1, 9]], "275767": [[1, 4]], "275772": [[1, 56]], "275773": [[1, 7]], "275774": [[1, 311], [315, 315]], "275776": [[1, 140]], "275777": [[1, 300]], "275778": [[1, 305]], "275782": [[1, 131], [133, 762]], "275832": [[1, 367]], "275833": [[1, 53], [56, 115], [117, 251]], "275834": [[1, 297]], "275835": [[1, 13]], "275836": [[1, 429], [431, 1163], [1166, 1170], [1184, 1293]], "275837": [[1, 186], [198, 726]], "275847": [[1, 2263]], "275886": [[73, 109]], "275890": [[1, 1393]], "275911": [[62, 298], [300, 354], [356, 440]], "275912": [[1, 289]], "275913": [[1, 475]], "275918": [[1, 318], [348, 361]], "275920": [[5, 463]], "275921": [[1, 2], [4, 5], [17, 20]], "275923": [[3, 53], [63, 64], [66, 126]], "275931": [[1, 14], [19, 89]], "275963": [[82, 139], [141, 172]], "276092": [[74, 149]], "276097": [[1, 507]], "276242": [[1, 7], [18, 61], [72, 1664]], "276243": [[1, 15], [18, 480], [482, 611]], "276244": [[3, 1202]], "276282": [[75, 534], [537, 1142]], "276283": [[3, 1087]], "276315": [[40, 175], [178, 217]], "276317": [[3, 138]], "276318": [[3, 103], [106, 570]], "276355": [[1, 33]], "276361": [[1, 161], [169, 208], [210, 800], [802, 833]], "276363": [[1, 140], [142, 238], [242, 1482]], "276384": [[2, 1117]], "276437": [[63, 224], [227, 1074], [1076, 2190]], "276454": [[1, 527]], "276458": [[1, 341]], "276495": [[87, 268]], "276501": [[4, 221], [223, 2547]], "276502": [[2, 741]], "276525": [[88, 469], [471, 1606], [1626, 2893]], "276527": [[1, 214]], "276528": [[4, 394]], "276542": [[74, 857]], "276543": [[1, 638], [643, 952]], "276544": [[2, 161]], "276545": [[2, 110], [117, 213]], "276581": [[79, 444]], "276582": [[1, 871]], "276583": [[1, 52]], "276584": [[1, 2]], "276585": [[1, 238], [241, 242], [245, 246]], "276586": [[2, 658], [680, 773]], "276587": [[1, 1006]], "276653": [[72, 550]], "276655": [[1, 593], [595, 1106]], "276659": [[1, 127], [129, 252]], "276775": [[96, 1260]], "276776": [[1, 1823]], "276794": [[1, 885]], "276807": [[66, 220]], "276808": [[1, 875]], "276810": [[1, 287]], "276811": [[1, 1270], [1272, 2563]], "276831": [[64, 755], [761, 2702]], "276834": [[1, 720]], "276870": [[78, 1354], [1356, 3108], [3111, 3258], [3260, 3484]], "276935": [[79, 184], [186, 838], [842, 906]], "276940": [[70, 213]], "276946": [[1, 27]], "276947": [[1, 89], [91, 126], [135, 141]], "276948": [[1, 474]], "276950": [[1, 2353]], "277069": [[81, 265], [267, 390]], "277070": [[1, 309], [311, 1059]], "277071": [[1, 82], [90, 178]], "277072": [[1, 253], [256, 466]], "277073": [[1, 90]], "277076": [[1, 3], [5, 7], [9, 35], [38, 1037]], "277087": [[204, 1191]], "277094": [[1, 161], [164, 584]], "277096": [[1, 1309], [1311, 2086]], "277112": [[1, 155]], "277126": [[42, 59]], "277127": [[1, 438], [440, 902]], "277148": [[83, 190], [193, 700]], "277166": [[77, 186], [188, 431]], "277168": [[1, 1708], [1711, 1822], [1824, 2223]], "277180": [[88, 228]], "277194": [[113, 139], [144, 497], [500, 1115], [1117, 1312], [1320, 1749], [1754, 2067], [2070, 2070]], "277305": [[62, 744]], "277420": [[84, 84], [86, 291], [293, 346]], "277981": [[82, 83], [85, 163]], "277991": [[1, 98]], "277992": [[1, 260], [262, 312]], "278017": [[77, 97], [99, 213], [215, 512], [514, 589]], "278018": [[1, 263], [265, 422], [424, 615], [617, 627], [642, 1011], [1020, 1181]], "278167": [[87, 394], [397, 1153], [1155, 1660], [1662, 1707], [1709, 2258]], "278175": [[1, 88]], "278193": [[77, 231]], "278239": [[76, 339], [341, 558], [560, 740]], "278240": [[1, 64], [70, 113], [115, 1121], [1123, 1296], [1299, 1309]], "278273": [[75, 110]], "278274": [[1, 18], [20, 85]], "278288": [[67, 81]], "278289": [[1, 42], [44, 52]], "278290": [[1, 11]], "278308": [[87, 216], [219, 587], [589, 680], [683, 1200], [1217, 1410], [1413, 1848], [1880, 1880]], "278310": [[1, 32], [34, 709]], "278315": [[73, 254], [256, 661], [663, 767]], "278345": [[84, 500], [503, 831]], "278346": [[1, 117]], "278349": [[1, 401], [403, 612], [632, 633]], "278366": [[1, 453]], "278406": [[85, 360], [362, 1682]], "278509": [[91, 1557]], "278769": [[75, 104]], "278770": [[1, 767]], "278801": [[48, 85]], "278802": [[1, 17]], "278803": [[1, 87], [91, 133], [135, 297], [299, 323]], "278804": [[1, 4]], "278805": [[3, 26], [30, 167], [170, 193], [196, 280], [283, 284], [288, 288]], "278808": [[1, 445], [447, 462], [464, 1793]], "278820": [[17, 1533]], "278822": [[1, 1627]], "278873": [[70, 129]], "278874": [[1, 273], [275, 478]], "278875": [[1, 210], [212, 834]], "278923": [[55, 467]], "278957": [[79, 227]], "278962": [[68, 408]], "278963": [[1, 23], [25, 175]], "278969": [[70, 511], [514, 1051], [1053, 1291], [1293, 1397], [1399, 1460]], "278975": [[1, 475], [477, 745], [747, 850]], "278976": [[1, 20]], "278986": [[71, 199]], "279024": [[82, 382]], "279029": [[1, 260]], "279071": [[71, 244]], "279080": [[68, 224]], "279115": [[118, 524]], "279116": [[38, 485]]} ).getVLuminosityBlockRange() return process
def unpackAndMergeFiles(datasetpath,prefix,castor): ### pwd = os.getenv("PWD") minRun = 0 maxRun = 0 sampleName = "None" ## Verify that CRAB directory exists pathCrabFull = "" pathCrabShort = "" for fname in os.listdir(prefix+datasetpath): if re.search("crab_0_",fname)!=None: print fname if pathCrabFull == "": pathCrabFull = prefix+datasetpath+"/"+fname pathCrabShort = fname else: print "ERROR: More than one CRAB directory exists in",prefix+datasetpath print " Only one is allowed!" os.abort() ## Unpack and merge the results if pathCrabFull != "" : #Get min and max number of analysed runs jsonFile = prefix+datasetpath+"/goodRuns.json" jsonList = LumiList(filename = jsonFile) runList = jsonList.getRuns() minRun = int(runList[0]) maxRun = int(runList[len(runList)-1]) ## Create TEMP dir pathTMP = "/tmp/"+os.getenv("USER")+"/_HADD_TMP_/" os.system("rm -rf /tmp/${USER}/_HADD_TMP_") os.system("mkdir -p "+pathTMP+prefix+datasetpath) pathCrabResults = pathCrabFull+"/res/" pathCrabResultsTMP = pathTMP+prefix+datasetpath+"/"+pathCrabShort+"/res/" print "CRAB results from:",pathCrabResults," will be unpacked here:",pathCrabResultsTMP #Copy CRAB directory to TEMP dir os.system("cp -r "+prefix+"/. "+pathTMP+prefix+"/.") ## Copy all but .tgz files (if any) ##os.system("cd "+pathCrabResults+";for i in efficiencyTree_*.root rawMonitor_*.root synchroAnalysis_*.root crab_*.xml CMSSW_*.stdout CMSSW_*.stderr ; do cp $i /tmp/${USER}/_HADD_TMP_; done; ls -lart ; cd -") ## Extract .tgz files (if any) ##os.system("cd "+pathCrabResults+";for i in out_files_*.tgz; do tar -xzvf $i -C /tmp/${USER}/_HADD_TMP_; done; ls -lart ; cd -") os.system("cd "+pathCrabResultsTMP+";for i in out_files_*.tgz; do tar -xzvf $i -C "+pathCrabResultsTMP+"; done; ls -lart ; cd -") ## Get missing CRAB job outputs (if any) ## After this step all out_files_*tgz will disappear from TMP dir os.system("cd "+pathTMP+prefix+datasetpath+"; crab -status") os.system("cd "+pathTMP+prefix+datasetpath+"; crab -get all") ## Get lumi summary report ## NOTE: 'crab -status' and 'crab -get all steps' are essential ## The lumiSummary.json is created in the original submit dir... os.system("cd "+pathTMP+prefix+datasetpath+"; crab -report") ##Files to merge jsonFileName = "GoodRuns_"+str(minRun)+"-"+str(maxRun)+".json" jsonFileNameLumiSummary = "lumiSummary-"+str(minRun)+"-"+str(maxRun)+".json" sampleName = "efficiencyTree-"+str(minRun)+"-"+str(maxRun)+".root" sampleName2 = "efficiencyHelper-"+str(minRun)+"-"+str(maxRun)+".root" sampleName3 = "synchroAnalysis-"+str(minRun)+"-"+str(maxRun)+".root" sampleName4 = "rawMonitor-"+str(minRun)+"-"+str(maxRun)+".root" sampleName5 = "l1demon-"+str(minRun)+"-"+str(maxRun)+".root" sampleName6 = "out-"+str(minRun)+"-"+str(maxRun)+".txt" print "Doing hadd for ",sampleName os.system("cd "+pathCrabResultsTMP+"; hadd /tmp/${USER}/_HADD_TMP_/"+sampleName+" efficiencyTree_*.root") print "Doing hadd for ",sampleName2 os.system("cd "+pathCrabResultsTMP+"; hadd /tmp/${USER}/_HADD_TMP_/"+sampleName2+" efficiencyHelper_*.root") print "Doing hadd for ",sampleName3 os.system("cd "+pathCrabResultsTMP+"; hadd /tmp/${USER}/_HADD_TMP_/"+sampleName3+" synchroAnalysis_*.root") print "Doing hadd for ",sampleName4 os.system("cd "+pathCrabResultsTMP+"; hadd /tmp/${USER}/_HADD_TMP_/"+sampleName4+" rawMonitor_*.root ; ls -lart") print "Doing hadd for ",sampleName5 os.system("cd "+pathCrabResultsTMP+"; hadd /tmp/${USER}/_HADD_TMP_/"+sampleName5+" l1demon_*.root ; ls -lart") print "Preparing out.txt" os.system("cd "+pathCrabResultsTMP+"; rm -f /tmp/${USER}/_HADD_TMP_/"+sampleName6+"; cat C*.stdout|grep -i lb|grep -i mean >> /tmp/${USER}/_HADD_TMP_/"+sampleName6) ##Copy results to TMP destination print "Copying final results to ",pathTMP+prefix,"/ROOT" os.system("mkdir -p "+pathTMP+prefix+"/ROOT") os.system("cp "+prefix+datasetpath+"/goodRuns.json"+" "+pathTMP+prefix+"/ROOT/"+jsonFileName) os.system("cp "+pathCrabResults+"/lumiSummary.json"+" "+pathTMP+prefix+"/ROOT/"+jsonFileNameLumiSummary) os.system("cp "+pathTMP+sampleName+" "+pathTMP+prefix+"/ROOT/") os.system("cp "+pathTMP+sampleName2+" "+pathTMP+prefix+"/ROOT/") os.system("cp "+pathTMP+sampleName3+" "+pathTMP+prefix+"/ROOT/") os.system("cp "+pathTMP+sampleName4+" "+pathTMP+prefix+"/ROOT/") os.system("cp "+pathTMP+sampleName5+" "+pathTMP+prefix+"/ROOT/") os.system("gzip "+pathTMP+sampleName6+"; cp "+pathTMP+sampleName6+".gz "+pathTMP+prefix+"/ROOT/") ##Copy results to final destination print "Copying final results to ",prefix,"/ROOT" os.system("mkdir -p "+prefix+"/ROOT") os.system("cp "+prefix+datasetpath+"/goodRuns.json"+" "+ prefix+"/ROOT/"+jsonFileName) os.system("cp "+pathCrabResults+"/lumiSummary.json"+" "+ prefix+"/ROOT/"+jsonFileNameLumiSummary) os.system("cp /tmp/${USER}/_HADD_TMP_/"+sampleName+" "+prefix+"/ROOT/") os.system("cp /tmp/${USER}/_HADD_TMP_/"+sampleName2+" "+prefix+"/ROOT/") os.system("cp /tmp/${USER}/_HADD_TMP_/"+sampleName3+" "+prefix+"/ROOT/") os.system("cp /tmp/${USER}/_HADD_TMP_/"+sampleName4+" "+prefix+"/ROOT/") os.system("cp /tmp/${USER}/_HADD_TMP_/"+sampleName5+" "+prefix+"/ROOT/") os.system("gzip /tmp/${USER}/_HADD_TMP_/"+sampleName6+"; cp /tmp/${USER}/_HADD_TMP_/"+sampleName6+".gz "+prefix+"/ROOT/") ##Remove trash from tmp os.system("rm -rf /tmp/${USER}/_HADD_TMP_/*.root") os.system("rm -rf /tmp/${USER}/_HADD_TMP_/out*.txt.gz") ##Copy crab files to CASTOR archiveName = (prefix+datasetpath)[2:] archiveName = archiveName.replace("/","_") archiveDir = archiveName[:-1]+"-"+str(minRun)+"-"+str(maxRun) archiveName = archiveDir+".tar.gz" os.system("cd "+pathTMP+"; tar -cvzf "+pathTMP+archiveName+" "+pathTMP+prefix+datasetpath+"/*") castor2 = castor+"/"+archiveDir+"/" print "Copying archive",archiveName,"to CASTOR path: ",castor2 os.system("rfmkdir "+castor2) command = "cd "+pathTMP+"; rfcp "+archiveName+" "+castor2+"; cd -" os.system(command) print "Copying merged data",sampleName,"to CASTOR path: ",castor2 command = "cd "+pathTMP+prefix+"/ROOT/; rfcp "+sampleName+" "+castor2+"; cd -" os.system(command) print "Copying merged data",sampleName2,"to CASTOR path: ",castor2 command = "cd "+pathTMP+prefix+"/ROOT/; rfcp "+sampleName2+" "+castor2+"; cd -" os.system(command) print "Copying merged data",sampleName3,"to CASTOR path: ",castor2 command = "cd "+pathTMP+prefix+"/ROOT/; rfcp "+sampleName3+" "+castor2+"; cd -" os.system(command) print "Copying merged data",sampleName4,"to CASTOR path: ",castor2 command = "cd "+pathTMP+prefix+"/ROOT/; rfcp "+sampleName4+" "+castor2+"; cd -" os.system(command) print "Copying merged data",sampleName5,"to CASTOR path: ",castor2 command = "cd "+pathTMP+prefix+"/ROOT/; rfcp "+sampleName5+" "+castor2+"; cd -" os.system(command) print "Copying merged data",sampleName6+".gz","to CASTOR path: ",castor2 command = "cd "+pathTMP+prefix+"/ROOT/; rfcp "+sampleName6+".gz "+castor2+"; cd -" os.system(command) print "Copying JSON files:",jsonFileName,",",jsonFileNameLumiSummary,"to CASTOR path: ",castor2 command = "cd "+pathTMP+prefix+"/ROOT/; rfcp "+jsonFileName+" "+jsonFileNameLumiSummary+" "+castor2+"; cd -" os.system(command) # Remove TEMP DIR os.system("rm -rf /tmp/${USER}/_HADD_TMP_") print "Done. "+'\033[93m'+"Please remove "+prefix+datasetpath+" directory manualy!"+'\033[0m'
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(-1)) # # supply processor with input files if len(sys.argv) < 4: # only one file in the list process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(inputList)) else: # many files in the list process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(*inputList)) # # JSON (good luminosity sections), only if processing data if flag_mc == 0: goodJSON = 'data/Cert_160404-180252_7TeV_ReRecoNov08_Collisions11_JSON.txt' myLumis = LumiList.LumiList(filename=goodJSON).getCMSSWString().split(',') process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange() process.source.lumisToProcess.extend(myLumis) # # Load jet correction services for all jet algoritms process.load( "JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff") # # all is ready: pass all arguments to Analyzer (C++ code in src/Analyzer.cc) process.demo = cms.EDAnalyzer('Analyzer', outFile=cms.string(outFile), mc=CfgTypes.int32(flag_mc), reco=CfgTypes.int32(flag_reco), gen=CfgTypes.int32(flag_gen)) process.p = cms.Path(process.demo) #