diff --git a/Configuration/DataProcessing/python/Merge.py b/Configuration/DataProcessing/python/Merge.py index 61f96599a9ae4..c5d416286c3e2 100644 --- a/Configuration/DataProcessing/python/Merge.py +++ b/Configuration/DataProcessing/python/Merge.py @@ -10,6 +10,7 @@ from FWCore.ParameterSet.Config import Process, EndPath from FWCore.ParameterSet.Modules import OutputModule, Source, Service +from Configuration.EventContent.EventContent_cff import NANOAODEventContent import FWCore.ParameterSet.Types as CfgTypes @@ -38,7 +39,7 @@ def mergeProcess(*inputFiles, **options): outputLFN = options.get("output_lfn", None) dropDQM = options.get("drop_dqm", False) newDQMIO = options.get("newDQMIO", False) - + mergeNANO = options.get("mergeNANO", False) # // # // build process #// @@ -63,8 +64,11 @@ def mergeProcess(*inputFiles, **options): #// if newDQMIO: outMod = OutputModule("DQMRootOutputModule") + elif mergeNANO: + outMod = OutputModule("NanoAODOutputModule",NANOAODEventContent.clone()) else: outMod = OutputModule("PoolOutputModule") + outMod.fileName = CfgTypes.untracked.string(outputFilename) if outputLFN != None: outMod.logicalFileName = CfgTypes.untracked.string(outputLFN) diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index 406605de1d33a..25b712711f0a3 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -222,7 +222,7 @@ # reminiAOD wf on 2016H 80X input workflows[136.7721] = ['',['RunJetHT2016H_reminiaod','REMINIAOD_data2016','HARVESTDR2_REMINIAOD_data2016']] # nanoAOD wf on 2016H 80X input -workflows[136.7722] = ['',['RunJetHT2016H_nano','NANOEDM2016_80X']] +workflows[136.7722] = ['',['RunJetHT2016H_nano','NANOEDM2016_80X','HARVESTNANOAOD2016_80X']] ### run 2017B ### workflows[136.780] = ['',['RunHLTPhy2017B','HLTDR2_2017','RECODR2_2017reHLT_Prompt','HARVEST2017']] @@ -378,11 +378,10 @@ # nanoaod wf without intermediate EDM, starting from existing MINIAOD inputs workflows[1325.6] = ['', ['TTbar_13_94XNanoAODINPUT','NANOAODMC2017']] # nanoaod wf with intermediate EDM and merge step, starting from existing MINIAOD inputs -workflows[1325.7] = ['', ['TTbar_13_94XNanoAODINPUT','NANOEDMMC2017']] -workflows[1325.8] = ['', ['TTbar_13_92XNanoAODINPUT','NANOEDMMC2017_92X']] +workflows[1325.7] = ['', ['TTbar_13_94XNanoAODINPUT','NANOEDMMC2017','HARVESTNANOAODMC2017']] +workflows[1325.8] = ['', ['TTbar_13_92XNanoAODINPUT','NANOEDMMC2017_92X','HARVESTNANOAODMC2017_92X']] #using ZEE as I cannot find TT at CERN -workflows[1329.1] = ['', ['ZEE_13_80XNanoAODINPUT','NANOEDMMC2016_80X']] - +workflows[1329.1] = ['', ['ZEE_13_80XNanoAODINPUT','NANOEDMMC2016_80X','HARVESTNANOAODMC2016_80X']] workflows[1326] = ['', ['WE_13','DIGIUP15','RECOUP15','HARVESTUP15']] diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 05d70f6d35992..8a6781b040d6e 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -711,7 +711,7 @@ def genS(fragment,howMuch): hiDefaults2018=merge([hiAlca2018,{'--scenario':'HeavyIons','-n':2}]) steps['HydjetQ_B12_5020GeV_2011']=merge([{'-n':1,'--beamspot':'RealisticHI2011Collision'},hiDefaults2011,genS('Hydjet_Quenched_B12_5020GeV_cfi',U2000by1)]) -steps['HydjetQ_B12_5020GeV_2015']=merge([{'-n':1,'--beamspot':'RealisticHICollision2015'},hiDefaults2015,genS('Hydjet_Quenched_B12_5020GeV_cfi',U2000by1)]) +steps['HydjetQ_B12_5020GeV_2015']=merge([{'-n':1,'--beamspot':'RealisticHICollisionFixZ2015'},hiDefaults2015,genS('Hydjet_Quenched_B12_5020GeV_cfi',U2000by1)]) steps['HydjetQ_MinBias_XeXe_5442GeV_2017']=merge([{'-n':1},hiDefaults2017,gen2017('Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi',U2000by1)]) steps['HydjetQ_B12_5020GeV_2018']=merge([{'-n':1},hiDefaults2018,gen2017('Hydjet_Quenched_B12_5020GeV_cfi',U2000by1)]) @@ -2020,6 +2020,14 @@ def gen2018HiMix(fragment,howMuch): steps['NANOEDM2017_92X'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'}, steps['NANOEDM2017'] ]) steps['NANOEDM2016_80X'] = merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'}, steps['NANOEDM2017'] ]) +steps['HARVESTNANOAODMC2017']=merge([{'-s':'HARVESTING:@nanoAODDQM','--conditions': 'auto:phase1_2017_realistic','--era': 'Run2_2017'},steps['HARVESTUP15']]) +steps['HARVESTNANOAODMC2017_92X']=merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'},steps['HARVESTNANOAODMC2017']]) +steps['HARVESTNANOAODMC2016_80X']=merge([{'--conditions': 'auto:run2_mc','--era': 'Run2_2016,run2_miniAOD_80XLegacy'},steps['HARVESTNANOAODMC2017']]) + +steps['HARVESTNANOAOD2017']=merge([{'--data':'','-s':'HARVESTING:@nanoAODDQM','--conditions':'auto:run2_data_relval','--era':'Run2_2017'},steps['HARVESTDR2']]) +steps['HARVESTNANOAOD2017_92X']=merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'},steps['HARVESTNANOAOD2017']]) +steps['HARVESTNANOAOD2016_80X']=merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'},steps['HARVESTNANOAOD2017']]) + steps['NANOMERGE'] = { '-s': 'ENDJOB', '-n': 1000 , '--eventcontent' : 'NANOAODSIM','--datatier': 'NANOAODSIM', '--conditions': 'auto:run2_mc' } ################################################################################# diff --git a/Configuration/StandardSequences/python/Mixing.py b/Configuration/StandardSequences/python/Mixing.py index c42bc38a558a1..02cc229f5def7 100644 --- a/Configuration/StandardSequences/python/Mixing.py +++ b/Configuration/StandardSequences/python/Mixing.py @@ -22,21 +22,21 @@ def addMixingScenario(label,dict): addMixingScenario("E10TeV_L21E31_BX432",{'file': 'SimGeneral.MixingModule.mix_E10TeV_L21E31_BX432_cfi'}) addMixingScenario("E14TeV_L10E33_BX2808",{'file': 'SimGeneral.MixingModule.mix_E14TeV_L10E33_BX2808_cfi'}) addMixingScenario("E14TeV_L28E32_BX2808",{'file': 'SimGeneral.MixingModule.mix_E14TeV_L28E32_BX2808_cfi'}) -addMixingScenario("E7TeV_AVE_01_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 25, 'B': (-5,3), 'N': 0.1}) -addMixingScenario("E7TeV_AVE_02_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 25, 'B': (-5,3), 'N': 0.2}) -addMixingScenario("E7TeV_AVE_05_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 25, 'B': (-5,3), 'N': 0.5}) -addMixingScenario("E7TeV_AVE_1_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 25, 'B': (-5,3), 'N': 1.}) -addMixingScenario("E7TeV_AVE_2_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 25, 'B': (-5,3), 'N': 2.}) -addMixingScenario("E7TeV_AVE_5_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 25, 'B': (-5,3), 'N': 5.}) -addMixingScenario("E7TeV_AVE_10_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 25, 'B': (-5,3), 'N': 10.}) -addMixingScenario("E7TeV_AVE_20_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 25, 'B': (-5,3), 'N': 20.}) -addMixingScenario("E7TeV_AVE_50_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 25, 'B': (-5,3), 'N': 50.}) -addMixingScenario("E7TeV_AVE_1_BX156",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 450, 'B': (-5,3), 'N': 1.}) -addMixingScenario("E7TeV_AVE_2_BX156",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 450, 'B': (-5,3), 'N': 2.}) -addMixingScenario("E7TeV_AVE_3_BX156",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 450, 'B': (-5,3), 'N': 3.}) -addMixingScenario("E7TeV_AVE_5_BX156",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 450, 'B': (-5,3), 'N': 5.}) -addMixingScenario("E7TeV_AVE_2_8_BX_50ns",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 50, 'B': (-3,2), 'N': 2.8}) -addMixingScenario("E7TeV_AVE_2_8_BXgt50ns_intime_only",{'file': 'SimGeneral.MixingModule.mix_POISSON_avergage_cfi', 'BX': 450, 'B': (0,0), 'N': 2.8}) +addMixingScenario("E7TeV_AVE_01_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 25, 'B': (-5,3), 'N': 0.1}) +addMixingScenario("E7TeV_AVE_02_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 25, 'B': (-5,3), 'N': 0.2}) +addMixingScenario("E7TeV_AVE_05_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 25, 'B': (-5,3), 'N': 0.5}) +addMixingScenario("E7TeV_AVE_1_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 25, 'B': (-5,3), 'N': 1.}) +addMixingScenario("E7TeV_AVE_2_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 25, 'B': (-5,3), 'N': 2.}) +addMixingScenario("E7TeV_AVE_5_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 25, 'B': (-5,3), 'N': 5.}) +addMixingScenario("E7TeV_AVE_10_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 25, 'B': (-5,3), 'N': 10.}) +addMixingScenario("E7TeV_AVE_20_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 25, 'B': (-5,3), 'N': 20.}) +addMixingScenario("E7TeV_AVE_50_BX2808",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 25, 'B': (-5,3), 'N': 50.}) +addMixingScenario("E7TeV_AVE_1_BX156",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 450, 'B': (-5,3), 'N': 1.}) +addMixingScenario("E7TeV_AVE_2_BX156",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 450, 'B': (-5,3), 'N': 2.}) +addMixingScenario("E7TeV_AVE_3_BX156",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 450, 'B': (-5,3), 'N': 3.}) +addMixingScenario("E7TeV_AVE_5_BX156",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 450, 'B': (-5,3), 'N': 5.}) +addMixingScenario("E7TeV_AVE_2_8_BX_50ns",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 50, 'B': (-3,2), 'N': 2.8}) +addMixingScenario("E7TeV_AVE_2_8_BXgt50ns_intime_only",{'file': 'SimGeneral.MixingModule.mix_POISSON_average_cfi', 'BX': 450, 'B': (0,0), 'N': 2.8}) addMixingScenario("E7TeV_FIX_1_BX156",{'file': 'SimGeneral.MixingModule.mix_FIX_average_cfi', 'BX': 450, 'B': (-5,3), 'N': 1}) addMixingScenario("E7TeV_FIX_2_BX156",{'file': 'SimGeneral.MixingModule.mix_FIX_average_cfi', 'BX': 450, 'B': (-5,3), 'N': 2}) addMixingScenario("E7TeV_FIX_3_BX156",{'file': 'SimGeneral.MixingModule.mix_FIX_average_cfi', 'BX': 450, 'B': (-5,3), 'N': 3}) diff --git a/Configuration/StandardSequences/python/VtxSmeared.py b/Configuration/StandardSequences/python/VtxSmeared.py index 2126e995c7d61..ca2359c60587e 100644 --- a/Configuration/StandardSequences/python/VtxSmeared.py +++ b/Configuration/StandardSequences/python/VtxSmeared.py @@ -46,11 +46,13 @@ 'Shifted15mmCollision2015' : 'IOMC.EventVertexGenerators.VtxSmearedShifted15mmCollision2015_cfi', 'NominalCollision2015' : 'IOMC.EventVertexGenerators.VtxSmearedNominalCollision2015_cfi', 'NominalHICollision2015': 'IOMC.EventVertexGenerators.VtxSmearedNominalHICollision2015_cfi', - 'RealisticHICollision2015': 'IOMC.EventVertexGenerators.VtxSmearedRealisticHICollision2015_cfi', + 'RealisticHICollisionFixZ2015': 'IOMC.EventVertexGenerators.VtxSmearedRealisticHICollisionFixZ2015_cfi', + 'RealisticXeXeCollision2017': 'IOMC.EventVertexGenerators.VtxSmearedRealisticXeXeCollision2017_cfi', 'ZeroTeslaRun247324Collision' : 'IOMC.EventVertexGenerators.VtxSmearedZeroTeslaRun247324Collision_cfi', 'Realistic50ns13TeVCollisionZeroTesla': 'IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollisionZeroTesla_cfi', 'Realistic50ns13TeVCollision': 'IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi', 'Nominal5TeVpp2015Collision': 'IOMC.EventVertexGenerators.VtxSmearedNominal5TeVpp2015Collision_cfi', + 'Realistic5TeVppCollision2017': 'IOMC.EventVertexGenerators.VtxSmearedRealistic5TeVppCollision2017_cfi', 'Realistic25ns13TeV2016Collision': 'IOMC.EventVertexGenerators.VtxSmearedRealistic25ns13TeV2016Collision_cfi', 'Realistic100ns13TeVCollisionBetaStar90m' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic100ns13TeVCollisionBetaStar90m_cfi', 'Realistic100ns13TeVCollisionBetaStar90mLowBunches' : 'IOMC.EventVertexGenerators.VtxSmearedRealistic100ns13TeVCollisionBetaStar90mLowBunches_cfi', diff --git a/DQMOffline/Configuration/python/autoDQM.py b/DQMOffline/Configuration/python/autoDQM.py index a62ae8e8d6b76..9cbc8fd634901 100644 --- a/DQMOffline/Configuration/python/autoDQM.py +++ b/DQMOffline/Configuration/python/autoDQM.py @@ -41,9 +41,9 @@ 'express': ['@commonSiStripZeroBias+@muon+@hcal+@jetmet+@ecal', 'PostDQMOffline', '@commonSiStripZeroBias+@muon+@hcal+@jetmet+@ecal'], - 'allForPrompt': ['@common+@muon+@hcal+@jetmet+@ecal', + 'allForPrompt': ['@common+@muon+@hcal+@jetmet+@ecal+@egamma', 'PostDQMOffline', - '@common+@muon+@hcal+@jetmet+@ecal'], + '@common+@muon+@hcal+@jetmet+@ecal+@egamma'], 'miniAODDQM': ['DQMOfflineMiniAOD', 'PostDQMOfflineMiniAOD', 'DQMHarvestMiniAOD'], diff --git a/DQMOffline/Trigger/python/LepHTMonitor_cff.py b/DQMOffline/Trigger/python/LepHTMonitor_cff.py index aa19531721dac..8e1818cc11fe4 100644 --- a/DQMOffline/Trigger/python/LepHTMonitor_cff.py +++ b/DQMOffline/Trigger/python/LepHTMonitor_cff.py @@ -187,8 +187,7 @@ from DQMOffline.Trigger.HLTEGTnPMonitor_cfi import egmGsfElectronIDsForDQM -LepHTMonitor = cms.Sequence( egmGsfElectronIDsForDQM # Use of electron VID requires this module being executed first - + DQMOffline_Ele15_HT600 +LepHTMonitor = cms.Sequence( DQMOffline_Ele15_HT600 + DQMOffline_Ele15_HT450 + DQMOffline_Ele50_HT450 + DQMOffline_Mu15_HT600 @@ -199,7 +198,8 @@ + DQMOffline_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ + DQMOffline_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350 + DQMOffline_DoubleMu4_Mass8_PFHT350 - + DQMOffline_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350 + + DQMOffline_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350, + cms.Task(egmGsfElectronIDsForDQM) # Use of electron VID requires this module being executed first ) LepHTClient = cms.Sequence( DQMOffline_LepHT_POSTPROCESSING ) diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index 13f835ea7b14a..7a0a091a62360 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -187,7 +187,7 @@ class GsfElectron : public RecoCandidate float ctfGsfOverlap() const { return core()->ctfGsfOverlap() ; } bool ecalDrivenSeed() const { return core()->ecalDrivenSeed() ; } bool trackerDrivenSeed() const { return core()->trackerDrivenSeed() ; } - SuperClusterRef parentSuperCluster() const { return core()->parentSuperCluster() ; } + virtual SuperClusterRef parentSuperCluster() const { return core()->parentSuperCluster() ; } // backward compatibility struct ClosestCtfTrack @@ -198,8 +198,8 @@ class GsfElectron : public RecoCandidate ClosestCtfTrack( TrackRef track, float sh ) : ctfTrack(track), shFracInnerHits(sh) {} } ; float shFracInnerHits() const { return core()->ctfGsfOverlap() ; } - TrackRef closestCtfTrackRef() const { return core()->ctfTrack() ; } - ClosestCtfTrack closestCtfTrack() const { return ClosestCtfTrack(core()->ctfTrack(),core()->ctfGsfOverlap()) ; } + virtual TrackRef closestCtfTrackRef() const { return core()->ctfTrack() ; } + virtual ClosestCtfTrack closestCtfTrack() const { return ClosestCtfTrack(core()->ctfTrack(),core()->ctfGsfOverlap()) ; } private: diff --git a/DataFormats/PatCandidates/interface/Electron.h b/DataFormats/PatCandidates/interface/Electron.h index d70ea3c40d39c..fae566272aeed 100644 --- a/DataFormats/PatCandidates/interface/Electron.h +++ b/DataFormats/PatCandidates/interface/Electron.h @@ -77,11 +77,11 @@ namespace pat { /// override the reco::GsfElectron::superCluster method, to access the internal storage of the supercluster reco::SuperClusterRef superCluster() const override; /// override the reco::GsfElectron::pflowSuperCluster method, to access the internal storage of the pflowSuperCluster - reco::SuperClusterRef parentSuperCluster() const; + reco::SuperClusterRef parentSuperCluster() const override; /// returns nothing. Use either gsfTrack or closestCtfTrack reco::TrackRef track() const override; /// override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the track - reco::TrackRef closestCtfTrackRef() const; + reco::TrackRef closestCtfTrackRef() const override; /// direct access to the seed cluster reco::CaloClusterPtr seed() const; diff --git a/DataFormats/PatCandidates/interface/Jet.h b/DataFormats/PatCandidates/interface/Jet.h index 885367cf21a20..88a8eed200691 100644 --- a/DataFormats/PatCandidates/interface/Jet.h +++ b/DataFormats/PatCandidates/interface/Jet.h @@ -47,6 +47,8 @@ #include "DataFormats/Common/interface/OwnVector.h" #include "DataFormats/Common/interface/AtomicPtrCache.h" +#include + // Define typedefs for convenience namespace pat { @@ -498,13 +500,13 @@ namespace pat { /// String access to subjet list - pat::JetPtrCollection const & subjets( std::string label ) const ; + pat::JetPtrCollection const & subjets( std::string const & label ) const ; /// Add new set of subjets - void addSubjets( pat::JetPtrCollection const & pieces, std::string label = "" ); + void addSubjets( pat::JetPtrCollection const & pieces, std::string const & label = "" ); /// Check to see if the subjet collection exists - bool hasSubjets( std::string label ) const { return find( subjetLabels_.begin(), subjetLabels_.end(), label) != subjetLabels_.end(); } + bool hasSubjets( std::string const & label ) const { return find( subjetLabels_.begin(), subjetLabels_.end(), label) != subjetLabels_.end(); } /// Number of subjet collections unsigned int nSubjetCollections( ) const { return subjetCollections_.size(); } @@ -512,7 +514,23 @@ namespace pat { /// Subjet collection names std::vector const & subjetCollectionNames() const { return subjetLabels_; } - + /// Access to mass of subjets + double groomedMass(unsigned int index = 0) const{ + auto const& sub = subjets(index); + return nSubjetCollections() > index && !sub.empty() ? + std::accumulate( sub.begin(), sub.end(), + reco::Candidate::LorentzVector(), + [] (reco::Candidate::LorentzVector const & a, reco::CandidatePtr const & b){return a + b->p4();}).mass() : + -1.0; + } + double groomedMass(std::string const & label) const{ + auto const& sub = subjets(label); + return hasSubjets(label) && !sub.empty() ? + std::accumulate( sub.begin(), sub.end(), + reco::Candidate::LorentzVector(), + [] (reco::Candidate::LorentzVector const & a, reco::CandidatePtr const & b){return a + b->p4();}).mass() : + -1.0; + } protected: diff --git a/DataFormats/PatCandidates/src/Jet.cc b/DataFormats/PatCandidates/src/Jet.cc index 215d3e4930132..592ef17fe5528 100644 --- a/DataFormats/PatCandidates/src/Jet.cc +++ b/DataFormats/PatCandidates/src/Jet.cc @@ -599,7 +599,7 @@ pat::JetPtrCollection const & Jet::subjets( unsigned int index) const { /// String access to subjet list -pat::JetPtrCollection const & Jet::subjets( std::string label ) const { +pat::JetPtrCollection const & Jet::subjets( std::string const & label ) const { auto found = find( subjetLabels_.begin(), subjetLabels_.end(), label ); if ( found != subjetLabels_.end() ){ auto index = std::distance( subjetLabels_.begin(), found ); @@ -611,7 +611,7 @@ pat::JetPtrCollection const & Jet::subjets( std::string label ) const { } /// Add new set of subjets -void Jet::addSubjets( pat::JetPtrCollection const & pieces, std::string label ) { +void Jet::addSubjets( pat::JetPtrCollection const & pieces, std::string const & label ) { subjetCollections_.push_back( pieces ); subjetLabels_.push_back( label ); } diff --git a/EventFilter/Utilities/interface/EvFDaqDirector.h b/EventFilter/Utilities/interface/EvFDaqDirector.h index 624225dce14bb..694f40c5f35f6 100644 --- a/EventFilter/Utilities/interface/EvFDaqDirector.h +++ b/EventFilter/Utilities/interface/EvFDaqDirector.h @@ -18,8 +18,8 @@ #include //system headers -//#include #include +#include #include #include #include @@ -104,8 +104,6 @@ namespace evf{ FileStatus updateFuLock(unsigned int& ls, std::string& nextFile, uint32_t& fsize, uint64_t& lockWaitTime); void tryInitializeFuLockFile(); unsigned int getRunNumber() const { return run_; } - FILE * maybeCreateAndLockFileHeadForStream(unsigned int ls, std::string &stream); - void unlockAndCloseMergeStream(); void lockInitLock(); void unlockInitLock(); void setFMS(evf::FastMonitoringService* fms) {fms_=fms;} @@ -127,7 +125,7 @@ namespace evf{ std::string getStreamMergeType(std::string const& stream, MergeType defaultType); bool emptyLumisectionMode() const {return emptyLumisectionMode_;} bool microMergeDisabled() const {return microMergeDisabled_;} - + static struct flock make_flock(short type, short whence, off_t start, off_t len, pid_t pid); private: //bool bulock(); @@ -164,7 +162,6 @@ namespace evf{ int bu_readlock_fd_; int bu_writelock_fd_; int fu_readwritelock_fd_; - int data_readwrite_fd_; int fulocal_rwlock_fd_; int fulocal_rwlock_fd2_; @@ -173,7 +170,6 @@ namespace evf{ FILE * fu_rw_lock_stream; FILE * bu_w_monitor_stream; FILE * bu_t_monitor_stream; - FILE * data_rw_stream; DirManager dirManager_; @@ -185,12 +181,6 @@ namespace evf{ struct flock bu_r_fulk; struct flock fu_rw_flk; struct flock fu_rw_fulk; - struct flock data_rw_flk; - struct flock data_rw_fulk; - //struct flock fulocal_rw_flk; - //struct flock fulocal_rw_fulk; - //struct flock fulocal_rw_flk2; - //struct flock fulocal_rw_fulk2; evf::FastMonitoringService * fms_ = nullptr; diff --git a/EventFilter/Utilities/plugins/RecoEventOutputModuleForFU.h b/EventFilter/Utilities/plugins/RecoEventOutputModuleForFU.h index fa3fca1bab617..8707c5ed3dc6c 100644 --- a/EventFilter/Utilities/plugins/RecoEventOutputModuleForFU.h +++ b/EventFilter/Utilities/plugins/RecoEventOutputModuleForFU.h @@ -20,6 +20,7 @@ namespace evf { + template class RecoEventOutputModuleForFU : public edm::StreamerOutputModuleBase { @@ -49,7 +50,7 @@ namespace evf { private: std::auto_ptr c_; - std::string stream_label_; + std::string streamLabel_; boost::filesystem::path openDatFilePath_; boost::filesystem::path openDatChecksumFilePath_; jsoncollector::IntJ processed_; @@ -68,7 +69,8 @@ namespace evf { jsoncollector::DataPointDefinition outJsonDef_; unsigned char* outBuf_=nullptr; bool readAdler32Check_=false; - + struct flock dataRwFlk_; + struct flock dataRwFulk_; }; //end-of-class-def @@ -77,7 +79,7 @@ namespace evf { edm::one::OutputModuleBase::OutputModuleBase(ps), edm::StreamerOutputModuleBase(ps), c_(new Consumer(ps)), - stream_label_(ps.getParameter("@module_label")), + streamLabel_(ps.getParameter("@module_label")), processed_(0), accepted_(0), errorEvents_(0), @@ -89,21 +91,24 @@ namespace evf { transferDestination_(), mergeType_(), hltErrorEvents_(0), - outBuf_(new unsigned char[1024*1024]) + outBuf_(new unsigned char[1024*1024]), + dataRwFlk_( evf::EvFDaqDirector::make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )), + dataRwFulk_( evf::EvFDaqDirector::make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )) + { //replace hltOutoputA with stream if the HLT menu uses this convention std::string testPrefix="hltOutput"; - if (stream_label_.find(testPrefix)==0) - stream_label_=std::string("stream")+stream_label_.substr(testPrefix.size()); + if (streamLabel_.find(testPrefix)==0) + streamLabel_=std::string("stream")+streamLabel_.substr(testPrefix.size()); - if (stream_label_.find("_")!=std::string::npos) { + if (streamLabel_.find("_")!=std::string::npos) { throw cms::Exception("RecoEventOutputModuleForFU") - << "Underscore character is reserved can not be used for stream names in FFF, but was detected in stream name -: " << stream_label_; + << "Underscore character is reserved can not be used for stream names in FFF, but was detected in stream name -: " << streamLabel_; } - std::string stream_label_lo = stream_label_; - boost::algorithm::to_lower(stream_label_lo); - auto streampos = stream_label_lo.rfind("stream"); + std::string streamLabelLow = streamLabel_; + boost::algorithm::to_lower(streamLabelLow); + auto streampos = streamLabelLow.rfind("stream"); if (streampos !=0 && streampos!=std::string::npos) throw cms::Exception("RecoEventOutputModuleForFU") << "stream (case-insensitive) sequence was found in stream suffix. This is reserved and can not be used for names in FFF based HLT, but was detected in stream name"; @@ -151,7 +156,7 @@ namespace evf { std::string outJsonDefName = ss.str(); edm::Service()->lockInitLock(); - struct stat fstat; + struct stat fstat; if (stat (outJsonDefName.c_str(), &fstat) != 0) { //file does not exist LogDebug("RecoEventOutputModuleForFU") << "writing output definition file -: " << outJsonDefName; std::string content; @@ -186,7 +191,7 @@ namespace evf { RecoEventOutputModuleForFU::start() { initRun(); - const std::string openInitFileName = edm::Service()->getOpenInitFilePath(stream_label_); + const std::string openInitFileName = edm::Service()->getOpenInitFilePath(streamLabel_); edm::LogInfo("RecoEventOutputModuleForFU") << "start() method, initializing streams. init stream -: " << openInitFileName; c_->setInitMessageFile(openInitFileName); @@ -207,7 +212,7 @@ namespace evf { { c_->doOutputHeader(init_message); - const std::string openIniFileName = edm::Service()->getOpenInitFilePath(stream_label_); + const std::string openIniFileName = edm::Service()->getOpenInitFilePath(streamLabel_); struct stat istat; stat(openIniFileName.c_str(), &istat); //read back file to check integrity of what was written @@ -233,8 +238,8 @@ namespace evf { << " expected:" << c_->get_adler32_ini() << " obtained:" << adler32c; } else { - edm::LogWarning("RecoEventOutputModuleForFU") << "Ini file checksum -: "<< stream_label_ << " " << adler32c; - boost::filesystem::rename(openIniFileName,edm::Service()->getInitFilePath(stream_label_)); + edm::LogWarning("RecoEventOutputModuleForFU") << "Ini file checksum -: "<< streamLabel_ << " " << adler32c; + boost::filesystem::rename(openIniFileName,edm::Service()->getInitFilePath(streamLabel_)); } } @@ -269,8 +274,8 @@ namespace evf { void RecoEventOutputModuleForFU::beginJob() { //get stream transfer destination - transferDestination_ = edm::Service()->getStreamDestinations(stream_label_); - mergeType_ = edm::Service()->getStreamMergeType(stream_label_,evf::MergeTypeDAT); + transferDestination_ = edm::Service()->getStreamDestinations(streamLabel_); + mergeType_ = edm::Service()->getStreamMergeType(streamLabel_,evf::MergeTypeDAT); } @@ -278,8 +283,8 @@ namespace evf { void RecoEventOutputModuleForFU::beginLuminosityBlock(edm::LuminosityBlockForOutput const& ls) { //edm::LogInfo("RecoEventOutputModuleForFU") << "begin lumi"; - openDatFilePath_ = edm::Service()->getOpenDatFilePath(ls.luminosityBlock(),stream_label_); - openDatChecksumFilePath_ = edm::Service()->getOpenDatFilePath(ls.luminosityBlock(),stream_label_); + openDatFilePath_ = edm::Service()->getOpenDatFilePath(ls.luminosityBlock(),streamLabel_); + openDatChecksumFilePath_ = edm::Service()->getOpenDatFilePath(ls.luminosityBlock(),streamLabel_); c_->setOutputFile(openDatFilePath_.string()); filelist_ = openDatFilePath_.filename().string(); } @@ -304,9 +309,27 @@ namespace evf { //lock struct stat istat; if (!edm::Service()->microMergeDisabled()) { - FILE *des = edm::Service()->maybeCreateAndLockFileHeadForStream(ls.luminosityBlock(),stream_label_); - std::string deschecksum = edm::Service()->getMergedDatChecksumFilePath(ls.luminosityBlock(), stream_label_); + //create if does not exist then lock the merge destination file + FILE *des = fopen(edm::Service()->getMergedDatFilePath(ls.luminosityBlock(),streamLabel_).c_str(), "a"); //open stream for appending + int data_readwrite_fd = fileno(des); + + //deleter function: unlock and close file + auto finishFile = [des, data_readwrite_fd, this](FILE* f) { + fflush(f); + fcntl(data_readwrite_fd,F_SETLKW, &dataRwFulk_); + fclose(des); + }; + + std::unique_ptr desGuard{des,finishFile}; + + if (data_readwrite_fd == -1) + edm::LogError("RecoEventOutputModuleForFU") << "problem with creating filedesc for datamerge " << strerror(errno); + else + LogDebug("RecoEventOutputModuleForFU") << "creating filedesc for datamerge -: " << data_readwrite_fd; + fcntl(data_readwrite_fd, F_SETLKW, &dataRwFlk_); + + std::string deschecksum = edm::Service()->getMergedDatChecksumFilePath(ls.luminosityBlock(), streamLabel_); struct stat istat; FILE * cf = nullptr; @@ -348,7 +371,6 @@ namespace evf { fprintf(cf,"%u",mergedAdler32); fclose(cf); - edm::Service()->unlockAndCloseMergeStream(); fclose(src); if (readAdler32Check_ && ((adlerb << 16) | adlera) != fileAdler32_.value()) { @@ -360,7 +382,7 @@ namespace evf { else { //no micromerge by HLT stat(openDatFilePath_.string().c_str(), &istat); filesize = istat.st_size; - boost::filesystem::rename(openDatFilePath_.string().c_str(), edm::Service()->getDatFilePath(ls.luminosityBlock(),stream_label_)); + boost::filesystem::rename(openDatFilePath_.string().c_str(), edm::Service()->getDatFilePath(ls.luminosityBlock(),streamLabel_)); } } else { //return if not in empty lumisection mode @@ -378,7 +400,7 @@ namespace evf { jsonMonitor_->snap(ls.luminosityBlock()); const std::string outputJsonNameStream = - edm::Service()->getOutputJsonFilePath(ls.luminosityBlock(),stream_label_); + edm::Service()->getOutputJsonFilePath(ls.luminosityBlock(),streamLabel_); jsonMonitor_->outputFullJSON(outputJsonNameStream,ls.luminosityBlock()); // reset monitoring params diff --git a/EventFilter/Utilities/src/EvFDaqDirector.cc b/EventFilter/Utilities/src/EvFDaqDirector.cc index 7a9de7e7ad432..ea15cc24c8c16 100644 --- a/EventFilter/Utilities/src/EvFDaqDirector.cc +++ b/EventFilter/Utilities/src/EvFDaqDirector.cc @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -33,17 +32,6 @@ namespace evf { //for enum MergeType const std::vector EvFDaqDirector::MergeTypeNames_ = {"","DAT","PB","JSNDATA"}; - namespace { - struct flock make_flock(short type, short whence, off_t start, off_t len, pid_t pid) - { -#ifdef __APPLE__ - return {start, len, pid, type, whence}; -#else - return {type, whence, start, len, pid}; -#endif - } - } - EvFDaqDirector::EvFDaqDirector(const edm::ParameterSet &pset, edm::ActivityRegistry& reg) : base_dir_(pset.getUntrackedParameter ("baseDir", ".")), @@ -62,7 +50,6 @@ namespace evf { bu_readlock_fd_(-1), bu_writelock_fd_(-1), fu_readwritelock_fd_(-1), - data_readwrite_fd_(-1), fulocal_rwlock_fd_(-1), fulocal_rwlock_fd2_(-1), @@ -71,7 +58,6 @@ namespace evf { fu_rw_lock_stream(nullptr), //bu_w_monitor_stream(0), //bu_t_monitor_stream(0), - data_rw_stream(nullptr), dirManager_(base_dir_), @@ -82,13 +68,7 @@ namespace evf { bu_w_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, 0 )), bu_r_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, 0 )), fu_rw_flk( make_flock ( F_WRLCK, SEEK_SET, 0, 0, getpid() )), - fu_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )), - data_rw_flk( make_flock ( F_WRLCK, SEEK_SET, 0, 0, getpid() )), - data_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )) - //fulocal_rw_flk( make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )), - //fulocal_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )), - //fulocal_rw_flk2( make_flock( F_WRLCK, SEEK_SET, 0, 0, getpid() )), - //fulocal_rw_fulk2( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )) + fu_rw_fulk( make_flock( F_UNLCK, SEEK_SET, 0, 0, getpid() )) { reg.watchPreallocate(this, &EvFDaqDirector::preallocate); @@ -820,27 +800,6 @@ namespace evf { fu_rw_lock_stream = fdopen(fu_readwritelock_fd_, "r+"); } - //create if does not exist then lock the merge destination file - FILE *EvFDaqDirector::maybeCreateAndLockFileHeadForStream(unsigned int ls, std::string &stream) { - data_rw_stream = fopen(getMergedDatFilePath(ls,stream).c_str(), "a"); //open stream for appending - data_readwrite_fd_ = fileno(data_rw_stream); - if (data_readwrite_fd_ == -1) - edm::LogError("EvFDaqDirector") << "problem with creating filedesc for datamerge " - << strerror(errno); - else - LogDebug("EvFDaqDirector") << "creating filedesc for datamerge -: " - << data_readwrite_fd_; - fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_flk); - - return data_rw_stream; - } - - void EvFDaqDirector::unlockAndCloseMergeStream() { - fflush(data_rw_stream); - fcntl(data_readwrite_fd_, F_SETLKW, &data_rw_fulk); - fclose(data_rw_stream); - } - void EvFDaqDirector::lockInitLock() { pthread_mutex_lock(&init_lock_); } @@ -1036,4 +995,14 @@ namespace evf { close(proc_flag_fd); } + struct flock EvFDaqDirector::make_flock(short type, short whence, off_t start, off_t len, pid_t pid) + { +#ifdef __APPLE__ + return {start, len, pid, type, whence}; +#else + return {type, whence, start, len, pid}; +#endif + } + } + diff --git a/IOMC/EventVertexGenerators/python/VtxSmearedParameters_cfi.py b/IOMC/EventVertexGenerators/python/VtxSmearedParameters_cfi.py index d7caba84db4a0..b53f54a4104bd 100644 --- a/IOMC/EventVertexGenerators/python/VtxSmearedParameters_cfi.py +++ b/IOMC/EventVertexGenerators/python/VtxSmearedParameters_cfi.py @@ -581,6 +581,20 @@ Z0 = cms.double(0.82054 ) ) +# Placeholder for beam spot extracted from data for 2017 pp run @ 5 TeV +# For now using the same parameters as Realistic25ns13TeVEarly2017Collision +Realistic5TeVppCollision2017VtxSmearingParameters = cms.PSet( + Phi = cms.double(0.0), + BetaStar = cms.double(40.0), + Emittance = cms.double(3.319e-8), + Alpha = cms.double(0.0), + SigmaZ = cms.double(3.5), + TimeOffset = cms.double(0.0), + X0 = cms.double(-0.024755), + Y0 = cms.double(0.069233 ), + Z0 = cms.double(0.82054 ) +) + # Test HF offset ShiftedCollision2015VtxSmearingParameters = cms.PSet( Phi = cms.double(0.0), @@ -631,7 +645,23 @@ ) # updated numbers based on beamspot fits to 2015 PbPb data -RealisticHICollision2015VtxSmearingParameters = cms.PSet( +# Later found to be incorrect, see following entry +# RealisticHICollision2015VtxSmearingParameters = cms.PSet( +# Phi = cms.double(0.0), +# BetaStar = cms.double(60.0), +# Emittance = cms.double(1.70e-07), +# Alpha = cms.double(0.0), +# SigmaZ = cms.double(5.2278), +# TimeOffset = cms.double(0.0), +# X0 = cms.double(0.1025), +# Y0 = cms.double(0.1654), +# Z0 = cms.double(3.2528) +#) +# updated numbers for 2015 PbPb data with Z centroid from fixed beamspot fits +# See discussion here https://hypernews.cern.ch/HyperNews/CMS/get/hi-general/3968.html +# See plot of difference here: https://www.dropbox.com/s/tsnkgvvpkdqjtyq/vzDataMCOverlay_c_20170420.pdf?dl=0 +# +RealisticHICollisionFixZ2015VtxSmearingParameters = cms.PSet( Phi = cms.double(0.0), BetaStar = cms.double(60.0), Emittance = cms.double(1.70e-07), @@ -640,8 +670,21 @@ TimeOffset = cms.double(0.0), X0 = cms.double(0.1025), Y0 = cms.double(0.1654), - Z0 = cms.double(3.2528) + Z0 = cms.double(0.771) ) +# Numbers based on beamspot fits to 2017 XeXe data +# Documentation here: https://twiki.cern.ch/twiki/pub/CMS/XeXeRereco/IanLRU_AlCaTkAlBS_20171130_approvedByLucaSara.pdf +RealisticXeXeCollision2017VtxSmearingParameters = cms.PSet( + Phi = cms.double(0.0), + BetaStar = cms.double(30.0), + Emittance = cms.double(4.33e-08), + Alpha = cms.double(0.0), + SigmaZ = cms.double(4.64), + TimeOffset = cms.double(0.0), + X0 = cms.double(-0.026), + Y0 = cms.double(0.081), + Z0 = cms.double(0.645) +) # Estimate for 2015 pp collisions at 5.02 TeV, based on feedback from accelerator: beta* ~ 400cm, normalized emittance = 2.5 um, SigmaZ similar to RunIIWinter15GS Nominal5TeVpp2015VtxSmearingParameters = cms.PSet( diff --git a/IOMC/EventVertexGenerators/python/VtxSmearedRealistic5TeVppCollision2017_cfi.py b/IOMC/EventVertexGenerators/python/VtxSmearedRealistic5TeVppCollision2017_cfi.py new file mode 100644 index 0000000000000..7e87d58a7598d --- /dev/null +++ b/IOMC/EventVertexGenerators/python/VtxSmearedRealistic5TeVppCollision2017_cfi.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + +from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import Realistic5TeVppCollision2017VtxSmearingParameters,VtxSmearedCommon +VtxSmeared = cms.EDProducer("BetafuncEvtVtxGenerator", + Realistic5TeVppCollision2017VtxSmearingParameters, + VtxSmearedCommon +) diff --git a/IOMC/EventVertexGenerators/python/VtxSmearedRealisticHICollisionFixZ2015_cfi.py b/IOMC/EventVertexGenerators/python/VtxSmearedRealisticHICollisionFixZ2015_cfi.py new file mode 100644 index 0000000000000..4e41b2c1ffe07 --- /dev/null +++ b/IOMC/EventVertexGenerators/python/VtxSmearedRealisticHICollisionFixZ2015_cfi.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import RealisticHICollisionFixZ2015VtxSmearingParameters,VtxSmearedCommon +VtxSmeared = cms.EDProducer("BetafuncEvtVtxGenerator", + RealisticHICollisionFixZ2015VtxSmearingParameters, + VtxSmearedCommon +) + + + diff --git a/IOMC/EventVertexGenerators/python/VtxSmearedRealisticXeXeCollision2017_cfi.py b/IOMC/EventVertexGenerators/python/VtxSmearedRealisticXeXeCollision2017_cfi.py new file mode 100644 index 0000000000000..1a05bc450824c --- /dev/null +++ b/IOMC/EventVertexGenerators/python/VtxSmearedRealisticXeXeCollision2017_cfi.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import RealisticXeXeCollision2017VtxSmearingParameters,VtxSmearedCommon +VtxSmeared = cms.EDProducer("BetafuncEvtVtxGenerator", + RealisticXeXeCollision2017VtxSmearingParameters, + VtxSmearedCommon +) + + + diff --git a/IOPool/Input/src/RootFile.h b/IOPool/Input/src/RootFile.h index 9745042b3cd9b..12d3e1cef900c 100644 --- a/IOPool/Input/src/RootFile.h +++ b/IOPool/Input/src/RootFile.h @@ -202,7 +202,7 @@ namespace edm { bool skipEntries(unsigned int& offset) {return eventTree_.skipEntries(offset);} bool skipEvents(int& offset); bool goToEvent(EventID const& eventID); - bool nextEventEntry() {return eventTree_.next();} + bool nextEventEntry() {return eventTree_.nextWithCache();} IndexIntoFile::EntryType getNextItemType(RunNumber_t& run, LuminosityBlockNumber_t& lumi, EventNumber_t& event); std::shared_ptr branchIDListHelper() const {return get_underlying_safe(branchIDListHelper_);} std::shared_ptr& branchIDListHelper() {return get_underlying_safe(branchIDListHelper_);} diff --git a/IOPool/Input/src/RootTree.cc b/IOPool/Input/src/RootTree.cc index d91f537217bb0..d7d8a156c5a90 100644 --- a/IOPool/Input/src/RootTree.cc +++ b/IOPool/Input/src/RootTree.cc @@ -192,6 +192,15 @@ namespace edm { if (treeMaxVirtualSize >= 0) tree_->SetMaxVirtualSize(static_cast(treeMaxVirtualSize)); } + bool + RootTree::nextWithCache() { + bool returnValue = ++entryNumber_ < entries_; + if(returnValue) { + setEntryNumber(entryNumber_); + } + return returnValue; + } + void RootTree::setEntryNumber(EntryNumber theEntryNumber) { filePtr_->SetCacheRead(treeCache_.get()); @@ -201,6 +210,16 @@ namespace edm { // However, because reading one event in the cluster is supposed to be equivalent to reading all events in the cluster, // we're not incurring additional over-reading - we're just doing it more efficiently. // NOTE: Constructor guarantees treeAutoFlush_ is positive, even if TTree->GetAutoFlush() is negative. + if(theEntryNumber < entryNumber_ and theEntryNumber >=0) { + //We started reading the file near the end, now we need to correct for the learning length + if(switchOverEntry_ >tree_->GetEntries()) { + switchOverEntry_ = switchOverEntry_-tree_->GetEntries(); + if(rawTreeCache_) { + rawTreeCache_->SetEntryRange(theEntryNumber, switchOverEntry_); + rawTreeCache_->FillBuffer(); + } + } + } if ((theEntryNumber < static_cast(entryNumber_-treeAutoFlush_)) && (treeCache_) && (!treeCache_->IsLearning()) && (entries_ > 0) && (switchOverEntry_ >= 0)) { treeCache_->SetEntryRange(theEntryNumber, entries_); @@ -382,12 +401,19 @@ namespace edm { filePtr_->SetCacheRead(nullptr); rawTreeCache_->SetLearnEntries(0); switchOverEntry_ = entryNumber_ + learningEntries_; + auto rawStart = entryNumber_; + auto rawEnd = switchOverEntry_; + auto treeStart =switchOverEntry_; + if(switchOverEntry_ >= tree_->GetEntries()) { + treeStart = switchOverEntry_-tree_->GetEntries(); + rawEnd = tree_->GetEntries(); + } rawTreeCache_->StartLearningPhase(); - rawTreeCache_->SetEntryRange(entryNumber_, switchOverEntry_); + rawTreeCache_->SetEntryRange(rawStart, rawEnd); rawTreeCache_->AddBranch("*", kTRUE); rawTreeCache_->StopLearningPhase(); treeCache_->StartLearningPhase(); - treeCache_->SetEntryRange(switchOverEntry_, tree_->GetEntries()); + treeCache_->SetEntryRange(treeStart, tree_->GetEntries()); // Make sure that 'branchListIndexes' branch exist in input file if (filePtr_->Get(poolNames::branchListIndexesBranchName().c_str()) != nullptr) { treeCache_->AddBranch(poolNames::branchListIndexesBranchName().c_str(), kTRUE); diff --git a/IOPool/Input/src/RootTree.h b/IOPool/Input/src/RootTree.h index 1712422c0e396..7da13921beee5 100644 --- a/IOPool/Input/src/RootTree.h +++ b/IOPool/Input/src/RootTree.h @@ -93,6 +93,7 @@ namespace edm { std::string const& oldBranchName); bool next() {return ++entryNumber_ < entries_;} + bool nextWithCache(); bool previous() {return --entryNumber_ >= 0;} bool current() const {return entryNumber_ < entries_ && entryNumber_ >= 0;} bool current(EntryNumber entry) const {return entry < entries_ && entry >= 0;} diff --git a/Mixing/Base/src/PileUp.cc b/Mixing/Base/src/PileUp.cc index eec86569e2796..6442045938e3e 100644 --- a/Mixing/Base/src/PileUp.cc +++ b/Mixing/Base/src/PileUp.cc @@ -68,7 +68,7 @@ namespace edm { Source_type_(config->sourcename_), averageNumber_(config->averageNumber_), intAverage_(static_cast(averageNumber_)), - histo_(config->histo_), + histo_(std::make_shared(*config->histo_)), histoDistribution_(type_ == "histo"), probFunctionDistribution_(type_ == "probFunction"), poisson_(type_ == "poisson"), diff --git a/SimGeneral/Configuration/python/SimGeneral_EventContent_cff.py b/SimGeneral/Configuration/python/SimGeneral_EventContent_cff.py index 64fe66910593a..d6f5a9bb932e8 100644 --- a/SimGeneral/Configuration/python/SimGeneral_EventContent_cff.py +++ b/SimGeneral/Configuration/python/SimGeneral_EventContent_cff.py @@ -43,3 +43,9 @@ phase2_timing.toModify( SimGeneralFEVTDEBUG, outputCommands = SimGeneralFEVTDEBUG.outputCommands + _phase2_timing_extraCommands ) phase2_timing.toModify( SimGeneralRECO, outputCommands = SimGeneralRECO.outputCommands + _phase2_timing_extraCommands ) +_pp_on_XeXe_extraCommands = ['keep CrossingFramePlaybackInfoNew_mix_*_*','keep *_heavyIon_*_*'] +from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017 +pp_on_XeXe_2017.toModify( SimGeneralRAW, outputCommands = SimGeneralRAW.outputCommands + _pp_on_XeXe_extraCommands ) +pp_on_XeXe_2017.toModify( SimGeneralFEVTDEBUG, outputCommands = SimGeneralFEVTDEBUG.outputCommands + _pp_on_XeXe_extraCommands ) +pp_on_XeXe_2017.toModify( SimGeneralRECO, outputCommands = SimGeneralRECO.outputCommands + _pp_on_XeXe_extraCommands ) +pp_on_XeXe_2017.toModify( SimGeneralAOD, outputCommands = SimGeneralAOD.outputCommands + _pp_on_XeXe_extraCommands )