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]); }
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]); }
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]); }