40 std::srand(std::time(0));
42 auto run = FairRunOnline::Instance();
43 if (run !=
nullptr && run->GetHttpServer() !=
nullptr)
50 run->GetHttpServer()->Register(
"/Tasks",
this);
51 run->GetHttpServer()->RegisterCommand(
"Reset_Neuland", Form(
"/Tasks/%s/->ResetHistos()", GetName()));
52 run->GetHttpServer()->RegisterCommand(
"Reset_Neuland_Mapped",
53 Form(
"/Tasks/%s/->ResetHistosMapped()", GetName()));
56 auto ioman = FairRootManager::Instance();
59 throw std::runtime_error(
"R3BNeulandOnlineSpectra: No FairRootManager");
65 throw std::runtime_error(
"R3BNeulandOnlineSpectra: No R3BEventHeader");
72 auto canvasMapped =
new TCanvas(
"NeulandMapped",
"NeulandMapped", 10, 10, 850, 850);
73 canvasMapped->Divide(1, 2);
104 run->AddObject(canvasMapped);
107 auto canvasJump =
new TCanvas(
"NeulandJumps",
"NeulandJumps", 10, 10, 850, 850);
108 canvasJump->Divide(1, 2);
116 R3B::root_owned<TH2D>(
"hJumpsvsEvntzoom",
"Jumps vs Evnt zoomed", 1000, 0, 10000000, 1000, -200, 200);
124 run->AddObject(canvasJump);
127 auto canvasCal =
new TCanvas(
"NeulandCal",
"NeulandCal", 10, 10, 850, 850);
128 canvasCal->Divide(2, 3);
142 "hCalT1vsBar",
"CalLevel: Time1 vs Bars ",
fNBars, 0.5,
fNBars + 0.5, 2000, -5000, 15000);
147 "hCalT2vsBar",
"CalLevel: Time2 vs Bars ",
fNBars, 0.5,
fNBars + 0.5, 2000, -5000, 15000);
164 run->AddObject(canvasCal);
167 auto canvasHit =
new TCanvas(
"NeulandHit",
"NeulandHit", 10, 10, 850, 850);
168 canvasHit->Divide(2, 2);
194 run->AddObject(canvasHit);
197 auto canvasHitCosmics =
new TCanvas(
"NeulandHitCosmics",
"NeulandHitCosmics", 10, 10, 850, 850);
198 canvasHitCosmics->Divide(2, 2);
201 "hHitEvsBarCosmics",
"HitLevel: Energy vs Bars cosmics",
fNBars, 0.5,
fNBars + 0.5, 1000, 0, 60);
202 canvasHitCosmics->cd(1);
207 canvasHitCosmics->cd(2);
212 canvasHitCosmics->cd(3);
216 "hDT675c",
"Thit - Thit675 vs Bars cosmics corrected",
fNBars, 0.5,
fNBars + 0.5, 1000, -20, 20);
220 canvasHitCosmics->cd(4);
224 "hDT625c",
"Thit - Thit625 vs Bars cosmics corrected",
fNBars, 0.5,
fNBars + 0.5, 1000, -20, 20);
226 canvasHitCosmics->cd(0);
229 run->AddObject(canvasHitCosmics);
232 auto canvasPlaneXY =
new TCanvas(
"NeulandPlaneXY",
"NeulandPlaneXY", 10, 10, 850, 850);
233 canvasPlaneXY->Divide(5, 6);
234 for (
unsigned int i = 0; i <
fNPlanes; i++)
237 "Hit XY Plane" + TString::Itoa(i, 10),
244 canvasPlaneXY->cd(i + 1);
247 canvasPlaneXY->cd(0);
250 run->AddObject(canvasPlaneXY);
253 auto canvasPlaneSofia =
new TCanvas(
"Timing",
"Timing", 10, 10, 850, 850);
254 canvasPlaneSofia->Divide(2, 2);
267 R3B::root_owned<TH2D>(
"hNeuLANDvsStart",
"hNeuLANDvsStart", 3000, -10000, 40000, 1000, -10000, 10000);
268 canvasPlaneSofia->cd(1);
273 canvasPlaneSofia->cd(2);
279 canvasPlaneSofia->cd(3);
284 canvasPlaneSofia->cd(4);
289 canvasPlaneSofia->cd(0);
292 run->AddObject(canvasPlaneSofia);
300 const double clight = 29.9792458;
304 if (((UInt_t)
fEventHeader->GetEventno() % 10000000) < 10000)
314 for (
const auto& mapped : mappedData)
316 const auto plane = mapped->GetPlaneId();
317 const auto barp = mapped->GetBarId();
318 const auto bar = (plane - 1) * 50 + barp;
320 if (mapped->GetFineTime1LE() > 0)
322 if (mapped->GetFineTime1TE() > 0)
324 if (mapped->GetCoarseTime1LE() > 0)
326 if (mapped->GetCoarseTime1TE() > 0)
328 if (mapped->GetFineTime2LE() > 0)
330 if (mapped->GetFineTime2TE() > 0)
332 if (mapped->GetCoarseTime2LE() > 0)
334 if (mapped->GetCoarseTime2TE() > 0)
338 for (
const auto& data : calData)
340 const auto side = data->GetSide() - 1;
341 const auto bar = data->GetBarId();
344 if (std::isnan(data->GetTriggerTime()))
350 hNeuLANDvsStart->Fill(start, data->GetTime() - data->GetTriggerTime());
353 for (
const auto& datax : calData)
355 const auto sidex = datax->GetSide() - 1;
356 const auto barx = datax->GetBarId();
360 hTestJump->Fill(barx, data->GetTime() - datax->GetTime());
363 data->GetTime() - datax->GetTime());
370 for (
const auto& hit : hits)
372 const auto bar = hit->GetPaddle();
377 if (std::isnan(hit->GetT()))
380 hTdiffvsBar->Fill(bar, hit->GetTdcL() - hit->GetTdcR());
382 const Double_t tcorr = hit->GetT() - (hit->GetPosition().Mag() -
fDistanceToTarget) / clight;
383 const Double_t tadj = hit->GetT();
385 if (hit->GetE() > 0.)
396 randx = (std::rand() / (float)RAND_MAX);
397 const int plane =
static_cast<const int>(std::floor((hit->GetPaddle() - 1) / 50));
398 ahXYperPlane[plane]->Fill(hit->GetPosition().X() + (plane % 2) * 5. * (randx - 0.5),
399 hit->GetPosition().Y() + ((plane + 1) % 2) * 5. * (randx - 0.5));
401 hTofvsX->Fill(hit->GetPosition().X() + (plane % 2) * 5. * (randx - 0.5), tadj);
402 hTofcvsX->Fill(hit->GetPosition().X() + (plane % 2) * 5. * (randx - 0.5), tcorr);
403 hTofvsY->Fill(hit->GetPosition().Y() + ((plane + 1) % 2) * 5. * (randx - 0.5), tadj);
404 hTofcvsY->Fill(hit->GetPosition().Y() + ((plane + 1) % 2) * 5. * (randx - 0.5), tcorr);
415 for (
const auto& hitref : hits)
417 if ((hitref->GetPaddle() == 675) && (bar != 675))
420 bar, (hit->GetTdcL() + hit->GetTdcR()) / 2. - (hitref->GetTdcL() + hitref->GetTdcR()) / 2.);
422 (hit->GetTdcL() + hit->GetTdcR()) / 2. -
423 (hitref->GetTdcL() + hitref->GetTdcR()) / 2. +
424 copysign(1., (hit->GetPosition() - hitref->GetPosition()).Y()) *
425 (hit->GetPosition() - hitref->GetPosition()).Mag() / clight);
427 if ((hitref->GetPaddle() == 625) && (bar != 625))
430 bar, (hit->GetTdcL() + hit->GetTdcR()) / 2. - (hitref->GetTdcL() + hitref->GetTdcR()) / 2.);
432 (hit->GetTdcL() + hit->GetTdcR()) / 2. -
433 (hitref->GetTdcL() + hitref->GetTdcR()) / 2. +
434 copysign(1., (hit->GetPosition() - hitref->GetPosition()).Y()) *
435 (hit->GetPosition() - hitref->GetPosition()).Mag() / clight);