Skip to content

Commit

Permalink
Merge pull request #6115 from cbernet/heppy_integration_7_3_X
Browse files Browse the repository at this point in the history
Heppy integration 7 3 x
  • Loading branch information
cmsbuild committed Nov 6, 2014
2 parents 3d03813 + a18642c commit ea52241
Show file tree
Hide file tree
Showing 127 changed files with 13,618 additions and 0 deletions.
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

0 comments on commit ea52241

Please sign in to comment.