3#include "CbmReportElement.h"
4#include "CbmHistManager.h"
5#include "CbmDrawHist.h"
9#include "CbmStsDigitizeParameters.h"
16#include <boost/assign/list_of.hpp>
20using std::stringstream;
22using boost::assign::list_of;
23using Cbm::NumberToString;
25using Cbm::FindAndReplace;
32 SetReportName(
"STSdigitize_qa");
38void CbmStsDigitizeQaReport::Create(){
39 Int_t eLossModel = fDigiPar->GetELossModel();
40 Bool_t lorentz = fDigiPar->GetUseLorentzShift();
41 Bool_t diffusion = fDigiPar->GetUseDiffusion();
42 Bool_t crossTalk = fDigiPar->GetUseCrossTalk();
43 Double_t dynRange = fDigiPar->GetDynRange();
44 Double_t threshold = fDigiPar->GetThreshold();
45 Int_t nAdc = fDigiPar->GetNofAdc();
46 Double_t timeResolution = fDigiPar->GetTimeResolution();
47 Double_t deadTime = fDigiPar->GetDeadTime();
48 Double_t noise = fDigiPar->GetNoise();
49 char eLossModelChar[7];
50 if (eLossModel == 0) sprintf(eLossModelChar,
"ideal");
51 if (eLossModel == 1) sprintf(eLossModelChar,
"uniform");
52 if (eLossModel == 2) sprintf(eLossModelChar,
"non-uniform");
54 Out() << R() -> DocumentBegin();
55 Out() << R() -> Title(0, GetTitle());
56 Out() <<
"Number of events: " << HM() -> H1(
"h_EventNo_DigitizeQa") -> GetEntries() << endl;
58 Out() <<
"Digitizer parameters: " << endl;
59 Out() <<
"\t noise \t\t\t" << noise <<
" e" << endl;
60 Out() <<
"\t threshold \t\t" << threshold <<
" e" << endl;
61 Out() <<
"\t dynamic range \t\t" << dynRange <<
" e" << endl;
62 Out() <<
"\t number of ADC \t\t" << nAdc << endl;
63 Out() <<
"\t time resolution \t" << timeResolution <<
" ns" << endl;
64 Out() <<
"\t dead time \t\t" << deadTime <<
" ns" << endl;
66 Out() <<
"Detector response model takes into account: " << endl;
67 Out() <<
"\t energy loss model: \t" << eLossModelChar << endl;
68 Out() <<
"\t diffusion: \t\t" << (diffusion ?
"On" :
"Off") << endl;
69 Out() <<
"\t Lorentz shift: \t" << (lorentz ?
"On" :
"Off") << endl;
70 Out() <<
"\t cross talk: \t\t" << (crossTalk ?
"On" :
"Off") << endl;
74 Out() << R() -> DocumentEnd();
77void CbmStsDigitizeQaReport::Draw(){
79 DrawNofObjectsHistograms();
82 DrawH1ByPattern(
"h_DigiCharge");
88void CbmStsDigitizeQaReport::DrawNofObjectsHistograms(){
89 string name =
"h_NofObjects_";
90 if ( !HM() -> Exists(name +
"Points") && !HM() -> Exists(name +
"Digis") &&
91 !HM() -> Exists(name +
"Digis_Station") && !HM() -> Exists(name +
"Points_Station"))
return;
92 string canvasName = GetReportName() +
name;
93 TCanvas* canvas = CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
97 vector<string> labels = list_of(
"Points")(
"Digis");
98 vector<TH1*> histos = list_of(HM() -> H1(name +
"Points"))(HM() -> H1(name +
"Digis"));
101 vector<TH1*> histos1 = list_of(HM() -> H1(name +
"Points_Station"))(HM() -> H1(name +
"Digis_Station"));
102 canvasName = GetReportName() +
"h_NofObjects_Station";
103 TCanvas* canvas1 = CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
104 canvas1 -> SetGrid();
109void CbmStsDigitizeQaReport::Draw2dHistograms(){
110 string name =
"h_DigisPerChip_Station";
111 for (Int_t stationId = 0; stationId < fSetup->GetNofStations(); stationId++){
112 if (!HM() -> Exists(Form(
"h_DigisPerChip_Station%i", stationId)) &&
113 !HM() -> Exists(Form(
"h_PointsMap_Station%i", stationId)) &&
114 !HM() -> Exists(Form(
"h_MeanAngleMap_Station%i", stationId)) &&
115 !HM() -> Exists(Form(
"h_RMSAngleMap_Station%i", stationId)) )
return;
117 string canvasName = GetReportName() +
name;
118 TCanvas* canvas = CreateCanvas(canvasName.c_str(), canvasName.c_str(), 2400, 600);
119 canvas -> Divide(4,2);
122 string name1 =
"h_PointsMap_Station";
123 string canvasName1 = GetReportName() + name1;
124 TCanvas* canvas1 = CreateCanvas(canvasName1.c_str(), canvasName1.c_str(), 2400, 600);
125 canvas1 -> Divide(4,2);
126 canvas1 -> SetGrid();
128 string name2 =
"h_MeanAngleMap_Station";
129 string canvasName2 = GetReportName() + name2;
130 TCanvas* canvas2 = CreateCanvas(canvasName2.c_str(), canvasName2.c_str(), 2400, 600);
131 canvas2 -> Divide(4,2);
132 canvas2 -> SetGrid();
134 string name3 =
"h_RMSAngleMap_Station";
135 string canvasName3 = GetReportName() + name3;
136 TCanvas* canvas3 = CreateCanvas(canvasName3.c_str(), canvasName3.c_str(), 2400, 600);
137 canvas3 -> Divide(4,2);
138 canvas3 -> SetGrid();
140 for (Int_t stationId = 0; stationId < fSetup -> GetNofStations(); stationId++){
141 canvas -> cd(stationId + 1);
144 canvas1 -> cd(stationId + 1);
147 canvas2 -> cd(stationId + 1);
150 canvas3 -> cd(stationId + 1);
156void CbmStsDigitizeQaReport::DrawLogHistograms(){
158 if ( !HM() -> Exists(name +
"PointsInDigiLog") && !HM() -> Exists(name +
"DigisByPointLog") )
return;
159 string canvasName = GetReportName() +
name +
"PointsInDigiLog";
160 TCanvas* canvas = CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
164 vector<TH1*> histos = list_of(HM() -> H1(name +
"PointsInDigiLog"));
165 vector<string> labels = list_of(Form(
"Points in digi, \n mean = %.2f", HM() -> H1(name +
"PointsInDigiLog") -> GetMean()));
168 canvasName = GetReportName() +
name +
"DigisByPointLog";
169 vector<TH1*> histos1 = list_of(HM() -> H1(name +
"DigisByPointLog"));
170 vector<string> labels1 = list_of(Form(
"Digis by point, \n mean = %.2f", HM() -> H1(name +
"DigisByPointLog") -> GetMean()));
171 TCanvas* canvas1 = CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
172 canvas1 -> SetGrid();
173 canvas1 -> SetLogy();
178void CbmStsDigitizeQaReport::DrawHistograms(){
180 if ( !HM() -> Exists(name +
"PointsInDigi") && !HM() -> Exists(name +
"DigisByPoint") )
return;
181 string canvasName = GetReportName() +
name +
"PointsInDigi";
182 TCanvas* canvas = CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
185 vector<TH1*> histos = list_of(HM() -> H1(name +
"PointsInDigi"));
186 vector<string> labels = list_of(Form(
"Points in digi, \n mean = %.2f", HM() -> H1(name +
"PointsInDigi") -> GetMean()));
189 canvasName = GetReportName() +
name +
"DigisByPoint";
190 vector<TH1*> histos1 = list_of(HM() -> H1(name +
"DigisByPoint"));
191 vector<string> labels1 = list_of(Form(
"Digis by point, \n mean = %.2f", HM() -> H1(name +
"DigisByPoint") -> GetMean()));
192 TCanvas* canvas1 = CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
193 canvas1 -> SetGrid();
199void CbmStsDigitizeQaReport::ScaleHistograms(){
200 Int_t nofEvents = HM() -> H1(
"h_EventNo_DigitizeQa") -> GetEntries();
201 if ( nofEvents == 0 ) nofEvents = 1;
203 HM() -> ScaleByPattern(
"h_NofObjects_.*_Station_.*", 1. / nofEvents);
204 HM() -> ShrinkEmptyBinsH1ByPattern(
"h_NofObjects_.*_Station_.*");
BmnSsdDigitizeParameters * fDigiPar
Digitisation parameters.
virtual ~CbmStsDigitizeQaReport()
CbmStsDigitizeQaReport(CbmStsSetup *setup, CbmStsDigitizeParameters *digipar)
Class representing the top level of the STS setup.
void DrawH2(TH2 *hist, HistScale logx=kLinear, HistScale logy=kLinear, HistScale logz=kLinear, const string &drawOpt="COLZ")
void DrawH1(TH1 *hist, HistScale logx=kLinear, HistScale logy=kLinear, const string &drawOpt="", Int_t color=BmnDrawingOptions::Color(0), Int_t lineWidth=BmnDrawingOptions::LineWidth(), Int_t lineStyle=BmnDrawingOptions::LineStyle(0), Float_t markerSize=BmnDrawingOptions::MarkerSize(), Int_t markerStyle=BmnDrawingOptions::MarkerStyle(0), Int_t fillColor=-1)