Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/analysis/management/src/G4VAnalysisManager.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

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