diff --git a/.gitignore b/.gitignore index c795b054e5ade51b7031abab1581a5b7e2d2f5ba..b68c22374878336d26638cab74325ea1f8a49665 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -build \ No newline at end of file +build +.vscode/* \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index fa67db65a4e01f1df7d0fed706ca76b0419ab0cf..4a3ed5d1fc58f151be123195aa1b3da79524ab93 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -4,8 +4,8 @@ "name": "Linux", "includePath": [ "${workspaceFolder}/**", - "/home/ming/root/include", - "/home/ming/root/lib" + "/home/mingf2/root/include", + "/home/mingf2/root/lib" ], "defines": [], "compilerPath": "/usr/bin/gcc", diff --git a/Headers/draw.h b/Headers/draw.h index f464978a27442fa921c82117b2ab9bf0c8895eb2..829290cf343335cb269a3684c85f408e3422ac37 100644 --- a/Headers/draw.h +++ b/Headers/draw.h @@ -3,14 +3,18 @@ #include <iostream> #include "TCanvas.h" +#include "TMath.h" #include "TH2F.h" #include "TGraph.h" #include "TStyle.h" -#include "TEllipse.h" +// #include "TEllipse.h" +#include "TMarker.h" #include "../Headers/setup.h" int Backprojection(const Setup& config, const std::vector<Cone>& cones, 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 drawImage(const Setup& config, const std::vector<std::vector<double>>& image); + +int aitoff2xy(const double& l, const double& b, double &Al, double &Ab); \ No newline at end of file diff --git a/Headers/setup.h b/Headers/setup.h index b8081a1c709c3d93d98485c4936c98c8548e959d..62fa497c651eb868e06805218a041498716e94c1 100644 --- a/Headers/setup.h +++ b/Headers/setup.h @@ -70,7 +70,7 @@ public: int pixelateSphere(); // simulation setup - const int nCones= 1000; + const int nCones= 100; double trueTheta; double truePhi; Vector3D trueSource; diff --git a/Sources/draw.cpp b/Sources/draw.cpp index 97fe26577bfed9779f023e1373957dc5ff2b226d..4fd033b5c8baebaf1e85ea9da67972c8f731a203 100644 --- a/Sources/draw.cpp +++ b/Sources/draw.cpp @@ -124,13 +124,42 @@ int drawImage(const Setup& config, const std::vector<std::vector<double>>& image // // 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"); + // 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 + 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(); 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 diff --git a/Sources/main.cpp b/Sources/main.cpp index 34cde31d722f778ac1134faead365920912f3fe6..e0f3b8033b565ec086ef85164c3a1846d4e362b4 100644 --- a/Sources/main.cpp +++ b/Sources/main.cpp @@ -14,7 +14,8 @@ int main(int argc, char** argv) { const Setup config(10); // simulate some 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 < config.nCones; i++) {