Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added DeepNtuplizer/data/EfficienciesAndSF_ID_GH.root
Binary file not shown.
Binary file added DeepNtuplizer/data/EfficienciesAndSF_ISO_GH.root
Binary file not shown.
Binary file added DeepNtuplizer/data/EfficienciesAndSF_Period4.root
Binary file not shown.
Binary file not shown.
Binary file added DeepNtuplizer/data/egammaEffi.txt_EGM2D.root
Binary file not shown.
Binary file added DeepNtuplizer/data/pileup_MC_2016.root
Binary file not shown.
Binary file added DeepNtuplizer/data/pileup_data_2016.root
Binary file not shown.
8 changes: 6 additions & 2 deletions DeepNtuplizer/interface/ntuple_JetInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class ntuple_JetInfo: public ntuple_content{
ntuple_JetInfo():ntuple_content(),
gluonReduction_(0),
useherwcompat_matching_(false),
isherwig_(false)
{}
isherwig_(false),
isData_(false)
{}

void getInput(const edm::ParameterSet& iConfig);
void initBranches(TTree* );
Expand Down Expand Up @@ -130,6 +131,8 @@ class ntuple_JetInfo: public ntuple_content{

bool useherwcompat_matching_;
bool isherwig_;
bool isData_;
bool removeUndefined_;

/////////branches

Expand Down Expand Up @@ -167,6 +170,7 @@ class ntuple_JetInfo: public ntuple_content{
int isPhysLeptonicB_;
int isPhysLeptonicB_C_;
int isPhysTau_;
int isRealData_;

// global variables
float npv_;
Expand Down
133 changes: 133 additions & 0 deletions DeepNtuplizer/interface/ntuple_eventInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*
* ntuple_eventInfo.h
*
* Created on: 20 Feb 2018
* Author: dwalter
*/

#ifndef DEEPNTUPLES_DEEPNTUPLIZER_INTERFACE_NTUPLE_EVENTINFO_H_
#define DEEPNTUPLES_DEEPNTUPLIZER_INTERFACE_NTUPLE_EVENTINFO_H_

#include "ntuple_content.h"
#include "triggerInfo.h"

#include <vector>
#include <string>
#include <TFile.h>
#include <TH1.h>
#include <TH2.h>
#include "TGraphAsymmErrors.h"
#include <TObjString.h>



#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"

void readHistoFromGraph(TGraphAsymmErrors* graph, TH1D** h, TString name);
void initializeScalefactor(std::vector<std::string> dirs, std::vector<std::string> names, std::vector<TH2F*>* sfHists, std::vector<std::string> periods);
void initializeScalefactor(std::vector<std::string> dirs, std::vector<std::string> names, std::vector<TH1D*>* sfHists, std::vector<std::string> periods);
double getScalefactor(double x, double y, std::vector<TH2F*> hists, unsigned int period, bool takeOverflowX = false);
double getScalefactor(double x, std::vector<TH1D*> hists, unsigned int period);


/*
* For MC weights such as pileup, lhe, ... later: lepton scalefactors
*/
class ntuple_eventInfo: public ntuple_content{
public:
ntuple_eventInfo():ntuple_content(),
isData_(false)
{}

void getInput(const edm::ParameterSet& iConfig);
void initBranches(TTree* );
void readEvent(const edm::Event& iEvent);

//use either of these functions

bool fillBranches(const pat::Jet &, const size_t& jetidx, const edm::View<pat::Jet> * coll=0);

void setLHEToken(edm::EDGetTokenT<LHEEventProduct> lheToken) {
lheToken_ = lheToken;
}
void setMuonsToken(edm::EDGetTokenT<edm::View<pat::Muon> > muonToken){
muonToken_ = muonToken;
}
void setElectronsToken(edm::EDGetTokenT<edm::View<pat::Electron> > electronToken){
electronToken_ = electronToken;
}
void setTriggerToken(edm::EDGetTokenT<edm::TriggerResults> triggerToken){
triggerToken_ = triggerToken;
}



private:

edm::EDGetTokenT<LHEEventProduct> lheToken_;
edm::EDGetTokenT<edm::View<pat::Muon> > muonToken_;
edm::EDGetTokenT<edm::View<pat::Electron> > electronToken_;
edm::EDGetTokenT<edm::TriggerResults> triggerToken_;

edm::Handle<LHEEventProduct> lheInfo;
edm::Handle<edm::View<pat::Muon> > muons;
edm::Handle<edm::View<pat::Electron> > electrons;


bool isData_;
bool useLHEWeights_;

std::vector<double> lumis;
std::vector<std::string> periods;

double sigma;
unsigned int nEvents;

std::string pupDataDir_;
std::string pupMCDir_;

//std::string sfTrigger_mu_BCDEF_Dir_;
//std::string sfTrigger_mu_BCDEF_Name_;
//std::string sfTrigger_mu_GH_Dir_;
//std::string sfTrigger_mu_GH_Name_;

std::vector<std::string> sfTrigger_mu_Dir_;
std::vector<std::string> sfTrigger_mu_Name_;
std::vector<std::string> sfTrigger_e_Dir_;
std::vector<std::string> sfTrigger_e_Name_;
std::vector<std::string> sfTrigger_emu_Dir_;
std::vector<std::string> sfTrigger_emu_Name_;
std::vector<std::string> sfMuonId_Dir_;
std::vector<std::string> sfMuonId_Name_;
std::vector<std::string> sfMuonIso_Dir_;
std::vector<std::string> sfMuonIso_Name_;
std::vector<std::string> sfElIdAndIso_Dir_;
std::vector<std::string> sfElIdAndIso_Name_;
std::vector<std::string> sfMuonTracking_Dir_;
std::vector<std::string> sfMuonTracking_Name_;

std::vector<TH2F*> sfTrigger_mu_Hist;
std::vector<TH2F*> sfTrigger_e_Hist;
std::vector<TH2F*> sfTrigger_emu_Hist;
std::vector<TH2F*> sfMuonId_Hist;
std::vector<TH2F*> sfMuonIso_Hist;
std::vector<TH2F*> sfElIdAndIso_Hist;

std::vector<TH1D*> sfMuonTracking_Hist;

std::vector<std::string> triggers;

// global variables

float ntrueInt_;
std::vector<double> pupWeights;

/////////branches
float event_weight_;



};


#endif /* DEEPNTUPLES_DEEPNTUPLIZER_INTERFACE_NTUPLE_EVENTINFO_H_ */
17 changes: 15 additions & 2 deletions DeepNtuplizer/interface/sorting_modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,23 @@ class sortingClass{
}

static bool compareByABCInv(const sortingClass& a, const sortingClass& b){
return !compareByABC(a,b);

compareResult tmpres=compare(a,b,0);
if(tmpres==cmp_smaller) return false;
if(tmpres==cmp_greater) return true;

tmpres=compare(a,b,1);
if(tmpres==cmp_smaller) return false;
if(tmpres==cmp_greater) return true;

tmpres=compare(a,b,2);
if(tmpres==cmp_smaller) return false;
if(tmpres==cmp_greater) return true;

return false;
}

//private:
//private:
float sortValA,sortValB,sortValC;


Expand Down
36 changes: 36 additions & 0 deletions DeepNtuplizer/interface/triggerInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* treeReader.h
*
* Created on: 17 May 2018
* Author: dwalter
*/

#ifndef DEEPNTUPLES_DEEPNTUPLIZER_INTERFACE_TRIGGERINFO_H_
#define DEEPNTUPLES_DEEPNTUPLIZER_INTERFACE_TRIGGERINFO_H_


#include <map>
#include <vector>
#include "FWCore/Common/interface/TriggerNames.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h"
#include "DataFormats/PatCandidates/interface/PackedTriggerPrescales.h"
#include "FWCore/Framework/interface/Event.h"

class TriggerInfo {

public:
TriggerInfo(const edm::Event& iEvent,
const edm::EDGetTokenT<edm::TriggerResults>& triggerBitsToken);
bool IsTriggered(std::string triggername) const ;
bool Exists(std::string triggername) const ;
bool IsAnyTriggered(std::vector< std::string > triggers) const ;
bool IsAnyTriggered(std::string triggerstring) const;
void ListTriggers() ;
std::map<std::string, bool> GetTriggers() const;
private:
std::map<std::string, bool> triggers;
std::vector<std::string> triggernames;
};

#endif
Loading