CbmRoot
CbmStsDigitizeQaReport.cxx
Go to the documentation of this file.
2 
3 #include "CbmDrawHist.h"
4 #include "CbmHistManager.h"
5 #include "CbmReportElement.h"
6 #include "CbmStsModule.h"
7 #include "CbmStsParAsic.h"
8 #include "CbmStsParSim.h"
9 #include "CbmStsSetup.h"
10 #include "CbmUtils.h"
11 
12 #include "TCanvas.h"
13 #include "TF1.h"
14 #include "TH1.h"
15 #include "TProfile.h"
16 #include "TStyle.h"
17 #include <boost/assign/list_of.hpp>
18 
19 using boost::assign::list_of;
22 using Cbm::Split;
23 using std::endl;
24 using std::string;
25 using std::stringstream;
26 using std::vector;
27 
29  const CbmStsParSim* settings,
30  const CbmStsParAsic* asicPar)
32  , fSetup(setup)
33  , fSettings(settings)
34  , fAsicPar(asicPar) {
35  SetReportName("STSdigitize_qa");
36 }
37 
39 
41  CbmStsELoss eLossModel = fSettings->ELossModel();
42  Bool_t lorentz = fSettings->LorentzShift();
43  Bool_t diffusion = fSettings->Diffusion();
44  Bool_t crossTalk = fSettings->CrossTalk();
45  Double_t dynRange = fAsicPar->GetDynRange();
46  Double_t threshold = fAsicPar->GetThreshold();
47  Int_t nAdc = fAsicPar->GetNofAdc();
48  Double_t timeResolution = fAsicPar->GetTimeResol();
49  Double_t deadTime = fAsicPar->GetDeadTime();
50  Double_t noise = fAsicPar->GetNoise();
51  char eLossModelChar[15];
52  if (eLossModel == CbmStsELoss::kIdeal) sprintf(eLossModelChar, "ideal");
53  if (eLossModel == CbmStsELoss::kUniform) sprintf(eLossModelChar, "uniform");
54  if (eLossModel == CbmStsELoss::kUrban) sprintf(eLossModelChar, "non-uniform");
55  Out().precision(1);
56  Out() << R()->DocumentBegin();
57  Out() << R()->Title(0, GetTitle());
58  Out() << "Number of events: "
59  << HM()->H1("h_EventNo_DigitizeQa")->GetEntries() << endl;
60  Out() << endl;
61  Out() << "Digitizer parameters: " << endl;
62  Out() << "\t noise \t\t\t" << noise << " e" << endl;
63  Out() << "\t threshold \t\t" << threshold << " e" << endl;
64  Out() << "\t dynamic range \t\t" << dynRange << " e" << endl;
65  Out() << "\t number of ADC \t\t" << nAdc << endl;
66  Out() << "\t time resolution \t" << timeResolution << " ns" << endl;
67  Out() << "\t dead time \t\t" << deadTime << " ns" << endl;
68  Out() << endl;
69  Out() << "Detector response model takes into account: " << endl;
70  Out() << "\t energy loss model: \t" << eLossModelChar << endl;
71  Out() << "\t diffusion: \t\t" << (diffusion ? "On" : "Off") << endl;
72  Out() << "\t Lorentz shift: \t" << (lorentz ? "On" : "Off") << endl;
73  Out() << "\t cross talk: \t\t" << (crossTalk ? "On" : "Off") << endl;
74 
75  PrintCanvases();
76 
77  Out() << R()->DocumentEnd();
78 }
79 
85  DrawH1ByPattern("h_DigiCharge");
86  /*DrawH1ByPattern("h_DigisByPoint");
87  DrawH1ByPattern("h_PointsInDigi");*/
89 }
90 
92  string name = "h_NofObjects_";
93  if (!HM()->Exists(name + "Points") && !HM()->Exists(name + "Digis")
94  && !HM()->Exists(name + "Digis_Station")
95  && !HM()->Exists(name + "Points_Station"))
96  return;
97  string canvasName = GetReportName() + name;
98  TCanvas* canvas =
99  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
100  canvas->SetGrid();
101  canvas->SetLogy();
102  canvas->cd();
103  vector<string> labels = list_of("Points")("Digis");
104  vector<TH1*> histos =
105  list_of(HM()->H1(name + "Points"))(HM()->H1(name + "Digis"));
106  DrawH1(histos, labels, kLinear, kLinear, true, 0.5, 0.55, 0.9, 0.75);
107 
108  vector<TH1*> histos1 = list_of(HM()->H1(name + "Points_Station"))(
109  HM()->H1(name + "Digis_Station"));
110  canvasName = GetReportName() + "h_NofObjects_Station";
111  TCanvas* canvas1 =
112  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
113  canvas1->SetGrid();
114  canvas1->cd();
115  DrawH1(histos1, labels, kLinear, kLinear, true, 0.5, 0.55, 0.9, 0.75);
116 }
117 
119  string name = "h_DigisPerChip_Station";
120  for (Int_t stationId = 0; stationId < fSetup->GetNofStations(); stationId++) {
121  if (!HM()->Exists(Form("h_DigisPerChip_Station%i", stationId))
122  && !HM()->Exists(Form("h_PointsMap_Station%i", stationId))
123  && !HM()->Exists(Form("h_MeanAngleMap_Station%i", stationId))
124  && !HM()->Exists(Form("h_RMSAngleMap_Station%i", stationId)))
125  return;
126  }
127  string canvasName = GetReportName() + name;
128  TCanvas* canvas =
129  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 2400, 600);
130  canvas->Divide(4, 2);
131  canvas->SetGrid();
132 
133  string name1 = "h_PointsMap_Station";
134  string canvasName1 = GetReportName() + name1;
135  TCanvas* canvas1 =
136  CreateCanvas(canvasName1.c_str(), canvasName1.c_str(), 2400, 600);
137  canvas1->Divide(4, 2);
138  canvas1->SetGrid();
139 
140  string name2 = "h_MeanAngleMap_Station";
141  string canvasName2 = GetReportName() + name2;
142  TCanvas* canvas2 =
143  CreateCanvas(canvasName2.c_str(), canvasName2.c_str(), 2400, 600);
144  canvas2->Divide(4, 2);
145  canvas2->SetGrid();
146 
147  string name3 = "h_RMSAngleMap_Station";
148  string canvasName3 = GetReportName() + name3;
149  TCanvas* canvas3 =
150  CreateCanvas(canvasName3.c_str(), canvasName3.c_str(), 2400, 600);
151  canvas3->Divide(4, 2);
152  canvas3->SetGrid();
153 
154  for (Int_t stationId = 0; stationId < fSetup->GetNofStations(); stationId++) {
155  canvas->cd(stationId + 1);
156  DrawH2(HM()->H2(Form("%s%i", name.c_str(), stationId)),
157  kLinear,
158  kLinear,
159  kLinear);
160 
161  canvas1->cd(stationId + 1);
162  DrawH2(HM()->H2(Form("%s%i", name1.c_str(), stationId)),
163  kLinear,
164  kLinear,
165  kLinear);
166 
167  canvas2->cd(stationId + 1);
168  DrawH2(HM()->H2(Form("%s%i", name2.c_str(), stationId)),
169  kLinear,
170  kLinear,
171  kLinear);
172 
173  canvas3->cd(stationId + 1);
174  DrawH2(HM()->H2(Form("%s%i", name3.c_str(), stationId)),
175  kLinear,
176  kLinear,
177  kLinear);
178  }
179 }
180 
181 
183  string name = "h_";
184  if (!HM()->Exists(name + "PointsInDigiLog")
185  && !HM()->Exists(name + "DigisByPointLog"))
186  return;
187  string canvasName = GetReportName() + name + "PointsInDigiLog";
188  TCanvas* canvas =
189  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
190  canvas->SetGrid();
191  canvas->SetLogy();
192  canvas->cd();
193  vector<TH1*> histos = list_of(HM()->H1(name + "PointsInDigiLog"));
194  vector<string> labels =
195  list_of(Form("Points in digi, \n mean = %.2f",
196  HM()->H1(name + "PointsInDigiLog")->GetMean()));
197  DrawH1(histos, labels, kLinear, kLinear, true, 0.5, 0.55, 0.9, 0.65);
198 
199  canvasName = GetReportName() + name + "DigisByPointLog";
200  vector<TH1*> histos1 = list_of(HM()->H1(name + "DigisByPointLog"));
201  vector<string> labels1 =
202  list_of(Form("Digis by point, \n mean = %.2f",
203  HM()->H1(name + "DigisByPointLog")->GetMean()));
204  TCanvas* canvas1 =
205  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
206  canvas1->SetGrid();
207  canvas1->SetLogy();
208  canvas1->cd();
209  DrawH1(histos1, labels1, kLinear, kLinear, true, 0.5, 0.55, 0.9, 0.65);
210 }
211 
213  string name = "h_";
214  if (!HM()->Exists(name + "PointsInDigi")
215  && !HM()->Exists(name + "DigisByPoint"))
216  return;
217  string canvasName = GetReportName() + name + "PointsInDigi";
218  TCanvas* canvas =
219  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
220  canvas->SetGrid();
221  canvas->cd();
222  vector<TH1*> histos = list_of(HM()->H1(name + "PointsInDigi"));
223  vector<string> labels =
224  list_of(Form("Points in digi, \n mean = %.2f",
225  HM()->H1(name + "PointsInDigi")->GetMean()));
226  DrawH1(histos, labels, kLinear, kLinear, true, 0.5, 0.55, 0.9, 0.65);
227 
228  canvasName = GetReportName() + name + "DigisByPoint";
229  vector<TH1*> histos1 = list_of(HM()->H1(name + "DigisByPoint"));
230  vector<string> labels1 =
231  list_of(Form("Digis by point, \n mean = %.2f",
232  HM()->H1(name + "DigisByPoint")->GetMean()));
233  TCanvas* canvas1 =
234  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
235  canvas1->SetGrid();
236  canvas1->cd();
237  DrawH1(histos1, labels1, kLinear, kLinear, true, 0.5, 0.55, 0.9, 0.65);
238 }
239 
240 
242  Int_t nofEvents = HM()->H1("h_EventNo_DigitizeQa")->GetEntries();
243  if (nofEvents == 0) nofEvents = 1;
244 
245  HM()->ScaleByPattern("h_NofObjects_.*_Station_.*", 1. / nofEvents);
246  HM()->ShrinkEmptyBinsH1ByPattern("h_NofObjects_.*_Station_.*");
247 }
248 
CbmReport::CreateCanvas
TCanvas * CreateCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
Create canvas and put it to vector of TCanvases. Canvases created with this function will be automati...
Definition: CbmReport.cxx:82
CbmStsDigitizeQaReport::DrawNofObjectsHistograms
void DrawNofObjectsHistograms()
Definition: CbmStsDigitizeQaReport.cxx:91
CbmStsParAsic::GetNoise
Double_t GetNoise() const
Electronic noise RMS.
Definition: CbmStsParAsic.h:109
CbmStsParAsic::GetThreshold
Double_t GetThreshold() const
ADC Threshold.
Definition: CbmStsParAsic.h:131
CbmStsDigitizeQaReport::DrawHistograms
void DrawHistograms()
Definition: CbmStsDigitizeQaReport.cxx:212
CbmStsDigitizeQaReport::fAsicPar
const CbmStsParAsic * fAsicPar
Definition: CbmStsDigitizeQaReport.h:22
CbmHistManager::ScaleByPattern
void ScaleByPattern(const std::string &pattern, Double_t scale)
Scale histograms which name matches specified pattern.
Definition: core/base/CbmHistManager.cxx:221
CbmStsSetup.h
CbmSimulationReport::H2
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
Definition: CbmSimulationReport.h:80
CbmStsELoss::kUrban
@ kUrban
CbmReportElement::DocumentBegin
virtual std::string DocumentBegin() const =0
Return string with open tags for document.
Cbm::FindAndReplace
string FindAndReplace(const string &name, const string &oldSubstr, const string &newSubstr)
Definition: CbmUtils.cxx:45
CbmHistManager::ShrinkEmptyBinsH1ByPattern
void ShrinkEmptyBinsH1ByPattern(const std::string &pattern)
Shrink empty bins in H1.
Definition: core/base/CbmHistManager.cxx:174
CbmReportElement::DocumentEnd
virtual std::string DocumentEnd() const =0
Return string with close tags of the document.
CbmReport::GetReportName
const std::string & GetReportName() const
Definition: CbmReport.h:64
CbmReport::R
const CbmReportElement * R() const
Accessor to CbmReportElement object. User has to write the report using available tags from CbmReport...
Definition: CbmReport.h:51
CbmDrawHist.h
Helper functions for drawing 1D and 2D histograms and graphs.
CbmStsParAsic::GetNofAdc
UShort_t GetNofAdc() const
Number of ADC channels.
Definition: CbmStsParAsic.h:103
CbmStsParSim::ELossModel
CbmStsELoss ELossModel() const
Energy loss model.
Definition: CbmStsParSim.h:57
CbmReportElement.h
Abstract class for basic report elements (headers, tables, images etc.).
CbmHistManager.h
Histogram manager.
CbmStsSetup::GetNofStations
Int_t GetNofStations() const
Definition: CbmStsSetup.h:90
CbmReport::SetReportName
void SetReportName(const std::string &name)
Definition: CbmReport.h:59
CbmStsParSim.h
CbmStsDigitizeQaReport.h
DrawH1
void DrawH1(TH1 *hist, HistScale logx, HistScale logy, const string &drawOpt, Int_t color, Int_t lineWidth, Int_t lineStyle, Int_t markerSize, Int_t markerStyle)
Definition: CbmDrawHist.cxx:49
CbmReport::PrintCanvases
void PrintCanvases() const
Print images created from canvases in the report.
Definition: CbmReport.cxx:109
CbmStsDigitizeQaReport
Definition: CbmStsDigitizeQaReport.h:11
CbmStsELoss
CbmStsELoss
Energy loss model used in simulation.
Definition: CbmStsDefs.h:43
CbmStsParAsic
Parameters of the STS readout ASIC.
Definition: CbmStsParAsic.h:25
kLinear
@ kLinear
Definition: CbmDrawHist.h:79
CbmStsDigitizeQaReport::~CbmStsDigitizeQaReport
virtual ~CbmStsDigitizeQaReport()
Definition: CbmStsDigitizeQaReport.cxx:38
CbmSimulationReport::H1
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Definition: CbmSimulationReport.h:73
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmStsDigitizeQaReport::Draw
virtual void Draw()
Pure abstract function which is called from public Create() function. This function has to draw all n...
Definition: CbmStsDigitizeQaReport.cxx:80
CbmHistManager::H1
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Definition: CbmHistManager.h:170
CbmStsDigitizeQaReport::fSettings
const CbmStsParSim * fSettings
Definition: CbmStsDigitizeQaReport.h:21
CbmStsSetup
Class representing the top level of the STS setup.
Definition: CbmStsSetup.h:39
CbmSimulationReport::DrawH1ByPattern
void DrawH1ByPattern(const std::string &histNamePattern)
Select by pattern TH1 histograms and draw each histogram on separate canvas.
CbmStsDigitizeQaReport::fSetup
CbmStsSetup * fSetup
Definition: CbmStsDigitizeQaReport.h:20
CbmUtils.h
CbmStsParSim::CrossTalk
Bool_t CrossTalk() const
Check whether cross-talk is applied.
Definition: CbmStsParSim.h:45
CbmStsDigitizeQaReport::CbmStsDigitizeQaReport
CbmStsDigitizeQaReport(CbmStsSetup *setup, const CbmStsParSim *settings, const CbmStsParAsic *asicPar)
Definition: CbmStsDigitizeQaReport.cxx:28
CbmStsParSim::LorentzShift
Bool_t LorentzShift() const
Check whether Lorentz shift is applied.
Definition: CbmStsParSim.h:76
CbmStsParAsic::GetDynRange
Double_t GetDynRange() const
Dynamic range of ADC.
Definition: CbmStsParAsic.h:97
CbmStsParSim
Settings for STS simulation (digitizer)
Definition: CbmStsParSim.h:25
CbmSimulationReport::HM
CbmHistManager * HM() const
Return pointer to Histogram manager.
Definition: CbmSimulationReport.h:92
CbmStsDigitizeQaReport::ScaleHistograms
void ScaleHistograms()
Definition: CbmStsDigitizeQaReport.cxx:241
CbmSimulationReport
Base class for simulation reports.
Definition: CbmSimulationReport.h:28
CbmReport::Out
std::ostream & Out() const
All text output goes to this stream.
Definition: CbmReport.h:56
DrawH2
void DrawH2(TH2 *hist, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
Definition: CbmDrawHist.cxx:84
CbmStsELoss::kIdeal
@ kIdeal
CbmStsDigitizeQaReport::DrawLogHistograms
void DrawLogHistograms()
Definition: CbmStsDigitizeQaReport.cxx:182
CbmStsParSim::Diffusion
Bool_t Diffusion() const
Check whether diffusion is applied.
Definition: CbmStsParSim.h:51
CbmStsDigitizeQaReport::Create
virtual void Create()
Inherited from CbmReport. Pure abstract function which is called from public Create() function.
Definition: CbmStsDigitizeQaReport.cxx:40
CbmStsDigitizeQaReport::Draw2dHistograms
void Draw2dHistograms()
Definition: CbmStsDigitizeQaReport.cxx:118
CbmStsParAsic::GetDeadTime
Double_t GetDeadTime() const
Single-channel dead time.
Definition: CbmStsParAsic.h:91
CbmReportElement::Title
virtual std::string Title(int size, const std::string &title) const =0
Return string with title.
CbmStsModule.h
Cbm::NumberToString
std::string NumberToString(const T &value, int precision=1)
Definition: CbmUtils.h:23
Cbm::Split
vector< string > Split(const string &name, char delimiter)
Definition: CbmUtils.cxx:54
CbmStsParAsic.h
CbmStsELoss::kUniform
@ kUniform
CbmStsParAsic::GetTimeResol
Double_t GetTimeResol() const
Time resolution.
Definition: CbmStsParAsic.h:137