91 for (Int_t stationId = 0; stationId < fNofStation; stationId++){
95 fHM -> Create1<TH1F>(Form(
"h_sts_MultPoints_Station%i",stationId),
96 Form(
"Mult, Station %i;Objects per event;Entries", stationId),
99 fHM -> Create2<TH2F>(Form(
"h_sts_PointsMap_Station%i",stationId),
100 Form(
"StsPoint, Station %i;x, cm;y, cm", stationId),
101 200, -10., 10., 200, -10., 10.);
102 fHM -> Create2<TH2F>(Form(
"h_sts_PointsMap_NoOverlap_Station%i",stationId),
103 Form(
"StsPoint, Station %i;x, cm;y, cm", stationId),
104 200, -10., 10., 200, -10., 10.);
106 fHM -> Create2<TH2F>(Form(
"h_sts_PointsMapEvent_Station%i",stationId),
107 Form(
"StsPoint/cm^{2}, Station %i;x, cm;y, cm", stationId),
108 200, -10., 10., 200, -10., 10.);
109 fHM -> Create2<TH2F>(Form(
"h_sts_PointsMapEvent_NoOverlap_Station%i",stationId),
110 Form(
"StsPoint/cm^{2}, Station %i;x, cm;y, cm", stationId),
111 200, -10., 10., 200, -10., 10.);
113 fHM -> Create2<TH2F>(Form(
"h_sts_PointsMapRate_Station%i",stationId),
114 Form(
"StsPoint/cm^{2}/s, Station %i;x, cm;y, cm", stationId),
115 200, -10., 10., 200, -10., 10.);
116 fHM -> Create2<TH2F>(Form(
"h_sts_PointsMapRate_NoOverlap_Station%i",stationId),
117 Form(
"StsPoint/cm^{2}/s, Station %i;x, cm;y, cm", stationId),
118 200, -10., 10., 200, -10., 10.);
119 fHM -> Create1<TH1F>(Form(
"h_sts_XPos_Station%i",stationId),
"X position;x, cm; Entries", 200, -10., 10.);
120 fHM -> Create1<TH1F>(Form(
"h_sts_YPos_Station%i",stationId),
"Y position;y, cm; Entries", 200, -10., 10.);
124 fHM -> Create1<TH1F>(
"h_sts_XMom",
"momentum px; GeV/c; Entries", 100, -5., 5.);
125 fHM -> Create1<TH1F>(
"h_sts_YMom",
"momentum py; GeV/c; Entries", 100, -5., 5.);
126 fHM -> Create1<TH1F>(
"h_sts_ZMom",
"momentum pz; GeV/c; Entries", 500, -10., 40.);
127 fHM -> Create1<TH1F>(
"h_sts_ELoss",
"energy loss; ; Entries", 100, 0., 0.02);
129 fHM -> Create1<TH1F>(
"h_sts_XPos",
"X position;x, cm; Entries", 200, -10., 10.);
130 fHM -> Create1<TH1F>(
"h_sts_YPos",
"Y position;y, cm; Entries", 200, -10., 10.);
141 fHM -> H1(
"h_sts_NofObjects_Points") -> Fill(points -> GetEntriesFast());
150 std::map<Int_t, vector<Int_t>> used_map = { {0, {}}, {1, {}} };
152 for(Int_t iPoint = 0; iPoint < points -> GetEntriesFast(); iPoint++) {
154 Int_t stationId = fSetup->GetStationNumber(stsPoint->GetDetectorID());
155 fHM -> H1(
"h_sts_NofObjects_Points_Station") -> Fill(stationId);
157 pointX = stsPoint -> GetXIn();
158 pointY = stsPoint -> GetYIn();
160 pX = stsPoint -> GetPx();
161 pY = stsPoint -> GetPy();
162 pZ = stsPoint -> GetPz();
164 fHM -> H1(Form(
"h_sts_XPos_Station%i", stationId)) -> Fill(pointX);
165 fHM -> H1(Form(
"h_sts_YPos_Station%i", stationId)) -> Fill(pointY);
167 fHM -> H2(Form(
"h_sts_PointsMap_Station%i", stationId)) -> Fill(pointX, pointY);
168 fHM -> H2(Form(
"h_sts_PointsMapEvent_Station%i", stationId)) -> Fill(pointX, pointY);
169 fHM -> H2(Form(
"h_sts_PointsMapRate_Station%i", stationId)) -> Fill(pointX, pointY);
170 fHM -> H1(
"h_sts_XPos") -> Fill(pointX);
171 fHM -> H1(
"h_sts_YPos") -> Fill(pointY);
172 fHM -> H1(
"h_sts_XMom") -> Fill(pX);
173 fHM -> H1(
"h_sts_YMom") -> Fill(pY);
174 fHM -> H1(
"h_sts_ZMom") -> Fill(pZ);
175 fHM -> H1(
"h_sts_ELoss") -> Fill(stsPoint -> GetEnergyLoss());
177 Int_t mcTrackID = stsPoint -> GetTrackID();
179 if (std::find(used_map[stationId].begin(), used_map[stationId].end(), mcTrackID) == used_map[stationId].end()) {
180 used_map[stationId].push_back(mcTrackID);
181 fHM -> H2(Form(
"h_sts_PointsMap_NoOverlap_Station%i", stationId)) -> Fill(pointX, pointY);
182 fHM -> H2(Form(
"h_sts_PointsMapEvent_NoOverlap_Station%i", stationId)) -> Fill(pointX, pointY);
183 fHM -> H2(Form(
"h_sts_PointsMapRate_NoOverlap_Station%i", stationId)) -> Fill(pointX, pointY);
186 fHM -> H1(Form(
"h_sts_MultPoints_Station%i",0)) -> Fill(used_map[0].size());
187 fHM -> H1(Form(
"h_sts_MultPoints_Station%i",1)) -> Fill(used_map[1].size());
193 Int_t nofEvents = fHM -> H1(
"h_sts_EventNo_MCQa") -> GetEntries();
197 Int_t xbins = (fHM->H2(
"h_sts_PointsMap_Station0"))->GetXaxis()->GetNbins();
198 Float_t xmax = fHM -> H2(
"h_sts_PointsMapEvent_Station0") -> GetXaxis()->GetXmax();
199 Float_t xmin = fHM -> H2(
"h_sts_PointsMapEvent_Station0") -> GetXaxis()->GetXmin();
200 Float_t scaleX =
static_cast<Float_t
>(xbins)/(xmax - xmin);
202 LOG(info) <<
"scaleX: " << scaleX;
204 Int_t ybins = fHM -> H2(
"h_sts_PointsMapEvent_Station0") -> GetYaxis()->GetNbins();
205 Int_t ymax = fHM -> H2(
"h_sts_PointsMapEvent_Station0") -> GetYaxis()->GetXmax();
206 Int_t ymin = fHM -> H2(
"h_sts_PointsMapEvent_Station0") -> GetYaxis()->GetXmin();
207 Float_t scaleY =
static_cast<Float_t
>(ybins)/(ymax - ymin);
209 LOG(info) <<
"scaleY: " << scaleY;
211 Float_t scale = scaleX * scaleY;
214 LOG(info) <<
"Scale factor to cm^2: " << scale;
216 for(Int_t
i=0;
i<fNofStation; ++
i) {
217 fHM -> Scale(Form(
"h_sts_PointsMapEvent_Station%i",
i),scale/nofEvents);
218 fHM -> Scale(Form(
"h_sts_PointsMapEvent_NoOverlap_Station%i",
i),scale/nofEvents);
219 fHM -> Scale(Form(
"h_sts_PointsMapRate_Station%i",
i),10000000.*scale/nofEvents);
220 fHM -> Scale(Form(
"h_sts_PointsMapRate_NoOverlap_Station%i",
i),10000000*scale/nofEvents);
223 gDirectory -> mkdir(
"QA/StsMCQa");
224 gDirectory -> cd(
"QA/StsMCQa");
225 fHM -> WriteToFile();
226 gDirectory -> cd(
"../..");