63 TDirectory* oldDir = gDirectory;
74 m_BoolEvtMonitor =
new TH1D(
"BoolEvtMonitor",
"Event synchronization", 2, -0.5, 1.5);
82 m_window_vs_slot =
new TH2F(
"window_vs_slot",
"Asic windows", 16, 0.5, 16.5, 512, 0, 512);
91 m_eventT0 =
new TH1F(
"eventT0",
"Event T0; event T0 [ns]; events per bin", nbinsT0, -rangeT0 / 2, rangeT0 / 2);
98 m_time =
new TH1F(
"goodHitTimes",
"Time distribution of good hits", 1000, -20, 80);
99 m_time->SetXTitle(
"time [ns]");
100 m_time->SetYTitle(
"hits per bin");
102 m_timeBG =
new TH1F(
"goodHitTimesBG",
"Time distribution of good hits (background)", 1000, -20, 80);
104 m_timeBG->SetYTitle(
"hits per bin");
106 m_signalHits =
new TProfile(
"signalHits",
"Number of good hits per track in [0, 50] ns", 16, 0.5, 16.5, 0, 1000);
112 m_backgroundHits =
new TProfile(
"backgroundHits",
"Number of good hits pet track in [-50, 0] ns", 16, 0.5, 16.5, 0, 1000);
118 m_trackHits =
new TH2F(
"trackHits",
"Number of events w/ and w/o track in the slot", 16, 0.5, 16.5, 2, 0, 2);
122 int nbinsHits = 1000;
123 double xmaxHits = 10000;
124 m_goodHitsPerEventAll =
new TH1F(
"goodHitsPerEventAll",
"Number of good hits per event", nbinsHits, 0, xmaxHits);
128 m_badHitsPerEventAll =
new TH1F(
"badHitsPerEventAll",
"Number of junk hits per event", nbinsHits, 0, xmaxHits);
133 double xminTDC = -100;
134 double xmaxTDC = 700;
135 m_goodTDCAll =
new TH1F(
"goodTDCAll",
"Raw time distribution of good hits", nbinsTDC, xminTDC, xmaxTDC);
139 m_badTDCAll =
new TH1F(
"badTDCAll",
"Raw time distribution of junk hits", nbinsTDC, xminTDC, xmaxTDC);
143 m_TOPOccAfterInjLER =
new TH1F(
"TOPOccInjLER",
"TOPOccInjLER/Time;Time in #mus;Nhits/Time (#mus bins)", 4000, 0, 20000);
144 m_TOPOccAfterInjHER =
new TH1F(
"TOPOccInjHER",
"TOPOccInjHER/Time;Time in #mus;Nhits/Time (#mus bins)", 4000, 0, 20000);
145 m_TOPEOccAfterInjLER =
new TH1F(
"TOPEOccInjLER",
"TOPEOccInjLER/Time;Time in #mus;Triggers/Time (#mus bins)", 4000, 0, 20000);
146 m_TOPEOccAfterInjHER =
new TH1F(
"TOPEOccInjHER",
"TOPEOccInjHER/Time;Time in #mus;Triggers/Time (#mus bins)", 4000, 0, 20000);
149 "LER: average Nhits; "
150 "time since injection [msec]; time within beam cycle [syst. clk]; Nhits average",
151 160, 0, 80, 256, 0, 1280, 0, 100000);
153 "HER: average Nhits; "
154 "time since injection [msec]; time within beam cycle [syst. clk]; Nhits average",
155 160, 0, 80, 256, 0, 1280, 0, 100000);
157 "LER: average Nhits (Nhits>1000); "
158 "time since injection [msec]; time within beam cycle [syst. clk]; Nhits average",
159 160, 0, 80, 256, 0, 1280, 0, 100000);
161 "HER: average Nhits (Nhits>1000); "
162 "time since injection [msec]; time within beam cycle [syst. clk]; Nhits average",
163 160, 0, 80, 256, 0, 1280, 0, 100000);
165 "LER: event distribution; "
166 "time since injection [msec]; time within beam cycle [syst. clk]; events per bin",
167 160, 0, 80, 256, 0, 1280);
169 "HER: event distribution; "
170 "time since injection [msec]; time within beam cycle [syst. clk]; events per bin",
171 160, 0, 80, 256, 0, 1280);
173 "LER: event distribution (Nhits>1000); "
174 "time since injection [msec]; time within beam cycle [syst. clk]; events per bin",
175 160, 0, 80, 256, 0, 1280);
177 "HER: event distribution (Nhits>1000); "
178 "time since injection [msec]; time within beam cycle [syst. clk]; events per bin",
179 160, 0, 80, 256, 0, 1280);
187 name = str(format(
"window_vs_asic_%1%") % (module));
188 title = str(format(
"Asic windows for slot #%1%") % (module));
189 h2 =
new TH2F(name.c_str(), title.c_str(), 64, 0, 64, 512, 0, 512);
190 h2->SetStats(kFALSE);
191 h2->SetXTitle(
"ASIC number");
192 h2->SetYTitle(
"window number w.r.t reference window");
196 name = str(format(
"good_hits_xy_%1%") % (module));
197 title = str(format(
"Distribution of good hits for slot #%1%") % (module));
198 h2 =
new TH2F(name.c_str(), title.c_str(), 64, 0.5, 64.5, 8, 0.5, 8.5);
199 h2->SetStats(kFALSE);
200 h2->GetXaxis()->SetTitle(
"pixel column");
201 h2->GetYaxis()->SetTitle(
"pixel row");
205 name = str(format(
"bad_hits_xy_%1%") % (module));
206 title = str(format(
"Distribution of junk hits for slot #%1%") % (module));
207 h2 =
new TH2F(name.c_str(), title.c_str(), 64, 0.5, 64.5, 8, 0.5, 8.5);
208 h2->SetStats(kFALSE);
209 h2->GetXaxis()->SetTitle(
"pixel column");
210 h2->GetYaxis()->SetTitle(
"pixel row");
214 name = str(format(
"good_hits_asics_%1%") % (module));
215 title = str(format(
"Distribution of good hits for slot #%1%") % (module));
216 h2 =
new TH2F(name.c_str(), title.c_str(), 64, 0, 64, 8, 0, 8);
217 h2->SetStats(kFALSE);
218 h2->GetXaxis()->SetTitle(
"ASIC number");
219 h2->GetYaxis()->SetTitle(
"ASIC channel");
223 name = str(format(
"bad_hits_asics_%1%") % (module));
224 title = str(format(
"Distribution of junk hits for slot #%1%") % (module));
225 h2 =
new TH2F(name.c_str(), title.c_str(), 64, 0, 64, 8, 0, 8);
226 h2->SetStats(kFALSE);
227 h2->GetXaxis()->SetTitle(
"ASIC number");
228 h2->GetYaxis()->SetTitle(
"ASIC channel");
232 name = str(format(
"good_TDC_%1%") % (module));
233 title = str(format(
"Raw time distribution of good hits for slot #%1%") % (module));
234 h1 =
new TH1F(name.c_str(), title.c_str(), nbinsTDC, xminTDC, xmaxTDC);
235 h1->GetXaxis()->SetTitle(
"raw time [samples]");
236 h1->GetYaxis()->SetTitle(
"hits per sample");
239 name = str(format(
"bad_TDC_%1%") % (module));
240 title = str(format(
"Raw time distribution of junk hits for slot #%1%") % (module));
241 h1 =
new TH1F(name.c_str(), title.c_str(), nbinsTDC, xminTDC, xmaxTDC);
242 h1->GetXaxis()->SetTitle(
"raw time [samples]");
243 h1->GetYaxis()->SetTitle(
"hits per sample");
246 name = str(format(
"good_timing_%1%") % (module));
247 title = str(format(
"Time distribution of good hits for slot #%1%") % (module));
248 h1 =
new TH1F(name.c_str(), title.c_str(), 200, -20, 80);
249 h1->GetXaxis()->SetTitle(
"time [ns]");
250 h1->GetYaxis()->SetTitle(
"hits per time bin");
253 name = str(format(
"good_timing_%1%BG") % (module));
254 title = str(format(
"Time distribution of good hits (background) for slot #%1%") % (module));
255 h1 =
new TH1F(name.c_str(), title.c_str(), 200, -20, 80);
256 h1->GetXaxis()->SetTitle(
"time [ns]");
257 h1->GetYaxis()->SetTitle(
"hits per time bin");
260 name = str(format(
"good_channel_hits_%1%") % (module));
261 title = str(format(
"Distribution of good hits for slot #%1%") % (module));
262 int numPixels = geo->getModule(i + 1).getPMTArray().getNumPixels();
263 h1 =
new TH1F(name.c_str(), title.c_str(), numPixels, 0, numPixels);
264 h1->GetXaxis()->SetTitle(
"channel number");
265 h1->GetYaxis()->SetTitle(
"hits per channel");
269 name = str(format(
"bad_channel_hits_%1%") % (module));
270 title = str(format(
"Distribution of junk hits for slot #%1%") % (module));
271 h1 =
new TH1F(name.c_str(), title.c_str(), numPixels, 0, numPixels);
272 h1->GetXaxis()->SetTitle(
"channel number");
273 h1->GetYaxis()->SetTitle(
"hits per channel");
277 name = str(format(
"pulseHeights_%1%") % (module));
278 title = str(format(
"Average pulse heights for slot #%1%") % (module));
279 auto* prof =
new TProfile(name.c_str(), title.c_str(), 32, 0.5, 32.5, 0, 2000);
280 prof->GetXaxis()->SetTitle(
"PMT number");
281 prof->GetYaxis()->SetTitle(
"pulse height [ADC counts]");
282 prof->SetMarkerStyle(20);
356 bool recBunchValid =
false;
357 bool cosmics =
false;
359 recBunchValid =
m_recBunch->isReconstructed();
369 double offset =
m_recBunch->getCurrentOffset() - t0;
378 for (
const auto& digit :
m_digits) {
379 int x = digit.getFirstWindow() !=
m_digits[0]->getFirstWindow() ? 1 : 0 ;
388 for (
const auto& track :
m_tracks) {
389 const auto* fitResult = track.getTrackFitResultWithClosestMass(
Const::pion);
390 if (not fitResult)
continue;
392 if (slot == 0)
continue;
393 numTracks[slot - 1]++;
394 trackMomenta[slot - 1] = std::max(trackMomenta[slot - 1], fitResult->getMomentum().R());
399 if (recBunchValid or cosmics) {
400 for (
size_t i = 0; i < numTracks.size(); i++) {
401 bool hit = numTracks[i] > 0;
409 for (
size_t i = 0; i < selectedSlots.size(); i++) {
410 selectedSlots[i] = (recBunchValid or cosmics) and numTracks[i] == 1 and trackMomenta[i] >
m_momentumCut;
422 for (
const auto& digit :
m_digits) {
423 int slot = digit.getModuleID();
425 B2ERROR(
"Invalid slot ID found in TOPDigits: ID = " << slot);
428 int asic_no = digit.getChannel() / 8;
429 int asic_ch = digit.getChannel() % 8;
434 if (digit.getHitQuality() != TOPDigit::c_Junk) {
435 m_goodHitsXY[slot - 1]->Fill(digit.getPixelCol(), digit.getPixelRow());
437 m_goodTDC[slot - 1]->Fill(digit.getRawTime());
440 m_pulseHeights[slot - 1]->Fill(digit.getPMTNumber(), digit.getPulseHeight());
442 if (digit.hasStatus(TOPDigit::c_EventT0Subtracted)) {
443 double time = digit.getTime();
444 if (cosmics) time += 10;
445 if (numTracks[slot - 1] > 0) {
452 if (selectedSlots[slot - 1] and abs(time) < 50) {
453 if (time > 0) numSignalHits[slot - 1]++;
454 else numBackgroundHits[slot - 1]++;
458 m_badHitsXY[slot - 1]->Fill(digit.getPixelCol(), digit.getPixelRow());
460 m_badTDC[slot - 1]->Fill(digit.getRawTime());
472 if (selectedSlots[slot - 1]) {
481 B2DEBUG(29,
"TTD FTSW : " << hex << it.GetTTUtime(0) <<
" " << it.GetTTCtime(0) <<
" EvtNr " << it.GetEveNo(0) <<
" Type " <<
482 (it.GetTTCtimeTRGType(0) & 0xF) <<
" TimeSincePrev " << it.GetTimeSincePrevTrigger(0) <<
" TimeSinceInj " <<
483 it.GetTimeSinceLastInjection(0) <<
" IsHER " << it.GetIsHER(0) <<
" Bunch " << it.GetBunchNumber(0));
484 auto time_clk = it.GetTimeSinceLastInjection(0);
485 if (time_clk != 0x7FFFFFFF) {
486 unsigned int nentries =
m_digits.getEntries();
487 double time_us = time_clk / 127.0;
488 double time_ms = time_us / 1000;
489 double time_1280 = time_clk % 1280;
490 if (it.GetIsHER(0)) {
495 if (nHits_good > 1000) {
504 if (nHits_good > 1000) {