9 #include "FairLogger.h"
10 #include "FairRootManager.h"
12 #include "TClonesArray.h"
18 #include "TProfile2D.h"
40 LOG(info) <<
"Trd Setup consist of " <<
fNofStation <<
" stations.";
48 FairRootManager* ioman = FairRootManager::Instance();
49 if (NULL == ioman) LOG(fatal) <<
"No FairRootManager!";
51 fTrdPoints =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"TrdPoint"));
52 if (NULL ==
fTrdPoints) LOG(error) <<
"No TrdPoint array!";
54 fMCTracks =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"MCTrack"));
55 if (NULL ==
fMCTracks) LOG(error) <<
"No MCTrack array!";
61 fHM->
Create1<TH1F>(
"h_trd_EventNo_MCQa",
"h_trd_EventNo_MCQa", 1, 0, 1.);
69 string name =
"h_trd_NofObjects_";
71 name +
"Points;Objects per event;Entries",
80 name +
"Points_Station;Station number;Objects per event",
87 for (Int_t stationId = 0; stationId <
fNofStation; stationId++) {
92 Form(
"h_trd_MultPoints_Station%i", stationId),
93 Form(
"Mult, Station %i;Objects per event;Entries", stationId),
98 fHM->
Create2<TH2F>(Form(
"h_trd_PointsMap_Station%i", stationId),
99 Form(
"TrdPoint, Station %i;x, cm;y, cm", stationId),
107 Form(
"h_trd_PointsMapEvent_Station%i", stationId),
108 Form(
"TrdPoint/cm^{2}, Station %i;x, cm;y, cm", stationId),
116 Form(
"h_trd_PointsMapRate_Station%i", stationId),
117 Form(
"TrdPoint/cm^{2}/s, Station %i;x, cm;y, cm", stationId),
124 fHM->
Create1<TH1F>(Form(
"h_trd_XPos_Station%i", stationId),
125 "X position;x, cm; Entries",
129 fHM->
Create1<TH1F>(Form(
"h_trd_YPos_Station%i", stationId),
130 "Y position;y, cm; Entries",
136 "h_trd_XPos",
"X position;x, cm; Entries", 1200, -60., 60.);
138 "h_trd_YPos",
"Y position;y, cm; Entries", 1200, -60., 60.);
143 fHM->
H1(
"h_trd_EventNo_MCQa")->Fill(0.5);
148 fHM->
H1(
"h_trd_NofObjects_Points")->Fill(
points->GetEntriesFast());
150 Double_t pointX = 0.;
151 Double_t pointY = 0.;
154 std::map<Int_t, vector<Int_t>> used_map;
156 for (Int_t iPoint = 0; iPoint <
points->GetEntriesFast(); iPoint++) {
161 fHM->
H1(
"h_trd_NofObjects_Points_Station")->Fill(stationId);
163 pointX = trdPoint->
GetXIn();
164 pointY = trdPoint->
GetYIn();
167 fHM->
H1(Form(
"h_trd_XPos_Station%i", stationId))->Fill(pointX);
168 fHM->
H1(Form(
"h_trd_YPos_Station%i", stationId))->Fill(pointY);
170 fHM->
H2(Form(
"h_trd_PointsMap_Station%i", stationId))->Fill(pointX, pointY);
171 fHM->
H2(Form(
"h_trd_PointsMapEvent_Station%i", stationId))
172 ->Fill(pointX, pointY);
173 fHM->
H2(Form(
"h_trd_PointsMapRate_Station%i", stationId))
174 ->Fill(pointX, pointY);
175 fHM->
H1(
"h_trd_XPos")->Fill(pointX);
176 fHM->
H1(
"h_trd_YPos")->Fill(pointY);
178 Int_t mcTrackID = trdPoint->GetTrackID();
181 used_map[stationId].begin(), used_map[stationId].end(), mcTrackID)
182 == used_map[stationId].end()) {
183 used_map[stationId].push_back(mcTrackID);
186 fHM->
H1(Form(
"h_trd_MultPoints_Station%i", 0))->Fill(used_map[0].size());
187 fHM->
H1(Form(
"h_trd_MultPoints_Station%i", 1))->Fill(used_map[1].size());
188 fHM->
H1(Form(
"h_trd_MultPoints_Station%i", 2))->Fill(used_map[2].size());
189 fHM->
H1(Form(
"h_trd_MultPoints_Station%i", 3))->Fill(used_map[3].size());
194 Int_t nofEvents =
fHM->
H1(
"h_trd_EventNo_MCQa")->GetEntries();
197 Int_t xbins = (
fHM->
H2(
"h_trd_PointsMap_Station0"))->GetXaxis()->GetNbins();
198 Float_t xmax =
fHM->
H2(
"h_trd_PointsMap_Station0")->GetXaxis()->GetXmax();
199 Float_t xmin =
fHM->
H2(
"h_trd_PointsMap_Station0")->GetXaxis()->GetXmin();
200 Float_t scaleX =
static_cast<Float_t
>(xbins) / (xmax - xmin);
202 Int_t ybins =
fHM->
H2(
"h_trd_PointsMap_Station0")->GetYaxis()->GetNbins();
203 Int_t ymax =
fHM->
H2(
"h_trd_PointsMap_Station0")->GetYaxis()->GetXmax();
204 Int_t ymin =
fHM->
H2(
"h_trd_PointsMap_Station0")->GetYaxis()->GetXmin();
205 Float_t scaleY =
static_cast<Float_t
>(ybins) / (ymax - ymin);
207 Float_t scale = scaleX * scaleY;
211 fHM->
Scale(Form(
"h_trd_PointsMapEvent_Station%i",
i), scale / nofEvents);
212 fHM->
Scale(Form(
"h_trd_PointsMapRate_Station%i",
i),
213 10000000. * scale / nofEvents);
216 gDirectory->mkdir(
"QA/TrdMCQa");
217 gDirectory->cd(
"QA/TrdMCQa");
219 gDirectory->cd(
"../..");