Skip to content

Commit

Permalink
Merge pull request #393 from amarini/topic_devel
Browse files Browse the repository at this point in the history
JER & JEC for ak8. Adding Vertex fit for leptons
  • Loading branch information
amarini authored Dec 28, 2018
2 parents 96944f1 + c8f8567 commit 63c96d2
Show file tree
Hide file tree
Showing 583 changed files with 140,529 additions and 615 deletions.
15 changes: 1 addition & 14 deletions Core/interface/BareJets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BareJets : virtual public BareP4
// -- variables
//TClonesArray *p4{0};
vector<float> *rawPt{0};
vector<float> *refPt{0}; // as in MINIAOD->pt()
//vector<float> *refPt{0}; // as in MINIAOD->pt()
vector<float> *bDiscr{0};
vector<float> *bMva{0};

Expand Down Expand Up @@ -80,19 +80,6 @@ class BareJets : virtual public BareP4
vector<float> *qglAxis1{0};
vector<int> *qglCMult{0};
vector<int> *qglNMult{0};

//super extra
//vector<float> dRToProduce{0.01,0.02,0.03,0.04,0.05,0.10,0.15,0.20};
vector<float> dRToProduce{};
map<string,vector<float>* > qglMult_dR;
map<string,vector<float>* > qglPtD_dR;
map<string,vector<float>* > qglAxis2_dR;
map<string,vector<float>* > qglAxis1_dR;

map<string,vector<float>* > qglGenMult_dR;
map<string,vector<float>* > qglGenPtD_dR;
map<string,vector<float>* > qglGenAxis2_dR;
map<string,vector<float>* > qglGenAxis1_dR;
};


Expand Down
4 changes: 4 additions & 0 deletions Core/interface/BareLeptons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class BareLeptons : virtual public BareP4

// ele scale and smear corrections
vector<float> *corr{0};

//kinfit
TClonesArray *kinfitP4{0};
vector<float> *kinfitPtErr{0};


};
Expand Down
20 changes: 10 additions & 10 deletions Core/interface/BareMet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ class BareMet : virtual public BareP4
// Should not stay here, but in MC -> we will esculed it if run on onlyMc
TClonesArray *genP4{0};

TLorentzVector *metNoMu{0};
TLorentzVector *pfMet_e3p0{0}; // raw
//TLorentzVector *metNoMu{0};
//TLorentzVector *pfMet_e3p0{0}; // raw
TLorentzVector *trackMet{0};
TLorentzVector *neutralMet{0};
TLorentzVector *photonMet{0};
TLorentzVector *HFMet{0};
TLorentzVector *CaloMet{0};
//TLorentzVector *neutralMet{0};
//TLorentzVector *photonMet{0};
//TLorentzVector *HFMet{0};
//TLorentzVector *CaloMet{0};
TLorentzVector *RawMet{0};
TLorentzVector *SmearedMet{0};

TLorentzVector *metPuppi{0};
TLorentzVector *metCleanMu{0};
TLorentzVector *metCleanEG{0};
TLorentzVector *metUnClean{0};
//TLorentzVector *metCleanMu{0};
//TLorentzVector *metCleanEG{0};
//TLorentzVector *metUnClean{0};
// --- SYSTEMATICS -- //
enum Syst{ JesUp= 0 , JesDown, JerUp,JerDown,UnclusterUp, UnclusterDown, TauUp, TauDown, PhotonUp, PhotonDown , ElectronUp, ElectronDown, MuonUp, MuonDown, MaxSyst};

// for PF MET
TClonesArray *metSyst{0};
// for Puppi MET
TClonesArray *metPuppiSyst{0};
//TClonesArray *metPuppiSyst{0};
};

#endif
Expand Down
6 changes: 3 additions & 3 deletions Core/interface/BareTaus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class BareTaus : virtual public BareP4
// -- members
//TClonesArray *p4{0};
vector<int> *Q{0}; // charge
vector<float> *M{0}; // mass
vector<float> *iso{0};
//vector<float> *M{0}; // mass
//vector<float> *iso{0};
vector<unsigned> *selBits{0};

// EXTENDED VARIABLES
Expand All @@ -75,7 +75,7 @@ class BareTaus : virtual public BareP4

// the ids are RecoTauTag/Configuration/python/HPSPFTaus_cff.py
// VL=3.5 L=2.5 M=1.5 T=0.8
vector<float> *isoPileupWeightedRaw{0};//byPileupWeightedIsolationRaw3Hits{0};
//vector<float> *isoPileupWeightedRaw{0};//byPileupWeightedIsolationRaw3Hits{0};

//mva isolation newDM raw
vector<float> *isoMva{0};
Expand Down
60 changes: 0 additions & 60 deletions Core/src/BareJets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ BareJets::~BareJets(){
BareFunctions::Delete(qglCMult);
BareFunctions::Delete(qglNMult);
//JER
BareFunctions::Delete(refPt);
BareFunctions::Delete(ptResUncCentral);
BareFunctions::Delete(ptResUncUp);
BareFunctions::Delete(ptResUncDown);
Expand All @@ -47,24 +46,12 @@ BareJets::~BareJets(){
BareFunctions::Delete(bcorr);
BareFunctions::Delete(bcorrunc);
//extra qg variables
for(const auto& dR : dRToProduce)
{
BareFunctions::Delete(qglMult_dR[Form("0p%.0f",dR*1000)]);
BareFunctions::Delete(qglPtD_dR[Form("0p%.0f",dR*1000)]);
BareFunctions::Delete(qglAxis2_dR[Form("0p%.0f",dR*1000)]);
BareFunctions::Delete(qglAxis1_dR[Form("0p%.0f",dR*1000)]);
BareFunctions::Delete(qglGenMult_dR[Form("0p%.0f",dR*1000)]);
BareFunctions::Delete(qglGenPtD_dR[Form("0p%.0f",dR*1000)]);
BareFunctions::Delete(qglGenAxis2_dR[Form("0p%.0f",dR*1000)]);
BareFunctions::Delete(qglGenAxis1_dR[Form("0p%.0f",dR*1000)]);
}
}

void BareJets::init(){
BareP4::init();

BareFunctions::New(rawPt);
BareFunctions::New(refPt);
BareFunctions::New(bDiscr);
BareFunctions::New(bMva);
//BareFunctions::New(bDiscrLegacy);
Expand Down Expand Up @@ -103,17 +90,6 @@ void BareJets::init(){
BareFunctions::New(ptResUncUp);
BareFunctions::New(ptResUncDown);

for(const auto& dR : dRToProduce)
{
BareFunctions::New(qglMult_dR[Form("0p%03.0f",dR*1000)]);
BareFunctions::New(qglPtD_dR[Form("0p%03.0f",dR*1000)]);
BareFunctions::New(qglAxis2_dR[Form("0p%03.0f",dR*1000)]);
BareFunctions::New(qglAxis1_dR[Form("0p%03.0f",dR*1000)]);
BareFunctions::New(qglGenMult_dR[Form("0p%03.0f",dR*1000)]);
BareFunctions::New(qglGenPtD_dR[Form("0p%03.0f",dR*1000)]);
BareFunctions::New(qglGenAxis2_dR[Form("0p%03.0f",dR*1000)]);
BareFunctions::New(qglGenAxis1_dR[Form("0p%03.0f",dR*1000)]);
}

}

Expand Down Expand Up @@ -152,21 +128,9 @@ void BareJets::clear(){
qglNMult->clear();

//
refPt->clear();
ptResUncCentral->clear();
ptResUncUp->clear();
ptResUncDown->clear();
for(const auto& dR : dRToProduce)
{
qglMult_dR[Form("0p%03.0f",dR*1000)] ->clear();
qglPtD_dR[Form("0p%03.0f",dR*1000)] ->clear();
qglAxis2_dR[Form("0p%03.0f",dR*1000)] ->clear();
qglAxis1_dR[Form("0p%03.0f",dR*1000)] ->clear();
qglGenMult_dR[Form("0p%03.0f",dR*1000)] ->clear();
qglGenPtD_dR[Form("0p%03.0f",dR*1000)] ->clear();
qglGenAxis2_dR[Form("0p%03.0f",dR*1000)] ->clear();
qglGenAxis1_dR[Form("0p%03.0f",dR*1000)] ->clear();
}
deepB->clear();
deepBB->clear();
deepC->clear();
Expand All @@ -183,7 +147,6 @@ void BareJets::defineBranches(TTree *t){
BareP4::defineBranches(t, jetName.Data());
//
t->Branch(jetName + "RawPt","vector<float>",&rawPt);
t->Branch(jetName + "RefPt","vector<float>",&refPt);
//
t->Branch(jetName + "Bdiscr","vector<float>",&bDiscr);
t->Branch(jetName + "BMva","vector<float>",&bMva);
Expand Down Expand Up @@ -227,17 +190,6 @@ void BareJets::defineBranches(TTree *t){
t->Branch(jetName + "PtResUncUp","vector<float>",&ptResUncUp);
t->Branch(jetName + "PtResUncDown","vector<float>",&ptResUncDown);

for(const auto& dR : dRToProduce)
{
t->Branch(jetName+Form("QglMult_dR0p%03.0f",dR*1000),"vector<float>",&qglMult_dR[Form("0p%03.0f",dR*1000)] );
t->Branch(jetName+Form("QglPtD_dR0p%03.0f",dR*1000),"vector<float>",&qglPtD_dR[Form("0p%03.0f",dR*1000)] );
t->Branch(jetName+Form("QglAxis2_dR0p%03.0f",dR*1000),"vector<float>",&qglAxis2_dR[Form("0p%03.0f",dR*1000)] );
t->Branch(jetName+Form("QglAxis1_dR0p%03.0f",dR*1000),"vector<float>",&qglAxis1_dR[Form("0p%03.0f",dR*1000)] );
t->Branch(jetName+Form("QglGenMult_dR0p%03.0f",dR*1000),"vector<float>",&qglGenMult_dR[Form("0p%03.0f",dR*1000)] );
t->Branch(jetName+Form("QglGenPtD_dR0p%03.0f",dR*1000),"vector<float>",&qglGenPtD_dR[Form("0p%03.0f",dR*1000)] );
t->Branch(jetName+Form("QglGenAxis2_dR0p%03.0f",dR*1000),"vector<float>",&qglGenAxis2_dR[Form("0p%03.0f",dR*1000)] );
t->Branch(jetName+Form("QglGenAxis1_dR0p%03.0f",dR*1000),"vector<float>",&qglGenAxis1_dR[Form("0p%03.0f",dR*1000)] );
}

t->Branch(jetName +"DeepB",&deepB);
t->Branch(jetName +"DeepBB",&deepBB);
Expand All @@ -255,7 +207,6 @@ void BareJets::setBranchAddresses(TTree* t, std::string prefix)

BareP4::setBranchAddresses(t,jetName.Data());
BareFunctions::SetBranchAddress(t,jetName + "RawPt" ,&rawPt);
BareFunctions::SetBranchAddress(t,jetName + "RefPt" ,&refPt);
BareFunctions::SetBranchAddress(t,jetName + "Bdiscr" ,&bDiscr);
BareFunctions::SetBranchAddress(t,jetName + "BMva" ,&bMva);
//BareFunctions::SetBranchAddress(t,jetName + "BdiscrLegacy" ,&bDiscrLegacy);
Expand Down Expand Up @@ -289,17 +240,6 @@ void BareJets::setBranchAddresses(TTree* t, std::string prefix)
BareFunctions::SetBranchAddress(t,jetName + "PtResUncUp" ,&ptResUncUp);
BareFunctions::SetBranchAddress(t,jetName + "PtResUncDown" ,&ptResUncDown);

for(const auto& dR : dRToProduce)
{
BareFunctions::SetBranchAddress(t,jetName+Form("QglMult_dR0p%03.0f",dR*1000) ,&qglMult_dR[Form("0p%03.0f",dR*1000)] );
BareFunctions::SetBranchAddress(t,jetName+Form("QglPtD_dR0p%03.0f",dR*1000) ,&qglPtD_dR[Form("0p%03.0f",dR*1000)] );
BareFunctions::SetBranchAddress(t,jetName+Form("QglAxis2_dR0p%03.0f",dR*1000),&qglAxis2_dR[Form("0p%03.0f",dR*1000)] );
BareFunctions::SetBranchAddress(t,jetName+Form("QglAxis1_dR0p%03.0f",dR*1000),&qglAxis1_dR[Form("0p%03.0f",dR*1000)] );
BareFunctions::SetBranchAddress(t,jetName+Form("QglGenMult_dR0p%03.0f",dR*1000),&qglGenMult_dR[Form("0p%03.0f",dR*1000)] );
BareFunctions::SetBranchAddress(t,jetName+Form("QglGenPtD_dR0p%03.0f",dR*1000),&qglGenPtD_dR[Form("0p%03.0f",dR*1000)] );
BareFunctions::SetBranchAddress(t,jetName+Form("QglGenAxis2_dR0p%03.0f",dR*1000),&qglGenAxis2_dR[Form("0p%03.0f",dR*1000)] );
BareFunctions::SetBranchAddress(t,jetName+Form("QglGenAxis1_dR0p%03.0f",dR*1000),&qglGenAxis1_dR[Form("0p%03.0f",dR*1000)] );
}

//DEEP
BareFunctions::SetBranchAddress(t,jetName +"DeepB",&deepB);
Expand Down
16 changes: 16 additions & 0 deletions Core/src/BareLeptons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ BareLeptons::~BareLeptons(){
BareFunctions::Delete(r9);
BareFunctions::Delete(resolution);
BareFunctions::Delete(nLayers);
BareFunctions::Delete(kinfitP4);
BareFunctions::Delete(kinfitPtErr);
}

void BareLeptons::init(){
Expand All @@ -46,6 +48,9 @@ void BareLeptons::init(){
BareFunctions::New(r9);
BareFunctions::New(resolution);
BareFunctions::New(nLayers);

BareFunctions::New(kinfitP4);
BareFunctions::New(kinfitPtErr);
}

void BareLeptons::clear(){
Expand Down Expand Up @@ -73,6 +78,9 @@ void BareLeptons::clear(){
resolution->clear() ;
nLayers->clear();

kinfitP4->Clear();
kinfitPtErr->clear();

}

void BareLeptons::defineBranches(TTree*t){
Expand Down Expand Up @@ -107,6 +115,11 @@ void BareLeptons::defineBranches(TTree*t){
t->Branch("lepNLayers","vector<int>",&nLayers);


//kintfit
t->Branch("lepKinfitPtErr","vector<float>",&kinfitPtErr);
t->Branch( "lepKinfitP4","TClonesArray", &kinfitP4, 128000, 0);


}

void BareLeptons::setBranchAddresses(TTree*t){
Expand Down Expand Up @@ -134,6 +147,9 @@ void BareLeptons::setBranchAddresses(TTree*t){

BareFunctions::SetBranchAddress(t,"lepResolution",&resolution);
BareFunctions::SetBranchAddress(t,"lepNLayers",&nLayers);

BareFunctions::SetBranchAddress(t,"lepKinfitPtErr",&kinfitPtErr);
BareFunctions::SetBranchAddress(t,"lepKinfitP4",&kinfitP4);
}

BAREREGISTER(BareLeptons);
Expand Down
Loading

0 comments on commit 63c96d2

Please sign in to comment.