Skip to content

Commit

Permalink
Merge pull request cms-sw#21 from pjwinnetou/OniaTree_11_2_X_miniAOD
Browse files Browse the repository at this point in the history
event selection filter & pdg selection option added & flag added of using L1 propagated muons
  • Loading branch information
pjwinnetou authored Sep 1, 2021
2 parents f01206a + ca85fb1 commit bb6431c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 20 deletions.
1 change: 1 addition & 0 deletions HeavyIonsAnalysis/EventAnalysis/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<use name="FWCore/PluginManager"/>
<use name="FWCore/ServiceRegistry"/>
<use name="HLTrigger/HLTcore"/>
<use name="RecoHI/HiCentralityAlgos"/>
<use name="DataFormats/HeavyIonEvent"/>
<use name="rootcore"/>
<flags EDM_PLUGIN="1"/>
3 changes: 2 additions & 1 deletion HiAnalysis/HiOnia/python/hioniaanalyzer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

onlyTheBest = cms.bool(False),
applyCuts = cms.bool(True),
selTightGlobalMuon = cms.bool(False),
selTightGlobalMuon = cms.bool(False),
storeEfficiency = cms.bool(False),
SofterSgMuAcceptance = cms.bool(False),
SumETvariables = cms.bool(True),
Expand All @@ -44,6 +44,7 @@

muonLessPV = cms.bool(False),
useSVfinder = cms.bool(False),
useL1MuonProp = cms.bool(False),

#-- Gen Details
BcPDG = cms.int32(541),
Expand Down
3 changes: 2 additions & 1 deletion HiAnalysis/HiOnia/python/oniaTreeAnalyzer_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def oniaTreeAnalyzer(process, muonTriggerList=[[],[],[],[]], HLTProName='HLT', m
storeSameSign = cms.bool(True), # Store/Drop same sign dimuons
AtLeastOneCand = cms.bool(False), # If true, store only events that have at least one selected candidate dimuon (or trimuon candidate if doTrimuons=true)
useSVfinder = cms.bool(False), #whether to use the standard secondary vertex finder (with some parameters tweaked to loosen it)
useL1MuonProp = cms.bool(False),

removeSignalEvents = cms.untracked.bool(False), # Remove/Keep signal events
removeTrueMuons = cms.untracked.bool(False), # Remove/Keep gen Muons
Expand Down Expand Up @@ -222,7 +223,7 @@ def oniaTreeAnalyzer(process, muonTriggerList=[[],[],[],[]], HLTProName='HLT', m
#from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
#stage2L1Trigger.toModify(process.hionia, stageL1Trigger = 2)

process.hionia.primaryVertexTag = cms.InputTag("offlinePrimaryVertices")
process.hionia.primaryVertexTag = cms.InputTag("offlineSlimmedPrimaryVerticesRecovery" if miniAOD else "offlinePrimaryVertices")
process.hionia.genParticles = cms.InputTag("prunedGenParticles" if miniAOD else "genParticles")
process.hionia.muonLessPV = cms.bool(muonlessPV)
process.hionia.CentralitySrc = cms.InputTag("")
Expand Down
20 changes: 10 additions & 10 deletions HiAnalysis/HiOnia/test/hioniaanalyzer_PbPbPrompt_112X_DATA_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
HLTProcess = "HLT" # Name of HLT process
isMC = False # if input is MONTECARLO: True or if it's DATA: False
muonSelection = "Glb" # Single muon selection: All, Glb(isGlobal), GlbTrk(isGlobal&&isTracker), Trk(isTracker), GlbOrTrk, TwoGlbAmongThree (which requires two isGlobal for a trimuon, and one isGlobal for a dimuon) are available
applyEventSel = False # Only apply Event Selection if the required collections are present
applyEventSel = True # Only apply Event Selection if the required collections are present
OnlySoftMuons = False # Keep only isSoftMuon's (without highPurity, and without isGlobal which should be put in 'muonSelection' parameter) from the beginning of HiSkim. If you want the full SoftMuon selection, set this flag false and add 'isSoftMuon' in lowerPuritySelection. In any case, if applyCuts=True, isSoftMuon is required at HiAnalysis level for muons of selected dimuons.
applyCuts = False # At HiAnalysis level, apply kinematic acceptance cuts + identification cuts (isSoftMuon (without highPurity) or isTightMuon, depending on TightGlobalMuon flag) for muons from selected di(tri)muons + hard-coded cuts on the di(tri)muon that you would want to add (but recommended to add everything in LateDimuonSelection, applied at the end of HiSkim)
SumETvariables = True # Whether to write out SumET-related variables
Expand All @@ -23,6 +23,7 @@
useSVfinder = False # External SV finder to check if the muons are from a resolved SV
miniAOD = True # whether the input file is in miniAOD format (default is AOD)
miniAOD_muonCuts = False # Apply the cuts used in the muon collections of miniAOD. Only has an effect with AOD.
useL1MuonProp = False # whether use of eta, phi information at L1 propagated from PV. Only use for offline-online matching studies
#----------------------------------------------------------------------------

# Print Onia Tree settings:
Expand Down Expand Up @@ -51,7 +52,7 @@
#'file:/eos/cms/store/group/phys_heavyions/mnguyen/miniAOD/reMiniAOD_DATA_PAT_HIDoubleMuon.root',
#'file:/afs/cern.ch/user/a/anstahll/work/MiniAOD/OniaTree/TRY2/CMSSW_10_3_3_patch1/src/reMiniAOD_DATA_PAT_JPsi.root',
#'file:/home/llr/cms/falmagne/miniAOD/CMSSW_10_3_3_patch1/src/reMiniAOD_DATA_PAT_JPsi_HiDoubleMuPsiPeri.root'
'file:/home/llr/cms/falmagne/miniAOD/CMSSW_11_2_0_pre9/src/step2_miniAOD_DoubleMuonPD_11_2_0_pre9_1.root'
'/store/hidata/HIRun2018A/HIDoubleMuon/MINIAOD/PbPb18_MiniAODv1-v1/120000/00137f14-f84b-4f1b-ad37-0717a01c981b.root'
#'/store/hidata/HIRun2018A/HIDoubleMuon/AOD/04Apr2019-v1/310001/FC3997EF-7B96-7947-81B0-96EEEA53AA60.root',
#'/store/hidata/HIRun2018A/HIDoubleMuon/AOD/04Apr2019-v1/310001/FE775A7B-0F67-A14E-AAEE-1E00D4EE0BC9.root',
#'/store/hidata/HIRun2018A/HIDoubleMuon/AOD/04Apr2019-v1/310001/FECEBB19-DB3E-AB40-B807-458134ABEEA3.root',
Expand Down Expand Up @@ -160,9 +161,9 @@

## Global tag
if isMC:
globalTag = 'auto:phase1_2018_realistic_hi'
globalTag = '112X_upgrade2018_realistic_HI_v9'
else:
globalTag = 'auto:run2_data'
globalTag = '112X_dataRun2_PromptLike_HI_v7'

#----------------------------------------------------------------------------

Expand All @@ -184,7 +185,7 @@
process.GlobalTag.snapshotTime = cms.string("9999-12-31 23:59:59.000")
process.GlobalTag.toGet.extend([
cms.PSet(record = cms.string("HeavyIonRcd"),
tag = cms.string("CentralityTable_HFtowers200_HydjetDrum5F_v1032x02_mc" if isMC else "CentralityTable_HFtowers200_DataPbPb_periHYDJETshape_run2v1033p1x01_offline"),
tag = cms.string("CentralityTable_HFtowers200_HydjetDrum5F_v1032x02_mc" if isMC else "CentralityTable_HFtowers200_DataPbPb_update2018HIrun_v0_offline"),
connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS"),
label = cms.untracked.string("HFtowers")
),
Expand Down Expand Up @@ -218,16 +219,15 @@
process.hionia.AtLeastOneCand = cms.bool(atLeastOneCand)
process.hionia.OneMatchedHLTMu = cms.int32(OneMatchedHLTMu)
process.hionia.useSVfinder = cms.bool(useSVfinder)
process.hionia.useL1MuonProp = cms.bool(useL1MuonProp)
process.hionia.checkTrigNames = cms.bool(False)#change this to get the event-level trigger info in hStats output (but creates lots of warnings when fake trigger names are used)

process.oniaTreeAna.replace(process.hionia, process.centralityBin * process.hionia )

if applyEventSel:
process.load('HeavyIonsAnalysis.Configuration.collisionEventSelection_cff')
process.load('HeavyIonsAnalysis.EventAnalysis.clusterCompatibilityFilter_cfi')
process.load('HeavyIonsAnalysis.Configuration.hfCoincFilter_cff')
process.load("RecoVertex.PrimaryVertexProducer.OfflinePrimaryVerticesRecovery_cfi")
process.oniaTreeAna.replace(process.hionia, process.hfCoincFilter2Th4 * process.primaryVertexFilter * process.clusterCompatibilityFilter * process.hionia )
process.load('HeavyIonsAnalysis.EventAnalysis.collisionEventSelection_cff')
process.load('HeavyIonsAnalysis.EventAnalysis.hffilter_cfi')
process.oniaTreeAna.replace(process.hionia, process.clusterCompatibilityFilter * process.primaryVertexFilter * process.phfCoincFilter2Th4 * process.hionia )

if atLeastOneCand:
if doTrimuons:
Expand Down
27 changes: 19 additions & 8 deletions HiAnalysis/HiOnia/test/hioniaanalyzer_PbPbPrompt_112X_MC_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
doDimuonTrk = False # Make collections of Jpsi+track candidates in addition to dimuons
atLeastOneCand = False # Keep only events that have one selected dimuon (or at least one trimuon if doTrimuons = true). BEWARE this can cause trouble in .root output if no event is selected by onia2MuMuPatGlbGlbFilter!
OneMatchedHLTMu = -1 # Keep only di(tri)muons of which the one(two) muon(s) are matched to the HLT Filter of this number. You can get the desired number in the output of oniaTree. Set to -1 for no matching.
pdgIDSel = 553 # Jpsi 443, Y(1S) 553
#############################################################################
keepExtraColl = False # General Tracks + Stand Alone Muons + Converted Photon collections
miniAOD = True # whether the input file is in miniAOD format (default is AOD)
miniAOD_muonCuts = False # Apply the cuts used in the muon collections of miniAOD. Only has an effect with AOD.
useL1MuonProp = False # whether use of eta, phi information at L1 propagated from PV. Only use for offline-online matching studies
#----------------------------------------------------------------------------

# Print Onia Tree settings:
Expand Down Expand Up @@ -50,7 +52,7 @@
#'/store/himc/HINPbPbAutumn18DR/JPsi_pThat-2_TuneCP5_HydjetDrumMB_5p02TeV_Pythia8/AODSIM/mva98_103X_upgrade2018_realistic_HI_v11-v1/120000/06BA15D4-3041-D54E-AB6D-F32A05C95948.root'
'file:/home/llr/cms/falmagne/miniAOD/step2_miniAOD_MC_JPsiEmb.root'
]
options.maxEvents = 1689 # -1 means all events
options.maxEvents = -1 # -1 means all events

# Get and parse the command line arguments
options.parseArguments()
Expand All @@ -76,6 +78,10 @@
"HLT_HIL3Mu0NHitQ10_L2Mu0_MAXdR3p5_M1to5_v1_L1step",#15
"HLT_HIL3Mu0NHitQ10_L2Mu0_MAXdR3p5_M1to5_v1_L2step",#16
"HLT_HIL3Mu0NHitQ10_L2Mu0_MAXdR3p5_M1to5_v1_L3step",#17
"HLT_HIL3Mu2p5NHitQ10_L2Mu2_M7toinf_v1_L1step",#18
"HLT_HIL3Mu2p5NHitQ10_L2Mu2_M7toinf_v1_L2step",#19
"HLT_HIL3Mu2p5NHitQ10_L2Mu2_M7toinf_v1_L3step",#20

),
# Double Muon Filter List
'DoubleMuonFilter' : cms.vstring(
Expand All @@ -96,7 +102,10 @@
"hltL3fL1sL1DoubleMuOpenL1fN3L2f0L3Filtered3",
"hltL1fL1sL1DoubleMuOpenMAXdR3p5L1Filtered0",#L1 step for Jpsi trigger
"hltL2fDoubleMuOpenL2DR3p5PreFiltered0",#L2 step
"hltL3f0L3Mu0L2Mu0DR3p5FilteredNHitQ10M1to5"#"hltL3f0DR3p5L3FilteredNHitQ10"#L3 step
"hltL3f0L3Mu0L2Mu0DR3p5FilteredNHitQ10M1to5",#"hltL3f0DR3p5L3FilteredNHitQ10"#L3 step
"hltL1fL1sL1DoubleMuOpenL1Filtered0",
"hltL2fDoubleMuOpenL2PreFiltered0",
"hltL3f0L3Filtered2p5NHitQ10",
),
# Single Muon Trigger List
'SingleMuonTrigger' : cms.vstring(
Expand Down Expand Up @@ -148,9 +157,10 @@

## Global tag
if isMC:
globalTag = 'auto:phase1_2018_realistic_hi'
globalTag = '112X_upgrade2018_realistic_HI_v9'
else:
globalTag = 'auto:run2_data'
globalTag = '112X_dataRun2_PromptLike_HI_v7'


#----------------------------------------------------------------------------

Expand All @@ -166,13 +176,13 @@
process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '')
### For Centrality
process.load("RecoHI.HiCentralityAlgos.CentralityBin_cfi")
#process.centralityBin.Centrality = cms.InputTag("hiCentrality")
#process.centralityBin.centralityVariable = cms.string("HFtowers")
process.centralityBin.Centrality = cms.InputTag("hiCentrality")
process.centralityBin.centralityVariable = cms.string("HFtowers")
print('\n\033[31m~*~ USING CENTRALITY TABLE FOR PbPb 2018 ~*~\033[0m\n')
process.GlobalTag.snapshotTime = cms.string("9999-12-31 23:59:59.000")
process.GlobalTag.toGet.extend([
cms.PSet(record = cms.string("HeavyIonRcd"),
tag = cms.string("CentralityTable_HFtowers200_HydjetDrum5F_v1032x02_mc" if isMC else "CentralityTable_HFtowers200_DataPbPb_periHYDJETshape_run2v1033p1x01_offline"),
tag = cms.string("CentralityTable_HFtowers200_HydjetDrum5F_v1032x02_mc" if isMC else "CentralityTable_HFtowers200_DataPbPb_update2018HIrun_v0_offline"),
connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS"),
label = cms.untracked.string("HFtowers")
),
Expand All @@ -184,7 +194,7 @@
from HiAnalysis.HiOnia.oniaTreeAnalyzer_cff import oniaTreeAnalyzer
oniaTreeAnalyzer(process,
muonTriggerList=triggerList, #HLTProName=HLTProcess,
muonSelection=muonSelection, L1Stage=2, isMC=isMC, outputFileName=options.outputFile, doTrimu=doTrimuons,
muonSelection=muonSelection, L1Stage=2, isMC=isMC, pdgID=pdgIDSel, outputFileName=options.outputFile, doTrimu=doTrimuons,
miniAOD=miniAOD, miniAODcuts=miniAOD_muonCuts#, OnlySingleMuons=True
)

Expand All @@ -205,6 +215,7 @@
process.hionia.applyCuts = cms.bool(applyCuts)
process.hionia.AtLeastOneCand = cms.bool(atLeastOneCand)
process.hionia.OneMatchedHLTMu = cms.int32(OneMatchedHLTMu)
process.hionia.useL1MuonProp = cms.bool(useL1MuonProp)
process.hionia.checkTrigNames = cms.bool(False)#change this to get the event-level trigger info in hStats output (but creates lots of warnings when fake trigger names are used)

'''
Expand Down

0 comments on commit bb6431c

Please sign in to comment.