File:P vs phi 1hitperlayer.jpg
From Nuclear Physics Group Documentation Pages
Jump to navigationJump to search
P_vs_phi_1hitperlayer.jpg (696 × 472 pixels, file size: 65 KB, MIME type: image/jpeg)
// // Written by Kyle Snavely June 30, 2008 // Modified by Daniel Mannarino July 28, 2008 // // This script reads in rootfiles and makes a plot of phi // vs. z for protons // -------------------------------------------------------- // // All my standard ROOT includes... #include <TString.h> #include <string> #include <fstream> #include <iostream> #include <TCanvas.h> #include <TH1.h> #include <TH2.h> #include <TF1.h> #include <TH3F.h> #include <TFile.h> #include <TTree.h> #include <TROOT.h> #include <TStyle.h> #include <TApplication.h> #include <TPaletteAxis.h> #include <TPaveText.h> #include <TPaveStats.h> #include <TPaveLabel.h> #include <vector> #include <TProfile.h> #include <TF1.h> #include <TGraphErrors.h> #include <TMultiGraph.h> #include <TGraph.h> #include <TDatime.h> #include <TLegend.h> #include <TAxis.h> #include <TGaxis.h> #include <TPad.h> #include <TLatex.h> #include <TRandom.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <TMath.h> #include <TMinuit.h> #include <TStopwatch.h> #include <TSpectrum.h> #include "TMath.h" // Interactive includes #include <TRint.h> #include <TApplication.h> #include <TGX11.h> #include <TVirtualX.h> #include <TFriendElement.h> using namespace std ; // Make tree a global variable so that we can access it outside this function. // You can then also access it from the command line. TTree *tree; // ************ The main program starts here. ****************// int main(int argc, char** argv) { /////////////////////////////////////////// // Initialize root, get our files and // // make them friends, create our canvas. // /////////////////////////////////////////// TApplication theApp("App", &argc, argv); // gStyle->SetOptFit(0111); gROOT->SetStyle("Plain"); gStyle->SetFillColor(10); /////////////////////////////////////////// // Proton files TFile *pro1 = new TFile("$DATA/proton_500000.root"); //Get bst tree TTree *bst = (TTree*)pro1->Get("bstT"); bst->AddFriend("genT", "$DATA/proton_500000.root"); /////////////////////////////////////////// // Make our canvas TCanvas* MyCanvas1 = new TCanvas("MyCanvas1", "Some Graphs", 1); MyCanvas1->SetFillColor(10); TPaveLabel *title1 = NULL; title1 = new TPaveLabel(0.1,0.96,0.9,0.99,"A Plot! Yay!"); title1->SetFillColor(10); //title1->Draw(); TDatime *now1; now1 = new TDatime(); TPaveLabel *date1 = new TPaveLabel(0.7,0.01,0.9,0.03,now1->AsString()); date1->SetFillColor(10); TPad* graphPad1 = new TPad("Graphs","Graphs",0.0,0.0,1.0,1.0); graphPad1->SetFillColor(10); graphPad1->Draw(); graphPad1->cd(); /////////////////////////////////////////// // Create and fill our histos // /////////////////////////////////////////// TH2F *p_phi = new TH2F("p_phi","p vs. phi (Protons)",200,0,360,200,200,4000); p_phi->SetMarkerColor(40); bst->Draw("p:phi>>p_phi","layer[0]==1 && layer[1]==2 && layer[2]==3 && layer[3]==4 && layer[4]==5 && layer[5]==6 && layer[6]==7 && layer[7]==8"); /////////////////////////////////////////// // Draw our graphs // /////////////////////////////////////////// graphPad1->Clear(); gStyle->SetPalette(1,0); p_phi->Draw("COLZ"); gStyle->SetNumberContours(255); // ------------------------------------------------ // Main application eventloop. Calls system dependent eventloop // -> runs an interactive interface theApp.Run(); return(0); } /********** End of main *************/
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 20:27, 28 July 2008 | 696 × 472 (65 KB) | Dan (talk | contribs) | <pre> // // Written by Kyle Snavely June 30, 2008 // Modified by Daniel Mannarino July 28, 2008 // // This script reads in rootfiles and makes a plot of phi // vs. z for protons // --------------------------------------------- |
You cannot overwrite this file.
File usage
The following page uses this file: