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

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

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