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

Heppy integration 7 3 x #6115

Merged
merged 63 commits into from Nov 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
59ce52b
first integration of heppy in CMSSW
cbernet Oct 17, 2014
320deb9
fwlite input working
cbernet Oct 17, 2014
be7fae5
imported analysis code from CMGTools. JSONAnalyzer working
cbernet Oct 17, 2014
06db110
Jet analyzer working (b tagging SF commented)
cbernet Oct 17, 2014
6fd3789
re-enabled btagging
cbernet Oct 17, 2014
6c9be89
importing all physics objects except electrons
cbernet Oct 17, 2014
acff8d0
move utility classes to dedicated physicsutils/ folder
arizzi Oct 18, 2014
f4e3a4b
added simple example
cbernet Oct 18, 2014
e317f00
added jets to simple example
cbernet Oct 18, 2014
acd9c19
updated imports after move to physicsutils
cbernet Oct 18, 2014
16bd1a4
platform detection from input root file
cbernet Oct 18, 2014
bfcd05d
create example subfolder
arizzi Oct 18, 2014
ce632d5
reorganize the structure, rename some classes, import some modules fr…
arizzi Oct 18, 2014
35fc353
move to core
arizzi Oct 20, 2014
fdb8cac
replace some imports
arizzi Oct 20, 2014
8a5ba08
adapt names, change process() argument list
arizzi Oct 20, 2014
281cb9a
adapt event interface
arizzi Oct 20, 2014
2991933
fix
arizzi Oct 20, 2014
37a211b
fix s
arizzi Oct 20, 2014
dabef6e
various fixes
arizzi Oct 20, 2014
9185b33
newest version of Tree(numpy) from Giovanni repo?
arizzi Oct 20, 2014
def0db6
class objects and events class now defined in configuration file by t…
cbernet Oct 20, 2014
f62af3b
added unit test for the config module
cbernet Oct 20, 2014
cd2a7b7
added unit test for the config module
cbernet Oct 20, 2014
6d2f9e5
code clean up in JetAnalyzer
cbernet Oct 20, 2014
5a95f11
adapted to new configuration strategy (class objects and Events in cfg)
cbernet Oct 20, 2014
7624c6e
more cleaning in JetAnalyzer
cbernet Oct 20, 2014
5b24138
Vertex analyzer fix and import path fix
arizzi Oct 20, 2014
fcd6df7
implement init.py and some renaming
arizzi Oct 20, 2014
8d0f998
implement init.py and some renaming
arizzi Oct 20, 2014
9a903a0
add c++ wrappers and helpers from CMG. Ele MVA is broken for 72X
arizzi Oct 20, 2014
c996680
fix s
arizzi Oct 20, 2014
1847c9c
fixes of imoprts and similar. Hitpattern migration fix
arizzi Oct 20, 2014
e3befdd
change names of ntupleObjects/Types as proposed in last mail (can be …
arizzi Oct 20, 2014
c354294
add init
arizzi Oct 20, 2014
0e9c332
fix wrong import
arizzi Oct 20, 2014
80b3bca
removing trivial inits because they do nothing
arizzi Oct 20, 2014
437cfcf
remove the check of initDone, use beginLoop for declareVariables
arizzi Oct 21, 2014
d35bd06
move beginLoop hook to TreeAnalyzerNumpy
arizzi Oct 21, 2014
9cc6045
more complete example of the autofill stuff
arizzi Oct 21, 2014
672d3bf
readd __init__.py
arizzi Oct 21, 2014
2ad515d
simple_example_cfg.py working. fixed a couple imports
cbernet Oct 21, 2014
d3d8e2f
example_autofill can also be used with the heppy.py script
cbernet Oct 21, 2014
60ed90a
renamed multiloop.py as heppy.py
cbernet Oct 21, 2014
6bfe9f1
ported pybatch.py, now called heppy_batch.py
cbernet Oct 21, 2014
c2cb671
better exception if an input file does not exist
cbernet Oct 21, 2014
4def3b2
clean up in PhysicsObjects.py
cbernet Oct 22, 2014
b7b7940
simplified name of root file and tree in TreeAnalyzerNumpy
cbernet Oct 22, 2014
216d5c5
added a very simple example for tutorials
cbernet Oct 22, 2014
6968ffd
cleanup in heppycore test cfgs
cbernet Nov 3, 2014
60ed7b2
removed java style, clean up, unittests in cmsswRelease
cbernet Nov 3, 2014
80d3958
removed again the custom init scripts
cbernet Nov 3, 2014
340b36c
bug fix after clean up in cmsswRelease
cbernet Nov 3, 2014
9accef7
simple_example_2 working on standard mini aod relvals
cbernet Nov 3, 2014
8461409
simple_example_2 working with Z->mumu events
cbernet Nov 3, 2014
9a5401b
clean up of imports in example_autofill.
cbernet Nov 3, 2014
c7b3718
renaming
cbernet Nov 3, 2014
ee8e875
adapted simple_example_cfg.py for tutorial
cbernet Nov 3, 2014
679fc4a
added miniaod files for 7_0_9_patch3
cbernet Nov 3, 2014
b875166
removed init scripts
cbernet Nov 3, 2014
98c4f39
mini aod test files for CMSSW_7_3_X integration builds
cbernet Nov 4, 2014
4313180
header guards standardized. constants defined as static class members.
cbernet Nov 6, 2014
a18642c
cleaning in physics utils to comply to CMS coding rules
cbernet Nov 6, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions PhysicsTools/Heppy/BuildFile.xml
@@ -0,0 +1,16 @@
<use name="root"/>
<use name="rootcore"/>
<use name="rootinteractive"/>
<use name="rootrflx"/>
<use name="rootpy"/>
<use name="clhepheader"/>
<use name="DataFormats/Candidate"/>
<use name="DataFormats/PatCandidates"/>
<use name="DataFormats/HepMCCandidate"/>
<use name="fastjet"/>
<use name="ktjet"/>
<use name="EgammaAnalysis/ElectronTools"/>
<use name="boost"/>
<export>
<lib name="1"/>
</export>
29 changes: 29 additions & 0 deletions PhysicsTools/Heppy/interface/AlphaT.h
@@ -0,0 +1,29 @@
#ifndef PhysicsTools_Heppy_AlphaT_h
#define PhysicsTools_Heppy_AlphaT_h

#include <cmath>
#include <numeric>
#include <vector>


/* AlphaT
*
* Calculates the AlphaT event variable for a given input jet collection
*
*
* 08 Sept 2014 - Ported from ICF code (Mark Baber)
*/

namespace heppy {

struct AlphaT {

static double getAlphaT( const std::vector<double>& et,
const std::vector<double>& px,
const std::vector<double>& py );

};

};

#endif // AlphaT_h
32 changes: 32 additions & 0 deletions PhysicsTools/Heppy/interface/BTagSF.h
@@ -0,0 +1,32 @@
#ifndef PhysicsTools_Heppy_BTagSF_h
#define PhysicsTools_Heppy_BTagSF_h

#include "TRandom3.h"
#include <iostream>

namespace heppy {

class BTagSF{

public:

BTagSF( int seed=0 );
~BTagSF();

Bool_t isbtagged(Float_t pt, Float_t eta, Float_t csv, Int_t jetflavor, Bool_t isdata, UInt_t btagsys, UInt_t mistagsys, Bool_t is2012);
Double_t getSFb(Float_t pt, UInt_t btagsys, Bool_t is2012);
Double_t getSFc(Float_t pt, UInt_t btagsys, Bool_t is2012);
Double_t getSFl(Float_t pt, Float_t eta, UInt_t mistagsys, Bool_t is2012);
Double_t getMistag(Float_t pt, Float_t eta);

enum { kNo, kDown, kUp }; // systematic variations


private:

TRandom3* randm;

};
};

#endif
37 changes: 37 additions & 0 deletions PhysicsTools/Heppy/interface/CMGMuonCleanerBySegmentsAlgo.h
@@ -0,0 +1,37 @@
#ifndef PhysicsTools_Heppy_CMGMuonCleanerBySegmentsAlgo_h
#define PhysicsTools_Heppy_CMGMuonCleanerBySegmentsAlgo_h

#include "DataFormats/PatCandidates/interface/Muon.h"
#include "CommonTools/Utils/interface/StringCutObjectSelector.h"
#include <vector>

namespace heppy {

class CMGMuonCleanerBySegmentsAlgo {
public:
CMGMuonCleanerBySegmentsAlgo(double sharedFraction=0.499, const std::string & preselection="track.isNonnull", const std::string & passthrough="isGlobalMuon && numberOfMatches >= 2") :
sharedFraction_(sharedFraction),
preselection_(preselection,true),
passthrough_(passthrough,true) {}
~CMGMuonCleanerBySegmentsAlgo() ;

/// Return a vector of boolean marking the muons to be considered clean
std::vector<bool> clean(const std::vector<pat::Muon> &muons) const ;

private:
/// Fraction of shared segments
double sharedFraction_;

/// Preselection cut
StringCutObjectSelector<pat::Muon> preselection_;
/// Always-accept cut
StringCutObjectSelector<pat::Muon> passthrough_;

/// Methods
bool isSameMuon(const pat::Muon &mu1, const pat::Muon &mu2) const ;
bool isBetterMuon(const pat::Muon &mu1, bool mu1PF, const pat::Muon &mu2, bool mu2PF) const ;
};

}

#endif
69 changes: 69 additions & 0 deletions PhysicsTools/Heppy/interface/Davismt2.h
@@ -0,0 +1,69 @@
#ifndef PhysicsTools_Heppy_Davismt2_h
#define PhysicsTools_Heppy_Davismt2_h

#include <iostream>
#include <math.h>
#include "TObject.h"

// using namespace std;

namespace heppy {

class Davismt2{
// class Davismt2 : public TObject {
public:
static const float RELATIVE_PRECISION;
static const float ABSOLUTE_PRECISION;
static const float MIN_MASS;
static const float ZERO_MASS;
static const float SCANSTEP;

Davismt2();
virtual ~Davismt2();
void mt2_bisect();
void mt2_massless();
void set_momenta(double *pa0, double *pb0, double* pmiss0);
void set_mn(double mn);
inline void set_verbose(int vlevel){verbose = vlevel;};
double get_mt2();
void print();
int nevt;

private:

int verbose;
bool solved;
bool momenta_set;
double mt2_b;

int nsols(double Dsq);
int nsols_massless(double Dsq);
//inline
int signchange_n( long double t1, long double t2, long double t3, long double t4, long double t5);
//inline
int signchange_p( long double t1, long double t2, long double t3, long double t4, long double t5);
int scan_high(double &Deltasq_high);
int find_high(double &Deltasq_high);
//data members
double pax, pay, ma, Ea;
double pmissx, pmissy;
double pbx, pby, mb, Eb;
double mn, mn_unscale;

//auxiliary definitions
double masq, Easq;
double mbsq, Ebsq;
double pmissxsq, pmissysq;
double mnsq;

//auxiliary coefficients
double a1, b1, c1, a2, b2, c2, d1, e1, f1, d2, e2, f2;
double d11, e11, f12, f10, d21, d20, e21, e20, f22, f21, f20;

double scale;
double precision;
// ClassDef(Davismt2,1)
};
}

#endif
37 changes: 37 additions & 0 deletions PhysicsTools/Heppy/interface/EGammaMvaEleEstimatorFWLite.h
@@ -0,0 +1,37 @@
#ifndef PhysicsTools_Heppy_EGammaMvaEleEstimatorFWLite_h
#define PhysicsTools_Heppy_EGammaMvaEleEstimatorFWLite_h

struct EGammaMvaEleEstimator;
namespace reco { struct Vertex; }
namespace pat { struct Electron; }
#include <vector>
#include <string>

namespace heppy {

class EGammaMvaEleEstimatorFWLite {
public:
EGammaMvaEleEstimatorFWLite();
~EGammaMvaEleEstimatorFWLite();

enum MVAType {
kTrig = 0, // MVA for triggering electrons
kTrigNoIP = 1, // MVA for triggering electrons without IP info
kNonTrig = 2, // MVA for non-triggering electrons
};

void initialize( std::string methodName,
MVAType type,
bool useBinnedVersion,
std::vector<std::string> weightsfiles );

float mvaValue(const pat::Electron& ele,
const reco::Vertex& vertex,
double rho,
bool full5x5,
bool printDebug = false);
private:
EGammaMvaEleEstimator *estimator_;
};
}
#endif
23 changes: 23 additions & 0 deletions PhysicsTools/Heppy/interface/FSRWeightAlgo.h
@@ -0,0 +1,23 @@
#ifndef PhysicsTools_Heppy_FSRWeightAlgo_h
#define PhysicsTools_Heppy_FSRWeightAlgo_h

#include "DataFormats/HepMCCandidate/interface/GenParticle.h"

namespace heppy {

class FSRWeightAlgo {

public:
FSRWeightAlgo() {}
virtual ~FSRWeightAlgo() {}
void addGenParticle(const reco::GenParticle& gen) {genParticles_.push_back(gen);}
void clear() {genParticles_.clear();}
double weight() const;

private:
double alphaRatio(double) const;

std::vector< reco::GenParticle > genParticles_;
};
}
#endif