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

Tnp fixed for recos fs 10 x #15

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b5b64e4
Merge pull request #7 from cms-analysis/master
fcouderc May 23, 2017
f871cf4
First commit
lsoffi Dec 4, 2017
dbf8c98
Integration of 92X IDs
lsoffi Dec 4, 2017
6ef6ee6
Add pu config for 92x
lsoffi Dec 4, 2017
ddb875c
Porting to 94X, fix of LostHits label, include <numeric> and 94X 2017…
lsoffi Dec 14, 2017
877900d
fix python input files
lsoffi Dec 14, 2017
0b2a1ea
added branch for VHbb
lsoffi Jan 11, 2018
41e30e6
adding 2017 EleID MVA
lsoffi Jan 12, 2018
55a6862
adding back also 80X Ids
lsoffi Jan 16, 2018
6c5c497
Adding Photon MVA 2017
lsoffi Jan 16, 2018
0ce6dca
Trying to add MVA 2017 for photons
lsoffi Jan 16, 2018
4655314
Adding 2017 MVA Photon ID
lsoffi Jan 16, 2018
596fce6
Adding new PU configuration
lsoffi Jan 17, 2018
11d6a7a
Fix to PileupWeightProducer
lsoffi Jan 17, 2018
67b2774
updating crab submit script
lsoffi Jan 19, 2018
9de582b
Merge branch 'CMSSW_9_4_X' into 2018.01.17_94X_prelim
michelif Jan 25, 2018
b7f1c43
Merge pull request #9 from lsoffi/2018.01.17_94X_prelim
michelif Jan 25, 2018
34a2627
Updating README
lsoffi Jan 25, 2018
cf18156
removed miniIso (had been added to master after Livia forked from it)
gzevi Jan 11, 2018
b3c9b7e
should not keep track of pyc files
gzevi Jan 11, 2018
ea132ad
Imported susy variables from NanoAOD configurations
gzevi Jan 17, 2018
e115047
imported SUSY IDs from https://github.com/UAEDF-tomc/cmssw/blob/susy_…
gzevi Jan 19, 2018
7930f6c
better comments
gzevi Jan 19, 2018
a16a445
bugfix
gzevi Jan 25, 2018
c13f2c7
better name for noniso flags
gzevi Jan 25, 2018
96b9280
2017 cutbased IDs
gzevi Jan 25, 2018
3b8470d
Merge pull request #10 from gzevi/SUSY2_on_CMSSW_9_4_X
lsoffi Jan 30, 2018
b2cb891
update README
lsoffi Jan 30, 2018
1fff732
Removing preliminary label from IDs
lsoffi Jan 30, 2018
a122505
fixing naming
michelif Mar 5, 2018
bb1b83f
Merge pull request #11 from michelif/fix_reReco_EGM94V1
lsoffi Mar 5, 2018
b3d5215
solving conflicts w/ cms-analysis CMSSSW_9_4_X
lsoffi Mar 5, 2018
19a2660
updating variables
michelif Mar 6, 2018
5fd2f0e
Merge pull request #2 from michelif/v2018.03.06_94X_fixingVar
lsoffi Mar 6, 2018
2678e63
Adding new variables and ID
lsoffi Mar 7, 2018
dfc14d1
Adding MVA old values
lsoffi Mar 7, 2018
e17f068
Fixing Ele_q
lsoffi Mar 7, 2018
158cfee
Adding event counter to the sequence - new branch for 2018 data
lsoffi May 11, 2018
2b757cd
Removing Spring15 ID
lsoffi May 12, 2018
7e06189
Changes for 10X fixed for RECO SFs
jainshilpi May 17, 2018
c372fa3
Changes for 10X fixed for RECO SFs
jainshilpi May 17, 2018
b0d98dc
Changes for 10X fixed for RECO SFs
jainshilpi May 17, 2018
857146a
tnpproducer maxevents set to options
jainshilpi May 17, 2018
e6aeec7
Changes for 10X fixed for RECO SFs
jainshilpi May 17, 2018
35e7f97
Changes for 10X fixed for RECO SFs
jainshilpi May 30, 2018
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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ TnP package for EGM
For regular users
1. install

git clone https://github.com/cms-analysis/EgammaAnalysis-TnPTreeProducer EgammaAnalysis/TnPTreeProducer -b <branchVersion>
git clone -b CMSSW_9_4_X https://github.com/cms-analysis/EgammaAnalysis-TnPTreeProducer.git EgammaAnalysis/TnPTreeProducer



For developpers
Expand All @@ -14,4 +15,6 @@ For developpers
git remote add username-push git@github.com:username/EgammaAnalysis-TnPTreeProducer.git

3. push commits to fork and then standard pull request process
git push username-push branchname
git push username-push branchname

4. submit jobs
15 changes: 13 additions & 2 deletions plugins/ElectronVariableHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ElectronVariableHelper<T>::ElectronVariableHelper(const edm::ParameterSet & iCon
produces<edm::ValueMap<float> >("dz");
produces<edm::ValueMap<float> >("dxy");
produces<edm::ValueMap<float> >("missinghits");
produces<edm::ValueMap<float> >("gsfhits");
produces<edm::ValueMap<float> >("l1e");
produces<edm::ValueMap<float> >("l1et");
produces<edm::ValueMap<float> >("l1eta");
Expand Down Expand Up @@ -96,21 +97,25 @@ void ElectronVariableHelper<T>::produce(edm::Event & iEvent, const edm::EventSet
std::vector<float> dzVals;
std::vector<float> dxyVals;
std::vector<float> mhVals;

std::vector<float> l1EVals;
std::vector<float> l1EtVals;
std::vector<float> l1EtaVals;
std::vector<float> l1PhiVals;
std::vector<float> pfPtVals;

std::vector<float> gsfhVals;

typename std::vector<T>::const_iterator probe, endprobes = probes->end();

for (probe = probes->begin(); probe != endprobes; ++probe) {

chi2Vals.push_back(probe->gsfTrack()->normalizedChi2());
dzVals.push_back(probe->gsfTrack()->dz(vtx->position()));
dxyVals.push_back(probe->gsfTrack()->dxy(vtx->position()));
mhVals.push_back(float(probe->gsfTrack()->hitPattern().numberOfHits(reco::HitPattern::MISSING_INNER_HITS)));

mhVals.push_back(float(probe->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS)));

gsfhVals.push_back(float(probe->gsfTrack()->hitPattern().trackerLayersWithMeasurement()));
float l1e = 999999.;
float l1et = 999999.;
float l1eta = 999999.;
Expand Down Expand Up @@ -170,6 +175,12 @@ void ElectronVariableHelper<T>::produce(edm::Event & iEvent, const edm::EventSet
mhFiller.fill();
iEvent.put(std::move(mhValMap), "missinghits");

std::unique_ptr<edm::ValueMap<float> > gsfhValMap(new edm::ValueMap<float>());
edm::ValueMap<float>::Filler gsfhFiller(*gsfhValMap);
gsfhFiller.insert(probes, gsfhVals.begin(), gsfhVals.end());
gsfhFiller.fill();
iEvent.put(std::move(gsfhValMap), "gsfhits");

std::unique_ptr<edm::ValueMap<float> > l1EValMap(new edm::ValueMap<float>());
edm::ValueMap<float>::Filler l1EFill(*l1EValMap);
l1EFill.insert(probes, l1EVals.begin(), l1EVals.end());
Expand Down
14 changes: 11 additions & 3 deletions plugins/MiniAODTriggerCandProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ void MiniAODTriggerCandProducer<reco::GsfElectron, trigger::TriggerObject>::prod
template<>
bool MiniAODTriggerCandProducer<pat::Electron, pat::TriggerObjectStandAlone>::onlineOfflineMatching(pat::ElectronRef ref,
const std::vector<pat::TriggerObjectStandAlone>* triggerObjects,
std::string filterLabel, float dRmin) {
std::string filterLabel, float dRmin,const edm::Handle<edm::TriggerResults> & triggerBits,const edm::TriggerNames &triggerNames, edm::Event &iEvent) {

for (pat::TriggerObjectStandAlone obj : *triggerObjects) {
//obj.unpackPathNames(triggerNames);
obj.unpackPathNames(triggerNames);
obj.unpackFilterLabels(iEvent, *triggerBits);
if (obj.hasFilterLabel(filterLabel)) {
float dR = deltaR(ref->superCluster()->position(), obj.p4());
if (dR < dRmin)
Expand All @@ -136,10 +138,13 @@ bool MiniAODTriggerCandProducer<pat::Electron, pat::TriggerObjectStandAlone>::on
template <>
bool MiniAODTriggerCandProducer<pat::Photon, pat::TriggerObjectStandAlone>::onlineOfflineMatching(pat::PhotonRef ref,
const std::vector<pat::TriggerObjectStandAlone>* triggerObjects,
std::string filterLabel, float dRmin) {
std::string filterLabel, float dRmin,const edm::Handle<edm::TriggerResults> & triggerBits,const edm::TriggerNames &triggerNames, edm::Event &iEvent) {

for (pat::TriggerObjectStandAlone obj : *triggerObjects) {
//obj.unpackPathNames(triggerNames);

obj.unpackPathNames(triggerNames);
obj.unpackFilterLabels(iEvent, *triggerBits);
if (obj.hasFilterLabel(filterLabel)) {
float dR = deltaR(ref->superCluster()->position(), obj.p4());
if (dR < dRmin)
Expand All @@ -153,10 +158,13 @@ bool MiniAODTriggerCandProducer<pat::Photon, pat::TriggerObjectStandAlone>::onli
template <>
bool MiniAODTriggerCandProducer<reco::RecoEcalCandidate, pat::TriggerObjectStandAlone>::onlineOfflineMatching(edm::Ref<std::vector<reco::RecoEcalCandidate>> ref,
const std::vector<pat::TriggerObjectStandAlone>* triggerObjects,
std::string filterLabel, float dRmin) {
std::string filterLabel, float dRmin,const edm::Handle<edm::TriggerResults> & triggerBits,const edm::TriggerNames &triggerNames, edm::Event &iEvent) {

for (pat::TriggerObjectStandAlone obj : *triggerObjects) {
//obj.unpackPathNames(triggerNames);

obj.unpackPathNames(triggerNames);
obj.unpackFilterLabels(iEvent, *triggerBits);
if (obj.hasFilterLabel(filterLabel)) {
float dR = deltaR(ref->superCluster()->position(), obj.p4());
if (dR < dRmin)
Expand Down
8 changes: 4 additions & 4 deletions plugins/MiniAODTriggerCandProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MiniAODTriggerCandProducer : public edm::EDProducer {
void init(const edm::TriggerResults &result, const edm::TriggerNames & triggerNames);
bool onlineOfflineMatching(TRef ref,
const UCollection* triggerObjects,
std::string filterLabel, float dRmin);
std::string filterLabel, float dRmin,const edm::Handle<edm::TriggerResults> & triggerBits,const edm::TriggerNames &triggerNames,edm::Event &iEvent);

bool onlineOfflineMatchingRECO(TRef ref,
const UCollection* triggerObjects,
Expand Down Expand Up @@ -122,13 +122,13 @@ template <class T, class U>
TRef ref = (*inputs)[i];
//std::cout << typeof(triggerObjects.product()) << std::endl;
if (filterNames_.size() > 0) {
saveObj = onlineOfflineMatching(ref, triggerObjects.product(), filterNames_[0], dRMatch_);
saveObj = onlineOfflineMatching(ref, triggerObjects.product(), filterNames_[0], dRMatch_,triggerBits,triggerNames,iEvent);

for (size_t f=1; f<filterNames_.size(); f++) {
if (isAND_)
saveObj = (saveObj && onlineOfflineMatching(ref, triggerObjects.product(), filterNames_[f], dRMatch_));
saveObj = (saveObj && onlineOfflineMatching(ref, triggerObjects.product(), filterNames_[f], dRMatch_,triggerBits,triggerNames,iEvent));
else
saveObj = (saveObj || onlineOfflineMatching(ref, triggerObjects.product(), filterNames_[f], dRMatch_));
saveObj = (saveObj || onlineOfflineMatching(ref, triggerObjects.product(), filterNames_[f], dRMatch_,triggerBits,triggerNames,iEvent));
}
}

Expand Down
4 changes: 3 additions & 1 deletion plugins/PileupWeightProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// Created: Mon Nov 21 15:05:26 CET 2011
//
//

#include <numeric>
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"

Expand Down Expand Up @@ -77,6 +77,8 @@ void PileupWeightProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS
if(!iEvent.isRealData() ) {
iEvent.getByToken(pileupInfoTag_, PupInfo);
int nPUtrue = PupInfo->begin()->getTrueNumInteractions();
// std::cout<<nPUtrue<<std::endl;
if(nPUtrue<0) nPUtrue=0;
// *pileupWeight = pileupWeights_[nPUtrue+1]; // NOT 100% sure
*pileupWeight = pileupWeights_[nPUtrue]; // most likely better estimate
}
Expand Down
149 changes: 149 additions & 0 deletions plugins/SimpleEventCounter.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
// -*- C++ -*-
//
// Package: EventCounter/SimpleEventCounter
// Class: SimpleEventCounter
//
/**\class SimpleEventCounter SimpleEventCounter.cc EventCounter/SimpleEventCounter/plugins/SimpleEventCounter.cc

Description: [one line class summary]

Implementation:
[Notes on implementation]
*/
//
// Original Author: Francesco Micheli
// Created: Wed, 09 May 2018 13:01:25 GMT
//
//


// system include files
#include <memory>

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"

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

#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"

#include "TH1F.h"

//
// class declaration
//

// If the analyzer does not use TFileService, please remove
// the template argument to the base class so the class inherits
// from edm::one::EDAnalyzer<> and also remove the line from
// constructor "usesResource("TFileService");"
// This will improve performance in multithreaded jobs.

class SimpleEventCounter : public edm::one::EDAnalyzer<edm::one::SharedResources> {
public:
explicit SimpleEventCounter(const edm::ParameterSet&);
~SimpleEventCounter();

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);


private:
virtual void beginJob() override;
virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
virtual void endJob() override;

// ----------member data ---------------------------
edm::Service<TFileService> fs_;
// to keep track of the sum of weights
TH1F *h_sumW;
};

//
// constants, enums and typedefs
//

//
// static data member definitions
//

//
// constructors and destructor
//
SimpleEventCounter::SimpleEventCounter(const edm::ParameterSet& iConfig)

{
//now do what ever initialization is needed
usesResource("TFileService");

}


SimpleEventCounter::~SimpleEventCounter()
{

// do anything here that needs to be done at desctruction time
// (e.g. close files, deallocate resources etc.)

}


//
// member functions
//

// ------------ method called for each event ------------
void
SimpleEventCounter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
{
using namespace edm;



#ifdef THIS_IS_AN_EVENT_EXAMPLE
Handle<ExampleData> pIn;
iEvent.getByLabel("example",pIn);
#endif

#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
ESHandle<SetupData> pSetup;
iSetup.get<SetupRecord>().get(pSetup);
#endif

// To keep track of the sum of weights
h_sumW->Fill(0.5);

}


// ------------ method called once each job just before starting event loop ------------
void
SimpleEventCounter::beginJob()
{
// to keep track of the sum of weights
h_sumW = fs_->make<TH1F>("h_sumW", "h_sumW", 1, 0., 1.);
h_sumW->Sumw2();
}

// ------------ method called once each job just after ending the event loop ------------
void
SimpleEventCounter::endJob()
{
}

// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
void
SimpleEventCounter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
//The following says we do not know what parameters are allowed so do no validation
// Please change this to state exactly what you do use, even if it is no parameters
edm::ParameterSetDescription desc;
desc.setUnknown();
descriptions.addDefault(desc);
}

//define this as a plug-in
DEFINE_FWK_MODULE(SimpleEventCounter);
Loading