Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file optical/OpNovice2/src/HistoManager.c 26 /// \file optical/OpNovice2/src/HistoManager.cc 27 /// \brief Implementation of the HistoManager 27 /// \brief Implementation of the HistoManager class 28 // 28 // 29 // 29 // 30 // << 30 // 31 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 33 34 #include "HistoManager.hh" 34 #include "HistoManager.hh" 35 << 36 #include "G4UnitsTable.hh" 35 #include "G4UnitsTable.hh" 37 36 38 //....oooOO0OOooo........oooOO0OOooo........oo 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 39 38 40 HistoManager::HistoManager() : fFileName("opno << 39 HistoManager::HistoManager() >> 40 : fFileName("opnovice2") 41 { 41 { 42 Book(); 42 Book(); 43 } 43 } 44 44 45 //....oooOO0OOooo........oooOO0OOooo........oo 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 46 >> 47 HistoManager::~HistoManager() >> 48 { >> 49 delete G4AnalysisManager::Instance(); >> 50 } >> 51 >> 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 53 47 void HistoManager::Book() 54 void HistoManager::Book() 48 { 55 { 49 // Create or get analysis manager 56 // Create or get analysis manager 50 G4AnalysisManager* analysisMan = G4AnalysisM << 57 // The choice of analysis technology is done via selection of a namespace 51 analysisMan->SetDefaultFileType("root"); << 58 // in HistoManager.hh 52 analysisMan->SetFileName(fFileName); << 59 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 53 analysisMan->SetVerboseLevel(1); << 60 analysisManager->SetFileName(fFileName); 54 analysisMan->SetActivation(true); // enable << 61 analysisManager->SetVerboseLevel(1); 55 << 62 analysisManager->SetActivation(true); // enable inactivation of histograms 56 // Define histograms << 63 57 // Default values (to be reset via /analysis << 64 // Define histogram indices, titles 58 G4int n = 100; << 65 G4int maxHisto = 13; 59 G4double xmn = 0.; << 66 G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", 60 G4double xmx = 100.; << 67 "10","11","12","13" }; 61 << 68 62 // 0 << 69 G4String title[] = { 63 analysisMan->CreateH1("0", "dummy", n, xmn, << 70 "dummy", // 0 64 // 1 << 71 "Cerenkov spectrum", // 1 65 analysisMan->CreateH1("Cerenkov spectrum", " << 72 "scintillation spectrum", // 2 66 // 2 << 73 "boundary process status", // 3 67 analysisMan->CreateH1("Scintillation spectru << 74 "X momentum dir of backward-going photons", // 4 68 // 3 << 75 "Y momentum dir of backward-going photons", // 5 69 analysisMan->CreateH1("Scintillation time", << 76 "Z momentum dir of backward-going photons", // 6 70 // 4 << 77 "X momentum dir of forward-going photons", // 7 71 analysisMan->CreateH1("WLS abs", "WLS absorp << 78 "Y momentum dir of forward-going photons", // 8 72 // 5 << 79 "Z momentum dir of forward-going photons", // 9 73 analysisMan->CreateH1("WLS em", "WLS emissio << 80 "X momentum dir of Fresnel-refracted photons", //10 74 // 6 << 81 "Y momentum dir of Fresnel-refracted photons", //11 75 analysisMan->CreateH1("WLS time", "WLS emiss << 82 "Z momentum dir of Fresnel-refracted photons", //12 76 // 7 << 83 "scintillation photons creation time", //13 77 analysisMan->CreateH1("WLS2 abs", "WLS2 abso << 84 }; 78 // 8 << 85 79 analysisMan->CreateH1("WLS2 em", "WLS2 emiss << 86 // Default values (to be reset via /analysis/h1/set command) 80 // 9 << 87 G4int nbins = 100; 81 analysisMan->CreateH1("WLS2 time", "WLS2 emi << 88 G4double vmin = 0.; 82 // 10 << 89 G4double vmax = 100.; 83 analysisMan->CreateH1("bdry status", "bounda << 90 84 // 11 << 91 // Create all histograms as inactivated 85 analysisMan->CreateH1("x_backward", "X momen << 92 for (G4int k=0; k <= maxHisto; ++k) { 86 // 12 << 93 G4int ih = analysisManager->CreateH1(id[k], title[k], nbins, vmin, vmax); 87 analysisMan->CreateH1("y_backward", "Y momen << 94 analysisManager->SetH1Activation(ih, false); 88 // 13 << 89 analysisMan->CreateH1("z_backward", "Z momen << 90 // 14 << 91 analysisMan->CreateH1("x_forward", "X moment << 92 // 15 << 93 analysisMan->CreateH1("y_forward", "Y moment << 94 // 16 << 95 analysisMan->CreateH1("z_forward", "Z moment << 96 // 17 << 97 analysisMan->CreateH1("x_fresnel", "X moment << 98 // 18 << 99 analysisMan->CreateH1("y_fresnel", "Y moment << 100 // 19 << 101 analysisMan->CreateH1("z_fresnel", "Z moment << 102 // 20 << 103 analysisMan->CreateH1("Fresnel refraction", << 104 // 21 << 105 analysisMan->CreateH1("Fresnel reflection", << 106 // 22 << 107 analysisMan->CreateH1("Total internal reflec << 108 xmx); << 109 // 23 << 110 analysisMan->CreateH1("Fresnel reflection pl << 111 xmx); << 112 // 24 << 113 analysisMan->CreateH1("Absorption", "Absorbe << 114 // 25 << 115 analysisMan->CreateH1("Transmitted", "Transm << 116 // 26 << 117 analysisMan->CreateH1("Spike reflection", "S << 118 << 119 for (G4int i = 0; i < analysisMan->GetNofH1s << 120 analysisMan->SetH1Activation(i, false); << 121 } 95 } 122 } 96 } 123 97