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 hadronic/Hadr02/src/Histo.cc 26 /// \file hadronic/Hadr02/src/Histo.cc 27 /// \brief Implementation of the Histo class 27 /// \brief Implementation of the Histo class 28 // 28 // 29 // 29 // 30 //-------------------------------------------- 30 //--------------------------------------------------------------------------- 31 // 31 // 32 // ClassName: Histo - Generic histogram/ntup 32 // ClassName: Histo - Generic histogram/ntuple manager class 33 // 33 // 34 // 34 // 35 // Author: V.Ivanchenko 30.10.03 35 // Author: V.Ivanchenko 30.10.03 36 // 36 // 37 //-------------------------------------------- 37 //---------------------------------------------------------------------------- 38 // 38 // 39 39 40 //....oooOO0OOooo........oooOO0OOooo........oo 40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 41 //....oooOO0OOooo........oooOO0OOooo........oo 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 42 42 43 #include "Histo.hh" 43 #include "Histo.hh" 44 << 45 #include "HistoMessenger.hh" 44 #include "HistoMessenger.hh" 46 << 47 #include "G4RootAnalysisManager.hh" 45 #include "G4RootAnalysisManager.hh" 48 #include "G4SystemOfUnits.hh" << 49 #include "G4XmlAnalysisManager.hh" 46 #include "G4XmlAnalysisManager.hh" 50 #include "G4ios.hh" 47 #include "G4ios.hh" >> 48 #include "G4SystemOfUnits.hh" >> 49 51 50 52 //....oooOO0OOooo........oooOO0OOooo........oo 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 53 //....oooOO0OOooo........oooOO0OOooo........oo 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 54 53 55 Histo::Histo() 54 Histo::Histo() 56 { 55 { 57 fManager = 0; << 56 fManager = 0; 58 fMessenger = new HistoMessenger(this); 57 fMessenger = new HistoMessenger(this); 59 58 60 fHistName = "test"; << 59 fHistName = "test"; 61 fHistType = "root"; << 60 fHistType = "root"; 62 fTupleName = "tuple"; << 61 fTupleName = "tuple"; 63 fTupleTitle = "test"; 62 fTupleTitle = "test"; 64 fNHisto = 0; << 63 fNHisto = 0; 65 fVerbose = 0; << 64 fVerbose = 0; 66 fDefaultAct = true; 65 fDefaultAct = true; 67 fHistoActive = false; << 66 fHistoActive= false; 68 fNtupleActive = false; << 67 fNtupleActive= false; 69 } 68 } 70 69 71 //....oooOO0OOooo........oooOO0OOooo........oo 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 71 73 Histo::~Histo() 72 Histo::~Histo() 74 { 73 { 75 delete fMessenger; 74 delete fMessenger; >> 75 delete fManager; 76 } 76 } 77 77 78 //....oooOO0OOooo........oooOO0OOooo........oo 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 79 79 80 void Histo::Book() 80 void Histo::Book() 81 { 81 { 82 if (!(fHistoActive || fNtupleActive)) { << 82 if(!(fHistoActive || fNtupleActive)) { return; } 83 return; << 84 } << 85 83 86 // Always creating analysis manager 84 // Always creating analysis manager 87 if (fHistType == "root") { << 85 if ( fHistType == "root" ) { 88 fManager = G4RootAnalysisManager::Instance << 86 fManager = G4RootAnalysisManager::Instance(); 89 } << 87 } else { 90 else { << 91 fManager = G4XmlAnalysisManager::Instance( 88 fManager = G4XmlAnalysisManager::Instance(); 92 } 89 } 93 90 94 // Creating a tree mapped to a new hbook fil 91 // Creating a tree mapped to a new hbook file. 95 G4String nam = fHistName; // + "." + fHistT << 92 G4String nam = fHistName;// + "." + fHistType; 96 93 97 // Open file histogram file 94 // Open file histogram file 98 if (!fManager->OpenFile(nam)) { << 95 if(!fManager->OpenFile(nam)) { 99 G4cout << "Histo::Book: ERROR open file <" 96 G4cout << "Histo::Book: ERROR open file <" << nam << ">" << G4endl; 100 fHistoActive = false; 97 fHistoActive = false; 101 fNtupleActive = false; 98 fNtupleActive = false; 102 return; << 99 return; 103 } 100 } 104 G4cout << "### Histo::Save: Opended file <" << 101 G4cout << "### Histo::Save: Opended file <" << nam << "> for " 105 << G4endl; << 102 << fNHisto << " histograms " << G4endl; 106 103 107 // Creating an 1-dimensional histograms in t 104 // Creating an 1-dimensional histograms in the root directory of the tree 108 for (G4int i = 0; i < fNHisto; ++i) { << 105 for(G4int i=0; i<fNHisto; ++i) { 109 if (fActive[i]) { << 106 if(fActive[i]) { 110 G4String ss = "h" + fIds[i]; 107 G4String ss = "h" + fIds[i]; 111 fHisto[i] = fManager->CreateH1(ss, fTitl << 108 fHisto[i] = fManager->CreateH1(ss, fTitles[i], fBins[i], fXmin[i], fXmax[i]); 112 if (fVerbose > 0) { << 109 if(fVerbose > 0) { 113 G4cout << "Created histogram #" << i < << 110 G4cout << "Created histogram #" << i << " id= " << fHisto[i] 114 << fTitles[i] << G4endl; << 111 << " " << ss << " " << fTitles[i] << G4endl; 115 } 112 } 116 } 113 } 117 } 114 } 118 // Creating a tuple factory, whose tuples wi 115 // Creating a tuple factory, whose tuples will be handled by the tree 119 if (fNtupleActive) { << 116 if(fNtupleActive) { 120 fManager->CreateNtuple(fTupleName, fTupleT << 117 fManager->CreateNtuple(fTupleName,fTupleTitle); 121 G4int i; 118 G4int i; 122 G4int n = fNtupleI.size(); 119 G4int n = fNtupleI.size(); 123 for (i = 0; i < n; ++i) { << 120 for(i=0; i<n; ++i) { 124 if (fTupleI[i] == -1) { << 121 if(fTupleI[i] == -1) { 125 fTupleI[i] = fManager->CreateNtupleICo << 122 fTupleI[i] = fManager->CreateNtupleIColumn(fNtupleI[i]); 126 } 123 } 127 } 124 } 128 n = fNtupleF.size(); 125 n = fNtupleF.size(); 129 for (i = 0; i < n; ++i) { << 126 for(i=0; i<n; ++i) { 130 if (fTupleF[i] == -1) { << 127 if(fTupleF[i] == -1) { 131 fTupleF[i] = fManager->CreateNtupleFCo << 128 fTupleF[i] = fManager->CreateNtupleFColumn(fNtupleF[i]); 132 } 129 } 133 } 130 } 134 n = fNtupleD.size(); 131 n = fNtupleD.size(); 135 for (i = 0; i < n; ++i) { << 132 for(i=0; i<n; ++i) { 136 if (fTupleD[i] == -1) { << 133 if(fTupleD[i] == -1) { 137 fTupleD[i] = fManager->CreateNtupleDCo << 134 fTupleD[i] = fManager->CreateNtupleDColumn(fNtupleD[i]); 138 } 135 } 139 } 136 } 140 } 137 } 141 } << 138 } 142 139 143 //....oooOO0OOooo........oooOO0OOooo........oo 140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 144 141 145 void Histo::Save() 142 void Histo::Save() 146 { 143 { 147 if (!(fHistoActive || fNtupleActive)) { << 144 if(!(fHistoActive || fNtupleActive)) { return; } 148 return; << 149 } << 150 145 151 // Creating a tree mapped to a new hbook fil 146 // Creating a tree mapped to a new hbook file. 152 G4String nam = fHistName + "." + fHistType; 147 G4String nam = fHistName + "." + fHistType; 153 148 154 // Write histogram file 149 // Write histogram file 155 if (!fManager->Write()) { << 150 if(!fManager->Write()) { 156 G4ExceptionDescription message; 151 G4ExceptionDescription message; 157 message << "Histo::Save: FATAL ERROR writi << 152 message << "Histo::Save: FATAL ERROR writing ROOT file."; 158 G4Exception("Histo::Save()", "Hadr02Code00 << 153 G4Exception("Histo::Save()", >> 154 "Hadr02Code001", FatalException, message); 159 } 155 } 160 if (fVerbose > 0) { << 156 if(fVerbose > 0) { 161 G4cout << "### Histo::Save: Histograms and 157 G4cout << "### Histo::Save: Histograms and Ntuples are saved" << G4endl; 162 } 158 } 163 if (fManager->CloseFile() && fVerbose > 0) { << 159 if(fManager->CloseFile() && fVerbose > 0) { 164 G4cout << " File is closed 160 G4cout << " File is closed" << G4endl; 165 } 161 } 166 fManager->Clear(); << 162 delete G4RootAnalysisManager::Instance(); 167 } << 163 fManager = 0; >> 164 } 168 165 169 //....oooOO0OOooo........oooOO0OOooo........oo 166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 170 167 171 void Histo::Add1D(const G4String& id, const G4 << 168 void Histo::Add1D(const G4String& id, const G4String& name, G4int nb, 172 G4double u) << 169 G4double x1, G4double x2, G4double u) 173 { 170 { 174 if (fVerbose > 0) { << 171 if(fVerbose > 0) { 175 G4cout << "Histo::Add1D: New histogram wil << 172 G4cout << "Histo::Add1D: New histogram will be booked: #" 176 << " " << x1 << " " << x2 << " " << 173 << id << " <" << name >> 174 << " " << nb << " " << x1 << " " << x2 << " " << u >> 175 << G4endl; 177 } 176 } 178 ++fNHisto; 177 ++fNHisto; 179 x1 /= u; 178 x1 /= u; 180 x2 /= u; 179 x2 /= u; 181 fActive.push_back(fDefaultAct); 180 fActive.push_back(fDefaultAct); 182 fBins.push_back(nb); 181 fBins.push_back(nb); 183 fXmin.push_back(x1); 182 fXmin.push_back(x1); 184 fXmax.push_back(x2); 183 fXmax.push_back(x2); 185 fUnit.push_back(u); 184 fUnit.push_back(u); 186 fIds.push_back(id); 185 fIds.push_back(id); 187 fTitles.push_back(name); 186 fTitles.push_back(name); 188 fHisto.push_back(-1); 187 fHisto.push_back(-1); 189 } 188 } 190 189 191 //....oooOO0OOooo........oooOO0OOooo........oo 190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 192 191 193 void Histo::SetHisto1D(G4int i, G4int nb, G4do << 192 void >> 193 Histo::SetHisto1D(G4int i, G4int nb, G4double x1, G4double x2, G4double u) 194 { 194 { 195 if (i >= 0 && i < fNHisto) { << 195 if(i>=0 && i<fNHisto) { 196 if (fVerbose > 0) { << 196 if(fVerbose > 0) { 197 G4cout << "Histo::SetHisto1D: #" << i << << 197 G4cout << "Histo::SetHisto1D: #" << i 198 << G4endl; << 198 << " " << nb << " " << x1 << " " << x2 << " " << u >> 199 << G4endl; 199 } 200 } 200 fBins[i] = nb; 201 fBins[i] = nb; 201 fXmin[i] = x1; 202 fXmin[i] = x1; 202 fXmax[i] = x2; 203 fXmax[i] = x2; 203 fUnit[i] = u; 204 fUnit[i] = u; 204 fActive[i] = true; 205 fActive[i] = true; 205 fHistoActive = true; 206 fHistoActive = true; 206 } << 207 } else { 207 else { << 208 G4cout << "Histo::SetHisto1D: WARNING! wrong histogram index " 208 G4cout << "Histo::SetHisto1D: WARNING! wro << 209 << i << G4endl; 209 } 210 } 210 } 211 } 211 212 212 //....oooOO0OOooo........oooOO0OOooo........oo 213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 213 214 214 void Histo::Activate(G4int i, G4bool val) 215 void Histo::Activate(G4int i, G4bool val) 215 { 216 { 216 if (fVerbose > 1) { << 217 if(fVerbose > 1) { 217 G4cout << "Histo::Activate: Histogram: #" << 218 G4cout << "Histo::Activate: Histogram: #" << i << " " 218 } << 219 << val << G4endl; 219 if (i >= 0 && i < fNHisto) { << 220 } 220 fActive[i] = val; << 221 if(i>=0 && i<fNHisto) { 221 if (val) { << 222 fActive[i] = val; 222 fHistoActive = true; << 223 if(val) { fHistoActive = true; } 223 } << 224 } 224 } 225 } 225 } 226 226 227 //....oooOO0OOooo........oooOO0OOooo........oo 227 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 228 228 229 void Histo::Fill(G4int i, G4double x, G4double 229 void Histo::Fill(G4int i, G4double x, G4double w) 230 { 230 { 231 if (!fHistoActive) { << 231 if(!fHistoActive) { return; } 232 return; << 232 if(fVerbose > 1) { 233 } << 233 G4cout << "Histo::Fill: Histogram: #" << i << " at x= " << x 234 if (fVerbose > 1) { << 234 << " weight= " << w 235 G4cout << "Histo::Fill: Histogram: #" << i << 235 << G4endl; 236 } << 236 } 237 if (i >= 0 && i < fNHisto) { << 237 if(i>=0 && i<fNHisto) { 238 if (fActive[i]) { << 238 if(fActive[i]) { fManager->FillH1(fHisto[i], x/fUnit[i], w); } 239 fManager->FillH1(fHisto[i], x / fUnit[i] << 239 } else { 240 } << 240 G4cout << "Histo::Fill: WARNING! wrong histogram index " 241 } << 241 << i << G4endl; 242 else { << 243 G4cout << "Histo::Fill: WARNING! wrong his << 244 } 242 } 245 } 243 } 246 244 247 //....oooOO0OOooo........oooOO0OOooo........oo 245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 248 246 249 void Histo::ScaleH1(G4int i, G4double x) 247 void Histo::ScaleH1(G4int i, G4double x) 250 { 248 { 251 if (!fHistoActive) { << 249 if(!fHistoActive) { return; } 252 return; << 250 if(fVerbose > 0) { 253 } << 251 G4cout << "Histo::Scale: Histogram: #" << i << " by factor " 254 if (fVerbose > 0) { << 252 << x << G4endl; 255 G4cout << "Histo::Scale: Histogram: #" << << 253 } 256 } << 254 if(i>=0 && i<fNHisto) { 257 if (i >= 0 && i < fNHisto) { << 255 if(fActive[i]) { 258 if (fActive[i]) { << 256 if ( fHistType == "root" ) 259 if (fHistType == "root") << 257 dynamic_cast<G4RootAnalysisManager*>(fManager)->GetH1(fHisto[i])->scale(x); 260 dynamic_cast<G4RootAnalysisManager*>(f << 258 if ( fHistType == "xml" ) 261 if (fHistType == "xml") << 259 dynamic_cast<G4XmlAnalysisManager*>(fManager)->GetH1(fHisto[i])->scale(x); 262 dynamic_cast<G4XmlAnalysisManager*>(fM << 260 } 263 } << 261 } else { 264 } << 262 G4cout << "Histo::Scale: WARNING! wrong histogram index " 265 else { << 263 << i << G4endl; 266 G4cout << "Histo::Scale: WARNING! wrong hi << 267 } 264 } 268 } 265 } 269 266 270 //....oooOO0OOooo........oooOO0OOooo........oo 267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 271 268 272 void Histo::AddTuple(const G4String& w1) 269 void Histo::AddTuple(const G4String& w1) 273 { 270 { 274 fTupleTitle = w1; 271 fTupleTitle = w1; 275 } 272 } 276 273 277 //....oooOO0OOooo........oooOO0OOooo........oo 274 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 278 275 279 void Histo::AddTupleI(const G4String& w1) 276 void Histo::AddTupleI(const G4String& w1) 280 { 277 { 281 fNtupleActive = true; 278 fNtupleActive = true; 282 fNtupleI.push_back(w1); 279 fNtupleI.push_back(w1); 283 fTupleI.push_back(-1); 280 fTupleI.push_back(-1); 284 } 281 } 285 282 286 //....oooOO0OOooo........oooOO0OOooo........oo 283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 287 284 288 void Histo::AddTupleF(const G4String& w1) 285 void Histo::AddTupleF(const G4String& w1) 289 { 286 { 290 fNtupleActive = true; 287 fNtupleActive = true; 291 fNtupleF.push_back(w1); 288 fNtupleF.push_back(w1); 292 fTupleF.push_back(-1); 289 fTupleF.push_back(-1); 293 } 290 } 294 291 295 //....oooOO0OOooo........oooOO0OOooo........oo 292 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 296 293 297 void Histo::AddTupleD(const G4String& w1) 294 void Histo::AddTupleD(const G4String& w1) 298 { 295 { 299 fNtupleActive = true; 296 fNtupleActive = true; 300 fNtupleD.push_back(w1); 297 fNtupleD.push_back(w1); 301 fTupleD.push_back(-1); 298 fTupleD.push_back(-1); 302 } 299 } 303 300 304 //....oooOO0OOooo........oooOO0OOooo........oo 301 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 305 302 306 void Histo::FillTupleI(G4int i, G4int x) 303 void Histo::FillTupleI(G4int i, G4int x) 307 { 304 { 308 if (!fNtupleActive) { << 305 if(!fNtupleActive) { return; } 309 return; << 310 } << 311 G4int n = fNtupleI.size(); 306 G4int n = fNtupleI.size(); 312 if (i >= 0 && i < n) { << 307 if(i >= 0 && i < n) { 313 if (fVerbose > 1) { << 308 if(fVerbose > 1) { 314 G4cout << "Histo::FillTupleI: i= " << i << 309 G4cout << "Histo::FillTupleI: i= " << i << " id= " << fTupleI[i] 315 << "> = " << x << G4endl; << 310 << " <" << fNtupleI[i] << "> = " << x << G4endl; 316 } << 311 } 317 fManager->FillNtupleIColumn(fTupleI[i], x) << 312 fManager->FillNtupleIColumn(fTupleI[i], x); 318 } << 313 } else { 319 else { << 314 G4cout << "Histo::FillTupleI: WARNING! wrong ntuple index " 320 G4cout << "Histo::FillTupleI: WARNING! wro << 315 << i << G4endl; 321 } 316 } 322 } 317 } 323 318 324 //....oooOO0OOooo........oooOO0OOooo........oo 319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 325 320 326 void Histo::FillTupleF(G4int i, G4float x) 321 void Histo::FillTupleF(G4int i, G4float x) 327 { 322 { 328 if (!fNtupleActive) { << 323 if(!fNtupleActive) { return; } 329 return; << 330 } << 331 G4int n = fNtupleF.size(); 324 G4int n = fNtupleF.size(); 332 if (i >= 0 && i < n) { << 325 if(i >= 0 && i < n) { 333 if (fVerbose > 1) { << 326 if(fVerbose > 1) { 334 G4cout << "Histo::FillTupleF: i= " << i << 327 G4cout << "Histo::FillTupleF: i= " << i << " id= " << fTupleF[i] 335 << "> = " << x << G4endl; << 328 << " <" << fNtupleF[i] << "> = " << x << G4endl; 336 } << 329 } 337 fManager->FillNtupleFColumn(fTupleF[i], x) << 330 fManager->FillNtupleFColumn(fTupleF[i], x); 338 } << 331 } else { 339 else { << 332 G4cout << "Histo::FillTupleF: WARNING! wrong ntuple index " 340 G4cout << "Histo::FillTupleF: WARNING! wro << 333 << i << G4endl; 341 } 334 } 342 } 335 } 343 336 344 //....oooOO0OOooo........oooOO0OOooo........oo 337 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 345 338 346 void Histo::FillTupleD(G4int i, G4double x) 339 void Histo::FillTupleD(G4int i, G4double x) 347 { 340 { 348 if (!fNtupleActive) { << 341 if(!fNtupleActive) { return; } 349 return; << 350 } << 351 G4int n = fNtupleD.size(); 342 G4int n = fNtupleD.size(); 352 if (i >= 0 && i < n) { << 343 if(i >= 0 && i < n) { 353 if (fVerbose > 1) { << 344 if(fVerbose > 1) { 354 G4cout << "Histo::FillTupleD: i= " << i << 345 G4cout << "Histo::FillTupleD: i= " << i << " id= " << fTupleD[i] 355 << "> = " << x << G4endl; << 346 << " <" << fNtupleD[i] << "> = " << x << G4endl; 356 } << 347 } 357 fManager->FillNtupleDColumn(fTupleD[i], x) << 348 fManager->FillNtupleDColumn(fTupleD[i], x); 358 } << 349 } else { 359 else { << 350 G4cout << "Histo::FillTupleD: WARNING! wrong ntuple index " 360 G4cout << "Histo::FillTupleD: WARNING! wro << 351 << i << G4endl; 361 } 352 } 362 } 353 } 363 354 364 //....oooOO0OOooo........oooOO0OOooo........oo 355 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 365 356 366 void Histo::AddRow() 357 void Histo::AddRow() 367 { 358 { 368 if (!fNtupleActive) { << 359 if(!fNtupleActive) { return; } 369 return; << 370 } << 371 fManager->AddNtupleRow(); 360 fManager->AddNtupleRow(); 372 } << 361 } 373 362 374 //....oooOO0OOooo........oooOO0OOooo........oo 363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 375 364 376 void Histo::SetFileName(const G4String& nam) << 365 void Histo::SetFileName(const G4String& nam) 377 { 366 { 378 fHistName = nam; 367 fHistName = nam; 379 fHistoActive = true; 368 fHistoActive = true; 380 } 369 } 381 370 382 //....oooOO0OOooo........oooOO0OOooo........oo 371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 383 372 384 void Histo::SetFileType(const G4String& nam) << 373 void Histo::SetFileType(const G4String& nam) 385 { 374 { 386 if (nam == "root" || nam == "ROOT") { << 375 if(nam == "root" || nam == "ROOT" ) { fHistType = "root"; } 387 fHistType = "root"; << 376 else if(nam == "xml" || nam == "XML") { fHistType = "xml"; } 388 } << 389 else if (nam == "xml" || nam == "XML") { << 390 fHistType = "xml"; << 391 } << 392 else { 377 else { 393 G4cout << "Histo::SetFileType: Sorry, form << 378 G4cout<<"Histo::SetFileType: Sorry, format for output file: "<<nam 394 << " not supported. Use \"root\" or << 379 <<" not supported. Use \"root\" or \"xml\"" << G4endl; 395 } << 380 } 396 } 381 } 397 382 398 //....oooOO0OOooo........oooOO0OOooo........oo 383 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 384 399 385