00001 {
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 gROOT->SetStyle("Plain");
00021
00022 gStyle->SetOptStat(0);
00023 gStyle->SetOptFit(0);
00024 gStyle->GetAttDate()->SetTextColor(1);
00025 gStyle->SetOptTitle(0);
00026 gStyle->SetLabelFont(132,"XYZ");
00027 gStyle->SetTextFont(132);
00028 gStyle->SetTitleFont(132,"XYZ");
00029
00030 gROOT->ForceStyle();
00031
00032
00033
00034
00035
00036
00037 TFile hfile("Events.root");
00038 TTree *tree = (TTree*)hfile.Get("RTree");
00039 RMCEvent *event = new RMCEvent();
00040 tree->SetBranchAddress("RMCEvent",&event);
00041
00042
00043
00044 TH1F *pmtqn = new TH1F("pmtqn"," ",50,-0.1,4.0);
00045 pmtqn->SetLineColor(kBlue);
00046 pmtqn->SetLineWidth(3);
00047 pmtqn->SetLineStyle(1);
00048 pmtqn->SetXTitle("Charge (photoelectrons)");
00049 pmtqn->SetYTitle("Hits/0.08 pe");
00050 pmtqn->SetTitle("Neutron and Positron Charge Spectra for R > 200 cm");
00051
00052 TH1F *pmtqpos = new TH1F("pmtqpos"," ",50,-0.1,4.0);
00053 pmtqpos->SetLineColor(kRed);
00054 pmtqpos->SetLineWidth(3);
00055 pmtqpos->SetLineStyle(2);
00056 pmtqpos->SetXTitle("Charge (photoelectrons)");
00057 pmtqpos->SetYTitle("Hits/0.08 pe");
00058 pmtqpos->SetTitle("Neutron and Positron Charge Spectra for R > 200 cm");
00059
00060
00061
00062 TLegend *leg = new TLegend(0.60,0.70,0.88,0.88);
00063 leg->AddEntry(pmtqpos,"Positrons","L");
00064 leg->AddEntry(pmtqn,"Neutrons","L");
00065
00066 Int_t nentries = (Int_t)tree->GetEntries();
00067
00068
00069
00070
00071
00072 Int_t num;
00073 Int_t numsecs;
00074 Int_t type,hits;
00075 Double_t energy,rgen;
00076 Double_t* vertex;
00077
00078
00079 for (Int_t i=0; i < nentries; i++){
00080 tree->GetEntry(i);
00081 num = event->GetEventNum();
00082 numsecs = event->GetNumSecondaries();
00083 vertex = event->GetInteractionVertex();
00084 rgen = sqrt(vertex[0]*vertex[0]+vertex[1]*vertex[1]+
00085 vertex[0]*vertex[0]);
00086
00087
00088
00089 RMCSecondary *secondary = NULL;
00090 for (Int_t isec=0; isec<numsecs; isec++){
00091
00092
00093
00094 secondary = (RMCSecondary *) event.fSecondaries->At(isec);
00095 type = secondary->GetSecondaryType();
00096 energy = secondary->GetSecondaryKE();
00097 hits = secondary->GetNumPMTs();
00098 int npe;
00099 double Time;
00100 Float_t Q;
00101
00102
00103
00104 for (Int_t j=0; j<hits; j++){
00105 RMCPMT *pmt = NULL;
00106 pmt = (RMCPMT *) secondary.fPMTs->At(j);
00107 Q = (Float_t) pmt->GetPMTQ();
00108 npe = pmt->GetPMTnpe();
00109 if (npe > 0){
00110 if (rgen > 200){
00111 if (isec == 0){
00112 pmtqpos->Fill(Q);
00113 }
00114 else
00115 pmtqn->Fill(Q);
00116 }
00117 }
00118 Time = pmt->GetPMTtime();
00119 delete pmt;
00120 }
00121 delete secondary;
00122 }
00123
00124 }
00125 pmtqn->DrawNormalized();
00126 pmtqpos->DrawNormalized("same");
00127
00128
00129 leg->SetTextFont(132);
00130 leg->Draw("same");
00131
00132 c1->Print("Qnp.eps");
00133
00134 delete event;
00135
00136
00137 return 0;
00138 }