[807] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // $Id: FCALRunAction.cc,v 1.7 2006/06/29 16:03:13 gunter Exp $ |
---|
[1230] | 27 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
[807] | 28 | // |
---|
| 29 | // |
---|
| 30 | |
---|
| 31 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 32 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 33 | |
---|
| 34 | //#ifndef G4ANALYSIS_USE |
---|
| 35 | |
---|
| 36 | #include "FCALRunAction.hh" |
---|
| 37 | |
---|
| 38 | #include "G4Run.hh" |
---|
| 39 | #include "G4RunManager.hh" |
---|
| 40 | #include "G4UImanager.hh" |
---|
| 41 | #include "G4VVisManager.hh" |
---|
| 42 | #include "G4ios.hh" |
---|
| 43 | |
---|
| 44 | #include "Randomize.hh" |
---|
| 45 | #include "FCALAnalysisManager.hh" |
---|
| 46 | //#include <AIDA/AIDA.h> |
---|
| 47 | |
---|
| 48 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 49 | |
---|
| 50 | FCALRunAction::FCALRunAction() |
---|
| 51 | { |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 55 | |
---|
| 56 | FCALRunAction::~FCALRunAction() |
---|
| 57 | { |
---|
| 58 | |
---|
| 59 | // cleanHisto(); |
---|
| 60 | |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | //void FCALRunAction::bookHisto(){ |
---|
| 65 | // |
---|
| 66 | // AIDA::IAnalysisFactory* af = AIDA_createAnalysisFactory(); |
---|
| 67 | // |
---|
| 68 | // // Creating the tree factory |
---|
| 69 | // AIDA::ITreeFactory* tf = af->createTreeFactory(); |
---|
| 70 | // |
---|
| 71 | // // Creating a tree mapped to an hbook file. |
---|
| 72 | // tree = tf->create("fcal.paw", "hbook", false, true); |
---|
| 73 | // |
---|
| 74 | // // Creating a histogram factory, whose histograms will be handled by the tree |
---|
| 75 | // AIDA::IHistogramFactory* hf = af->createHistogramFactory(*tree); |
---|
| 76 | // |
---|
| 77 | // // Creating a ntuple factory. |
---|
| 78 | // |
---|
| 79 | // AIDA::ITupleFactory* nf = af->createTupleFactory(*tree); |
---|
| 80 | // |
---|
| 81 | // // Creating ntuples |
---|
| 82 | // |
---|
| 83 | // ntuple[1] = nf->create("100","Number Out of World","float OutOfWorld, i, j"); |
---|
| 84 | // |
---|
| 85 | // ntuple[2] = nf->create("200","Secondary Info","float Secondary, i, j"); |
---|
| 86 | // |
---|
| 87 | // ntuple[3] = nf->create("300","Energy Deposits","float EmEdep, HadEdep"); |
---|
| 88 | // |
---|
| 89 | // // Creating Histograms |
---|
| 90 | // |
---|
| 91 | // histo[1] = hf->createHistogram1D("1","Number of OutOfWorld",100, 0., 100.); |
---|
| 92 | // histo[2] = hf->createHistogram1D("2","Number of Secondaries",100, 0., 100.); |
---|
| 93 | // histo[3] = hf->createHistogram1D("3","Electromagnetic Energy / MeV",100, 0., 100.); |
---|
| 94 | // histo[4] = hf->createHistogram1D("4","Hadronic Energy / MeV",100, 0., 100.); |
---|
| 95 | // |
---|
| 96 | // delete hf; |
---|
| 97 | // delete tf; |
---|
| 98 | // delete af; |
---|
| 99 | // delete nf; |
---|
| 100 | // |
---|
| 101 | //} |
---|
| 102 | // |
---|
| 103 | ////....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 104 | // |
---|
| 105 | //void FCALRunAction::cleanHisto() |
---|
| 106 | //{ |
---|
| 107 | // |
---|
| 108 | // tree->commit(); // Writing the histograms to the file |
---|
| 109 | // tree->close(); // and closing the tree (and the file) |
---|
| 110 | // |
---|
| 111 | // delete tree; |
---|
| 112 | // |
---|
| 113 | // |
---|
| 114 | //} |
---|
| 115 | // |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 119 | |
---|
| 120 | void FCALRunAction::BeginOfRunAction(const G4Run* aRun) |
---|
| 121 | { |
---|
| 122 | |
---|
| 123 | G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl; |
---|
| 124 | |
---|
| 125 | // if (aRun->GetRunID() == 0) bookHisto(); |
---|
| 126 | |
---|
| 127 | if (G4VVisManager::GetConcreteInstance()) |
---|
| 128 | { |
---|
| 129 | G4UImanager* UI = G4UImanager::GetUIpointer(); |
---|
| 130 | UI->ApplyCommand("/vis/scene/notifyHandlers"); |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | #ifdef G4ANALYSIS_USE |
---|
| 134 | |
---|
| 135 | // book histograms and ntuples |
---|
| 136 | |
---|
| 137 | FCALAnalysisManager * analysis = FCALAnalysisManager::getInstance(); |
---|
| 138 | analysis->book(); |
---|
| 139 | |
---|
| 140 | #endif |
---|
| 141 | |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 145 | |
---|
| 146 | void FCALRunAction::EndOfRunAction(const G4Run* ) |
---|
| 147 | { |
---|
| 148 | |
---|
| 149 | #ifdef G4ANALYSIS_USE |
---|
| 150 | FCALAnalysisManager* analysis = FCALAnalysisManager::getInstance(); |
---|
| 151 | #endif |
---|
| 152 | |
---|
| 153 | if (G4VVisManager::GetConcreteInstance()) { |
---|
| 154 | G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update"); |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | #ifdef G4ANALYSIS_USE |
---|
| 158 | analysis->finish(); |
---|
| 159 | #endif |
---|
| 160 | |
---|
| 161 | } |
---|
| 162 | |
---|
| 163 | //#endif |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | |
---|