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 // $Id: G4VAnalysisManager.cc 70604 2013-06-03 11:27:06Z ihrivnac $ 26 27 27 // Author: Ivana Hrivnacova, 09/07/2013 (ivan 28 // Author: Ivana Hrivnacova, 09/07/2013 (ivana@ipno.in2p3.fr) 28 29 29 #include "G4VAnalysisManager.hh" 30 #include "G4VAnalysisManager.hh" 30 #include "G4AnalysisMessenger.hh" 31 #include "G4AnalysisMessenger.hh" >> 32 #include "G4AnalysisUtilities.hh" 31 #include "G4HnManager.hh" 33 #include "G4HnManager.hh" >> 34 #include "G4VH1Manager.hh" >> 35 #include "G4VH2Manager.hh" 32 #include "G4VNtupleManager.hh" 36 #include "G4VNtupleManager.hh" 33 #include "G4VNtupleFileManager.hh" << 34 #include "G4VFileManager.hh" 37 #include "G4VFileManager.hh" 35 #include "G4NtupleBookingManager.hh" << 36 #include "G4Threading.hh" << 37 #include "G4AutoLock.hh" << 38 38 39 using namespace G4Analysis; << 39 #include <iostream> 40 << 41 namespace { << 42 //Mutex to lock master manager when merging << 43 G4Mutex registerWorkerMutex = G4MUTEX_INITIA << 44 } << 45 << 46 namespace { << 47 << 48 //____________________________________________ << 49 void NtupleMergingWarning(std::string_view cla << 50 std::string_view fun << 51 const G4String& outp << 52 { << 53 G4Analysis::Warn( << 54 "Ntuple merging is not available with " + << 55 "Setting is ignored.", className, function << 56 } << 57 << 58 } << 59 40 60 // << 41 using namespace G4Analysis; 61 // ctor/dtor << 62 // << 63 42 64 //____________________________________________ 43 //_____________________________________________________________________________ 65 G4VAnalysisManager::G4VAnalysisManager(const G << 44 G4VAnalysisManager::G4VAnalysisManager(const G4String& type, G4bool isMaster) 66 : fState(type, ! G4Threading::IsWorkerThread( << 45 : fState(type, isMaster), >> 46 fMessenger(0), >> 47 fH1HnManager(0), >> 48 fH2HnManager(0), >> 49 fVH1Manager(0), >> 50 fVH2Manager(0), >> 51 fVNtupleManager(0), >> 52 fVFileManager(0) 67 { 53 { 68 fMessenger = std::make_unique<G4AnalysisMess << 54 fMessenger = new G4AnalysisMessenger(this); 69 fNtupleBookingManager = std::make_shared<G4N << 70 << 71 // Set master/worker instances << 72 // used only in "FromUI" functions << 73 if ( ! G4Threading::IsWorkerThread() ) { << 74 fgMasterInstance = this; << 75 } << 76 else { << 77 if (fgMasterInstance != nullptr) { << 78 G4AutoLock lock(®isterWorkerMutex); << 79 fgMasterInstance->fWorkerManagers.push_b << 80 lock.unlock(); << 81 } << 82 } << 83 } << 84 << 85 //____________________________________________ << 86 G4VAnalysisManager::~G4VAnalysisManager() = de << 87 << 88 // << 89 // private methods << 90 // << 91 << 92 //____________________________________________ << 93 G4bool G4VAnalysisManager::WriteFromUI() << 94 { << 95 // Write is performed on workers first, then o << 96 << 97 if (! fState.GetIsMaster() ) return true; << 98 << 99 auto result = true; << 100 << 101 // Process first all workers << 102 for (auto workerManger : fWorkerManagers) { << 103 // Update G4Threading << 104 auto g4ThreadingValue = G4Threading::G4Get << 105 G4Threading::G4SetThreadId(workerManger->f << 106 << 107 result &= workerManger->Write(); << 108 << 109 // Set G4Threading back << 110 G4Threading::G4SetThreadId(g4ThreadingValu << 111 } << 112 << 113 // Process write on master << 114 result &= Write(); << 115 << 116 return result; << 117 } 55 } 118 56 119 //____________________________________________ 57 //_____________________________________________________________________________ 120 G4bool G4VAnalysisManager::CloseFileFromUI(G4b << 58 G4VAnalysisManager::~G4VAnalysisManager() 121 { 59 { 122 // Close file is performed on workers first, t << 60 delete fMessenger; 123 << 61 delete fVH1Manager; 124 if (! fState.GetIsMaster() ) return true; << 62 delete fVH2Manager; 125 << 63 delete fVNtupleManager; 126 auto result = true; << 64 delete fVFileManager; 127 << 128 // Process first all workers << 129 for (auto workerManger : fWorkerManagers) { << 130 // Update G4Threading << 131 auto g4ThreadingValue = G4Threading::G4Get << 132 G4Threading::G4SetThreadId(workerManger->f << 133 << 134 result &= workerManger->CloseFile(reset); << 135 << 136 // Set G4Threading back << 137 G4Threading::G4SetThreadId(g4ThreadingValu << 138 } << 139 << 140 // Process write on master << 141 result &= CloseFile(reset); << 142 << 143 return result; << 144 } 65 } 145 66 146 //____________________________________________ << 67 // 147 G4bool G4VAnalysisManager::ResetFromUI() << 148 { << 149 // Reset file is performed on workers first, t << 150 << 151 if (! fState.GetIsMaster() ) return true; << 152 << 153 auto result = true; << 154 << 155 // Process first all workers << 156 for (auto workerManger : fWorkerManagers) { << 157 // Update G4Threading << 158 auto g4ThreadingValue = G4Threading::G4Get << 159 G4Threading::G4SetThreadId(workerManger->f << 160 << 161 result &= workerManger->Reset(); << 162 << 163 // Set G4Threading back << 164 G4Threading::G4SetThreadId(g4ThreadingValu << 165 } << 166 << 167 // Process write on master << 168 result &= Reset(); << 169 << 170 return result; << 171 } << 172 << 173 // << 174 // protected methods 68 // protected methods 175 // 69 // 176 << 70 177 //____________________________________________ << 178 void G4VAnalysisManager::SetDefaultFileTypeImp << 179 { << 180 if ( (! GetType().empty()) && (GetFileType() << 181 // If not generic analysis manager (which << 182 // the file type cannot be different from << 183 Warn("Cannot set default file type " + val << 184 " different than the analysis manager ty << 185 fkClass, "SetDefault"); << 186 return; << 187 } << 188 << 189 fH1HnManager->SetDefaultFileType(value); << 190 fH2HnManager->SetDefaultFileType(value); << 191 fH3HnManager->SetDefaultFileType(value); << 192 fP1HnManager->SetDefaultFileType(value); << 193 fP2HnManager->SetDefaultFileType(value); << 194 } << 195 << 196 //____________________________________________ << 197 G4String G4VAnalysisManager::GetDefaultFileTyp << 198 { << 199 return GetFileType(); << 200 } << 201 << 202 //____________________________________________ << 203 void G4VAnalysisManager::SetH1Manager(G4VTBase << 204 { << 205 fVH1Manager.reset(h1Manager); << 206 fH1HnManager = h1Manager->GetHnManager(); << 207 if (fVFileManager != nullptr ) fH1HnManager- << 208 if (! GetFileType().empty() ) fH1HnManager-> << 209 } << 210 << 211 //____________________________________________ << 212 void G4VAnalysisManager::SetH2Manager(G4VTBase << 213 { << 214 fVH2Manager.reset(h2Manager); << 215 fH2HnManager = h2Manager->GetHnManager(); << 216 if (fVFileManager != nullptr ) fH2HnManager- << 217 if (! GetFileType().empty() ) fH2HnManager-> << 218 } << 219 << 220 //____________________________________________ << 221 void G4VAnalysisManager::SetH3Manager(G4VTBase << 222 { << 223 fVH3Manager.reset(h3Manager); << 224 fH3HnManager = h3Manager->GetHnManager(); << 225 if (fVFileManager != nullptr ) fH3HnManager- << 226 if (! GetFileType().empty() ) fH3HnManager-> << 227 } << 228 << 229 //____________________________________________ << 230 void G4VAnalysisManager::SetP1Manager(G4VTBase << 231 { << 232 fVP1Manager.reset(p1Manager); << 233 fP1HnManager = p1Manager->GetHnManager(); << 234 if (fVFileManager != nullptr ) fP1HnManager- << 235 if (! GetFileType().empty() ) fP1HnManager-> << 236 } << 237 << 238 //____________________________________________ 71 //_____________________________________________________________________________ 239 void G4VAnalysisManager::SetP2Manager(G4VTBase << 72 void G4VAnalysisManager::SetH1Manager(G4VH1Manager* h1Manager) 240 { 73 { 241 fVP2Manager.reset(p2Manager); << 74 fVH1Manager = h1Manager; 242 fP2HnManager = p2Manager->GetHnManager(); << 75 fH1HnManager = h1Manager->fHnManager; 243 if (fVFileManager != nullptr ) fP2HnManager- << 76 fMessenger->SetH1HnManager(fH1HnManager); 244 if (! GetFileType().empty() ) fP2HnManager-> << 77 } 245 } << 246 78 247 //____________________________________________ 79 //_____________________________________________________________________________ 248 void G4VAnalysisManager::SetNtupleManager(std: << 80 void G4VAnalysisManager::SetH2Manager(G4VH2Manager* h2Manager) 249 { 81 { 250 fVNtupleManager = std::move(ntupleManager); << 82 fVH2Manager = h2Manager; 251 fVNtupleManager->SetFirstId(fNtupleBookingMa << 83 fH2HnManager = h2Manager->fHnManager; 252 fVNtupleManager->SetFirstNtupleColumnId(fNtu << 84 fMessenger->SetH2HnManager(fH2HnManager); 253 } << 85 } 254 86 255 //____________________________________________ 87 //_____________________________________________________________________________ 256 void G4VAnalysisManager::SetNtupleFileManager( << 88 void G4VAnalysisManager::SetNtupleManager(G4VNtupleManager* ntupleManager) 257 std::shared_ptr<G4VNtupleFileManager> ntuple << 258 { 89 { 259 fVNtupleFileManager = std::move(ntupleFileMa << 90 fVNtupleManager = ntupleManager; 260 } << 91 } 261 92 262 //____________________________________________ 93 //_____________________________________________________________________________ 263 void G4VAnalysisManager::SetFileManager(std::s << 94 void G4VAnalysisManager::SetFileManager(G4VFileManager* fileManager) 264 { 95 { 265 fVFileManager = fileManager; 96 fVFileManager = fileManager; 266 << 97 } 267 if ( fH1HnManager != nullptr ) fH1HnManager- << 268 if ( fH2HnManager != nullptr ) fH2HnManager- << 269 if ( fH3HnManager != nullptr ) fH3HnManager- << 270 if ( fP1HnManager != nullptr ) fP1HnManager- << 271 if ( fP2HnManager != nullptr ) fP2HnManager- << 272 } << 273 98 274 //____________________________________________ 99 //_____________________________________________________________________________ 275 G4bool G4VAnalysisManager::WriteAscii(const G4 100 G4bool G4VAnalysisManager::WriteAscii(const G4String& fileName) 276 { 101 { 277 // Do not write on workers << 102 G4bool finalResult = true; 278 if ( ! fState.GetIsMaster() ) return true; << 279 << 280 auto result = true; << 281 103 282 // Replace or add file extension .ascii 104 // Replace or add file extension .ascii 283 G4String name(fileName); 105 G4String name(fileName); 284 if (name.find('.') != std::string::npos) { << 106 if ( name.find(".") != std::string::npos ) { 285 name.erase(name.find('.'), name.length()); << 107 name.erase(name.find("."), name.length()); 286 } 108 } 287 name.append(".ascii"); 109 name.append(".ascii"); 288 110 289 Message(kVL3, "write ASCII", "file", name); << 111 #ifdef G4VERBOSE 290 << 112 if ( fState.GetVerboseL3() ) >> 113 fState.GetVerboseL3()->Message("write ASCII", "file", name); >> 114 #endif >> 115 291 std::ofstream output(name, std::ios::out); 116 std::ofstream output(name, std::ios::out); 292 if ( ! output ) { 117 if ( ! output ) { 293 Warn("Cannot open file. File name is not d << 118 G4ExceptionDescription description; 294 fkClass, "WriteAscii"); << 119 description >> 120 << "Cannot open file. File name is not defined."; >> 121 G4Exception("G4VAnalysisManager::WriteAscii()", >> 122 "Analysis_W009", JustWarning, description); 295 return false; 123 return false; 296 } 124 } 297 output.setf( std::ios::scientific, std::ios: 125 output.setf( std::ios::scientific, std::ios::floatfield ); 298 126 299 result &= fVH1Manager->WriteOnAscii(output); << 127 G4bool result = fVH1Manager->WriteOnAscii(output); 300 result &= fVH2Manager->WriteOnAscii(output); << 128 finalResult = finalResult && result; 301 result &= fVH3Manager->WriteOnAscii(output); << 129 302 result &= fVP1Manager->WriteOnAscii(output); << 130 result = fVH2Manager->WriteOnAscii(output); 303 result &= fVP2Manager->WriteOnAscii(output); << 131 finalResult = finalResult && result; 304 << 132 305 Message(kVL1, "write ASCII", "file", name, r << 133 #ifdef G4VERBOSE 306 << 134 if ( fState.GetVerboseL1() ) 307 return result; << 135 fState.GetVerboseL1()->Message("write ASCII", "file", name, result); 308 } << 136 #endif 309 << 137 310 //____________________________________________ << 138 return finalResult; 311 std::shared_ptr<G4VFileManager> << 139 } 312 G4VAnalysisManager::GetFileManager(const G4Str << 313 { << 314 // Check if file type corresponds the manage << 315 G4String extension = GetExtension(fileName); << 316 if ((extension.size() != 0u) && extension != << 317 Warn( << 318 "The file extension differs from " + Get << 319 GetFileType() + " output type will be us << 320 fkClass, "GetFileManager"); << 321 } << 322 << 323 return fVFileManager; << 324 } << 325 140 326 // << 141 // 327 // public methods 142 // public methods 328 // 143 // 329 144 330 //____________________________________________ 145 //_____________________________________________________________________________ 331 G4bool G4VAnalysisManager::OpenFile(const G4St << 146 G4bool G4VAnalysisManager::OpenFile() 332 { 147 { 333 // Protection against opening file twice << 148 if ( fVFileManager->GetFileName() == "" ) { 334 // (Seems to happen when opening file via UI << 149 G4ExceptionDescription description; 335 if (IsOpenFile()) { << 150 description 336 // G4cout << "Skipping OpenFile. File is a << 151 << "Cannot open file. File name is not defined."; 337 return true; << 152 G4Exception("G4VFileManager::OpenFile()", 338 } << 153 "Analysis_W009", JustWarning, description); 339 << 340 if ( fileName != "" ) { << 341 return OpenFileImpl(fileName); << 342 } << 343 if (fVFileManager->GetFileName() == "") { << 344 Warn("Cannot open file. File name is not d << 345 return false; 154 return false; 346 } << 155 } >> 156 347 return OpenFileImpl(fVFileManager->GetFileNa 157 return OpenFileImpl(fVFileManager->GetFileName()); 348 } << 158 } 349 << 350 //____________________________________________ << 351 G4bool G4VAnalysisManager::Write() << 352 { << 353 auto result = true; << 354 << 355 result &= WriteImpl(); << 356 if ( IsPlotting() ) { << 357 result &= PlotImpl(); << 358 } << 359 << 360 // Increment cycle number << 361 fState.IncrementCycle(); << 362 << 363 return result; << 364 } << 365 << 366 //____________________________________________ << 367 G4bool G4VAnalysisManager::CloseFile(G4bool re << 368 { << 369 auto result = CloseFileImpl(reset); << 370 << 371 // Notify about new cycle << 372 fState.ResetCycle(); << 373 if (fVNtupleManager != nullptr) { << 374 fVNtupleManager->SetNewCycle(false); << 375 } << 376 << 377 return result; << 378 } << 379 << 380 //____________________________________________ << 381 G4bool G4VAnalysisManager::Reset() << 382 { << 383 // Notify about new cycle << 384 // (as reset causes deleting ntuples) << 385 if (fVNtupleManager != nullptr) { << 386 fVNtupleManager->SetNewCycle(true); << 387 } << 388 << 389 return ResetImpl(); << 390 } << 391 << 392 //____________________________________________ << 393 void G4VAnalysisManager::Clear() << 394 { << 395 Message(kVL4, "clear", "all data"); << 396 << 397 // clear hntools objects << 398 ClearImpl(); << 399 << 400 // clear remaining data << 401 fNtupleBookingManager->ClearData(); << 402 if ( fVNtupleManager != nullptr ) fVNtupleMa << 403 if ( fVFileManager != nullptr ) fVFileManage << 404 << 405 Message(kVL1, "clear", "all data"); << 406 } << 407 159 408 //____________________________________________ 160 //_____________________________________________________________________________ 409 G4bool G4VAnalysisManager::Merge(tools::histo: << 161 G4bool G4VAnalysisManager::OpenFile(const G4String& fileName) 410 { << 411 return MergeImpl(hmpi); << 412 } << 413 << 414 //____________________________________________ << 415 G4bool G4VAnalysisManager::Plot() << 416 { << 417 return PlotImpl(); << 418 } << 419 << 420 //____________________________________________ << 421 G4bool G4VAnalysisManager::IsOpenFile() const << 422 { 162 { 423 return IsOpenFileImpl(); << 163 return OpenFileImpl(fileName); 424 } << 164 } 425 165 426 //____________________________________________ 166 //_____________________________________________________________________________ 427 void G4VAnalysisManager::SetDefaultFileType(co << 167 G4bool G4VAnalysisManager::Write() 428 { 168 { 429 SetDefaultFileTypeImpl(value); << 169 return WriteImpl(); 430 } << 170 } 431 171 432 //____________________________________________ 172 //_____________________________________________________________________________ 433 G4String G4VAnalysisManager::GetDefaultFileTyp << 173 G4bool G4VAnalysisManager::CloseFile() 434 { 174 { 435 return GetDefaultFileTypeImpl(); << 175 return CloseFileImpl(); 436 } << 176 } 437 177 438 //____________________________________________ 178 //_____________________________________________________________________________ 439 G4bool G4VAnalysisManager::SetFileName(const G 179 G4bool G4VAnalysisManager::SetFileName(const G4String& fileName) 440 { << 180 { 441 return fVFileManager->SetFileName(fileName); << 181 return fVFileManager->SetFileName(fileName); 442 } 182 } 443 183 444 //____________________________________________ 184 //_____________________________________________________________________________ 445 G4bool G4VAnalysisManager::SetHistoDirectoryNa 185 G4bool G4VAnalysisManager::SetHistoDirectoryName(const G4String& dirName) 446 { << 186 { 447 return fVFileManager->SetHistoDirectoryName( << 187 return fVFileManager->SetHistoDirectoryName(dirName); 448 } 188 } 449 189 450 //____________________________________________ 190 //_____________________________________________________________________________ 451 G4bool G4VAnalysisManager::SetNtupleDirectoryN 191 G4bool G4VAnalysisManager::SetNtupleDirectoryName(const G4String& dirName) 452 { << 192 { 453 return fVFileManager->SetNtupleDirectoryName << 193 return fVFileManager->SetNtupleDirectoryName(dirName); 454 } 194 } 455 195 456 //____________________________________________ 196 //_____________________________________________________________________________ 457 void G4VAnalysisManager::SetCompressionLevel(G << 197 G4String G4VAnalysisManager::GetFileName() const 458 { << 198 { 459 fVFileManager->SetCompressionLevel(level); << 199 return fVFileManager->GetFileName(); 460 } << 461 << 462 //____________________________________________ << 463 G4String G4VAnalysisManager::GetFileName() con << 464 { << 465 return fVFileManager->GetFileName(); << 466 } 200 } 467 201 468 //____________________________________________ 202 //_____________________________________________________________________________ 469 G4String G4VAnalysisManager::GetHistoDirectory << 203 G4String G4VAnalysisManager::GetHistoDirectoryName() const 470 { << 204 { 471 return fVFileManager->GetHistoDirectoryName( << 205 return fVFileManager->GetHistoDirectoryName(); 472 } 206 } 473 << 207 474 //____________________________________________ 208 //_____________________________________________________________________________ 475 G4String G4VAnalysisManager::GetNtupleDirector 209 G4String G4VAnalysisManager::GetNtupleDirectoryName() const 476 { 210 { 477 return fVFileManager->GetNtupleDirectoryName << 211 return fVFileManager->GetNtupleDirectoryName(); 478 } << 479 << 480 //____________________________________________ << 481 G4int G4VAnalysisManager::GetCompressionLevel( << 482 { << 483 return fVFileManager->GetCompressionLevel(); << 484 } 212 } 485 213 486 //____________________________________________ 214 //_____________________________________________________________________________ 487 G4int G4VAnalysisManager::CreateH1(const G4Str 215 G4int G4VAnalysisManager::CreateH1(const G4String& name, const G4String& title, 488 G4int nbins, G4 216 G4int nbins, G4double xmin, G4double xmax, 489 const G4String& 217 const G4String& unitName, const G4String& fcnName, 490 const G4String& 218 const G4String& binSchemeName) 491 { 219 { 492 std::array<G4HnDimension, kDim1> bins = { << 220 if ( ! CheckName(name, "H1") ) return kInvalidId; 493 G4HnDimension(nbins, xmin, xmax)}; << 221 if ( ! CheckNbins(nbins) ) return kInvalidId; 494 std::array<G4HnDimensionInformation, kDim1> << 222 if ( ! CheckMinMax(xmin, xmax, binSchemeName) ) return kInvalidId; 495 G4HnDimensionInformation(unitName, fcnName << 223 496 << 224 return fVH1Manager->CreateH1(name, title, nbins, xmin, xmax, 497 return fVH1Manager->Create(name, title, bins << 225 unitName, fcnName, binSchemeName); 498 } << 226 } 499 227 500 //____________________________________________ 228 //_____________________________________________________________________________ 501 G4int G4VAnalysisManager::CreateH1(const G4Str 229 G4int G4VAnalysisManager::CreateH1(const G4String& name, const G4String& title, 502 const std::vect 230 const std::vector<G4double>& edges, 503 const G4String& 231 const G4String& unitName, const G4String& fcnName) 504 { 232 { 505 std::array<G4HnDimension, kDim1> bins = { << 233 if ( ! CheckName(name, "H1") ) return kInvalidId; 506 G4HnDimension(edges)}; << 234 if ( ! CheckEdges(edges) ) return kInvalidId; 507 std::array<G4HnDimensionInformation, kDim1> << 508 G4HnDimensionInformation(unitName, fcnName << 509 235 510 return fVH1Manager->Create(name, title, bins << 236 return fVH1Manager->CreateH1(name, title, edges, unitName, fcnName); 511 } << 237 } 512 238 513 //____________________________________________ 239 //_____________________________________________________________________________ 514 G4int G4VAnalysisManager::CreateH2(const G4Str 240 G4int G4VAnalysisManager::CreateH2(const G4String& name, const G4String& title, 515 G4int nxbins, G 241 G4int nxbins, G4double xmin, G4double xmax, 516 G4int nybins, G 242 G4int nybins, G4double ymin, G4double ymax, 517 const G4String& 243 const G4String& xunitName, const G4String& yunitName, 518 const G4String& 244 const G4String& xfcnName, const G4String& yfcnName, 519 const G4String& << 245 const G4String& xbinSchemeName, 520 const G4String& 246 const G4String& ybinSchemeName) 521 << 247 522 { 248 { 523 std::array<G4HnDimension, kDim2> bins = { << 249 if ( ! CheckName(name, "H2") ) return kInvalidId; 524 G4HnDimension(nxbins, xmin, xmax), << 250 525 G4HnDimension(nybins, ymin, ymax) }; << 251 if ( ! CheckNbins(nxbins) ) return kInvalidId; 526 std::array<G4HnDimensionInformation, kDim2> << 252 if ( ! CheckMinMax(xmin, xmax, xbinSchemeName) ) return kInvalidId; 527 G4HnDimensionInformation(xunitName, xfcnNa << 253 528 G4HnDimensionInformation(yunitName, yfcnNa << 254 if ( ! CheckNbins(nybins) ) return kInvalidId; 529 << 255 if ( ! CheckMinMax(ymin, ymax, ybinSchemeName) ) return kInvalidId; 530 return fVH2Manager->Create(name, title, bins << 256 531 } << 257 return fVH2Manager->CreateH2(name, title, >> 258 nxbins, xmin, xmax, nybins, ymin, ymax, >> 259 xunitName, yunitName, xfcnName, yfcnName, >> 260 xbinSchemeName, ybinSchemeName); >> 261 } 532 262 533 //____________________________________________ 263 //_____________________________________________________________________________ 534 G4int G4VAnalysisManager::CreateH2(const G4Str 264 G4int G4VAnalysisManager::CreateH2(const G4String& name, const G4String& title, 535 const std::vect 265 const std::vector<G4double>& xedges, 536 const std::vect 266 const std::vector<G4double>& yedges, 537 const G4String& 267 const G4String& xunitName, const G4String& yunitName, 538 const G4String& 268 const G4String& xfcnName, const G4String& yfcnName) 539 << 269 540 { << 541 std::array<G4HnDimension, kDim2> bins = { << 542 G4HnDimension(xedges), G4HnDimension(yedge << 543 std::array<G4HnDimensionInformation, kDim2> << 544 G4HnDimensionInformation(xunitName, xfcnNa << 545 G4HnDimensionInformation(yunitName, yfcnNa << 546 << 547 return fVH2Manager->Create(name, title, bins << 548 } << 549 << 550 //____________________________________________ << 551 G4int G4VAnalysisManager::CreateH3(const G4Str << 552 G4int nxbins, G << 553 G4int nybins, G << 554 G4int nzbins, G << 555 const G4String& << 556 const G4String& << 557 const G4String& << 558 const G4String& << 559 const G4String& << 560 const G4String& << 561 const G4String& << 562 << 563 { << 564 std::array<G4HnDimension, kDim3> bins = { << 565 G4HnDimension(nxbins, xmin, xmax), << 566 G4HnDimension(nybins, ymin, ymax), << 567 G4HnDimension(nzbins, zmin, zmax)}; << 568 std::array<G4HnDimensionInformation, kDim3> << 569 G4HnDimensionInformation(xunitName, xfcnNa << 570 G4HnDimensionInformation(yunitName, yfcnNa << 571 G4HnDimensionInformation(zunitName, zfcnNa << 572 << 573 return fVH3Manager->Create(name, title, bins << 574 } << 575 << 576 //____________________________________________ << 577 G4int G4VAnalysisManager::CreateH3(const G4Str << 578 const std::vect << 579 const std::vect << 580 const std::vect << 581 const G4String& << 582 const G4String& << 583 const G4String& << 584 const G4String& << 585 << 586 { 270 { 587 std::array<G4HnDimension, kDim3> bins = { << 271 if ( ! CheckName(name, "H2") ) return kInvalidId; 588 G4HnDimension(xedges), G4HnDimension(yedg << 272 589 std::array<G4HnDimensionInformation, kDim3> << 273 if ( ! CheckEdges(xedges) ) return kInvalidId; 590 G4HnDimensionInformation(xunitName, xfcnNa << 274 if ( ! CheckEdges(yedges) ) return kInvalidId; 591 G4HnDimensionInformation(yunitName, yfcnNa << 275 592 G4HnDimensionInformation(zunitName, zfcnNa << 276 return fVH2Manager->CreateH2(name, title, 593 << 277 xedges, yedges, 594 return fVH3Manager->Create(name, title, bins << 278 xunitName, yunitName, xfcnName, yfcnName); 595 } << 279 } 596 280 597 //____________________________________________ 281 //_____________________________________________________________________________ 598 G4bool G4VAnalysisManager::SetH1(G4int id, 282 G4bool G4VAnalysisManager::SetH1(G4int id, 599 G4int nbins, G 283 G4int nbins, G4double xmin, G4double xmax, 600 const G4String 284 const G4String& unitName, const G4String& fcnName, 601 const G4String 285 const G4String& binSchemeName) 602 { << 286 { 603 std::array<G4HnDimension, kDim1> bins = { << 287 if ( ! CheckNbins(nbins) ) return kInvalidId; 604 G4HnDimension(nbins, xmin, xmax)}; << 288 if ( ! CheckMinMax(xmin, xmax, binSchemeName) ) return kInvalidId; 605 std::array<G4HnDimensionInformation, kDim1> << 606 G4HnDimensionInformation(unitName, fcnName << 607 289 608 return fVH1Manager->Set(id, bins, info); << 290 return fVH1Manager->SetH1(id, nbins, xmin, xmax, unitName, fcnName, binSchemeName); 609 } 291 } 610 << 292 611 //____________________________________________ 293 //_____________________________________________________________________________ 612 G4bool G4VAnalysisManager::SetH1(G4int id, 294 G4bool G4VAnalysisManager::SetH1(G4int id, 613 const std::vec 295 const std::vector<G4double>& edges, 614 const G4String 296 const G4String& unitName, const G4String& fcnName) 615 { << 297 { 616 std::array<G4HnDimension, kDim1> bins = { << 298 if ( ! CheckEdges(edges) ) return kInvalidId; 617 G4HnDimension(edges)}; << 618 std::array<G4HnDimensionInformation, kDim1> << 619 G4HnDimensionInformation(unitName, fcnName << 620 299 621 return fVH1Manager->Set(id, bins, info); << 300 return fVH1Manager->SetH1(id, edges, unitName, fcnName); 622 } 301 } 623 << 302 624 //____________________________________________ 303 //_____________________________________________________________________________ 625 G4bool G4VAnalysisManager::SetH2(G4int id, 304 G4bool G4VAnalysisManager::SetH2(G4int id, 626 G4int nxbins, << 305 G4int nxbins, G4double xmin, G4double xmax, 627 G4int nybins, 306 G4int nybins, G4double ymin, G4double ymax, 628 const G4String 307 const G4String& xunitName, const G4String& yunitName, 629 const G4String 308 const G4String& xfcnName, const G4String& yfcnName, 630 const G4String << 309 const G4String& xbinSchemeName, 631 const G4String 310 const G4String& ybinSchemeName) 632 { << 311 { 633 std::array<G4HnDimension, kDim2> bins = { << 312 if ( ! CheckNbins(nxbins) ) return kInvalidId; 634 G4HnDimension(nxbins, xmin, xmax), << 313 if ( ! CheckMinMax(xmin, xmax, xbinSchemeName) ) return kInvalidId; 635 G4HnDimension(nybins, ymin, ymax) }; << 314 636 std::array<G4HnDimensionInformation, kDim2> << 315 if ( ! CheckNbins(nybins) ) return kInvalidId; 637 G4HnDimensionInformation(xunitName, xfcnNa << 316 if ( ! CheckMinMax(ymin, ymax, ybinSchemeName) ) return kInvalidId; 638 G4HnDimensionInformation(yunitName, yfcnNa << 317 639 << 318 return fVH2Manager->SetH2(id, nxbins, xmin, xmax, nybins, ymin, ymax, 640 return fVH2Manager->Set(id, bins, info); << 319 xunitName, yunitName, xfcnName, yfcnName, >> 320 xbinSchemeName, ybinSchemeName); 641 } 321 } 642 << 322 643 //____________________________________________ 323 //_____________________________________________________________________________ 644 G4bool G4VAnalysisManager::SetH2(G4int id, 324 G4bool G4VAnalysisManager::SetH2(G4int id, 645 const std::vec 325 const std::vector<G4double>& xedges, 646 const std::vec 326 const std::vector<G4double>& yedges, 647 const G4String 327 const G4String& xunitName, const G4String& yunitName, 648 const G4String 328 const G4String& xfcnName, const G4String& yfcnName) 649 { << 329 { 650 std::array<G4HnDimension, kDim2> bins = { << 330 if ( ! CheckEdges(xedges) ) return kInvalidId; 651 G4HnDimension(xedges), G4HnDimension(yedge << 331 if ( ! CheckEdges(yedges) ) return kInvalidId; 652 std::array<G4HnDimensionInformation, kDim2> << 653 G4HnDimensionInformation(xunitName, xfcnNa << 654 G4HnDimensionInformation(yunitName, yfcnNa << 655 << 656 return fVH2Manager->Set(id, bins, info); << 657 } << 658 << 659 //____________________________________________ << 660 G4bool G4VAnalysisManager::SetH3(G4int id, << 661 G4int nxbins, << 662 G4int nybins, << 663 G4int nzbins, << 664 const G4String << 665 const G4String << 666 const G4String << 667 const G4String << 668 const G4String << 669 const G4String << 670 const G4String << 671 { << 672 std::array<G4HnDimension, kDim3> bins = { << 673 G4HnDimension(nxbins, xmin, xmax), << 674 G4HnDimension(nybins, ymin, ymax), << 675 G4HnDimension(nzbins, zmin, zmax)}; << 676 std::array<G4HnDimensionInformation, kDim3> << 677 G4HnDimensionInformation(xunitName, xfcnNa << 678 G4HnDimensionInformation(yunitName, yfcnNa << 679 G4HnDimensionInformation(zunitName, zfcnNa << 680 << 681 return fVH3Manager->Set(id, bins, info); << 682 } << 683 << 684 //____________________________________________ << 685 G4bool G4VAnalysisManager::SetH3(G4int id, << 686 const std::vec << 687 const std::vec << 688 const std::vec << 689 const G4String << 690 const G4String << 691 const G4String << 692 const G4String << 693 { << 694 std::array<G4HnDimension, kDim3> bins = { << 695 G4HnDimension(xedges), G4HnDimension(yedge << 696 std::array<G4HnDimensionInformation, kDim3> << 697 G4HnDimensionInformation(xunitName, xfcnNa << 698 G4HnDimensionInformation(yunitName, yfcnNa << 699 G4HnDimensionInformation(zunitName, zfcnNa << 700 332 701 return fVH3Manager->Set(id, bins, info); << 333 return fVH2Manager->SetH2(id, xedges, yedges, >> 334 xunitName, yunitName, xfcnName, yfcnName); 702 } 335 } 703 << 336 704 //____________________________________________ 337 //_____________________________________________________________________________ 705 G4bool G4VAnalysisManager::ScaleH1(G4int id, G 338 G4bool G4VAnalysisManager::ScaleH1(G4int id, G4double factor) 706 { 339 { 707 return fVH1Manager->Scale(id, factor); << 340 return fVH1Manager->ScaleH1(id, factor); 708 } << 341 } 709 342 710 //____________________________________________ 343 //_____________________________________________________________________________ 711 G4bool G4VAnalysisManager::ScaleH2(G4int id, G 344 G4bool G4VAnalysisManager::ScaleH2(G4int id, G4double factor) 712 { 345 { 713 return fVH2Manager->Scale(id, factor); << 346 return fVH2Manager->ScaleH2(id, factor); 714 } << 347 } 715 << 348 716 //____________________________________________ 349 //_____________________________________________________________________________ 717 G4bool G4VAnalysisManager::ScaleH3(G4int id, G << 350 G4int G4VAnalysisManager::CreateNtuple(const G4String& name, 718 { << 719 return fVH3Manager->Scale(id, factor); << 720 } << 721 << 722 //____________________________________________ << 723 G4int G4VAnalysisManager::CreateP1(const G4Str << 724 G4int nbins, G4 << 725 G4double ymin, << 726 const G4String& << 727 const G4String& << 728 const G4String& << 729 { << 730 std::array<G4HnDimension, kDim2> bins = { << 731 G4HnDimension(nbins, xmin, xmax), << 732 G4HnDimension(0, ymin, ymax) }; << 733 std::array<G4HnDimensionInformation, kDim2> << 734 G4HnDimensionInformation(xunitName, xfcnNa << 735 G4HnDimensionInformation(yunitName, yfcnNa << 736 << 737 return fVP1Manager->Create(name, title, bins << 738 } << 739 << 740 //____________________________________________ << 741 G4int G4VAnalysisManager::CreateP1(const G4Str << 742 const std::vect << 743 G4double ymin, << 744 const G4String& << 745 const G4String& << 746 { << 747 std::array<G4HnDimension, kDim2> bins = { << 748 G4HnDimension(edges), G4HnDimension(0, ymi << 749 std::array<G4HnDimensionInformation, kDim2> << 750 G4HnDimensionInformation(xunitName, xfcnNa << 751 G4HnDimensionInformation(yunitName, yfcnNa << 752 << 753 return fVP1Manager->Create(name, title, bins << 754 } << 755 << 756 //____________________________________________ << 757 G4int G4VAnalysisManager::CreateP2(const G4Str << 758 G4int nxbins, G4 << 759 G4int nybins, G4 << 760 G4double zmin, G << 761 const G4String& << 762 const G4String& << 763 const G4String& << 764 const G4String& << 765 const G4String& << 766 const G4String& << 767 { << 768 std::array<G4HnDimension, kDim3> bins = { << 769 G4HnDimension(nxbins, xmin, xmax), << 770 G4HnDimension(nybins, ymin, ymax), << 771 G4HnDimension(0, zmin, zmax)}; << 772 std::array<G4HnDimensionInformation, kDim3> << 773 G4HnDimensionInformation(xunitName, xfcnNa << 774 G4HnDimensionInformation(yunitName, yfcnNa << 775 G4HnDimensionInformation(zunitName, zfcnNa << 776 << 777 return fVP2Manager->Create(name, title, bins << 778 } << 779 << 780 //____________________________________________ << 781 G4int G4VAnalysisManager::CreateP2(const G4Str << 782 const std::vecto << 783 const std::vecto << 784 G4double zmin, G << 785 const G4String& << 786 const G4String& << 787 const G4String& << 788 const G4String& << 789 { << 790 std::array<G4HnDimension, kDim3> bins = { << 791 G4HnDimension(xedges), G4HnDimension(yedg << 792 std::array<G4HnDimensionInformation, kDim3> << 793 G4HnDimensionInformation(xunitName, xfcnNa << 794 G4HnDimensionInformation(yunitName, yfcnNa << 795 G4HnDimensionInformation(zunitName, zfcnNa << 796 << 797 return fVP2Manager->Create(name, title, bins << 798 } << 799 << 800 //____________________________________________ << 801 G4bool G4VAnalysisManager::SetP1(G4int id, << 802 G4int nbins, G << 803 G4double ymin, << 804 const G4String << 805 const G4String << 806 const G4String << 807 { << 808 std::array<G4HnDimension, kDim2> bins = { << 809 G4HnDimension(nbins, xmin, xmax), << 810 G4HnDimension(0, ymin, ymax) }; << 811 std::array<G4HnDimensionInformation, kDim2> << 812 G4HnDimensionInformation(xunitName, xfcnNa << 813 G4HnDimensionInformation(yunitName, yfcnNa << 814 << 815 return fVP1Manager->Set(id, bins, info); << 816 } << 817 << 818 //____________________________________________ << 819 G4bool G4VAnalysisManager::SetP1(G4int id, << 820 const std::vec << 821 G4double ymin, << 822 const G4String << 823 const G4String << 824 { << 825 std::array<G4HnDimension, kDim2> bins = { << 826 G4HnDimension(edges), G4HnDimension(0, ymi << 827 std::array<G4HnDimensionInformation, kDim2> << 828 G4HnDimensionInformation(xunitName, xfcnNa << 829 G4HnDimensionInformation(yunitName, yfcnNa << 830 << 831 return fVP1Manager->Set(id, bins, info); << 832 } << 833 << 834 //____________________________________________ << 835 G4bool G4VAnalysisManager::SetP2(G4int id, << 836 G4int nxbins, G4 << 837 G4int nybins, G4 << 838 G4double zmin, G << 839 const G4String& << 840 const G4String& << 841 const G4String& << 842 const G4String& << 843 const G4String& << 844 const G4String& << 845 { << 846 std::array<G4HnDimension, kDim3> bins = { << 847 G4HnDimension(nxbins, xmin, xmax), << 848 G4HnDimension(nybins, ymin, ymax), << 849 G4HnDimension(0, zmin, zmax)}; << 850 std::array<G4HnDimensionInformation, kDim3> << 851 G4HnDimensionInformation(xunitName, xfcnNa << 852 G4HnDimensionInformation(yunitName, yfcnNa << 853 G4HnDimensionInformation(zunitName, zfcnNa << 854 << 855 return fVP2Manager->Set(id, bins, info); << 856 } << 857 << 858 //____________________________________________ << 859 G4bool G4VAnalysisManager::SetP2(G4int id, << 860 const std::vecto << 861 const std::vecto << 862 G4double zmin, G << 863 const G4String& << 864 const G4String& << 865 const G4String& << 866 const G4String& << 867 const G4String& << 868 const G4String& << 869 { << 870 std::array<G4HnDimension, kDim3> bins = { << 871 G4HnDimension(xedges), G4HnDimension(yedge << 872 std::array<G4HnDimensionInformation, kDim3> << 873 G4HnDimensionInformation(xunitName, xfcnNa << 874 G4HnDimensionInformation(yunitName, yfcnNa << 875 G4HnDimensionInformation(zunitName, zfcnNa << 876 << 877 return fVP2Manager->Set(id, bins, info); << 878 } << 879 << 880 //____________________________________________ << 881 G4bool G4VAnalysisManager::ScaleP1(G4int id, G << 882 { << 883 return fVP1Manager->Scale(id, factor); << 884 } << 885 << 886 //____________________________________________ << 887 G4bool G4VAnalysisManager::ScaleP2(G4int id, G << 888 { << 889 return fVP2Manager->Scale(id, factor); << 890 } << 891 << 892 //____________________________________________ << 893 G4int G4VAnalysisManager::CreateNtuple(const G << 894 cons 351 const G4String& title) 895 { 352 { 896 return fNtupleBookingManager->CreateNtuple(n << 353 if ( ! CheckName(name, "Ntuple") ) return kInvalidId; 897 } << 354 >> 355 return fVNtupleManager->CreateNtuple(name, title); >> 356 } 898 357 899 //____________________________________________ 358 //_____________________________________________________________________________ 900 G4int G4VAnalysisManager::CreateNtupleIColumn( 359 G4int G4VAnalysisManager::CreateNtupleIColumn(const G4String& name) 901 { 360 { 902 return fNtupleBookingManager->CreateNtupleIC << 361 if ( ! CheckName(name, "NtupleIColumn") ) return kInvalidId; 903 } << 904 362 905 //____________________________________________ << 363 return fVNtupleManager->CreateNtupleIColumn(name); 906 G4int G4VAnalysisManager::CreateNtupleFColumn( << 364 } 907 { << 908 return fNtupleBookingManager->CreateNtupleFC << 909 } << 910 365 911 //____________________________________________ 366 //_____________________________________________________________________________ 912 G4int G4VAnalysisManager::CreateNtupleDColumn( << 367 G4int G4VAnalysisManager::CreateNtupleFColumn(const G4String& name) 913 { << 914 return fNtupleBookingManager->CreateNtupleDC << 915 } << 916 << 917 //____________________________________________ << 918 G4int G4VAnalysisManager::CreateNtupleSColumn( << 919 { 368 { 920 return fNtupleBookingManager->CreateNtupleSC << 369 if ( ! CheckName(name, "NtupleFColumn") ) return kInvalidId; 921 } << 922 370 923 //____________________________________________ << 371 return fVNtupleManager->CreateNtupleFColumn(name); 924 G4int G4VAnalysisManager::CreateNtupleIColumn( << 372 } 925 << 926 { << 927 return fNtupleBookingManager->CreateNtupleIC << 928 } << 929 373 930 //____________________________________________ 374 //_____________________________________________________________________________ 931 G4int G4VAnalysisManager::CreateNtupleFColumn( << 375 G4int G4VAnalysisManager::CreateNtupleDColumn(const G4String& name) 932 << 933 { 376 { 934 return fNtupleBookingManager->CreateNtupleFC << 377 if ( ! CheckName(name, "NtupleDColumn") ) return kInvalidId; 935 } << 936 378 937 //____________________________________________ << 379 return fVNtupleManager->CreateNtupleDColumn(name); 938 G4int G4VAnalysisManager::CreateNtupleDColumn( << 380 } 939 << 940 { << 941 return fNtupleBookingManager->CreateNtupleDC << 942 } << 943 << 944 //____________________________________________ << 945 G4int G4VAnalysisManager::CreateNtupleSColumn( << 946 << 947 { << 948 return fNtupleBookingManager->CreateNtupleSC << 949 } << 950 381 951 //____________________________________________ 382 //_____________________________________________________________________________ 952 void G4VAnalysisManager::FinishNtuple() 383 void G4VAnalysisManager::FinishNtuple() 953 { << 384 { 954 auto ntupleBooking = fNtupleBookingManager-> << 385 return fVNtupleManager->FinishNtuple(); 955 << 956 if ( fVNtupleManager ) { << 957 fVNtupleManager->CreateNtuple(ntupleBookin << 958 } << 959 } << 960 << 961 //____________________________________________ << 962 void G4VAnalysisManager::SetNtupleMerging(G4bo << 963 G4int /*nofReducedNtupleFil << 964 { << 965 // The function is overridden in the managers << 966 // Here we give just a warning that the featur << 967 << 968 NtupleMergingWarning(fkClass, "SetNtupleMerg << 969 } << 970 << 971 //____________________________________________ << 972 void G4VAnalysisManager::SetNtupleRowWise(G4bo << 973 G4bo << 974 { << 975 // The function is overridden in the managers << 976 // Here we give just a warning that the featur << 977 << 978 NtupleMergingWarning(fkClass, "SetNtupleRowW << 979 } << 980 << 981 //____________________________________________ << 982 void G4VAnalysisManager::SetBasketSize(unsigne << 983 { << 984 // The function is overridden in the managers << 985 // Here we give just a warning that the featur << 986 << 987 NtupleMergingWarning(fkClass, "SetBasketSize << 988 } 386 } 989 << 387 990 //____________________________________________ 388 //_____________________________________________________________________________ 991 void G4VAnalysisManager::SetBasketEntries(unsi << 389 G4int G4VAnalysisManager::CreateNtupleIColumn(G4int ntupleId, >> 390 const G4String& name) 992 { 391 { 993 // The function is overridden in the managers << 392 if ( ! CheckName(name, "NtupleIColumn") ) return kInvalidId; 994 // Here we give just a warning that the featur << 995 << 996 NtupleMergingWarning(fkClass, "SetBasketEntr << 997 } << 998 393 999 //____________________________________________ << 394 return fVNtupleManager->CreateNtupleIColumn(ntupleId, name); 1000 G4int G4VAnalysisManager::CreateNtupleIColumn << 395 } 1001 << 1002 { << 1003 return fNtupleBookingManager->CreateNtupleI << 1004 } << 1005 396 1006 //___________________________________________ 397 //_____________________________________________________________________________ 1007 G4int G4VAnalysisManager::CreateNtupleFColumn << 398 G4int G4VAnalysisManager::CreateNtupleFColumn(G4int ntupleId, const G4String& name) 1008 << 1009 { 399 { 1010 return fNtupleBookingManager->CreateNtupleF << 400 if ( ! CheckName(name, "NtupleFColumn") ) return kInvalidId; 1011 } << 1012 << 1013 401 1014 //___________________________________________ << 402 return fVNtupleManager->CreateNtupleFColumn(ntupleId, name); 1015 G4int G4VAnalysisManager::CreateNtupleDColumn << 403 } 1016 << 1017 { << 1018 return fNtupleBookingManager->CreateNtupleD << 1019 } << 1020 << 1021 //___________________________________________ << 1022 G4int G4VAnalysisManager::CreateNtupleSColumn << 1023 << 1024 { << 1025 return fNtupleBookingManager->CreateNtupleS << 1026 } << 1027 << 1028 //___________________________________________ << 1029 G4int G4VAnalysisManager::CreateNtupleIColumn << 1030 << 1031 << 1032 { << 1033 return fNtupleBookingManager->CreateNtupleI << 1034 } << 1035 404 1036 //___________________________________________ << 1037 G4int G4VAnalysisManager::CreateNtupleFColumn << 1038 << 1039 << 1040 { << 1041 return fNtupleBookingManager->CreateNtupleF << 1042 } << 1043 405 1044 //___________________________________________ 406 //_____________________________________________________________________________ 1045 G4int G4VAnalysisManager::CreateNtupleDColumn << 407 G4int G4VAnalysisManager::CreateNtupleDColumn(G4int ntupleId, const G4String& name) 1046 << 1047 << 1048 { 408 { 1049 return fNtupleBookingManager->CreateNtupleD << 409 if ( ! CheckName(name, "NtupleDColumn") ) return kInvalidId; 1050 } << 1051 410 1052 //___________________________________________ << 411 return fVNtupleManager->CreateNtupleDColumn(ntupleId, name); 1053 G4int G4VAnalysisManager::CreateNtupleSColumn << 412 } 1054 << 1055 << 1056 { << 1057 return fNtupleBookingManager->CreateNtupleS << 1058 } << 1059 413 1060 //___________________________________________ 414 //_____________________________________________________________________________ 1061 void G4VAnalysisManager::FinishNtuple(G4int n 415 void G4VAnalysisManager::FinishNtuple(G4int ntupleId) 1062 { << 416 { 1063 auto ntupleBooking = fNtupleBookingManager- << 417 return fVNtupleManager->FinishNtuple(ntupleId); 1064 << 1065 if ( fVNtupleManager ) { << 1066 fVNtupleManager->CreateNtuple(ntupleBooki << 1067 } << 1068 } 418 } 1069 << 419 1070 //___________________________________________ 420 //_____________________________________________________________________________ 1071 G4bool G4VAnalysisManager::SetFirstHistoId(G4 << 421 G4bool G4VAnalysisManager::SetFirstHistoId(G4int firstId) 1072 { 422 { 1073 auto result = true; << 423 G4bool finalResult = true; 1074 << 424 G4bool result = fVH1Manager->SetFirstId(firstId); 1075 result &= SetFirstH1Id(firstId); << 425 finalResult = finalResult && result; 1076 result &= SetFirstH2Id(firstId); << 426 1077 result &= SetFirstH3Id(firstId); << 427 result = fH1HnManager->SetFirstId(firstId); >> 428 finalResult = finalResult && result; >> 429 >> 430 result = fVH2Manager->SetFirstId(firstId); >> 431 finalResult = finalResult && result; 1078 432 1079 return result; << 433 result = fH2HnManager->SetFirstId(firstId); 1080 } << 434 finalResult = finalResult && result; 1081 << 435 1082 //___________________________________________ << 436 return finalResult; 1083 G4bool G4VAnalysisManager::SetFirstH1Id(G4int << 437 } 1084 { << 1085 return fH1HnManager->SetFirstId(firstId); << 1086 } << 1087 << 1088 //___________________________________________ << 1089 G4bool G4VAnalysisManager::SetFirstH2Id(G4int << 1090 { << 1091 return fH2HnManager->SetFirstId(firstId); << 1092 } << 1093 438 1094 //___________________________________________ 439 //_____________________________________________________________________________ 1095 G4bool G4VAnalysisManager::SetFirstH3Id(G4int << 440 G4bool G4VAnalysisManager::SetFirstH1Id(G4int firstId) 1096 { 441 { 1097 return fH3HnManager->SetFirstId(firstId); << 442 G4bool finalResult = true; 1098 } << 443 G4bool result = fVH1Manager->SetFirstId(firstId); >> 444 finalResult = finalResult && result; >> 445 >> 446 result = fH1HnManager->SetFirstId(firstId); >> 447 finalResult = finalResult && result; >> 448 >> 449 return finalResult; >> 450 } 1099 451 1100 //___________________________________________ 452 //_____________________________________________________________________________ 1101 G4bool G4VAnalysisManager::SetFirstProfileId( << 453 G4bool G4VAnalysisManager::SetFirstH2Id(G4int firstId) 1102 { 454 { 1103 auto result = true; << 455 G4bool finalResult = true; >> 456 G4bool result = fVH2Manager->SetFirstId(firstId); >> 457 finalResult = finalResult && result; 1104 458 1105 result &= SetFirstP1Id(firstId); << 459 result = fH2HnManager->SetFirstId(firstId); 1106 result &= SetFirstP2Id(firstId); << 460 finalResult = finalResult && result; 1107 << 461 1108 return result; << 462 return finalResult; 1109 } << 463 } 1110 464 1111 //___________________________________________ 465 //_____________________________________________________________________________ 1112 G4bool G4VAnalysisManager::SetFirstP1Id(G4int << 466 G4bool G4VAnalysisManager::SetFirstNtupleId(G4int firstId) 1113 { 467 { 1114 return fP1HnManager->SetFirstId(firstId); << 468 return fVNtupleManager->SetFirstId(firstId); 1115 } << 469 } 1116 470 1117 //___________________________________________ 471 //_____________________________________________________________________________ 1118 G4bool G4VAnalysisManager::SetFirstP2Id(G4int << 472 G4bool G4VAnalysisManager::SetFirstNtupleColumnId(G4int firstId) 1119 { 473 { 1120 return fP2HnManager->SetFirstId(firstId); << 474 return fVNtupleManager->SetFirstNtupleColumnId(firstId); 1121 } << 1122 << 1123 //___________________________________________ << 1124 G4bool G4VAnalysisManager::SetFirstNtupleId(G << 1125 { << 1126 auto result = true; << 1127 << 1128 result &= fNtupleBookingManager->SetFirstId << 1129 if ( fVNtupleManager ) { << 1130 result &= fVNtupleManager->SetFirstId(fir << 1131 } << 1132 << 1133 return result; << 1134 } << 1135 << 1136 //___________________________________________ << 1137 G4bool G4VAnalysisManager::SetFirstNtupleColu << 1138 { << 1139 auto result = true; << 1140 << 1141 result &= fNtupleBookingManager->SetFirstNt << 1142 if ( fVNtupleManager ) { << 1143 result &= fVNtupleManager->SetFirstNtuple << 1144 } << 1145 << 1146 return result; << 1147 } 475 } 1148 476 1149 // Fill methods in .icc 477 // Fill methods in .icc 1150 478 1151 //___________________________________________ 479 //_____________________________________________________________________________ 1152 void G4VAnalysisManager::SetActivation(G4boo << 480 void G4VAnalysisManager::SetActivation(G4bool activation) 1153 { 481 { 1154 fState.SetIsActivation(activation); 482 fState.SetIsActivation(activation); 1155 } 483 } 1156 484 1157 // GetActivation() in .icc 485 // GetActivation() in .icc 1158 486 1159 //___________________________________________ 487 //_____________________________________________________________________________ 1160 G4bool G4VAnalysisManager::IsActive() const 488 G4bool G4VAnalysisManager::IsActive() const 1161 { 489 { 1162 // Return true if activation option is select << 490 // Return true if activation option is selected and any of managers has 1163 // an activated object. 491 // an activated object. 1164 492 1165 return fState.GetIsActivation() && << 493 return fState.GetIsActivation() && 1166 ( fH1HnManager->IsActive() || << 494 ( fH1HnManager->IsActive() || fH2HnManager->IsActive() ); 1167 fH2HnManager->IsActive() || << 495 } 1168 fH3HnManager->IsActive() || << 496 1169 fP1HnManager->IsActive() || << 1170 fP2HnManager->IsActive() ); << 1171 } << 1172 497 1173 //___________________________________________ 498 //_____________________________________________________________________________ 1174 G4bool G4VAnalysisManager::IsAscii() const 499 G4bool G4VAnalysisManager::IsAscii() const 1175 { 500 { 1176 // Return true any of managers has an object 501 // Return true any of managers has an object with activated ASCII option. 1177 502 1178 return ( fH1HnManager->IsAscii() || << 503 return ( fH1HnManager->IsAscii() || fH2HnManager->IsAscii() ); 1179 fH2HnManager->IsAscii() || << 504 } 1180 fH3HnManager->IsAscii() || << 1181 fP1HnManager->IsAscii() || << 1182 fP2HnManager->IsAscii() ); << 1183 } << 1184 << 1185 //___________________________________________ << 1186 G4bool G4VAnalysisManager::IsPlotting() const << 1187 { << 1188 // Return true any of managers has an object << 1189 << 1190 return ( fH1HnManager->IsPlotting() || << 1191 fH2HnManager->IsPlotting() || << 1192 fH3HnManager->IsPlotting() || << 1193 fP1HnManager->IsPlotting() || << 1194 fP2HnManager->IsPlotting() ); << 1195 } << 1196 << 1197 //___________________________________________ << 1198 G4int G4VAnalysisManager::GetFirstH1Id() cons << 1199 { << 1200 // Return first H1 id << 1201 << 1202 return fH1HnManager->GetFirstId(); << 1203 } << 1204 << 1205 //___________________________________________ << 1206 G4int G4VAnalysisManager::GetFirstH2Id() cons << 1207 { << 1208 // Return first H2 id << 1209 << 1210 return fH2HnManager->GetFirstId(); << 1211 } << 1212 << 1213 //___________________________________________ << 1214 G4int G4VAnalysisManager::GetFirstH3Id() cons << 1215 { << 1216 // Return first H3 id << 1217 << 1218 return fH3HnManager->GetFirstId(); << 1219 } << 1220 << 1221 //___________________________________________ << 1222 G4int G4VAnalysisManager::GetFirstP1Id() cons << 1223 { << 1224 // Return first P1 id << 1225 << 1226 return fP1HnManager->GetFirstId(); << 1227 } << 1228 << 1229 //___________________________________________ << 1230 G4int G4VAnalysisManager::GetFirstP2Id() cons << 1231 { << 1232 // Return first P2 id << 1233 << 1234 return fP2HnManager->GetFirstId(); << 1235 } << 1236 << 1237 //___________________________________________ << 1238 G4int G4VAnalysisManager::GetFirstNtupleId() << 1239 { << 1240 // Return first Ntuple id << 1241 << 1242 return fNtupleBookingManager->GetFirstId(); << 1243 } << 1244 << 1245 //___________________________________________ << 1246 G4int G4VAnalysisManager::GetFirstNtupleColum << 1247 { << 1248 // Return first Ntuple column id << 1249 << 1250 return fNtupleBookingManager->GetFirstNtupl << 1251 } << 1252 << 1253 //___________________________________________ << 1254 G4int G4VAnalysisManager::GetNofH1s(G4bool on << 1255 { << 1256 return fVH1Manager->GetNofHns(onlyIfExist); << 1257 } << 1258 << 1259 //___________________________________________ << 1260 G4int G4VAnalysisManager::GetNofH2s(G4bool on << 1261 { << 1262 return fVH2Manager->GetNofHns(onlyIfExist); << 1263 } << 1264 << 1265 //___________________________________________ << 1266 G4int G4VAnalysisManager::GetNofH3s(G4bool on << 1267 { << 1268 return fVH3Manager->GetNofHns(onlyIfExist); << 1269 } << 1270 << 1271 //___________________________________________ << 1272 G4int G4VAnalysisManager::GetNofP1s(G4bool on << 1273 { << 1274 return fVP1Manager->GetNofHns(onlyIfExist); << 1275 } << 1276 << 1277 //___________________________________________ << 1278 G4int G4VAnalysisManager::GetNofP2s(G4bool on << 1279 { << 1280 return fVP2Manager->GetNofHns(onlyIfExist); << 1281 } << 1282 << 1283 //___________________________________________ << 1284 G4int G4VAnalysisManager::GetNofNtuples(G4boo << 1285 { << 1286 return fNtupleBookingManager->GetNofNtuples << 1287 } << 1288 << 1289 // GetH1Id(), GetH2Id in .icc << 1290 << 1291 //___________________________________________ << 1292 G4bool G4VAnalysisManager::ListH1(G4bool only << 1293 { << 1294 return fVH1Manager->List(G4cout, onlyIfActi << 1295 } << 1296 << 1297 //___________________________________________ << 1298 G4bool G4VAnalysisManager::ListH2(G4bool only << 1299 { << 1300 return fVH2Manager->List(G4cout, onlyIfActi << 1301 } << 1302 << 1303 //___________________________________________ << 1304 G4bool G4VAnalysisManager::ListH3(G4bool only << 1305 { << 1306 return fVH3Manager->List(G4cout, onlyIfActi << 1307 } << 1308 505 1309 //___________________________________________ 506 //_____________________________________________________________________________ 1310 G4bool G4VAnalysisManager::ListP1(G4bool only << 507 G4int G4VAnalysisManager::GetNofH1s() const 1311 { 508 { 1312 return fVP1Manager->List(G4cout, onlyIfActi << 509 return fH1HnManager->GetNofHns(); 1313 } << 510 } 1314 511 1315 //___________________________________________ 512 //_____________________________________________________________________________ 1316 G4bool G4VAnalysisManager::ListP2(G4bool only << 513 G4int G4VAnalysisManager::GetNofH2s() const 1317 { 514 { 1318 return fVP2Manager->List(G4cout, onlyIfActi << 515 return fH2HnManager->GetNofHns(); 1319 } << 516 } 1320 517 1321 //___________________________________________ 518 //_____________________________________________________________________________ 1322 G4bool G4VAnalysisManager::ListNtuple(G4bool << 519 G4int G4VAnalysisManager::GetNofNtuples() const 1323 { 520 { 1324 return fNtupleBookingManager->List(G4cout, << 521 return fVNtupleManager->GetNofNtuples(); 1325 } << 522 } 1326 523 1327 //___________________________________________ << 524 // GetH1Id(), GetH2Id in .icc 1328 G4bool G4VAnalysisManager::List(G4bool onlyIf << 1329 { << 1330 auto result = true; << 1331 result &= ListH1(onlyIfActive); << 1332 result &= ListH2(onlyIfActive); << 1333 result &= ListH3(onlyIfActive); << 1334 result &= ListP1(onlyIfActive); << 1335 result &= ListP2(onlyIfActive); << 1336 result &= ListNtuple(onlyIfActive); << 1337 << 1338 return result; << 1339 } << 1340 525 1341 //___________________________________________ 526 //_____________________________________________________________________________ 1342 void G4VAnalysisManager::SetH1Activation(G4i 527 void G4VAnalysisManager::SetH1Activation(G4int id, G4bool activation) 1343 { 528 { 1344 // Set activation to a given H1 object 529 // Set activation to a given H1 object 1345 530 1346 fH1HnManager->SetActivation(id, activation) 531 fH1HnManager->SetActivation(id, activation); 1347 } << 532 } 1348 533 1349 //___________________________________________ 534 //_____________________________________________________________________________ 1350 void G4VAnalysisManager::SetH1Activation(G4b 535 void G4VAnalysisManager::SetH1Activation(G4bool activation) 1351 { 536 { 1352 // Set activation to all H1 objects 537 // Set activation to all H1 objects 1353 538 1354 fH1HnManager->SetActivation(activation); 539 fH1HnManager->SetActivation(activation); 1355 } << 540 } 1356 541 1357 //___________________________________________ 542 //_____________________________________________________________________________ 1358 void G4VAnalysisManager::SetH1Ascii(G4int id 543 void G4VAnalysisManager::SetH1Ascii(G4int id, G4bool ascii) 1359 { 544 { 1360 fH1HnManager->SetAscii(id, ascii); 545 fH1HnManager->SetAscii(id, ascii); 1361 } << 546 } 1362 << 1363 //___________________________________________ << 1364 void G4VAnalysisManager::SetH1Plotting(G4int << 1365 { << 1366 fH1HnManager->SetPlotting(id, plotting); << 1367 } << 1368 << 1369 //___________________________________________ << 1370 void G4VAnalysisManager::SetH1FileName(G4int << 1371 { << 1372 fH1HnManager->SetFileName(id, fileName); << 1373 } << 1374 547 1375 //___________________________________________ 548 //_____________________________________________________________________________ 1376 void G4VAnalysisManager::SetH2Activation(G4i 549 void G4VAnalysisManager::SetH2Activation(G4int id, G4bool activation) 1377 { 550 { 1378 // Set activation to a given H2 object 551 // Set activation to a given H2 object 1379 552 1380 fH2HnManager->SetActivation(id, activation) 553 fH2HnManager->SetActivation(id, activation); 1381 } << 554 } 1382 555 1383 //___________________________________________ 556 //_____________________________________________________________________________ 1384 void G4VAnalysisManager::SetH2Activation(G4b 557 void G4VAnalysisManager::SetH2Activation(G4bool activation) 1385 { 558 { 1386 // Set activation to all H2 objects 559 // Set activation to all H2 objects 1387 560 1388 fH2HnManager->SetActivation(activation); 561 fH2HnManager->SetActivation(activation); 1389 } << 562 } 1390 563 1391 //___________________________________________ 564 //_____________________________________________________________________________ 1392 void G4VAnalysisManager::SetH2Ascii(G4int id 565 void G4VAnalysisManager::SetH2Ascii(G4int id, G4bool ascii) 1393 { 566 { 1394 fH2HnManager->SetAscii(id, ascii); 567 fH2HnManager->SetAscii(id, ascii); 1395 } << 568 } 1396 << 1397 //___________________________________________ << 1398 void G4VAnalysisManager::SetH2Plotting(G4int << 1399 { << 1400 fH2HnManager->SetPlotting(id, plotting); << 1401 } << 1402 << 1403 //___________________________________________ << 1404 void G4VAnalysisManager::SetH2FileName(G4int << 1405 { << 1406 fH2HnManager->SetFileName(id, fileName); << 1407 } << 1408 << 1409 //___________________________________________ << 1410 void G4VAnalysisManager::SetH3Activation(G4i << 1411 { << 1412 // Set activation to a given H3 object << 1413 << 1414 fH3HnManager->SetActivation(id, activation) << 1415 } << 1416 << 1417 //___________________________________________ << 1418 void G4VAnalysisManager::SetH3Activation(G4b << 1419 { << 1420 // Set activation to all H3 objects << 1421 << 1422 fH3HnManager->SetActivation(activation); << 1423 } << 1424 << 1425 //___________________________________________ << 1426 void G4VAnalysisManager::SetH3Ascii(G4int id << 1427 { << 1428 fH3HnManager->SetAscii(id, ascii); << 1429 } << 1430 << 1431 //___________________________________________ << 1432 void G4VAnalysisManager::SetH3Plotting(G4int << 1433 { << 1434 fH3HnManager->SetPlotting(id, plotting); << 1435 } << 1436 << 1437 //___________________________________________ << 1438 void G4VAnalysisManager::SetH3FileName(G4int << 1439 { << 1440 fH3HnManager->SetFileName(id, fileName); << 1441 } << 1442 << 1443 //___________________________________________ << 1444 void G4VAnalysisManager::SetP1Activation(G4i << 1445 { << 1446 // Set activation to a given P1 object << 1447 << 1448 fP1HnManager->SetActivation(id, activation) << 1449 } << 1450 << 1451 //___________________________________________ << 1452 void G4VAnalysisManager::SetP1Activation(G4b << 1453 { << 1454 // Set activation to all P1 objects << 1455 << 1456 fP1HnManager->SetActivation(activation); << 1457 } << 1458 << 1459 //___________________________________________ << 1460 void G4VAnalysisManager::SetP1Ascii(G4int id << 1461 { << 1462 fP1HnManager->SetAscii(id, ascii); << 1463 } << 1464 << 1465 //___________________________________________ << 1466 void G4VAnalysisManager::SetP1Plotting(G4int << 1467 { << 1468 fP1HnManager->SetPlotting(id, plotting); << 1469 } << 1470 << 1471 //___________________________________________ << 1472 void G4VAnalysisManager::SetP1FileName(G4int << 1473 { << 1474 fP1HnManager->SetFileName(id, fileName); << 1475 } << 1476 << 1477 //___________________________________________ << 1478 void G4VAnalysisManager::SetP2Activation(G4i << 1479 { << 1480 // Set activation to a given P2 object << 1481 << 1482 fP2HnManager->SetActivation(id, activation) << 1483 } << 1484 << 1485 //___________________________________________ << 1486 void G4VAnalysisManager::SetP2Activation(G4b << 1487 { << 1488 // Set activation to all P2 objects << 1489 << 1490 fP2HnManager->SetActivation(activation); << 1491 } << 1492 << 1493 //___________________________________________ << 1494 void G4VAnalysisManager::SetP2Ascii(G4int id << 1495 { << 1496 fP2HnManager->SetAscii(id, ascii); << 1497 } << 1498 << 1499 //___________________________________________ << 1500 void G4VAnalysisManager::SetP2Plotting(G4int << 1501 { << 1502 fP2HnManager->SetPlotting(id, plotting); << 1503 } << 1504 << 1505 //___________________________________________ << 1506 void G4VAnalysisManager::SetP2FileName(G4int << 1507 { << 1508 fP2HnManager->SetFileName(id, fileName); << 1509 } << 1510 << 1511 //___________________________________________ << 1512 void G4VAnalysisManager::SetNtupleActivation << 1513 { << 1514 // Set activation to a given ntuple object << 1515 << 1516 fNtupleBookingManager->SetActivation(id, ac << 1517 if ( fVNtupleManager ) { << 1518 fVNtupleManager->SetActivation(id, activa << 1519 } << 1520 } << 1521 << 1522 //___________________________________________ << 1523 void G4VAnalysisManager::SetNtupleActivation << 1524 { << 1525 // Set activation to all ntuple objects << 1526 << 1527 fNtupleBookingManager->SetActivation(activa << 1528 if ( fVNtupleManager ) { << 1529 fVNtupleManager->SetActivation(activation << 1530 } << 1531 } << 1532 << 1533 //___________________________________________ << 1534 void G4VAnalysisManager::SetNtupleFileName(G << 1535 { << 1536 // Set activation to a given P2 object << 1537 << 1538 fNtupleBookingManager->SetFileName(id, file << 1539 } << 1540 << 1541 //___________________________________________ << 1542 void G4VAnalysisManager::SetNtupleFileName(c << 1543 { << 1544 // Set activation to all P2 objects << 1545 << 1546 fNtupleBookingManager->SetFileName(fileName << 1547 } << 1548 << 1549 //___________________________________________ << 1550 G4bool G4VAnalysisManager::DeleteH1(G4int id << 1551 { << 1552 return fVH1Manager->Delete(id, keepSetting) << 1553 } << 1554 << 1555 //___________________________________________ << 1556 G4bool G4VAnalysisManager::DeleteH2(G4int id << 1557 { << 1558 return fVH2Manager->Delete(id, keepSetting) << 1559 } << 1560 << 1561 //___________________________________________ << 1562 G4bool G4VAnalysisManager::DeleteH3(G4int id << 1563 { << 1564 return fVH3Manager->Delete(id, keepSetting) << 1565 } << 1566 << 1567 //___________________________________________ << 1568 G4bool G4VAnalysisManager::DeleteP1(G4int id << 1569 { << 1570 return fVP1Manager->Delete(id, keepSetting) << 1571 } << 1572 << 1573 //___________________________________________ << 1574 G4bool G4VAnalysisManager::DeleteP2(G4int id << 1575 { << 1576 return fVP2Manager->Delete(id, keepSetting) << 1577 } << 1578 << 1579 //___________________________________________ << 1580 G4bool G4VAnalysisManager::DeleteNtuple(G4in << 1581 { << 1582 auto result = fNtupleBookingManager->Delete << 1583 << 1584 if (fVNtupleManager != nullptr) { << 1585 result &= fVNtupleManager->Delete(id); << 1586 } << 1587 << 1588 return result; << 1589 } << 1590 569 1591 // Access methods in .icc 570 // Access methods in .icc 1592 571 1593 //___________________________________________ 572 //_____________________________________________________________________________ 1594 void G4VAnalysisManager::SetVerboseLevel(G4in << 573 void G4VAnalysisManager::SetVerboseLevel(G4int verboseLevel) 1595 { 574 { 1596 fState.SetVerboseLevel(verboseLevel); 575 fState.SetVerboseLevel(verboseLevel); 1597 } << 576 } 1598 577 1599 // GetVerboseLevel() in .icc << 578 // GetVerboseLevel() in .icc 1600 579 1601 580