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

Work up until 74X MC samples #164

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e7cd8c1
Remove obsolete b tag weight code
EmyrClement May 7, 2015
f1d6e77
Update analysis path.
EmyrClement May 7, 2015
c7237cb
Add jet parton info and whether those partons come from ttbar decay.
EmyrClement May 7, 2015
b3b301a
Doug's work on Rochester reco.
EmyrClement May 7, 2015
d587c7a
Apply stash
EmyrClement May 7, 2015
b473c81
Add variable to store if all jets passed ot fit are from ttbar.
EmyrClement May 11, 2015
11bfc55
Pass leading 5 jets, regardless of CSV to fit. Store category of bes…
EmyrClement May 11, 2015
5f2b5fa
Extend hit fit to control regions.
EmyrClement May 12, 2015
76e27c9
Add info on position of last ttbar jet in jet collection.
EmyrClement May 13, 2015
f7c42d9
Add numbers to partonType for clarity and ease of use.
EmyrClement May 13, 2015
8ca51d7
Check if all ttbar jets are in the cleaned jets collection.
EmyrClement May 14, 2015
9c5676c
Add top reco variables to unfolding tree.
EmyrClement May 18, 2015
99f10e0
Add second kinematic fit.
EmyrClement Jun 1, 2015
7dd3e38
Check if all ttbar jets are in the cleaned jets collection.
EmyrClement May 14, 2015
71100f7
Read in likelihood inputs from file. Doug's analyser to construct di…
EmyrClement May 13, 2015
73a6a5b
Add parton information to unfolding tree.
EmyrClement Jun 2, 2015
946f46d
Fill event weight in HitFit branch.
EmyrClement Jun 2, 2015
7de1af2
Use global variable to determine whether to run (time consuming) top …
EmyrClement Jun 15, 2015
53eac88
Add selection on lepton pt. Sort out selection criteria (AGAIN?). Ad…
EmyrClement Jun 15, 2015
be60fa7
Update to 74X MC samples. Update triggers for 74X MC.
EmyrClement Jun 15, 2015
a9aa59b
Read in pdg of pseudo jets (==5 for b jets).
EmyrClement Jun 15, 2015
511b880
Ensure all particle level quantities are calculated from pseudo varia…
EmyrClement Jun 15, 2015
a96393d
Make job splitting more general to any TTJet sample.
EmyrClement Jun 15, 2015
5852de3
Set maxEvents to 0
EmyrClement Jun 15, 2015
8c6ab06
Leftovers...
EmyrClement Jun 15, 2015
88216e9
Update config name in condor script job.sh
EmyrClement Jun 16, 2015
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
15 changes: 11 additions & 4 deletions bin/Analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void Analysis::analyse() {


while (eventReader->hasNextEvent()) {

initiateEvent();
printNumberOfProccessedEventsEvery(Globals::printEveryXEvents);
inspectEvents();
Expand All @@ -59,9 +60,11 @@ void Analysis::analyse() {
bjetWeights = BjetWeights(jets, numberOfBJets);

ttbar_plus_X_analyser_->analyse(currentEvent);
if ( ( currentEvent->getDataType() == DataType::TTJets || currentEvent->getDataType() == DataType::TT_Pythia8 ) && Globals::treePrefix_ == "" ) {
if ( ( currentEvent->getDataType() == DataType::TTJets_amcatnloFXFX || currentEvent->getDataType() == DataType::TTJets_madgraphMLM ) && Globals::treePrefix_ == "" ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this a bit easier in the future I created a feature request in issue #166

pseudoTopAnalyser_->analyse(currentEvent);
unfoldingRecoAnalyser_->analyse(currentEvent);
partonAnalyser_->analyse(currentEvent);
// likelihoodInputAnalyser_->analyse(currentEvent);
}
treeMan->FillTrees();
}
Expand Down Expand Up @@ -107,7 +110,7 @@ void Analysis::initiateEvent() {
}

//top pt weight
if(Globals::applyTopPtReweighting == true && currentEvent->getDataType() == DataType::TTJets){
if(Globals::applyTopPtReweighting == true && currentEvent->getDataType() == DataType::TTJets_amcatnloFXFX){

double topPtweight = 1.;
topPtweight = weights->reweightTopPt(currentEvent);
Expand Down Expand Up @@ -158,10 +161,12 @@ void Analysis::createHistograms() {
<< endl;
lastNumberOfHistograms = numberOfHistograms;

if ( ( eventReader->getSeenDatatypes()[DataType::TTJets] || eventReader->getSeenDatatypes()[DataType::TT_Pythia8] )
if ( ( eventReader->getSeenDatatypes()[DataType::TTJets_amcatnloFXFX] || eventReader->getSeenDatatypes()[DataType::TTJets_madgraphMLM] )
&& Globals::treePrefix_ == "" ) {
pseudoTopAnalyser_->createTrees();
unfoldingRecoAnalyser_->createTrees();
partonAnalyser_->createTrees();
likelihoodInputAnalyser_->createTrees();
}

histMan->setCurrentHistogramFolder("");
Expand All @@ -185,7 +190,9 @@ Analysis::Analysis(std::string datasetInfoFile) : //
ttbar_plus_X_analyser_(new TTbar_plus_X_analyser(histMan, treeMan)), //
vertexAnalyser(new VertexAnalyser(histMan)),
pseudoTopAnalyser_(new PseudoTopAnalyser(histMan, treeMan)),
unfoldingRecoAnalyser_(new UnfoldingRecoAnalyser(histMan, treeMan)) {
unfoldingRecoAnalyser_(new UnfoldingRecoAnalyser(histMan, treeMan)),
partonAnalyser_(new PartonAnalyser(histMan, treeMan)),
likelihoodInputAnalyser_(new LikelihoodInputAnalyser(histMan, treeMan)) {
histMan->enableDebugMode(true);
}

Expand Down
5 changes: 5 additions & 0 deletions bin/Analysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

#include "../interface/Analysers/PseudoTopAnalyser.h"
#include "../interface/Analysers/UnfoldingRecoAnalyser.h"
#include "../interface/Analysers/PartonAnalyser.h"
#include "../interface/Analysers/LikelihoodInputAnalyser.h"

class Analysis {
private:
Expand All @@ -54,6 +56,9 @@ class Analysis {

BAT::PseudoTopAnalyserLocalPtr pseudoTopAnalyser_;
BAT::UnfoldingRecoAnalyserLocalPtr unfoldingRecoAnalyser_;
BAT::PartonAnalyserLocalPtr partonAnalyser_;

BAT::LikelihoodInputAnalyserLocalPtr likelihoodInputAnalyser_;

public:
Analysis(std::string fileForPileUpReweighting);
Expand Down
2 changes: 1 addition & 1 deletion condor/job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ while [ $local_process -lt $range_for_loop ] ; do
echo "I will run sample=${sample} in mode=${analysisMode} for centre-of-mass energy of ${energy} TeV"
echo "Analysing ntuple number "$ntupleToProcess

python_config=master_PHYS14_cfg.py
python_config=master_2015_cfg.py
if [ $energy -eq 7 ]; then
python_config=master_2011_53X_cfg.py
fi
Expand Down
4 changes: 2 additions & 2 deletions condor/job_mapper
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def build_matrix(energy, chosen_sample = None, chosen_mode = None, splitTTJet =
if not chosen_sample in samples:
sys.exit("ERROR Trying to run unknown sample '%s'" % options.sample)
for mode in analysis_modes_:
if splitTTJet and chosen_sample == 'TTJet':
if splitTTJet and 'TTJets' in chosen_sample:
for ntupleIndex in range(1,numberOfInputFiles(chosen_sample,energy)+1):
result.append((chosen_sample, mode,ntupleIndex))
else:
Expand All @@ -87,7 +87,7 @@ def build_matrix(energy, chosen_sample = None, chosen_mode = None, splitTTJet =
else:
for sample in samples:
for mode in analysis_modes_:
if splitTTJet and sample is 'TTJet':
if splitTTJet and 'TTJets' in sample:
for ntupleIndex in range(1,numberOfInputFiles(sample,energy)+1):
result.append((sample, mode,ntupleIndex))
else:
Expand Down
Binary file added data/LikelihoodInputAnalyserOutput.root
Binary file not shown.
14 changes: 9 additions & 5 deletions interface/Analysers/HitFitAnalyser.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ namespace BAT {

class HitFitAnalyser: public BasicAnalyser {
private:
std::string outFileName;
ofstream outFile;

// BAT::TtbarHypothesis trueFourVectors;
BAT::TtbarHypothesis truthMatchEvent;
BAT::JetCollection jetsForFitting;
BAT::JetCollection bJetsForFitting;

std::string FitterPath_;
std::string hitfitDefault_;
Expand All @@ -46,6 +45,8 @@ class HitFitAnalyser: public BasicAnalyser {
double hitfitTopMass_;
double lepton_charge;
bool do_MC_matching;
bool allTTBarJetsPassedToFit_;
bool allTTBarJetsPassSelection_;

bool isElectronChannel_;

Expand All @@ -63,17 +64,20 @@ class HitFitAnalyser: public BasicAnalyser {

private:
FourVector fourVectorFromHitFit(const hitfit::Fourvec& v);
BAT::TtbarHypothesis BatEvent(const hitfit::Lepjets_Event& ev);
BAT::TtbarHypothesis BatEvent(const hitfit::Lepjets_Event& ev, const EventPtr event, const string solutionCategoryHistogram );

hitfit::Fit_Result performSecondKinematicFit(const hitfit::Lepjets_Event& unfittedEvent, const EventPtr event);

public:
HitFitAnalyser(HistogramManagerPtr histMan, const bool isElectronChannel, std::string histogramFolder = "hitfitStudy" );
HitFitAnalyser(HistogramManagerPtr histMan, TreeManagerPtr treeMan, const bool isElectronChannel, std::string histogramFolder = "hitfitStudy" );
virtual ~HitFitAnalyser();

void analyse(const EventPtr);
BAT::TtbarHypothesis analyseAndReturn(const EventPtr, const JetCollection jets, const JetCollection bjets, const LeptonPointer selectedLepton );
void setMCTTbarHypothesis(const TtbarHypothesis& mcEvent);
void createHistograms();
void printFile(const string filename);
void createTrees();
int positionOfLastTTBarJet(const JetCollection jets);
};
typedef boost::scoped_ptr<HitFitAnalyser> HitFitAnalyserLocalPtr;
typedef boost::shared_ptr<HitFitAnalyser> HitFitAnalyserPtr;
Expand Down
33 changes: 33 additions & 0 deletions interface/Analysers/LikelihoodInputAnalyser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* LikelihoodInputAnalyser.h
*
* Created on: May 5, 2015
* Author: ejclemen
*/

#ifndef LIKELIHOODINPUTANALYSER_H_
#define LIKELIHOODINPUTANALYSER_H_
#include <fstream>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include "../../interface/TtbarHypothesis.h"
#include "BasicAnalyser.h"
#include "../Rochester/NeutrinoSolver.h"

namespace BAT {

class LikelihoodInputAnalyser: public BasicAnalyser {

public:
LikelihoodInputAnalyser(HistogramManagerPtr histMan, TreeManagerPtr treeMan, std::string histogramFolder = "likelihood" );
virtual ~LikelihoodInputAnalyser();

void analyse(const EventPtr);
void createHistograms();
void createTrees();
};
typedef boost::scoped_ptr<LikelihoodInputAnalyser> LikelihoodInputAnalyserLocalPtr;
typedef boost::shared_ptr<LikelihoodInputAnalyser> LikelihoodInputAnalyserPtr;
}

#endif /* LIKELIHOODINPUTANALYSER_H_ */
40 changes: 40 additions & 0 deletions interface/Analysers/LikelihoodRecoAnalyser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* LikelihoodRecoAnalyser.h
*
* Created on: Mey 13, 2015
* Author: ejclemen
*/

#ifndef LIKELIHOODRECOANALYSER_H_
#define LIKELIHOODRECOANALYSER_H_
#include <fstream>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include "../../interface/TtbarHypothesis.h"
#include "../../interface/HistHelpers/HistogramManager.h"
#include "../../interface/ReconstructionModules/LikelihoodBasedTopPairReconstruction.h"
#include "BasicAnalyser.h"


namespace BAT {

class LikelihoodRecoAnalyser: public BasicAnalyser {
private:
bool isElectronChannel_;

private:

public:
LikelihoodRecoAnalyser(HistogramManagerPtr histMan, TreeManagerPtr treeMan, const bool isElectronChannel, std::string histogramFolder = "likelihoodReco" );
virtual ~LikelihoodRecoAnalyser();

void analyse(const EventPtr);
void analyse(const EventPtr, const JetCollection jets, const JetCollection bjets, const LeptonPointer selectedLepton, const METPointer met );
void createHistograms();
void createTrees();
};
typedef boost::scoped_ptr<LikelihoodRecoAnalyser> LikelihoodRecoAnalyserLocalPtr;
typedef boost::shared_ptr<LikelihoodRecoAnalyser> LikelihoodRecoAnalyserPtr;
}

#endif /* LIKELIHOODRECOANALYSER_H_ */
30 changes: 30 additions & 0 deletions interface/Analysers/PartonAnalyser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* PartonAnalyser.h
*
* Created on: 24 Feb 2015
* Author: ejclemen
*/

#ifndef PartonAnalyser_H_
#define PartonAnalyser_H_

#include "BasicAnalyser.h"

namespace BAT {

class PartonAnalyser: public BAT::BasicAnalyser {
public:
PartonAnalyser(HistogramManagerPtr histMan, TreeManagerPtr treeMan, std::string histogramFolder = "TTbar_plus_X_analysis/Unfolding");
virtual ~PartonAnalyser();
void analyse(const EventPtr);

void createHistograms();
void createTrees();

protected:
void fillHistograms(std::string subcollection, std::string suffix = "");
};
typedef boost::scoped_ptr<PartonAnalyser> PartonAnalyserLocalPtr;
typedef boost::shared_ptr<PartonAnalyser> PartonAnalyserPtr;
} /* namespace BAT */
#endif /* PartonAnalyser_H_ */
9 changes: 9 additions & 0 deletions interface/Analysers/TTbar_plus_X_analyser.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "JetAnalyser.h"
#include "WAnalyser.h"
#include "HitFitAnalyser.h"
#include "LikelihoodRecoAnalyser.h"

#include "Binned_variable_analyser.h"

#include <string>
Expand Down Expand Up @@ -139,6 +141,13 @@ class TTbar_plus_X_analyser: public BAT::BasicAnalyser {
// HitFit Analyser
HitFitAnalyserLocalPtr hitFitAnalyserEPlusJetsRefSelection_;
HitFitAnalyserLocalPtr hitFitAnalyserMuPlusJetsRefSelection_;
HitFitAnalyserLocalPtr hitFitAnalyserEPlusJetsQCDSelection_;
HitFitAnalyserLocalPtr hitFitAnalyserEPlusJetsConversionSelection_;
HitFitAnalyserLocalPtr hitFitAnalyserMuPlusJetsQCDSelection_;

// Likelihood ttbar reco analyser
LikelihoodRecoAnalyserLocalPtr likelihoodRecoAnalyserEPlusJetsRefSelection_;
LikelihoodRecoAnalyserLocalPtr likelihoodRecoAnalyserMuPlusJetsRefSelection_;

// variable definitions
std::vector<Variable> electron_variables_, muon_variables_;
Expand Down
59 changes: 0 additions & 59 deletions interface/BTagWeight2011.h

This file was deleted.

Loading