BmnRoot
Loading...
Searching...
No Matches
BmnDstQa.cxx
Go to the documentation of this file.
1#include "BmnDstQa.h"
2
4: fSteering(new BmnOfflineQaSteering()),
5 fHistoManager(new BmnQaHistoManager()),
6 fDetGem(nullptr),
7 fDetCsc(nullptr),
8 fDetSilicon(nullptr)
9{
10 fSteering->SetGeometriesByRunId(id, fDetGem, fDetSilicon, fDetCsc);
11
12 pair <Int_t, TString> periodSetup = fSteering->GetRunAndSetupByRunId(id);
13 prefix = TString::Format("RUN%d_SETUP_%s_", periodSetup.first, periodSetup.second.Data());
14
15 Hits();
16 Tracks();
17 Matching();
18 PID();
19}
20
21void BmnDstQa::Hits() {
22 HitsDistributions();
23 OccupancyHistos();
24 AverageStripValuePerHit();
25}
26
27void BmnDstQa::Tracks() {
28 BasicTrackDistributions();
29 ResidualsPullsHistos();
30 AverageStripValuePerTrack();
31}
32
33void BmnDstQa::Matching() {
34 MatchingHistos();
35 EfficiencyHistos();
36}
37
38void BmnDstQa::PID() {
39
40
41}
42
43void BmnDstQa::BasicTrackDistributions() {
44 const Int_t nDets = 2;
45 TString detNames[nDets] = {"GEM", "SILICON"};
46 for (Int_t iDet = 0; iDet < nDets; iDet++)
47 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Distribution of Nhits, %s track", prefix.Data(), detNames[iDet].Data()), Form("DST, Distribution of Nhits, %s track", detNames[iDet].Data()), 100, 0., 0.);
48
49 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Distribution of total multiplicity", prefix.Data()),
50 Form("DST, Distribution of total multiplicity"), 100, 0., 0.);
51 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Distribution of momenta", prefix.Data()),
52 Form("DST, Distribution of momenta"), 200, -20., +20.);
53 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Distribution of Nhits", prefix.Data()),
54 Form("DST, Distribution of Nhits"), 100, 0., 0.);
55
56 fHistoManager->Create2 <TH2F> (Form("%sDST_2d, Vp_{z} vs. Ntracks", prefix.Data()), Form("DST_2d, Vp_{z} vs. Ntracks"), 20, 0, 20, 200, -10., +10.);
57
58 const Int_t nDims = 3;
59 TString dim[nDims] = {"X", "Y", "Z"};
60 for (Int_t iDim = 0; iDim < nDims; iDim++) {
61 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Distribution of start%s", prefix.Data(), dim[iDim].Data()), Form("DST, Distribution of start%s", dim[iDim].Data()), 100, 0., 0.);
62 if (!dim[iDim].Contains("Z"))
63 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Distribution of start T%s", prefix.Data(), dim[iDim].Data()), Form("DST, Distribution of start T%s", dim[iDim].Data()), 100, 0., 0.);
64 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Distribution of last%s", prefix.Data(), dim[iDim].Data()), Form("DST, Distribution of last%s", dim[iDim].Data()), 100, 0., 0.);
65 if (!dim[iDim].Contains("Z"))
66 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Distribution of last T%s", prefix.Data(), dim[iDim].Data()), Form("DST, Distribution of last T%s", dim[iDim].Data()), 100, 0., 0.);
67 }
68}
69
70void BmnDstQa::HitsDistributions() {
71 const Int_t nDets = 6;
72 TString detNames[nDets] = {"GEM", "SILICON", "CSC", "TOF400", "TOF700", "DCH"};
73
74 // Common distributions of X, Y and Z-coordinates ...
75 for (Int_t iDet = 0; iDet < nDets; iDet++) {
76 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, %s, Distribution of X", prefix.Data(), detNames[iDet].Data()),
77 Form("%s, Distribution of X", detNames[iDet].Data()), 100, 0., 0.);
78 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, %s, Distribution of Y", prefix.Data(), detNames[iDet].Data()),
79 Form("%s, Distribution of Y", detNames[iDet].Data()), 100, 0., 0.);
80 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, %s, Distribution of Z", prefix.Data(), detNames[iDet].Data()),
81 Form("%s, Distribution of Z", detNames[iDet].Data()), 100, 0., 0.);
82 }
83
84 // Common distributions of X and Y-errors ...
85 for (Int_t iDet = 0; iDet < nDets; iDet++) {
86 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, %s, Distribution of dX", prefix.Data(), detNames[iDet].Data()),
87 Form("%s, Distribution of dX", detNames[iDet].Data()), 100, 0., 0.);
88 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, %s, Distribution of dY", prefix.Data(), detNames[iDet].Data()),
89 Form("%s, Distribution of dY", detNames[iDet].Data()), 100, 0., 0.);
90 }
91
92 // Common distributions of cluster sizes and signals ...
93 for (Int_t iDet = 0; iDet < nDets; iDet++) {
94 if (iDet > 2)
95 break;
96
97 // sizes ...
98 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, %s, Distribution of X cluster size", prefix.Data(), detNames[iDet].Data()),
99 Form("%s, Distribution of X cluster size", detNames[iDet].Data()), 16, 0., 16.);
100 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, %s, Distribution of X' cluster size", prefix.Data(), detNames[iDet].Data()),
101 Form("%s, Distribution of X' cluster size", detNames[iDet].Data()), 16, 0., 16.);
102
103 // signals ...
104 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, %s, Distribution of X cluster signals", prefix.Data(), detNames[iDet].Data()),
105 Form("%s, Distribution of X cluster size", detNames[iDet].Data()), 100, 0., 0.);
106 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, %s, Distribution of X' cluster signals", prefix.Data(), detNames[iDet].Data()),
107 Form("%s, Distribution of X' cluster size", detNames[iDet].Data()), 100, 0., 0.);
108 }
109}
110
111void BmnDstQa::MatchingHistos() {
112 const Int_t nBins = 20;
113 const Int_t nBinsXY = 50;
114
115 const Int_t nDets = 4;
116 TString dets[nDets] = {"CSC", "DCH1", "TOF700", "DCH2"};
117
118 for (Int_t iDet = 0; iDet < nDets; iDet++) {
119 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, hAllNo%s", prefix.Data(), dets[iDet].Data()),
120 Form("%s, matchingMomWithout; Rigidity [GeV/(Qc)]; N", dets[iDet].Data()), nBins, 0., 15.);
121 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, hAllYes%s", prefix.Data(), dets[iDet].Data()),
122 Form("%s, matchingMomWith; Rigidity [GeV/(Qc)]; N", dets[iDet].Data()), nBins, 0., 15.);
123
124 fHistoManager->Create2 <TH2F> (Form("%sDST_2d, hAllNo%sXY", prefix.Data(), dets[iDet].Data()),
125 Form("%s, matchingEffWithout; X [cm]; Y [cm]", dets[iDet].Data()), nBinsXY, -20, 100, nBinsXY, -60, 60);
126 fHistoManager->Create2 <TH2F> (Form("%sDST_2d, hAllYes%sXY", prefix.Data(), dets[iDet].Data()),
127 Form("%s, matchingEffWith; X [cm]; Y [cm]", dets[iDet].Data()), nBinsXY, -20, 100, nBinsXY, -60, 60);
128 }
129}
130
131void BmnDstQa::EfficiencyHistos() {
132 const Int_t nBins = 20;
133 const Int_t nBinsXY = 50;
134 const Int_t nDets = 4;
135 TString dets[nDets] = {"CSC", "DCH1", "TOF700", "DCH2"};
136
137 for (Int_t iDet = 0; iDet < nDets; iDet++) {
138 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, hEff%s", prefix.Data(), dets[iDet].Data()),
139 Form("%s, Efficiency of matching; Rigidity [GeV/(Qc)]; Efficiency", dets[iDet].Data()), nBins, 0., 15.);
140
141 fHistoManager->Create2 <TH2F> (Form("%sDST_2d, hEff%sXY", prefix.Data(), dets[iDet].Data()),
142 Form("%s, Efficiency of matching; X [cm]; Y [cm]", dets[iDet].Data()), nBinsXY, -20, 100, nBinsXY, -60, 60);
143 }
144}
145
146void BmnDstQa::ResidualsPullsHistos() {
147 const Int_t nDets = 8;
148 TString dets[nDets] = {"MWPC", "SILICON", "GEM", "CSC", "TOF400", "DCH1", "TOF700", "DCH2"};
149
150 const Double_t resBoard = 7;
151
152 for (Int_t iDet = 0; iDet < nDets; iDet++) {
153 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, hResX%s", prefix.Data(), dets[iDet].Data()),
154 Form("%s, Residuals X; X Residual [cm]; N", dets[iDet].Data()), 100, -resBoard, resBoard);
155 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, hResY%s", prefix.Data(), dets[iDet].Data()),
156 Form("%s, Residuals Y; Y Residual [cm]; N", dets[iDet].Data()), 100, -resBoard, resBoard);
157
158 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, hPullX%s", prefix.Data(), dets[iDet].Data()),
159 Form("%s Pulls X; X Pull [cm]; N", dets[iDet].Data()), 100, -resBoard, resBoard);
160 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, hPullY%s", prefix.Data(), dets[iDet].Data()),
161 Form("%s, Pulls Y; Y Pull [cm]; N", dets[iDet].Data()), 100, -resBoard, resBoard);
162 }
163}
164
165void BmnDstQa::OccupancyHistos() {
166 const Int_t nDets = 5;
167 TString dets[nDets] = {"SILICON", "GEM", "CSC", "TOF400", "TOF700"};
168
169 for (Int_t iDet = 0; iDet < nDets; iDet++) {
170 if (dets[iDet].Contains("GEM"))
171 for (Int_t iStat = 0; iStat < fDetGem->GetNStations(); iStat++) {
172 Double_t xUp = -fDetGem->GetStation(iStat)->GetXMinStation();
173 Double_t xLow = -fDetGem->GetStation(iStat)->GetXMaxStation();
174 Double_t yLow = fDetGem->GetStation(iStat)->GetYMinStation();
175 Double_t yUp = fDetGem->GetStation(iStat)->GetYMaxStation();
176
177 fHistoManager->Create2 <TH2D> (Form("%sDST_2d, hOccupancy%s, stat %d", prefix.Data(), dets[iDet].Data(), iStat),
178 Form("Occupancy %s, stat %d; X [cm]; Y [cm]", dets[iDet].Data(), iStat), Int_t(xUp - xLow), xLow, xUp, Int_t(yUp - yLow), yLow, yUp);
179 } else if (dets[iDet].Contains("SILICON"))
180 for (Int_t iStat = 0; iStat < fDetSilicon->GetNStations(); iStat++) {
181 Double_t xUp = -fDetSilicon->GetStation(iStat)->GetXMinStation();
182 Double_t xLow = -fDetSilicon->GetStation(iStat)->GetXMaxStation();
183 Double_t yLow = fDetSilicon->GetStation(iStat)->GetYMinStation();
184 Double_t yUp = fDetSilicon->GetStation(iStat)->GetYMaxStation();
185
186 fHistoManager->Create2 <TH2D> (Form("%sDST_2d, hOccupancy%s, stat %d", prefix.Data(), dets[iDet].Data(), iStat),
187 Form("Occupancy %s, stat %d; X [cm]; Y [cm]", dets[iDet].Data(), iStat), 3 * Int_t(xUp - xLow), xLow, xUp, 3 * Int_t(yUp - yLow), yLow, yUp);
188 } else if (dets[iDet].Contains("CSC") && fDetCsc)
189 for (Int_t iStat = 0; iStat < fDetCsc->GetNStations(); iStat++) {
190 Double_t xUp = -fDetCsc->GetStation(iStat)->GetXMinStation();
191 Double_t xLow = -fDetCsc->GetStation(iStat)->GetXMaxStation();
192 Double_t yLow = fDetCsc->GetStation(iStat)->GetYMinStation();
193 Double_t yUp = fDetCsc->GetStation(iStat)->GetYMaxStation();
194
195 fHistoManager->Create2 <TH2D> (Form("%sDST_2d, hOccupancy%s, stat %d", prefix.Data(), dets[iDet].Data(), iStat),
196 Form("Occupancy %s, stat %d; X [cm]; Y [cm]", dets[iDet].Data(), iStat), Int_t(xUp - xLow), xLow, xUp, Int_t(yUp - yLow), yLow, yUp);
197 } else
198 fHistoManager->Create2 <TH2F> (Form("%sDST_2d, hOccupancy%s", prefix.Data(), dets[iDet].Data()),
199 Form("Occupancy %s; X [cm]; Y [cm]", dets[iDet].Data()), 100, 0., 0., 100, 0., 0.);
200 }
201}
202
203void BmnDstQa::AverageStripValuePerHit() {
204 const Int_t nLayers = 2; // X and X'
205 TString layers[nLayers] = {"X", "X'"};
206
207 for (Int_t iLayer = 0; iLayer < nLayers; iLayer++) {
208 for (Int_t iStat = 0; iStat < fDetGem->GetNStations(); iStat++)
209 fHistoManager->Create1 <TH1I> (Form("%sDST_1d, Ave. strip value per hit in %s (%s)", prefix.Data(), "GEM", layers[iLayer].Data()),
210 Form("%s, Ave. strip value per hit (%s); N_{strips}; N", "GEM", layers[iLayer].Data()), 20, 0., 20.);
211
212 for (Int_t iStat = 0; iStat < fDetSilicon->GetNStations(); iStat++)
213 fHistoManager->Create1 <TH1I> (Form("%sDST_1d, Ave. strip value per hit in %s (%s)", prefix.Data(), "SILICON", layers[iLayer].Data()),
214 Form("%s, Ave. strip value per hit (%s); N_{strips}; N", "SILICON", layers[iLayer].Data()), 20, 0., 20.);
215
216 if (fDetCsc)
217 for (Int_t iStat = 0; iStat < fDetCsc->GetNStations(); iStat++)
218 fHistoManager->Create1 <TH1I> (Form("%sDST_1d, Ave. strip value per hit in %s (%s)", prefix.Data(), "CSC", layers[iLayer].Data()),
219 Form("%s, Ave. strip value per hit (%s); N_{strips}; N", "CSC", layers[iLayer].Data()), 20, 0., 20.);
220 }
221}
222
223void BmnDstQa::AverageStripValuePerTrack() {
224 const Int_t nLayers = 2; // X and X'
225 TString layers[nLayers] = {"X", "X'"};
226
227 for (Int_t iLayer = 0; iLayer < nLayers; iLayer++) {
228 for (Int_t iStat = 0; iStat < fDetGem->GetNStations(); iStat++)
229 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Ave. strip value per track in %s (%s)", prefix.Data(), "GEM", layers[iLayer].Data()),
230 Form("%s, Ave. strip value per track (%s); N_{strips}; N", "GEM", layers[iLayer].Data()), 20, 0., 20.);
231
232 for (Int_t iStat = 0; iStat < fDetSilicon->GetNStations(); iStat++)
233 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Ave. strip value per track in %s (%s)", prefix.Data(), "SILICON", layers[iLayer].Data()),
234 Form("%s, Ave. strip value per track (%s); N_{strips}; N", "SILICON", layers[iLayer].Data()), 20, 0., 20.);
235
236 if (fDetCsc)
237 for (Int_t iStat = 0; iStat < fDetCsc->GetNStations(); iStat++)
238 fHistoManager->Create1 <TH1F> (Form("%sDST_1d, Ave. strip value per track in %s (%s)", prefix.Data(), "CSC", layers[iLayer].Data()),
239 Form("%s, Ave. strip value per track (%s); N_{strips}; N", "CSC", layers[iLayer].Data()), 20, 0., 20.);
240 }
241}
242
BmnCSCStation * GetStation(Int_t station_num)
Double_t GetXMinStation()
Double_t GetYMaxStation()
Double_t GetXMaxStation()
Double_t GetYMinStation()
BmnDstQa()
Definition BmnDstQa.h:17
BmnGemStripStation * GetStation(Int_t station_num)
void Create2(const TString &name, const TString &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY)
Helper function for creation of 2-dimensional histograms and profiles. Template argument is a real ob...
void Create1(const TString &name, const TString &title, Int_t nofBins, Double_t minBin, Double_t maxBin)
Helper function for creation of 1-dimensional histograms and profiles. Template argument is a real ob...
void SetGeometriesByRunId(Int_t id, BmnGemStripStationSet *&gem, BmnSiliconStationSet *&silicon, BmnCSCStationSet *&csc)
pair< Int_t, TString > GetRunAndSetupByRunId(Int_t id)
BmnSiliconStation * GetStation(Int_t station_num)
const UInt_t dim