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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 ]

Diff markup

Differences between /analysis/hntools/include/G4ToolsAnalysisManager.icc (Version 11.3.0) and /analysis/hntools/include/G4ToolsAnalysisManager.icc (Version 11.2.1)


  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                                                    26 
 27 #include "G4HnInformation.hh"                      27 #include "G4HnInformation.hh"
 28                                                    28 
 29 #include "G4THnToolsManager.hh"                    29 #include "G4THnToolsManager.hh"
 30                                                    30 
 31 //____________________________________________     31 //_____________________________________________________________________________
 32 template <typename HT>                             32 template <typename HT>
 33 inline                                             33 inline
 34 G4bool G4ToolsAnalysisManager::WriteT(             34 G4bool G4ToolsAnalysisManager::WriteT(
 35   const std::vector<std::pair<HT*, G4HnInforma     35   const std::vector<std::pair<HT*, G4HnInformation*>>& hnVector)
 36 {                                                  36 {
 37   auto result = true;                              37   auto result = true;
 38                                                    38 
 39   for ( auto& [ht, info] : hnVector) {             39   for ( auto& [ht, info] : hnVector) {
 40     auto activation = info->GetActivation();       40     auto activation = info->GetActivation();
 41                                                    41 
 42     // skip writing if activation is enabled a     42     // skip writing if activation is enabled and H1 is inactivated
 43     // or if histogram was deleted                 43     // or if histogram was deleted
 44     if ( ( fState.GetIsActivation() && ( ! act     44     if ( ( fState.GetIsActivation() && ( ! activation ) ) ||
 45          ( info->GetDeleted() ) ) continue;        45          ( info->GetDeleted() ) ) continue;
 46                                                    46 
 47     auto name = info->GetName();                   47     auto name = info->GetName();
 48     auto fileName = info->GetFileName();           48     auto fileName = info->GetFileName();
 49     auto fileManager = GetFileManager(fileName     49     auto fileManager = GetFileManager(fileName);
 50                                                    50 
 51     // skip writing if cannot get file manager     51     // skip writing if cannot get file manager (wrong file extension)
 52     if ( ! fileManager ) {                         52     if ( ! fileManager ) {
 53       G4Analysis::Warn(                            53       G4Analysis::Warn(
 54         "Cannot get file manager for file " +      54         "Cannot get file manager for file " + fileName + ".\n" +
 55         "Writing " + G4Analysis::GetHnType<HT>     55         "Writing " + G4Analysis::GetHnType<HT>() + " " +  name + " will be skipped.",
 56         fkClass, "WriteT");                        56         fkClass, "WriteT");
 57       continue;                                    57       continue;
 58     }                                              58     }
 59                                                    59 
 60     auto fileKind = " in file ";                   60     auto fileKind = " in file ";
 61     if ( fileName != "" ) {                        61     if ( fileName != "" ) {
 62       fileKind = " in extra file ";                62       fileKind = " in extra file ";
 63     } else {                                       63     } else {
 64       fileName = fileManager->GetFullFileName(     64       fileName = fileManager->GetFullFileName();
 65     }                                              65     }
 66                                                    66 
 67     // update name with a cycle number             67     // update name with a cycle number
 68     if (! fileManager->HasCycles() && fState.G     68     if (! fileManager->HasCycles() && fState.GetCycle() > 0) {
 69       name += "_v" + std::to_string(fState.Get     69       name += "_v" + std::to_string(fState.GetCycle());
 70     }                                              70     }
 71                                                    71 
 72     Message(G4Analysis::kVL4, "write", G4Analy     72     Message(G4Analysis::kVL4, "write", G4Analysis::GetHnType<HT>(),
 73       name + fileKind + fileName);                 73       name + fileKind + fileName);
 74                                                    74 
 75     if ( ! fileManager->template GetHnFileMana     75     if ( ! fileManager->template GetHnFileManager<HT>()->Write(ht, name, fileName) ) {
 76       G4Analysis::Warn(                            76       G4Analysis::Warn(
 77         "Writing " + G4Analysis::GetHnType<HT>     77         "Writing " + G4Analysis::GetHnType<HT>() + " " +  name +
 78         " to file " +  fileName + " failed.",      78         " to file " +  fileName + " failed.",
 79         fkClass, "WriteT");                        79         fkClass, "WriteT");
 80       result = false;                              80       result = false;
 81     }                                              81     }
 82                                                    82 
 83     if (result) {                                  83     if (result) {
 84       // notify that file has a written object     84       // notify that file has a written object
 85       fileManager->SetIsEmpty(fileName, false)     85       fileManager->SetIsEmpty(fileName, false);
 86     }                                              86     }
 87                                                    87 
 88     Message(G4Analysis::kVL3, "write", G4Analy     88     Message(G4Analysis::kVL3, "write", G4Analysis::GetHnType<HT>(),
 89       name + " in the " + fileKind + " file "      89       name + " in the " + fileKind + " file " + fileName);
 90   }                                                90   }
 91                                                    91 
 92   return result;                                   92   return result;
 93 }                                                  93 }
 94                                                    94 
 95 //____________________________________________     95 //_____________________________________________________________________________
 96 inline                                             96 inline
 97 G4bool G4ToolsAnalysisManager::IsOpenFileImpl(     97 G4bool G4ToolsAnalysisManager::IsOpenFileImpl() const
 98 {                                                  98 {
 99   return fVFileManager->IsOpenFile();              99   return fVFileManager->IsOpenFile();
100 }                                                 100 }
101                                                   101 
102 //____________________________________________    102 //_____________________________________________________________________________
103 inline                                            103 inline
104 tools::histo::h1d*  G4ToolsAnalysisManager::Ge    104 tools::histo::h1d*  G4ToolsAnalysisManager::GetH1(G4int id, G4bool warn,
105                                                   105                                                  G4bool onlyIfActive) const
106 {                                                 106 {
107   return fH1Manager->GetT(id, warn, onlyIfActi    107   return fH1Manager->GetT(id, warn, onlyIfActive);
108 }                                                 108 }
109                                                   109 
110 //____________________________________________    110 //_____________________________________________________________________________
111 inline                                            111 inline
112 tools::histo::h2d*  G4ToolsAnalysisManager::Ge    112 tools::histo::h2d*  G4ToolsAnalysisManager::GetH2(G4int id, G4bool warn,
113                                                   113                                                  G4bool onlyIfActive) const
114 {                                                 114 {
115   return fH2Manager->GetT(id, warn, onlyIfActi    115   return fH2Manager->GetT(id, warn, onlyIfActive);
116 }                                                 116 }
117                                                   117 
118 //____________________________________________    118 //_____________________________________________________________________________
119 inline                                            119 inline
120 tools::histo::h3d*  G4ToolsAnalysisManager::Ge    120 tools::histo::h3d*  G4ToolsAnalysisManager::GetH3(G4int id, G4bool warn,
121                                                   121                                                  G4bool onlyIfActive) const
122 {                                                 122 {
123   return fH3Manager->GetT(id, warn, onlyIfActi    123   return fH3Manager->GetT(id, warn, onlyIfActive);
124 }                                                 124 }
125                                                   125 
126 //____________________________________________    126 //_____________________________________________________________________________
127 inline                                            127 inline
128 tools::histo::p1d*  G4ToolsAnalysisManager::Ge    128 tools::histo::p1d*  G4ToolsAnalysisManager::GetP1(G4int id, G4bool warn,
129                                                   129                                                  G4bool onlyIfActive) const
130 {                                                 130 {
131   return fP1Manager->GetT(id, warn, onlyIfActi    131   return fP1Manager->GetT(id, warn, onlyIfActive);
132 }                                                 132 }
133                                                   133 
134 //____________________________________________    134 //_____________________________________________________________________________
135 inline                                            135 inline
136 tools::histo::p2d*  G4ToolsAnalysisManager::Ge    136 tools::histo::p2d*  G4ToolsAnalysisManager::GetP2(G4int id, G4bool warn,
137                                                   137                                                  G4bool onlyIfActive) const
138 {                                                 138 {
139   return fP2Manager->GetT(id, warn, onlyIfActi    139   return fP2Manager->GetT(id, warn, onlyIfActive);
140 }                                                 140 }
141                                                   141 
142 //____________________________________________    142 //_____________________________________________________________________________
143 inline                                            143 inline
144 std::vector<tools::histo::h1d*>::iterator G4To    144 std::vector<tools::histo::h1d*>::iterator G4ToolsAnalysisManager::BeginH1()
145 {                                                 145 {
146   return fH1Manager->BeginT();                    146   return fH1Manager->BeginT();
147 }                                                 147 }
148                                                   148 
149 //____________________________________________    149 //_____________________________________________________________________________
150 inline                                            150 inline
151 std::vector<tools::histo::h1d*>::iterator G4To    151 std::vector<tools::histo::h1d*>::iterator G4ToolsAnalysisManager::EndH1()
152 {                                                 152 {
153   return fH1Manager->EndT();                      153   return fH1Manager->EndT();
154 }                                                 154 }
155                                                   155 
156 //____________________________________________    156 //_____________________________________________________________________________
157 inline                                            157 inline
158 std::vector<tools::histo::h1d*>::const_iterato    158 std::vector<tools::histo::h1d*>::const_iterator
159 G4ToolsAnalysisManager::BeginConstH1() const      159 G4ToolsAnalysisManager::BeginConstH1() const
160 {                                                 160 {
161   return fH1Manager->BeginConstT();               161   return fH1Manager->BeginConstT();
162 }                                                 162 }
163                                                   163 
164 //____________________________________________    164 //_____________________________________________________________________________
165 inline                                            165 inline
166 std::vector<tools::histo::h1d*>::const_iterato    166 std::vector<tools::histo::h1d*>::const_iterator
167 G4ToolsAnalysisManager::EndConstH1() const        167 G4ToolsAnalysisManager::EndConstH1() const
168 {                                                 168 {
169   return fH1Manager->EndConstT();                 169   return fH1Manager->EndConstT();
170 }                                                 170 }
171                                                   171 
172 //____________________________________________    172 //_____________________________________________________________________________
173 inline                                            173 inline
174 std::vector<tools::histo::h2d*>::iterator G4To    174 std::vector<tools::histo::h2d*>::iterator G4ToolsAnalysisManager::BeginH2()
175 {                                                 175 {
176   return fH2Manager->BeginT();                    176   return fH2Manager->BeginT();
177 }                                                 177 }
178                                                   178 
179 //____________________________________________    179 //_____________________________________________________________________________
180 inline                                            180 inline
181 std::vector<tools::histo::h2d*>::iterator G4To    181 std::vector<tools::histo::h2d*>::iterator G4ToolsAnalysisManager::EndH2()
182 {                                                 182 {
183   return fH2Manager->EndT();                      183   return fH2Manager->EndT();
184 }                                                 184 }
185                                                   185 
186 //____________________________________________    186 //_____________________________________________________________________________
187 inline                                            187 inline
188 std::vector<tools::histo::h2d*>::const_iterato    188 std::vector<tools::histo::h2d*>::const_iterator
189 G4ToolsAnalysisManager::BeginConstH2() const      189 G4ToolsAnalysisManager::BeginConstH2() const
190 {                                                 190 {
191   return fH2Manager->BeginConstT();               191   return fH2Manager->BeginConstT();
192 }                                                 192 }
193                                                   193 
194 //____________________________________________    194 //_____________________________________________________________________________
195 inline                                            195 inline
196 std::vector<tools::histo::h2d*>::const_iterato    196 std::vector<tools::histo::h2d*>::const_iterator
197 G4ToolsAnalysisManager::EndConstH2() const        197 G4ToolsAnalysisManager::EndConstH2() const
198 {                                                 198 {
199   return fH2Manager->EndConstT();                 199   return fH2Manager->EndConstT();
200 }                                                 200 }
201                                                   201 
202 //____________________________________________    202 //_____________________________________________________________________________
203 inline                                            203 inline
204 std::vector<tools::histo::h3d*>::iterator G4To    204 std::vector<tools::histo::h3d*>::iterator G4ToolsAnalysisManager::BeginH3()
205 {                                                 205 {
206   return fH3Manager->BeginT();                    206   return fH3Manager->BeginT();
207 }                                                 207 }
208                                                   208 
209 //____________________________________________    209 //_____________________________________________________________________________
210 inline                                            210 inline
211 std::vector<tools::histo::h3d*>::iterator G4To    211 std::vector<tools::histo::h3d*>::iterator G4ToolsAnalysisManager::EndH3()
212 {                                                 212 {
213   return fH3Manager->EndT();                      213   return fH3Manager->EndT();
214 }                                                 214 }
215                                                   215 
216 //____________________________________________    216 //_____________________________________________________________________________
217 inline                                            217 inline
218 std::vector<tools::histo::h3d*>::const_iterato    218 std::vector<tools::histo::h3d*>::const_iterator
219 G4ToolsAnalysisManager::BeginConstH3() const      219 G4ToolsAnalysisManager::BeginConstH3() const
220 {                                                 220 {
221   return fH3Manager->BeginConstT();               221   return fH3Manager->BeginConstT();
222 }                                                 222 }
223                                                   223 
224 //____________________________________________    224 //_____________________________________________________________________________
225 inline                                            225 inline
226 std::vector<tools::histo::h3d*>::const_iterato    226 std::vector<tools::histo::h3d*>::const_iterator
227 G4ToolsAnalysisManager::EndConstH3() const        227 G4ToolsAnalysisManager::EndConstH3() const
228 {                                                 228 {
229   return fH3Manager->EndConstT();                 229   return fH3Manager->EndConstT();
230 }                                                 230 }
231                                                   231 
232 //____________________________________________    232 //_____________________________________________________________________________
233 inline                                            233 inline
234 std::vector<tools::histo::p1d*>::iterator G4To    234 std::vector<tools::histo::p1d*>::iterator G4ToolsAnalysisManager::BeginP1()
235 {                                                 235 {
236   return fP1Manager->BeginT();                    236   return fP1Manager->BeginT();
237 }                                                 237 }
238                                                   238 
239 //____________________________________________    239 //_____________________________________________________________________________
240 inline                                            240 inline
241 std::vector<tools::histo::p1d*>::iterator G4To    241 std::vector<tools::histo::p1d*>::iterator G4ToolsAnalysisManager::EndP1()
242 {                                                 242 {
243   return fP1Manager->EndT();                      243   return fP1Manager->EndT();
244 }                                                 244 }
245                                                   245 
246 //____________________________________________    246 //_____________________________________________________________________________
247 inline                                            247 inline
248 std::vector<tools::histo::p1d*>::const_iterato    248 std::vector<tools::histo::p1d*>::const_iterator
249 G4ToolsAnalysisManager::BeginConstP1() const      249 G4ToolsAnalysisManager::BeginConstP1() const
250 {                                                 250 {
251   return fP1Manager->BeginConstT();               251   return fP1Manager->BeginConstT();
252 }                                                 252 }
253                                                   253 
254 //____________________________________________    254 //_____________________________________________________________________________
255 inline                                            255 inline
256 std::vector<tools::histo::p1d*>::const_iterato    256 std::vector<tools::histo::p1d*>::const_iterator
257 G4ToolsAnalysisManager::EndConstP1() const        257 G4ToolsAnalysisManager::EndConstP1() const
258 {                                                 258 {
259   return fP1Manager->EndConstT();                 259   return fP1Manager->EndConstT();
260 }                                                 260 }
261                                                   261 
262 //____________________________________________    262 //_____________________________________________________________________________
263 inline                                            263 inline
264 std::vector<tools::histo::p2d*>::iterator G4To    264 std::vector<tools::histo::p2d*>::iterator G4ToolsAnalysisManager::BeginP2()
265 {                                                 265 {
266   return fP2Manager->BeginT();                    266   return fP2Manager->BeginT();
267 }                                                 267 }
268                                                   268 
269 //____________________________________________    269 //_____________________________________________________________________________
270 inline                                            270 inline
271 std::vector<tools::histo::p2d*>::iterator G4To    271 std::vector<tools::histo::p2d*>::iterator G4ToolsAnalysisManager::EndP2()
272 {                                                 272 {
273   return fP2Manager->EndT();                      273   return fP2Manager->EndT();
274 }                                                 274 }
275                                                   275 
276 //____________________________________________    276 //_____________________________________________________________________________
277 inline                                            277 inline
278 std::vector<tools::histo::p2d*>::const_iterato    278 std::vector<tools::histo::p2d*>::const_iterator
279 G4ToolsAnalysisManager::BeginConstP2() const      279 G4ToolsAnalysisManager::BeginConstP2() const
280 {                                                 280 {
281   return fP2Manager->BeginConstT();               281   return fP2Manager->BeginConstT();
282 }                                                 282 }
283                                                   283 
284 //____________________________________________    284 //_____________________________________________________________________________
285 inline                                            285 inline
286 std::vector<tools::histo::p2d*>::const_iterato    286 std::vector<tools::histo::p2d*>::const_iterator
287 G4ToolsAnalysisManager::EndConstP2() const        287 G4ToolsAnalysisManager::EndConstP2() const
288 {                                                 288 {
289   return fP2Manager->EndConstT();                 289   return fP2Manager->EndConstT();
290 }                                                 290 }
291                                                   291