19 Double_t SawTooth(Double_t x, Double_t WaveLen);
21 TCanvas *ContourList(){
23 const Double_t PI = TMath::Pi();
25 TCanvas* c =
new TCanvas(
"c",
"Contour List",0,0,600,600);
26 c->SetRightMargin(0.15);
27 c->SetTopMargin(0.15);
32 Int_t nPhiSamples = 80;
34 Double_t HofZwavelength = 4.0;
35 Double_t dZ = HofZwavelength/(Double_t)(nZsamples - 1);
36 Double_t dPhi = 2*PI/(Double_t)(nPhiSamples - 1);
39 TArrayD HofZ(nZsamples);
40 TArrayD phi(nPhiSamples);
41 TArrayD FofPhi(nPhiSamples);
44 for ( i = 0; i < nZsamples; i++) {
45 z[i] = (i)*dZ - HofZwavelength/2.0;
46 HofZ[i] = SawTooth(z[i], HofZwavelength);
49 for(Int_t i=0; i < nPhiSamples; i++){
51 FofPhi[i] = sin(phi[i]);
55 TH2D *HistStreamFn =
new TH2D(
"HstreamFn",
56 "#splitline{Histogram with negative and positive contents. Six contours are defined.}{It is plotted with options CONT LIST to retrieve the contours points in TGraphs}",
57 nZsamples, z[0], z[nZsamples-1], nPhiSamples, phi[0], phi[nPhiSamples-1]);
60 for (Int_t i = 0; i < nZsamples; i++) {
61 for(Int_t j = 0; j < nPhiSamples; j++){
62 HistStreamFn->SetBinContent(i,j, HofZ[i]*FofPhi[j]);
66 gStyle->SetOptStat(0);
67 gStyle->SetTitleW(0.99);
68 gStyle->SetTitleH(0.08);
78 HistStreamFn->SetContour(6, contours);
81 HistStreamFn->Draw(
"CONT Z LIST");
85 TObjArray *conts = (TObjArray*)gROOT->GetListOfSpecials()->FindObject(
"contours");
86 TList* contLevel = NULL;
94 printf(
"*** No Contours Were Extracted!\n");
98 TotalConts = conts->GetSize();
101 printf(
"TotalConts = %d\n", TotalConts);
103 for(i = 0; i < TotalConts; i++){
104 contLevel = (TList*)conts->At(i);
105 printf(
"Contour %d has %d Graphs\n", i, contLevel->GetSize());
106 nGraphs += contLevel->GetSize();
111 TCanvas* c1 =
new TCanvas(
"c1",
"Contour List",610,0,600,600);
112 c1->SetTopMargin(0.15);
113 TH2F *hr =
new TH2F(
"hr",
114 "#splitline{Negative contours are returned first (highest to lowest). Positive contours are returned from}{lowest to highest. On this plot Negative contours are drawn in red and positive contours in blue.}",
115 2, -2, 2, 2, 0, 6.5);
118 Double_t xval0, yval0, zval0;
123 for(i = 0; i < TotalConts; i++){
124 contLevel = (TList*)conts->At(i);
125 if (i<3) zval0 = contours[2-i];
126 else zval0 = contours[i];
127 printf(
"Z-Level Passed in as: Z = %f\n", zval0);
130 curv = (TGraph*)contLevel->First();
131 for(j = 0; j < contLevel->GetSize(); j++){
132 curv->GetPoint(0, xval0, yval0);
133 if (zval0<0) curv->SetLineColor(kRed);
134 if (zval0>0) curv->SetLineColor(kBlue);
136 printf(
"\tGraph: %d -- %d Elements\n", nGraphs,curv->GetN());
140 gc = (TGraph*)curv->Clone();
143 sprintf(val,
"%g",zval0);
144 l.DrawLatex(xval0,yval0,val);
145 curv = (TGraph*)contLevel->After(curv);
149 printf(
"\n\n\tExtracted %d Contours and %d Graphs \n", TotalConts, nGraphs );
150 gStyle->SetTitleW(0.);
151 gStyle->SetTitleH(0.);
156 Double_t SawTooth(Double_t x, Double_t WaveLen){
175 if ( (x < -WaveLen/2) || (x > WaveLen/2)) y = -99999999;
176 if (x <= -WaveLen/4) {
178 }
else if ((x > -WaveLen/4) && (x <= WaveLen/4)) {
180 }
else if (( x > WaveLen/4) && (x <= WaveLen/2)) {