本文整理汇总了C++中TTimer::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ TTimer::Reset方法的具体用法?C++ TTimer::Reset怎么用?C++ TTimer::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTimer
的用法示例。
在下文中一共展示了TTimer::Reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: wait
/************ wait funtion !! ***************************************************************
*********************************************************************************************/
void wait(){
TTimer *timer = new TTimer("gSystem->ProcessEvents();", 50, kFALSE);
char *input;
Bool_t done = kFALSE;
do{
timer->TurnOn();
timer->Reset();
input=Getline("Type <return> to continue : ");
timer->TurnOff();
if(input){ done =kTRUE; }
}while(!done);
}
示例3: 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]);
}
示例4: 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]);
}
示例5: calibraPlastico
void calibraPlastico(char* filename, int channel=4) {
FILE *outfile[2];
outfile[0] = fopen("Chi2_511","w");
outfile[1] = fopen("Chi2_1275","w");
Int_t number_of_loop=0;
Int_t i, j, k, i_sm, rsen[2];
Float_t r, alpha, energia;
Int_t b_altezza;
// energies
Float_t E_peak[NUMENERGIES];
Float_t E_compton[NUMENERGIES];
E_peak[0] = 511.;
E_peak[1] = 1275.;
for (i=0; i<NUMENERGIES; i++) {
E_compton[i] = 2*E_peak[i]*E_peak[i]/(511+2*E_peak[i]);
printf("E_compton[%d] = %f;\n",i,E_compton[i]);
}
TTimer *timer = new TTimer("gSystem->ProcessEvents();", 50, kFALSE);
TCanvas *c0 = new TCanvas("c0");
c0->cd();
h_ideal = new TH1F("h_ideal","Compton ideale",NBINS,0,MAXHISTONRG);
// check file existance
f_smearings = new TFile("smearings.root","UPDATE");
// check smearing samples existance
for(i=0; i<NUMENERGIES; i++) {
sprintf(smoothName,"smooth_%.1f_%d;1",E_peak[i],NSMEARINGS-2);
if (!f_smearings->Get(smoothName)) {
cout << smoothName << " " << f_smearings->FindObject(smoothName) << endl;
// smearing for that energy do not exist
printf("Non esistono.\n");
// ideal compton histogram
for (j=0; j<NBINS; j++) {
if (j>h_ideal->FindBin(50) && j<h_ideal->FindBin(E_compton[i])) {
r = h_ideal->GetBinCenter(j)/E_peak[i];
alpha = E_peak[i]/511.0;
energia = KN_NORM * (2+r*r/(alpha*alpha*(1-r)*(1-r))+r/(1-r) * (r-2/alpha));
h_ideal->SetBinContent(j,energia);
} else { h_ideal->SetBinContent(j,0); }
}
h_ideal->Draw();
c0->Update();
timer->TurnOn();
timer->Reset();
timer->TurnOff();
// creazione spettri smussati
for (i_sm=1; i_sm<NSMEARINGS; i_sm++) {
sprintf(smoothName,"smooth_%.1f_%d",E_peak[i],i_sm);
printf("Creo '%s': ",smoothName);
h_smooth = new TH1F(smoothName,"Smooth",NBINS,0,MAXHISTONRG); // istogramma in energia
for (j=1; j<h_ideal->FindBin(E_compton[i]); j++) {
b_altezza = h_ideal->GetBinContent(j);
for (k=1; k<b_altezza; k++){ h_smooth->Fill(gRandom->Gaus(h_ideal->GetBinCenter(j),i_sm)); } printf(".");
} printf("\n");
h_smooth->Write();
}
}
}
// ok, we've got the smearings!
f_smearings->Close();
f_smearings = new TFile("smearings.root","READ");
// ----------------------------------
// retrieving "raw" histogram
// ----------------------------------
TFile *infile = new TFile(filename);
TTree *tree= (TTree*)infile->Get("acq_tree_0");
TBranch *branch = tree->GetBranch(Form("acq_ch%d",channel));
branch->SetAddress(&inc_data.timetag);
TH1F *h_raw = new TH1F("h_raw","Acquisizione",NBINS,0,MAXHISTOCHN);
UInt_t toentry=branch->GetEntries();
printf("getHistoFromFile: There are %d entries in the branch\n",toentry);
for(i=0; i<toentry; i++) {
branch->GetEntry(i);
h_raw->Fill(inc_data.qlong);
}
h_raw->Draw();
TSpectrum *s = new TSpectrum(10);
Int_t e, nPeaks, bTemp, bFirstPeak = 9999;
Float_t *xPeaks;
// trovo il primo picco
nPeaks = s->Search(h_raw->Rebin(2, "h_raw_rebinned"));
if (nPeaks>0) {
xPeaks = s->GetPositionX();
// loop sui picchi per trovare il primo
for (i=0;i<nPeaks;i++) {
bTemp = h_raw->GetXaxis()->FindBin(xPeaks[i]);
if (bTemp<bFirstPeak) { bFirstPeak = bTemp; }
}
//.........这里部分代码省略.........