Fork me on GitHub

Changes in / [7834539f:ad3b7ce] in git


Ignore:
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • README_4LHCb

    r7834539f rad3b7ce  
    50502) Simulate p p -> b b~ events
    5151
     52
     53  wget http://cp3.irmp.ucl.ac.be/downloads/pp2bb.hep.tgz
    5254  tar -xzvf pp2bb.hep.tgz
    5355  ./DelphesSTDHEP examples/delphes_card_prelLHCb.tcl delphes_output.root pp2bb.hep
     
    5961
    6062
    61 
    62 Simple analysis using TTree::Draw
    63 =================================
    64 
    65 Now we can start ROOT and look at the data stored in the output ROOT file.
    66 
    67 Start ROOT and load Delphes shared library:
    68 
    69    root -l
    70    gSystem->Load("libDelphes");
    71 
    72 Open ROOT file and do some basic analysis using Draw or TBrowser:
    73 
    74    TFile::Open("delphes_output.root");
    75    Delphes->Draw("Track.PT");
    76    TBrowser browser;
    77 
    78 Note 1: Delphes - tree name, it can be learned e.g. from TBrowser
    79 
    80 Note 2: Track - branch name; PT - variable (leaf) of this branch
    81 
    82 Complete description of all branches can be found in
    83 
    84    doc/RootTreeDescription.html
    85 
    86 This information is also available at
    87 
    88    https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/RootTreeDescription
    89 
    90 
    91 Macro-based analysis
    92 ====================
    93 
    94 Analysis macro consists of histogram booking, event loop (histogram filling),
    95 histogram display.
    96 
    97 Start ROOT and load Delphes shared library:
    98 
    99    root -l
    100    gSystem->Load("libDelphes");
    101 
    102 Basic analysis macro:
    103 
    104 {
    105   // Create chain of root trees
    106   TChain chain("Delphes");
    107   chain.Add("delphes_output.root");
    108  
    109   // Create object of class ExRootTreeReader
    110   ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
    111   Long64_t numberOfEntries = treeReader->GetEntries();
    112  
    113   // Get pointers to branches used in this analysis
    114   TClonesArray *branchTrack = treeReader->UseBranch("Track");
    115 
    116   // Book histograms
    117   TH1 *histTrackPT = new TH1F("track pt", "track P_{T}", 50, 0.0, 20.0);
    118 
    119   // Loop over all events
    120   for(Int_t entry = 0; entry < numberOfEntries; ++entry)
    121   {
    122 
    123     // Load selected branches with data from specified event
    124     treeReader->ReadEntry(entry);
    125  
    126     // If event contains at least 1 track
    127     if(branchTrack->GetEntries() > 0)
    128     {
    129       // Take first track
    130       Track *track = (Track*) branchTrack->At(0);
    131      
    132       // Plot track transverse momentum
    133       histTrackPT->Fill(track->PT);
    134      
    135       // Print electron transverse momentum and Particle Data Group ID
    136       cout << track->PID<< "   " << track->PT << endl;
    137     }
    138 
    139   }
    140 
    141   // Show resulting histograms
    142   histTrackPT->Draw();
    143 }
    144 
Note: See TracChangeset for help on using the changeset viewer.