00001 #ifndef XeStat_h
00002 #define XeStat_h
00003
00004 #include "XeMath.h"
00005 #include "Math/DistFunc.h"
00006 #include <TRandom3.h>
00007
00008
00009 enum content { SPECTRUM
00010 , VALUES
00011 } ;
00012
00013 enum forceType { DO_NOT_FORCE
00014 , FORCE_TRUE
00015 , FORCE_FALSE
00016 } ;
00017
00018 enum analysisType { NO_ANALYSIS
00019 , PL_ANALYSIS
00020 , CUTS_ANALYSIS
00021 } ;
00022
00023 enum parameterType { PARAMETER_OF_INTEREST
00024 , NUISANCE_PARAMETER
00025 , FIXED_PARAMETER
00026 , FROZEN_PARAMETER
00027 , N_PARAMETER_TYPES
00028 } ;
00029
00030 enum sentivityModes { MINUS_TWO_SIGMAS
00031 , MINUS_ONE_SIGMA
00032 , MEDIAN
00033 , PLUS_ONE_SIGMA
00034 , PLUS_TWO_SIGMAS
00035 , N_SENSITIVITY_MODES
00036 } ;
00037
00038 enum systematicModes { ONE_SIGMA_BELOW = 0
00039 , CENTRAL
00040 , ONE_SIGMA_ABOVE
00041 , N_SIGMA_MODES
00042 } ;
00043
00044 enum rejectionFactor { REJECT995
00045 , REJECT9975
00046 , REJECT999
00047 , REJECT_ALL
00048 , N_REJECTION_MODES
00049 } ;
00050
00051 enum basicParameter { PAR_SIGMA = -1
00052 , PAR_SYST_BKG_TVALUE = -2
00053 , PAR_LEFF_TVALUE = -3
00054 , PAR_EFFICIENCY_TVALUE = -4
00055 , PAR_STAT_BKG_TVALUE = -120
00056 } ;
00057
00058 enum ciMode { CI_UP
00059 , CI_LOW
00060 , CI_TWO_SIDED
00061 , CLS_UP
00062 , CLS_LOW
00063 , CLS_TWO_SIDED
00064 , N_CI_MODES
00065 } ;
00066
00067 enum sigmaModes { ESTIMATED, UPPER_LIMIT };
00068 enum sigmaUnits { SIGMA_UNIT , EVENT_UNIT };
00069
00070 STATIC_CONST double DEFAULT_CL = 0.9 ;
00071 STATIC_CONST double DEFAULT_SIMULATED_X0 = 0.1 ;
00072 STATIC_CONST double DEFAULT_SIMULATED_SIGMA = 0.1 ;
00073 STATIC_CONST double DEFAULT_SIMULATED_MU_GAUSS = 0.5 ;
00074 STATIC_CONST double DEFAULT_SIMULATED_XMAX_B = 1.0 ;
00075 STATIC_CONST double LOGSQR2PI = 0.918938533205 ;
00076 STATIC_CONST double DEFAULT_EVENT_LK_LOWER_LIMIT = -7.5 ;
00077 STATIC_CONST double DEFAULT_EVENT_LOWER_LIMIT = 0. ;
00078 STATIC_CONST double DEFAULT_EVENT_UPPER_LIMIT = 20.0 ;
00079 STATIC_CONST bool DEFAULT_FORCE_SIGMA_POSITIVE = true ;
00080
00081 typedef double (*func_d)(double);
00082
00083 class DataSet;
00084
00085
00086
00087
00088
00089
00090 class XeStat : virtual public XeMath , virtual public XeObject {
00091
00092 public :
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 static void setAnalysisMode(int mode);
00104
00105
00106
00107
00108
00109 static int getAnalysisMode();
00110
00111
00112
00113
00114
00115 static void setPrintLevel(int level);
00116
00117
00118
00119
00120
00121
00122 static bool checkAnalysisMode(string name, int requested);
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133 static bool isAnalysisDefined(bool verbose=false);
00134
00135
00136
00137
00138 static bool isCutsBased();
00139
00140
00141
00142
00143 static bool isPL();
00144
00145
00146
00147
00148 static int getPrintLevel();
00149
00150
00151
00152
00153
00154 static int getSigmaLinLog(int unit);
00155
00156
00157
00158
00159
00160
00161 static XeRange* newSigmaRange(XeRange*range=NULL, int unit=EVENT_UNIT);
00162
00163
00164
00165
00166 static string getAnalysisModeName();
00167
00168
00169
00170
00171
00172 static string getAnalysisModeName(int mode);
00173
00174
00175
00176
00177
00178 static string getSystematicModeName(int syst);
00179
00180
00181
00182
00183
00184 static string getSigmaUnitName(int unit);
00185
00186
00187
00188
00189
00190 static string getSigmaLabel(int unit);
00191
00192
00193
00194
00195
00196 static string getSigmaModeName(int mode);
00197
00198
00199
00200
00201
00202
00203 static string getSigmaLimitLabel(int unit);
00204
00205 virtual ~XeStat();
00206 XeStat(string name);
00207 XeStat();
00208
00209 protected:
00210
00211 static int printLevel;
00212 static int analysisMode;
00213
00214 ClassDef(XeStat,1)
00215 } ;
00216
00217
00218
00219
00220
00221
00222
00223 class XeCombinable : virtual public XeStat {
00224
00225 public:
00226
00227
00228
00229
00230
00231 virtual ~XeCombinable();
00232
00233
00234
00235
00236 XeCombinable();
00237
00238
00239
00240
00241 XeCombinable(int e);
00242
00243
00244
00245
00246 virtual void setTheExperiment();
00247
00248
00249
00250
00251
00252 void setExperiment(int exp=UNDEFINED_INT);
00253
00254
00255
00256
00257
00258 int getExperiment();
00259
00260
00261
00262
00263 bool isExperimentSet();
00264
00265 protected:
00266
00267
00268
00269
00270
00271 static string getTheName(int e);
00272
00273 int experiment;
00274
00275 ClassDef(XeCombinable,1)
00276 };
00277
00278
00279
00280
00281
00282 class XeValues : public map<double,int>, public XeObject {
00283
00284 public :
00285
00286
00287
00288
00289
00290 virtual ~XeValues();
00291
00292 XeValues();
00293
00294
00295
00296
00297 XeValues(string name);
00298
00299
00300
00301
00302
00303
00304
00305 XeValues(string name,double *d,int n);
00306
00307
00308
00309
00310
00311
00312 XeValues(string name,vector<double>& vd);
00313
00314
00315
00316
00317
00318
00319
00320
00321 XeValues(string name,DataSet* dataSet,int col);
00322
00323
00324
00325
00326 int getNValues();
00327
00328
00329
00330
00331 int getNEntries();
00332
00333
00334
00335
00336
00337 bool printIt(int level=1);
00338
00339
00340
00341
00342 double largestGap();
00343
00344
00345
00346
00347
00348
00349 double quantile(double f);
00350
00351
00352
00353
00354
00355 double findSigma(double sigma);
00356
00357
00358
00359
00360
00361
00362 void reset();
00363
00364
00365
00366
00367
00368
00369 void add(double* values,int n);
00370
00371
00372
00373
00374
00375 void add(double value);
00376
00377
00378 protected :
00379
00380 int nEntries;
00381
00382 ClassDef(XeValues,1)
00383
00384 };
00385
00386 const string SPECTRUM_HEADER="Spectrum: ";
00387
00388
00389
00390
00391 class XeSpectrum : virtual public XeGraphics, virtual public XeStat{
00392
00393 public :
00394
00395 virtual ~XeSpectrum();
00396
00397
00398
00399
00400 XeSpectrum();
00401
00402
00403
00404
00405 XeSpectrum(string n);
00406
00407
00408
00409
00410 static string getTheName(string nam);
00411
00412
00413
00414
00415 string getReducedName();
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429 XeSpectrum(string nam,int nBins, double min, double max
00430 , double* spec=NULL, int nValues=0, int mode=SPECTRUM);
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441 XeSpectrum(string nam,LinearRange *lr, double *spec=NULL
00442 ,int nValues=0, int mode=SPECTRUM);
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454 XeSpectrum(string nam,int nBins, double min, double max
00455 , vector<double> &spec, int mode=SPECTRUM);
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465 XeSpectrum(string nam, LinearRange *lr,vector<double> &spec
00466 , int mode=SPECTRUM);
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476 XeSpectrum(string nam,int nBins,double min,double max, XeValues* values);
00477
00478
00479
00480
00481
00482
00483
00484
00485 void fillExponent(double x0, double norm=1., double xmin=0.
00486 ,double xmax=VERY_LARGE);
00487
00488
00489
00490
00491 XeSpectrum operator+(XeSpectrum& other);
00492
00493
00494
00495
00496 XeSpectrum operator*(double a);
00497
00498
00499
00500
00501
00502
00503 void add(XeSpectrum* other);
00504
00505
00506
00507
00508
00509
00510 void fillDelta(double x, double weight=1.);
00511
00512
00513
00514
00515
00516
00517 void setBin(int bin, double content);
00518
00519
00520
00521
00522
00523
00524 bool printIt(int level=1);
00525
00526
00527
00528
00529
00530 void printDetailed(bool ignoreTail);
00531
00532
00533
00534
00535 double sum();
00536
00537
00538
00539
00540
00541 LinearRange* getRange();
00542
00543
00544
00545
00546 int getNBins();
00547
00548
00549
00550
00551 double getMin();
00552
00553
00554
00555
00556 double getMax();
00557
00558
00559
00560
00561
00562
00563 vector<double>* getTheSpectrum();
00564
00565
00566
00567
00568
00569 double* getSpectrum();
00570
00571
00572
00573
00574
00575 int getBin(double x);
00576
00577
00578
00579
00580
00581
00582 pair<int,double> getBinAndFraction(double x);
00583
00584
00585
00586
00587
00588
00589
00590 double integral(double x1, double x2);
00591
00592
00593
00594
00595
00596
00597
00598
00599 XeGraph* newGraph( string Xlab="", string Ylab="" , XeStyle* style=NULL
00600 , string legend="");
00601
00602
00603
00604
00605
00606
00607
00608
00609 void drawGraph(string options="C",string Xlab="", string Ylab=""
00610 , XeStyle* style=NULL);
00611
00612
00613
00614
00615
00616
00617
00618 void drawGraphWithFrame(string options="C",string Xlab="", string Ylab=""
00619 , XeStyle* style=NULL );
00620
00621
00622
00623
00624
00625 void drawHistogram(string options="C",string Xlab="", string Ylab="");
00626
00627
00628
00629
00630
00631
00632
00633 TH1F* newHistogram(string name="",int plot=NONE);
00634
00635
00636
00637
00638
00639
00640 TH2F* newHistogram(int nSpectra,int plot=NONE);
00641
00642
00643
00644
00645
00646
00647 void fillHistogram(TH2F* hist, int spectrum);
00648
00649
00650
00651
00652 void reset();
00653
00654
00655
00656
00657
00658
00659 virtual void fillValues(double* values, int nValues);
00660
00661
00662
00663
00664
00665
00666 virtual void importSpectrum(double* spectrum);
00667
00668
00669
00670
00671
00672 virtual void importSpectrum(vector<double>& spectrum);
00673
00674
00675
00676
00677
00678 virtual void addSpectrum(vector<double>& spectrum);
00679
00680
00681
00682
00683
00684 void setTheRange(LinearRange *range);
00685
00686
00687
00688
00689
00690
00691
00692 void setTheRange(int nB, double min,double max);
00693
00694
00695 protected :
00696
00697
00698
00699
00700 void initialize();
00701
00702 int nBins;
00703 bool rangeIsCreated;
00704 LinearRange * range;
00705 vector<double> spectrum;
00706
00707 ClassDef(XeSpectrum,1)
00708 };
00709
00710 class XeDist : virtual public XeStat {
00711
00712 public:
00713
00714 virtual ~XeDist();
00715
00716 XeDist();
00717
00718
00719
00720
00721 XeDist(string n);
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733 static void normalize(TH1F* h,double toWhat=1.);
00734
00735
00736
00737
00738
00739
00740
00741 static void normalize(TGraph* graph,double toWhat=1.);
00742
00743
00744
00745
00746
00747
00748
00749 static double findQuantile(TH1* h, double q);
00750
00751
00752
00753
00754
00755
00756
00757 static double findSigma(TH1* h, double sigma);
00758
00759
00760
00761
00762 static double rndm();
00763
00764
00765
00766
00767
00768 virtual double generate()=0;
00769
00770
00771
00772
00773
00774
00775 vector<double> generateVector(int n);
00776
00777
00778
00779
00780
00781
00782 virtual double pdf(double x)=0;
00783
00784
00785
00786
00787
00788
00789 virtual double logPdf(double x);
00790
00791
00792
00793
00794
00795
00796 virtual double cdf(double x)=0;
00797
00798
00799
00800
00801
00802
00803
00804 double cdf(double x1,double x2);
00805
00806
00807
00808
00809 static string getTheName(string nam);
00810
00811 protected :
00812
00813 static TRandom3 random;
00814
00815 ClassDef(XeDist,1)
00816
00817 };
00818
00819
00820
00821
00822
00823
00824 class TabulatedDist : public XeSpectrum, public XeDist {
00825
00826 public:
00827
00828
00829
00830
00831
00832 virtual ~TabulatedDist();
00833
00834
00835
00836
00837 TabulatedDist();
00838
00839
00840
00841
00842 TabulatedDist(string n);
00843
00844
00845
00846
00847
00848
00849
00850 TabulatedDist(string nam,LinearRange *lr, double *spec=NULL
00851 , int nValues=0, int mode=SPECTRUM);
00852
00853 double cdf(double x);
00854 double pdf(double x);
00855
00856
00857
00858
00859 TabulatedDist(XeSpectrum *sp);
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873 TabulatedDist(string nam,int nbins, double min,double max,double *spec=NULL
00874 , int nValues=0, int mode=SPECTRUM);
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884 TabulatedDist(string nam,int nBins,double min,double max,XeValues* values);
00885
00886
00887
00888
00889
00890
00891 void importSpectrum(double* array);
00892
00893
00894
00895
00896
00897 void importSpectrum(vector<double>& spectrum);
00898
00899
00900
00901
00902
00903 void importSpectrum(XeSpectrum* spectrum);
00904
00905
00906
00907
00908
00909
00910 virtual void fillValues(double* values, int nValues);
00911
00912
00913
00914
00915
00916
00917
00918
00919 void importDistribution(XeDist* dist);
00920
00921
00922
00923
00924
00925
00926 void addDelta(double x, double w=1.);
00927
00928
00929
00930
00931
00932
00933 TH1F* newCumulatedHistogram(string name="",int plot=NONE);
00934
00935
00936
00937
00938
00939
00940
00941
00942 XeGraph* newCumulatedGraph( string Xlab="", string Ylab=""
00943 , XeStyle* style=NULL, string legend="");
00944
00945
00946
00947
00948
00949
00950
00951
00952 void drawCumulatedGraph(string options="C",string Xlab="", string Ylab=""
00953 , XeStyle* style=NULL);
00954
00955
00956
00957
00958
00959
00960
00961 void drawCumulatedGraphWithFrame(string options="C",string Xlab=""
00962 , string Ylab="" , XeStyle* style=NULL );
00963
00964
00965
00966
00967
00968 void drawCumulatedHist(string options="C",string Xlab="", string Ylab="");
00969
00970
00971
00972
00973
00974 double generate();
00975
00976
00977
00978
00979
00980
00981 double quantileX(double c);
00982
00983
00984
00985
00986
00987
00988 int quantileBin(double c);
00989
00990
00991
00992
00993
00994 bool printIt(int level=1);
00995
00996
00997
00998
00999
01000 bool printCumulated(int level=1);
01001
01002
01003
01004
01005
01006 double* getCumulated();
01007
01008
01009
01010
01011
01012 void normalizeAndCumulate();
01013
01014
01015
01016
01017 map<double,int>* getCdfMap();
01018
01019
01020
01021
01022 vector<double>* getCdfVector();
01023
01024
01025 protected:
01026
01027 vector<double> cdfVector;
01028 map<double,int> cdfMap;
01029
01030 ClassDef(TabulatedDist,1)
01031
01032 };
01033
01034
01035
01036
01037
01038 class UniformDist : public XeDist {
01039
01040 public :
01041
01042
01043
01044
01045 UniformDist();
01046
01047
01048
01049
01050
01051
01052 UniformDist(double a, double b);
01053 ~UniformDist();
01054
01055
01056
01057
01058
01059
01060 void setLimits(double a, double b);
01061
01062
01063
01064
01065
01066 double cdf(double x);
01067
01068
01069
01070
01071
01072 double pdf(double x);
01073
01074
01075
01076
01077 double generate();
01078 static double generate(double a, double b);
01079
01080 protected :
01081
01082 double x0;
01083 double x1;
01084 double onew;
01085
01086 ClassDef(UniformDist,1)
01087
01088 };
01089
01090
01091
01092
01093
01094 class ExponentialDist : public XeDist {
01095
01096 public :
01097
01098 ExponentialDist(double x0=1.);
01099 ~ExponentialDist();
01100
01101 void setX0(double x0);
01102
01103
01104
01105
01106
01107 double cdf(double x);
01108
01109
01110
01111
01112
01113 double pdf(double x);
01114
01115
01116
01117
01118
01119
01120 double logPdf(double x);
01121
01122
01123
01124
01125 double generate();
01126
01127
01128
01129
01130
01131 static double generate(double x0);
01132
01133 protected :
01134
01135 double x0;
01136
01137
01138 ClassDef(ExponentialDist,1)
01139
01140 };
01141
01142
01143
01144
01145
01146 class Chi2Dist : public XeDist {
01147
01148 public :
01149
01150
01151
01152
01153 Chi2Dist();
01154
01155
01156
01157
01158
01159 Chi2Dist(int dof);
01160 ~Chi2Dist();
01161
01162
01163
01164
01165
01166 void setNdof(int ndof);
01167
01168
01169
01170
01171
01172 double cdf(double x);
01173
01174
01175
01176
01177
01178 double pdf(double x);
01179
01180
01181
01182
01183 double generate();
01184
01185
01186
01187
01188
01189
01190 static double pdf(double x,int dof);
01191
01192
01193
01194
01195
01196
01197 static double above(double chi2, int ndof);
01198
01199
01200
01201
01202
01203
01204 static double below(double chi2, int ndof);
01205
01206
01207
01208
01209
01210
01211
01212 static double between(double chi2_1, double chi2_2, int ndof);
01213
01214
01215
01216
01217
01218 static double generate(int dof);
01219
01220 protected :
01221
01222 int ndof;
01223
01224 ClassDef(Chi2Dist,1)
01225
01226 };
01227
01228
01229
01230
01231
01232 class GaussianDist : public XeDist {
01233
01234 public :
01235
01236
01237
01238
01239
01240 GaussianDist();
01241
01242
01243
01244
01245
01246
01247 GaussianDist(double mu, double sigma);
01248 ~GaussianDist();
01249
01250
01251
01252
01253 void setMu(double mu);
01254
01255
01256
01257
01258 void setSigma(double sigma);
01259
01260
01261
01262
01263
01264 double cdf(double x);
01265
01266
01267
01268
01269
01270 double pdf(double x);
01271
01272
01273
01274
01275
01276
01277 double logPdf(double x);
01278
01279
01280
01281
01282 double generate();
01283
01284
01285
01286
01287 static double above(double nSigmas);
01288
01289
01290
01291
01292 static double below(double nSigmas);
01293
01294
01295
01296
01297
01298
01299
01300 static double inside(double Xmin, double Xmax, double sigma=1.);
01301 static double logPdf(double x, double mean, double sigma);
01302 static double generate(double m, double sig);
01303
01304 protected :
01305
01306 double mu;
01307 double sigma;
01308
01309
01310 ClassDef(GaussianDist,1)
01311
01312 };
01313
01314
01315
01316
01317
01318 class PoissonDist : public XeDist {
01319
01320 public :
01321
01322 PoissonDist(double mu);
01323 ~PoissonDist();
01324
01325 void setMu(double mu);
01326
01327
01328
01329
01330
01331 double cdf(double x);
01332
01333
01334
01335
01336
01337 double pdf(double x);
01338
01339
01340
01341
01342
01343
01344 double logPdf(double x);
01345
01346
01347
01348
01349 double generate();
01350
01351 static double generate(double m);
01352 static double pdf(int n, double m);
01353 static double pdf(double n, double m);
01354 static double logPdf(int n, double m);
01355 static double logPdf(double n, double m);
01356 static double aboveEqual(int n, double m);
01357 static double above(int n, double m);
01358 static double belowEqual(int n, double m);
01359 static double below(int n, double m);
01360 static double between(int n1, int n2, double m);
01361 static void fillTable(XeTable& table, double m, double eps);
01362
01363 protected :
01364
01365 double mu;
01366
01367
01368 ClassDef(PoissonDist,1)
01369
01370 };
01371
01372
01373
01374
01375
01376 class XeSigma : public XeObject {
01377
01378 public :
01379
01380 ~XeSigma();
01381 XeSigma();
01382
01383
01384
01385
01386
01387
01388 XeSigma(double mass,string name="");
01389
01390
01391
01392
01393
01394
01395
01396
01397 XeSigma(double mass,double sigma, double events,string name="");
01398
01399
01400
01401
01402 double getMass();
01403
01404
01405
01406
01407 double getSigma();
01408
01409
01410
01411
01412 double getEvents();
01413
01414
01415
01416
01417
01418
01419 double getValue(int unit);
01420
01421
01422
01423
01424
01425 bool printIt(int level=1);
01426
01427
01428
01429
01430 void set(double mass,double sigma, double events,string name="");
01431
01432 protected :
01433
01434 double mass;
01435 double sigma;
01436 double events;
01437
01438
01439
01440
01441
01442
01443 static string getTheName(double mass,string eTitle);
01444
01445 ClassDef(XeSigma,1)
01446 };
01447
01448
01449
01450
01451 class XeLimit : public XeStat {
01452
01453 public :
01454
01455 ~XeLimit();
01456 XeLimit();
01457
01458
01459
01460
01461
01462
01463 XeLimit(double mass,string name="");
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476 XeLimit(double mass,double estimatedSigma, double estimatedEvents
01477 , double sigmaLimit, double eventsLimit,string name="");
01478
01479
01480
01481
01482 double getMass();
01483
01484
01485
01486
01487 double getSigmaLimit();
01488
01489
01490
01491
01492 double getEventsLimit();
01493
01494
01495
01496
01497
01498
01499 double getLimit(int unit);
01500
01501
01502
01503
01504 double getEstimatedSigma();
01505
01506
01507
01508
01509 double getEstimatedEvents();
01510
01511
01512
01513
01514
01515
01516 double getEstimated(int unit);
01517
01518
01519
01520
01521
01522
01523
01524 double getValue(int what,int unit);
01525
01526
01527
01528
01529
01530
01531 bool printIt(int level=1);
01532
01533 protected :
01534
01535
01536
01537
01538
01539
01540 static string getTheName(double mass,string eTitle);
01541
01542 XeSigma estimated;
01543 XeSigma limit;
01544
01545 ClassDef(XeLimit,1)
01546 };
01547
01548
01549 typedef map<double, XeSigma*>::iterator SigmaIterator;
01550
01551
01552
01553 class XeSigmas : public map<double, XeSigma*> , public XeStat {
01554
01555 public :
01556
01557 ~XeSigmas();
01558
01559
01560
01561 XeSigmas();
01562
01563
01564
01565
01566
01567 XeSigmas(string title);
01568
01569
01570
01571
01572
01573 bool printIt(int level=1);
01574
01575
01576
01577
01578
01579 void read(string fName);
01580
01581
01582
01583
01584
01585 void add(XeSigma *sigma);
01586
01587
01588
01589
01590
01591
01592
01593 void add(double mass, double sigma, double events);
01594
01595
01596
01597
01598
01599
01600 XeGraph* newSigmaGraph(int plot);
01601
01602
01603
01604
01605
01606
01607 XeGraph* newEventsGraph(int plot);
01608
01609
01610
01611
01612
01613
01614
01615 XeGraph* newGraph(int unit,int plot=NONE);
01616
01617 ClassDef(XeSigmas,1)
01618
01619 };
01620
01621
01622 typedef map<double, XeLimit*>::iterator UpperLimitIterator;
01623
01624
01625
01626
01627 class XeLimits : public map<double, XeLimit*>, public XeStat {
01628
01629 public :
01630
01631 ~XeLimits();
01632
01633
01634
01635 XeLimits();
01636
01637
01638
01639
01640
01641 XeLimits(string title);
01642
01643
01644
01645
01646
01647
01648 bool printIt(int level=1);
01649
01650
01651
01652
01653
01654 void read(string fName);
01655
01656
01657
01658
01659
01660 void add(XeLimit *limit);
01661
01662
01663
01664
01665
01666
01667
01668
01669
01670
01671
01672 void add(double mass, double estimatedSigma, double estimatedEvents
01673 , double sigmaLimit, double eventsLimit );
01674
01675
01676
01677
01678
01679
01680 XeGraph* newGraphOfEstimatedSigma(int plot=NONE);
01681
01682
01683
01684
01685
01686
01687
01688 XeGraph* newGraphOfEstimatedEvents(int plot=NONE);
01689
01690
01691
01692
01693
01694
01695 XeGraph* newGraphOfSigmaLimit(int plot=NONE);
01696
01697
01698
01699
01700
01701
01702
01703 XeGraph* newGraphOfEventLimit(int plot=NONE);
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714 XeGraph* newGraph(int mode, int unit, int plot=NONE);
01715
01716 ClassDef(XeLimits,1)
01717
01718 };
01719
01720
01721
01722
01723
01724 class XeSensitivity : public XeStat {
01725
01726 public :
01727
01728 ~XeSensitivity();
01729
01730
01731
01732 XeSensitivity();
01733
01734
01735
01736
01737
01738
01739
01740 XeSensitivity(double mass,double signalPerCm2,string eTitle="");
01741
01742
01743
01744
01745
01746
01747
01748
01749 XeSensitivity(double mass,double signalPerCm2, double * limits
01750 ,string eTitle="");
01751
01752
01753
01754
01755
01756 bool printIt(int level=1);
01757
01758
01759
01760
01761
01762
01763
01764 void setLimit(int mode, double limit);
01765
01766
01767
01768
01769
01770 void setLimits(double* limits);
01771
01772
01773
01774
01775
01776
01777
01778 double getLimit(int which,int unit=SIGMA_UNIT);
01779
01780
01781
01782
01783 double* getLimits();
01784
01785
01786
01787
01788 double getMass();
01789
01790
01791
01792
01793 double getSignalPerCm2();
01794
01795 protected :
01796
01797
01798
01799
01800
01801
01802 static string getTheName(double mass,string eTitle);
01803
01804 double mass;
01805 double signalPerCm2;
01806 double limits[N_SENSITIVITY_MODES];
01807
01808 ClassDef(XeSensitivity,1)
01809 };
01810
01811 typedef map<double, XeSensitivity*>::iterator SensitivityIterator;
01812
01813
01814
01815
01816 class SensitivityBands : public XeStat
01817 , public map<double, XeSensitivity*> ,public XeStylized {
01818
01819 public :
01820
01821 ~SensitivityBands();
01822
01823
01824
01825
01826 SensitivityBands();
01827
01828
01829
01830
01831
01832 SensitivityBands(string runName);
01833
01834
01835
01836
01837
01838
01839 static int lineStyle(int which);
01840
01841
01842
01843
01844
01845
01846 static double numberOfSigmas(int which);
01847
01848
01849
01850
01851
01852
01853 static string bandName(int which);
01854
01855
01856
01857
01858 void read(string fName);
01859
01860
01861
01862
01863
01864 void draw(string options="C",int unit=SIGMA_UNIT);
01865
01866
01867
01868
01869 double getMaxX();
01870
01871
01872
01873
01874 double getMinX();
01875
01876
01877
01878
01879 double getMaxY();
01880
01881
01882
01883
01884 double getMinY();
01885
01886
01887
01888
01889 double getMinYNotZero();
01890
01891
01892
01893
01894
01895 bool printIt(int level=1);
01896
01897
01898
01899
01900
01901 void add(XeSensitivity *sensitivity);
01902
01903
01904
01905
01906
01907
01908
01909 void add(double mass, double signalPerCm2, double* limits);
01910
01911
01912
01913
01914
01915
01916
01917 XeGraph* newGraph(int which,int unit=SIGMA_UNIT);
01918
01919
01920
01921
01922
01923 XeMultiGraph* newMultiGraph(int unit=SIGMA_UNIT);
01924
01925
01926
01927
01928
01929
01930
01931 TPolyLine* newPolygon(int low, int high, int unit);
01932
01933 ClassDef(SensitivityBands,1)
01934 };
01935
01936
01937
01938
01939 class DataSet : public XeStat {
01940
01941 public :
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951
01952 DataSet(string name,int nCol);
01953
01954
01955
01956 DataSet();
01957 ~DataSet();
01958
01959
01960
01961
01962
01963 void addEntry(double* x);
01964
01965
01966
01967
01968
01969 bool printIt(int level=1);
01970
01971
01972
01973
01974 void clear();
01975
01976
01977
01978
01979
01980
01981 void getEntry(int entry,double* values);
01982
01983
01984
01985
01986 int getNColumns();
01987
01988
01989
01990
01991 int getNEvents();
01992
01993
01994
01995
01996
01997
01998 double getValue(int entry,int col);
01999
02000
02001
02002
02003
02004 double getMax(int col);
02005
02006
02007
02008
02009
02010 double getMin(int col);
02011
02012
02013
02014
02015
02016
02017 double* getVector(int col);
02018
02019
02020
02021
02022
02023
02024 vector<double>* getColumn(int col);
02025
02026
02027
02028
02029
02030
02031
02032
02033 virtual bool update();
02034
02035 protected :
02036
02037 vector<vector<double>* > entries;
02038 int nColumns;
02039 int nEvents;
02040
02041 ClassDef(DataSet,1)
02042 };
02043
02044
02045
02046
02047
02048 class SimulatedDataSet : public DataSet {
02049
02050 public :
02051
02052
02053
02054
02055
02056 SimulatedDataSet(string name, int nDim);
02057 SimulatedDataSet();
02058
02059 virtual void initialize();
02060 virtual void generateSignal(double *x)=0;
02061 virtual void generateBackground(double *x)=0;
02062 void simulate(double muSignal, double muBackground);
02063 void generate(int nSignal, int nBackground);
02064
02065
02066
02067
02068
02069 ~SimulatedDataSet();
02070
02071 protected :
02072
02073 vector<double> transient;
02074
02075 ClassDef(SimulatedDataSet,1)
02076
02077 };
02078
02079
02080
02081
02082
02083 class OneDimSimulatedDataSet : public SimulatedDataSet {
02084
02085 public :
02086
02087
02088
02089
02090
02091 OneDimSimulatedDataSet();
02092
02093 void generateSignal(double *x);
02094 void generateBackground(double *x);
02095 void setSignal(XeDist* s);
02096 void setBackground(XeDist* b);
02097
02098
02099
02100
02101
02102 XeDist* getSignal();
02103 XeDist* getBackground();
02104
02105
02106
02107
02108
02109 ~OneDimSimulatedDataSet();
02110 void initialize();
02111
02112 protected :
02113
02114 XeDist* signal;
02115 XeDist* background;
02116
02117 ClassDef(OneDimSimulatedDataSet,1)
02118
02119 };
02120
02121
02122
02123
02124
02125
02126 class SimulatedExponentAndBackground : public OneDimSimulatedDataSet {
02127
02128 public :
02129
02130
02131
02132
02133
02134 SimulatedExponentAndBackground(double x0=DEFAULT_SIMULATED_X0
02135 ,double xMaxB=DEFAULT_SIMULATED_XMAX_B);
02136
02137
02138
02139
02140
02141 void setX0(double x0);
02142 void setXmaxB(double xm);
02143
02144
02145
02146
02147
02148 ~SimulatedExponentAndBackground();
02149
02150 protected :
02151
02152 ExponentialDist *exp;
02153 UniformDist *uni;
02154
02155 ClassDef(SimulatedExponentAndBackground,1)
02156
02157
02158 };
02159
02160
02161
02162
02163
02164 class SimulatedGaussianAndBackground : public OneDimSimulatedDataSet {
02165
02166 public :
02167
02168
02169
02170
02171
02172 SimulatedGaussianAndBackground( double mu=DEFAULT_SIMULATED_MU_GAUSS
02173 , double sigma=DEFAULT_SIMULATED_SIGMA
02174 , double xMaxB=DEFAULT_SIMULATED_XMAX_B
02175 ) ;
02176
02177
02178
02179
02180
02181 void setXmaxB(double xm);
02182 void setMu(double mu);
02183 void setSigma(double sigma);
02184
02185
02186
02187
02188
02189
02190 ~SimulatedGaussianAndBackground();
02191
02192 protected :
02193
02194 GaussianDist *gau;
02195 UniformDist *uni;
02196
02197 ClassDef(SimulatedGaussianAndBackground,1)
02198 };
02199
02200
02201
02202
02203
02204
02205 class SignalAndBackground : virtual public XeStat {
02206
02207
02208
02209
02210
02211 public :
02212
02213 virtual ~SignalAndBackground();
02214 SignalAndBackground(double sigToE=1., double bkg=0., double dbkg=0.
02215 ,double eff=1., double deff=0.);
02216
02217
02218
02219
02220 void combine(SignalAndBackground *sb1, SignalAndBackground *sb2);
02221 void combine(vector<SignalAndBackground*> &vsb);
02222
02223
02224
02225
02226
02227 void printSBParameters();
02228 void setBackground(double b=0.);
02229 void setDBackground(double db=0.);
02230 void setExposure(double exposure=1.);
02231 void setSigToEvents(double v=1.);
02232 void setNObserved(int observed=0);
02233 void setNObservedAsBackground();
02234 void setEfficiency(double e=1.);
02235 void setDEfficiency(double de=0.);
02236 void fillPoissonTable(XeTable& table, double eps=1.e-5, double sig=0.);
02237 int getNObserved();
02238 double getBackground();
02239 double getDBackground();
02240 double getSigToEvents();
02241 double getExposure();
02242 double getEfficiency();
02243 double getDEfficiency();
02244 double nSignalEvents(double sigma);
02245 double nBackgroundEvents();
02246 double nTotalEvents(double sigma);
02247
02248
02249
02250
02251
02252 void reset();
02253 double probability(int observed=AUTO,double sig=0.);
02254
02255 protected:
02256
02257
02258 int nObserved;
02259 double sigToEvents;
02260 double exposure;
02261 double efficiency;
02262 double dEfficiency;
02263 double background;
02264 double dBackground;
02265
02266 ClassDef(SignalAndBackground,1)
02267 };
02268
02269
02270
02271
02272
02273
02274
02275
02276 class CI : virtual public solvable, public XeStat {
02277
02278 public:
02279
02280 CI(int mode=UNDEFINED_INT);
02281 virtual ~CI();
02282 bool isInside(double x);
02283 bool withLowerLimit();
02284 bool withUpperLimit();
02285 double getLowerLimit();
02286 double getUpperLimit();
02287 void applyCLs(bool doIt);
02288 bool isCLsApplied();
02289
02290
02291
02292
02293
02294
02295 protected:
02296
02297 int mode;
02298 bool withUpper;
02299 bool withLower;
02300 bool doApplyCLs;
02301 double LowerLimit;
02302 double UpperLimit;
02303 static bool withCLs(int mode);
02304 static bool withLowerLimit(int mode);
02305 static bool withUpperLimit(int mode);
02306 static bool isSingleLowerLimit(int mode);
02307 static bool isSingleUpperLimit(int mode);
02308 };
02309
02310
02311
02312
02313
02314
02315 class PoissonCI : public CI {
02316
02317
02318
02319
02320
02321
02322
02323 public :
02324
02325 PoissonCI(SignalAndBackground *sb,int mode=UNDEFINED_INT);
02326 PoissonCI(double sigToE=1.,double bkg=0.,int mode=UNDEFINED_INT);
02327 virtual ~PoissonCI();
02328 void computeLimits(int nObserved, double CL=DEFAULT_CL);
02329 void computeLimits(double CL=DEFAULT_CL);
02330 bool expectsBackground();
02331 double upperSigma(double CL=DEFAULT_CL);
02332 double coverage(double sigma,double CL=DEFAULT_CL);
02333
02334 static bool expectsBackground(int mode);
02335 static double upperLimit(int m, int nObs, double bkg, double CL);
02336 static double lowerLimit(int m, int nObs, double bkg, double CL);
02337
02338
02339
02340
02341
02342 double getValue(double sigma);
02343 double oneLimit(int currentMode, double CL);
02344 void setBackground(double b=0.);
02345 void setExposure(double exposure=1.);
02346 void setSigToEvents(double v=1.);
02347 void setNObserved(int observed);
02348 void setNObservedAsBackground();
02349 void setEfficiency(double e=1.);
02350 void setSignalAndBackground(SignalAndBackground *sb);
02351
02352 SignalAndBackground* getSignalAndBackground();
02353
02354 protected :
02355
02356 bool deleteSB;
02357 int currentMode;
02358 SignalAndBackground* SB;
02359 ClassDef(PoissonCI,1)
02360 };
02361
02362
02363
02364
02365
02366
02367 class Rejection : virtual public XeStat {
02368
02369
02370
02371
02372
02373 public:
02374
02375 Rejection();
02376 ~Rejection();
02377
02378 static string getModeName(double e);
02379 static string getModeName(int mode);
02380 static int getMode(double eff);
02381 static double getRejection(int mode);
02382
02383 protected :
02384
02385 static double rejections[N_REJECTION_MODES];
02386 ClassDef(Rejection,1)
02387
02388 };
02389
02390
02391
02392
02393
02394
02395
02396
02397
02398 class PValue : virtual public XeStat {
02399
02400
02401 public :
02402
02403
02404
02405
02406
02407
02408
02409
02410 PValue();
02411
02412
02413
02414
02415
02416
02417 PValue(string name, int analMode=NO_ANALYSIS);
02418
02419
02420
02421
02422
02423
02424 virtual double pValueS(double sigma)=0;
02425
02426
02427
02428
02429
02430
02431 virtual double qExclusion(double sigma);
02432
02433
02434
02435
02436
02437 virtual double getSigmaHat();
02438
02439
02440
02441
02442 virtual double nSignalPerCm2()=0;
02443
02444
02445
02446
02447
02448 virtual bool update()=0;
02449
02450
02451
02452
02453 virtual void printFlagsAndParameters()=0;
02454
02455
02456
02457
02458 virtual void exclusionComputed();
02459
02460
02461
02462
02463
02464 virtual bool simulate(double sigma=0.);
02465
02466
02467
02468
02469 virtual void setWimpMass(double mass);
02470
02471
02472
02473
02474 virtual void updateSigmaUnit();
02475
02476
02477
02478
02479 virtual void estimateCrossSection();
02480
02481
02482
02483
02484
02485 virtual int forceCLs();
02486
02487
02488
02489
02490 void setSigmaUnit(double scale);
02491
02492
02493
02494
02495
02496
02497
02498
02499
02500
02501 void initializeIt(int mode=NO_ANALYSIS);
02502
02503 virtual ~PValue();
02504
02505
02506
02507
02508 bool isAnalysisModeOK();
02509
02510
02511
02512
02513 bool isInitializedOK();
02514
02515
02516
02517
02518 bool isInError();
02519
02520
02521
02522
02523 bool initialize();
02524
02525
02526
02527
02528 double pValueB();
02529
02530
02531
02532
02533 virtual double eventsUpperLimit();
02534
02535
02536
02537
02538 virtual double eventsLowerLimit();
02539
02540
02541
02542
02543 virtual void setEventsUpperLimit(double l);
02544
02545
02546
02547
02548 virtual void setEventsLowerLimit(double l);
02549
02550 protected :
02551
02552
02553
02554
02555 virtual bool checkPValue()=0;
02556
02557 int requestedAnalysisMode;
02558 bool initializedOK;
02559 bool inError;
02560 double sigmaUnit;
02561 double lowerLimit;
02562 double upperLimit;
02563
02564 ClassDef(PValue,1)
02565 };
02566
02567
02568
02569
02570
02571
02572 class PVcountingSB :public PValue, public SignalAndBackground
02573 , public XeCombinable {
02574
02575
02576
02577
02578
02579 public :
02580
02581 ~PVcountingSB();
02582 PVcountingSB(double sigToE=1., double bkg=0. ,double eff=1.);
02583
02584
02585
02586
02587
02588
02589
02590
02591 void printFlagsAndParameters();
02592
02593
02594
02595
02596 void setEventsUpperLimit(double lim);
02597 bool update();
02598 bool checkPValue();
02599 double pValueS(double sigma);
02600
02601
02602
02603
02604 double nSignalPerCm2();
02605 double eventsUpperLimit();
02606 double getSigmaHat();
02607
02608 ClassDef(PVcountingSB,1)
02609
02610 };
02611
02612
02613
02614
02615
02616
02617
02618 class YellinPValue : public XeCombinable, public PValue {
02619
02620
02621
02622 public :
02623
02624
02625
02626
02627
02628
02629 virtual ~YellinPValue();
02630 YellinPValue(DataSet* dataSet, XeDist* signalDistribution
02631 , double sToE=1., int col=0);
02632 YellinPValue(OneDimSimulatedDataSet* dataSet,double sToE=1.);
02633 double pValueS(double sigma);
02634
02635
02636
02637
02638 double nSignalPerCm2();
02639 double eventsUpperLimit();
02640 bool update();
02641 bool checkPValue();
02642
02643
02644
02645
02646 void printFlagsAndParameters();
02647 int forceCLs();
02648
02649 DataSet* getDataSet();
02650
02651 protected :
02652
02653 int column;
02654 double sigToEvents;
02655 double maxGapForOne;
02656 DataSet* dataSet;
02657 XeDist* signal;
02658
02659 ClassDef(YellinPValue,1)
02660
02661 };
02662
02663
02664
02665
02666
02667
02668 class Exclusion : public XeStat, public solvable {
02669
02670 public :
02671
02672
02673
02674
02675
02676
02677 ~Exclusion();
02678
02679
02680
02681 Exclusion();
02682
02683
02684
02685
02686
02687 Exclusion(PValue *pValue);
02688
02689
02690
02691
02692
02693
02694 Exclusion(PValue** pValueS, int nP);
02695
02696
02697
02698
02699
02700
02701 XeLimit* computeUpperLimit(double cl=DEFAULT_CL);
02702
02703
02704
02705
02706
02707 void simulate(double sigma);
02708
02709
02710
02711
02712
02713 double qExclusion(double sig);
02714
02715
02716
02717
02718
02719
02720
02721
02722 void simulateNUpperLimits(int n, XeValues *sigmas=NULL
02723 , XeValues *events=NULL,double cl=DEFAULT_CL);
02724
02725
02726
02727
02728
02729
02730
02731
02732
02733
02734
02735 void simulateNQValues(int n, XeValues *qs=NULL, XeValues* sHats=NULL
02736 ,XeValues* eHats=NULL,double sigSim=0.,double sigTest=0.);
02737
02738
02739
02740
02741
02742
02743 XeGraph* newGraphOfQExclusion(XeRange* sr, int unit=EVENT_UNIT);
02744
02745
02746
02747
02748
02749
02750
02751
02752 XeSensitivity* newSensitivity(double mass, int n, double cl=DEFAULT_CL);
02753
02754
02755
02756
02757
02758
02759
02760
02761 SensitivityBands* newSensitivityBands(int n, XeRange* mr=NULL
02762 ,double cl=DEFAULT_CL);
02763
02764
02765
02766
02767
02768
02769
02770 XeLimits* newUpperLimits(XeRange* mr=NULL,double cl=DEFAULT_CL);
02771
02772
02773
02774
02775
02776
02777
02778 XeGraph* newGraphOfPValue(XeRange* sr,int plot=NONE);
02779
02780
02781
02782
02783
02784
02785
02786
02787 XeGraph* newGraphOfUpperSigma(XeRange* mr, int plot=NONE
02788 ,double cl=DEFAULT_CL);
02789
02790
02791
02792
02793
02794
02795
02796
02797 XeGraph* newGraphOfUpperEvents(XeRange* mr,int plot=NONE
02798 ,double cl=DEFAULT_CL);
02799
02800
02801
02802
02803
02804
02805
02806
02807
02808
02809 XeGraph* newGraphOfUpperLimit(int unit,XeRange* mr,int plot=NONE
02810 , double cl=DEFAULT_CL);
02811
02812
02813
02814
02815 void reset();
02816
02817
02818
02819
02820
02821 void setWimpMass(double mass);
02822
02823
02824
02825
02826 double getWimpMass();
02827
02828
02829
02830
02831
02832
02833
02834 void setSigmaUnitAndLimits(double sigmaUnit, double eMin, double eMax);
02835
02836
02837
02838
02839
02840 void applyCLs(bool doIt);
02841
02842
02843
02844
02845
02846 void applyCLsAndSave(bool doIt);
02847
02848
02849
02850
02851 void saveCLs();
02852
02853
02854
02855
02856 void restoreCLs();
02857
02858
02859
02860
02861
02862 void applyFisherCorrection(bool doIt);
02863
02864
02865
02866
02867 bool isCLsApplied();
02868
02869
02870
02871
02872
02873 static double typicalUpperLimit(int nev);
02874
02875
02876
02877
02878
02879
02880
02881
02882
02883
02884 bool prepareForLimit();
02885
02886
02887
02888
02889 bool update();
02890
02891
02892
02893
02894 bool initialize();
02895
02896
02897
02898
02899
02900
02901
02902 double correctedPValue(double sigma,bool useSaved=false);
02903
02904
02905
02906
02907
02908 double getValue(double sigma);
02909
02910 protected :
02911
02912 int nPValues;
02913 bool initializedOK;
02914 bool doApplyCLs;
02915 bool savedApplyCLs;
02916 bool fisherCorrection;
02917 double wimpMass;
02918 double savedPBkg;
02919 double signalPerCm2;
02920 double eventMin;
02921 double eventMax;
02922 vector<PValue*> pValues;
02923
02924
02925
02926
02927
02928
02929 void addPValues(PValue** pV,int l);
02930
02931
02932
02933
02934
02935
02936 void addPValue(PValue* pV);
02937
02938
02939
02940
02941 double computePB();
02942
02943 ClassDef(Exclusion,1)
02944
02945 } ;
02946
02947
02948
02949
02950
02951 class LKParameter : public XeCombinable {
02952
02953
02954
02955
02956
02957 public :
02958
02959
02960 static string getTypeName(int type);
02961
02962 virtual ~LKParameter();
02963
02964
02965
02966
02967 LKParameter();
02968
02969
02970
02971
02972
02973
02974
02975
02976
02977
02978
02979
02980 LKParameter(int id, int type,string nam,double initial,double step
02981 ,double min, double max);
02982
02983 void printInitial();
02984 void printCurrent(bool withErrors);
02985 void setType(int typ);
02986 void setInitialValue(double i);
02987 void setCurrentValue(double c);
02988 void setCurrentValueInMinuitUnits(double c);
02989
02990
02991
02992
02993
02994
02995
02996 void setMinuitUnit(double s=1.);
02997 void setStep(double st);
02998 void setSigma(double sig);
02999 void setSigmaInMinuitUnits(double sig);
03000 void setMinimum(double mi);
03001 void setMaximum(double max);
03002 int getType();
03003 int getId();
03004 double getCurrentValue();
03005 double getCurrentValueInMinuitUnits();
03006 double getInitialValue();
03007 double getInitialValueInMinuitUnits();
03008 double getMaximum();
03009 double getMaximumInMinuitUnits();
03010 double getMinimum();
03011 double getMinimumInMinuitUnits();
03012 double getStep();
03013 double getStepInMinuitUnits();
03014 double getSigma();
03015 string getTypeName();
03016
03017
03018
03019
03020
03021
03022
03023
03024
03025
03026 void setCommon(bool c=true);
03027 bool isActive();
03028 bool isOfInterest();
03029 bool isCommon();
03030
03031
03032
03033
03034
03035 void freeze(bool doFreeze);
03036
03037
03038
03039
03040
03041 bool compares(LKParameter* par, bool print);
03042 void printExperiment();
03043 bool inCombinedMode();
03044 void initialize();
03045 void setCombinedMode(bool mode=true);
03046
03047 protected :
03048
03049 int type;
03050 int id;
03051 bool common;
03052 bool combinedMode;
03053 double initialValue;
03054 double step;
03055 double minimum;
03056 double maximum;
03057 double currentValue;
03058 double sigma;
03059 double MinuitUnit;
03060
03061 ClassDef(LKParameter,1)
03062
03063 } ;
03064
03065
03066
03067
03068 class SigmaParameter : public LKParameter {
03069 public :
03070 SigmaParameter();
03071 ~SigmaParameter();
03072
03073 ClassDef(SigmaParameter,1)
03074
03075 } ;
03076
03077
03078
03079
03080 class TSystBkgParameter : public LKParameter {
03081 public :
03082 TSystBkgParameter();
03083 ~TSystBkgParameter();
03084
03085 ClassDef(TSystBkgParameter,1)
03086 } ;
03087
03088
03089
03090
03091
03092 class TStatBkgParameter : public LKParameter {
03093
03094 public :
03095 TStatBkgParameter();
03096 TStatBkgParameter(int band);
03097 ~TStatBkgParameter();
03098
03099 ClassDef(TStatBkgParameter,1)
03100
03101 protected :
03102
03103 static string getTheName(int b);
03104 int band;
03105 } ;
03106
03107
03108
03109
03110
03111 class TLEffParameter : public LKParameter {
03112 public :
03113 TLEffParameter();
03114 ~TLEffParameter();
03115
03116 ClassDef(TLEffParameter,1)
03117
03118 } ;
03119
03120
03121
03122
03123 class TEfficiencyParameter : public LKParameter {
03124 public :
03125 TEfficiencyParameter();
03126 ~TEfficiencyParameter();
03127
03128 ClassDef(TEfficiencyParameter,1)
03129
03130 } ;
03131
03132
03133
03134
03135
03136
03137 class Likelihood : public XeCombinable {
03138
03139
03140 public:
03141
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151 virtual double computeTheLogLikelihood()=0;
03152 virtual ~Likelihood();
03153
03154
03155
03156
03157
03158 Likelihood(string name);
03159
03160
03161
03162
03163 Likelihood();
03164
03165
03166
03167
03168
03169
03170
03171 static double shapeLikelihood(vector<double>* values, XeDist* dist);
03172
03173
03174
03175
03176
03177
03178
03179
03180
03181 static double shapeLikelihood(vector<double>* values
03182 ,vector<XeDist*>& dists
03183 ,vector<double>& weights);
03184
03185
03186
03187
03188 bool parameterExists(int p);
03189
03190
03191
03192
03193
03194
03195
03196
03197
03198
03199
03200 void addParameter(int id, int type,string nam,double initialVal
03201 ,double step,double mi, double ma);
03202
03203
03204
03205
03206
03207
03208 void addParameter(LKParameter* param,int id=SAME);
03209
03210
03211
03212
03213
03214
03215 void replaceParameter(LKParameter* param,int id=SAME);
03216
03217
03218
03219
03220
03221 void addParameterTolerant(LKParameter* param);
03222
03223
03224
03225
03226
03227
03228 void activateParameter(LKParameter* param, bool active=true);
03229
03230
03231
03232
03233
03234
03235 void removeParameter(LKParameter* param, bool tolerant=false);
03236
03237
03238
03239
03240
03241
03242 void removeParameter(int id, bool tolerant=false);
03243
03244 void listParameters();
03245 void printInitialParameters();
03246 void printResultParameters();
03247 void printCurrentParameters();
03248 void setTheExperiment();
03249 void ignoreParameter(int id);
03250 void setParameterType(int id,int type);
03251 void setParameterValue(int id,double v);
03252 void setInitialValue(int id,double v);
03253 double getParameterValue(int id);
03254 double maximize(bool freezeParametersOfInterest);
03255
03256
03257
03258
03259
03260 int getNTotalParameters();
03261 int getNActiveParameters();
03262 int getNParametersOfInterest();
03263 int getNMinuitParameters();
03264 int getNNuisanceParameters();
03265 int getNParameters(int type);
03266 void resetParameters();
03267 LKParameter* getParameter(int id);
03268 map<int,LKParameter*>* getParameters();
03269
03270
03271
03272
03273
03274
03275
03276
03277
03278
03279
03280
03281 static double shapeLikelihood( vector<int>* bins, int nDist, double** dists
03282 , double *norm );
03283
03284
03285
03286
03287
03288 void setCurrentValues(const double* v,const double* ers=NULL);
03289 void setCurrentValuesInMinuitUnits(const double*v,const double*e=NULL);
03290 void setCombinedMode(bool mode=true);
03291 void printInitialHeader();
03292 void printCurrentHeader();
03293 bool checkConsistency();
03294 bool inCombinedMode();
03295 int mapMinuitParameters(bool freezeParametersOfInterest);
03296 int getNParametersForChi2();
03297 void forceNParametersOfInterest(int nF);
03298 void clearTheParameters();
03299
03300 protected:
03301
03302
03303
03304
03305 void setup();
03306
03307 int currentId;
03308 int nParametersOfInterest;
03309 int nActiveParameters;
03310 int nNuisanceParameters;
03311 int forcedNParametersOfInterest;
03312 bool combinedMode;
03313 vector<LKParameter*> MinuitParameters;
03314 map<int,LKParameter*> parameters;
03315
03316 void clear();
03317 bool checkParameter(int p, bool shouldExist);
03318
03319 ClassDef(Likelihood,1)
03320
03321 } ;
03322
03323 typedef map<int,LKParameter*>::iterator ParameterIterator;
03324
03325 #define TRAVERSE_PARAMETERS(it) \
03326 for(ParameterIterator it=parameters.begin(); it!=parameters.end(); it++)
03327
03328
03329
03330
03331
03332
03333
03334 class LikelihoodFromDataSet : public Likelihood {
03335
03336
03337
03338 public :
03339
03340
03341
03342
03343 LikelihoodFromDataSet(DataSet* data);
03344 virtual ~LikelihoodFromDataSet();
03345 virtual double computeIndividualLog(double *values)=0;
03346 double computeTheLogLikelihood();
03347 DataSet* getDataSet();
03348
03349 protected :
03350
03351 DataSet* data;
03352 vector<double> values;
03353 static string getTheName(DataSet* data);
03354
03355 ClassDef(LikelihoodFromDataSet,1)
03356
03357 } ;
03358
03359
03360
03361
03362
03363
03364 class ProfileLikelihood : public Likelihood, public PValue {
03365
03366
03367
03368 public :
03369
03370
03371
03372
03373
03374
03375
03376
03377 ProfileLikelihood();
03378
03379
03380
03381
03382
03383 ProfileLikelihood(string name);
03384
03385
03386
03387
03388
03389 double qExclusion(double sigma);
03390
03391
03392
03393
03394
03395 void updateSigmaUnit();
03396
03397
03398
03399
03400
03401
03402 double pValueS(double sigma);
03403 virtual ~ProfileLikelihood();
03404
03405
03406
03407
03408
03409 void doForceSigmaPositive(bool force);
03410
03411
03412
03413
03414
03415
03416
03417
03418 virtual bool checkPValue();
03419
03420
03421
03422
03423 void printFlagsAndParameters();
03424
03425
03426
03427
03428
03429 void estimateCrossSection();
03430
03431
03432
03433
03434
03435 double getSigmaHat();
03436
03437
03438
03439
03440 double getLodD();
03441
03442
03443
03444
03445
03446 XeGraph* newGraphOfLogLikelihood(EventRange* er=NULL);
03447
03448 protected :
03449
03450
03451
03452
03453 void setup();
03454
03455 LKParameter *sigPar;
03456 double sigmaHat;
03457 double LogD;
03458 bool forceSigmaPositive;
03459
03460 ClassDef(ProfileLikelihood,1)
03461
03462 } ;
03463
03464
03465
03466
03467
03468 class CombinedProfileLikelihood : public ProfileLikelihood {
03469
03470 public :
03471
03472
03473
03474
03475
03476 CombinedProfileLikelihood(string name);
03477 ~CombinedProfileLikelihood();
03478 void combine(ProfileLikelihood* pl,int experiment);
03479 double computeTheLogLikelihood();
03480
03481
03482
03483
03484
03485 ProfileLikelihood* getProfile(int experiment);
03486
03487
03488
03489
03490 void printFlagsAndParameters();
03491 void setWimpMass(double);
03492
03493
03494
03495
03496 double nSignalPerCm2();
03497
03498
03499
03500
03501
03502
03503 bool update();
03504
03505
03506 protected:
03507
03508 bool checkPValue();
03509 map<int,ProfileLikelihood* > exps;
03510 int nCommon;
03511 double sigToEvents;
03512
03513 ClassDef(CombinedProfileLikelihood,1)
03514
03515 };
03516
03517 typedef map<int,ProfileLikelihood*>::iterator expIterator;
03518
03519 #define TRAVERSE_EXPERIMENTS(it) \
03520 for(expIterator it=exps.begin(); it!=exps.end(); it++)
03521
03522
03523
03524
03525
03526
03527
03528 class PLcountingSB : public SignalAndBackground, public ProfileLikelihood{
03529
03530
03531
03532
03533
03534 public :
03535
03536 ~PLcountingSB();
03537 PLcountingSB(double sigToE=1., double bkg=0., double dbkg=0.
03538 ,double eff=1., double deff=0.);
03539
03540
03541
03542
03543
03544
03545
03546
03547
03548
03549 double computeTheLogLikelihood();
03550
03551
03552
03553
03554 void printFlagsAndParameters();
03555 void setWimpMass(double mass);
03556 bool update();
03557
03558
03559
03560
03561 double nSignalPerCm2();
03562 double eventsUpperLimit();
03563
03564
03565 ClassDef(PLcountingSB,1)
03566
03567 };
03568 #endif
03569
03570
03571