Skip to content

Commit

Permalink
Add configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
lmartika committed Dec 4, 2024
1 parent 45a82a5 commit 50605df
Showing 1 changed file with 226 additions and 0 deletions.
226 changes: 226 additions & 0 deletions HeavyIonsAnalysis/Configuration/test/aggregate_MC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
### HiForest Configuration
# Input: miniAOD
# Type: mc

import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run3_pp_on_PbPb_2023_cff import Run3_pp_on_PbPb_2023
process = cms.Process('HiForest', Run3_pp_on_PbPb_2023)

###############################################################################

# HiForest info
process.load("HeavyIonsAnalysis.EventAnalysis.HiForestInfo_cfi")
process.HiForestInfo.info = cms.vstring("HiForest, miniAOD, 132X, mc")

###############################################################################

# input files
process.source = cms.Source("PoolSource",
duplicateCheckMode = cms.untracked.string("noDuplicateCheck"),
fileNames = cms.untracked.vstring(
'/store/group/phys_heavyions/jviinika/PythiaHydjetRun3_5p36TeV_dijet_ptHat15_100kEvents_miniAOD_2023_08_30/PythiaHydjetDijetRun3/PythiaHydjetRun3_dijet_ptHat15_5p36TeV_miniAOD/230830_165931/0000/pythiaHydjet_miniAOD_11.root'
),
)

# number of events to process, set to -1 to process all events
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(10)
)

###############################################################################

# load Global Tag, geometry, etc.
process.load('Configuration.Geometry.GeometryDB_cff')
process.load('Configuration.StandardSequences.Services_cff')
process.load('Configuration.StandardSequences.MagneticField_38T_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.load('FWCore.MessageService.MessageLogger_cfi')


from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, '132X_mcRun3_2023_realistic_HI_v10', '')
process.HiForestInfo.GlobalTagLabel = process.GlobalTag.globaltag
process.GlobalTag.snapshotTime = cms.string("9999-12-31 23:59:59.000")
process.GlobalTag.toGet.extend([
cms.PSet(record = cms.string("BTagTrackProbability3DRcd"),
tag = cms.string("JPcalib_MC103X_2018PbPb_v4"),
connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS")
)
])


###############################################################################

# root output
process.TFileService = cms.Service("TFileService",
fileName = cms.string("HiForestMiniAOD.root"))

# # edm output for debugging purposes
# process.output = cms.OutputModule(
# "PoolOutputModule",
# fileName = cms.untracked.string('HiForestEDM.root'),
# outputCommands = cms.untracked.vstring(
# 'keep *',
# )
# )

# process.output_path = cms.EndPath(process.output)

###############################################################################

#############################
# Gen Analyzer
#############################
process.load('HeavyIonsAnalysis.EventAnalysis.HiGenAnalyzer_cfi')

# event analysis
process.load('HeavyIonsAnalysis.EventAnalysis.hltanalysis_cfi')
process.load('HeavyIonsAnalysis.EventAnalysis.particleFlowAnalyser_cfi')
process.load('HeavyIonsAnalysis.EventAnalysis.hievtanalyzer_mc_cfi')
process.load('HeavyIonsAnalysis.EventAnalysis.skimanalysis_cfi')
process.load('HeavyIonsAnalysis.EventAnalysis.hltobject_cfi')
process.load('HeavyIonsAnalysis.EventAnalysis.l1object_cfi')

#from HeavyIonsAnalysis.EventAnalysis.hltobject_cfi import trigger_list_mc
#process.hltobject.triggerNames = trigger_list_mc

################################
# electrons, photons, muons
process.load('HeavyIonsAnalysis.EGMAnalysis.ggHiNtuplizer_cfi')
process.ggHiNtuplizer.doGenParticles = cms.bool(True)
process.ggHiNtuplizer.doMuons = cms.bool(False)
process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi")
################################
# jet reco sequence
process.load('HeavyIonsAnalysis.JetAnalysis.akCs4PFJetSequence_pponPbPb_mc_cff')
################################
# tracks
process.load("HeavyIonsAnalysis.TrackAnalysis.TrackAnalyzers_cff")
#muons
process.load("HeavyIonsAnalysis.MuonAnalysis.unpackedMuons_cfi")
process.load("HeavyIonsAnalysis.MuonAnalysis.muonAnalyzer_cfi")
process.muonAnalyzer.doGen = cms.bool(True)

###############################################################################

# ZDC analyzer
process.load('HeavyIonsAnalysis.ZDCAnalysis.QWZDC2018Producer_cfi')
process.load('HeavyIonsAnalysis.ZDCAnalysis.QWZDC2018RecHit_cfi')
process.load('HeavyIonsAnalysis.ZDCAnalysis.zdcanalyzer_cfi')

process.zdcanalyzer.doZDCRecHit = False
process.zdcanalyzer.doZDCDigi = True
process.zdcanalyzer.zdcRecHitSrc = cms.InputTag("QWzdcreco")
process.zdcanalyzer.zdcDigiSrc = cms.InputTag("hcalDigis", "ZDC")
process.zdcanalyzer.calZDCDigi = False
process.zdcanalyzer.verbose = False

process.genJetSequence = cms.Sequence()
###############################################################################
# main forest sequence
process.forest = cms.Path(
process.HiForestInfo +
process.hltanalysis +
# process.hltobject +
# process.l1object +
# process.trackSequencePbPb +
# process.particleFlowAnalyser +
process.genJetSequence +
process.hiEvtAnalyzer #+
# process.HiGenParticleAna +
# process.ggHiNtuplizer +
# process.zdcdigi +
# process.QWzdcreco +
#process.akCs4PFJetAnalyzer +
# process.zdcanalyzer #+
# process.unpackedMuons +
# process.muonAnalyzer
)

#customisation
process.particleFlowAnalyser.ptMin = 0.0
process.ggHiNtuplizer.muonPtMin = 0.0

# Gen
process.load("GeneratorInterface.RivetInterface.mergedGenParticles_cfi")
process.genJetSequence += process.mergedGenParticles
## Produces a reco::GenParticleCollection named mergedGenParticles

process.load("RecoHI.HiJetAlgos.HFdecayProductTagger_cfi")
process.HFdecayProductTagger.genParticles = cms.InputTag("mergedGenParticles")
process.HFdecayProductTagger.tagBorC = cms.bool(True) # tag B
process.genJetSequence += process.HFdecayProductTagger

taggedGenParticlesName_ = "HFdecayProductTagger"

process.bDecayAna = process.HiGenParticleAna.clone(
genParticleSrc = cms.InputTag(taggedGenParticlesName_),
useRefVector = cms.untracked.bool(False),
partonMEOnly = cms.untracked.bool(False),
chargedOnly = True,
doHI = False,
etaMax = cms.untracked.double(10),
ptMin = cms.untracked.double(0),
stableOnly = False
)
process.genJetSequence += process.bDecayAna


# Select the types of jets filled
matchJets = True # Enables q/g and heavy flavor jet identification in MC
jetPtMin = 15
jetAbsEtaMax = 2.5

doTracks = False
doSvtx = False

# Choose which additional information is added to jet trees
doHIJetID = True # Fill jet ID and composition information branches
doWTARecluster = False # Add jet phi and eta for WTA axis
doBtagging = True # Note that setting to True increases computing time a lot

# 0 means use original mini-AOD jets, otherwise use R value, e.g., 3,4,8
jetLabel = "2"

# add candidate tagging, copy/paste to add other jet radii
from HeavyIonsAnalysis.JetAnalysis.deepNtupleSettings_cff import candidateBtaggingMiniAOD
candidateBtaggingMiniAOD(process, isMC = True, jetPtMin = jetPtMin, jetCorrLevels = ['L2Relative', 'L3Absolute'], doBtagging = doBtagging, labelR = jetLabel)

# setup jet analyzer
setattr(process,"akCs"+jetLabel+"PFJetAnalyzer",process.akCs4PFJetAnalyzer.clone())
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").jetTag = 'selectedUpdatedPatJetsDeepFlavour'
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").jetName = 'akCs'+jetLabel+'PF'
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").matchJets = matchJets
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").matchTag = 'patJetsAK'+jetLabel+'PFUnsubJets'
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").doHiJetID = doHIJetID
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").doWTARecluster = doWTARecluster
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").jetPtMin = jetPtMin
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").jetAbsEtaMax = cms.untracked.double(jetAbsEtaMax)
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").rParam = int(jetLabel)*0.1
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").jetFlavourInfos = "ak"+jetLabel+"PFUnsubJetFlavourInfos"
if doBtagging:
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").useNewBtaggers = True
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").pfJetProbabilityBJetTag = cms.untracked.string("pfJetProbabilityBJetTagsDeepFlavour")
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").pfUnifiedParticleTransformerAK4JetTags = cms.untracked.string("pfUnifiedParticleTransformerAK4JetTagsDeepFlavour")

if doTracks:
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").doTracks = cms.untracked.bool(True)
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").ipTagInfoLabel = cms.untracked.string("pfImpactParameter")
if doSvtx:
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").doSvtx = cms.untracked.bool(True)
getattr(process,"akCs"+jetLabel+"PFJetAnalyzer").svTagInfoLabel = cms.untracked.string("pfInclusiveSecondaryVertexFinder")

process.forest += getattr(process,"akCs"+jetLabel+"PFJetAnalyzer")


#########################
# Event Selection -> add the needed filters here
#########################

process.load('HeavyIonsAnalysis.EventAnalysis.collisionEventSelection_cff')
process.pclusterCompatibilityFilter = cms.Path(process.clusterCompatibilityFilter)
process.pprimaryVertexFilter = cms.Path(process.primaryVertexFilter)
process.load('HeavyIonsAnalysis.EventAnalysis.hffilter_cfi')
process.pphfCoincFilter2Th4 = cms.Path(process.phfCoincFilter2Th4)
process.pAna = cms.EndPath(process.skimanalysis)

0 comments on commit 50605df

Please sign in to comment.