Skip to content

Commit

Permalink
a.) add variable ThirdJetFractionPlain (i.e. third-jet pt-fraction wi…
Browse files Browse the repository at this point in the history
…thout projection on dijet axis) and b.) add parameter outOnlyRoot_ which reads 'plots only to root-file' from config file to prevent plots from being written into individual (eps) files
  • Loading branch information
kirschen committed Feb 18, 2011
1 parent a3d87b6 commit 5f18f0c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 15 deletions.
2 changes: 2 additions & 0 deletions ControlPlots.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ ControlPlotsFunction::Function ControlPlots::findTwoJetsPtBalanceEventFunction(c
return &ControlPlotsFunction::twoJetsPtBalanceEventJetMeanMoment;
if( varName == "ThirdJetFraction" )
return &ControlPlotsFunction::twoJetsPtBalanceEventThirdJetFraction;
if( varName == "ThirdJetFractionPlain" )
return &ControlPlotsFunction::twoJetsPtBalanceEventThirdJetFractionPlain;
if( varName == "Asymmetry" && type == ControlPlotsConfig::Uncorrected )
return &ControlPlotsFunction::twoJetsPtBalanceEventAsymmetry;
if( varName == "Asymmetry" && type == ControlPlotsConfig::Kalibri )
Expand Down
7 changes: 6 additions & 1 deletion ControlPlotsConfig.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// $Id: ControlPlotsConfig.cc,v 1.17 2010/10/12 08:40:53 stadie Exp $
// $Id: ControlPlotsConfig.cc,v 1.18 2010/12/13 10:38:28 stadie Exp $

#include "ControlPlotsConfig.h"

Expand Down Expand Up @@ -516,6 +516,9 @@ void ControlPlotsConfig::init() {
outDirName_ = config_->read<std::string>("plots output directory","controlPlots");
gSystem->MakeDirectory(outDirName_.c_str());

// Store whether plots are only exported to root-file
outOnlyRoot_= config_->read<bool>("plots only to root-file",0);

outFileType_ = config_->read<std::string>("plots format","eps");
// Define style for different correction types
// This should become configurable via config file
Expand Down Expand Up @@ -644,6 +647,8 @@ std::string ControlPlotsConfig::varTitle(const std::string &varName) const {
title = "(p_{T,1} - p_{T,2})/(p_{T,1} + p_{T,2})";
else if( varName == "ThirdJetFraction")
title = "p_{3}^{proj.}/#bar p_{T}";
else if( varName == "ThirdJetFractionPlain")
title = "p_{3}/#bar p_{T}";
return title;
}

Expand Down
7 changes: 5 additions & 2 deletions ControlPlotsConfig.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// $Id: ControlPlotsConfig.h,v 1.7 2010/10/12 08:40:53 stadie Exp $
// $Id: ControlPlotsConfig.h,v 1.8 2010/12/13 10:38:28 stadie Exp $

#ifndef CONTROLPLOTS_CONFIG_H
#define CONTROLPLOTS_CONFIG_H
Expand Down Expand Up @@ -52,7 +52,7 @@ class ConfigFile;
//!
//! \author Matthias Schroeder
//! \date 2009/12/18
//! $Id: ControlPlotsConfig.h,v 1.7 2010/10/12 08:40:53 stadie Exp $
//! $Id: ControlPlotsConfig.h,v 1.8 2010/12/13 10:38:28 stadie Exp $
// ----------------------------------------------------------------
class ControlPlotsConfig {
public:
Expand Down Expand Up @@ -185,6 +185,8 @@ class ControlPlotsConfig {
std::string outDirName() const { return outDirName_; }
//! Returns the file ending ("eps") of the control plots
std::string outFileType() const { return outFileType_; }
//! Specifies whether the plots are only saved in a root-file.
bool outOnlyRoot() const { return outOnlyRoot_; }
//! Writes a \p obj to ROOT file
void toRootFile(TObject *obj) const;

Expand Down Expand Up @@ -218,6 +220,7 @@ class ControlPlotsConfig {

std::string outDirName_;
std::string outFileType_;
bool outOnlyRoot_;

std::map<InputTag,int> colors_;
std::map<InputTag,int> markerStyles_;
Expand Down
20 changes: 18 additions & 2 deletions ControlPlotsFunction.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// $Id: ControlPlotsFunction.cc,v 1.14 2010/10/20 11:28:04 stadie Exp $
// $Id: ControlPlotsFunction.cc,v 1.15 2010/12/13 10:38:28 stadie Exp $

#include "ControlPlotsFunction.h"

Expand Down Expand Up @@ -240,12 +240,28 @@ double ControlPlotsFunction::twoJetsPtBalanceEventJetAbsEta(const Event *evt) co
double ControlPlotsFunction::twoJetsPtBalanceEventThirdJetFraction(const Event *evt) const {
const TwoJetsPtBalanceEvent * tjpbe = static_cast<const TwoJetsPtBalanceEvent*>(evt);
if (! tjpbe->hasJet3()) return 0;

if(tjpbe->getJet1()->pt() < 8) return 0;
// Phi of dijet axis
double pPhi = TVector2::Phi_mpi_pi(0.5*(tjpbe->getJet1()->phi() + tjpbe->getJet2()->phi()) + M_PI/2.);
double pJ3 = tjpbe->getJet3()->corFactors().getL2L3() * tjpbe->getJet3()->pt() * cos(TVector2::Phi_mpi_pi(pPhi-tjpbe->getJet3()->phi()));

if(tjpbe->getJet1()->pt() < 8) return 0;
if(pJ3 < 6) return 0;
return pJ3/tjpbe->ptDijetCorrL2L3();
}

//! \brief Returns fraction of momentum of third jet and average dijet momentum
//!
//! The \p Event \p evt has to be of type \p TwoJetsPtBalanceEvent.
//! Implements \p Function.
// ----------------------------------------------------------------
double ControlPlotsFunction::twoJetsPtBalanceEventThirdJetFractionPlain(const Event *evt) const {
const TwoJetsPtBalanceEvent * tjpbe = static_cast<const TwoJetsPtBalanceEvent*>(evt);
if (! tjpbe->hasJet3()) return 0;
if(tjpbe->getJet1()->pt() < 8) return 0;
double pJ3 = tjpbe->getJet3()->corFactors().getL2L3() * tjpbe->getJet3()->pt();
if(pJ3 < 6) return 0;
return pJ3/tjpbe->ptDijetCorrL2L3();
}

Expand Down
5 changes: 3 additions & 2 deletions ControlPlotsFunction.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// $Id: ControlPlotsFunction.h,v 1.14 2010/10/20 11:28:16 stadie Exp $
// $Id: ControlPlotsFunction.h,v 1.15 2010/12/13 10:38:28 stadie 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.14 2010/10/20 11:28:16 stadie Exp $
//! $Id: ControlPlotsFunction.h,v 1.15 2010/12/13 10:38:28 stadie Exp $
// ----------------------------------------------------------------
class ControlPlotsFunction {
public:
Expand Down Expand Up @@ -83,6 +83,7 @@ class ControlPlotsFunction {
double twoJetsPtBalanceEventMeanPt(const Event *evt) const;
double twoJetsPtBalanceEventJetEMF(const Event *evt) const;
double twoJetsPtBalanceEventThirdJetFraction(const Event *evt) const;
double twoJetsPtBalanceEventThirdJetFractionPlain(const Event *evt) const;
double twoJetsPtBalanceEventJetMomentPhiPhi(const Event *evt) const;
double twoJetsPtBalanceEventJetMomentEtaEta(const Event *evt) const;
double twoJetsPtBalanceEventJetMeanMoment(const Event *evt) const;
Expand Down
19 changes: 11 additions & 8 deletions ControlPlotsProfile.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// $Id: ControlPlotsProfile.cc,v 1.17 2010/12/13 10:38:28 stadie Exp $
// $Id: ControlPlotsProfile.cc,v 1.18 2011/02/18 15:33:39 stadie Exp $

#include "ControlPlotsProfile.h"

Expand Down Expand Up @@ -95,6 +95,9 @@ void ControlPlotsProfile::draw() {
c1->cd();
std::string fileName;

Bool_t only_to_root = config_->outOnlyRoot();
// std::cout << "only to root: " << only_to_root << std::endl;

// Draw 2D histograms
for(std::vector<Bin*>::iterator binIt = bins_.begin();
binIt != bins_.end(); binIt++) {
Expand All @@ -109,7 +112,7 @@ void ControlPlotsProfile::draw() {
config_->toRootFile(h);
fileName = config_->outDirName() + "/";
fileName += (*binIt)->hist2DFileName(*it) + "." + config_->outFileType();
c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
if(!only_to_root)c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
}
}

Expand Down Expand Up @@ -163,7 +166,7 @@ void ControlPlotsProfile::draw() {
p2->DrawClone();
fileName = config_->outDirName() + "/";
fileName += (*binIt)->profileFileName(*profTypeIt) + "." + config_->outFileType();
c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
if(!only_to_root)c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
}
}

Expand Down Expand Up @@ -209,7 +212,7 @@ void ControlPlotsProfile::draw() {
p2->DrawClone();
fileName = config_->outDirName() + "/";
fileName += (*binIt)->profileFileName(*profTypeIt) + "_zoom." + config_->outFileType();
c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
if(!only_to_root)c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
}
}
delete leg;
Expand Down Expand Up @@ -273,10 +276,10 @@ void ControlPlotsProfile::draw() {
p2->DrawClone();
fileName = config_->outDirName() + "/";
fileName += config_->name() +"_Special_"+config_->binName((*binIt)->id())+ "_zoom." + config_->outFileType();
c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
if(!only_to_root)c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
delete leg;
}

// Draw distributions
for(std::vector<Bin*>::iterator binIt = bins_.begin();
binIt != bins_.end(); binIt++) {
Expand All @@ -291,7 +294,7 @@ void ControlPlotsProfile::draw() {
config_->toRootFile(h);
fileName = config_->outDirName() + "/";
fileName += (*binIt)->distributionFileName(n,*tagsIt) + "." + config_->outFileType();
c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
if(!only_to_root)c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
}
}
}
Expand All @@ -310,7 +313,7 @@ void ControlPlotsProfile::draw() {
fileName = config_->outDirName() + "/";
fileName += hXSpectrum_[0]->GetName();
fileName += "." + config_->outFileType();
c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
if(!only_to_root)c1->SaveAs(fileName.c_str(),(config_->outFileType()).c_str());
config_->toRootFile(hXSpectrum_[0]);
if(hXSpectrum_[1]) config_->toRootFile(hXSpectrum_[1]);
if(hXSpectrum_[2]) config_->toRootFile(hXSpectrum_[2]);
Expand Down

0 comments on commit 5f18f0c

Please sign in to comment.