224 std::vector<string> fObservables;
225 fObservables = TRestEventProcess::ReadObservables();
227 for (
unsigned int i = 0; i < fObservables.size(); i++)
228 if (fObservables[i].find(
"nTracks_LE_") != string::npos) {
229 Double_t energy =
StringToDouble(fObservables[i].substr(11, fObservables[i].length()).c_str());
231 fTrack_LE_EnergyObservables.push_back(fObservables[i]);
232 fTrack_LE_Threshold.push_back(energy);
233 nTracks_LE.push_back(0);
236 for (
unsigned int i = 0; i < fObservables.size(); i++)
237 if (fObservables[i].find(
"nTracks_HE_") != string::npos) {
238 Double_t energy =
StringToDouble(fObservables[i].substr(11, fObservables[i].length()).c_str());
240 fTrack_HE_EnergyObservables.push_back(fObservables[i]);
241 fTrack_HE_Threshold.push_back(energy);
242 nTracks_HE.push_back(0);
245 for (
unsigned int i = 0; i < fObservables.size(); i++)
246 if (fObservables[i].find(
"nTracks_En_") != string::npos) {
247 Double_t energy =
StringToDouble(fObservables[i].substr(11, fObservables[i].length()).c_str());
249 fTrack_En_EnergyObservables.push_back(fObservables[i]);
250 fTrack_En_Threshold.push_back(energy);
251 nTracks_En.push_back(0);
254 for (
unsigned int i = 0; i < fObservables.size(); i++)
255 if (fObservables[i].find(
"twistLow_") != string::npos) {
256 Double_t tailPercentage =
257 StringToDouble(fObservables[i].substr(9, fObservables[i].length()).c_str());
259 fTwistLowObservables.push_back(fObservables[i]);
260 fTwistLowTailPercentage.push_back(tailPercentage);
261 fTwistLowValue.push_back(0);
264 for (
unsigned int i = 0; i < fObservables.size(); i++)
265 if (fObservables[i].find(
"twistHigh_") != string::npos) {
266 Double_t tailPercentage =
267 StringToDouble(fObservables[i].substr(10, fObservables[i].length()).c_str());
269 fTwistHighObservables.push_back(fObservables[i]);
270 fTwistHighTailPercentage.push_back(tailPercentage);
271 fTwistHighValue.push_back(0);
274 for (
unsigned int i = 0; i < fObservables.size(); i++)
275 if (fObservables[i].find(
"twistBalance_") != string::npos) {
276 Double_t tailPercentage =
277 StringToDouble(fObservables[i].substr(13, fObservables[i].length()).c_str());
279 fTwistBalanceObservables.push_back(fObservables[i]);
280 fTwistBalanceTailPercentage.push_back(tailPercentage);
281 fTwistBalanceValue.push_back(0);
284 for (
unsigned int i = 0; i < fObservables.size(); i++)
285 if (fObservables[i].find(
"twistRatio_") != string::npos) {
286 Double_t tailPercentage =
287 StringToDouble(fObservables[i].substr(11, fObservables[i].length()).c_str());
289 fTwistRatioObservables.push_back(fObservables[i]);
290 fTwistRatioTailPercentage.push_back(tailPercentage);
291 fTwistRatioValue.push_back(0);
294 for (
unsigned int i = 0; i < fObservables.size(); i++)
295 if (fObservables[i].find(
"twistWeightedLow_") != string::npos) {
296 Double_t tailPercentage =
297 StringToDouble(fObservables[i].substr(17, fObservables[i].length()).c_str());
299 fTwistWeightedLowObservables.push_back(fObservables[i]);
300 fTwistWeightedLowTailPercentage.push_back(tailPercentage);
301 fTwistWeightedLowValue.push_back(0);
304 for (
unsigned int i = 0; i < fObservables.size(); i++)
305 if (fObservables[i].find(
"twistWeightedHigh_") != string::npos) {
306 Double_t tailPercentage =
307 StringToDouble(fObservables[i].substr(18, fObservables[i].length()).c_str());
309 fTwistWeightedHighObservables.push_back(fObservables[i]);
310 fTwistWeightedHighTailPercentage.push_back(tailPercentage);
311 fTwistWeightedHighValue.push_back(0);
314 for (
unsigned int i = 0; i < fObservables.size(); i++)
315 if (fObservables[i].find(
"twistLow_X_") != string::npos) {
316 Double_t tailPercentage =
317 StringToDouble(fObservables[i].substr(11, fObservables[i].length()).c_str());
319 fTwistLowObservables_X.push_back(fObservables[i]);
320 fTwistLowTailPercentage_X.push_back(tailPercentage);
321 fTwistLowValue_X.push_back(0);
324 for (
unsigned int i = 0; i < fObservables.size(); i++)
325 if (fObservables[i].find(
"twistHigh_X_") != string::npos) {
326 Double_t tailPercentage =
327 StringToDouble(fObservables[i].substr(12, fObservables[i].length()).c_str());
329 fTwistHighObservables_X.push_back(fObservables[i]);
330 fTwistHighTailPercentage_X.push_back(tailPercentage);
331 fTwistHighValue_X.push_back(0);
334 for (
unsigned int i = 0; i < fObservables.size(); i++)
335 if (fObservables[i].find(
"twistBalance_X_") != string::npos) {
336 Double_t tailPercentage =
337 StringToDouble(fObservables[i].substr(15, fObservables[i].length()).c_str());
339 fTwistBalanceObservables_X.push_back(fObservables[i]);
340 fTwistBalanceTailPercentage_X.push_back(tailPercentage);
341 fTwistBalanceValue_X.push_back(0);
344 for (
unsigned int i = 0; i < fObservables.size(); i++)
345 if (fObservables[i].find(
"twistRatio_X_") != string::npos) {
346 Double_t tailPercentage =
347 StringToDouble(fObservables[i].substr(13, fObservables[i].length()).c_str());
349 fTwistRatioObservables_X.push_back(fObservables[i]);
350 fTwistRatioTailPercentage_X.push_back(tailPercentage);
351 fTwistRatioValue_X.push_back(0);
354 for (
unsigned int i = 0; i < fObservables.size(); i++)
355 if (fObservables[i].find(
"twistWeightedLow_X_") != string::npos) {
356 Double_t tailPercentage =
357 StringToDouble(fObservables[i].substr(19, fObservables[i].length()).c_str());
359 fTwistWeightedLowObservables_X.push_back(fObservables[i]);
360 fTwistWeightedLowTailPercentage_X.push_back(tailPercentage);
361 fTwistWeightedLowValue_X.push_back(0);
364 for (
unsigned int i = 0; i < fObservables.size(); i++)
365 if (fObservables[i].find(
"twistWeightedHigh_X_") != string::npos) {
366 Double_t tailPercentage =
367 StringToDouble(fObservables[i].substr(20, fObservables[i].length()).c_str());
369 fTwistWeightedHighObservables_X.push_back(fObservables[i]);
370 fTwistWeightedHighTailPercentage_X.push_back(tailPercentage);
371 fTwistWeightedHighValue_X.push_back(0);
374 for (
unsigned int i = 0; i < fObservables.size(); i++)
375 if (fObservables[i].find(
"twistLow_Y_") != string::npos) {
376 Double_t tailPercentage =
377 StringToDouble(fObservables[i].substr(11, fObservables[i].length()).c_str());
379 fTwistLowObservables_Y.push_back(fObservables[i]);
380 fTwistLowTailPercentage_Y.push_back(tailPercentage);
381 fTwistLowValue_Y.push_back(0);
384 for (
unsigned int i = 0; i < fObservables.size(); i++)
385 if (fObservables[i].find(
"twistHigh_Y_") != string::npos) {
386 Double_t tailPercentage =
387 StringToDouble(fObservables[i].substr(12, fObservables[i].length()).c_str());
389 fTwistHighObservables_Y.push_back(fObservables[i]);
390 fTwistHighTailPercentage_Y.push_back(tailPercentage);
391 fTwistHighValue_Y.push_back(0);
394 for (
unsigned int i = 0; i < fObservables.size(); i++)
395 if (fObservables[i].find(
"twistBalance_Y_") != string::npos) {
396 Double_t tailPercentage =
397 StringToDouble(fObservables[i].substr(15, fObservables[i].length()).c_str());
399 fTwistBalanceObservables_Y.push_back(fObservables[i]);
400 fTwistBalanceTailPercentage_Y.push_back(tailPercentage);
401 fTwistBalanceValue_Y.push_back(0);
404 for (
unsigned int i = 0; i < fObservables.size(); i++)
405 if (fObservables[i].find(
"twistRatio_Y_") != string::npos) {
406 Double_t tailPercentage =
407 StringToDouble(fObservables[i].substr(13, fObservables[i].length()).c_str());
409 fTwistRatioObservables_Y.push_back(fObservables[i]);
410 fTwistRatioTailPercentage_Y.push_back(tailPercentage);
411 fTwistRatioValue_Y.push_back(0);
414 for (
unsigned int i = 0; i < fObservables.size(); i++)
415 if (fObservables[i].find(
"twistWeightedLow_Y_") != string::npos) {
416 Double_t tailPercentage =
417 StringToDouble(fObservables[i].substr(19, fObservables[i].length()).c_str());
419 fTwistWeightedLowObservables_Y.push_back(fObservables[i]);
420 fTwistWeightedLowTailPercentage_Y.push_back(tailPercentage);
421 fTwistWeightedLowValue_Y.push_back(0);
424 for (
unsigned int i = 0; i < fObservables.size(); i++)
425 if (fObservables[i].find(
"twistWeightedHigh_Y_") != string::npos) {
426 Double_t tailPercentage =
427 StringToDouble(fObservables[i].substr(20, fObservables[i].length()).c_str());
429 fTwistWeightedHighObservables_Y.push_back(fObservables[i]);
430 fTwistWeightedHighTailPercentage_Y.push_back(tailPercentage);
431 fTwistWeightedHighValue_Y.push_back(0);
439 for (
int tck = 0; tck < fInputTrackEvent->GetNumberOfTracks(); tck++)
440 fOutputTrackEvent->AddTrack(fInputTrackEvent->GetTrack(tck));
443 fInputTrackEvent->PrintOnlyTracks();
446 Int_t nTracksX = 0, nTracksY = 0, nTracksXYZ = 0;
447 nTracksX = fInputTrackEvent->GetNumberOfTracks(
"X");
448 nTracksY = fInputTrackEvent->GetNumberOfTracks(
"Y");
449 nTracksXYZ = fInputTrackEvent->GetNumberOfTracks(
"XYZ");
459 for (
unsigned int n = 0; n < nTracks_HE.size(); n++) nTracks_HE[n] = 0;
461 for (
unsigned int n = 0; n < nTracks_LE.size(); n++) nTracks_LE[n] = 0;
463 for (
unsigned int n = 0; n < nTracks_En.size(); n++) nTracks_En[n] = 0;
465 for (
int tck = 0; tck < fInputTrackEvent->GetNumberOfTracks(); tck++) {
466 if (!fInputTrackEvent->isTopLevel(tck))
continue;
468 TRestTrack* t = fInputTrackEvent->GetTrack(tck);
469 Double_t en = t->GetEnergy();
471 if ((t->isXYZ()) || (t->isXZ()) || (t->isYZ())) {
473 for (
unsigned int n = 0; n < fTrack_HE_EnergyObservables.size(); n++)
474 if (en > fTrack_HE_Threshold[n]) nTracks_HE[n]++;
476 for (
unsigned int n = 0; n < fTrack_LE_EnergyObservables.size(); n++)
477 if (en < fTrack_LE_Threshold[n]) nTracks_LE[n]++;
479 for (
unsigned int n = 0; n < fTrack_En_EnergyObservables.size(); n++)
480 if (en > fTrack_En_Threshold[n] - fDeltaEnergy && en < fTrack_En_Threshold[n] + fDeltaEnergy)
485 for (
unsigned int n = 0; n < fTrack_LE_EnergyObservables.size(); n++) {
489 for (
unsigned int n = 0; n < fTrack_HE_EnergyObservables.size(); n++) {
493 for (
unsigned int n = 0; n < fTrack_En_EnergyObservables.size(); n++) {
498 TRestTrack* tXYZ = fInputTrackEvent->GetMaxEnergyTrack(
"XYZ");
499 TRestTrack* tX = fInputTrackEvent->GetMaxEnergyTrack(
"X");
500 TRestTrack* tY = fInputTrackEvent->GetMaxEnergyTrack(
"Y");
502 if (fEnableTwistParameters) {
505 Double_t twist = -1, twistWeighted = -1;
507 for (
unsigned int n = 0; n < fTwistWeightedHighValue.size(); n++) fTwistWeightedHighValue[n] = -1;
509 for (
unsigned int n = 0; n < fTwistWeightedLowValue.size(); n++) fTwistWeightedLowValue[n] = -1;
511 for (
unsigned int n = 0; n < fTwistLowValue.size(); n++) fTwistLowValue[n] = -1;
513 for (
unsigned int n = 0; n < fTwistHighValue.size(); n++) fTwistHighValue[n] = -1;
515 for (
unsigned int n = 0; n < fTwistBalanceValue.size(); n++) fTwistBalanceValue[n] = -1;
517 for (
unsigned int n = 0; n < fTwistRatioValue.size(); n++) fTwistRatioValue[n] = -1;
521 Int_t Nhits = hits->GetNumberOfHits();
526 for (
unsigned int n = 0; n < fTwistLowObservables.size(); n++) {
527 Int_t Nend = fTwistLowTailPercentage[n] * Nhits / 100.;
529 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
531 if (twistStart < twistEnd)
532 fTwistLowValue[n] = twistStart;
534 fTwistLowValue[n] = twistEnd;
537 for (
unsigned int n = 0; n < fTwistHighObservables.size(); n++) {
538 Int_t Nend = fTwistHighTailPercentage[n] * Nhits / 100.;
540 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
542 if (twistStart > twistEnd)
543 fTwistHighValue[n] = twistStart;
545 fTwistHighValue[n] = twistEnd;
548 for (
unsigned int n = 0; n < fTwistBalanceObservables.size(); n++) {
549 Int_t Nend = fTwistBalanceTailPercentage[n] * Nhits / 100.;
551 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
553 if (twistStart < twistEnd)
554 fTwistBalanceValue[n] = (twistEnd - twistStart) / (twistEnd + twistStart);
556 fTwistBalanceValue[n] = (twistStart - twistEnd) / (twistEnd + twistStart);
559 for (
unsigned int n = 0; n < fTwistRatioObservables.size(); n++) {
560 Int_t Nend = fTwistRatioTailPercentage[n] * Nhits / 100.;
562 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
564 if (twistStart > twistEnd) {
565 if (twistEnd <= 0) twistEnd = -1;
566 fTwistRatioValue[n] = twistStart / twistEnd;
568 if (twistStart <= 0) twistStart = -1;
569 fTwistRatioValue[n] = twistEnd / twistStart;
573 for (
unsigned int n = 0; n < fTwistWeightedLowObservables.size(); n++) {
574 Int_t Nend = fTwistWeightedLowTailPercentage[n] * Nhits / 100.;
578 if (twistStart < twistEnd)
579 fTwistWeightedLowValue[n] = twistStart;
581 fTwistWeightedLowValue[n] = twistEnd;
584 for (
unsigned int n = 0; n < fTwistWeightedHighObservables.size(); n++) {
585 Int_t Nend = fTwistWeightedHighTailPercentage[n] * Nhits / 100.;
589 if (twistStart > twistEnd)
590 fTwistWeightedHighValue[n] = twistStart;
592 fTwistWeightedHighValue[n] = twistEnd;
596 for (
unsigned int n = 0; n < fTwistLowObservables.size(); n++) {
600 for (
unsigned int n = 0; n < fTwistHighObservables.size(); n++) {
604 for (
unsigned int n = 0; n < fTwistBalanceObservables.size(); n++) {
608 for (
unsigned int n = 0; n < fTwistRatioObservables.size(); n++) {
612 for (
unsigned int n = 0; n < fTwistWeightedLowObservables.size(); n++) {
613 SetObservableValue((
string)fTwistWeightedLowObservables[n], fTwistWeightedLowValue[n]);
616 for (
unsigned int n = 0; n < fTwistWeightedHighObservables.size(); n++) {
617 SetObservableValue((
string)fTwistWeightedHighObservables[n], fTwistWeightedHighValue[n]);
626 Double_t twist_X = -1, twistWeighted_X = -1;
628 for (
unsigned int n = 0; n < fTwistWeightedHighValue_X.size(); n++) fTwistWeightedHighValue_X[n] = -1;
630 for (
unsigned int n = 0; n < fTwistWeightedLowValue_X.size(); n++) fTwistWeightedLowValue_X[n] = -1;
632 for (
unsigned int n = 0; n < fTwistLowValue_X.size(); n++) fTwistLowValue_X[n] = -1;
634 for (
unsigned int n = 0; n < fTwistHighValue_X.size(); n++) fTwistHighValue_X[n] = -1;
636 for (
unsigned int n = 0; n < fTwistBalanceValue_X.size(); n++) fTwistBalanceValue_X[n] = -1;
638 for (
unsigned int n = 0; n < fTwistRatioValue_X.size(); n++) fTwistRatioValue_X[n] = -1;
642 Int_t Nhits = hits->GetNumberOfHits();
647 for (
unsigned int n = 0; n < fTwistLowObservables_X.size(); n++) {
648 Int_t Nend = fTwistLowTailPercentage_X[n] * Nhits / 100.;
650 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
652 if (twistStart < twistEnd)
653 fTwistLowValue_X[n] = twistStart;
655 fTwistLowValue_X[n] = twistEnd;
658 for (
unsigned int n = 0; n < fTwistHighObservables_X.size(); n++) {
659 Int_t Nend = fTwistHighTailPercentage_X[n] * Nhits / 100.;
661 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
663 if (twistStart > twistEnd)
664 fTwistHighValue_X[n] = twistStart;
666 fTwistHighValue_X[n] = twistEnd;
669 for (
unsigned int n = 0; n < fTwistBalanceObservables_X.size(); n++) {
670 Int_t Nend = fTwistBalanceTailPercentage_X[n] * Nhits / 100.;
672 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
674 if (twistStart < twistEnd)
675 fTwistBalanceValue_X[n] = (twistEnd - twistStart) / (twistEnd + twistStart);
677 fTwistBalanceValue_X[n] = (twistStart - twistEnd) / (twistEnd + twistStart);
680 for (
unsigned int n = 0; n < fTwistRatioObservables_X.size(); n++) {
681 Int_t Nend = fTwistRatioTailPercentage_X[n] * Nhits / 100.;
683 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
685 if (twistStart > twistEnd) {
686 if (twistEnd <= 0) twistEnd = -1;
687 fTwistRatioValue[n] = twistStart / twistEnd;
689 if (twistStart <= 0) twistStart = -1;
690 fTwistRatioValue[n] = twistEnd / twistStart;
694 for (
unsigned int n = 0; n < fTwistWeightedLowObservables_X.size(); n++) {
695 Int_t Nend = fTwistWeightedLowTailPercentage_X[n] * Nhits / 100.;
699 if (twistStart < twistEnd)
700 fTwistWeightedLowValue_X[n] = twistStart;
702 fTwistWeightedLowValue_X[n] = twistEnd;
705 for (
unsigned int n = 0; n < fTwistWeightedHighObservables_X.size(); n++) {
706 Int_t Nend = fTwistWeightedHighTailPercentage_X[n] * Nhits / 100.;
710 if (twistStart > twistEnd)
711 fTwistWeightedHighValue_X[n] = twistStart;
713 fTwistWeightedHighValue_X[n] = twistEnd;
717 for (
unsigned int n = 0; n < fTwistLowObservables_X.size(); n++) {
721 for (
unsigned int n = 0; n < fTwistHighObservables_X.size(); n++) {
725 for (
unsigned int n = 0; n < fTwistBalanceObservables_X.size(); n++) {
729 for (
unsigned int n = 0; n < fTwistRatioObservables_X.size(); n++) {
733 for (
unsigned int n = 0; n < fTwistWeightedLowObservables_X.size(); n++) {
734 SetObservableValue((
string)fTwistWeightedLowObservables_X[n], fTwistWeightedLowValue_X[n]);
737 for (
unsigned int n = 0; n < fTwistWeightedHighObservables_X.size(); n++) {
738 SetObservableValue((
string)fTwistWeightedHighObservables_X[n], fTwistWeightedHighValue_X[n]);
747 Double_t twist_Y = -1, twistWeighted_Y = -1;
749 for (
unsigned int n = 0; n < fTwistWeightedHighValue_Y.size(); n++) fTwistWeightedHighValue_Y[n] = -1;
751 for (
unsigned int n = 0; n < fTwistWeightedLowValue_Y.size(); n++) fTwistWeightedLowValue_Y[n] = -1;
753 for (
unsigned int n = 0; n < fTwistLowValue_Y.size(); n++) fTwistLowValue_Y[n] = -1;
755 for (
unsigned int n = 0; n < fTwistHighValue_Y.size(); n++) fTwistHighValue_Y[n] = -1;
757 for (
unsigned int n = 0; n < fTwistBalanceValue_Y.size(); n++) fTwistBalanceValue_Y[n] = -1;
759 for (
unsigned int n = 0; n < fTwistRatioValue_Y.size(); n++) fTwistRatioValue_Y[n] = -1;
763 Int_t Nhits = hits->GetNumberOfHits();
768 for (
unsigned int n = 0; n < fTwistLowObservables_Y.size(); n++) {
769 Int_t Nend = fTwistLowTailPercentage_Y[n] * Nhits / 100.;
771 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
773 if (twistStart < twistEnd)
774 fTwistLowValue_Y[n] = twistStart;
776 fTwistLowValue_Y[n] = twistEnd;
779 for (
unsigned int n = 0; n < fTwistHighObservables_Y.size(); n++) {
780 Int_t Nend = fTwistHighTailPercentage_Y[n] * Nhits / 100.;
782 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
784 if (twistStart > twistEnd)
785 fTwistHighValue_Y[n] = twistStart;
787 fTwistHighValue_Y[n] = twistEnd;
790 for (
unsigned int n = 0; n < fTwistBalanceObservables_Y.size(); n++) {
791 Int_t Nend = fTwistBalanceTailPercentage_Y[n] * Nhits / 100.;
793 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
795 if (twistStart < twistEnd)
796 fTwistBalanceValue_Y[n] = (twistEnd - twistStart) / (twistEnd + twistStart);
798 fTwistBalanceValue_Y[n] = (twistStart - twistEnd) / (twistEnd + twistStart);
801 for (
unsigned int n = 0; n < fTwistRatioObservables_Y.size(); n++) {
802 Int_t Nend = fTwistRatioTailPercentage_Y[n] * Nhits / 100.;
804 Double_t twistEnd = hits->
GetHitsTwist(Nhits - Nend, Nhits);
806 if (twistStart > twistEnd) {
807 if (twistEnd <= 0) twistEnd = -1;
808 fTwistRatioValue[n] = twistStart / twistEnd;
810 if (twistStart <= 0) twistStart = -1;
811 fTwistRatioValue[n] = twistEnd / twistStart;
815 for (
unsigned int n = 0; n < fTwistWeightedLowObservables_Y.size(); n++) {
816 Int_t Nend = fTwistWeightedLowTailPercentage_Y[n] * Nhits / 100.;
820 if (twistStart < twistEnd)
821 fTwistWeightedLowValue_Y[n] = twistStart;
823 fTwistWeightedLowValue_Y[n] = twistEnd;
826 for (
unsigned int n = 0; n < fTwistWeightedHighObservables_Y.size(); n++) {
827 Int_t Nend = fTwistWeightedHighTailPercentage_Y[n] * Nhits / 100.;
831 if (twistStart > twistEnd)
832 fTwistWeightedHighValue_Y[n] = twistStart;
834 fTwistWeightedHighValue_Y[n] = twistEnd;
838 for (
unsigned int n = 0; n < fTwistLowObservables_Y.size(); n++) {
842 for (
unsigned int n = 0; n < fTwistHighObservables_Y.size(); n++) {
846 for (
unsigned int n = 0; n < fTwistBalanceObservables_Y.size(); n++) {
850 for (
unsigned int n = 0; n < fTwistRatioObservables_Y.size(); n++) {
854 for (
unsigned int n = 0; n < fTwistWeightedLowObservables_Y.size(); n++) {
855 SetObservableValue((
string)fTwistWeightedLowObservables_Y[n], fTwistWeightedLowValue_Y[n]);
858 for (
unsigned int n = 0; n < fTwistWeightedHighObservables_Y.size(); n++) {
859 SetObservableValue((
string)fTwistWeightedHighObservables_Y[n], fTwistWeightedHighValue_Y[n]);
869 Double_t tckMaxEnXYZ = 0, tckMaxEnX = 0, tckMaxEnY = 0;
870 Double_t tckMaxXYZ_SigmaX = 0, tckMaxXYZ_SigmaY = 0, tckMaxXYZ_SigmaZ = 0;
871 Double_t tckMaxXZ_SigmaX = 0;
872 Double_t tckMaxXZ_SigmaZ = 0;
873 Double_t tckMaxYZ_SigmaY = 0;
874 Double_t tckMaxYZ_SigmaZ = 0;
875 Double_t tckMaxXZ_nHits = 0;
876 Double_t tckMaxYZ_nHits = 0;
877 Double_t tckMaxXYZ_gausSigmaX = 0, tckMaxXYZ_gausSigmaY = 0, tckMaxXYZ_gausSigmaZ = 0;
878 Double_t tckMaxXZ_gausSigmaX = 0, tckMaxXZ_gausSigmaZ_XZ = 0;
879 Double_t tckMaxYZ_gausSigmaY = 0, tckMaxYZ_gausSigmaZ_YZ = 0;
880 Double_t tckMaxTrack_XYZ_GaussSigmaZ = 0;
881 Double_t tckMaxTrack_XYZ_SigmaZ2 = 0;
882 Double_t tckMaxTrack_XYZ_skewXY = 0, tckMaxTrack_XYZ_skewZ = 0;
884 if (fInputTrackEvent->GetMaxEnergyTrack()) {
885 tckMaxEnXYZ = fInputTrackEvent->GetMaxEnergyTrack()->GetEnergy();
886 tckMaxXYZ_SigmaX = fInputTrackEvent->GetMaxEnergyTrack()->GetHits()->
GetSigmaX();
887 tckMaxXYZ_SigmaY = fInputTrackEvent->GetMaxEnergyTrack()->GetHits()->
GetSigmaY();
888 tckMaxXYZ_SigmaZ = fInputTrackEvent->GetMaxEnergyTrack()->GetHits()->
GetSigmaZ2();
889 RESTDebug <<
"id: " << fInputTrackEvent->GetID() <<
" " << fInputTrackEvent->GetSubEventTag()
890 <<
" tckMaxEnXYZ: " << tckMaxEnXYZ <<
RESTendl;
891 tckMaxXYZ_gausSigmaX = fInputTrackEvent->GetMaxEnergyTrack()->GetHits()->
GetGaussSigmaX();
892 tckMaxXYZ_gausSigmaY = fInputTrackEvent->GetMaxEnergyTrack()->GetHits()->
GetGaussSigmaY();
893 tckMaxXYZ_gausSigmaZ = fInputTrackEvent->GetMaxEnergyTrack()->GetHits()->
GetGaussSigmaZ();
903 if (fInputTrackEvent->GetMaxEnergyTrack(
"X")) {
904 tckMaxEnX = fInputTrackEvent->GetMaxEnergyTrack(
"X")->GetEnergy();
905 tckMaxXZ_SigmaX = fInputTrackEvent->GetMaxEnergyTrack(
"X")->GetHits()->
GetSigmaX();
906 tckMaxXZ_SigmaZ = fInputTrackEvent->GetMaxEnergyTrack(
"X")->GetHits()->
GetSigmaZ2();
907 tckMaxXZ_gausSigmaX = fInputTrackEvent->GetMaxEnergyTrack(
"X")->GetHits()->
GetGaussSigmaX();
908 tckMaxXZ_gausSigmaZ_XZ = fInputTrackEvent->GetMaxEnergyTrack(
"X")->GetHits()->
GetGaussSigmaZ();
909 tckMaxXZ_nHits = fInputTrackEvent->GetMaxEnergyTrack(
"X")->GetNumberOfHits();
910 RESTDebug <<
"id: " << fInputTrackEvent->GetID() <<
" " << fInputTrackEvent->GetSubEventTag()
911 <<
" tckMaxEnX: " << tckMaxEnX <<
RESTendl;
921 if (fInputTrackEvent->GetMaxEnergyTrack(
"Y")) {
922 tckMaxEnY = fInputTrackEvent->GetMaxEnergyTrack(
"Y")->GetEnergy();
923 tckMaxYZ_SigmaY = fInputTrackEvent->GetMaxEnergyTrack(
"Y")->GetHits()->
GetSigmaY();
924 tckMaxYZ_SigmaZ = fInputTrackEvent->GetMaxEnergyTrack(
"Y")->GetHits()->
GetSigmaZ2();
925 tckMaxYZ_gausSigmaY = fInputTrackEvent->GetMaxEnergyTrack(
"Y")->GetHits()->
GetGaussSigmaY();
926 tckMaxYZ_gausSigmaZ_YZ = fInputTrackEvent->GetMaxEnergyTrack(
"Y")->GetHits()->
GetGaussSigmaZ();
927 tckMaxYZ_nHits = fInputTrackEvent->GetMaxEnergyTrack(
"Y")->GetNumberOfHits();
928 RESTDebug <<
"id: " << fInputTrackEvent->GetID() <<
" " << fInputTrackEvent->GetSubEventTag()
929 <<
" tckMaxEnY: " << tckMaxEnY <<
RESTendl;
939 SetObservableValue(
"MaxTrackxySigmaGausBalance", (tckMaxXZ_gausSigmaX - tckMaxYZ_gausSigmaY) /
940 (tckMaxXZ_gausSigmaX + tckMaxYZ_gausSigmaY));
943 (tckMaxXZ_SigmaX - tckMaxYZ_SigmaY) / (tckMaxXZ_SigmaX + tckMaxYZ_SigmaY));
945 SetObservableValue(
"MaxTrackEnergyBalanceXY", (tckMaxEnX - tckMaxEnY) / (tckMaxEnX + tckMaxEnY));
947 Double_t tckMaxEnergy = tckMaxEnX + tckMaxEnY + tckMaxEnXYZ;
949 Double_t totalEnergy = fInputTrackEvent->GetEnergy();
951 Double_t trackEnergyRatio = (totalEnergy - tckMaxEnergy) / totalEnergy;
956 SetObservableValue(
"MaxTrackZSigmaGausBalance", (tckMaxXZ_gausSigmaZ_XZ - tckMaxYZ_gausSigmaZ_YZ) /
957 (tckMaxXZ_gausSigmaZ_XZ + tckMaxYZ_gausSigmaZ_YZ));
960 (tckMaxXZ_SigmaZ - tckMaxYZ_SigmaZ) / (tckMaxXZ_SigmaZ + tckMaxYZ_SigmaZ));
962 SetObservableValue(
"MaxTrackEnergyBalanceXY", (tckMaxEnX - tckMaxEnY) / (tckMaxEnX + tckMaxEnY));
967 if (fInputTrackEvent->GetMaxEnergyTrack(
"X"))
968 hitsXZ = fInputTrackEvent->GetMaxEnergyTrack(
"X")->GetHits();
969 if (fInputTrackEvent->GetMaxEnergyTrack(
"Y"))
970 hitsYZ = fInputTrackEvent->GetMaxEnergyTrack(
"Y")->GetHits();
972 auto hitsBoth = {hitsXZ, hitsYZ};
974 for (
auto arg : hitsBoth) {
975 if (arg ==
nullptr)
continue;
976 for (
unsigned int n = 0; n < arg->GetNumberOfHits(); n++) {
978 Double_t eDep = arg->GetEnergy(n);
980 Double_t x = arg->GetX(n);
981 Double_t y = arg->GetY(n);
982 Double_t z = arg->GetZ(n);
984 auto time = arg->GetTime(n);
985 auto type = arg->GetType(n);
987 hits.
AddHit({x, y, z}, eDep, time, type);
992 tckMaxTrack_XYZ_skewZ = hits.
GetSkewZ();
993 tckMaxTrack_XYZ_skewXY = hits.
GetSkewXY();
1001 Double_t tckSecondMaxXYZ_SigmaX = 0, tckSecondMaxXYZ_SigmaY = 0;
1002 Double_t tckSecondMaxXYZ_gausSigmaX = 0, tckSecondMaxXYZ_gausSigmaY = 0;
1003 Double_t tckSecondMaxXZ_gausSigmaX = 0, tckSecondMaxXZ_gausSigmaZ_XZ = 0;
1004 Double_t tckSecondMaxYZ_gausSigmaY = 0, tckSecondMaxYZ_gausSigmaZ_YZ = 0;
1006 if (fInputTrackEvent->GetSecondMaxEnergyTrack() !=
nullptr) {
1007 tckSecondMaxXYZ_SigmaX = fInputTrackEvent->GetSecondMaxEnergyTrack()->GetHits()->
GetSigmaX();
1008 tckSecondMaxXYZ_SigmaY = fInputTrackEvent->GetSecondMaxEnergyTrack()->GetHits()->
GetSigmaY();
1009 tckSecondMaxXYZ_gausSigmaX = fInputTrackEvent->GetSecondMaxEnergyTrack()->GetHits()->
GetGaussSigmaX();
1010 tckSecondMaxXYZ_gausSigmaY = fInputTrackEvent->GetSecondMaxEnergyTrack()->GetHits()->
GetGaussSigmaY();
1013 Double_t tckSecondMaxEnergy_X = 0;
1014 Double_t tckSecondMaxXZ_SigmaX = 0;
1015 Double_t tckSecondMaxXZ_SigmaZ = 0;
1016 if (fInputTrackEvent->GetSecondMaxEnergyTrack(
"X") !=
nullptr) {
1017 tckSecondMaxXZ_SigmaX = fInputTrackEvent->GetSecondMaxEnergyTrack(
"X")->GetHits()->
GetSigmaX();
1018 tckSecondMaxXZ_SigmaZ = fInputTrackEvent->GetSecondMaxEnergyTrack(
"X")->GetHits()->
GetSigmaZ2();
1019 tckSecondMaxEnergy_X = fInputTrackEvent->GetSecondMaxEnergyTrack(
"X")->GetEnergy();
1020 tckSecondMaxXZ_gausSigmaX =
1021 fInputTrackEvent->GetSecondMaxEnergyTrack(
"X")->GetHits()->
GetGaussSigmaX();
1022 tckSecondMaxXZ_gausSigmaZ_XZ =
1023 fInputTrackEvent->GetSecondMaxEnergyTrack(
"X")->GetHits()->
GetGaussSigmaZ();
1026 Double_t tckSecondMaxEnergy_Y = 0;
1027 Double_t tckSecondMaxYZ_SigmaY = 0;
1028 Double_t tckSecondMaxYZ_SigmaZ = 0;
1029 if (fInputTrackEvent->GetSecondMaxEnergyTrack(
"Y") !=
nullptr) {
1030 tckSecondMaxYZ_SigmaY = fInputTrackEvent->GetSecondMaxEnergyTrack(
"Y")->GetHits()->
GetSigmaY();
1031 tckSecondMaxYZ_SigmaZ = fInputTrackEvent->GetSecondMaxEnergyTrack(
"Y")->GetHits()->
GetSigmaZ2();
1032 tckSecondMaxEnergy_Y = fInputTrackEvent->GetSecondMaxEnergyTrack(
"Y")->GetEnergy();
1033 tckSecondMaxYZ_gausSigmaY =
1034 fInputTrackEvent->GetSecondMaxEnergyTrack(
"Y")->GetHits()->
GetGaussSigmaY();
1035 tckSecondMaxYZ_gausSigmaZ_YZ =
1036 fInputTrackEvent->GetSecondMaxEnergyTrack(
"Y")->GetHits()->
GetGaussSigmaZ();
1039 Double_t trackSecondMaxEnergy = tckSecondMaxEnergy_X + tckSecondMaxEnergy_Y;
1044 SetObservableValue((
string)
"SecondMaxTrackGaussSigmaX", tckSecondMaxXYZ_gausSigmaX);
1045 SetObservableValue((
string)
"SecondMaxTrackGaussSigmaY", tckSecondMaxXYZ_gausSigmaY);
1050 SetObservableValue((
string)
"SecondMaxTrack_XZ_GaussSigmaX", tckSecondMaxXZ_gausSigmaX);
1051 SetObservableValue((
string)
"SecondMaxTrack_XZ_GaussSigmaZ", tckSecondMaxXZ_gausSigmaZ_XZ);
1056 SetObservableValue((
string)
"SecondMaxTrack_YZ_GaussSigmaY", tckSecondMaxYZ_gausSigmaY);
1057 SetObservableValue((
string)
"SecondMaxTrack_YZ_GaussSigmaZ", tckSecondMaxYZ_gausSigmaZ_YZ);
1060 (tckSecondMaxXZ_gausSigmaX - tckSecondMaxYZ_gausSigmaY) /
1061 (tckSecondMaxXZ_gausSigmaX + tckSecondMaxYZ_gausSigmaY));
1063 SetObservableValue(
"SecondMaxTrackxySigmaBalance", (tckSecondMaxXZ_SigmaX - tckSecondMaxYZ_SigmaY) /
1064 (tckSecondMaxXZ_SigmaX + tckSecondMaxYZ_SigmaY));
1065 SetObservableValue(
"SecondMaxTrackZSigmaBalance", (tckSecondMaxXZ_SigmaZ - tckSecondMaxYZ_SigmaZ) /
1066 (tckSecondMaxXZ_SigmaZ + tckSecondMaxYZ_SigmaZ));
1068 (tckSecondMaxXZ_gausSigmaZ_XZ - tckSecondMaxYZ_gausSigmaZ_YZ) /
1069 (tckSecondMaxXZ_gausSigmaZ_XZ + tckSecondMaxYZ_gausSigmaZ_YZ));
1070 SetObservableValue(
"SecondMaxTrackEnergyBalanceXY", (tckSecondMaxEnergy_X - tckSecondMaxEnergy_Y) /
1071 (tckSecondMaxEnergy_X + tckSecondMaxEnergy_Y));
1076 Double_t tckLenX = fInputTrackEvent->GetMaxEnergyTrackLength(
"X");
1077 Double_t tckLenY = fInputTrackEvent->GetMaxEnergyTrackLength(
"Y");
1078 Double_t tckLenXYZ = fInputTrackEvent->GetMaxEnergyTrackLength();
1086 Double_t tckVolX = fInputTrackEvent->GetMaxEnergyTrackVolume(
"X");
1087 Double_t tckVolY = fInputTrackEvent->GetMaxEnergyTrackVolume(
"Y");
1088 Double_t tckVolXYZ = fInputTrackEvent->GetMaxEnergyTrackVolume();
1099 Double_t maxX = 0, maxY = 0, maxZ = 0;
1100 Double_t sMaxX = 0, sMaxY = 0, sMaxZ = 0;
1101 Double_t dX = 0, dY = 0, dZ = 0;
1102 Double_t dXZ = 0, dYZ = 0, dXYZ = 0;
1105 TRestTrack* tMax = fInputTrackEvent->GetMaxEnergyTrack();
1107 if (tMax !=
nullptr) {
1108 maxX = tMax->GetMeanPosition().X();
1109 maxY = tMax->GetMeanPosition().Y();
1110 maxZ = tMax->GetMeanPosition().Z();
1118 TRestTrack* tSecondMax = fInputTrackEvent->GetSecondMaxEnergyTrack();
1120 if (tSecondMax !=
nullptr) {
1121 sMaxX = tSecondMax->GetMeanPosition().X();
1122 sMaxY = tSecondMax->GetMeanPosition().Y();
1123 sMaxZ = tSecondMax->GetMeanPosition().Z();
1130 if (sMaxX != 0) dX = abs(maxX - sMaxX);
1131 if (sMaxY != 0) dY = abs(maxY - sMaxY);
1132 if (sMaxZ != 0) dZ = abs(maxZ - sMaxZ);
1134 if (dX != 0 || dY != 0 || dZ != 0) dXYZ = TMath::Sqrt(dX * dX + dY * dY + dZ * dZ);
1139 maxX = 0, maxY = 0, maxZ = 0;
1140 dX = 0, dY = 0, dZ = 0;
1141 tMax = fInputTrackEvent->GetMaxEnergyTrack(
"X");
1142 if (tMax !=
nullptr) {
1143 maxX = tMax->GetMeanPosition().X();
1144 maxZ = tMax->GetMeanPosition().Z();
1150 sMaxX = 0, sMaxY = 0, sMaxZ = 0;
1151 tSecondMax = fInputTrackEvent->GetSecondMaxEnergyTrack(
"X");
1152 if (tSecondMax !=
nullptr) {
1153 sMaxX = tSecondMax->GetMeanPosition().X();
1154 sMaxZ = tSecondMax->GetMeanPosition().Z();
1160 if (sMaxX != 0) dX = abs(maxX - sMaxX);
1161 if (sMaxZ != 0) dZ = abs(maxZ - sMaxZ);
1163 if (dX != 0 || dY != 0 || dZ != 0) dXZ = TMath::Sqrt(dX * dX + dZ * dZ);
1168 maxX = 0, maxY = 0, maxZ = 0;
1169 dX = 0, dY = 0, dZ = 0;
1171 tMax = fInputTrackEvent->GetMaxEnergyTrack(
"Y");
1172 if (tMax !=
nullptr) {
1173 maxY = tMax->GetMeanPosition().Y();
1174 maxZ = tMax->GetMeanPosition().Z();
1180 sMaxX = 0, sMaxY = 0, sMaxZ = 0;
1181 tSecondMax = fInputTrackEvent->GetSecondMaxEnergyTrack(
"Y");
1182 if (tSecondMax !=
nullptr) {
1183 sMaxY = tSecondMax->GetMeanPosition().Y();
1184 sMaxZ = tSecondMax->GetMeanPosition().Z();
1190 if (sMaxY != 0) dY = abs(maxY - sMaxY);
1191 if (sMaxZ != 0) dZ = abs(maxZ - sMaxZ);
1193 if (dX != 0 || dY != 0 || dZ != 0) dYZ = TMath::Sqrt(dY * dY + dZ * dZ);
1196 Double_t dXZ_YZ = 0.5 * TMath::Sqrt(dYZ * dYZ + dXZ * dXZ);
1200 Double_t x = 0, y = 0, z = 0;
1202 if (tXYZ !=
nullptr) {
1203 x = tXYZ->GetMeanPosition().X();
1204 y = tXYZ->GetMeanPosition().Y();
1205 z = tXYZ->GetMeanPosition().Z();
1209 if (tX !=
nullptr) {
1210 x = tX->GetMeanPosition().X();
1211 zxz += tX->GetMeanPosition().Z();
1214 if (tY !=
nullptr) {
1215 y = tY->GetMeanPosition().Y();
1216 zxz += tY->GetMeanPosition().Z();
1220 z = i == 0 ? i : zxz / i;
1232 Double_t evTimeDelay = 0;
1233 if (fPreviousEventTime.size() > 0) evTimeDelay = fInputTrackEvent->GetTime() - fPreviousEventTime.back();
1236 Double_t meanRate = 0;
1237 if (fPreviousEventTime.size() == 100)
1238 meanRate = 100. / (fInputTrackEvent->GetTime() - fPreviousEventTime.front());
1242 if (nTracksX < fNTracksXCut.X() || nTracksX > fNTracksXCut.Y())
return nullptr;
1243 if (nTracksY < fNTracksYCut.X() || nTracksY > fNTracksYCut.Y())
return nullptr;
1248 return fOutputTrackEvent;