00001 {
00002
00003
00004
00005
00006 TFile inpf("output_0.root");
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.;
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
00046
00047 }
00048
00049
00050
00051 }