#include "TProfile.h" void fPlot_NWenu( const char* cFilename, const char* cPath) { Float_t dX[10000], dY[10000], dXE[10000], dYE[10000]; Int_t nEntries, nZoom = 1, nNB, nNPT = 0, nJentry; char cError[8], cFile[200]; TGraphErrors* oPlot; TFile* f = new TFile( cFilename); TTree* tree = (TTree*) f->Get( "physmon"); TPhysMon* oPM = new TPhysMon(); c1 = new TCanvas( "n_wenu", "N(Wenu events) per pb^{-1} vs run number", 200, 10, 700, 500); c1->GetFrame()->SetBorderSize( 12); tree->SetBranchAddress( "PhysMon", &oPM); nEntries = tree->GetEntries(); for ( nJentry = 0; nJentry < nEntries; nJentry++) { nNB = tree->GetEntry( nJentry); if( good_run( oPM->fRunNumber) && ( oPM->fLumiTape > 100.)) { dX[ nNPT] = oPM->fRunNumber; dY[ nNPT] = oPM->fNWenu / oPM->fLumiTape; dXE[ nNPT] = 0; dYE[ nNPT] = sqrt( oPM->fNWenu) / oPM->fLumiTape; nNPT++; } } oPlot = new TGraphErrors( nNPT, dX, dY,dXE,dYE); oPlot->SetTitle( "N(Wenu events) per pb^{-1} vs run number"); oPlot->SetMarkerStyle( 20); oPlot->SetMarkerSize( 1.); oPlot->SetMaximum( 9.); oPlot->SetMinimum( 0.); oPlot->GetHistogram()->GetXaxis()->SetTitle( "run number"); oPlot->Draw( "AP"); sprintf( cFile, "%s/n_Wenu.gif", cPath); c1->Print( cFile); if( nZoom){ c1->Clear(); oPlot->GetHistogram()->GetXaxis()->SetRangeUser( dX[ nNPT - 1] - 1000, dX[ nNPT - 1]); oPlot->Draw( "AP"); sprintf( cFile, "%s/n_Wenu.1.gif", cPath); c1->Print( cFile); } c1->Close(); }