#include <SimTracker/TrackerMaterialAnalysis/plugins/TrackingMaterialPlotter.h>
Public Types | |
typedef std::pair< double, double > | Range |
Public Member Functions | |
void | draw (void) |
void | normalize (void) |
void | plotSegmentInLayer (const MaterialAccountingStep &step, int layer) |
void | plotSegmentUnassigned (const MaterialAccountingStep &step) |
TrackingMaterialPlotter (float maxZ, float maxR, float resolution) | |
Private Member Functions | |
void | fill_color () |
unsigned int | fill_gradient (unsigned int first, unsigned int last, unsigned int steps=100, unsigned int index=0) |
unsigned int | fill_gradient (const TColor &first, const TColor &last, unsigned int steps=100, unsigned int index=0) |
Private Attributes | |
std::vector< int > | m_color |
std::vector< int > | m_gradient |
XHistogram | m_tracker |
Definition at line 16 of file TrackingMaterialPlotter.h.
typedef std::pair<double, double> TrackingMaterialPlotter::Range |
Definition at line 19 of file TrackingMaterialPlotter.h.
TrackingMaterialPlotter::TrackingMaterialPlotter | ( | float | maxZ, | |
float | maxR, | |||
float | resolution | |||
) |
Definition at line 89 of file TrackingMaterialPlotter.cc.
References fill_color(), fill_gradient(), int, m_color, m_tracker, and max.
00090 { 00091 const float rzMinZ = -maxZ; 00092 const float rzMaxZ = maxZ; 00093 const float rzMinR = 0.; 00094 const float rzMaxR = maxR; 00095 const int rzBinsZ = (int) (2. * maxZ * resolution); 00096 const int rzBinsR = (int) ( maxR * resolution); 00097 00098 std::vector<double> max; 00099 max.push_back( 0.02 ); 00100 max.push_back( 0.04 ); 00101 m_tracker = XHistogram( 2, rzBinsZ, rzBinsR, std::make_pair(rzMinZ, rzMaxZ), std::make_pair(rzMinR, rzMaxR), m_color.size(), max); 00102 00103 TColor::InitializeColors(); 00104 fill_color(); 00105 fill_gradient( kWhite, kBlack, 100); // 100-steps gradient from white to black 00106 }
Definition at line 129 of file TrackingMaterialPlotter.cc.
References XHistogram::colormap(), XHistogram::get(), m_color, m_gradient, m_tracker, and scale.
00130 { 00131 const double scale = 10.; 00132 TCanvas* canvas; 00133 00134 XHistogram::Histogram* radlen = m_tracker.get(0); 00135 canvas = new TCanvas("radlen_rz", "RadiationLengths - RZ view", (int) (600 * scale * 1.25), (int) (120 * scale * 1.50)); 00136 gStyle->SetOptStat(0); 00137 gStyle->SetPalette( m_gradient.size(), & m_gradient.front() ); 00138 gStyle->SetNumberContours( m_gradient.size() ); 00139 canvas->GetFrame()->SetFillColor(kWhite); 00140 radlen->Draw("colz"); 00141 radlen->Draw("same axis y+"); 00142 canvas->SaveAs("radlen.png"); 00143 delete canvas; 00144 00145 XHistogram::Histogram* dedx = m_tracker.get(1); 00146 canvas = new TCanvas("dedx_rz", "-dE/dx term - RZ view", (int) (600 * scale * 1.25), (int) (120 * scale * 1.50)); 00147 canvas->GetFrame()->SetFillColor(kWhite); 00148 gStyle->SetOptStat(0); 00149 gStyle->SetPalette( m_gradient.size(), & m_gradient.front() ); 00150 gStyle->SetNumberContours( m_gradient.size() ); 00151 dedx->Draw("colz"); 00152 dedx->Draw("same axis y+"); 00153 canvas->SaveAs("dedx.png"); 00154 delete canvas; 00155 00156 XHistogram::ColorMap* colormap = m_tracker.colormap(); 00157 canvas = new TCanvas("layer_rz", "Layers - RZ view", (int) (600 * scale * 1.25), (int) (120 * scale * 1.50)); 00158 canvas->GetFrame()->SetFillColor(kWhite); 00159 gStyle->SetOptStat(0); 00160 gStyle->SetPalette( m_color.size(), & m_color.front() ); 00161 gStyle->SetNumberContours( m_color.size() ); 00162 colormap->SetMinimum( 1 ); 00163 colormap->SetMaximum( m_color.size() ); 00164 colormap->Draw("col"); 00165 colormap->Draw("same axis y+"); 00166 canvas->SaveAs("layers.png"); 00167 delete canvas; 00168 }
Definition at line 14 of file TrackingMaterialPlotter.cc.
References m_color.
Referenced by TrackingMaterialPlotter().
00015 { 00016 m_color.push_back(kBlack); // unassigned 00017 m_color.push_back(kBlue); // PixelBarrel 00018 m_color.push_back(kBlue + 100); // 00019 m_color.push_back(kBlue); // 00020 m_color.push_back(kGreen); // TIB 00021 m_color.push_back(kGreen + 100); // 00022 m_color.push_back(kGreen); // 00023 m_color.push_back(kGreen + 100); // 00024 m_color.push_back(kRed); // TOB 00025 m_color.push_back(kRed + 100); // 00026 m_color.push_back(kRed); // 00027 m_color.push_back(kRed + 100); // 00028 m_color.push_back(kRed); // 00029 m_color.push_back(kRed + 100); // 00030 m_color.push_back(kBlue); // PixelEndcap Z- 00031 m_color.push_back(kBlue + 100); // 00032 m_color.push_back(kGreen); // TID Z- 00033 m_color.push_back(kGreen + 100); // 00034 m_color.push_back(kGreen); // 00035 m_color.push_back(kRed); // TEC Z- 00036 m_color.push_back(kRed + 100); // 00037 m_color.push_back(kRed); // 00038 m_color.push_back(kRed + 100); // 00039 m_color.push_back(kRed); // 00040 m_color.push_back(kRed + 100); // 00041 m_color.push_back(kRed); // 00042 m_color.push_back(kRed + 100); // 00043 m_color.push_back(kRed); // 00044 m_color.push_back(kBlue); // PixelEndcap Z+ 00045 m_color.push_back(kBlue + 100); // 00046 m_color.push_back(kGreen); // TID Z+ 00047 m_color.push_back(kGreen + 100); // 00048 m_color.push_back(kGreen); // 00049 m_color.push_back(kRed); // TEC Z+ 00050 m_color.push_back(kRed + 100); // 00051 m_color.push_back(kRed); // 00052 m_color.push_back(kRed + 100); // 00053 m_color.push_back(kRed); // 00054 m_color.push_back(kRed + 100); // 00055 m_color.push_back(kRed); // 00056 m_color.push_back(kRed + 100); // 00057 m_color.push_back(kRed); // 00058 }
unsigned int TrackingMaterialPlotter::fill_gradient | ( | unsigned int | first, | |
unsigned int | last, | |||
unsigned int | steps = 100 , |
|||
unsigned int | index = 0 | |||
) | [private] |
Definition at line 84 of file TrackingMaterialPlotter.cc.
References fill_gradient().
00085 { 00086 return fill_gradient(* (TColor *) gROOT->GetListOfColors()->At(first), * (TColor *) gROOT->GetListOfColors()->At(last), steps, index); 00087 }
unsigned int TrackingMaterialPlotter::fill_gradient | ( | const TColor & | first, | |
const TColor & | last, | |||
unsigned int | steps = 100 , |
|||
unsigned int | index = 0 | |||
) | [private] |
Definition at line 61 of file TrackingMaterialPlotter.cc.
References b1, b2, g1, g2, i, m_gradient, r1, and r2.
Referenced by fill_gradient(), and TrackingMaterialPlotter().
00062 { 00063 if (index == 0) { 00064 // if no index was given, find the highest used one and start from that plus one 00065 index = ((TObjArray*) gROOT->GetListOfColors())->GetLast() + 1; 00066 } 00067 00068 float r1, g1, b1, r2, g2, b2; 00069 first.GetRGB(r1, g1, b1); 00070 last.GetRGB(r2, g2, b2); 00071 float delta_r = (r2 - r1) / (steps - 1); 00072 float delta_g = (g2 - g1) / (steps - 1); 00073 float delta_b = (b2 - b1) / (steps - 1); 00074 00075 m_gradient.resize(steps); 00076 for (unsigned int i = 0; i < steps; ++i) { 00077 new TColor(index + i, r1 + delta_r * i, g1 + delta_g * i, b1 + delta_b * i); 00078 m_gradient[i] = index + i; 00079 } 00080 00081 return index; 00082 }
Definition at line 25 of file TrackingMaterialPlotter.h.
References m_tracker, and XHistogram::normalize().
void TrackingMaterialPlotter::plotSegmentInLayer | ( | const MaterialAccountingStep & | step, | |
int | layer | |||
) |
Definition at line 118 of file TrackingMaterialPlotter.cc.
References MaterialAccountingStep::energyLoss(), XHistogram::fill(), MaterialAccountingStep::in(), MaterialAccountingStep::length(), m_tracker, MaterialAccountingStep::out(), PV3DBase< T, PVType, FrameType >::perp(), MaterialAccountingStep::radiationLengths(), w, and PV3DBase< T, PVType, FrameType >::z().
Referenced by TrackingMaterialAnalyser::split().
00119 { 00120 std::vector<double> w(2); 00121 w[0] = step.radiationLengths(); 00122 w[1] = step.energyLoss(); 00123 m_tracker.fill( std::make_pair(step.in().z(), step.out().z()), 00124 std::make_pair(step.in().perp(), step.out().perp()), 00125 w, step.length(), layer+1 ); // layer is 1-based, but plot uses: 0 is empty, 1 is unassigned 00126 }
void TrackingMaterialPlotter::plotSegmentUnassigned | ( | const MaterialAccountingStep & | step | ) |
Definition at line 108 of file TrackingMaterialPlotter.cc.
References MaterialAccountingStep::energyLoss(), XHistogram::fill(), MaterialAccountingStep::in(), MaterialAccountingStep::length(), m_tracker, MaterialAccountingStep::out(), PV3DBase< T, PVType, FrameType >::perp(), MaterialAccountingStep::radiationLengths(), w, and PV3DBase< T, PVType, FrameType >::z().
Referenced by TrackingMaterialAnalyser::split().
00109 { 00110 std::vector<double> w(2); 00111 w[0] = step.radiationLengths(); 00112 w[1] = step.energyLoss(); 00113 m_tracker.fill( std::make_pair(step.in().z(), step.out().z()), 00114 std::make_pair(step.in().perp(), step.out().perp()), 00115 w, step.length(), 1 ); // 0 is empty, 1 is unassigned 00116 }
std::vector<int> TrackingMaterialPlotter::m_color [private] |
Definition at line 34 of file TrackingMaterialPlotter.h.
Referenced by draw(), fill_color(), and TrackingMaterialPlotter().
std::vector<int> TrackingMaterialPlotter::m_gradient [private] |
XHistogram TrackingMaterialPlotter::m_tracker [private] |
Definition at line 32 of file TrackingMaterialPlotter.h.
Referenced by draw(), normalize(), plotSegmentInLayer(), plotSegmentUnassigned(), and TrackingMaterialPlotter().