36 #include <TObjString.h> 40 #define DETECTOR_TAG_FORWARD 0 41 #define DETECTOR_TAG_BACKWARD 1 65 for (UInt_t i=0; i<
fAddT0.size(); i++)
87 for (UInt_t i=0; i<
fAddT0.size(); i++)
107 if ((idx < 0) || (idx >= static_cast<Int_t>(
fRawRunData.size())))
147 if (idx >=
fT0.size())
170 return fAddT0[idx].size();
188 if (addRunIdx >=
fAddT0.size())
191 if (idx >=
fAddT0[addRunIdx].size())
194 return fAddT0[addRunIdx][idx];
208 if (idx >=
fT0.size())
226 if (addRunIdx >=
fAddT0.size())
227 fAddT0.resize(addRunIdx+1);
229 if (idx >=
fAddT0[addRunIdx].size())
230 fAddT0[addRunIdx].resize(idx+1);
232 fAddT0[addRunIdx][idx] = val;
298 str +=
", msr runNo = ";
304 if (rawRunData ==
nullptr) {
310 std::cerr << std::endl <<
">> PMusrT0::PMusrT0: **ERROR** found histogram number " << histoNo+1 <<
" which is NOT present in the data file.";
311 std::cerr << std::endl <<
">> Please try to fix this first ..." << std::endl;
315 Int_t noOfBins = rawRunData->
GetDataBin(histoNo)->size();
316 Double_t start = -0.5;
317 Double_t end = noOfBins - 0.5;
318 fHisto = std::make_unique<TH1F>(
"fHisto", str.Data(), noOfBins, start, end);
319 fHisto->SetMarkerStyle(21);
320 fHisto->SetMarkerSize(0.5);
321 fHisto->SetMarkerColor(TColor::GetColor(0,0,0));
323 Double_t maxVal = 0.0;
325 for (UInt_t i=0; i<rawRunData->
GetDataBin(histoNo)->size(); i++) {
327 if (rawRunData->
GetDataBin(histoNo)->at(i) > maxVal) {
328 maxVal = rawRunData->
GetDataBin(histoNo)->at(i);
335 str +=
" forward grouped and runs added";
337 str +=
" backward grouped and runs added";
338 str +=
", msr runNo = ";
343 if (rawRunData ==
nullptr) {
350 Int_t noOfBins = rawRunData->
GetDataBin(histoNo)->size();
351 Double_t start = -0.5;
352 Double_t end = noOfBins - 0.5;
353 fHisto = std::make_unique<TH1F>(
"fHisto", str.Data(), noOfBins, start, end);
354 fHisto->SetMarkerStyle(21);
355 fHisto->SetMarkerSize(0.5);
356 fHisto->SetMarkerColor(TColor::GetColor(0,0,0));
376 for (Int_t i=0; i<noOfBins; i++) {
394 if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->
GetDataBin(histoNo)->size())))
395 dval += rawRunData->
GetDataBin(histoNo)->at(i+t0-t00);
408 if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->
GetDataBin(histoNo)->size())))
409 dval += rawRunData->
GetDataBin(histoNo)->at(i+t0-t00);
413 fHisto->SetBinContent(i+1, dval);
418 for (Int_t i=0; i<noOfBins; i++) {
434 if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->
GetDataBin(histoNo)->size())))
435 dval += rawRunData->
GetDataBin(histoNo)->at(i+t0-t00);
449 if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->
GetDataBin(histoNo)->size())))
450 dval += rawRunData->
GetDataBin(histoNo)->at(i+t0-t00);
453 fHisto->SetBinContent(i+1, dval);
458 for (Int_t i=0; i<noOfBins; i++) {
476 if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->
GetDataBin(histoNo)->size())))
477 dval += rawRunData->
GetDataBin(histoNo)->at(i+t0-t00);
481 fHisto->SetBinContent(i+1, dval);
488 fMainCanvas = std::make_unique<TCanvas>(
"fMainCanvas", str);
489 fMainCanvas->SetFillColor(TColor::GetColor(255,255,255));
494 fMainCanvas->Connect(
"ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
"PMusrT0",
495 this,
"HandleCmdKey(Int_t,Int_t,Int_t,TObject*)");
496 fMainCanvas->Connect(
"Closed()",
"PMusrT0",
this,
"Quit()");
512 fHisto->Draw(
"p0 9 hist");
515 str =
"please set t0 bin only.";
521 fToDoInfo->DrawLatex(0.1, 0.91, str.Data());
524 str =
"please set data and bkg range.";
530 fToDoInfo->DrawLatex(0.1, 0.91, str.Data());
542 Emit(
"Done(Int_t)",
status);
571 if (event != kKeyPress) {
581 }
else if (x ==
'Q') {
584 }
else if (x ==
'u') {
586 }
else if (x ==
'z') {
588 }
else if (x ==
's') {
594 }
else if (x ==
'T') {
596 }
else if (x ==
't') {
598 }
else if (x ==
'b') {
600 }
else if (x ==
'B') {
602 }
else if (x ==
'd') {
604 }
else if (x ==
'D') {
639 fTimeoutTimer->Connect(
"Timeout()",
"PMusrT0",
this,
"Quit()");
676 else if (addRunIdx > 0)
682 else if (addRunIdx > 0)
689 Double_t max =
fHisto->GetMaximum();
691 fT0Line = std::make_unique<TLine>((Double_t)t0Bin, 0.0, (Double_t)t0Bin, max);
693 fT0Line->SetLineColor(TColor::GetColor(0,255,0));
724 fData = std::make_unique<TH1F>(
"fData",
"fData", noOfBins, start, end);
725 fData->SetMarkerStyle(21);
726 fData->SetMarkerSize(0.5);
727 fData->SetMarkerColor(TColor::GetColor(0,0,255));
729 for (Int_t i=0; i<noOfBins; i++) {
732 fData->Draw(
"p0 9 hist same");
752 fBkg = std::make_unique<TH1F>(
"fBkg",
"fBkg", noOfBins, start, end);
753 fBkg->SetMarkerStyle(21);
754 fBkg->SetMarkerSize(0.5);
755 fBkg->SetMarkerColor(TColor::GetColor(255,0,0));
757 for (Int_t i=0; i<noOfBins; i++) {
760 fBkg->Draw(
"p0 9 hist same");
763 Double_t max =
fHisto->GetMaximum();
804 Double_t max =
fHisto->GetMaximum();
807 fT0DataLine = std::make_unique<TLine>(
static_cast<Double_t
>(t0Bin), 0.0, static_cast<Double_t>(t0Bin), max);
846 Int_t binx =
fHisto->GetXaxis()->FindFixBin(x) - 1;
848 std::cout << std::endl <<
">> PMusrT0::SetT0Channel(): t0 = " << binx << std::endl;
905 std::cout << std::endl <<
">> PMusrT0::SetEstimatedT0Channel(): estimated t0 = " <<
fT0Estimated << std::endl;
932 std::cout << std::endl <<
">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " <<
fDataRange[0] << std::endl;
948 fData.reset(
new TH1F(
"fData",
"fData", noOfBins, start, end));
949 fData->SetMarkerStyle(21);
950 fData->SetMarkerSize(0.5);
951 fData->SetMarkerColor(TColor::GetColor(0,0,255));
952 for (Int_t i=0; i<noOfBins; i++) {
955 fData->Draw(
"p0 9 hist same");
978 std::cout << std::endl <<
">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " <<
fDataRange[1] << std::endl;
994 fData.reset(
new TH1F(
"fData",
"fData", noOfBins, start, end));
995 fData->SetMarkerStyle(21);
996 fData->SetMarkerSize(0.5);
997 fData->SetMarkerColor(TColor::GetColor(0,0,255));
998 for (Int_t i=0; i<noOfBins; i++) {
1001 fData->Draw(
"p0 9 hist same");
1024 std::cout << std::endl <<
">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " <<
fBkgRange[0] << std::endl;
1040 fBkg.reset(
new TH1F(
"fBkg",
"fBkg", noOfBins, start, end));
1041 fBkg->SetMarkerStyle(21);
1042 fBkg->SetMarkerSize(0.5);
1043 fBkg->SetMarkerColor(TColor::GetColor(255,0,0));
1044 for (Int_t i=0; i<noOfBins; i++) {
1047 fBkg->Draw(
"p0 9 hist same");
1070 std::cout << std::endl <<
">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " <<
fBkgRange[1] << std::endl;
1086 fBkg.reset(
new TH1F(
"fBkg",
"fBkg", noOfBins, start, end));
1087 fBkg->SetMarkerStyle(21);
1088 fBkg->SetMarkerSize(0.5);
1089 fBkg->SetMarkerColor(TColor::GetColor(255,0,0));
1090 for (Int_t i=0; i<noOfBins; i++) {
1093 fBkg->Draw(
"p0 9 hist same");
1107 fHisto->GetXaxis()->UnZoom();
1108 fHisto->GetYaxis()->UnZoom();
1125 const Int_t range = 75;
1128 Double_t t0x =
fT0Line->GetX1();
1129 Int_t t0 =
fHisto->GetXaxis()->FindBin(t0x)-1;
1131 Int_t min = t0 - range;
1132 Int_t max = t0 + range;
1147 fHisto->GetXaxis()->SetRangeUser(min, max);
void SetDataLastChannel()
std::unique_ptr< TCanvas > fMainCanvas
main canvas for the graphical user interface
Int_t fPx
x-position of the cursor
std::unique_ptr< TLine > fT0Line
line showing the position of t0
Int_t fTimeout
timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place ...
virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
virtual void InitDataAndBkg()
std::vector< PRawRunData * > fRawRunData
holds the raw data of the needed runs, idx=0 the run, idx>0 the addruns
Int_t fRunNo
msr-file run number
virtual Bool_t IsSingleHisto()
Int_t fPy
y-position of the cursor
virtual Int_t GetCmdTag()
virtual Int_t GetDetectorTag()
virtual void SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
Bool_t fDataAndBkgEnabled
enable/disable data and background range handling (necessary in connection with grouping and addrun) ...
void SetBkgFirstChannel()
std::unique_ptr< TTimer > fTimeoutTimer
timeout timer in order to terminate if no action is taking place for too long
void SetEstimatedT0Channel()
#define PMUSRT0_GET_DATA_AND_BKG_RANGE
std::unique_ptr< TH1F > fData
ranged raw data histogram (first good bin, last good bin)
virtual void SetMsrT0Entry(UInt_t runNo, UInt_t idx, Double_t bin)
virtual UInt_t GetHistoNoSize()
virtual void SetT0Bin(UInt_t val, UInt_t idx)
PIntVector fHistoNo
msr-file histo numbers, i.e. idx + Red/Green offset
Bool_t fT0Enabled
enable/disable t0 handling (necessary in connection with grouping and addrun)
virtual UInt_t GetAddT0BinSize(UInt_t idx)
virtual void SetTimeout(Int_t timeout)
Int_t fAddRunIdx
msr-file addrun index
Bool_t fValid
true if raw data set are available, otherwise false
PMsrHandler * fMsrHandler
msr-file handler
virtual Int_t GetAddT0Bin(UInt_t addRunIdx, UInt_t idx)
virtual const Bool_t IsPresent(UInt_t histoNo)
virtual PMsrRunList * GetMsrRunList()
Bool_t fShowT0DataChannel
Int_t fHistoNoIdx
msr-file histo number index
std::unique_ptr< TH1F > fHisto
full raw data histogram
PMusrT0Data fMusrT0Data
raw muSR run data sets.
virtual void SetMsrHandler(PMsrHandler *msrHandler)
virtual Int_t GetT0BinData()
virtual UInt_t GetRawRunDataSize()
PIntVector fT0
holding the t0's of the run
virtual Int_t GetAddRunIdx()
virtual const TString * GetRunName()
virtual void SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoIdx, Double_t bin)
virtual void SetAddT0Bin(UInt_t val, UInt_t addRunIdx, UInt_t idx)
std::unique_ptr< TLine > fFirstDataLine
line showing the start of the data (first good data bin)
void SetDataFirstChannel()
std::unique_ptr< TLine > fT0DataLine
line showing the position of t0 found in the data file
Bool_t fSingleHisto
true if single histo fit, false for asymmetry fit
ClassImpQ(PMusrT0) PMusrT0
Int_t fT0Estimated
estimated t0 value (in bins)
Int_t fDetectorTag
detector tag. forward=0,backward=1
Int_t fT0Data
holding the t0 found in the current data set
Int_t fStatus
0=quit locally, i.e. only a single musrt0 raw data canvas will terminate but not the application...
void ShowDataFileT0Channel()
Int_t fDataRange[2]
data range (first good bin, last good bin)
std::unique_ptr< TLine > fLastDataLine
line showing the end of the data (last good data bin)
#define PMUSRT0_GET_T0_DATA_AND_BKG_RANGE
void HideDataFileT0Channel()
virtual PRawRunData * GetRawRunData(Int_t idx)
virtual void Done(Int_t status=0)
std::unique_ptr< TLine > fFirstBkgLine
line showing the start of the background
std::vector< PIntVector > fAddT0
holding the t0's of the addruns
virtual Int_t GetHistoNo(UInt_t idx)
virtual const PDoubleVector * GetDataBin(const UInt_t histoNo)
std::unique_ptr< TLine > fLastBkgLine
line showing the end of the background
virtual void SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
Int_t fCmdTag
command tag. 0=get t0, 1=get data-/bkg-range, 2=get t0, and data-/bkg-range
std::unique_ptr< TLatex > fToDoInfo
clear text user instruction string
virtual Int_t GetHistoNoIdx()
std::unique_ptr< TH1F > fBkg
histogram starting from 'bkg start' up to 'bkg end'
virtual Int_t GetT0Bin(UInt_t idx)
Int_t fBkgRange[2]
background range (first bkg bin, last bkg bin)