TkN 2.1
Toolkit for Nuclei
draw_xrays.C
1#include "Rtypes.h"
2#include "TROOT.h"
3#include "TGraph.h"
4#include "TCanvas.h"
5#include "TAxis.h"
6#include "TMultiGraph.h"
7
8#include "tkmanager.h"
9
10using namespace tkn;
11
12void draw_xrays()
13{
14 gROOT->SetStyle("tkn-histo");
15
16 auto *canvas = new TCanvas();
17
18 vector<tkstring> xrays_names {"Kalpha1","Kalpha2","Kbeta1" ,"Lalpha1","Lalpha2" ,"Lbeta1" ,"Lbeta2" ,"Lgamma1" ,"Malpha1"};
19 vector<int> xrays_colors{ kAzure , kAzure-2, kAzure-4, kViolet , kViolet-2, kViolet-4, kViolet-6, kViolet-8, kRed };
20 vector<int> xrays_style { 20 , 21 , 22 , 20 , 21 , 22 , 23 , 29 , 20 };
21
22 map<tkstring,TGraph*> xrays_graphs;
23
24 TMultiGraph *multigraph = new TMultiGraph("draw_xrays","draw_xrays");
25 multigraph->GetXaxis()->SetTitle("Charge");
26 multigraph->GetYaxis()->SetTitle("X-Ray energy (keV)");
27 for(size_t i=0 ; i<xrays_names.size() ; i++) {
28 TGraph *g = new TGraph;
29 g->SetNameTitle(xrays_names.at(i).data(),xrays_names.at(i).data());
30 g->SetMarkerStyle(xrays_style.at(i));
31 g->SetMarkerSize(1);
32 g->SetMarkerColor(xrays_colors.at(i));
33 g->GetXaxis()->SetTitle("Charge");
34 g->GetYaxis()->SetTitle("X-Ray energy (keV)");
35 xrays_graphs[xrays_names.at(i)] = g;
36 multigraph->Add(g,"lp");
37 }
38
39 for(const auto &znucs : gmanager->get_map_of_nuclei_per_z()) {
40 tknucleus nuc(znucs.first);
41 auto xrays = nuc.get_xrays();
42 for(const auto &xray: xrays) {
43 TGraph *g = xrays_graphs[xray->get_type().copy().remove_all("XRay_")];
44 g->AddPoint(nuc.get_z(),xray->get_value());
45 }
46 }
47
48 multigraph->Draw("apl");
49
50 canvas->BuildLegend(0.20903,0.477895,0.419732,0.932632,"","p");
51 canvas->SaveAs("draw_xrays.png");
52}
A nucleus made of Z protons and N neutrons.
Definition: tknucleus.h:54
Definition: tklog.cpp:39