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

update marker

parent b3cb0f84
No related branches found
No related tags found
No related merge requests found
build build
\ No newline at end of file .vscode/*
\ No newline at end of file
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
"name": "Linux", "name": "Linux",
"includePath": [ "includePath": [
"${workspaceFolder}/**", "${workspaceFolder}/**",
"/home/ming/root/include", "/home/mingf2/root/include",
"/home/ming/root/lib" "/home/mingf2/root/lib"
], ],
"defines": [], "defines": [],
"compilerPath": "/usr/bin/gcc", "compilerPath": "/usr/bin/gcc",
......
...@@ -3,14 +3,18 @@ ...@@ -3,14 +3,18 @@
#include <iostream> #include <iostream>
#include "TCanvas.h" #include "TCanvas.h"
#include "TMath.h"
#include "TH2F.h" #include "TH2F.h"
#include "TGraph.h" #include "TGraph.h"
#include "TStyle.h" #include "TStyle.h"
#include "TEllipse.h" // #include "TEllipse.h"
#include "TMarker.h"
#include "../Headers/setup.h" #include "../Headers/setup.h"
int Backprojection(const Setup& config, const std::vector<Cone>& cones, int Backprojection(const Setup& config, const std::vector<Cone>& cones,
std::vector<std::vector<double>>& image); std::vector<std::vector<double>>& image);
int drawImage(const Setup& config, const std::vector<std::vector<double>>& image); int drawImage(const Setup& config, const std::vector<std::vector<double>>& image);
\ No newline at end of file
int aitoff2xy(const double& l, const double& b, double &Al, double &Ab);
\ No newline at end of file
...@@ -70,7 +70,7 @@ public: ...@@ -70,7 +70,7 @@ public:
int pixelateSphere(); int pixelateSphere();
// simulation setup // simulation setup
const int nCones= 1000; const int nCones= 100;
double trueTheta; double trueTheta;
double truePhi; double truePhi;
Vector3D trueSource; Vector3D trueSource;
......
...@@ -124,13 +124,42 @@ int drawImage(const Setup& config, const std::vector<std::vector<double>>& image ...@@ -124,13 +124,42 @@ int drawImage(const Setup& config, const std::vector<std::vector<double>>& image
// // el1->Draw("SAME"); // // el1->Draw("SAME");
// draw source 2 // draw source 2
double sigma = 5; // double sigma = 5;
TEllipse* el2 = new TEllipse(config.truePhi / conv, config.trueTheta / conv, sigma, sigma); // TEllipse* el2 = new TEllipse(config.truePhi / conv, config.trueTheta / conv, sigma, sigma);
el2->SetFillColor(0); // el2->SetFillColor(0);
el2->SetFillStyle(0); // el2->SetFillStyle(0);
el2->SetLineColor(4); // el2->SetLineColor(4);
el2->Draw("SAME"); // el2->Draw("SAME");
// draw source in aitoff
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");
canvas->Draw(); canvas->Draw();
return 0; return 0;
}
int aitoff2xy(const double& l, const double& b, double &Al, double &Ab)
{
Double_t x, y;
Double_t alpha2 = (l/2)*TMath::DegToRad();
Double_t delta = b*TMath::DegToRad();
Double_t r2 = TMath::Sqrt(2.);
Double_t f = 2*r2/TMath::Pi();
Double_t cdec = TMath::Cos(delta);
Double_t denom = TMath::Sqrt(1. + cdec*TMath::Cos(alpha2));
x = cdec*TMath::Sin(alpha2)*2.*r2/denom;
y = TMath::Sin(delta)*r2/denom;
x *= TMath::RadToDeg()/f;
y *= TMath::RadToDeg()/f;
// x *= -1.; // for a skymap swap left<->right
Al = x;
Ab = y;
return 0;
} }
\ No newline at end of file
...@@ -14,7 +14,8 @@ int main(int argc, char** argv) { ...@@ -14,7 +14,8 @@ int main(int argc, char** argv) {
const Setup config(10); const Setup config(10);
// simulate some cones // simulate some cones
std::vector<Cone> cones; std::vector<Cone> cones;
std::srand(std::time(nullptr)); // std::srand(std::time(nullptr));
std::srand(0);
// for (int i = 0; i < 10; i++) // for (int i = 0; i < 10; i++)
for (int i = 0; i < config.nCones; i++) for (int i = 0; i < config.nCones; i++)
{ {
......
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