forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cms-sw#6 from nhanvtran/IsoAndFixes-91X
updated submission scripts and isolation analyzer
- Loading branch information
Showing
8 changed files
with
462 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef FASTPUPPI_NTUPLERPRODUCER_ISOANALYZER_HH | ||
#define FASTPUPPI_NTUPLERPRODUCER_ISOANALYZER_HH | ||
#include "combiner.hh" | ||
#include "TFile.h" | ||
#include "TTree.h" | ||
#include <algorithm> | ||
#include <iostream> | ||
#include <fastjet/PseudoJet.hh> | ||
#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" | ||
#include "DataFormats/HepMCCandidate/interface/GenParticle.h" | ||
|
||
class isoanalyzer { | ||
public: | ||
isoanalyzer(std::string iFile, int debug=0); | ||
void setGenMuons(const reco::GenParticleCollection &iGenParticles,int iIndex); | ||
void matchMuons(std::vector<combiner::Particle> &iParticle); | ||
void computeIso(std::vector<combiner::Particle> &iParticle, float coneSize, std::string type); | ||
// double genmatch(int iId, fastjet::PseudoJet &matchjet,std::vector < fastjet::PseudoJet > &genjets); | ||
void clear(); | ||
inline void fill() {fFile->cd(); fTree->Fill();} | ||
inline void write() {fFile->cd(); fTree->Write(); fFile->Write();} | ||
private: | ||
TFile *fFile; | ||
TTree *fTree; | ||
int fBase; | ||
int fSize; | ||
int fNVars; | ||
|
||
float _gmu1_pt; | ||
float _gmu1_eta; | ||
float _gmu1_phi; | ||
float _gmu2_pt; | ||
float _gmu2_eta; | ||
float _gmu2_phi; | ||
|
||
TLorentzVector _mu1; | ||
TLorentzVector _mu2; | ||
|
||
float _mu1_pt; | ||
float _mu1_eta; | ||
float _mu1_phi; | ||
float _mu1_iso_pf; | ||
float _mu1_iso_tk; | ||
float _mu1_iso_tkvtx; | ||
float _mu1_iso_pup; | ||
|
||
float _mu2_pt; | ||
float _mu2_eta; | ||
float _mu2_phi; | ||
float _mu2_iso_pf; | ||
float _mu2_iso_tk; | ||
float _mu2_iso_tkvtx; | ||
float _mu2_iso_pup; | ||
|
||
|
||
int fDebug; | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
scenario = "D12" | ||
#scenario = "D4T" | ||
from Configuration.StandardSequences.Eras import eras | ||
|
||
if "T" in scenario: | ||
process = cms.Process("OUT", eras.Phase2C2_timing) | ||
else: | ||
process = cms.Process("OUT", eras.Phase2C2) | ||
|
||
process.load('Configuration.StandardSequences.Services_cff') | ||
if "D12" in scenario: process.load('Configuration.Geometry.GeometryExtended2023D12Reco_cff') | ||
if "D11" in scenario: process.load('Configuration.Geometry.GeometryExtended2023D11Reco_cff') | ||
if "D4" in scenario: process.load('Configuration.Geometry.GeometryExtended2023D4Reco_cff') | ||
process.load('Configuration.StandardSequences.MagneticField_cff') | ||
process.load('Configuration.StandardSequences.EndOfProcess_cff') | ||
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') | ||
from Configuration.AlCa.GlobalTag import GlobalTag | ||
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') | ||
|
||
process.load("FWCore.MessageLogger.MessageLogger_cfi") | ||
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True), allowUnscheduled = cms.untracked.bool(False) ) | ||
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1)) | ||
process.MessageLogger.cerr.FwkReport.reportEvery = 10 | ||
|
||
process.source = cms.Source("PoolSource", | ||
# replace 'myfile.root' with the source file you want to use | ||
fileNames = cms.untracked.vstring( | ||
'XXXX' | ||
) | ||
) | ||
|
||
process.load('FastPUPPI.NtupleProducer.l1tPFCaloProducersFromOfflineRechits_cff') | ||
process.load('FastPUPPI.NtupleProducer.l1tPFTkProducersFromOfflineTracks_cfi') | ||
|
||
process.InfoOut = cms.EDProducer('NtupleProducer', | ||
L1TrackTag = cms.InputTag('l1tPFTkProducersFromOfflineTracksStrips'), | ||
EcalTPTag = cms.InputTag('l1tPFEcalProducerFromOfflineRechits','towers'), | ||
HGEcalTPTag = cms.InputTag('l1tPFHGCalEEProducerFromOfflineRechits','towers'), | ||
HcalTPTag = cms.InputTag('l1tPFHcalProducerFromOfflineRechits','towers'), | ||
HGHcalTPTag = cms.InputTag('l1tPFHGCalFHProducerFromOfflineRechits','towers'), | ||
BHHcalTPTag = cms.InputTag('l1tPFHGCalBHProducerFromOfflineRechits','towers'), | ||
HFTPTag = cms.InputTag('l1tPFHFProducerFromOfflineRechits','towers'), | ||
MuonTPTag = cms.InputTag('gmtStage2Digis','Muon'), | ||
genParTag = cms.InputTag('genParticles'), | ||
zeroSuppress = cms.bool(False), | ||
corrector = cms.string("/afs/cern.ch/work/n/ntran/private/Correlator/analysis/go15-gpetruc/CMSSW_9_1_0_pre2/src/FastPUPPI/NtupleProducer/data/pion_eta_phi.root"), | ||
corrector2 = cms.string("/afs/cern.ch/work/n/ntran/private/Correlator/analysis/go15-gpetruc/CMSSW_9_1_0_pre2/src/FastPUPPI/NtupleProducer/data/pion_eta_phi_res_old.root"), | ||
ecorrector = cms.string("/afs/cern.ch/work/n/ntran/private/Correlator/analysis/go15-gpetruc/CMSSW_9_1_0_pre2/src/FastPUPPI/NtupleProducer/data/ecorr.root"), | ||
trackres = cms.string("/afs/cern.ch/work/n/ntran/private/Correlator/analysis/go15-gpetruc/CMSSW_9_1_0_pre2/src/FastPUPPI/NtupleProducer/data/tkres.root"), | ||
eleres = cms.string("/afs/cern.ch/work/n/ntran/private/Correlator/analysis/go15-gpetruc/CMSSW_9_1_0_pre2/src/FastPUPPI/NtupleProducer/data/eres.root"), | ||
pionres = cms.string("/afs/cern.ch/work/n/ntran/private/Correlator/analysis/go15-gpetruc/CMSSW_9_1_0_pre2/src/FastPUPPI/NtupleProducer/data/pionres.root"), | ||
trkPtCut = cms.double(YYYY), | ||
metRate = cms.bool(ZZZZ), | ||
etaCharged = cms.double(2.5), | ||
puppiPtCut = cms.double(4.0), | ||
vtxRes = cms.double(0.333), | ||
debug = cms.untracked.int32(1), | ||
outputName = cms.untracked.string("ntuple.root"), | ||
) | ||
|
||
|
||
process.l1Puppi = cms.Sequence(process.l1tPFCaloProducersFromOfflineRechits+process.l1tPFTkProducersFromOfflineTracksStrips) | ||
|
||
process.p = cms.Path(process.l1Puppi * process.InfoOut ) | ||
|
||
if False: # turn on CMSSW downstream processing and output | ||
process.InfoOut.outputName = ""; # turn off Ntuples | ||
|
||
from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets | ||
process.ak4L1RawCalo = ak4PFJets.clone(src = 'InfoOut:RawCalo') | ||
process.ak4L1Calo = ak4PFJets.clone(src = 'InfoOut:Calo') | ||
process.ak4L1TK = ak4PFJets.clone(src = 'InfoOut:TK') | ||
process.ak4L1PF = ak4PFJets.clone(src = 'InfoOut:PF') | ||
process.ak4L1Puppi = ak4PFJets.clone(src = 'InfoOut:Puppi') | ||
|
||
from RecoMET.METProducers.PFMET_cfi import pfMet | ||
pfMet.calculateSignificance = False | ||
process.l1MetRawCalo = pfMet.clone(src = "InfoOut:RawCalo") | ||
process.l1MetCalo = pfMet.clone(src = "InfoOut:Calo") | ||
process.l1MetTK = pfMet.clone(src = "InfoOut:TK") | ||
process.l1MetPF = pfMet.clone(src = "InfoOut:PF") | ||
process.l1MetPuppi = pfMet.clone(src = "InfoOut:Puppi") | ||
|
||
process.l1JetMET = cms.Sequence( | ||
process.ak4L1RawCalo + process.ak4L1Calo + process.ak4L1TK + process.ak4L1PF + process.ak4L1Puppi + | ||
process.l1MetRawCalo + process.l1MetCalo + process.l1MetTK + process.l1MetPF + process.l1MetPuppi | ||
) | ||
|
||
process.p = cms.Path(process.l1Puppi * process.InfoOut * process.l1JetMET ) | ||
|
||
process.out = cms.OutputModule("PoolOutputModule", | ||
fileName = cms.untracked.string("l1pf_out.root"), | ||
outputCommands = cms.untracked.vstring("drop *", | ||
"keep *_gmtStage2Digis_*_*", | ||
"keep *_genParticles_*_*", | ||
"keep *_ak4GenJetsNoNu_*_*", | ||
"keep *_genMetTrue_*_*", | ||
"keep *_*_*_OUT", | ||
) | ||
) | ||
process.e = cms.EndPath(process.out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/python | ||
import sys | ||
import os | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description='Submit some dang jobs') | ||
parser.add_argument('-v','--verbose', dest='verbose', action='store_true', | ||
help='verbosity') | ||
parser.add_argument('--submit', dest='submit', action='store_true', | ||
help='submit') | ||
parser.add_argument('--metRate', dest='metRate', action='store_true', | ||
help='metRate') | ||
parser.add_argument('--sample', dest='sample', default='dy_140', | ||
help='data sample to run on') | ||
parser.add_argument('--tkptcut', dest='tkptcut', default='2.0', | ||
help='data sample to run on') | ||
|
||
args = parser.parse_args() | ||
|
||
def main(): | ||
|
||
print args.sample; | ||
if args.verbose: print "verbose!" | ||
|
||
tplFileIn = 'runNtupleProducer_cfg_tmp.py' | ||
tplFileOut = 'runNtupleProducer_cfg_tmpO.py' | ||
|
||
cursample = args.sample | ||
|
||
samples = {}; | ||
samples['dy_140'] = '/store/relval/CMSSW_9_1_0_pre1/RelValZMM_14/GEN-SIM-RECO/PU25ns_90X_upgrade2023_realistic_v9_D12PU140-v1/00000'; | ||
samples['tt_140'] = '/store/relval/CMSSW_9_1_0_pre1/RelValTTbar_14TeV/GEN-SIM-RECO/PU25ns_90X_upgrade2023_realistic_v9_D11PU140-v1/00000'; | ||
samples['qcdmu_140'] = '/store/relval/CMSSW_9_1_0_pre1/RelValQCD_Pt-20toInf_MuEnrichedPt15_14TeV/GEN-SIM-RECO/PU25ns_90X_upgrade2023_realistic_v9_D12PU140-v1/00000' | ||
samples['mugun_140'] = '/store/relval/CMSSW_9_1_0_pre1/RelValSingleMuPt1Extended/GEN-SIM-RECO/PU25ns_90X_upgrade2023_realistic_v9_D12PU140-v1/00000' | ||
oput = os.listdir('/eos/cms'+samples[cursample]); | ||
# print oput | ||
|
||
sMetRate = "False" | ||
if args.metRate: sMetRate = "True" | ||
sTkPtCut = args.tkptcut; | ||
|
||
fIn = open(tplFileIn, "r") ; | ||
fOut = open(tplFileOut, "wr"); | ||
for line in fIn: | ||
newline = line.replace('YYYY',sTkPtCut) | ||
newline2 = newline.replace('ZZZZ',sMetRate) | ||
fOut.write(newline2[:-1] + "\n"); | ||
print newline2[:-1] | ||
|
||
for i,n in enumerate(oput): | ||
label = cursample+"_"+sTkPtCut | ||
if args.metRate: label += "_metrate" | ||
command = "bsub -q cmscaf1nh -o out.%%J run.sh %s %s $PWD %s %s" % (samples[cursample],n,label,tplFileOut) | ||
print args.submit, args.sample, label, command | ||
if args.submit: os.system(command); | ||
|
||
##--------------------------------------- | ||
if __name__ == '__main__': | ||
main(); | ||
##--------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
#!/bin/bash | ||
|
||
#python submit.py --sample dy_140 --tkptcut 2.0 --submit | ||
#python submit.py --sample tt_140 --tkptcut 2.0 --submit | ||
#python submit.py --sample qcdmu_140 --tkptcut 2.0 --submit | ||
#python submit.py --sample mugun_140 --tkptcut 2.0 --metRate --submit | ||
|
||
python submit.py --sample dy_140 --tkptcut 2.5 --submit | ||
python submit.py --sample tt_140 --tkptcut 2.5 --submit | ||
python submit.py --sample qcdmu_140 --tkptcut 2.5 --submit | ||
python submit.py --sample mugun_140 --tkptcut 2.5 --metRate --submit | ||
|
||
python submit.py --sample dy_140 --tkptcut 3.0 --submit | ||
python submit.py --sample tt_140 --tkptcut 3.0 --submit | ||
python submit.py --sample qcdmu_140 --tkptcut 3.0 --submit | ||
python submit.py --sample mugun_140 --tkptcut 3.0 --metRate --submit | ||
|
||
python submit.py --sample dy_140 --tkptcut 0.0 --submit | ||
python submit.py --sample tt_140 --tkptcut 0.0 --submit | ||
python submit.py --sample qcdmu_140 --tkptcut 0.0 --submit | ||
python submit.py --sample mugun_140 --tkptcut 0.0 --metRate --submit |
Oops, something went wrong.