/home/cern/BDSIM_new/examples/ILC/2mrad/elossHisto.C

00001 { 
00002   //TFile inpf1("eloss_tmp1.root");
00003   //TFile inpf2("eloss_tmp3_halo_nosr.root");
00004   //TFile inpf3("eloss_tmp4_nosr.root"); // no sr - beam
00005   //TFile inpf4("eloss_tmp2_halo.root");
00006   TFile inpf("output_0.root"); // no sr - beam
00007   
00008 
00009   TTree *tr = ElossNtuple;
00010   
00011   Int_t nbins = 200;
00012 
00013   TH1F *h = new TH1F("heloss","Energy loss [GeV/e-]",nbins,0,50);
00014 
00015   TH1F *hint = new TH1F("helossint","Integrated energy loss [GeV/e-]",nbins,0,50);
00016 
00017   Float_t E, z;
00018 
00019   tr->SetBranchAddress("z",&z);
00020   tr->SetBranchAddress("E",&E);
00021 
00022   Int_t nentries = tr->GetEntries();
00023 
00024   Float_t nfact = 1./500.;  // count Gev/e-
00025 
00026   for(Int_t i=0;i<nentries;i++)
00027     {
00028       tr->GetEntry(i);
00029       h->Fill(z,E*nfact);
00030     }
00031   
00032   Float_t x;
00033   
00034   for(Int_t i=0;i<nbins-1;i++)
00035     {
00036       x = 0;
00037 
00038       for(Int_t j=0;j<i+1;j++)
00039         {
00040           x = x + h->GetBinContent(j);
00041         }
00042 
00043       hint->SetBinContent(i,x);
00044 
00045       //cout<<"i="<<i<<" x="<<x<<endl;
00046 
00047     }
00048   
00049 
00050 
00051 }

Generated on Wed Mar 5 17:25:21 2008 for BDSIM by  doxygen 1.5.3