本文整理汇总了C++中TCanvas::SetCrosshair方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::SetCrosshair方法的具体用法?C++ TCanvas::SetCrosshair怎么用?C++ TCanvas::SetCrosshair使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::SetCrosshair方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VetoThres2
void VetoThres2(Int_t Lo, Int_t Hi)
{
TCanvas* Window;
TTimer* Refresh;
TH1F* Energy;
Char_t Buff[256];
Char_t* Keyb;
Double_t Pos[438];
Window = new TCanvas();
Window->SetCrosshair();
Window->ToggleEventStatus();
Refresh = new TTimer("Flush()", 50, kFALSE);
for(Int_t ch=Lo; ch<Hi+1; ch++)
{
sprintf(Buff, "Veto_Energy%d", ch);
Energy = (TH1F*)gROOT->FindObject(Buff);
Energy->GetXaxis()->SetRange(0, 250);
Energy->Draw();
Window->Update();
sprintf(Buff, "Threshold for %d: ", ch);
Refresh->TurnOn();
Refresh->Reset();
Keyb = Getline(Buff);
Refresh->TurnOff();
Pos[ch] = atof(Keyb);
}
for(Int_t ch=Lo; ch<Hi+1; ch++)
printf("%5.1f\n", Pos[ch]);
}
示例2: VetoEnergy2
void VetoEnergy2(Int_t Lo, Int_t Hi)
{
TCanvas* Window;
TTimer* Refresh;
TH1F* Energy;
Char_t Buff[256];
Char_t* Keyb;
Double_t Pos[438];
Double_t MaxVal;
Int_t MaxBin;
Int_t Start;
Window = new TCanvas();
Window->SetCrosshair();
Window->ToggleEventStatus();
Refresh = new TTimer("Flush()", 50, kFALSE);
for(Int_t ch=Lo; ch<Hi+1; ch++)
{
sprintf(Buff, "Veto_Energy%d", ch);
Energy = (TH1F*)gROOT->FindObject(Buff);
Energy->GetXaxis()->SetRange(0, 500);
Energy->Draw();
Window->Update();
sprintf(Buff, "Lower bound for %d: ", ch);
Refresh->TurnOn();
Refresh->Reset();
Keyb = Getline(Buff);
Refresh->TurnOff();
Start = atoi(Keyb);
MaxVal = 0.0;
Pos[ch] = 0.0;
for(Int_t bn=Start; bn<2048; bn++)
if(Energy->GetBinContent(bn) > MaxVal)
{
MaxVal = Energy->GetBinContent(bn);
Pos[ch] = 1.0*bn;
}
}
for(Int_t ch=Lo; ch<Hi+1; ch++)
printf("%4.0f\n", Pos[ch]);
}
示例3: VetoEnergy3
void VetoEnergy3(Int_t Lo, Int_t Hi)
{
TCanvas* Window;
TTimer* Refresh;
TH1F* Energy;
TF1* Fit;
Char_t Buff[256];
Char_t* Keyb;
Double_t Pos[438];
Double_t Lower;
Double_t Param[3];
Int_t OK;
Window = new TCanvas();
Window->SetCrosshair();
Window->ToggleEventStatus();
Refresh = new TTimer("Flush()", 50, kFALSE);
for(Int_t ch=Lo; ch<Hi+1; ch++)
{
sprintf(Buff, "Veto_Energy%d", ch);
Energy = (TH1F*)gROOT->FindObject(Buff);
Energy->Draw();
Window->Update();
Fit = new TF1("F1", "gaus", 0.7, 2.0);
Energy->Fit("F1", "RQ");
Fit->Draw("same");
Window->Update();
Fit->GetParameters(Param);
Refresh->TurnOn();
Refresh->Reset();
sprintf(Buff, "OK for %d? ", ch);
Keyb = Getline(Buff);
Refresh->TurnOff();
OK = atoi(Keyb);
if(OK) goto Done;
Refit:
Refresh->TurnOn();
Refresh->Reset();
sprintf(Buff, "Lower bound for %d: ", ch);
Keyb = Getline(Buff);
Refresh->TurnOff();
Lower = atof(Keyb);
Fit = new TF1("F1", "gaus", Lower, 2.0);
Energy->Fit("F1", "RQ");
Fit->Draw("same");
Window->Update();
Fit->GetParameters(Param);
Refresh->TurnOn();
Refresh->Reset();
sprintf(Buff, "OK for %d? ", ch);
Keyb = Getline(Buff);
Refresh->TurnOff();
OK = atoi(Keyb);
if(!OK) goto Refit;
Done:
Pos[ch] = Param[1];
}
for(Int_t ch=Lo; ch<Hi+1; ch++)
printf("%8.6f\n", Pos[ch]);
}