41 #include <TApplication.h> 42 #include <TSAXParser.h> 47 #include "git-revision.h" 62 std::cout << std::endl <<
"usage: musrt0 <msr-file> [{--getT0FromPromptPeak | -g} [<firstGoodBinOffset>]]";
63 std::cout << std::endl <<
" [--timeout <timeout>] | --show-dynamic-path | --version | --help";
64 std::cout << std::endl <<
" <msr-file>: msr input file";
65 std::cout << std::endl <<
" --getT0FromPromptPeak, -g with <firstGoodBinOffset>:";
66 std::cout << std::endl <<
" will, in non-interactive mode estimate the t0's from the prompt peak";
67 std::cout << std::endl <<
" and write it into the msr-file.";
68 std::cout << std::endl <<
" if <firstGoodBinOffset> is given, to first good bin will be t0+<firstGoodBinOffset>.";
69 std::cout << std::endl <<
" if no <firstGoodBinOffset> is given, only t0 will be set.";
70 std::cout << std::endl <<
" --timeout <timeout>: <timeout> given in seconds after which musrview terminates.";
71 std::cout << std::endl <<
" If <timeout> <= 0, no timeout will take place. Default <timeout> is 0.";
72 std::cout << std::endl;
73 std::cout << std::endl <<
" 'musrt0 <msr-file>' will execute musrt0";
74 std::cout << std::endl <<
" 'musrt0 <msr-file> --timeout 180' will execute musrt0, but terminate it after";
75 std::cout << std::endl <<
" 180 sec if not already done so.";
76 std::cout << std::endl <<
" 'musrt0' or 'musrt0 --help' will show this help";
77 std::cout << std::endl <<
" 'musrt0 --version' will print the musrt0 version";
78 std::cout << std::endl <<
" 'musrt0 --show-dynamic-path' dumps the dynamic search paths and exit.";
79 std::cout << std::endl << std::endl;
98 std::unique_ptr<PMusrT0> musrT0 = std::make_unique<PMusrT0>(data);
101 if (!musrT0->IsValid()) {
102 std::cerr << std::endl <<
">> musrt0 **ERROR** invalid item found! (idx=" << idx <<
")";
103 std::cerr << std::endl;
111 musrT0->SetMsrHandler(msrHandler);
119 musrT0->InitDataAndBkg();
123 musrT0->Connect(
"Done(Int_t)",
"TApplication", &app,
"Terminate(Int_t)");
126 Bool_t result =
true;
127 if (musrT0->GetStatus() >= 1)
133 musrT0->Disconnect(musrT0.get());
147 Double_t maxData = -999;
149 for (UInt_t i=0; i<data->size(); i++) {
150 if (data->at(i) > maxData) {
151 maxData = data->at(i);
176 Int_t
main(Int_t argc, Char_t *argv[])
178 Bool_t show_syntax =
false;
180 Bool_t success =
true;
181 Char_t filename[1024];
182 Bool_t getT0FromPromptPeak =
false;
183 Bool_t firstGoodBinOffsetPresent =
false;
184 Int_t firstGoodBinOffset = 0;
194 const char *dsp = gSystem->GetDynamicPath();
195 if (strstr(dsp,
"/usr/local/lib") ==
nullptr)
196 gSystem->AddDynamicPath(
"/usr/local/lib");
198 memset(filename,
'\0',
sizeof(filename));
199 for (
int i=1; i<argc; i++) {
200 if (!strcmp(argv[i],
"--version")) {
202 #ifdef HAVE_GIT_REV_H 203 std::cout << std::endl <<
"musrt0 version: " << PACKAGE_VERSION <<
", git-branch: " << GIT_BRANCH <<
", git-rev: " << GIT_CURRENT_SHA1 <<
" (" << BUILD_TYPE <<
"), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
205 std::cout << std::endl <<
"musrt0 version: " << PACKAGE_VERSION <<
" (" << BUILD_TYPE <<
"), ROOT version: " << ROOT_VERSION_USED << std::endl << std::endl;
208 #ifdef HAVE_GIT_REV_H 209 std::cout << std::endl <<
"musrt0 git-branch: " << GIT_BRANCH <<
", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
211 std::cout << std::endl <<
"musrt0 version: unknown." << std::endl << std::endl;
215 }
else if (!strcmp(argv[i],
"--help")) {
218 }
else if (!strcmp(argv[i],
"--show-dynamic-path")) {
219 std::cout << std::endl <<
"musrt0: internal dynamic search paths for shared libraries/root dictionaries:";
220 std::cout << std::endl <<
" '" << gSystem->GetDynamicPath() <<
"'" << std::endl << std::endl;
222 }
else if (strstr(argv[i],
".msr")) {
223 if (strlen(filename) == 0) {
224 strcpy(filename, argv[i]);
226 std::cout << std::endl <<
"**ERROR** only one file name allowed." << std::endl;
230 }
else if (!strcmp(argv[i],
"--getT0FromPromptPeak") || !strcmp(argv[i],
"-g")) {
231 getT0FromPromptPeak =
true;
233 TString offset(argv[i+1]);
234 if (offset.IsFloat()) {
235 firstGoodBinOffsetPresent =
true;
236 firstGoodBinOffset = offset.Atof();
240 }
else if (!strcmp(argv[i],
"--timeout")) {
242 TString numStr(argv[i+1]);
243 if (numStr.IsDigit()) {
246 std::cout << std::endl <<
"**ERROR** timeout '" << argv[i+1] <<
"' is not a number" << std::endl;
252 std::cout << std::endl <<
"**ERROR** no timeout given." << std::endl;
262 if (strlen(filename) == 0) {
263 std::cout << std::endl <<
"**ERROR** msr-file missing!" << std::endl;
274 std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
275 std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>();
276 if (!startupHandler->StartupFileFound()) {
277 std::cerr << std::endl <<
">> musrt0 **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
278 std::cerr << std::endl;
281 saxParser->ConnectToHandler(
"PStartupHandler", startupHandler.get());
288 std::cerr << std::endl <<
">> musrt0 **WARNING** Reading/parsing musrfit_startup.xml failed.";
289 std::cerr << std::endl;
294 std::unique_ptr<PMsrHandler> msrHandler = std::make_unique<PMsrHandler>(filename);
295 status = msrHandler->ReadMsrFile();
299 std::cout << std::endl <<
">> musrt0 **ERROR** couldn't find '" << filename <<
"'" << std::endl << std::endl;
302 std::cout << std::endl <<
"**SYNTAX ERROR** in file " << filename <<
", full stop here." << std::endl << std::endl;
305 std::cout << std::endl <<
"**UNKNOWN ERROR** when trying to read the msr-file" << std::endl << std::endl;
310 msrHandler->CopyMsrStatisticBlock();
313 PMsrRunList *runList = msrHandler->GetMsrRunList();
314 for (UInt_t i=0; i<runList->size(); i++) {
315 fitType = runList->at(i).GetFitType();
317 fitType = msrHandler->GetMsrGlobal()->GetFitType();
320 std::cout << std::endl <<
">> musrt0 **ERROR** t0 setting for NonMusr fit type doesn't make any sense, will quit ..." << std::endl;
327 std::unique_ptr<PRunDataHandler> dataHandler;
330 dataHandler = std::make_unique<PRunDataHandler>(msrHandler.get(), startupHandler->GetDataPathList());
332 dataHandler = std::make_unique<PRunDataHandler>(msrHandler.get());
334 dataHandler->ReadData();
336 success = dataHandler->IsAllDataAvailable();
338 std::cout << std::endl <<
">> musrt0 **ERROR** Couldn't read all data files, will quit ..." << std::endl;
342 if (getT0FromPromptPeak && success) {
346 TString *runName =
nullptr;
350 for (UInt_t i=0; i<runList->size(); i++) {
351 fitType = runList->at(i).GetFitType();
353 fitType = msrHandler->GetMsrGlobal()->GetFitType();
358 if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
360 histoNo = runList->at(i).GetForwardHistoNo();
361 runName = runList->at(i).GetRunName();
363 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
365 runList->at(i).SetT0Bin(t0Bin, 0);
367 if (firstGoodBinOffsetPresent) {
368 start = t0Bin + firstGoodBinOffset;
369 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
370 runList->at(i).SetDataRange(start, 0);
371 runList->at(i).SetDataRange(end, 1);
373 }
else if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
375 histoNo = runList->at(i).GetForwardHistoNo();
376 runName = runList->at(i).GetRunName();
378 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
380 runList->at(i).SetT0Bin(t0Bin, 0);
382 if (firstGoodBinOffsetPresent) {
383 start = t0Bin + firstGoodBinOffset;
384 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
385 runList->at(i).SetDataRange(start, 0);
386 runList->at(i).SetDataRange(end, 1);
389 for (UInt_t j=1; j<runList->at(i).GetRunNameSize(); j++) {
390 runName = runList->at(i).GetRunName(j);
392 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
394 runList->at(i).SetAddT0Bin(t0Bin, j-1, 0);
396 }
else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) {
397 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
399 histoNo = runList->at(i).GetForwardHistoNo(j);
400 runName = runList->at(i).GetRunName();
402 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
404 runList->at(i).SetT0Bin(t0Bin, j);
405 if (firstGoodBinOffsetPresent && (j==0)) {
406 start = t0Bin + firstGoodBinOffset;
407 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
408 runList->at(i).SetDataRange(start, 0);
409 runList->at(i).SetDataRange(end, 1);
413 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
415 histoNo = runList->at(i).GetForwardHistoNo(j);
416 runName = runList->at(i).GetRunName();
418 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
420 runList->at(i).SetT0Bin(t0Bin, j);
421 if (firstGoodBinOffsetPresent && (j==0)) {
422 start = t0Bin + firstGoodBinOffset;
423 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
424 runList->at(i).SetDataRange(start, 0);
425 runList->at(i).SetDataRange(end, 1);
428 for (UInt_t k=1; k<runList->at(i).GetRunNameSize(); k++) {
429 runName = runList->at(i).GetRunName(k);
431 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
433 runList->at(i).SetAddT0Bin(t0Bin, k-1, j);
439 if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
442 histoNo = runList->at(i).GetForwardHistoNo();
443 runName = runList->at(i).GetRunName();
445 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
447 runList->at(i).SetT0Bin(t0Bin, 0);
449 if (firstGoodBinOffsetPresent) {
450 start = t0Bin + firstGoodBinOffset;
451 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
452 runList->at(i).SetDataRange(start, 0);
453 runList->at(i).SetDataRange(end, 1);
457 histoNo = runList->at(i).GetBackwardHistoNo();
458 runName = runList->at(i).GetRunName();
460 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
462 runList->at(i).SetT0Bin(t0Bin, 1);
464 if (firstGoodBinOffsetPresent) {
465 start = t0Bin + firstGoodBinOffset;
466 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
467 runList->at(i).SetDataRange(start, 2);
468 runList->at(i).SetDataRange(end, 3);
470 }
else if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
473 histoNo = runList->at(i).GetForwardHistoNo();
474 runName = runList->at(i).GetRunName();
476 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
478 runList->at(i).SetT0Bin(t0Bin, 0);
480 if (firstGoodBinOffsetPresent) {
481 start = t0Bin + firstGoodBinOffset;
482 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
483 runList->at(i).SetDataRange(start, 0);
484 runList->at(i).SetDataRange(end, 1);
487 for (UInt_t j=1; j<runList->at(i).GetRunNameSize(); j++) {
488 runName = runList->at(i).GetRunName(j);
490 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
492 runList->at(i).SetAddT0Bin(t0Bin, j-1, 0);
496 histoNo = runList->at(i).GetBackwardHistoNo();
497 runName = runList->at(i).GetRunName();
499 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
501 runList->at(i).SetT0Bin(t0Bin, 1);
503 if (firstGoodBinOffsetPresent) {
504 start = t0Bin + firstGoodBinOffset;
505 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
506 runList->at(i).SetDataRange(start, 2);
507 runList->at(i).SetDataRange(end, 3);
510 for (UInt_t j=1; j<runList->at(i).GetRunNameSize(); j++) {
511 runName = runList->at(i).GetRunName(j);
513 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
515 runList->at(i).SetAddT0Bin(t0Bin, j-1, 1);
517 }
else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) {
519 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
521 histoNo = runList->at(i).GetForwardHistoNo(j);
522 runName = runList->at(i).GetRunName();
524 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
526 runList->at(i).SetT0Bin(t0Bin, 2*j);
527 if (firstGoodBinOffsetPresent && (j==0)) {
528 start = t0Bin + firstGoodBinOffset;
529 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
530 runList->at(i).SetDataRange(start, 0);
531 runList->at(i).SetDataRange(end, 1);
535 for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
537 histoNo = runList->at(i).GetBackwardHistoNo(j);
538 runName = runList->at(i).GetRunName();
540 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
542 runList->at(i).SetT0Bin(t0Bin, 2*j+1);
543 if (firstGoodBinOffsetPresent && (j==0)) {
544 start = t0Bin + firstGoodBinOffset;
545 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
546 runList->at(i).SetDataRange(start, 2);
547 runList->at(i).SetDataRange(end, 3);
552 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
554 histoNo = runList->at(i).GetForwardHistoNo(j);
555 runName = runList->at(i).GetRunName();
557 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
559 runList->at(i).SetT0Bin(t0Bin, 2*j);
560 if (firstGoodBinOffsetPresent && (j==0)) {
561 start = t0Bin + firstGoodBinOffset;
562 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
563 runList->at(i).SetDataRange(start, 0);
564 runList->at(i).SetDataRange(end, 1);
567 for (UInt_t k=1; k<runList->at(i).GetRunNameSize(); k++) {
568 runName = runList->at(i).GetRunName(k);
570 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
572 runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j);
576 for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
578 histoNo = runList->at(i).GetBackwardHistoNo(j);
579 runName = runList->at(i).GetRunName();
581 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
583 runList->at(i).SetT0Bin(t0Bin, 2*j+1);
584 if (firstGoodBinOffsetPresent && (j==0)) {
585 start = t0Bin + firstGoodBinOffset;
586 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
587 runList->at(i).SetDataRange(start, 2);
588 runList->at(i).SetDataRange(end, 3);
591 for (UInt_t k=1; k<runList->at(i).GetRunNameSize(); k++) {
592 runName = runList->at(i).GetRunName(k);
594 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
596 runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j+1);
602 if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
605 histoNo = runList->at(i).GetForwardHistoNo();
606 runName = runList->at(i).GetRunName();
608 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
610 runList->at(i).SetT0Bin(t0Bin, 0);
612 if (firstGoodBinOffsetPresent) {
613 start = t0Bin + firstGoodBinOffset;
614 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
615 runList->at(i).SetDataRange(start, 0);
616 runList->at(i).SetDataRange(end, 1);
620 histoNo = runList->at(i).GetBackwardHistoNo();
621 runName = runList->at(i).GetRunName();
623 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
625 runList->at(i).SetT0Bin(t0Bin, 1);
627 if (firstGoodBinOffsetPresent) {
628 start = t0Bin + firstGoodBinOffset;
629 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
630 runList->at(i).SetDataRange(start, 2);
631 runList->at(i).SetDataRange(end, 3);
633 }
else if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
636 histoNo = runList->at(i).GetForwardHistoNo();
637 runName = runList->at(i).GetRunName();
639 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
641 runList->at(i).SetT0Bin(t0Bin, 0);
643 if (firstGoodBinOffsetPresent) {
644 start = t0Bin + firstGoodBinOffset;
645 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
646 runList->at(i).SetDataRange(start, 0);
647 runList->at(i).SetDataRange(end, 1);
650 for (UInt_t j=1; j<runList->at(i).GetRunNameSize(); j++) {
651 runName = runList->at(i).GetRunName(j);
653 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
655 runList->at(i).SetAddT0Bin(t0Bin, j-1, 0);
659 histoNo = runList->at(i).GetBackwardHistoNo();
660 runName = runList->at(i).GetRunName();
662 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
664 runList->at(i).SetT0Bin(t0Bin, 1);
666 if (firstGoodBinOffsetPresent) {
667 start = t0Bin + firstGoodBinOffset;
668 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
669 runList->at(i).SetDataRange(start, 2);
670 runList->at(i).SetDataRange(end, 3);
673 for (UInt_t j=1; j<runList->at(i).GetRunNameSize(); j++) {
674 runName = runList->at(i).GetRunName(j);
676 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
678 runList->at(i).SetAddT0Bin(t0Bin, j-1, 1);
680 }
else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) {
682 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
684 histoNo = runList->at(i).GetForwardHistoNo(j);
685 runName = runList->at(i).GetRunName();
687 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
689 runList->at(i).SetT0Bin(t0Bin, 2*j);
690 if (firstGoodBinOffsetPresent && (j==0)) {
691 start = t0Bin + firstGoodBinOffset;
692 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
693 runList->at(i).SetDataRange(start, 0);
694 runList->at(i).SetDataRange(end, 1);
698 for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
700 histoNo = runList->at(i).GetBackwardHistoNo(j);
701 runName = runList->at(i).GetRunName();
703 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
705 runList->at(i).SetT0Bin(t0Bin, 2*j+1);
706 if (firstGoodBinOffsetPresent && (j==0)) {
707 start = t0Bin + firstGoodBinOffset;
708 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
709 runList->at(i).SetDataRange(start, 2);
710 runList->at(i).SetDataRange(end, 3);
715 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
717 histoNo = runList->at(i).GetForwardHistoNo(j);
718 runName = runList->at(i).GetRunName();
720 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
722 runList->at(i).SetT0Bin(t0Bin, 2*j);
723 if (firstGoodBinOffsetPresent && (j==0)) {
724 start = t0Bin + firstGoodBinOffset;
725 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
726 runList->at(i).SetDataRange(start, 0);
727 runList->at(i).SetDataRange(end, 1);
730 for (UInt_t k=1; k<runList->at(i).GetRunNameSize(); k++) {
731 runName = runList->at(i).GetRunName(k);
733 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
735 runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j);
739 for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
741 histoNo = runList->at(i).GetBackwardHistoNo(j);
742 runName = runList->at(i).GetRunName();
744 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
746 runList->at(i).SetT0Bin(t0Bin, 2*j+1);
747 if (firstGoodBinOffsetPresent && (j==0)) {
748 start = t0Bin + firstGoodBinOffset;
749 end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
750 runList->at(i).SetDataRange(start, 2);
751 runList->at(i).SetDataRange(end, 3);
754 for (UInt_t k=1; k<runList->at(i).GetRunNameSize(); k++) {
755 runName = runList->at(i).GetRunName(k);
757 t0Bin =
musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
759 runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j+1);
782 TApplication app(
"App", &argc, argv);
785 std::vector<PRawRunData*> rawRunData;
789 for (UInt_t i=0; i<runList->size(); i++) {
790 fitType = runList->at(i).GetFitType();
792 fitType = msrHandler->GetMsrGlobal()->GetFitType();
798 if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
803 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
806 if (rawRunData[0]->IsPresent(runList->at(i).GetForwardHistoNo(0))) {
807 musrT0Data.
SetT0BinData((UInt_t)rawRunData[0]->GetT0Bin(runList->at(i).GetForwardHistoNo(0)));
812 forwardHistos.clear();
813 forwardHistos.push_back(runList->at(i).GetForwardHistoNo(0));
822 if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
828 forwardHistos.clear();
829 forwardHistos.push_back(runList->at(i).GetForwardHistoNo(0));
834 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
835 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
837 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
839 if (rawRunData[j]->IsPresent(runList->at(i).GetForwardHistoNo(0))) {
840 musrT0Data.
SetT0BinData((UInt_t)rawRunData[j]->GetT0Bin(runList->at(i).GetForwardHistoNo(0)));
848 }
else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) {
853 forwardHistos.clear();
854 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++)
855 forwardHistos.push_back(runList->at(i).GetForwardHistoNo(j));
860 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
863 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
865 if (rawRunData[0]->IsPresent(runList->at(i).GetForwardHistoNo(j))) {
866 musrT0Data.
SetT0BinData((UInt_t)rawRunData[0]->GetT0Bin(runList->at(i).GetForwardHistoNo(j)));
879 forwardHistos.clear();
880 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++)
881 forwardHistos.push_back(runList->at(i).GetForwardHistoNo(j));
886 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
887 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
889 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
891 for (UInt_t k=0; k<runList->at(i).GetForwardHistoNoSize(); k++) {
893 if (rawRunData[j]->IsPresent(runList->at(i).GetForwardHistoNo(k))) {
894 musrT0Data.
SetT0BinData((UInt_t)rawRunData[j]->GetT0Bin(runList->at(i).GetForwardHistoNo(k)));
907 for (UInt_t j=0; j<runList->at(i).GetT0BinSize(); j++) {
908 musrT0Data.
SetT0Bin((UInt_t)runList->at(i).GetT0Bin(j), j);
909 for (UInt_t k=0; k<runList->at(i).GetAddT0BinEntries(); k++) {
910 musrT0Data.
SetAddT0Bin((UInt_t)runList->at(i).GetAddT0Bin(k, j), k, j);
921 if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
926 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
929 if (rawRunData[0]->IsPresent(runList->at(i).GetForwardHistoNo(0))) {
930 musrT0Data.
SetT0BinData((UInt_t)rawRunData[0]->GetT0Bin(runList->at(i).GetForwardHistoNo(0)));
935 forwardHistos.clear();
936 forwardHistos.push_back(runList->at(i).GetForwardHistoNo(0));
948 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
951 if (rawRunData[0]->IsPresent(runList->at(i).GetForwardHistoNo(0))) {
952 musrT0Data.
SetT0BinData((UInt_t)rawRunData[0]->GetT0Bin(runList->at(i).GetForwardHistoNo(0)));
957 backwardHistos.clear();
958 backwardHistos.push_back(runList->at(i).GetBackwardHistoNo(0));
968 if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) {
974 forwardHistos.clear();
975 forwardHistos.push_back(runList->at(i).GetForwardHistoNo(0));
980 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
981 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
983 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
985 if (rawRunData[j]->IsPresent(runList->at(i).GetForwardHistoNo(0))) {
986 musrT0Data.
SetT0BinData((UInt_t)rawRunData[j]->GetT0Bin(runList->at(i).GetForwardHistoNo(0)));
999 backwardHistos.clear();
1000 backwardHistos.push_back(runList->at(i).GetBackwardHistoNo(0));
1005 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
1006 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
1008 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
1010 if (rawRunData[j]->IsPresent(runList->at(i).GetForwardHistoNo(0))) {
1011 musrT0Data.
SetT0BinData((UInt_t)rawRunData[j]->GetT0Bin(runList->at(i).GetForwardHistoNo(0)));
1019 }
else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) {
1024 forwardHistos.clear();
1025 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++)
1026 forwardHistos.push_back(runList->at(i).GetForwardHistoNo(j));
1031 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
1034 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
1036 if (rawRunData[0]->IsPresent(runList->at(i).GetForwardHistoNo(j))) {
1037 musrT0Data.
SetT0BinData((UInt_t)rawRunData[0]->GetT0Bin(runList->at(i).GetForwardHistoNo(j)));
1049 backwardHistos.clear();
1050 for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++)
1051 backwardHistos.push_back(runList->at(i).GetBackwardHistoNo(j));
1056 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
1059 for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
1061 if (rawRunData[0]->IsPresent(runList->at(i).GetForwardHistoNo(j))) {
1062 musrT0Data.
SetT0BinData((UInt_t)rawRunData[0]->GetT0Bin(runList->at(i).GetForwardHistoNo(j)));
1075 forwardHistos.clear();
1076 for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++)
1077 forwardHistos.push_back(runList->at(i).GetForwardHistoNo(j));
1082 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
1083 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
1085 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
1087 for (UInt_t k=0; k<runList->at(i).GetForwardHistoNoSize(); k++) {
1089 if (rawRunData[j]->IsPresent(runList->at(i).GetForwardHistoNo(k))) {
1090 musrT0Data.
SetT0BinData((UInt_t)rawRunData[j]->GetT0Bin(runList->at(i).GetForwardHistoNo(k)));
1103 backwardHistos.clear();
1104 for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++)
1105 backwardHistos.push_back(runList->at(i).GetBackwardHistoNo(j));
1110 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
1111 rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
1113 for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
1115 for (UInt_t k=0; k<runList->at(i).GetBackwardHistoNoSize(); k++) {
1117 if (rawRunData[j]->IsPresent(runList->at(i).GetForwardHistoNo(k))) {
1118 musrT0Data.
SetT0BinData((UInt_t)rawRunData[j]->GetT0Bin(runList->at(i).GetForwardHistoNo(k)));
1131 for (UInt_t j=0; j<runList->at(i).GetT0BinSize(); j++) {
1132 musrT0Data.
SetT0Bin((UInt_t)runList->at(i).GetT0Bin(j), j);
1133 for (UInt_t k=0; k<runList->at(i).GetAddT0BinEntries(); k++) {
1134 musrT0Data.
SetAddT0Bin((UInt_t)runList->at(i).GetAddT0Bin(k, j), k, j);
1155 forwardHistos.clear();
1156 backwardHistos.clear();
1161 msrHandler->WriteMsrLogFile(
false);
1165 gSystem->CopyFile(filename,
"__temp.msr", kTRUE);
1167 TString fln = TString(filename);
1169 strcpy(ext,
".mlog");
1170 fln.ReplaceAll(
".msr", 4, ext, strlen(ext));
1171 gSystem->CopyFile(fln.Data(), filename, kTRUE);
1173 gSystem->CopyFile(
"__temp.msr", fln.Data(), kTRUE);
1175 gSystem->Exec(
"rm __temp.msr");
std::vector< PMsrRunBlock > PMsrRunList
#define MSR_FITTYPE_SINGLE_HISTO_RRF
virtual Int_t GetCmdTag()
#define MSR_FITTYPE_SINGLE_HISTO
Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data, UInt_t idx, Int_t timeout)
int parseXmlFile(TSAXParser *, const char *)
#define PMUSRT0_GET_DATA_AND_BKG_RANGE
#define PMUSR_MSR_FILE_NOT_FOUND
virtual void SetT0Bin(UInt_t val, UInt_t idx)
std::vector< Int_t > PIntVector
std::vector< Double_t > PDoubleVector
virtual void SetDetectorTag(const UInt_t detectorTag)
virtual void SetT0BinData(UInt_t val)
#define MSR_FITTYPE_NON_MUSR
virtual void SetRunNo(const UInt_t runNo)
const char * startup_path_name
virtual void SetCmdTag(const UInt_t cmdTag)
Int_t musrt0_getMaxBin(const PDoubleVector *data)
virtual void SetAddT0Bin(UInt_t val, UInt_t addRunIdx, UInt_t idx)
virtual void SetSingleHisto(const Bool_t flag)
#define MSR_FITTYPE_MU_MINUS
#define PMUSR_MSR_SYNTAX_ERROR
virtual void SetHistoNoIdx(const UInt_t histoNoIdx)
#define PMUSR_WRONG_STARTUP_SYNTAX
virtual void SetRawRunData(const std::vector< PRawRunData *> rawRunData)
#define PMUSRT0_GET_T0_DATA_AND_BKG_RANGE
Int_t main(Int_t argc, Char_t *argv[])
#define MSR_FITTYPE_ASYM_RRF
virtual void SetHistoNo(const PIntVector histoNo)
virtual void SetAddRunIdx(const UInt_t addRunIdx)