/home/cern/BDSIM_new/utils/root-scripts/showCylHits.C

00001 {
00002 
00003 Float_t pi = 3.14;
00004 
00005 TFile f("output1.root");
00006 //TBrowser b;
00007 TTree *t = (TTree*)f->Get("samp1");
00008 
00009 Int_t nentries = (Int_t)t->GetEntries();
00010 
00011 TBranch *brX = t->GetBranch("x");
00012 TBranch *brY = t->GetBranch("y");
00013 TBranch *brZ = t->GetBranch("z");
00014 TBranch *brNpart = t->GetBranch("part");
00015 TBranch *brE = t->GetBranch("E");
00016 
00017 Float_t Emin = -0.005;
00018 Float_t Emax = +0.005;
00019 
00020 TH1F *histE = new TH1F("histE","Energy",100,Emin,Emax);
00021 
00022 Float_t E;
00023 brE->SetAddress(&E);
00024 
00025 for( Int_t i=0; i<nentries;i++)
00026 {
00027   brE->GetEntry(i);
00028   histE->Fill(E);
00029 }
00030 
00031 
00032 Float_t Zmin = -5;
00033 Float_t Zmax = 1;
00034 
00035 Float_t X,Y,Z;
00036 Int_t npart;
00037 
00038 brX->SetAddress(&X);
00039 brY->SetAddress(&Y);
00040 brZ->SetAddress(&Z);
00041 brNpart->SetAddress(&npart);
00042 
00043 TH2F *histXY = new TH2F("histo","R #phi",100,Zmin,Zmax,100,-pi/2,pi/2);
00044 
00045 //Int_t drawnPDGtype = 11; // electron
00046 //histXY->SetTitle("Electrons"); 
00047 
00048 //Int_t drawnPDGtype = -11; // electron
00049 //histXY->SetTitle("Positrons"); 
00050 
00051 Int_t drawnPDGtype = 22; // photons
00052 histXY->SetTitle("Photons"); 
00053 
00054 
00055 for( Int_t i=0; i<nentries;i++)
00056 {
00057   brX->GetEntry(i);
00058   brY->GetEntry(i);
00059   brZ->GetEntry(i);
00060   brNpart->GetEntry(i);
00061 
00062   if(npart == drawnPDGtype) 
00063     histXY->Fill(Z,asin(Y/sqrt(X*X + Y*Y)));
00064 }
00065 
00066 
00067 histXY->SetMarkerColor(4);
00068 histXY->SetMarkerStyle(6);
00069 histXY->GetYaxis()->SetTitle("#phi , rad");
00070 histXY->GetXaxis()->SetTitle("Z, m");
00071 
00072 }

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