Changeset 1342 for trunk/examples/advanced/microbeam
- Timestamp:
- Nov 5, 2010, 4:08:39 PM (14 years ago)
- Location:
- trunk/examples/advanced/microbeam
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/advanced/microbeam/History
r1337 r1342 1 1 ------------------------------------------------------------------- 2 $Id: History,v 1.2 8 2010/06/10 09:54:05 vnivanchExp $2 $Id: History,v 1.29 2010/10/07 14:03:11 sincerti Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 10 10 -------------------- 11 11 12 07 October 2010 - S. Incerti - tag microbeam-V09-03-07 13 - Updated for use of AIDA fof histograms. 14 12 15 10 June 2010 - V.Ivanchenko - tag microbeam-V09-03-06 13 16 - Added option "ionGasModel" to the Physics List … … 17 20 18 21 09 June 2010 - S. Incerti - tag microbeam-V09-03-04 19 - Switched to physics_list library. 20 microbeam.mac adapted. 22 - Switched to physics_list library. microbeam.mac adapted. 21 23 22 24 06 June 2010 - S. Incerti - tag microbeam-V09-03-03 -
trunk/examples/advanced/microbeam/Microbeam.cc
r1337 r1342 25 25 // 26 26 // ------------------------------------------------------------------- 27 // $Id: Microbeam.cc,v 1.1 0 2010/06/09 18:13:46sincerti Exp $27 // $Id: Microbeam.cc,v 1.11 2010/10/07 14:03:11 sincerti Exp $ 28 28 // ------------------------------------------------------------------- 29 29 // GEANT4 - Microbeam example … … 53 53 #include "MicrobeamSteppingAction.hh" 54 54 #include "MicrobeamSteppingVerbose.hh" 55 #include "MicrobeamHistoManager.hh" 55 56 56 57 int main(int argc,char** argv) { … … 82 83 runManager->SetUserAction(KinAct); 83 84 84 MicrobeamRunAction* RunAct = new MicrobeamRunAction(detector); 85 MicrobeamHistoManager* histo = new MicrobeamHistoManager(); 86 87 MicrobeamRunAction* RunAct = new MicrobeamRunAction(detector,histo); 85 88 86 89 runManager->SetUserAction(RunAct); 87 runManager->SetUserAction(new MicrobeamEventAction(RunAct ));90 runManager->SetUserAction(new MicrobeamEventAction(RunAct,histo)); 88 91 runManager->SetUserAction(new MicrobeamTrackingAction(RunAct)); 89 runManager->SetUserAction(new MicrobeamSteppingAction(RunAct,detector ));92 runManager->SetUserAction(new MicrobeamSteppingAction(RunAct,detector,histo)); 90 93 91 94 // initialize G4 kernel … … 96 99 97 100 // local user files created by the simulation 98 system ("rm -rf dose.txt"); 99 system ("rm -rf 3DDose.txt"); 100 system ("rm -rf stoppingPower.txt"); 101 system ("rm -rf range.txt"); 102 system ("rm -rf beamPosition.txt"); 101 system ("rm -rf microbeam.root"); 103 102 104 103 if (argc==1) // define UI session for interactive mode. -
trunk/examples/advanced/microbeam/README
r1337 r1342 1 1 ------------------------------------------------------------------- 2 $Id: README,v 1.1 1 2010/06/09 18:13:46sincerti Exp $2 $Id: README,v 1.12 2010/10/07 14:03:11 sincerti Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 17 17 * e-mail:incerti@cenbg.in2p3.fr 18 18 19 Last modified by S. Incerti, 0 9/06/201019 Last modified by S. Incerti, 07/10/2010 20 20 21 21 ---->0. INTRODUCTION. … … 80 80 - MONTE CARLO MICRODOSIMETRY FOR TARGETED IRRADIATION OF INDIVIDUAL CELLS USING 81 81 A MICROBEAM FACILITY 82 By S. Incerti, T. Pouthier, H. Seznec, Ph. Moretto, O. Boissonnade, 83 T. M. H. Ha, F. Andersson, Ph. Barberet, C. Habchi and D. T. Nguyen 84 In preparation (2007) 82 By S. Incerti, H. Seznec, M. Simon, Ph. Barberet, C. Habchi, Ph. Moretto 83 Published in Rad. Prot. Dos. 133, 1 (2009) 2-11 85 84 86 85 - MONTE CARLO SIMULATION OF THE CENBG MICROBEAM AND NANOBEAM LINES WITH THE … … 88 87 By S. Incerti, Q. Zhang, F. Andersson, Ph. Moretto, G.W. Grime, 89 88 M.J. Merchant, D.T. Nguyen, C. Habchi, T. Pouthier and H. Seznec 90 In press in Nucl.Instrum.Meth.B, 200789 Published in Nucl. Instrum. and Meth. B 260 (2007) 20-27 91 90 92 91 - A COMPARISON OF CELLULAR IRRADIATION TECHNIQUES WITH ALPHA PARTICLES USING … … 94 93 By S. Incerti, N. Gault, C. Habchi, J.L.. Lefaix, Ph. Moretto, J.L.. Poncy, 95 94 T. Pouthier, H. Seznec. Dec 2006. 3pp. 96 Published in Rad. Prot.Dos.,1-3,2006 (Micros 2005 special issue).95 Published in Rad. Prot. Dos. 122, 1-4, (2006) 327-329 97 96 98 97 - GEANT4 SIMULATION OF THE NEW CENBG MICRO AND NANO PROBES FACILITY … … 124 123 125 124 126 ---->3. SET-UP 127 128 - a standard Geant4 example GNUmakefile is provided 125 ------->3 VISUALIZATION 129 126 130 The following section gives the necessary environment variables. 131 132 ------->>3.1 ENVIRONMENT VARIABLES 133 134 All variables are defined with their default value. 135 136 - G4SYSTEM = Linux-g++ 137 138 - G4INSTALL points to the installation directory of GEANT4; 139 140 - G4LIB point to the compiled libraries of GEANT4; 141 142 - G4WORKDIR points to the work directory; 143 144 - CLHEP_BASE_DIR points to the installation directory of CHLEP; 145 146 - G4LEDATA points to the low energy electromagnetic libraries; 147 148 - LD_LIBRARY_PATH = $CLHEP_BASE_DIR/lib 149 150 - G4LEVELGAMMADATA points to the photoevaporation library; 151 152 - NeutronHPCrossSections points to the neutron data files; 153 154 - G4RADIOACTIVEDATA points to the libraries for radio-active decay 155 hadronic processes; 156 157 However, the $G4LEVELGAMMADATA, $NeutronHPCrossSections and $G4RADIOACTIVEDATA 158 variables do not need to be defined for this example. 159 160 Once these variables have been set, simply type gmake to compile the Microbeam 161 example. 162 163 ------->>3.2 VISUALIZATION 164 165 The user can visualize the targeted cell with OpenGL, DAWN and vrml, 166 as chosen in the microbeam.mac file. OpenGL is the default viewer. The 167 cytoplasm in shown in red and the nucleus in green. 168 127 The user can visualize the targeted cell by uncommenting the following line in 128 microbeam.mac: 129 #/control/execute vis.mac 169 130 170 131 ---->4. HOW TO RUN THE EXAMPLE 171 132 172 In interactive mode, run: 133 The variable G4ANALYSIS_USE must be set to 1. 173 134 174 > $G4WORDIR/bin/Linux-g++/Microbeam 135 In order to generate histograms, at least one of the AIDA implementations should be 136 available. 137 138 The code should be compiled with gmake and run with : 175 139 176 The macro microbeam.mac is executed by default. 177 All visualisation commands are in the vis.mac macro file. 140 > $G4WORDIR/bin/$G4SYSTEM/Microbeam 141 142 The macro file microbeam.mac is read by default. 178 143 179 144 … … 185 150 ---->6. SIMULATION OUTPUT AND RESULT ANALYZIS 186 151 187 Th is example does not need any external analysis package.188 The output results consists in several .txt files:152 The output results consist in several a microbeam.root file, containing several 153 ntuples: 189 154 190 * dose.txt : gives thetotal deposited dose in the cell nucleus and in the cell155 * total deposited dose in the cell nucleus and in the cell 191 156 cytoplasm by each incident alpha particle; 192 157 193 * 3DDose.txt : gives theaverage on the whole run of the dose deposited per158 * average on the whole run of the dose deposited per 194 159 Voxel per incident alpha particle; 195 160 196 * range.txt : indicates thefinal stopping (x,y,z) position of the incident161 * final stopping (x,y,z) position of the incident 197 162 alpha particle within the irradiated medium (cell or culture medium) 198 163 199 * stopping Power.txt : gives the actual stoppingpower dE/dx of the incident164 * stopping power dE/dx of the incident 200 165 alpha particle just before penetrating into the targeted cell; 201 166 202 * beam Position.txt : gives the beamtransverse position distribution(X and Y)167 * beam transverse position distribution(X and Y) 203 168 just before penetrating into the targeted cell; 204 169 205 These files can be easily analyzed using for example the provided ROOT macro170 These results can be easily analyzed using for example the provided ROOT macro 206 171 file plot.C; to do so : 207 172 * be sure to have ROOT installed on your machine … … 210 175 * under your ROOT session, type in : .X plot.C to execute the macro file 211 176 212 A graphical output obtained with this macro for 40000 incident alpha particles213 is shown in the file microbeam.gif214 215 The simulation predicts that 95% of the incident alpha particles detected by the216 gas detector are located within a circle of 10 um in diameter on the target, in217 nice agreement with experimental measurements performed on the CENBG setup.218 177 219 178 --------------------------------------------------------------------------- -
trunk/examples/advanced/microbeam/include/MicrobeamEventAction.hh
r807 r1342 25 25 // 26 26 // ------------------------------------------------------------------- 27 // $Id: MicrobeamEventAction.hh,v 1. 5 2006/06/29 16:05:05 gunterExp $27 // $Id: MicrobeamEventAction.hh,v 1.6 2010/10/07 14:03:11 sincerti Exp $ 28 28 // ------------------------------------------------------------------- 29 29 … … 35 35 36 36 class MicrobeamRunAction; 37 class MicrobeamHistoManager; 37 38 class G4Event; 38 39 … … 43 44 public: 44 45 45 MicrobeamEventAction(MicrobeamRunAction* );46 MicrobeamEventAction(MicrobeamRunAction*, MicrobeamHistoManager *); 46 47 ~MicrobeamEventAction(); 47 48 … … 55 56 56 57 MicrobeamRunAction* Run; 58 MicrobeamHistoManager* Histo; 57 59 G4String drawFlag; 58 60 G4int printModulo; -
trunk/examples/advanced/microbeam/include/MicrobeamRunAction.hh
r807 r1342 25 25 // 26 26 // ------------------------------------------------------------------- 27 // $Id: MicrobeamRunAction.hh,v 1. 5 2006/06/29 16:05:13 gunterExp $27 // $Id: MicrobeamRunAction.hh,v 1.6 2010/10/07 14:03:11 sincerti Exp $ 28 28 // ------------------------------------------------------------------- 29 29 … … 35 35 36 36 #include "MicrobeamDetectorConstruction.hh" 37 #include "MicrobeamHistoManager.hh" 37 38 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 44 45 public: 45 46 46 MicrobeamRunAction(MicrobeamDetectorConstruction* );47 MicrobeamRunAction(MicrobeamDetectorConstruction*, MicrobeamHistoManager*); 47 48 ~MicrobeamRunAction(); 48 49 … … 81 82 82 83 MicrobeamDetectorConstruction* Detector; 84 MicrobeamHistoManager* Histo; 83 85 MicrobeamPhantomConfiguration myMicrobeamPhantomConfiguration; 84 86 -
trunk/examples/advanced/microbeam/include/MicrobeamSteppingAction.hh
r807 r1342 25 25 // 26 26 // ------------------------------------------------------------------- 27 // $Id: MicrobeamSteppingAction.hh,v 1. 5 2006/06/29 16:05:15 gunterExp $27 // $Id: MicrobeamSteppingAction.hh,v 1.6 2010/10/07 14:03:11 sincerti Exp $ 28 28 // ------------------------------------------------------------------- 29 29 … … 35 35 #include "MicrobeamRunAction.hh" 36 36 #include "MicrobeamDetectorConstruction.hh" 37 #include "MicrobeamHistoManager.hh" 37 38 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 41 42 { 42 43 public: 43 MicrobeamSteppingAction(MicrobeamRunAction* ,MicrobeamDetectorConstruction*); 44 MicrobeamSteppingAction(MicrobeamRunAction* ,MicrobeamDetectorConstruction*, 45 MicrobeamHistoManager *); 44 46 ~MicrobeamSteppingAction(); 45 47 … … 49 51 MicrobeamRunAction* Run; 50 52 MicrobeamDetectorConstruction* Detector; 53 MicrobeamHistoManager* Histo; 51 54 G4float massPhantom; 52 55 -
trunk/examples/advanced/microbeam/microbeam.out
r1337 r1342 5 5 6 6 ************************************************************* 7 Geant4 version Name: geant4-09-03-ref-0 6(25-June-2010)7 Geant4 version Name: geant4-09-03-ref-08 (25-June-2010) 8 8 Copyright : Geant4 Collaboration 9 9 Reference : NIM A 506 (2003), 250-303 … … 137 137 ### G4GoudsmitSaundersonTable loading PDF data 138 138 ### G4GoudsmitSaundersonMscModel loading ELSEPA data 139 G4NeutronInelasticXS::G4NeutronInelasticXS: Initialise140 G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise141 139 PhysicsList::SetCuts:CutLength : 10 nm 142 140 G4ProcessTable::Insert : arguments are 0 pointer … … 265 263 BetheBloch : Emin= 2 MeV Emax= 10 TeV 266 264 265 msc: for kaon+ SubType= 10 266 Lambda tables from 100 eV to 10 TeV in 220 bins, spline: 1 267 RangeFactor= 0.2, stepLimitType: 0, latDisplacement: 1 268 ===== EM models for the G4Region DefaultRegionForTheWorld ====== 269 UrbanMsc90 : Emin= 0 eV Emax= 10 TeV 270 267 271 hIoni: for kaon+ SubType= 2 268 272 dE/dx and range tables from 100 eV to 10 TeV in 220 bins … … 364 368 ===== EM models for the G4Region DefaultRegionForTheWorld ====== 365 369 eCoulombScattering : Emin= 0 eV Emax= 10 TeV 366 G4NeutronInelasticXS::BuildPhysicsTable:367 neutron368 G4NEUTRONXSDATA environment variable not set369 G4NeutronCaptureXS::BuildPhysicsTable:370 neutron371 G4NEUTRONXSDATA environment variable not set372 370 373 371 hIoni: for pi+ SubType= 2 … … 563 561 564 562 -> Event # 3 generated 565 ===> Sorry, the incident alpha particle has missed the targeted cell ! 563 ===> The incident alpha particle has reached the targeted cell : 564 -----> total absorbed dose within Nucleus is (Gy) = 0.6101508140564 565 -----> total absorbed dose within Cytoplasm is (Gy) = 0.035633563995361 566 566 567 567 -> Event # 4 generated 568 ===> Sorry, the incident alpha particle has missed the targeted cell ! 568 ===> The incident alpha particle has reached the targeted cell : 569 -----> total absorbed dose within Nucleus is (Gy) = 0.32617983222008 570 -----> total absorbed dose within Cytoplasm is (Gy) = 0.037377636879683 569 571 570 572 -> Event # 5 generated 571 ===> Sorry, the incident alpha particle has missed the targeted cell ! 573 ===> The incident alpha particle has reached the targeted cell : 574 -----> total absorbed dose within Nucleus is (Gy) = 0.35554075241089 575 -----> total absorbed dose within Cytoplasm is (Gy) = 0.024478180333972 572 576 573 577 -> Event # 6 generated 574 ===> The incident alpha particle has reached the targeted cell : 575 -----> total absorbed dose within Nucleus is (Gy) = 0.32255533337593 576 -----> total absorbed dose within Cytoplasm is (Gy) = 0.022024262696505 578 ===> Sorry, the incident alpha particle has missed the targeted cell ! 577 579 578 580 -> Event # 7 generated … … 589 591 590 592 ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer. 591 -> Total number of particles detected by the gas detector : 1593 -> Total number of particles detected by the gas detector : 3 592 594 593 595 Idle> Graphics systems deleted. -
trunk/examples/advanced/microbeam/plot.C
r1230 r1342 1 1 // ------------------------------------------------------------------- 2 // $Id: plot.C,v 1. 5 2009/04/30 10:23:57sincerti Exp $2 // $Id: plot.C,v 1.6 2010/10/07 14:03:11 sincerti Exp $ 3 3 // ------------------------------------------------------------------- 4 4 // … … 24 24 gROOT->SetStyle("Plain"); 25 25 Double_t scale; 26 26 27 27 28 c1 = new TCanvas ("c1","",20,20,1200,900); 28 29 c1.Divide(4,3); 29 30 FILE * fp = fopen("dose.txt","r");31 Float_t nD,cD;32 Int_t ncols=0;33 Int_t nlines = 0;34 35 TH1F *h1 = new TH1F("Absorbed dose distribution in Nucleus","Dose distribution in Nucleus",100,0.001,0.5);36 TH1F *h10 = new TH1F("Absorbed dose distribution in Cytoplasm","Dose distribution in Cytoplasm",100,0.001,0.2);37 38 while (1)39 {40 ncols = fscanf(fp,"%f %f",&nD,&cD);41 if (ncols < 0) break;42 h1->Fill(nD);43 h10->Fill(cD);44 nlines++;45 }46 fclose(fp);47 48 c1.cd(2);49 scale = 1/h1->Integral();50 h1->Scale(scale);51 h1->Draw();52 h1->GetXaxis()->SetLabelSize(0.025);53 h1->GetYaxis()->SetLabelSize(0.025);54 h1->GetXaxis()->SetTitleSize(0.035);55 h1->GetYaxis()->SetTitleSize(0.035);56 h1->GetXaxis()->SetTitleOffset(1.4);57 h1->GetYaxis()->SetTitleOffset(1.4);58 h1->GetXaxis()->SetTitle("Absorbed dose (Gy)");59 h1->GetYaxis()->SetTitle("Fraction of events");60 h1->SetLineColor(3);61 h1->SetFillColor(3);62 63 //*****************64 // DOSE IN CYTOPLASM65 //*****************66 67 c1.cd(6);68 scale = 1/h10->Integral();69 h10->Scale(scale);70 h10->Draw();71 h10->GetXaxis()->SetLabelSize(0.025);72 h10->GetYaxis()->SetLabelSize(0.025);73 h10->GetXaxis()->SetTitleSize(0.035);74 h10->GetYaxis()->SetTitleSize(0.035);75 h10->GetXaxis()->SetTitleOffset(1.4);76 h10->GetYaxis()->SetTitleOffset(1.4);77 h10->GetXaxis()->SetTitle("Absorbed dose (Gy)");78 h10->GetYaxis()->SetTitle("Fraction of events");79 h10->SetLineColor(2);80 h10->SetFillColor(2);81 82 //********************************83 // STOPPING POWER AT CELL ENTRANCE84 //********************************85 86 gStyle->SetOptStat(0000);87 gStyle->SetOptFit();88 gStyle->SetPalette(1);89 gROOT->SetStyle("Plain");90 91 Float_t d;92 FILE * fp = fopen("stoppingPower.txt","r");93 94 TH1F *h2 = new TH1F("Beam stopping Power at cell entrance","h1",200,0,300);95 while (1)96 {97 ncols = fscanf(fp,"%f",&d);98 if (ncols < 0) break;99 h2->Fill(d);100 nlines++;101 }102 fclose(fp);103 104 c1.cd(9);105 scale = 1/h2->Integral();106 h2->Scale(scale);107 h2->Draw();108 h2->GetXaxis()->SetLabelSize(0.025);109 h2->GetYaxis()->SetLabelSize(0.025);110 h2->GetXaxis()->SetTitleSize(0.035);111 h2->GetYaxis()->SetTitleSize(0.035);112 h2->GetXaxis()->SetTitleOffset(1.4);113 h2->GetYaxis()->SetTitleOffset(1.4);114 h2->GetXaxis()->SetTitle("dE/dx (keV/µm)");115 h2->GetYaxis()->SetTitle("Fraction of events");116 h2->SetTitle("dE/dx at cell entrance");117 h2->SetFillColor(4);118 h2->SetLineColor(4);119 h2->Fit("gaus");120 gaus->SetLineColor(6);121 h2->Fit("gaus");122 123 //**************124 // RANGE IN CELL125 //**************126 127 Float_t Xc,Zc,X1,Y1,Z1,x,z,X2,Y2,Z2;128 Float_t d;129 130 // X position of target in World131 Xc = -1295.59e3 - 955e3*sin(10*TMath::Pi()/180);132 133 // Z position of target in World134 Zc = -1327e3 + 955e3*cos(10*TMath::Pi()/180);135 136 // Line alignment (cf MicrobeamEMField.cc)137 Xc = Xc + 5.24*cos(10*TMath::Pi()/180);138 Zc = Zc + 5.24*sin(10*TMath::Pi()/180);139 140 FILE * fp = fopen("range.txt","r");141 142 TNtuple *ntuple = new TNtuple("Rmax","ntuple","Z2:Y2:X2");143 144 while (1)145 {146 ncols = fscanf(fp,"%f %f %f",&X1,&Y1,&Z1);147 if (ncols < 0) break;148 x = X1-Xc;149 z = Z1-Zc;150 Z2 = z*cos(10*TMath::Pi()/180)-x*sin(10*TMath::Pi()/180);151 X2 = z*sin(10*TMath::Pi()/180)+x*cos(10*TMath::Pi()/180);152 Y2 = Y1;153 154 ntuple->Fill(Z2,Y2,X2);155 nlines++;156 }157 fclose(fp);158 159 c1.cd(10);160 ntuple->Draw("X2:Z2","abs(X2)<50","surf3");161 gPad->SetLogz();162 htemp->GetXaxis()->SetLabelSize(0.025);163 htemp->GetYaxis()->SetLabelSize(0.025);164 htemp->GetZaxis()->SetLabelSize(0.025);165 htemp->GetXaxis()->SetTitleSize(0.035);166 htemp->GetYaxis()->SetTitleSize(0.035);167 htemp->GetXaxis()->SetTitleOffset(1.4);168 htemp->GetYaxis()->SetTitleOffset(1.4);169 htemp->GetXaxis()->SetTitle("Z (µm)");170 htemp->GetYaxis()->SetTitle("X (µm)");171 htemp->SetTitle("Range in cell");172 30 173 31 //********************* 174 32 // INTENSITY HISTOGRAMS 175 33 //********************* 34 jump: 176 35 177 36 FILE * fp = fopen("phantom.dat","r"); … … 189 48 190 49 TNtuple *ntupleYXN = new TNtuple("NUCLEUS","ntuple","Y:X:vox"); 191 TNtuple *ntupleZX = new TNtuple("CYTOP ASM","ntuple","Z:X:vox");192 TNtuple *ntupleYX = new TNtuple("CYTOP ASM","ntuple","Y:X:vox");50 TNtuple *ntupleZX = new TNtuple("CYTOPLASM","ntuple","Z:X:vox"); 51 TNtuple *ntupleYX = new TNtuple("CYTOPLASM","ntuple","Y:X:vox"); 193 52 194 53 nlines=0; … … 308 167 hist->SetTitle("Nucleus intensity on transverse section"); 309 168 310 //**************** 311 // ENERGY DEPOSITS 312 //**************** 313 169 // 170 171 TFile f("microbeam.root"); 172 173 TNtuple* ntuple0; 174 TNtuple* ntuple1; 175 TNtuple* ntuple2; 176 TNtuple* ntuple3; 177 TNtuple* ntuple4; 178 179 ntuple0 = (TNtuple*)f->Get("ntuple0"); 180 ntuple1 = (TNtuple*)f->Get("ntuple1"); 181 ntuple2 = (TNtuple*)f->Get("ntuple2"); 182 ntuple3 = (TNtuple*)f->Get("ntuple3"); 183 ntuple4 = (TNtuple*)f->Get("ntuple4"); 184 185 TH1F *h1 = new TH1F("h1","Dose distribution in Nucleus",100,0.001,1.); 186 TH1F *h10 = new TH1F("h10","Dose distribution in Cytoplasm",100,0.001,.2); 187 188 c1.cd(2); 189 190 ntuple3->Project("h1","doseN"); 191 scale = 1/h1->Integral(); 192 h1->Scale(scale); 193 h1->Draw(); 194 h1->GetXaxis()->SetLabelSize(0.025); 195 h1->GetYaxis()->SetLabelSize(0.025); 196 h1->GetXaxis()->SetTitleSize(0.035); 197 h1->GetYaxis()->SetTitleSize(0.035); 198 h1->GetXaxis()->SetTitleOffset(1.4); 199 h1->GetYaxis()->SetTitleOffset(1.4); 200 h1->GetXaxis()->SetTitle("Absorbed dose (Gy)"); 201 h1->GetYaxis()->SetTitle("Fraction of events"); 202 h1->SetLineColor(3); 203 h1->SetFillColor(3); 204 205 //***************** 206 // DOSE IN CYTOPLASM 207 //***************** 208 209 c1.cd(6); 210 ntuple3->Project("h10","doseC"); 211 scale = 1/h10->Integral(); 212 h10->Scale(scale); 213 h10->Draw(); 214 h10->GetXaxis()->SetLabelSize(0.025); 215 h10->GetYaxis()->SetLabelSize(0.025); 216 h10->GetXaxis()->SetTitleSize(0.035); 217 h10->GetYaxis()->SetTitleSize(0.035); 218 h10->GetXaxis()->SetTitleOffset(1.4); 219 h10->GetYaxis()->SetTitleOffset(1.4); 220 h10->GetXaxis()->SetTitle("Absorbed dose (Gy)"); 221 h10->GetYaxis()->SetTitle("Fraction of events"); 222 h10->SetLineColor(2); 223 h10->SetFillColor(2); 224 225 //******************************** 226 // STOPPING POWER AT CELL ENTRANCE 227 //******************************** 228 314 229 gStyle->SetOptStat(0000); 315 230 gStyle->SetOptFit(); … … 317 232 gROOT->SetStyle("Plain"); 318 233 319 FILE * fp = fopen("3DDose.txt","r"); 320 321 TNtuple *ntuple2 = new TNtuple("CELL","ntuple","yVox:xVox:dose"); 322 TNtuple *ntuple3 = new TNtuple("CELL","ntuple","xVox:zVox:dose"); 323 TNtuple *ntuplezyx = new TNtuple("DOSE","ntuple","zVox:yVox:xVox:dose"); 324 325 while (1) 326 { 327 ncols = fscanf(fp,"%f %f %f %f",&xVox, &yVox, &zVox, &dose); 328 if (ncols < 0) break; 329 330 xVox= xVox*voxelSizeX; 331 yVox= yVox*voxelSizeY; 332 zVox= zVox*voxelSizeZ; 333 334 ntuple2->Fill(yVox,xVox,dose); 335 ntuple3->Fill(xVox,zVox,dose); 336 ntuplezyx->Fill(zVox,yVox,xVox,dose); 337 } 338 fclose(fp); 234 Float_t d; 235 236 TH1F *h2 = new TH1F("h2","Beam stopping power at cell entrance",200,0,300); 237 238 c1.cd(9); 239 ntuple0->Project("h2","sp"); 240 scale = 1/h2->Integral(); 241 h2->Scale(scale); 242 h2->Draw(); 243 h2->GetXaxis()->SetLabelSize(0.025); 244 h2->GetYaxis()->SetLabelSize(0.025); 245 h2->GetXaxis()->SetTitleSize(0.035); 246 h2->GetYaxis()->SetTitleSize(0.035); 247 h2->GetXaxis()->SetTitleOffset(1.4); 248 h2->GetYaxis()->SetTitleOffset(1.4); 249 h2->GetXaxis()->SetTitle("dE/dx (keV/µm)"); 250 h2->GetYaxis()->SetTitle("Fraction of events"); 251 h2->SetTitle("dE/dx at cell entrance"); 252 h2->SetFillColor(4); 253 h2->SetLineColor(4); 254 h2->Fit("gaus"); 255 gaus->SetLineColor(6); 256 h2->Fit("gaus"); 257 258 259 //************** 260 // RANGE IN CELL 261 //************** 262 263 Double_t Xc,Zc,X1,Y1,Z1,X2,Y2,Z2; 264 265 // X position of target in World 266 Xc = -1295.59e3 - 955e3*sin(10*TMath::Pi()/180); 267 268 // Z position of target in World 269 Zc = -1327e3 + 955e3*cos(10*TMath::Pi()/180); 270 271 // Line alignment (cf MicrobeamEMField.cc) 272 Xc = Xc + 5.24*cos(10*TMath::Pi()/180); 273 Zc = Zc + 5.24*sin(10*TMath::Pi()/180); 274 275 TNtuple *ntupleR = new TNtuple("Rmax","ntuple","Z2:Y2:X2"); 276 Double_t x,y,z,xx,zz; 277 ntuple2->SetBranchAddress("x",&x); 278 ntuple2->SetBranchAddress("y",&y); 279 ntuple2->SetBranchAddress("z",&z); 280 Int_t nentries = (Int_t)ntuple2->GetEntries(); 281 for (Int_t i=0;i<nentries;i++) 282 { 283 ntuple2->GetEntry(i); 284 X1=x; 285 Y1=y; 286 Z1=z; 287 xx = X1-Xc; 288 zz = Z1-Zc; 289 Z2 = zz*cos(10*TMath::Pi()/180)-xx*sin(10*TMath::Pi()/180); 290 X2 = zz*sin(10*TMath::Pi()/180)+xx*cos(10*TMath::Pi()/180); 291 Y2 = Y1; 292 ntupleR->Fill(Z2,Y2,X2); 293 } 294 295 c1.cd(10); 296 ntupleR->Draw("X2:Z2","abs(X2)<50","surf3"); 297 gPad->SetLogz(); 298 /* 299 htemp->GetXaxis()->SetLabelSize(0.025); 300 htemp->GetYaxis()->SetLabelSize(0.025); 301 htemp->GetZaxis()->SetLabelSize(0.025); 302 htemp->GetXaxis()->SetTitleSize(0.035); 303 htemp->GetYaxis()->SetTitleSize(0.035); 304 htemp->GetXaxis()->SetTitleOffset(1.4); 305 htemp->GetYaxis()->SetTitleOffset(1.4); 306 htemp->GetXaxis()->SetTitle("Z (µm)"); 307 htemp->GetYaxis()->SetTitle("X (µm)"); 308 htemp->SetTitle("Range in cell"); 309 */ 310 311 //**************** 312 // ENERGY DEPOSITS 313 //**************** 314 315 316 gStyle->SetOptStat(0000); 317 gStyle->SetOptFit(); 318 gStyle->SetPalette(1); 319 gROOT->SetStyle("Plain"); 339 320 340 321 c1.cd(11); 341 322 TH2F *hist = new TH2F("hist","hist",50,-20,20,50,-20,20); 342 ntuple 2->Draw("yVox:xVox>>hist","dose","contz");323 ntuple4->Draw("y*0.359060:x*0.359060>>hist","doseV","contz"); 343 324 gPad->SetLogz(); 344 325 hist->Draw("contz"); … … 353 334 hist->GetYaxis()->SetTitle("X (µm)"); 354 335 hist->SetTitle("Mean energy deposit -transverse- (z axis in eV)"); 336 355 337 356 338 c1.cd(12); 357 339 TH2F *hist = new TH2F("hist","hist",50,-20,20,50,-20,20); 358 ntuple 3->Draw("xVox:zVox>>hist","dose","contz");340 ntuple4->Draw("x*0.359060:z*0.162810>>hist","doseV","contz"); 359 341 gPad->SetLogz(); 360 342 hist->Draw("contz"); … … 379 361 gROOT->SetStyle("Plain"); 380 362 381 Float_t bx, by; 382 FILE * fp = fopen("beamPosition.txt","r"); 383 384 TH1F *h77 = new TH1F("Beam X transverse position at cell entrance","h1",200,-10,10); 385 TH1F *h88 = new TH1F("Beam Y transverse position at cell entrance","h1",200,-10,10); 386 while (1) 387 { 388 ncols = fscanf(fp,"%f %f",&bx, &by); 389 if (ncols < 0) break; 390 h77->Fill(bx); 391 h88->Fill(by); 392 nlines++; 393 } 394 fclose(fp); 395 363 TH1F *h77 = new TH1F("hx","h1",200,-10,10); 364 TH1F *h88 = new TH1F("hy","h1",200,-10,10); 365 396 366 c1.cd(4); 397 scale = 1/h77->Integral(); 367 ntuple1->Project("hx","x"); 368 scale = 1/h77->Integral(); 398 369 h77->Scale(scale); 399 370 h77->Draw(); … … 413 384 414 385 c1.cd(8); 415 scale = 1/h88->Integral(); 386 ntuple1->Project("hy","y"); 387 scale = 1/h88->Integral(); 416 388 h88->Scale(scale); 417 389 h88->Draw(); -
trunk/examples/advanced/microbeam/src/MicrobeamEventAction.cc
r1337 r1342 25 25 // 26 26 // ------------------------------------------------------------------- 27 // $Id: MicrobeamEventAction.cc,v 1. 8 2010/06/07 03:18:01 sincerti Exp $27 // $Id: MicrobeamEventAction.cc,v 1.9 2010/10/07 14:03:11 sincerti Exp $ 28 28 // ------------------------------------------------------------------- 29 29 … … 33 33 #include "MicrobeamEventAction.hh" 34 34 #include "MicrobeamRunAction.hh" 35 #include "MicrobeamHistoManager.hh" 35 36 36 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 37 38 38 MicrobeamEventAction::MicrobeamEventAction(MicrobeamRunAction* run) 39 :Run(run),drawFlag("all"),printModulo(10000) 39 MicrobeamEventAction::MicrobeamEventAction(MicrobeamRunAction* run, 40 MicrobeamHistoManager * his) 41 :Run(run),Histo(his),drawFlag("all"),printModulo(10000) 40 42 {} 41 43 … … 64 66 if (Run->GetDoseN()>0 || Run->GetDoseC()>0) 65 67 { 66 FILE* myFile;67 myFile=fopen("dose.txt","a");68 fprintf(myFile,"%e %e\n",Run->GetDoseN(),Run->GetDoseC()); 69 fclose (myFile); 68 Histo->FillNtuple(3,0,Run->GetDoseN()); 69 Histo->FillNtuple(3,1,Run->GetDoseC()); 70 Histo->AddRowNtuple(3); 71 70 72 G4cout << " ===> The incident alpha particle has reached the targeted cell :" << G4endl; 71 73 G4cout << " -----> total absorbed dose within Nucleus is (Gy) = " << Run->GetDoseN() << G4endl; -
trunk/examples/advanced/microbeam/src/MicrobeamRunAction.cc
r807 r1342 25 25 // 26 26 // ------------------------------------------------------------------- 27 // $Id: MicrobeamRunAction.cc,v 1. 6 2006/06/29 16:05:37 gunterExp $27 // $Id: MicrobeamRunAction.cc,v 1.7 2010/10/07 14:03:11 sincerti Exp $ 28 28 // ------------------------------------------------------------------- 29 29 … … 36 36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 37 37 38 MicrobeamRunAction::MicrobeamRunAction(MicrobeamDetectorConstruction* det) 39 :Detector(det) 38 MicrobeamRunAction::MicrobeamRunAction(MicrobeamDetectorConstruction* det, 39 MicrobeamHistoManager * his) 40 :Detector(det),Histo(his) 40 41 { 41 42 saveRndm = 0; … … 55 56 { 56 57 58 // Histograms 59 Histo->book(); 60 57 61 // save Rndm status 58 62 if (saveRndm > 0) … … 99 103 } 100 104 101 FILE *myFile;102 myFile=fopen("3DDose.txt","a");103 105 for (G4int i=0; i<nbOfPixels; i++) 104 106 { … … 106 108 v = mapVoxels[i]; 107 109 if ( (GetNumEvent()+1) !=0) 108 fprintf (myFile,"%f %f %f %f \n", v.x(), v.y(), v.z(), dose3DDose[i]/(GetNumEvent()+1)); 110 { 111 Histo->FillNtuple(4,0,v.x()); 112 Histo->FillNtuple(4,1,v.y()); 113 Histo->FillNtuple(4,2,v.z()); 114 Histo->FillNtuple(4,3,dose3DDose[i]/(GetNumEvent()+1)); 115 Histo->AddRowNtuple(4); 116 } 109 117 } 110 fclose (myFile); 111 118 112 119 G4cout << "-> Total number of particles detected by the gas detector : " << GetNbOfHitsGas() << G4endl; 113 120 G4cout << G4endl; 121 122 //save histograms 123 Histo->save(); 124 114 125 } -
trunk/examples/advanced/microbeam/src/MicrobeamSteppingAction.cc
r1230 r1342 25 25 // 26 26 // ------------------------------------------------------------------- 27 // $Id: MicrobeamSteppingAction.cc,v 1. 9 2008/06/16 07:46:11 sincerti Exp $27 // $Id: MicrobeamSteppingAction.cc,v 1.10 2010/10/07 14:03:11 sincerti Exp $ 28 28 // ------------------------------------------------------------------- 29 29 … … 36 36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 37 37 38 MicrobeamSteppingAction::MicrobeamSteppingAction(MicrobeamRunAction* run,MicrobeamDetectorConstruction* det) 39 :Run(run),Detector(det) 38 MicrobeamSteppingAction::MicrobeamSteppingAction(MicrobeamRunAction* run,MicrobeamDetectorConstruction* det, 39 MicrobeamHistoManager* his) 40 :Run(run),Detector(det),Histo(his) 40 41 { } 41 42 … … 86 87 { 87 88 88 if(aStep->GetTotalEnergyDeposit()>0)89 if( (aStep->GetPreStepPoint()->GetKineticEnergy() - aStep->GetPostStepPoint()->GetKineticEnergy() ) >0) 89 90 { 90 FILE *myFile;91 myFile=fopen("stoppingPower.txt","a"); 92 fprintf(myFile,"%e \n",93 (aStep->GetTotalEnergyDeposit()/keV)/(aStep->GetStepLength()/micrometer));94 fclose (myFile);91 Histo->FillNtuple(0,0,aStep->GetPreStepPoint()->GetKineticEnergy()/keV); 92 Histo->FillNtuple(0,1, 93 (aStep->GetPreStepPoint()->GetKineticEnergy() - 94 aStep->GetPostStepPoint()->GetKineticEnergy())/ keV/(aStep->GetStepLength()/micrometer)); 95 Histo->AddRowNtuple(0); 95 96 } 96 97 97 // Average dE over step s yggested by Michel Maire98 // Average dE over step suggested by Michel Maire 98 99 99 100 G4StepPoint* p1 = aStep->GetPreStepPoint(); … … 111 112 // end 112 113 113 FILE *myFile; 114 myFile=fopen("beamPosition.txt","a"); 115 fprintf 116 ( 117 myFile,"%e %e \n", 118 localPosition.x()/micrometer, 119 localPosition.y()/micrometer 120 ); 121 fclose (myFile); 114 Histo->FillNtuple(1,0,localPosition.x()/micrometer); 115 Histo->FillNtuple(1,1,localPosition.y()/micrometer); 116 Histo->AddRowNtuple(1); 122 117 123 118 } … … 142 137 143 138 { 144 FILE *myFile; 145 myFile=fopen("range.txt","a"); 146 fprintf 147 ( myFile,"%e %e %e\n", 148 (aStep->GetTrack()->GetPosition().x())/micrometer, 149 (aStep->GetTrack()->GetPosition().y())/micrometer, 150 (aStep->GetTrack()->GetPosition().z())/micrometer 151 ); 152 fclose (myFile); 139 Histo->FillNtuple(2,0,aStep->GetPostStepPoint()->GetPosition().x()/micrometer); 140 Histo->FillNtuple(2,1,aStep->GetPostStepPoint()->GetPosition().y()/micrometer); 141 Histo->FillNtuple(2,2,aStep->GetPostStepPoint()->GetPosition().z()/micrometer); 142 Histo->AddRowNtuple(2); 153 143 } 154 144 155 145 // TOTAL DOSE DEPOSIT AND DOSE DEPOSIT WITHIN A PHANTOM VOXEL 146 // FOR ALL PARTICLES 156 147 157 148 if (aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "physicalNucleus")
Note: See TracChangeset
for help on using the changeset viewer.