1 |
#include "PlotTools.h"
|
2 |
#include "SusyScan.h"
|
3 |
#include "GeneratorMasses.h"
|
4 |
|
5 |
#include <cmath>
|
6 |
#include <algorithm>
|
7 |
|
8 |
#include "TGraph.h"
|
9 |
#include "TH2.h"
|
10 |
#include "TH2F.h"
|
11 |
#include "TObjArray.h"
|
12 |
#include "TPad.h"
|
13 |
#include "TRint.h"
|
14 |
#include "TROOT.h"
|
15 |
|
16 |
template<class T>
|
17 |
TGraph * PlotTools<T>::Line( double(*x)(const T*), double(*y)(const T*),
|
18 |
double(*func)(const T*), const double mass, const double diff )
|
19 |
{
|
20 |
TGraph * result = new TGraph(1);
|
21 |
std::sort(_scan->begin(),_scan->end(),sort_by(x));
|
22 |
int i=0;
|
23 |
for (typename std::vector<T*>::const_iterator it=_scan->begin();it!=_scan->end();++it){
|
24 |
if ( fabs(func( *it)-mass)<diff )
|
25 |
result->SetPoint(i++, x(*it), y(*it));
|
26 |
}
|
27 |
return result;
|
28 |
}
|
29 |
|
30 |
|
31 |
template<class T>
|
32 |
void PlotTools<T>::Area( TH2*h, double(*x)(const T*), double(*y)(const T*),
|
33 |
double(*f)(const T*) )
|
34 |
{
|
35 |
for (typename std::vector<T*>::const_iterator it=_scan->begin();it!=_scan->end();++it){
|
36 |
h->SetBinContent( h->GetXaxis()->FindBin(x(*it)),
|
37 |
h->GetYaxis()->FindBin(y(*it)), f(*it) );
|
38 |
}
|
39 |
}
|
40 |
|
41 |
template<class T>
|
42 |
TGraph * PlotTools<T>::GetContour(TH2*plot, int flag)
|
43 |
{
|
44 |
plot->SetContour(2);
|
45 |
plot->SetContourLevel(0,0);
|
46 |
plot->SetContourLevel(1,0.5);
|
47 |
plot->SetFillColor(1);
|
48 |
plot->Draw("CONT List");
|
49 |
gPad->Update();
|
50 |
TObjArray *contours = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours");
|
51 |
int ncontours = contours->GetSize();
|
52 |
//std::cout << "N contours = " << ncontours << std::endl;
|
53 |
TList *list = (TList*)contours->At(0);
|
54 |
//list->GetSize();
|
55 |
TGraph *gr1 = (TGraph*)list->First();
|
56 |
return gr1;
|
57 |
}
|
58 |
|
59 |
template class PlotTools<SusyScan>;
|
60 |
template class PlotTools<GeneratorMasses>;
|