00001 {
00002
00003 TFile tempfile("output_0.root");
00004 Int_t nsamps = tempfile.GetNkeys() - 2;
00005 tempfile.Close();
00006 Float_t r,x,xp,y,yp,z,z0,e,e0;
00007 Int_t part,nev;
00008
00009 Int_t jstar=1;
00010 Int_t jend=nsamps;
00011 cout << "Number of Samplers: " << nsamps << endl;
00012 Float_t factor;
00013 Char_t ChainName[256];
00014 TNtuple *ntuple = new TNtuple("ntuple","nutple","r:x:xp:y:yp:z:z0:E:E0:part:nev:n");
00015
00016 for (Int_t j=jstar; j <=jend ; j++)
00017 {
00018
00019 sprintf(ChainName,"sampler_phys_%d",j);
00020 TChain PChain(ChainName);
00021 for( int k = 0; k<23; k++)
00022 {
00023 char filename[200];
00024 sprintf(filename,"output_%d.root",k);
00025 cout << "Opening File: " << filename << endl;
00026 PChain.Add(filename);
00027 }
00028 PChain.SetBranchAddress("x", &x);
00029 PChain.SetBranchAddress("xp", &xp);
00030 PChain.SetBranchAddress("y", &y);
00031 PChain.SetBranchAddress("yp", &yp);
00032 PChain.SetBranchAddress("z", &z);
00033 PChain.SetBranchAddress("z0", &z0);
00034 PChain.SetBranchAddress("E", &e);
00035 PChain.SetBranchAddress("E0", &e0);
00036 PChain.SetBranchAddress("part", &part);
00037 PChain.SetBranchAddress("nev", &nev);
00038
00039 Int_t mmax = (Int_t)PChain.GetEntries();
00040 for (Int_t m=0; m<mmax;m++)
00041 {
00042 PChain.GetEntry(m);
00043 r=TMath::Sqrt(x*x+y*y);
00044
00045 x*=1e-6;
00046 y*=1e-6;
00047 xp*=1e-6;
00048 yp*=1e-6;
00049
00050 ntuple->Fill(r,x,xp,y,yp,z,z0,e,e0,part,nev,j);
00051
00052 }
00053
00054 }
00055
00056 }