File:Phi vs z 1hitperlayer with zero.jpg

From Nuclear Physics Group Documentation Pages
Revision as of 18:30, 28 July 2008 by Dan (talk | contribs) (// // Original Template Sarah Philips // Written by Kyle Snavely June 30, 2008 // Modified by Daniel Mannarino July 14, 2008 // // This script reads in rootfiles and makes a plot of phi // vs. z for protons // --------------)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Phi_vs_z_1hitperlayer_with_zero.jpg(696 × 472 pixels, file size: 67 KB, MIME type: image/jpeg)

// // Original Template Sarah Philips // Written by Kyle Snavely June 30, 2008 // Modified by Daniel Mannarino July 14, 2008 // // This script reads in rootfiles and makes a plot of phi // vs. z for protons // -------------------------------------------------------- //


// All my standard ROOT includes...

  1. include <TString.h>
  2. include <string>
  3. include <fstream>
  4. include <iostream>
  5. include <TCanvas.h>
  6. include <TH1.h>
  7. include <TH2.h>
  8. include <TF1.h>
  9. include <TH3F.h>
  10. include <TFile.h>
  11. include <TTree.h>
  12. include <TROOT.h>
  13. include <TStyle.h>
  14. include <TApplication.h>
  15. include <TPaletteAxis.h>
  16. include <TPaveText.h>
  17. include <TPaveStats.h>
  18. include <TPaveLabel.h>
  19. include <vector>
  20. include <TProfile.h>
  21. include <TF1.h>
  22. include <TGraphErrors.h>
  23. include <TMultiGraph.h>
  24. include <TGraph.h>
  25. include <TDatime.h>
  26. include <TLegend.h>
  27. include <TAxis.h>
  28. include <TGaxis.h>
  29. include <TPad.h>
  30. include <TLatex.h>
  31. include <TRandom.h>
  32. include <stdio.h>
  33. include <stdlib.h>
  34. include <math.h>
  35. include <TMath.h>
  36. include <TMinuit.h>
  37. include <TStopwatch.h>
  38. include <TSpectrum.h>
  39. include "TMath.h"


// Interactive includes

  1. include <TRint.h>
  2. include <TApplication.h>
  3. include <TGX11.h>
  4. include <TVirtualX.h>
  5. 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 *phi_z = new TH2F("phi_z","phi vs. z (Protons)",200,-2.75,2.75,200,0,360);
 phi_z->SetMarkerColor(40);  
 bst->Draw("phi:z>>phi_z","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);
 phi_z->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/TimeThumbnailDimensionsUserComment
current18:30, 28 July 2008Thumbnail for version as of 18:30, 28 July 2008696 × 472 (67 KB)Dan (talk | contribs)// // Original Template Sarah Philips // Written by Kyle Snavely June 30, 2008 // Modified by Daniel Mannarino July 14, 2008 // // This script reads in rootfiles and makes a plot of phi // vs. z for protons // --------------

The following page uses this file: