#include "TProfile.h" void fPlot_Zee_Mass_Pb( 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( "pbmon"); TPbMon* oPM = new TPbMon(); c1 = new TCanvas( "zee_mass_pb", "Zee mass per pb-1", 200, 10, 700, 500); c1->GetFrame()->SetBorderSize( 12); tree->SetBranchAddress( "PbMon", &oPM); nEntries = tree->GetEntries(); for ( nJentry = 0; nJentry < nEntries; nJentry++) { nNB = tree->GetEntry( nJentry); dX[ nNPT] = ( oPM->fMinRun + oPM->fMaxRun) / 2.; dY[ nNPT] = oPM->fZeeMass.fVal; dXE[ nNPT] = ( oPM->fMaxRun - oPM->fMinRun) / 2.; dYE[ nNPT] = oPM->fZeeMass.fErr; nNPT++; } oPlot = new TGraphErrors( nNPT, dX, dY,dXE,dYE); oPlot->SetTitle( "Zee mass vs time per pb-1"); oPlot->SetMarkerStyle( 20); oPlot->SetMarkerSize( 1.); oPlot->SetMaximum( 118.); oPlot->SetMinimum( 58.); oPlot->GetHistogram()->GetXaxis()->SetTitle("run number"); oPlot->Draw( "AP"); sprintf( cFile, "%s/zee_mass.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/zee_mass.1.gif", cPath); c1->Print( cFile); } c1->Close(); }