Skip to content
Snippets Groups Projects
Commit e529054a authored by mingf2's avatar mingf2
Browse files

fix marker position

parent 4868b6f3
No related branches found
No related tags found
No related merge requests found
......@@ -7,8 +7,7 @@
#include "TH2F.h"
#include "TGraph.h"
#include "TStyle.h"
// #include "TEllipse.h"
#include "TMarker.h"
#include "TEllipse.h"
#include "../Headers/setup.h"
......@@ -17,4 +16,5 @@ int Backprojection(const Setup& config, const std::vector<Cone>& cones,
int drawImage(const Setup& config, const std::vector<std::vector<double>>& image);
// convert cartesian to worldmap coordinates
int aitoff2xy(const double& l, const double& b, double &Al, double &Ab);
\ No newline at end of file
......@@ -56,11 +56,11 @@ public:
// image setup
// Altitude angle, rad
const int thetaBins = 179;
const int thetaBins = 180;
const int phiBins = 360;
const double dtheta = 179 / double(thetaBins) * M_PI / 180;
const double thetaMin = -89 * M_PI / 180;
const double thetaMax = 89 * M_PI / 180;
const double dtheta = 180 / double(thetaBins) * M_PI / 180;
const double thetaMin = -90 * M_PI / 180 + dtheta / 2;
const double thetaMax = 90 * M_PI / 180 - dtheta / 2;
// Azimuthal angle, rad
const double dphi = 2 * M_PI /double(phiBins);
const double phiMin = -M_PI + dphi / 2;
......
......@@ -46,13 +46,13 @@ int Backprojection(const Setup& config, const std::vector<Cone>& cones,
int drawImage(const Setup& config, const std::vector<std::vector<double>>& image){
TH2D *histo = new TH2D("ROI", " ; Azimuth; Elevation",
config.phiBins, -180, 180,
config.thetaBins, -89.5, 89.5);
config.thetaBins, -90, 90);
TCanvas *canvas = new TCanvas("THCanvas","Sinocanvas", 1000, 500);
for (int i = 1; i <= config.phiBins; i++)
for (int i = 0; i < config.phiBins; i++)
{
for (int j = 1; j < config.thetaBins; j++)
for (int j = 0; j < config.thetaBins; j++)
{
histo->SetBinContent(i, j, image[j][i]);
histo->SetBinContent(i+1, j+1, image[j][i]);
}
}
gStyle->SetOptStat(0);
......@@ -60,7 +60,7 @@ int drawImage(const Setup& config, const std::vector<std::vector<double>>& image
histo->Draw("z aitoff");
// grid
float conv=M_PI/180; // I am also aware of TMath::DegToRad() and TMath::Pi() which could be used there...
float conv=M_PI/180;
float la, lo, x, y, z;
const int Nl = 19; // Number of drawn latitudes
......@@ -116,27 +116,16 @@ int drawImage(const Setup& config, const std::vector<std::vector<double>>& image
for (int j=0;j<NL;++j) longitudes[j]->Draw("l");
// // // canvas1->cd(4)->SetLogz();
// // // draw source 1
// // TEllipse* el1 = new TEllipse(86.5276, 0, 5., 5.);
// // el1->SetFillColor(0);
// // el1->SetFillStyle(0);
// // el1->SetLineColor(4);
// // el1->Draw("SAME");
// draw source 2
// double sigma = 5;
// TEllipse* el2 = new TEllipse(config.truePhi / conv, config.trueTheta / conv, sigma, sigma);
// el2->SetFillColor(0);
// el2->SetFillStyle(0);
// el2->SetLineColor(4);
// el2->Draw("SAME");
// draw source in aitoff
// draw source marker
double sigma = 1;
double Ax, Ay;
aitoff2xy(config.truePhi / conv, config.trueTheta / conv, Ax, Ay);
TMarker *marker = new TMarker(Ax, Ay, 24);
// marker->SetMarkerColorAlpha(kBlue, 0.0);
marker->Draw("SAME");
TEllipse* el2 = new TEllipse(Ax, Ay, sigma, sigma);
el2->SetFillColor(0);
el2->SetFillStyle(0);
el2->SetLineWidth(2);
el2->SetLineColor(kRed);
el2->Draw("SAME");
canvas->Draw();
......
......@@ -14,9 +14,7 @@ int main(int argc, char** argv) {
const Setup config(10);
// simulate some cones
std::vector<Cone> cones;
// std::srand(std::time(nullptr));
std::srand(0);
// for (int i = 0; i < 10; i++)
std::srand(std::time(nullptr));
for (int i = 0; i < config.nCones; i++)
{
cones.push_back(createCone(config));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment