00001
00013 #include <iostream.h>
00014 #include <math.h>
00015 #include <string.h>
00016 #include <cstdio>
00017 #include "TObject.h"
00018 #include "TObjArray.h"
00019 #include "RMCEvent.hh"
00020 #include "RMCSecondary.hh"
00021 #include "ReactorEvent.hh"
00022 #include "ReactorDetector.hh"
00023
00024 ClassImp(RMCEvent);
00025
00026 RMCEvent::RMCEvent()
00027 {
00028
00029 fSecondaries = new TObjArray(10);
00030 fNSecondary = 0;
00031
00032 }
00033
00034 RMCEvent::~RMCEvent(){
00035
00036
00037 }
00038
00039 void RMCEvent::Build(ReactorEvent& Event, ReactorDetector& Detector, std::string EventType, int Nevent)
00040 {
00041
00042
00043
00044 fEventNum = Nevent;
00045 if (EventType == "reactor"){
00046 fEventType = 0;
00047 int n=0;
00048
00049 fKEParent = Event.GetEnu(n);
00050
00051 double* rnu = new double[n];
00052 double* cnu = new double[n];
00053 double* fnu = new double[n];
00054 rnu[n] = Event.GetNubarVertexR(n);
00055 cnu[n] = Event.GetNubarVertexCosTheta(n);
00056 fnu[n] = Event.GetNubarVertexPhi(n);
00057 fInteractionVertex[0] = rnu[n]*cos(fnu[n])*sqrt(1-cnu[n]*cnu[n]);
00058 fInteractionVertex[1] = rnu[n]*sin(fnu[n])*sqrt(1-cnu[n]*cnu[n]);
00059 fInteractionVertex[2] = rnu[n]*cnu[n];
00060
00061 fNumSecondaries = 2;
00062
00063
00064 delete[] rnu;
00065 delete[] cnu;
00066 delete[] fnu;
00067
00068
00069
00070
00071 fNSecondary = 0;
00072 double energy=0.;
00073
00074 double time=0.;
00075 double dircos[3];
00076 int ngammas = 0;
00077 for (int s=0; s<fNumSecondaries; s++)
00078 {
00079 double ETotalDeposited=0.;
00080 RMCSecondary *secondary = new RMCSecondary(Detector,s);
00081 if (s==0)
00082 {
00083 energy = Event.GetPositronKE(n);
00084 time = Event.GetPositronTime(n);
00085 dircos[0]=1.0;
00086 dircos[1]=0.0;
00087 dircos[2]=0.0;
00088
00089
00090 ngammas = Detector.GetNgamma("P");
00091 double* eg = new double[ngammas];
00092 double* tg = new double[ngammas];
00093 double* rg = new double[ngammas];
00094 double* cg = new double[ngammas];
00095 double* fg = new double[ngammas];
00096 Detector.GetGamma("P",eg,tg,rg,cg,fg);
00097 for (int i=0;i < ngammas; i++) ETotalDeposited+=eg[i];
00098 delete[] eg;
00099 delete[] tg;
00100 delete[] rg;
00101 delete[] cg;
00102 delete[] fg;
00103
00104 }
00105 if (s==1)
00106 {
00107 energy = Event.GetNeutronKE(n);
00108 time = Event.GetNeutronTime(n);
00109 dircos[0]=-1.0;
00110 dircos[1]=0.0;
00111 dircos[2]=0.0;
00112
00113
00114 ngammas = Detector.GetNgamma("N");
00115 double* eg = new double[ngammas];
00116 double* tg = new double[ngammas];
00117 double* rg = new double[ngammas];
00118 double* cg = new double[ngammas];
00119 double* fg = new double[ngammas];
00120 Detector.GetGamma("N",eg,tg,rg,cg,fg);
00121 for (int i=0;i < ngammas; i++) ETotalDeposited+=eg[i];
00122 delete[] eg;
00123 delete[] tg;
00124 delete[] rg;
00125 delete[] cg;
00126 delete[] fg;
00127 }
00128 secondary->SetSecondaryGammas(ngammas);
00129 secondary->SetSecondaryEDeposited(ETotalDeposited);
00130 secondary->SetSecondaryKE(energy);
00131 secondary->SetSecondaryTime(time);
00132 secondary->SetSecondaryDirection(dircos);
00133 fSecondaries->AddAt(secondary,s);
00134 }
00135
00136 }
00137 }