Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:54

0001 // -------------------------------------------------------------------
0002 // -------------------------------------------------------------------
0003 //
0004 // *********************************************************************
0005 // To execute this macro under ROOT after your simulation ended,
0006 //   1 - launch ROOT (usually type 'root' at your machine's prompt)
0007 //   2 - type '.X plot.C' at the ROOT session prompt
0008 // *********************************************************************
0009 
0010 void SetLeafAddress(TNtuple* ntuple, const char* name, void* address);
0011 
0012 void plotDeexcitation()
0013 {
0014   gROOT->Reset();
0015   gStyle->SetPalette(1);
0016   gROOT->SetStyle("Plain");
0017 
0018   TCanvas* c1 = new TCanvas ("c1","",20,20,1000,500);
0019   c1->Divide(2,1);
0020 
0021   // Uncomment if merging should be done
0022   //system ("rm -rf dna.root");
0023   //system ("hadd dna.root dna_*.root");
0024 
0025   TFile* f = new TFile("dna.root");
0026 
0027   TNtuple* ntuple2;
0028   ntuple2 = (TNtuple*)f->Get("track");
0029   bool rowWise2 = true;
0030   TBranch* eventBranch2 = ntuple2->FindBranch("row_wise_branch");
0031   if ( ! eventBranch2 ) rowWise2 = false;
0032 
0033   // Auger electrons
0034   c1->cd(1);
0035   gStyle->SetOptStat(000000);
0036 
0037   ntuple2->SetFillStyle(1001);
0038   ntuple2->SetFillColor(2);
0039   ntuple2->Draw("kineticEnergy","kineticEnergy>450&&kineticEnergy<550&&flagParticle==1","B");
0040 
0041   gPad->SetLogy();
0042 
0043   TText *pt1 = new TText(510,500,"Auger electrons");
0044   pt1->Draw("SAME");
0045 
0046   // Fluorescence photons
0047   c1->cd(2);
0048   gStyle->SetOptStat(000000);
0049 
0050   ntuple2->SetFillStyle(1001);
0051   ntuple2->SetFillColor(4);
0052   ntuple2->Draw("kineticEnergy","flagParticle==0","B");
0053 
0054   gPad->SetLogy();
0055 
0056   TText *pt2 = new TText(523.1,10,"Fluo. photons");
0057   pt2->Draw("SAME");
0058 
0059 }
0060 
0061 void SetLeafAddress(TNtuple* ntuple, const char* name, void* address) {
0062   TLeaf* leaf = ntuple->FindLeaf(name);
0063   if ( ! leaf ) {
0064     std::cerr << "Error in <SetLeafAddress>: unknown leaf --> " << name << std::endl;
0065     return;
0066   }
0067   leaf->SetAddress(address);
0068 }