draw_BadNormt.C

Go to the documentation of this file.
00001 //_____________________________________________________________________________
00002 int count(TH2* h)
00003 {
00004   int n = 0;
00005 
00006   for ( int ix = 1; ix <= h->GetXaxis()->GetNbins(); ++ix ) 
00007     {
00008       for ( int iy = 1; iy <= h->GetYaxis()->GetNbins(); ++iy ) 
00009         {
00010           if ( h->GetCellContent(ix,iy) )
00011             {
00012               ++n;
00013             }
00014         }
00015     }
00016 
00017   return n;
00018 }
00019 
00020 //_____________________________________________________________________________
00021 void drawlines(int nx, int ny)
00022 {
00023   const int solid=1;
00024   const int dotdot=3;
00025 
00026   for ( int ix=1; ix < nx; ++ix ) 
00027     {
00028       TLine* line = new TLine(ix-0.5,0,ix-0.5,ny-1);
00029       if ( ix%12== 0 )
00030         {
00031           line->SetLineStyle(solid);
00032         }
00033       else
00034         {
00035           line->SetLineStyle(dotdot);
00036         }
00037       line->Draw();
00038       for ( int iy=1; iy < ny; ++iy ) 
00039         {
00040           TLine* line = new TLine(0,iy-0.5,nx-1,iy-0.5);
00041           if ( iy%12== 0 )
00042             {
00043               line->SetLineStyle(solid);
00044             }
00045           else
00046             {
00047               line->SetLineStyle(dotdot);
00048             }
00049           line->Draw();
00050         }
00051     }
00052 }
00053 
00054 void draw_BadNormt(const char* file="/afs/rhic.bnl.gov/phenix/users/aphecetc/CALIB/Run4/BADNORMT/histos.root")
00055 {
00056   TGaxis::SetMaxDigits(7);
00057 
00058   TFile* f = new TFile(file);
00059   
00060   gStyle->SetPalette(1);
00061   gStyle->SetOptStat(0);
00062 
00063   const char* sectors[] = { "W0","W1","W2","W3","E2","E3" };
00064   TCanvas* canvas[7];
00065 
00066   for ( size_t i = 0; i < 6; ++i ) 
00067     {
00068       canvas[i] = new TCanvas(sectors[i],sectors[i]);
00069       TH2* h = (TH2*)(f->Get(sectors[i]));
00070       int n = count(h);
00071       cout << sectors[i] << " " << n << endl;
00072       ostringstream str;
00073       str << sectors[i] << " : " << n << " bad normt towers";
00074       h->SetTitle(str.str().c_str());
00075       h->Draw("COLZ");
00076       drawlines(72,36);
00077     }
00078 
00079   canvas[6] = new TCanvas("BadNormtPerRun","BadNormtPerRun");
00080   canvas[6]->Draw();
00081   TH2* h = new TH2F("h","Number of bad normt towers",
00082                     10,122213,123564,
00083                     10,220,245);
00084 
00085   h->Draw();
00086 
00087   TGraph* g = (TGraph*)(f->Get("NBADS"));
00088 
00089   g->SetMarkerStyle(20);
00090   g->SetMarkerSize(1.0);
00091   g->Draw("LP");
00092 
00093   for ( size_t i = 0; i < 7; ++i ) 
00094     {
00095       string name = canvas[i]->GetName();
00096       name += ".eps";
00097       canvas[i]->SaveAs(name.c_str());
00098     }
00099 }