| [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 | // ********************************************************************
|
|---|
| 27 | // $Id: MedLinacAnalysisManager.cc,v 1.9 2006/06/29 16:04:15 gunter Exp $
|
|---|
| 28 | //
|
|---|
| 29 | //
|
|---|
| 30 | // Code developed by: M. Piergentili
|
|---|
| 31 | //
|
|---|
| 32 | //
|
|---|
| 33 | #ifdef G4ANALYSIS_USE
|
|---|
| 34 | #include <stdlib.h>
|
|---|
| 35 | #include <fstream>
|
|---|
| 36 | #include "MedLinacAnalysisManager.hh"
|
|---|
| 37 |
|
|---|
| 38 | #include "G4ios.hh"
|
|---|
| 39 |
|
|---|
| 40 | #include "AIDA/IHistogram1D.h"
|
|---|
| 41 | #include "AIDA/IHistogram2D.h"
|
|---|
| 42 |
|
|---|
| 43 | #include "AIDA/IManagedObject.h"
|
|---|
| 44 | #include "AIDA/IAnalysisFactory.h"
|
|---|
| 45 | #include "AIDA/IHistogramFactory.h"
|
|---|
| 46 | #include "AIDA/ITupleFactory.h"
|
|---|
| 47 | #include "AIDA/ITreeFactory.h"
|
|---|
| 48 | #include "AIDA/ITree.h"
|
|---|
| 49 | #include "AIDA/ITuple.h"
|
|---|
| 50 |
|
|---|
| 51 | MedLinacAnalysisManager* MedLinacAnalysisManager::instance = 0;
|
|---|
| 52 |
|
|---|
| 53 | MedLinacAnalysisManager::MedLinacAnalysisManager():
|
|---|
| 54 | aFact(0), theTree(0), histFact(0),h1(0),h2(0),h3(0),
|
|---|
| 55 | h4(0),h5(0),h6(0),h7(0),h8(0),h9(0),h10(0),
|
|---|
| 56 | h11(0),h12(0),h13(0),h14(0),h15(0)
|
|---|
| 57 |
|
|---|
| 58 | {
|
|---|
| 59 | //build up the factories
|
|---|
| 60 | aFact = AIDA_createAnalysisFactory();
|
|---|
| 61 |
|
|---|
| 62 | AIDA::ITreeFactory *treeFact = aFact->createTreeFactory();
|
|---|
| 63 |
|
|---|
| 64 | //parameters for the TreeFactory
|
|---|
| 65 |
|
|---|
| 66 | std::string fileName = "MedLinacDiane.xml";
|
|---|
| 67 | theTree = treeFact->create(fileName,"xml",false, true,"uncompress");
|
|---|
| 68 |
|
|---|
| 69 | delete treeFact;
|
|---|
| 70 |
|
|---|
| 71 | histFact = aFact->createHistogramFactory( *theTree );
|
|---|
| 72 |
|
|---|
| 73 | }
|
|---|
| 74 | MedLinacAnalysisManager::~MedLinacAnalysisManager()
|
|---|
| 75 | {
|
|---|
| 76 | delete histFact;
|
|---|
| 77 | histFact = 0;
|
|---|
| 78 |
|
|---|
| 79 | delete theTree;
|
|---|
| 80 | histFact = 0;
|
|---|
| 81 |
|
|---|
| 82 | delete aFact;
|
|---|
| 83 | aFact = 0;
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | MedLinacAnalysisManager* MedLinacAnalysisManager::getInstance()
|
|---|
| 87 | {
|
|---|
| 88 | if (instance == 0) instance = new MedLinacAnalysisManager;
|
|---|
| 89 | return instance;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | void MedLinacAnalysisManager::book()
|
|---|
| 93 | {
|
|---|
| 94 | //creating an other 1D histogram ...
|
|---|
| 95 | h1 = histFact->createHistogram1D("14010","PDD5", //histoID,histo name
|
|---|
| 96 | 60,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 97 | //creating an other 1D histogram ...
|
|---|
| 98 | h2 = histFact->createHistogram1D("14020","Flatness build-up5", //histoID,histo name
|
|---|
| 99 | 60,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 100 |
|
|---|
| 101 | //creating an other 1D histogram ...
|
|---|
| 102 | h3 = histFact->createHistogram1D("14030","Flatness 50mm 5", //histoID,histo name
|
|---|
| 103 | 60,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 104 |
|
|---|
| 105 | //creating an other 1D histogram ...
|
|---|
| 106 | h4 = histFact->createHistogram1D("14040","Flatness 100mm 5", //histoID,histo name
|
|---|
| 107 | 60,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 108 | //creating an other 1D histogram ...
|
|---|
| 109 | h5 = histFact->createHistogram1D("14050","Flatness 200mm 5", //histoID,histo name
|
|---|
| 110 | 60,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 111 |
|
|---|
| 112 | //creating an other 1D histogram ...
|
|---|
| 113 | h6 = histFact->createHistogram1D("14060","PDD 2", //histoID,histo name
|
|---|
| 114 | 150,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 115 | //creating an other 1D histogram ...
|
|---|
| 116 | h7 = histFact->createHistogram1D("14070","Flatness build-up 2",//histoID,histo name
|
|---|
| 117 | 150,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 118 | //creating an other 1D histogram ...
|
|---|
| 119 | h8 = histFact->createHistogram1D("14080","Flatness 50mm 2", //histoID,histo name
|
|---|
| 120 | 150,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 121 | //creating an other 1D histogram ...
|
|---|
| 122 | h9 = histFact->createHistogram1D("14090","Flatness 100mm 2", //histoID,histo name
|
|---|
| 123 | 150,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 124 | //creating an other 1D histogram ...
|
|---|
| 125 | h10 = histFact->createHistogram1D("14100","Flatness 200mm 2", //histoID,histo name
|
|---|
| 126 | 150,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 | //creating an other 1D histogram ...
|
|---|
| 130 | h11 = histFact->createHistogram1D("14101","PDD 1", //histoID,histo name
|
|---|
| 131 | 300,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 132 | //creating an other 1D histogram ...
|
|---|
| 133 | h12 = histFact->createHistogram1D("14102","Flatness build-up 1",//histoID,histo name
|
|---|
| 134 | 300,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 135 | //creating an other 1D histogram ...
|
|---|
| 136 | h13 = histFact->createHistogram1D("14103","Flatness 50mm 1", //histoID,histo name
|
|---|
| 137 | 300,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 138 | //creating an other 1D histogram ...
|
|---|
| 139 | h14 = histFact->createHistogram1D("14104","Flatness 100mm 1", //histoID,histo name
|
|---|
| 140 | 300,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 141 | //creating an other 1D histogram ...
|
|---|
| 142 | h15 = histFact->createHistogram1D("14105","Flatness 200mm 1", //histoID,histo name
|
|---|
| 143 | 300,-150.0,150.0); //bins' number, zmin, zmax
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | void MedLinacAnalysisManager::FillHistogram1WithEnergy(G4double z,
|
|---|
| 149 | G4float energyDeposit)
|
|---|
| 150 | {
|
|---|
| 151 | //G4cout << " fill HISTO1-------------"<<G4endl;
|
|---|
| 152 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (0,0,z)
|
|---|
| 153 | h1->fill(z,energyDeposit);
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 | void MedLinacAnalysisManager::FillHistogram2WithEnergy(G4double x,
|
|---|
| 157 | G4float energyDeposit)
|
|---|
| 158 | {
|
|---|
| 159 | //G4cout << " fill HISTO2-------------"<<G4endl;
|
|---|
| 160 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,135mm)
|
|---|
| 161 | h2->fill(x,energyDeposit);
|
|---|
| 162 | }
|
|---|
| 163 | void MedLinacAnalysisManager::FillHistogram3WithEnergy(G4double x,
|
|---|
| 164 | G4float energyDeposit)
|
|---|
| 165 | {
|
|---|
| 166 | //G4cout << " fill HISTO3-------------"<<G4endl;
|
|---|
| 167 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,135mm)
|
|---|
| 168 | h3->fill(x,energyDeposit);
|
|---|
| 169 | }
|
|---|
| 170 |
|
|---|
| 171 | void MedLinacAnalysisManager::FillHistogram4WithEnergy(G4double x,
|
|---|
| 172 | G4float energyDeposit)
|
|---|
| 173 | {
|
|---|
| 174 | //G4cout << " fill HISTO4-------------"<<G4endl;
|
|---|
| 175 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,80mm)
|
|---|
| 176 | h4->fill(x,energyDeposit);
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| 179 | void MedLinacAnalysisManager::FillHistogram5WithEnergy(G4double x,
|
|---|
| 180 | G4float energyDeposit)
|
|---|
| 181 | {
|
|---|
| 182 | //G4cout << " fill HISTO5-------------"<<G4endl;
|
|---|
| 183 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,30mm)
|
|---|
| 184 | h5->fill(x,energyDeposit);
|
|---|
| 185 | }
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 | void MedLinacAnalysisManager::FillHistogram6WithEnergy(G4double z,
|
|---|
| 189 | G4float energyDeposit)
|
|---|
| 190 | {
|
|---|
| 191 | //G4cout << " fill HISTO6-------------"<<G4endl;
|
|---|
| 192 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (0,0,z)
|
|---|
| 193 | h6->fill(z,energyDeposit);
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | void MedLinacAnalysisManager::FillHistogram7WithEnergy(G4double x,
|
|---|
| 197 | G4float energyDeposit)
|
|---|
| 198 | {
|
|---|
| 199 | //G4cout << " fill HISTO7-------------"<<G4endl;
|
|---|
| 200 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,135mm)
|
|---|
| 201 | h7->fill(x,energyDeposit);
|
|---|
| 202 | }
|
|---|
| 203 |
|
|---|
| 204 | void MedLinacAnalysisManager::FillHistogram8WithEnergy(G4double x,
|
|---|
| 205 | G4float energyDeposit)
|
|---|
| 206 | {
|
|---|
| 207 | //G4cout << " fill HISTO8-------------"<<G4endl;
|
|---|
| 208 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,80mm)
|
|---|
| 209 | h8->fill(x,energyDeposit);
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 | void MedLinacAnalysisManager::FillHistogram9WithEnergy(G4double x,
|
|---|
| 213 | G4float energyDeposit)
|
|---|
| 214 | {
|
|---|
| 215 | //G4cout << " fill HISTO9-------------"<<G4endl;
|
|---|
| 216 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,30mm)
|
|---|
| 217 | h9->fill(x,energyDeposit);
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|
| 220 | void MedLinacAnalysisManager::FillHistogram10WithEnergy(G4double x,
|
|---|
| 221 | G4float energyDeposit)
|
|---|
| 222 | {
|
|---|
| 223 | //G4cout << " fill HISTO10-------------"<<G4endl;
|
|---|
| 224 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,-70mm)
|
|---|
| 225 | h10->fill(x,energyDeposit);
|
|---|
| 226 | }
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 | void MedLinacAnalysisManager::FillHistogram11WithEnergy(G4double z,
|
|---|
| 230 | G4float energyDeposit)
|
|---|
| 231 | {
|
|---|
| 232 | //G4cout << " fill HISTO11-------------"<<G4endl;
|
|---|
| 233 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (0,0,z)
|
|---|
| 234 | h11->fill(z,energyDeposit);
|
|---|
| 235 | }
|
|---|
| 236 |
|
|---|
| 237 | void MedLinacAnalysisManager::FillHistogram12WithEnergy(G4double x,
|
|---|
| 238 | G4float energyDeposit)
|
|---|
| 239 | {
|
|---|
| 240 | //G4cout << " fill HISTO12-------------"<<G4endl;
|
|---|
| 241 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,135mm)
|
|---|
| 242 | h12->fill(x,energyDeposit);
|
|---|
| 243 | }
|
|---|
| 244 |
|
|---|
| 245 | void MedLinacAnalysisManager::FillHistogram13WithEnergy(G4double x,
|
|---|
| 246 | G4float energyDeposit)
|
|---|
| 247 | {
|
|---|
| 248 | //G4cout << " fill HISTO13-------------"<<G4endl;
|
|---|
| 249 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,80mm)
|
|---|
| 250 | h13->fill(x,energyDeposit);
|
|---|
| 251 | }
|
|---|
| 252 |
|
|---|
| 253 | void MedLinacAnalysisManager::FillHistogram14WithEnergy(G4double x,
|
|---|
| 254 | G4float energyDeposit)
|
|---|
| 255 | {
|
|---|
| 256 | //G4cout << " fill HISTO14-------------"<<G4endl;
|
|---|
| 257 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,30mm)
|
|---|
| 258 | h14->fill(x,energyDeposit);
|
|---|
| 259 | }
|
|---|
| 260 |
|
|---|
| 261 | void MedLinacAnalysisManager::FillHistogram15WithEnergy(G4double x,
|
|---|
| 262 | G4float energyDeposit)
|
|---|
| 263 | {
|
|---|
| 264 | //G4cout << " fill HISTO15-------------"<<G4endl;
|
|---|
| 265 | //1DHistrogram: energy deposit in a voxel which center is fixed in position (x,0,-70mm)
|
|---|
| 266 | h15->fill(x,energyDeposit);
|
|---|
| 267 | }
|
|---|
| 268 |
|
|---|
| 269 | void MedLinacAnalysisManager::finish()
|
|---|
| 270 | {
|
|---|
| 271 | // write all histograms to file ...
|
|---|
| 272 | theTree->commit();
|
|---|
| 273 |
|
|---|
| 274 | // close (will again commit) ...
|
|---|
| 275 | theTree->close();
|
|---|
| 276 | }
|
|---|
| 277 | #endif
|
|---|
| 278 |
|
|---|
| 279 |
|
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 |
|
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 |
|
|---|