Skip to content

Commit

Permalink
add L5 (MVA), L1L2L3 correction types to jettruthevent plots (MAV-Jet…
Browse files Browse the repository at this point in the history
…METCorFactorsFactory still needs to be checked in)
  • Loading branch information
kirschen committed Nov 21, 2012
1 parent 816c108 commit a0a45a2
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 7 deletions.
4 changes: 4 additions & 0 deletions ControlPlots.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ ControlPlotsFunction::Function ControlPlots::findJetTruthEventFunction(const std
return &ControlPlotsFunction::jetTruthEventResponseL2L3L4Corrected;
if( varName == "GenJetResponse" && type == ControlPlotsConfig::L2L3ResL4 )
return &ControlPlotsFunction::jetTruthEventResponseL2L3ResL4Corrected;
if( varName == "GenJetResponse" && type == ControlPlotsConfig::L1L2L3 )
return &ControlPlotsFunction::jetTruthEventResponseL1L2L3Corrected;
if( varName == "GenJetResponse" && type == ControlPlotsConfig::L5 )
return &ControlPlotsFunction::jetTruthEventResponseL5Corrected;
if( varName == "") {
return 0;
}
Expand Down
22 changes: 21 additions & 1 deletion ControlPlotsConfig.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// $Id: ControlPlotsConfig.cc,v 1.34 2012/11/08 14:47:03 kirschen Exp $
// $Id: ControlPlotsConfig.cc,v 1.35 2012/11/20 14:35:33 rathjd Exp $

#include "ControlPlotsConfig.h"

Expand Down Expand Up @@ -200,6 +200,8 @@ std::string ControlPlotsConfig::legendLabel(const InputTag& tag) const {
//! - "L2L3Res" : \p CorrectionType::L2L3Res
//! - "L2L3L4" : \p CorrectionType::L2L3L4
//! - "L2L3ResL4" : \p CorrectionType::L2L3ResL4
//! - "L1L2L3" : \p CorrectionType::L1L2L3
//! - "L5" : \p CorrectionType::L5
// --------------------------------------------------
ControlPlotsConfig::CorrectionType ControlPlotsConfig::correctionType(const std::string &typeName) const {
CorrectionType type = Uncorrected;
Expand All @@ -216,6 +218,10 @@ ControlPlotsConfig::CorrectionType ControlPlotsConfig::correctionType(const std:
type = L2L3L4;
else if( typeName == "L2L3ResL4" )
type = L2L3ResL4;
else if( typeName == "L1L2L3" )
type = L1L2L3;
else if( typeName == "L5" )
type = L5;
else
std::cerr << "WARNING: Undefined CorrectionType '" << typeName << "'\n";

Expand All @@ -231,6 +237,8 @@ ControlPlotsConfig::CorrectionType ControlPlotsConfig::correctionType(const std:
//! - \p CorrectionType::L2L3Res : "L2L3res"
//! - \p CorrectionType::L2L3L4 : "L2L3L4"
//! - \p CorrectionType::L2L3ResL4 : "L2L3ResL4"
//! - \p CorrectionType::L1L2L3 : "L1L2L3"
//! - \p CorrectionType::L5 : "L5"
// --------------------------------------------------
std::string ControlPlotsConfig::correctionTypeName(CorrectionType corrType) const {
std::string name = "corrTypeName";
Expand All @@ -247,6 +255,10 @@ std::string ControlPlotsConfig::correctionTypeName(CorrectionType corrType) cons
name = "L2L3L4";
else if( corrType == L2L3ResL4 )
name = "L2L3ResL4";
else if( corrType == L1L2L3 )
name = "L1L2L3";
else if( corrType == L5 )
name = "L5";
else
std::cerr << "WARNING: Undefined CorrectionType '" << corrType << "'\n";

Expand Down Expand Up @@ -638,13 +650,17 @@ void ControlPlotsConfig::init() {
colors_[std::make_pair(*samplesIt,L2L3Res)] = kBlue+2;
colors_[std::make_pair(*samplesIt,L2L3L4)] = 8;
colors_[std::make_pair(*samplesIt,L2L3ResL4)] = 1;
colors_[std::make_pair(*samplesIt,L1L2L3)] = 2;
colors_[std::make_pair(*samplesIt,L5)] = 8;
if(samplesIt - sampleIds.begin() == 0) {
markerStyles_[std::make_pair(*samplesIt,Uncorrected)] = 20;
markerStyles_[std::make_pair(*samplesIt,Kalibri)] = 21;
markerStyles_[std::make_pair(*samplesIt,L2L3)] = 24;
markerStyles_[std::make_pair(*samplesIt,L2L3Res)] = 27;
markerStyles_[std::make_pair(*samplesIt,L2L3L4)] = 28;
markerStyles_[std::make_pair(*samplesIt,L2L3ResL4)] = 20;
markerStyles_[std::make_pair(*samplesIt,L1L2L3)] = 21;
markerStyles_[std::make_pair(*samplesIt,L5)] = 28;
} else {
int style = -(samplesIt - sampleIds.begin());
markerStyles_[std::make_pair(*samplesIt,Uncorrected)] = style;
Expand All @@ -653,6 +669,8 @@ void ControlPlotsConfig::init() {
markerStyles_[std::make_pair(*samplesIt,L2L3Res)] = style;
markerStyles_[std::make_pair(*samplesIt,L2L3L4)] = style;
markerStyles_[std::make_pair(*samplesIt,L2L3ResL4)] = style;
markerStyles_[std::make_pair(*samplesIt,L1L2L3)] = style;
markerStyles_[std::make_pair(*samplesIt,L5)] = style;
}
// Define default legend labels for the different corrections
std::string name = sampleName(*samplesIt);
Expand All @@ -662,6 +680,8 @@ void ControlPlotsConfig::init() {
legendLabels_[std::make_pair(*samplesIt,L2L3Res)] = name + " L2L3res";
legendLabels_[std::make_pair(*samplesIt,L2L3L4)] = name +" L2L3L4";
legendLabels_[std::make_pair(*samplesIt,L2L3ResL4)] = name +" L2L3ResL4";
legendLabels_[std::make_pair(*samplesIt,L1L2L3)] = name + " L1L2L3";
legendLabels_[std::make_pair(*samplesIt,L5)] = name + " L5";

// Read optional legend labels
std::vector<std::string> legLabelStr = bag_of_string(config_->read<std::string>(name_+" legend label",";"));
Expand Down
6 changes: 3 additions & 3 deletions ControlPlotsConfig.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// $Id: ControlPlotsConfig.h,v 1.16 2012/07/17 12:23:38 kirschen Exp $
// $Id: ControlPlotsConfig.h,v 1.17 2012/07/18 14:45:45 kirschen Exp $

#ifndef CONTROLPLOTS_CONFIG_H
#define CONTROLPLOTS_CONFIG_H
Expand Down Expand Up @@ -57,12 +57,12 @@ class ConfigFile;
//!
//! \author Matthias Schroeder
//! \date 2009/12/18
//! $Id: ControlPlotsConfig.h,v 1.16 2012/07/17 12:23:38 kirschen Exp $
//! $Id: ControlPlotsConfig.h,v 1.17 2012/07/18 14:45:45 kirschen Exp $
// ----------------------------------------------------------------
class ControlPlotsConfig {
public:
//! Different jet energy correction types
enum CorrectionType { Uncorrected, Kalibri, L2L3, L2L3Res, L2L3L4, L2L3ResL4 };
enum CorrectionType { Uncorrected, Kalibri, L2L3, L2L3Res, L2L3L4, L2L3ResL4, L1L2L3, L5 };
typedef std::vector<CorrectionType>::const_iterator CorrectionTypeIt;
typedef std::pair<int,CorrectionType> InputTag;
typedef std::vector<InputTag>::const_iterator InputTagsIterator;
Expand Down
36 changes: 35 additions & 1 deletion ControlPlotsFunction.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// $Id: ControlPlotsFunction.cc,v 1.32 2012/11/20 14:47:44 rathjd Exp $
// $Id: ControlPlotsFunction.cc,v 1.33 2012/11/20 14:53:58 rathjd Exp $

#include "ControlPlotsFunction.h"

Expand Down Expand Up @@ -239,6 +239,40 @@ double ControlPlotsFunction::jetTruthEventResponseL2L3ResL4Corrected(const Event
}


//! \brief Returns the corrected jet response
//!
//! The \p Event \p evt has to be of type \p JetTruthEvent.
//! The response is defined as
//! \f[ p^{jet'}_{T} / p^{true}_{T}\f],
//! where \f$ p^{jet'}_{T} \f$ is the jet's pt corrected by
//! the JetMET L1L2L3 JEC.
//! Implements \p Function.
// ----------------------------------------------------------------
double ControlPlotsFunction::jetTruthEventResponseL1L2L3Corrected(const Event * evt) const {
const JetTruthEvent * jte = static_cast<const JetTruthEvent*>(evt);
Jet * jet = static_cast<Jet*>(jte->mess());

return jet->corFactors().getL1()*jet->corFactors().getL2L3() * jet->pt() / jte->truth();
}


//! \brief Returns the corrected jet response
//!
//! The \p Event \p evt has to be of type \p JetTruthEvent.
//! The response is defined as
//! \f[ p^{jet'}_{T} / p^{true}_{T}\f],
//! where \f$ p^{jet'}_{T} \f$ is the jet's pt corrected by
//! the JetMET L5 JEC.
//! Implements \p Function.
// ----------------------------------------------------------------
double ControlPlotsFunction::jetTruthEventResponseL5Corrected(const Event * evt) const {
const JetTruthEvent * jte = static_cast<const JetTruthEvent*>(evt);
Jet * jet = static_cast<Jet*>(jte->mess());
// std::cout << "L1:" << jet->corFactors().getL1() << " l2l3:" << jet->corFactors().getL2L3() << " l2:" << jet->corFactors().getL2() << " l3:" << jet->corFactors().getL3() << " L5:" << jet->corFactors().getL5() << std::endl;
return jet->corFactors().getL5() * jet->pt() / jte->truth();
}


//! \brief Returns run number uf the Event
//!
//! The \p Event \p evt has to be of type \p TwoJetsPtBalanceEvent.
Expand Down
6 changes: 4 additions & 2 deletions ControlPlotsFunction.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// $Id: ControlPlotsFunction.h,v 1.28 2012/11/08 14:47:03 kirschen Exp $
// $Id: ControlPlotsFunction.h,v 1.29 2012/11/20 14:47:09 rathjd Exp $

#ifndef CONTROLPLOTS_FUNCTION_H
#define CONTROLPLOTS_FUNCTION_H
Expand All @@ -24,7 +24,7 @@ class Event;
//!
//! \author Matthias Schroeder
//! \date 2009/12/18
//! $Id: ControlPlotsFunction.h,v 1.28 2012/11/08 14:47:03 kirschen Exp $
//! $Id: ControlPlotsFunction.h,v 1.29 2012/11/20 14:47:09 rathjd Exp $
// ----------------------------------------------------------------
class ControlPlotsFunction {
public:
Expand Down Expand Up @@ -78,6 +78,8 @@ class ControlPlotsFunction {
double jetTruthEventResponseL2L3ResCorrected(const Event * evt) const;
double jetTruthEventResponseL2L3L4Corrected(const Event * evt) const;
double jetTruthEventResponseL2L3ResL4Corrected(const Event * evt) const;
double jetTruthEventResponseL1L2L3Corrected(const Event * evt) const;
double jetTruthEventResponseL5Corrected(const Event * evt) const;

double twoJetsPtBalanceEventRunNumber(const Event *evt) const;
double twoJetsPtBalanceEventJetPhi(const Event *evt) const;
Expand Down

0 comments on commit a0a45a2

Please sign in to comment.