g4analyze.C File Reference

Go to the source code of this file.

Functions

void g4analyze ()

Function Documentation

void g4analyze (  ) 

Definition at line 3 of file g4analyze.C.

00003                  {
00004 
00005 
00006   const Int_t NUM_VOLS = 7;
00007   const Int_t NUM_Z = 6;
00008   
00009   Double_t vol_num[NUM_VOLS] = {31,41,42,43,44,71,1};
00010   
00011   Double_t z_mother[NUM_Z] = {4745,5000,6340,9080,10420,14000};
00012   
00013   
00014   
00015   TCanvas *c1 = new TCanvas("washers_part1","",0);
00016   c1->Divide(3,3);
00017   TCanvas *c2 = new TCanvas("washers_part2","",0);
00018   c2->Divide(2,3);
00019   
00020   for (Int_t i=0 ; i<NUM_VOLS ; i++) {
00021     
00022     TString vol = "volume==";
00023     vol+=vol_num[i];
00024     vol+="&&ion";
00025     vol+="&&kineE0>2750";
00026     
00027     TString htitle = "Exit of volume #";
00028     htitle+=vol_num[i];
00029     TString hname = "xy";
00030     hname+=vol_num[i];
00031     
00032     TString draw = "x:y>>xy";
00033     draw+=vol_num[i];
00034     
00035     TH2F *xy = new TH2F(hname,htitle,1000,-200,200,1000,-200,200);
00036     
00037     c1->cd(i+1);
00038     xy->SetStats(0);
00039     xy->GetXaxis()->SetLabelSize(0.055);
00040     xy->GetYaxis()->SetLabelSize(0.055);
00041     geant->Draw(draw,vol);
00042     
00043   }
00044   
00045   
00046   for (Int_t i=0 ; i<NUM_Z ; i++) {
00047     
00048     TString cut = "z==";
00049     cut+=z_mother[i];
00050     cut+="&&ion";
00051     cut+="&&kineE0>2750";
00052     
00053     TString htitle = "Entrance of Volume at z=";
00054     htitle+=z_mother[i];
00055     TString hname = "xy";
00056     hname+=z_mother[i];
00057     
00058     TString draw = "x:y>>xy";
00059     draw+=z_mother[i];
00060     
00061     TH2F *xy = new TH2F(hname,htitle,1000,-200,200,1000,-200,200);
00062     
00063     c2->cd(i+1);
00064     xy->SetStats(0);
00065     xy->GetXaxis()->SetLabelSize(0.055);
00066     xy->GetYaxis()->SetLabelSize(0.055);
00067     geant->Draw(draw,cut);
00068     
00069   }
00070   
00071   
00072   /*TCanvas *c1 = new TCanvas("averages","X and Y Averaging",1);
00073     
00074   
00075   const Int_t NUM_VOLS = 7;
00076   Double_t vol_num[NUM_VOLS] = {31,41,42,43,44,71,1};
00077   
00078   
00079   
00080   
00081   Double_t xsum[NUM_VOLS], xnum[NUM_VOLS], xavg[NUM_VOLS], 
00082   ysum[NUM_VOLS], ynum[NUM_VOLS], yavg[NUM_VOLS],
00083   zloc[NUM_VOLS];
00084   
00085   for (Int_t i=0; i<NUM_VOLS; i++) {
00086   
00087   TString vol = "volume==";
00088   vol+=vol_num[i];
00089 
00090         geant->Draw("z",vol,"goff");
00091 
00092         Double_t *z = geant->GetV1();
00093   
00094   zloc[i] = *(z + 0);
00095 
00096 
00097         geant->Draw("x:y",vol,"goff");
00098 
00099         Int_t num_vals = geant->GetSelectedRows();
00100         const Int_t K = num_vals;
00101         Double_t *x = geant->GetV1();
00102         Double_t *y = geant->GetV2();
00103         Double_t xval[K],yval[K];
00104 
00105 
00106   for (Int_t k=0; k < K; k++) {
00107       xval[k] = *(x + k);
00108       yval[k] = *(y + k);
00109   }
00110 
00111   for (Int_t j=0; j<K; j++) {
00112       if ( abs(xval[j])<10.0 && abs(yval[j])>30.0 && abs(yval[j])<140.0) {
00113     ysum[i]+=abs(yval[j]);
00114     ynum[i]++;
00115       }
00116       if ( abs(yval[j])<10.0 && abs(xval[j])>30.0 && abs(xval[j])<140.0) {
00117     xsum[i]+=abs(xval[j]);
00118     xnum[i]++;
00119       }
00120 
00121         }
00122 
00123   xavg[i] = xsum[i] / xnum[i];
00124   yavg[i] = ysum[i] / ynum[i];
00125 
00126 
00127     }
00128 
00129 
00130     TGraph *gr1 = new TGraph(NUM_VOLS, zloc, xavg);
00131     gr1->SetMarkerColor(4);
00132     gr1->SetLineColor(4);
00133 
00134     TGraph *gr2 = new TGraph(NUM_VOLS, zloc, yavg);
00135     gr2->SetMarkerColor(2);
00136     gr2->SetLineColor(2);
00137 
00138 
00139     TMultiGraph *mg = new TMultiGraph();
00140     mg->Add(gr1);
00141     mg->Add(gr2);
00142 
00143     mg->Draw("APC*");
00144     mg->SetTitle("Average Values of X and Y for GEANT Simulation");
00145     mg->GetXaxis()->SetTitle("Z");
00146     mg->GetYaxis()->SetTitle("X and Y averages");
00147     mg->GetXaxis()->CenterTitle();
00148     mg->GetYaxis()->CenterTitle();
00149 
00150     TLegend *leg = new TLegend(0.75,0.75,0.89,0.89);
00151     leg->AddEntry(gr1,"X","p");
00152     leg->AddEntry(gr2,"Y","p");
00153     leg->Draw();*/
00154 
00155 
00156 }


Generated on 16 Jun 2013 for mollersim by  doxygen 1.6.1