babymaker  e95a6a9342d4604277fe7cc6149b6b5b24447d89
utilities.hh
Go to the documentation of this file.
1 // Common utilities
2 
3 #ifndef H_UTILITIES
4 #define H_UTILITIES
5 
6 #include <vector>
7 #include <string>
8 #include <iostream>
9 #include <stdexcept>
10 #include "DataFormats/PatCandidates/interface/Electron.h"
11 #include "FWCore/MessageLogger/interface/MessageLogger.h"
12 #include <fastjet/PseudoJet.hh>
13 #include "TString.h"
14 
15 typedef std::vector<const reco::Candidate*> vCands;
16 typedef reco::Candidate::LorentzVector LVector;
17 
18 #define ERROR(x) do{throw cms::Exception("babymaker") << "In " << __FILE__ << " at line " << __LINE__ << " (in function " << __func__ << "): " << x << std::endl;}while(false)
19 #define DBG(x) do{edm::LogError("babymaker") << "In " << __FILE__ << " at line " << __LINE__ << " (in function " << __func__ << "): " << x << std::endl;}while(false)
20 
21 namespace utilities{
22 
24  bool contains(const std::string &s, const std::string &pat);
25  float sumMass(const LVector &a, const LVector &b);
26  float sumPt(const LVector &a, const LVector &b);
27  float dPhi(float phi1, float phi2);
28  float dR(float phi1, float phi2, float eta1, float eta2);
29  bool greaterPt(const reco::Candidate *a, const reco::Candidate *b);
30  bool greaterM(const fastjet::PseudoJet &a, const fastjet::PseudoJet &b);
31  float getMT(float pt1, float phi1, float pt2, float phi2);
32  float getMT(float m1, float pt1, float phi1,
33  float m2, float pt2, float phi2);
34  float getMT2(float pt1, float phi1, float pt2, float phi2, float met, float met_phi);
35  float getMT2(float m1, float pt1, float phi1,
36  float m2, float pt2, float phi2,
37  float met, float met_phi);
38  std::string execute(const std::string &cmd);
39  TString roundNumber(double num, int decimals, double denom=1.);
40  TString addCommas(double num);
41 
42 }
43 
44 #endif
bool greaterM(const fastjet::PseudoJet &a, const fastjet::PseudoJet &b)
Definition: utilities.cc:40
TString addCommas(double num)
Definition: utilities.cc:125
std::vector< const reco::Candidate * > vCands
Definition: utilities.hh:15
bool contains(const std::string &s, const std::string &pat)
TString roundNumber(double num, int decimals, double denom=1.)
Definition: utilities.cc:104
float getMT(float pt1, float phi1, float pt2, float phi2)
Definition: utilities.cc:44
string cmd
Moving file.
float dR(float phi1, float phi2, float eta1, float eta2)
Definition: utilities.cc:29
bool greaterPt(const reco::Candidate *a, const reco::Candidate *b)
Definition: utilities.cc:36
float sumMass(const LVector &a, const LVector &b)
Definition: utilities.cc:16
reco::Candidate::LorentzVector LVector
Definition: utilities.hh:16
std::string execute(const std::string &cmd)
float dPhi(float phi1, float phi2)
Definition: utilities.cc:24
float getMT2(float pt1, float phi1, float pt2, float phi2, float met, float met_phi)
Definition: utilities.cc:54
float sumPt(const LVector &a, const LVector &b)
Definition: utilities.cc:20