本文整理汇总了C++中TTimer::TurnOn方法的典型用法代码示例。如果您正苦于以下问题:C++ TTimer::TurnOn方法的具体用法?C++ TTimer::TurnOn怎么用?C++ TTimer::TurnOn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTimer
的用法示例。
在下文中一共展示了TTimer::TurnOn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: trial1
void trial1()
{
gStyle->SetCanvasPreferGL(true);
//gStyle->SetFrameFillColor(42);
TCanvas *c1=new TCanvas("can1");
//can1->SetFillColor(17);
f1=new TF1("f1","[0]*x",0,10);
f1->SetParameter(0,1);
//f1->SetNpx(10);
f1->SetMaximum(10);
f1->SetMinimum(0);
f1->Draw();
TTimer *timer = new TTimer(20);
timer->SetCommand("Animate()");
timer->TurnOn();
}
示例4: anim
void anim()
{
gStyle->SetFrameFillColor(42);
TCanvas *c1 = new TCanvas("c1");
c1->SetFillColor(17);
pi = TMath::Pi();
f2 = new TF2("f2","sin(2*x)*sin(2*y)*[0]",0,pi,0,pi);
f2->SetParameter(0,1);
f2->SetNpx(15);
f2->SetNpy(15);
f2->SetMaximum(1);
f2->SetMinimum(-1);
f2->Draw("surf1");
TTimer *timer = new TTimer(20);
timer->SetCommand("Animate()");
timer->TurnOn();
}
示例5: 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]);
}
示例6: shapesAnim
void shapesAnim() {
TCanvas *c1 = new TCanvas("c1","Geometry Shapes",10,10,500,500);
// Define some volumes
TBRIK *brik = new TBRIK("BRIK","BRIK","void",200,150,150);
TTRD1 *trd1 = new TTRD1("TRD1","TRD1","void",200,50,100,100);
TTRD2 *trd2 = new TTRD2("TRD2","TRD2","void",200,50,200,50,100);
TTRAP *trap = new TTRAP("TRAP","TRAP","void",190,0,0,60,40,90,15,120,80,180,15);
TPARA *para = new TPARA("PARA","PARA","void",100,200,200,15,30,30);
TGTRA *gtra = new TGTRA("GTRA","GTRA","void",390,0,0,20,60,40,90,15,120,80,180,15);
TTUBE *tube = new TTUBE("TUBE","TUBE","void",150,200,400);
TTUBS *tubs = new TTUBS("TUBS","TUBS","void",80,100,100,90,235);
TCONE *cone = new TCONE("CONE","CONE","void",100,50,70,120,150);
TCONS *cons = new TCONS("CONS","CONS","void",50,100,100,200,300,90,270);
TSPHE *sphe = new TSPHE("SPHE","SPHE","void",25,340, 45,135, 0,270);
TSPHE *sphe1 = new TSPHE("SPHE1","SPHE1","void",0,140, 0,180, 0,360);
TSPHE *sphe2 = new TSPHE("SPHE2","SPHE2","void",0,200, 10,120, 45,145);
TPCON *pcon = new TPCON("PCON","PCON","void",180,270,4);
pcon->DefineSection(0,-200,50,100);
pcon->DefineSection(1,-50,50,80);
pcon->DefineSection(2,50,50,80);
pcon->DefineSection(3,200,50,100);
TPGON *pgon = new TPGON("PGON","PGON","void",180,270,8,4);
pgon->DefineSection(0,-200,50,100);
pgon->DefineSection(1,-50,50,80);
pgon->DefineSection(2,50,50,80);
pgon->DefineSection(3,200,50,100);
// Set shapes attributes
brik->SetLineColor(1);
trd1->SetLineColor(2);
trd2->SetLineColor(3);
trap->SetLineColor(4);
para->SetLineColor(5);
gtra->SetLineColor(7);
tube->SetLineColor(6);
tubs->SetLineColor(7);
cone->SetLineColor(2);
cons->SetLineColor(3);
pcon->SetLineColor(6);
pgon->SetLineColor(2);
sphe->SetLineColor(kRed);
sphe1->SetLineColor(kBlack);
sphe2->SetLineColor(kBlue);
// Build the geometry hierarchy
TNode *node1 = new TNode("NODE1","NODE1","BRIK");
node1->cd();
TNode *node2 = new TNode("NODE2","NODE2","TRD1",0,0,-1000);
TNode *node3 = new TNode("NODE3","NODE3","TRD2",0,0,1000);
TNode *node4 = new TNode("NODE4","NODE4","TRAP",0,-1000,0);
TNode *node5 = new TNode("NODE5","NODE5","PARA",0,1000,0);
TNode *node6 = new TNode("NODE6","NODE6","TUBE",-1000,0,0);
TNode *node7 = new TNode("NODE7","NODE7","TUBS",1000,0,0);
TNode *node8 = new TNode("NODE8","NODE8","CONE",-300,-300,0);
TNode *node9 = new TNode("NODE9","NODE9","CONS",300,300,0);
TNode *node10 = new TNode("NODE10","NODE10","PCON",0,-1000,-1000);
TNode *node11 = new TNode("NODE11","NODE11","PGON",0,1000,1000);
TNode *node12 = new TNode("NODE12","NODE12","GTRA",0,-400,700);
TNode *node13 = new TNode("NODE13","NODE13","SPHE",10,-400,500);
TNode *node14 = new TNode("NODE14","NODE14","SPHE1",10, 250,300);
TNode *node15 = new TNode("NODE15","NODE15","SPHE2",10,-100,-200);
// Draw this geometry in the current canvas
node1->cd();
node1->Draw();
c1->Update();
//start a Timer
TTimer *timer = new TTimer(20);
timer->SetCommand("Animate()");
timer->TurnOn();
}
示例7: 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]);
}
示例8: 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; }
}
//.........这里部分代码省略.........