{
// This example plots a vector and accumulates a histogram of the values// of this vector.// Only the part of the vector that corresponds to the interesting part// are plotted (a peak at the beginning of the frames)// The histogram is accumulated for nframmax frames// To see the result of this macro, click here
gROOT->Reset();
gBenchmark->Start("scroll2");
FrameH* fr;
Double_t time;
// Max number of frames displayedInt_t nframmax = 14;
// Open a new window (canvas) and divide it by 2
c1 = new TCanvas("c1","c1",1);
c1->Divide(2,1);
c1_1->SetFillColor(44);
c1_1->SetFrameFillColor(41);
c1_2->SetFillColor(44);
c1_2->SetFrameFillColor(41);
c1_2->SetLogy();
c1_2->SetGridx();
c1_2->SetGridy();
// Open a frame channel
fc = new VFrameChannel("demoDB.root");
// Start time
time = 600000000.1;
// Histogram to constrain the limits
hisfr = new TH1F("hisfr","Histogram of MYGO_Seis values",100,0.,3000.);
hisfr->SetMarkerColor(4);
hisfr->SetMarkerStyle(8);
hisfr->SetMarkerSize(0.7);
// Get the first frame
fr = fc->GetFrame(time);
Int_t nfram = 0;
while ( (fr!=0) && (nfram<nframmax) ) {
nfram++;
printf("nfram = %dn",nfram);
// Draws the vector (only in the signal region)
c1->cd(1);
gVM->Draw(fr,"adc.MYGO_ADC1",0.13,0.07);
// Get the corresponding VSPlot and set the color to blueVSPlot* vfp = gVM->GetLastPlot();
vfp->SetLineColor(4);
// Fill the histogram (accumulates it) and draw it// the + option in front of the name of the histogram// means that it's content is not erased before each fill
c1->cd(2);
gVM->DrawHist(fr,"adc.MYGO_ADC1",0.13,0.07,"+hisfr","e1");
// Update the canvas
gPad->Update();
FrameFree(fr);
fr = fc->GetNextFrame(); // Get the next frame
}
// Fits the histogram and draws the fit result
hisfr->Fit("gaus");
hisfr->SetMarkerColor(4);
hisfr->SetMarkerStyle(8);
hisfr->SetMarkerSize(0.7);
hisfr->Draw("e1");
gBenchmark->Show("scroll2");
}
- ROOT page - VEGA page - Class index - Top of the page This page has been automatically generated. If you have any comments or suggestions
about the page layout send a mail to
, or
contact
with any questions or problems regarding ROOT or VEGA.