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);
109 R3B::root_owned<TH2D>(
"hJumpsvsEvntzoom",
"Jumps vs Evnt zoomed", 1000, 0, 10000000, 1000, -200, 200);
111 auto canvasCal =
new TCanvas(
"NeulandCal",
"NeulandCal", 10, 10, 850, 850);
112 canvasCal->Divide(2, 2);
126 "hCalT1vsBar",
"CalLevel: Time1 vs Bars ",
fNBars, 0.5,
fNBars + 0.5, 2000, -5000, 15000);
128 "hCalT2vsBar",
"CalLevel: Time2 vs Bars ",
fNBars, 0.5,
fNBars + 0.5, 2000, -5000, 15000);
143 run->AddObject(canvasCal);
146 auto canvasHit =
new TCanvas(
"NeulandHit",
"NeulandHit", 10, 10, 850, 850);
147 canvasHit->Divide(2, 2);
173 run->AddObject(canvasHit);
176 auto canvasHitCosmics =
new TCanvas(
"NeulandHitCosmics",
"NeulandHitCosmics", 10, 10, 850, 850);
177 canvasHitCosmics->Divide(2, 2);
180 "hHitEvsBarCosmics",
"HitLevel: Energy vs Bars cosmics",
fNBars, 0.5,
fNBars + 0.5, 1000, 0, 60);
181 canvasHitCosmics->cd(1);
186 canvasHitCosmics->cd(2);
191 canvasHitCosmics->cd(3);
195 "hDT675c",
"Thit - Thit675 vs Bars cosmics corrected",
fNBars, 0.5,
fNBars + 0.5, 1000, -20, 20);
199 canvasHitCosmics->cd(4);
203 "hDT625c",
"Thit - Thit625 vs Bars cosmics corrected",
fNBars, 0.5,
fNBars + 0.5, 1000, -20, 20);
205 canvasHitCosmics->cd(0);
208 run->AddObject(canvasHitCosmics);
211 for (
unsigned int i = 0; i <
fNPlanes; i++)
214 "Hit XY Plane" + TString::Itoa(i, 10),
223 auto canvasPlaneSofia =
new TCanvas(
"Timing",
"Timing", 10, 10, 850, 850);
224 canvasPlaneSofia->Divide(2, 2);
237 R3B::root_owned<TH2D>(
"hNeuLANDvsStart",
"hNeuLANDvsStart", 3000, -10000, 40000, 1000, -10000, 10000);
238 canvasPlaneSofia->cd(1);
243 canvasPlaneSofia->cd(2);
249 canvasPlaneSofia->cd(3);
254 canvasPlaneSofia->cd(4);
259 canvasPlaneSofia->cd(0);
262 run->AddObject(canvasPlaneSofia);
270 const double clight = 29.9792458;
286 for (
const auto& mapped : mappedData)
288 const auto plane = mapped->GetPlaneId();
289 const auto barp = mapped->GetBarId();
290 const auto bar = (plane - 1) * 50 + barp;
292 if (mapped->GetFineTime1LE() > 0)
294 if (mapped->GetFineTime1TE() > 0)
296 if (mapped->GetCoarseTime1LE() > 0)
298 if (mapped->GetCoarseTime1TE() > 0)
300 if (mapped->GetFineTime2LE() > 0)
302 if (mapped->GetFineTime2TE() > 0)
304 if (mapped->GetCoarseTime2LE() > 0)
306 if (mapped->GetCoarseTime2TE() > 0)
310 for (
const auto& data : calData)
312 const auto side = data->GetSide() - 1;
313 const auto bar = data->GetBarId();
316 if (std::isnan(data->GetTriggerTime()))
322 hNeuLANDvsStart->Fill(start, data->GetTime() - data->GetTriggerTime());
325 for (
const auto& datax : calData)
327 const auto sidex = datax->GetSide() - 1;
328 const auto barx = datax->GetBarId();
332 hTestJump->Fill(barx, data->GetTime() - datax->GetTime());
342 for (
const auto& hit : hits)
344 const auto bar = hit->GetPaddle();
349 if (std::isnan(hit->GetT()))
352 hTdiffvsBar->Fill(bar, hit->GetTdcL() - hit->GetTdcR());
354 const Double_t tcorr = hit->GetT() - ((hit->GetPosition().r() -
fDistanceToTarget) / clight);
355 const Double_t tadj = hit->GetT();
357 if (hit->GetE() > 0.)
368 randx = (std::rand() / (float)RAND_MAX);
369 const int plane =
static_cast<const int>(std::floor((hit->GetPaddle() - 1) / 50));
370 ahXYperPlane[plane]->Fill(hit->GetPosition().X() + (plane % 2) * 5. * (randx - 0.5),
371 hit->GetPosition().Y() + ((plane + 1) % 2) * 5. * (randx - 0.5));
373 hTofvsX->Fill(hit->GetPosition().X() + (plane % 2) * 5. * (randx - 0.5), tadj);
374 hTofcvsX->Fill(hit->GetPosition().X() + (plane % 2) * 5. * (randx - 0.5), tcorr);
375 hTofvsY->Fill(hit->GetPosition().Y() + ((plane + 1) % 2) * 5. * (randx - 0.5), tadj);
376 hTofcvsY->Fill(hit->GetPosition().Y() + ((plane + 1) % 2) * 5. * (randx - 0.5), tcorr);
387 for (
const auto& hitref : hits)
389 if ((hitref->GetPaddle() == 675) && (bar != 675))
392 bar, (hit->GetTdcL() + hit->GetTdcR()) / 2. - (hitref->GetTdcL() + hitref->GetTdcR()) / 2.);
394 (hit->GetTdcL() + hit->GetTdcR()) / 2. -
395 (hitref->GetTdcL() + hitref->GetTdcR()) / 2. +
396 copysign(1., (hit->GetPosition() - hitref->GetPosition()).Y()) *
397 (hit->GetPosition() - hitref->GetPosition()).r() / clight);
399 if ((hitref->GetPaddle() == 625) && (bar != 625))
402 bar, (hit->GetTdcL() + hit->GetTdcR()) / 2. - (hitref->GetTdcL() + hitref->GetTdcR()) / 2.);
404 (hit->GetTdcL() + hit->GetTdcR()) / 2. -
405 (hitref->GetTdcL() + hitref->GetTdcR()) / 2. +
406 copysign(1., (hit->GetPosition() - hitref->GetPosition()).Y()) *
407 (hit->GetPosition() - hitref->GetPosition()).r() / clight);