ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RootMacros/rootlogon.C
(Generate patch)

Comparing UserCode/RootMacros/rootlogon.C (file contents):
Revision 1.1 by anderson, Sat Sep 6 18:58:12 2008 UTC vs.
Revision 1.3 by chawon, Thu Mar 11 07:13:25 2010 UTC

# Line 1 | Line 1
1   {
2 /* If a rootlogon.C file exists in the same
3  * directory as where ROOT is being started,
4  * all commands in it will be run first.
5  * Michael Anderson, July 2007
6  */
7
8 const char* defaultFileToOpen = "PhotonJet20-200.root";
9 //const char* defaultFileToOpen = "PhotonJet200-500.root";
10 //const char* defaultFileToOpen = "JetET110.root";
11 //const char* defaultFileToOpen = "single_electron.root";
12 //const char* defaultFileToOpen = "single_pi0.root";
13
14 gROOT->SetStyle("Plain");
15
16 // Change settings on plotting histograms
17 //gStyle->SetOptStat(111111);      // This will cause overflow and underflow to be shown
18 gStyle->SetOptFit();               // Show fitting values in legend
19 //gStyle->SetHistLineWidth(2);     // Set the line width to 2 pixels
20 //gStyle->SetTitleFontSize(0.035); // Shrink Histogram Title Size
21 //gStyle->SetPalette(1);           // Make 2D plots pretty ->Draw("colz")
22
23 // Load macros so that you can call them
24 //  from the command line within ROOT.
25 // Can load other scripts in other directories with something like:
26 //   G__loadfile("~/RootMacros/entryCount.C");
27 G__loadfile("~/RootMacros/entryCount.C");    // Counts entries in histograms
28 G__loadfile("~/RootMacros/PlotFromTTree.C"); // Plots from TTree into histogram
29 G__loadfile("~/RootMacros/Plot2hists1D.C");  // Plots 2 histograms onto same plot
30 G__loadfile("~/RootMacros/Plot3hists1D.C");  // Plots 3 histograms onto same plot
31 G__loadfile("~/RootMacros/Divide2hists1D.C");// Divides 2 histograms and plots result
32 G__loadfile("~/RootMacros/setAxes.C");       // Sets the x and y axis titles for 1-D and 2-D histograms
33 G__loadfile("~/RootMacros/setTitleAxes.C");  // Sets the main and axis titles for 1-D and 2-D histograms
34 G__loadfile("~/RootMacros/ProfileBeforeNAfter.C");
35 G__loadfile("~/RootMacros/PlotMeanVsXaxis.C");
36
37 // Load a root file - Must be done before making canvas & histograms
38 cout << "Trying to open default file, " << defaultFileToOpen  << endl;
39 TFile *file1 = new TFile(defaultFileToOpen);
40 if (file1.IsZombie()) {
41   cout << "You can set a default file to open in the rootlogon.C" << endl;
42 }
43
44 // Create a default canvas and histogram of 640x480 pixels
45 // These are used by PlotFromTTree.C, Plot2hists1D.C
46 TCanvas *c1 = new TCanvas("c1","testCanvas",640,480);
47 TH1 *h1     = new TH1F("h1","Blah",20,-5,5);
48 TH1 *h2     = new TH1F("h2","Blah",20,-5,5);
49 TH2F *h2d   = new TH2F("h2d","Blah",20,-5,5,20,-5,5);
2  
3 < // Run other logon scripts
4 < //gROOT->Macro("rootlogon-CmsTDR.C");
3 > gSystem->Load("libFWCoreFWLite.so");
4 > AutoLibraryLoader::enable();
5 >
6 > TStyle *gStyle= new TStyle("CMS","CMS approved plots style");
7 >
8 > // use plain black on white colors
9 > gStyle->SetFrameBorderMode(0);
10 > gStyle->SetCanvasBorderMode(0);
11 > gStyle->SetPadBorderMode(0);
12 > gStyle->SetPadColor(0);
13 > gStyle->SetCanvasColor(0);
14 > gStyle->SetStatColor(0);
15 > gStyle->SetFillColor(0);
16 >
17 > // set the paper & margin sizes
18 > gStyle->SetPaperSize(20,26);
19 > gStyle->SetPadTopMargin(0.05);
20 > gStyle->SetPadRightMargin(0.05);
21 > gStyle->SetPadBottomMargin(0.16);
22 > gStyle->SetPadLeftMargin(0.12);
23 >
24 > // use large Times-Roman fonts
25 > gStyle->SetTextFont(132);
26 > gStyle->SetTextSize(0.08);
27 > gStyle->SetLabelFont(132,"x");
28 > gStyle->SetLabelFont(132,"y");
29 > gStyle->SetLabelFont(132,"z");
30 > gStyle->SetLabelSize(0.05,"x");
31 > gStyle->SetTitleSize(0.06,"x");
32 > gStyle->SetLabelSize(0.05,"y");
33 > gStyle->SetTitleSize(0.06,"y");
34 > gStyle->SetLabelSize(0.05,"z");
35 > gStyle->SetTitleSize(0.06,"z");
36 >
37 > // use bold lines and markers
38 > gStyle->SetMarkerStyle(20);
39 > gStyle->SetHistLineWidth(1.85);
40 > //gStyle->SetHistLineWidth(3.85);
41 > gStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
42 >
43 > // get rid of X error bars and y error bar caps
44 > gStyle->SetErrorX(0.001);
45 >
46 > // do not display any of the standard histogram decorations
47 > gStyle->SetOptTitle(0);
48 > gStyle->SetOptStat(0);
49 > gStyle->SetOptFit(0);
50 >
51 > // put tick marks on top and RHS of plots
52 > gStyle->SetPadTickX(1);
53 > gStyle->SetPadTickY(1);
54 >
55 > gROOT->SetStyle("Plain");
56 > //gStyle->SetOptStat(1100);
57 > gStyle->SetOptStat(1);
58 > gStyle->SetOptFit(1111);
59 > gStyle->SetPadTickX(1);
60 > gStyle->SetPadTickY(1);
61   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines