Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run i ifinal #19

Open
wants to merge 135 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
fa42829
2018 branch to run on 102x mc
lsoffi Sep 25, 2018
13e4889
cut by cut bool
swagata87 Oct 17, 2018
4b82aaf
cut-by-cut ele branches
swagata87 Oct 17, 2018
a252248
changes
swagata87 Oct 19, 2018
dea118f
update
swagata87 Dec 10, 2018
278bc29
100X to 94X name change
swagata87 Feb 28, 2019
4a806f2
Do not track *.pyc, *.root or temporary crab files
Aug 29, 2019
c801ab0
Update README.md
Aug 29, 2019
1cbf97c
Comment added
Aug 29, 2019
5dcd9f7
Pile-up for 2018
Aug 29, 2019
f64d32d
Clean-up of unneeded old commented code
Aug 29, 2019
3272736
Make it possible to add multiple HLT filters to measure
Aug 29, 2019
67f9bba
Update README.md
tomcornelis Sep 4, 2019
269f9e2
2018 files
swagata87 Sep 9, 2019
d850acf
Merge pull request #1 from tomcornelis/Nm1_proposedUpdates
swagata87 Oct 2, 2019
1b58ef3
first commit
lfinco Dec 4, 2019
3bde22e
trying to match L1 objects
lfinco Dec 4, 2019
2e8b722
working L1 matching for Leg1
lfinco Dec 5, 2019
41465c3
Attempt to have the L1 leg thresholds based on prescale
Dec 6, 2019
784560a
Merge pull request #1 from tomcornelis/lfinco
lfinco Dec 9, 2019
386ab20
modified version of submitting script
lfinco Dec 16, 2019
449397d
Subtracting lumis from lower thresholds + merging files with the same…
Dec 16, 2019
3b0ceab
Merge pull request #2 from tomcornelis/lfinco
lfinco Dec 16, 2019
c5d46e3
Skipping empty jsons
Dec 17, 2019
04cf172
Merge pull request #3 from tomcornelis/lfinco
lfinco Dec 17, 2019
bd4b94e
correction of the allProbes collection for the case with L1 matching
lfinco Jan 16, 2020
9f926d8
few small corrections and tests
lfinco Jan 17, 2020
3119dd0
Simplifying/generalization of crab submission script
Feb 18, 2020
bf02db6
README: recommended release to include V2 ID's
Feb 18, 2020
b81fb62
Storing more ID's in the trigger tree
Feb 18, 2020
77d822a
Test directory
Feb 18, 2020
a1caf80
Move crab directory one level up
Feb 18, 2020
5f06b00
Quick way to test all data/MC and year combinations
Feb 19, 2020
b52ec39
Run trigger by default
Feb 19, 2020
4f19787
implement el_relPfLepIso03 and passingDoubleHLTsafe
guitargeek Feb 19, 2020
b8acc18
Merge pull request #1 from guitargeek/VVV_patch
tomcornelis Feb 19, 2020
fd7160a
Adding check for single values in the test runs
Feb 20, 2020
ab6f418
Big clean-up/refactoring, all ID's now added to the trigger tree
Feb 20, 2020
b722d8b
Merge remote-tracking branch 'myfork/RunIIfinal' into RunIIfinal
Feb 20, 2020
0bb0766
Print out the error when test fails
Feb 20, 2020
d47a635
Reference files uploaded to git
Feb 20, 2020
be188eb
In the process of adding 2016/2017
Feb 20, 2020
afc9ac0
Updating DY samples
Feb 21, 2020
7fa4c3b
README updated
Feb 21, 2020
2f46c2c
L1 matching requirement for leg23 flag, added flags for HLTDoubleEle33
lfinco Feb 21, 2020
7b17490
Merge remote-tracking branch 'lfinco/lfinco' into RunIIfinal_lfincoMerge
Feb 21, 2020
f14dc6a
L1 matching clean-up
Feb 21, 2020
2a8c7b5
Apply L1 matching based on the "L1match" occuring in the flag name
Feb 26, 2020
eebab97
Small print statement
Feb 27, 2020
9124096
Adding photon variables
Feb 27, 2020
6b9870a
Updating test files
Feb 27, 2020
045921b
Merge pull request #2 from tomcornelis/RunIIfinal_lfincoMerge
tomcornelis Feb 27, 2020
7c2f2cd
Adding two more photon variables
Feb 27, 2020
5b682a3
Correct HLT settings for all years
Feb 28, 2020
fab75d0
Print statement
Feb 28, 2020
c878088
print statement
Feb 28, 2020
bf03941
Update reference files
Feb 28, 2020
837ff10
Merge pull request #3 from tomcornelis/RunIIfinal_lfincoMerge
tomcornelis Feb 28, 2020
790ae04
Improving crab submission
Feb 28, 2020
88ed42e
typo solved
Feb 28, 2020
8482262
Make sure they make separate crab directories for different years
Feb 28, 2020
1d98bbc
Allow to submit from slc7
Feb 28, 2020
1d0c267
Use wrapper to avoid crazy crab errors
Feb 28, 2020
3c42d67
Make it work on lxplus
Mar 2, 2020
b98c2ec
Needs to differentiate between era=2016 and is80X, because 2016 MiniA…
Mar 2, 2020
be26178
Adding variable which seem to be in there in some other branches
Mar 3, 2020
5083d29
Implementing the possibility to submit with different L1 thresholds
Mar 3, 2020
dcc0f6d
Little script to merge the output files
Mar 5, 2020
c404f12
Automatic check if it was already merged correctly
Mar 5, 2020
debf6b6
To mix the prescales in monte carlo as they are in data
Mar 6, 2020
50aed17
Update README
Mar 9, 2020
3e5f9fc
Small fixes
Mar 14, 2020
0606440
Implementation of lepton mva's
Mar 20, 2020
bbe7ab9
Switch of debug output
Mar 20, 2020
b77a6dc
Refactoring the probe modules
Mar 23, 2020
1ff90cd
Removing duplicate code, use writeValueMap() everywhere
Mar 25, 2020
f249a2c
Adding the new TOP leptonMva
May 8, 2020
0247ea2
Update testing
May 8, 2020
1a17dbb
Updating README
May 8, 2020
2b85a53
Update README
May 8, 2020
b277d2b
Update README
May 8, 2020
f37c63e
Make sure there is a log directory
May 8, 2020
eab98da
Make sure ElectronVariableHelper.h can work on AOD
May 12, 2020
aa13dc9
Fix AOD running
May 12, 2020
b6458a6
Save mc_probe variables only for MC
May 12, 2020
43b5ecb
Do not ignore exceptions
May 12, 2020
d054740
Fix/improve compareTrees script
May 12, 2020
f3754d6
New test run finished
May 12, 2020
fa23503
update .gitignore
May 12, 2020
18be326
To quickly commit updated rootfiles and logs from test
May 12, 2020
4d12423
Putting GT's in TnPTreeProducer_cfg
May 14, 2020
fb1ba8e
New test run finished
May 14, 2020
2fb6e1a
Fixing variable input to lepton mva's
May 14, 2020
b530134
New test run finished
May 14, 2020
9636b75
Quick change in what to run for tests
May 15, 2020
87f7f2a
Quick change in what to run for tests
May 15, 2020
bcc1e0a
Typo and update README
May 15, 2020
8bb7fdf
Add DY NLO and reduce the units per job to avoid walltime limits
May 29, 2020
f3d79eb
Remove tabs from python code
Jun 2, 2020
571fabd
Avoid to run the try catch block for every event
Jun 3, 2020
73108b3
Adding location of tuples to README
Jun 5, 2020
35a7cc6
Use own test files
Jun 5, 2020
57a2bac
Adding a few more variables
Jun 8, 2020
2f8d7b3
Working towards a CMSSW-release indepedent branch
Jun 8, 2020
2524b1a
New test run finished
Jun 8, 2020
60787da
Combining branch RunIIfinal_UL into RunIIfinal
Jun 8, 2020
7c4a054
New test run finished
Jun 8, 2020
52334fa
Needed for compilation in CMSSW_10_6_X
Jun 9, 2020
d41c3ca
Small fix to find xml for leptonMvaTOP in UL
Jun 9, 2020
91a15ec
Also having the UL test files stored at eos
Jun 9, 2020
85b0783
runTests.py does UL tests when in CMSSW_10_6
Jun 9, 2020
8e972bf
Update README: RunIIfinal branch works now in both CMSSW_10_2 and CMS…
Jun 9, 2020
0932585
New test run finished (UL tests added)
Jun 9, 2020
eedea55
Get rereco and UL crab submission in same file
Jun 9, 2020
83ff108
Make it CMSSW_11_X compatible
Jun 9, 2020
6cda14b
Merge branch 'RunIIfinal' of https://github.com/tomcornelis/EgammaAna…
Jun 9, 2020
2069ed6
Update README
Jun 9, 2020
68690fd
Fix isReleaseAbove function
Jun 9, 2020
b7f4de3
Update GT for 2018
Jun 9, 2020
3f34119
We still had this old 80X-style 2016 data here, corrected now
Jun 10, 2020
bbe62cb
Typo in README
Jun 11, 2020
8382a15
Update README: new tuples location
Jun 15, 2020
e18c34b
Adding extension for 2018 DY NLO sample
Jun 20, 2020
901502b
Add matched conversion
Jul 8, 2020
cf79a2a
Don't fail when temp files already exist
Jul 16, 2020
de3b6c1
Updated general info for UL2016
ram1123 Feb 10, 2021
74d6b35
Merge pull request #5 from ram1123/dev/RunIIfinal_UL2016
swagata87 Jun 27, 2022
a378e17
change made
Aug 1, 2022
ac31b25
change made
Aug 1, 2022
c9acfdf
Update README.md
yiruole Aug 1, 2022
d23131f
Update TnPTreeProducer_cfg.py
yiruole Aug 2, 2022
df9fd9e
change made
Mar 20, 2023
e1b8d5f
change made
Mar 20, 2023
0e0da1f
change made
Apr 3, 2023
ac7d575
change made
Apr 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
trying to match L1 objects
  • Loading branch information
lfinco committed Dec 4, 2019
commit 3bde22e7331975ce6db6d105ec5fb9ff12469866
14 changes: 14 additions & 0 deletions plugins/MiniAODL1Stage2CandProducer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "MiniAODL1Stage2CandProducer.h"

#include "DataFormats/PatCandidates/interface/Electron.h"
#include "DataFormats/PatCandidates/interface/Photon.h"

typedef MiniAODL1Stage2CandProducer<pat::Electron> PatElectronL1Stage2CandProducer;
DEFINE_FWK_MODULE(PatElectronL1Stage2CandProducer);

typedef MiniAODL1Stage2CandProducer<reco::GsfElectron> GsfElectronL1Stage2CandProducer;
DEFINE_FWK_MODULE(GsfElectronL1Stage2CandProducer);

//typedef MiniAODL1CandProducer<pat::Photon> PatPhotonL1CandProducer;
//DEFINE_FWK_MODULE(PatPhotonL1CandProducer);

136 changes: 136 additions & 0 deletions plugins/MiniAODL1Stage2CandProducer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#ifndef _MINIADOL1STAGE2CANDPRODUCER_H_
#define _MINIADOL1STAGE2CANDPRODUCER_H_

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/EDProducer.h"

//#include "DataFormats/L1Trigger/interface/L1EmParticle.h"
//#include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
#include "DataFormats/L1Trigger/interface/EGamma.h" //for stage 2 L1
#include <DataFormats/Math/interface/deltaR.h>

#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <string>
#include <vector>

template <class T>
class MiniAODL1Stage2CandProducer : public edm::EDProducer {

typedef std::vector<T> TCollection;
typedef edm::Ref<TCollection> TRef;
typedef edm::RefVector<TCollection> TRefVector;

public:
MiniAODL1Stage2CandProducer(const edm::ParameterSet&);
~MiniAODL1Stage2CandProducer();

bool l1OfflineMatching(const std::vector<l1t::EGamma>& triggerObjects,
math::XYZTLorentzVector refP4, float dRmin, float dRminEE, int& index);
private:
/// compare two l1Extra in et
struct ComparePt {
bool operator()( const l1t::EGamma& t1, const l1t::EGamma& t2 ) const {
return t1.et() > t2.et();
}
};
ComparePt ptComparator;

virtual void produce(edm::Event&, const edm::EventSetup&) override;

edm::EDGetTokenT<TRefVector> inputs_;
edm::EDGetTokenT<l1t::EGammaBxCollection> l1ObjectsToken_;
float minET_;
float dRMatch_;
float dRMatchEE_;

};

template <class T>
MiniAODL1Stage2CandProducer<T>::MiniAODL1Stage2CandProducer(const edm::ParameterSet& iConfig ) :


inputs_(consumes<TRefVector>(iConfig.getParameter<edm::InputTag>("inputs"))),
l1ObjectsToken_(consumes<l1t::EGammaBxCollection> ( iConfig.getParameter<edm::InputTag>("objects"))),
minET_(iConfig.getParameter<double>("minET")),
dRMatch_(iConfig.getParameter<double>("dRmatch"))
{
std::cout << "!!!!!!!!!!!!!!!!!!!!" << std::endl;
if(iConfig.exists("dRmatchEE"))
dRMatchEE_ = (iConfig.getParameter<double>("dRmatchEE"));
else
dRMatchEE_ = dRMatch_; //for backwards compatibility

produces<TRefVector>();
}

template <class T>
MiniAODL1Stage2CandProducer<T>::~MiniAODL1Stage2CandProducer()
{}

template <class T>
void MiniAODL1Stage2CandProducer<T>::produce(edm::Event &iEvent, const edm::EventSetup &eventSetup) {

cout <<"1" <<endl;
edm::Handle<l1t::EGammaBxCollection> l1ObjectsH;
edm::Handle<TRefVector> inputs;

iEvent.getByToken(l1ObjectsToken_, l1ObjectsH);
iEvent.getByToken(inputs_, inputs);
cout <<"2" <<endl;
//Merge L1 objects and sort by et
std::vector<l1t::EGamma> mergedL1;
for(auto it=l1ObjectsH->begin(0); it!=l1ObjectsH->end(0); it++){
mergedL1.push_back(*it);
// std::cout << "L1: " << endl;
}
cout <<"3" <<endl;
std::sort(mergedL1.begin(), mergedL1.end(), ptComparator);

// Create the output collection
// std::auto_ptr<TRefVector> outColRef(new TRefVector);
std::unique_ptr<TRefVector> outColRef(new TRefVector);
cout <<"4" <<endl;
for (size_t i=0; i<inputs->size(); i++) {
TRef ref = (*inputs)[i];
int index = -1;

if (l1OfflineMatching(mergedL1, ref->p4(), dRMatch_, dRMatchEE_, index)) {
outColRef->push_back(ref);
}
}
cout <<"5" <<endl;
//iEvent.put(outColRef);
iEvent.put(std::move(outColRef));
}

template <class T>
bool MiniAODL1Stage2CandProducer<T>::l1OfflineMatching(const std::vector<l1t::EGamma>& l1Objects,
math::XYZTLorentzVector refP4, float dRmin, float dRminEE, int& index) {

cout <<"a" <<endl;
index = 0;
//for (auto it=l1Objects.begin(0); it != l1Objects.end(0); it++) { //bx 0 only considered
for (auto it=l1Objects.begin(); it != l1Objects.end(); it++) {
if (it->et() < minET_)
continue;
cout <<"b" <<endl;
float dR = deltaR(refP4, it->p4());
if(fabs(refP4.eta()) < 1.5)
if (dR < dRmin)
return true;
if(dR < dRminEE) //allow for looser requirements in EE (not needed for stage2)
return true;
index++;
}

return false;
cout <<"c" <<endl;
}


#endif

11 changes: 11 additions & 0 deletions plugins/MiniAODStage2L1CandProducer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "MiniAODL1CandProducer.h"

#include "DataFormats/PatCandidates/interface/Electron.h"
#include "DataFormats/PatCandidates/interface/Photon.h"

typedef MiniAODL1CandProducer<pat::Electron> PatElectronL1CandProducer;
DEFINE_FWK_MODULE(PatElectronL1CandProducer);

typedef MiniAODL1CandProducer<pat::Photon> PatPhotonL1CandProducer;
DEFINE_FWK_MODULE(PatPhotonL1CandProducer);

13 changes: 13 additions & 0 deletions python/egmGoodParticlesDef_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def setGoodParticlesMiniAOD(process, options):
src = cms.InputTag( options['ELECTRON_COLL'] ),
cut = cms.string( options['ELECTRON_CUTS'] ),
)


process.goodElectronsL1 = cms.EDFilter("PATElectronRefSelector",
src = cms.InputTag( options['ELECTRON_COLL'] ),
cut = cms.string( options['ELECTRON_CUTS'] ),
)

#################### Photon collection
process.goodPhotons = cms.EDFilter("PATPhotonRefSelector",
Expand Down Expand Up @@ -154,6 +160,13 @@ def setGoodParticlesAOD(process, options):
cut = cms.string(options['ELECTRON_CUTS'])
)


process.goodElectronsL1 = cms.EDFilter("GsfElectronRefSelector",
src = cms.InputTag( options['ELECTRON_COLL'] ),
cut = cms.string( options['ELECTRON_CUTS'] ),
)


#################### Photon collection
### dummy in AOD (use miniAOD for photons)
process.goodPhotons = cms.EDFilter("PhotonRefSelector",
Expand Down
37 changes: 33 additions & 4 deletions python/egmTreesSetup_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,47 @@ def setTagsProbes(process, options):
)

##################### PROBE ELECTRONs ###########################
# process.probeEle = process.tagEle.clone()
# process.probeEle.filterNames = cms.vstring(options['TnPHLTProbeFilters'])
# process.probeEle.inputs = cms.InputTag("goodElectrons")




######added by me
################# PROBE Matched to L1 #######################

process.goodElectronProbesL1 = cms.EDProducer("PatElectronL1Stage2CandProducer",
#process.goodElectronProbesL1 = cms.EDProducer("GsfElectronL1Stage2CandProducer",
inputs = cms.InputTag("goodElectrons"),
#isoObjects = cms.InputTag("l1extraParticles:Isolated"),
#nonIsoObjects = cms.InputTag("l1extraParticles:NonIsolated"),
#objects = cms.InputTag("hltCaloStage2Digis:EGamma"),
objects = cms.InputTag("caloStage2Digis:EGamma"),
minET = cms.double(23), #lead eff only
#minET = cms.double(14), #sublead eff only
#minET = cms.double(0.), #test on how L1 efficiency with the whole big OR changes vs time
dRmatch = cms.double(0.2), #defined to match L1 online matching to hlt (0.261)
dRmatchEE = cms.double(0.2), #defined to match L1 online matching to hlt (should probably be tightened for stage2)
isolatedOnly = cms.bool(False)
)


process.probeEle = process.tagEle.clone()
process.probeEle.filterNames = cms.vstring(options['TnPHLTProbeFilters'])
process.probeEle.inputs = cms.InputTag("goodElectrons")
process.probeEle.inputs = cms.InputTag("goodElectronProbesL1")


################# PROBE ELECTRONs passHLT #######################


process.probeElePassHLT = process.tagEle.clone()
process.probeElePassHLT.inputs = cms.InputTag("probeEle")
process.probeElePassHLT.isAND = cms.bool(False)

for flag, filterNames in options['HLTFILTERSTOMEASURE'].iteritems():
setattr(process, flag, process.probeElePassHLT.clone(filterNames=filterNames))

setattr(process, flag, process.probeElePassHLT.clone(filterNames=filterNames))
###################### PROBE PHOTONs ############################
process.probePho = cms.EDProducer( gamHLTProducer,
filterNames = options['TnPHLTProbeFilters'],
Expand Down Expand Up @@ -159,7 +188,7 @@ def setSequences(process, options):
process.hlt_sequence = cms.Sequence( process.hltFilter )

process.tag_sequence = cms.Sequence(
process.goodElectrons +
process.goodElectrons +
process.tagEleCutBasedTight +
process.tagEle
)
Expand Down
4 changes: 2 additions & 2 deletions scripts/crab/tnpCrabSubmitAOD.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

doEleTree = 'doEleID=False'
doPhoTree = 'doPhoID=False'
doHLTTree = 'doTrigger=False'
doHLTTree = 'doTrigger=True'
doRECO = 'doRECO=True'

mainOutputDir = '/store/group/phys_egamma/tnp/80X/RecoSF/%s' % submitVersion
#mainOutputDir = '/store/group/phys_egamma/tnp/80X/RecoSF/%s' % submitVersion

config.General.transferLogs = False

Expand Down
Loading