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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 8.0)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26                                                   
 27 #include "G4HnInformation.hh"                     
 28                                                   
 29 #include "G4THnToolsManager.hh"                   
 30                                                   
 31 //____________________________________________    
 32 template <typename HT>                            
 33 inline                                            
 34 G4bool G4ToolsAnalysisManager::WriteT(            
 35   const std::vector<std::pair<HT*, G4HnInforma    
 36 {                                                 
 37   auto result = true;                             
 38                                                   
 39   for ( auto& [ht, info] : hnVector) {            
 40     auto activation = info->GetActivation();      
 41                                                   
 42     // skip writing if activation is enabled a    
 43     // or if histogram was deleted                
 44     if ( ( fState.GetIsActivation() && ( ! act    
 45          ( info->GetDeleted() ) ) continue;       
 46                                                   
 47     auto name = info->GetName();                  
 48     auto fileName = info->GetFileName();          
 49     auto fileManager = GetFileManager(fileName    
 50                                                   
 51     // skip writing if cannot get file manager    
 52     if ( ! fileManager ) {                        
 53       G4Analysis::Warn(                           
 54         "Cannot get file manager for file " +     
 55         "Writing " + G4Analysis::GetHnType<HT>    
 56         fkClass, "WriteT");                       
 57       continue;                                   
 58     }                                             
 59                                                   
 60     auto fileKind = " in file ";                  
 61     if ( fileName != "" ) {                       
 62       fileKind = " in extra file ";               
 63     } else {                                      
 64       fileName = fileManager->GetFullFileName(    
 65     }                                             
 66                                                   
 67     // update name with a cycle number            
 68     if (! fileManager->HasCycles() && fState.G    
 69       name += "_v" + std::to_string(fState.Get    
 70     }                                             
 71                                                   
 72     Message(G4Analysis::kVL4, "write", G4Analy    
 73       name + fileKind + fileName);                
 74                                                   
 75     if ( ! fileManager->template GetHnFileMana    
 76       G4Analysis::Warn(                           
 77         "Writing " + G4Analysis::GetHnType<HT>    
 78         " to file " +  fileName + " failed.",     
 79         fkClass, "WriteT");                       
 80       result = false;                             
 81     }                                             
 82                                                   
 83     if (result) {                                 
 84       // notify that file has a written object    
 85       fileManager->SetIsEmpty(fileName, false)    
 86     }                                             
 87                                                   
 88     Message(G4Analysis::kVL3, "write", G4Analy    
 89       name + " in the " + fileKind + " file "     
 90   }                                               
 91                                                   
 92   return result;                                  
 93 }                                                 
 94                                                   
 95 //____________________________________________    
 96 inline                                            
 97 G4bool G4ToolsAnalysisManager::IsOpenFileImpl(    
 98 {                                                 
 99   return fVFileManager->IsOpenFile();             
100 }                                                 
101                                                   
102 //____________________________________________    
103 inline                                            
104 tools::histo::h1d*  G4ToolsAnalysisManager::Ge    
105                                                   
106 {                                                 
107   return fH1Manager->GetT(id, warn, onlyIfActi    
108 }                                                 
109                                                   
110 //____________________________________________    
111 inline                                            
112 tools::histo::h2d*  G4ToolsAnalysisManager::Ge    
113                                                   
114 {                                                 
115   return fH2Manager->GetT(id, warn, onlyIfActi    
116 }                                                 
117                                                   
118 //____________________________________________    
119 inline                                            
120 tools::histo::h3d*  G4ToolsAnalysisManager::Ge    
121                                                   
122 {                                                 
123   return fH3Manager->GetT(id, warn, onlyIfActi    
124 }                                                 
125                                                   
126 //____________________________________________    
127 inline                                            
128 tools::histo::p1d*  G4ToolsAnalysisManager::Ge    
129                                                   
130 {                                                 
131   return fP1Manager->GetT(id, warn, onlyIfActi    
132 }                                                 
133                                                   
134 //____________________________________________    
135 inline                                            
136 tools::histo::p2d*  G4ToolsAnalysisManager::Ge    
137                                                   
138 {                                                 
139   return fP2Manager->GetT(id, warn, onlyIfActi    
140 }                                                 
141                                                   
142 //____________________________________________    
143 inline                                            
144 std::vector<tools::histo::h1d*>::iterator G4To    
145 {                                                 
146   return fH1Manager->BeginT();                    
147 }                                                 
148                                                   
149 //____________________________________________    
150 inline                                            
151 std::vector<tools::histo::h1d*>::iterator G4To    
152 {                                                 
153   return fH1Manager->EndT();                      
154 }                                                 
155                                                   
156 //____________________________________________    
157 inline                                            
158 std::vector<tools::histo::h1d*>::const_iterato    
159 G4ToolsAnalysisManager::BeginConstH1() const      
160 {                                                 
161   return fH1Manager->BeginConstT();               
162 }                                                 
163                                                   
164 //____________________________________________    
165 inline                                            
166 std::vector<tools::histo::h1d*>::const_iterato    
167 G4ToolsAnalysisManager::EndConstH1() const        
168 {                                                 
169   return fH1Manager->EndConstT();                 
170 }                                                 
171                                                   
172 //____________________________________________    
173 inline                                            
174 std::vector<tools::histo::h2d*>::iterator G4To    
175 {                                                 
176   return fH2Manager->BeginT();                    
177 }                                                 
178                                                   
179 //____________________________________________    
180 inline                                            
181 std::vector<tools::histo::h2d*>::iterator G4To    
182 {                                                 
183   return fH2Manager->EndT();                      
184 }                                                 
185                                                   
186 //____________________________________________    
187 inline                                            
188 std::vector<tools::histo::h2d*>::const_iterato    
189 G4ToolsAnalysisManager::BeginConstH2() const      
190 {                                                 
191   return fH2Manager->BeginConstT();               
192 }                                                 
193                                                   
194 //____________________________________________    
195 inline                                            
196 std::vector<tools::histo::h2d*>::const_iterato    
197 G4ToolsAnalysisManager::EndConstH2() const        
198 {                                                 
199   return fH2Manager->EndConstT();                 
200 }                                                 
201                                                   
202 //____________________________________________    
203 inline                                            
204 std::vector<tools::histo::h3d*>::iterator G4To    
205 {                                                 
206   return fH3Manager->BeginT();                    
207 }                                                 
208                                                   
209 //____________________________________________    
210 inline                                            
211 std::vector<tools::histo::h3d*>::iterator G4To    
212 {                                                 
213   return fH3Manager->EndT();                      
214 }                                                 
215                                                   
216 //____________________________________________    
217 inline                                            
218 std::vector<tools::histo::h3d*>::const_iterato    
219 G4ToolsAnalysisManager::BeginConstH3() const      
220 {                                                 
221   return fH3Manager->BeginConstT();               
222 }                                                 
223                                                   
224 //____________________________________________    
225 inline                                            
226 std::vector<tools::histo::h3d*>::const_iterato    
227 G4ToolsAnalysisManager::EndConstH3() const        
228 {                                                 
229   return fH3Manager->EndConstT();                 
230 }                                                 
231                                                   
232 //____________________________________________    
233 inline                                            
234 std::vector<tools::histo::p1d*>::iterator G4To    
235 {                                                 
236   return fP1Manager->BeginT();                    
237 }                                                 
238                                                   
239 //____________________________________________    
240 inline                                            
241 std::vector<tools::histo::p1d*>::iterator G4To    
242 {                                                 
243   return fP1Manager->EndT();                      
244 }                                                 
245                                                   
246 //____________________________________________    
247 inline                                            
248 std::vector<tools::histo::p1d*>::const_iterato    
249 G4ToolsAnalysisManager::BeginConstP1() const      
250 {                                                 
251   return fP1Manager->BeginConstT();               
252 }                                                 
253                                                   
254 //____________________________________________    
255 inline                                            
256 std::vector<tools::histo::p1d*>::const_iterato    
257 G4ToolsAnalysisManager::EndConstP1() const        
258 {                                                 
259   return fP1Manager->EndConstT();                 
260 }                                                 
261                                                   
262 //____________________________________________    
263 inline                                            
264 std::vector<tools::histo::p2d*>::iterator G4To    
265 {                                                 
266   return fP2Manager->BeginT();                    
267 }                                                 
268                                                   
269 //____________________________________________    
270 inline                                            
271 std::vector<tools::histo::p2d*>::iterator G4To    
272 {                                                 
273   return fP2Manager->EndT();                      
274 }                                                 
275                                                   
276 //____________________________________________    
277 inline                                            
278 std::vector<tools::histo::p2d*>::const_iterato    
279 G4ToolsAnalysisManager::BeginConstP2() const      
280 {                                                 
281   return fP2Manager->BeginConstT();               
282 }                                                 
283                                                   
284 //____________________________________________    
285 inline                                            
286 std::vector<tools::histo::p2d*>::const_iterato    
287 G4ToolsAnalysisManager::EndConstP2() const        
288 {                                                 
289   return fP2Manager->EndConstT();                 
290 }                                                 
291