Macros | Functions | Variables
includeROOT.h File Reference
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <sys/stat.h>
#include <ctime>
#include <string>
#include "Rtypes.h"
#include "TMath.h"
#include "TVector3.h"
#include "TCut.h"
#include "TH1.h"
#include "TH2.h"
#include "TF1.h"
#include "TProfile.h"
#include "TGraph.h"
#include "TGraphErrors.h"
#include "TTree.h"
#include "TLeaf.h"
#include "TFile.h"
#include "TChain.h"
#include "TCanvas.h"
#include "TLegend.h"
#include "TStyle.h"
#include "TROOT.h"
#include "TMinuit.h"

Go to the source code of this file.

Macros

#define TABL   <<"\t"<<
 
#define BIG   1.79768e+308
 
#define BIGINT   2147483647
 
#define BIGSIZE   18446744073709551615
 
#define M_PI   3.14159265358979323846
 
#define NINT(a)   ( int(floor((a)+0.5)) )
 
#define SGN(a)    ( (a)<0 ? -1 : ( (a)>0 ? +1 : 0 ) )
 

Functions

int SQR (int b)
 
float SQR (float b)
 
double SQR (double b)
 
long double SQR (long double b)
 
int CUBE (int b)
 
float CUBE (float b)
 
double CUBE (double b)
 
long double CUBE (long double b)
 
int QUAD (int b)
 
float QUAD (float b)
 
double QUAD (double b)
 
long double QUAD (long double b)
 
double Qadd (double const x, double const y)
 
double Qadd (double const x, double const y, double const z)
 
double Qsub (double const x, double const y)
 
double binerr (double const passed, double const tested)
 
char * stringEffErr (int num, int den)
 
bool filehamna (const std::string &filename)
 
double massPDG (int PDGcode)
 
bool chargedPDG (int PDGcode)
 

Variables

int const nothingPDG = 0
 
int const protonPDG = 2212
 
int const neutronPDG = 2112
 
int const electronPDG = 11
 
int const muonPDG = 13
 
int const nuePDG = 12
 
int const numuPDG = 14
 
int const pichPDG = 211
 
int const pi0PDG = 111
 
int const etaPDG = 221
 
int const etaPRPDG = 331
 
int const rho0PDG = 113
 
int const rhoCHPDG = 213
 
int const KchPDG = 321
 
int const KlongPDG = 130
 
int const KshortPDG = 310
 
int const KzeroPDG = 311
 
int const gammaPDG = 22
 
int const ArgonPDG = 1000180400
 
int const CarbonPDG = 1000060120
 
int const DeuteronPDG = 1000010020
 
int const HeliumPDG = 1000020040
 
int const lambdaPDG = 3122
 
int const sigmaM_PDG = 3112
 
int const sigma0_PDG = 3212
 
int const sigmaP_PDG = 3222
 
int const cascadeM_PDG = 3312
 
int const cascade0_PDG = 3322
 
double const Melectron = 0.00051100
 
double const Mmuon = 0.10565837
 
double const Mpi0 = 0.13497770
 
double const Meta = 0.547862
 
double const MetaPR = 0.95778
 
double const Mrho = 0.77526
 
double const MpiCH = 0.13957061
 
double const MchK = 0.493677
 
double const MneuK = 0.497611
 
double const Mprot = 0.93827208
 
double const Mneut = 0.93956541
 
double const Mlambda = 1.115683
 
double const MsigmaNeg = 1.197449
 
double const Msigma0 = 1.192642
 
double const MsigmaPos = 1.18937
 
double const Mcasc0 = 1.31486
 
double const McascNeg = 1.32171
 

Macro Definition Documentation

#define BIG   1.79768e+308

Definition at line 49 of file includeROOT.h.

#define BIGINT   2147483647

Definition at line 50 of file includeROOT.h.

#define BIGSIZE   18446744073709551615

Definition at line 51 of file includeROOT.h.

#define M_PI   3.14159265358979323846

Definition at line 54 of file includeROOT.h.

#define NINT (   a)    ( int(floor((a)+0.5)) )

Definition at line 56 of file includeROOT.h.

#define SGN (   a)    ( (a)<0 ? -1 : ( (a)>0 ? +1 : 0 ) )

Definition at line 57 of file includeROOT.h.

#define TABL   <<"\t"<<

Definition at line 22 of file includeROOT.h.

Function Documentation

double binerr ( double const  passed,
double const  tested 
)
inline

Definition at line 100 of file includeROOT.h.

100  {
101  // Garbage input
102  if ((passed<0) || (tested<=0) || (passed>tested)) {
103  std::cout << "Fatality in binerr(double,double): Invalid arguments ";
104  std::cout << passed << "/" << tested << std::endl;
105  std::exit(1);
106  }
107  double err;
108  // Fairly ad-hoc statistical uncertainties for low stats
109  if ( tested==1.0 ) {
110  err = 0.393;
111  } else if ( passed==0.0 || passed==tested ) {
112  err = 0.421 / pow(tested,0.94);
113  } else {
114  err = std::sqrt( passed*(tested-passed)/tested );
115  }
116  err /= tested;
117  return err;
118 }
constexpr T pow(T x)
Definition: pow.h:72
void err(const char *fmt,...)
Definition: message.cpp:226
QTextStream & endl(QTextStream &s)
bool chargedPDG ( int  PDGcode)

Definition at line 265 of file includeROOT.h.

265  {
266 
267  if (PDGcode > 1000000000) return true;
268 
269  switch (PDGcode){
270  case +electronPDG: case -electronPDG:
271  case +muonPDG: case -muonPDG:
272  case +pichPDG: case -pichPDG:
273  case +rhoCHPDG: case -rhoCHPDG:
274  case +KchPDG: case -KchPDG:
275  case +protonPDG: case -protonPDG:
276  case +sigmaM_PDG: case -sigmaM_PDG:
277  case +sigmaP_PDG: case -sigmaP_PDG:
278  case +cascadeM_PDG: case -cascadeM_PDG:
279  return true;
280 
281  case gammaPDG:
282  case +nuePDG: case -nuePDG:
283  case +numuPDG: case -numuPDG:
284  case pi0PDG: case rho0PDG:
285  case etaPDG: case etaPRPDG:
286  case KlongPDG: case KshortPDG:
287  case +KzeroPDG: case -KzeroPDG:
288  case +neutronPDG: case -neutronPDG:
289  case +lambdaPDG: case -lambdaPDG:
290  case +sigma0_PDG: case -sigma0_PDG:
291  case +cascade0_PDG: case -cascade0_PDG:
292  return false;
293 
294  default:
295  // Should be some wide, fast-decaying resonance.
296  return false;
297  }
298 }
int const etaPDG
Definition: includeROOT.h:157
int const cascade0_PDG
Definition: includeROOT.h:177
int const cascadeM_PDG
Definition: includeROOT.h:176
int const pichPDG
Definition: includeROOT.h:155
int const rhoCHPDG
Definition: includeROOT.h:160
int const KzeroPDG
Definition: includeROOT.h:164
int const protonPDG
Definition: includeROOT.h:149
int const nuePDG
Definition: includeROOT.h:153
int const etaPRPDG
Definition: includeROOT.h:158
int const gammaPDG
Definition: includeROOT.h:165
int const rho0PDG
Definition: includeROOT.h:159
int const lambdaPDG
Definition: includeROOT.h:172
int const KlongPDG
Definition: includeROOT.h:162
int const sigmaP_PDG
Definition: includeROOT.h:175
int const pi0PDG
Definition: includeROOT.h:156
int const neutronPDG
Definition: includeROOT.h:150
int const KshortPDG
Definition: includeROOT.h:163
int const numuPDG
Definition: includeROOT.h:154
int const sigma0_PDG
Definition: includeROOT.h:174
int const sigmaM_PDG
Definition: includeROOT.h:173
int const muonPDG
Definition: includeROOT.h:152
int const electronPDG
Definition: includeROOT.h:151
int const KchPDG
Definition: includeROOT.h:161
int CUBE ( int  b)
inline

Definition at line 64 of file includeROOT.h.

64 {return b*b*b;}
static bool * b
Definition: config.cpp:1043
float CUBE ( float  b)
inline

Definition at line 65 of file includeROOT.h.

65 {return b*b*b;}
static bool * b
Definition: config.cpp:1043
double CUBE ( double  b)
inline

Definition at line 66 of file includeROOT.h.

66 {return b*b*b;}
static bool * b
Definition: config.cpp:1043
long double CUBE ( long double  b)
inline

Definition at line 67 of file includeROOT.h.

67 {return b*b*b;}
static bool * b
Definition: config.cpp:1043
bool filehamna ( const std::string filename)
inline

Definition at line 136 of file includeROOT.h.

136  {
137  struct stat buf;
138  int retval = stat(filename.c_str(), &buf);
139  if (retval==0 && !S_ISREG(buf.st_mode)) {
140  cout << "filehamna(string) : Not a regular file" << endl;
141  }
142  // -1 is the error condition, meaning that the file isn't there
143  return (retval == -1);
144 }
string filename
Definition: train.py:213
QTextStream & endl(QTextStream &s)
double massPDG ( int  PDGcode)

Definition at line 203 of file includeROOT.h.

203  {
204 
205  if (PDGcode > 1000000000) {
206  int A = (PDGcode -1000000000)/10;
207  A = A%1000;
208  return A * (39.948 / 40.0);
209  }
210 
211  switch (PDGcode){
212  case +electronPDG: case -electronPDG:
213  return Melectron;
214  case +muonPDG: case -muonPDG:
215  return Mmuon;
216  case gammaPDG:
217  case +nuePDG: case -nuePDG:
218  case +numuPDG: case -numuPDG:
219  return 0.000000;
220  case +pichPDG: case -pichPDG:
221  return Mpi0;
222  case rho0PDG:
223  case +rhoCHPDG: case -rhoCHPDG:
224  return Mrho;
225  case +KchPDG: case -KchPDG:
226  return MpiCH;
227  case +protonPDG: case -protonPDG:
228  return Mprot;
229  case pi0PDG:
230  return Mpi0;
231  case etaPDG:
232  return Meta;
233  case etaPRPDG:
234  return MetaPR;
235  case KlongPDG:
236  return MneuK;
237  case +neutronPDG: case -neutronPDG:
238  return Mneut;
239 
240  case KshortPDG:
241  case +KzeroPDG: case -KzeroPDG:
242  return -MneuK;
243  case +lambdaPDG: case -lambdaPDG:
244  return -Mlambda;
245  case +sigmaM_PDG: case -sigmaM_PDG:
246  return -MsigmaNeg;
247  case +sigma0_PDG: case -sigma0_PDG:
248  return Msigma0;
249  case +sigmaP_PDG: case -sigmaP_PDG:
250  return -MsigmaPos;
251  case +cascade0_PDG: case -cascade0_PDG:
252  return -Mcasc0;
253  case +cascadeM_PDG: case -cascadeM_PDG:
254  return -McascNeg;
255 
256  default:
257  // Should be some wide, fast-decaying resonance.
258  return -2468;
259  }
260 }
int const etaPDG
Definition: includeROOT.h:157
int const cascade0_PDG
Definition: includeROOT.h:177
int const cascadeM_PDG
Definition: includeROOT.h:176
double const Msigma0
Definition: includeROOT.h:194
int const pichPDG
Definition: includeROOT.h:155
double const MneuK
Definition: includeROOT.h:189
int const rhoCHPDG
Definition: includeROOT.h:160
double const MsigmaPos
Definition: includeROOT.h:195
int const KzeroPDG
Definition: includeROOT.h:164
int const protonPDG
Definition: includeROOT.h:149
double const Mrho
Definition: includeROOT.h:186
int const nuePDG
Definition: includeROOT.h:153
double const Meta
Definition: includeROOT.h:184
int const etaPRPDG
Definition: includeROOT.h:158
int const gammaPDG
Definition: includeROOT.h:165
double const McascNeg
Definition: includeROOT.h:197
int const rho0PDG
Definition: includeROOT.h:159
int const lambdaPDG
Definition: includeROOT.h:172
int const KlongPDG
Definition: includeROOT.h:162
double const MetaPR
Definition: includeROOT.h:185
int const sigmaP_PDG
Definition: includeROOT.h:175
double const Mcasc0
Definition: includeROOT.h:196
double const Melectron
Definition: includeROOT.h:181
double const Mmuon
Definition: includeROOT.h:182
int const pi0PDG
Definition: includeROOT.h:156
int const neutronPDG
Definition: includeROOT.h:150
int const KshortPDG
Definition: includeROOT.h:163
double const Mpi0
Definition: includeROOT.h:183
double const Mprot
Definition: includeROOT.h:190
int const numuPDG
Definition: includeROOT.h:154
int const sigma0_PDG
Definition: includeROOT.h:174
double const MsigmaNeg
Definition: includeROOT.h:193
double const Mlambda
Definition: includeROOT.h:192
int const sigmaM_PDG
Definition: includeROOT.h:173
int const muonPDG
Definition: includeROOT.h:152
int const electronPDG
Definition: includeROOT.h:151
double const Mneut
Definition: includeROOT.h:191
int const KchPDG
Definition: includeROOT.h:161
double const MpiCH
Definition: includeROOT.h:187
double Qadd ( double const  x,
double const  y 
)
inline

Definition at line 77 of file includeROOT.h.

77  {
78  return std::hypot(x,y);
79 }
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
Definition: hypot.h:60
list x
Definition: train.py:276
double Qadd ( double const  x,
double const  y,
double const  z 
)
inline

Definition at line 80 of file includeROOT.h.

80  {
81  double absX,absY,absZ;
82  absX = fabs(x); absY = fabs(y); absZ = fabs(z);
83  if ( absX>absY && absX>absZ ) return std::hypot(x,std::hypot(y,z));
84  if ( absY>absX && absY>absZ ) return std::hypot(y,std::hypot(x,z));
85  return Qadd(z,Qadd(x,y));
86 }
double Qadd(double const x, double const y)
Definition: includeROOT.h:77
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
Definition: hypot.h:60
list x
Definition: train.py:276
double Qsub ( double const  x,
double const  y 
)
inline

Definition at line 87 of file includeROOT.h.

87  {
88  if (std::fabs(x) < std::fabs(y)) {
89  std::cout << "Fatality in Qsub(double,double): Invalid arguments";
90  std::cout << std::endl;
91  std::exit(1);
92  }
93  long double x2 = x*x; long double y2 = y*y;
94  return double(std::sqrt( x2 - y2 ));
95 }
list x
Definition: train.py:276
QTextStream & endl(QTextStream &s)
int QUAD ( int  b)
inline

Definition at line 69 of file includeROOT.h.

69 {int p = b*b; return p*p;}
p
Definition: test.py:223
static bool * b
Definition: config.cpp:1043
float QUAD ( float  b)
inline

Definition at line 70 of file includeROOT.h.

70 {float p = b*b; return p*p;}
p
Definition: test.py:223
static bool * b
Definition: config.cpp:1043
double QUAD ( double  b)
inline

Definition at line 71 of file includeROOT.h.

71 {double p = b*b; return p*p;}
p
Definition: test.py:223
static bool * b
Definition: config.cpp:1043
long double QUAD ( long double  b)
inline

Definition at line 72 of file includeROOT.h.

72 {long double p = b*b; return p*p;}
p
Definition: test.py:223
static bool * b
Definition: config.cpp:1043
int SQR ( int  b)
inline

Definition at line 59 of file includeROOT.h.

59 {return b*b;}
static bool * b
Definition: config.cpp:1043
float SQR ( float  b)
inline

Definition at line 60 of file includeROOT.h.

60 {return b*b;}
static bool * b
Definition: config.cpp:1043
double SQR ( double  b)
inline

Definition at line 61 of file includeROOT.h.

61 {return b*b;}
static bool * b
Definition: config.cpp:1043
long double SQR ( long double  b)
inline

Definition at line 62 of file includeROOT.h.

62 {return b*b;}
static bool * b
Definition: config.cpp:1043
char* stringEffErr ( int  num,
int  den 
)

Definition at line 123 of file includeROOT.h.

123  {
124  // Yea, its a memory leak. Fight me.
125  char* temp = new char[32];
126  double rat = 1000.0*double(num)/double(den);
127  double err = 1000.0*binerr(double(num),double(den));
128 // Assuming UTF-8 encoding on your terminal or whatever
129  sprintf(temp,"%5.2f %c%c %5.2f m%c%c", rat, 0xC2,0xB1, err, 0xC2,0xB0);
130  return temp;
131 }
double binerr(double const passed, double const tested)
Definition: includeROOT.h:100
void err(const char *fmt,...)
Definition: message.cpp:226

Variable Documentation

int const ArgonPDG = 1000180400

Definition at line 167 of file includeROOT.h.

int const CarbonPDG = 1000060120

Definition at line 168 of file includeROOT.h.

int const cascade0_PDG = 3322

Definition at line 177 of file includeROOT.h.

int const cascadeM_PDG = 3312

Definition at line 176 of file includeROOT.h.

int const DeuteronPDG = 1000010020

Definition at line 169 of file includeROOT.h.

int const electronPDG = 11

Definition at line 151 of file includeROOT.h.

int const etaPDG = 221

Definition at line 157 of file includeROOT.h.

int const etaPRPDG = 331

Definition at line 158 of file includeROOT.h.

int const gammaPDG = 22

Definition at line 165 of file includeROOT.h.

int const HeliumPDG = 1000020040

Definition at line 170 of file includeROOT.h.

int const KchPDG = 321

Definition at line 161 of file includeROOT.h.

int const KlongPDG = 130

Definition at line 162 of file includeROOT.h.

int const KshortPDG = 310

Definition at line 163 of file includeROOT.h.

int const KzeroPDG = 311

Definition at line 164 of file includeROOT.h.

int const lambdaPDG = 3122

Definition at line 172 of file includeROOT.h.

double const Mcasc0 = 1.31486

Definition at line 196 of file includeROOT.h.

double const McascNeg = 1.32171

Definition at line 197 of file includeROOT.h.

double const MchK = 0.493677

Definition at line 188 of file includeROOT.h.

double const Melectron = 0.00051100

Definition at line 181 of file includeROOT.h.

double const Meta = 0.547862

Definition at line 184 of file includeROOT.h.

double const MetaPR = 0.95778

Definition at line 185 of file includeROOT.h.

double const Mlambda = 1.115683

Definition at line 192 of file includeROOT.h.

double const Mmuon = 0.10565837

Definition at line 182 of file includeROOT.h.

double const MneuK = 0.497611

Definition at line 189 of file includeROOT.h.

double const Mneut = 0.93956541

Definition at line 191 of file includeROOT.h.

double const Mpi0 = 0.13497770

Definition at line 183 of file includeROOT.h.

double const MpiCH = 0.13957061

Definition at line 187 of file includeROOT.h.

double const Mprot = 0.93827208

Definition at line 190 of file includeROOT.h.

double const Mrho = 0.77526

Definition at line 186 of file includeROOT.h.

double const Msigma0 = 1.192642

Definition at line 194 of file includeROOT.h.

double const MsigmaNeg = 1.197449

Definition at line 193 of file includeROOT.h.

double const MsigmaPos = 1.18937

Definition at line 195 of file includeROOT.h.

int const muonPDG = 13

Definition at line 152 of file includeROOT.h.

int const neutronPDG = 2112

Definition at line 150 of file includeROOT.h.

int const nothingPDG = 0

Definition at line 148 of file includeROOT.h.

int const nuePDG = 12

Definition at line 153 of file includeROOT.h.

int const numuPDG = 14

Definition at line 154 of file includeROOT.h.

int const pi0PDG = 111

Definition at line 156 of file includeROOT.h.

int const pichPDG = 211

Definition at line 155 of file includeROOT.h.

int const protonPDG = 2212

Definition at line 149 of file includeROOT.h.

int const rho0PDG = 113

Definition at line 159 of file includeROOT.h.

int const rhoCHPDG = 213

Definition at line 160 of file includeROOT.h.

int const sigma0_PDG = 3212

Definition at line 174 of file includeROOT.h.

int const sigmaM_PDG = 3112

Definition at line 173 of file includeROOT.h.

int const sigmaP_PDG = 3222

Definition at line 175 of file includeROOT.h.