Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-01 07:06:39

0001 //
0002 // draw.cxx
0003 //
0004 // Created by TB on 6/13/11.
0005 // Copyright 2011 BNL. All rights reserved.
0006 //
0007 // Example of a simple analysis using TTree::Draw() statements.
0008 
0009 void draw(const TString inputFile ) {
0010    
0011    // When you use only TTree::Draw() you can ignore errors like these:
0012    //Warning in <TClass::TClass>: no dictionary for class EventBase is available
0013    //Warning in <TClass::TClass>: no dictionary for class Particle is available
0014    // ROOT doesn't need the listed dictionary files to access the data.
0015    TFile file(inputFile, "READ");
0016    
0017    // The TTree is named EICTree
0018    TTree* tree(NULL );
0019    file.GetObject("EICTree", tree );
0020    if(! tree) return; // Oops!
0021    
0022    TCanvas* canvas = new TCanvas;
0023    canvas->Divide(2, 1);
0024    
0025    canvas->cd(1);
0026    // For event-wise quantities you don't need to prepend "event." to the
0027    // Draw() statement string; ROOT will automatically resolve it:
0028    tree->Draw("QSquared"); // Equivalent to "event.QSquared"
0029    
0030    canvas->cd(2);
0031    // Similarly you don't need to prepend "event.particles." to access particle
0032    // variables.
0033    tree->Draw("pt"); // Equivalent to "event.particles.pt".
0034 }