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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 /examples/extended/parameterisations/Par02/src/Par02Output.cc (Version 11.3.0) and /examples/extended/parameterisations/Par02/src/Par02Output.cc (Version 11.0.p3,)


** Warning: Cannot open xref database.

  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 /// \file Par02Output.cc                          
 28 /// \brief Implementation of the Par02Output c    
 29                                                   
 30 #include "Par02Output.hh"                         
 31                                                   
 32 #include "Par02EventInformation.hh"               
 33                                                   
 34 #include "G4AnalysisManager.hh"                   
 35 #include "G4Event.hh"                             
 36 #include "G4RunManager.hh"                        
 37 #include "G4SystemOfUnits.hh"                     
 38 #include "G4UnitsTable.hh"                        
 39                                                   
 40 //....oooOO0OOooo........oooOO0OOooo........oo    
 41                                                   
 42 Par02Output* Par02Output::fPar02Output = nullp    
 43 G4ThreadLocal G4int Par02Output::fCurrentNtupl    
 44 G4ThreadLocal G4int Par02Output::fCurrentID =     
 45                                                   
 46 //....oooOO0OOooo........oooOO0OOooo........oo    
 47                                                   
 48 Par02Output::Par02Output() : fFileNameWithRunN    
 49 {                                                 
 50   fFileName = "DefaultOutput.root";               
 51 }                                                 
 52                                                   
 53 //....oooOO0OOooo........oooOO0OOooo........oo    
 54                                                   
 55 Par02Output::~Par02Output() = default;            
 56                                                   
 57 //....oooOO0OOooo........oooOO0OOooo........oo    
 58                                                   
 59 Par02Output* Par02Output::Instance()              
 60 {                                                 
 61   if (!fPar02Output) {                            
 62     fPar02Output = new Par02Output();             
 63   }                                               
 64   return fPar02Output;                            
 65 }                                                 
 66                                                   
 67 //....oooOO0OOooo........oooOO0OOooo........oo    
 68                                                   
 69 void Par02Output::SetFileName(G4String aName)     
 70 {                                                 
 71   fFileName = aName;                              
 72 }                                                 
 73                                                   
 74 //....oooOO0OOooo........oooOO0OOooo........oo    
 75                                                   
 76 void Par02Output::AppendName(G4bool aApp)         
 77 {                                                 
 78   fFileNameWithRunNo = aApp;                      
 79 }                                                 
 80                                                   
 81 //....oooOO0OOooo........oooOO0OOooo........oo    
 82                                                   
 83 G4String Par02Output::GetFileName()               
 84 {                                                 
 85   return fFileName;                               
 86 }                                                 
 87                                                   
 88 //....oooOO0OOooo........oooOO0OOooo........oo    
 89                                                   
 90 void Par02Output::StartAnalysis(G4int aRunID)     
 91 {                                                 
 92   G4AnalysisManager* analysisManager = G4Analy    
 93   if (fFileNameWithRunNo) {                       
 94     fFileName += "_run";                          
 95     fFileName += G4UIcommand::ConvertToString(    
 96   }                                               
 97   analysisManager->SetDefaultFileType("root");    
 98   analysisManager->SetVerboseLevel(1);            
 99   analysisManager->SetFileName(fFileName);        
100   analysisManager->OpenFile(fFileName);           
101 }                                                 
102                                                   
103 //....oooOO0OOooo........oooOO0OOooo........oo    
104                                                   
105 void Par02Output::EndAnalysis()                   
106 {                                                 
107   G4AnalysisManager* analysisManager = G4Analy    
108   analysisManager->Write();                       
109   analysisManager->CloseFile();                   
110 }                                                 
111                                                   
112 //....oooOO0OOooo........oooOO0OOooo........oo    
113                                                   
114 void Par02Output::CreateNtuples()                 
115 {                                                 
116   const G4Event* event = G4RunManager::GetRunM    
117   G4String evName = "Event_";                     
118   evName += G4UIcommand::ConvertToString(event    
119   G4AnalysisManager* analysisManager = G4Analy    
120   fCurrentNtupleId = analysisManager->CreateNt    
121                                                   
122   analysisManager->CreateNtupleIColumn("partic    
123   analysisManager->CreateNtupleIColumn("PID");    
124   analysisManager->CreateNtupleDColumn("MC_pX"    
125   analysisManager->CreateNtupleDColumn("MC_pY"    
126   analysisManager->CreateNtupleDColumn("MC_pZ"    
127                                                   
128   analysisManager->CreateNtupleDColumn("tracke    
129   analysisManager->CreateNtupleDColumn("tracke    
130   analysisManager->CreateNtupleDColumn("tracke    
131   analysisManager->CreateNtupleDColumn("tracke    
132   analysisManager->CreateNtupleDColumn("tracke    
133                                                   
134   analysisManager->CreateNtupleDColumn("emcal_    
135   analysisManager->CreateNtupleDColumn("emcal_    
136   analysisManager->CreateNtupleDColumn("emcal_    
137   analysisManager->CreateNtupleDColumn("emcal_    
138   analysisManager->CreateNtupleDColumn("emcal_    
139   analysisManager->CreateNtupleDColumn("emcal_    
140                                                   
141   analysisManager->CreateNtupleDColumn("hcal_r    
142   analysisManager->CreateNtupleDColumn("hcal_e    
143   analysisManager->CreateNtupleDColumn("hcal_X    
144   analysisManager->CreateNtupleDColumn("hcal_Y    
145   analysisManager->CreateNtupleDColumn("hcal_Z    
146   analysisManager->CreateNtupleDColumn("hcal_E    
147                                                   
148   analysisManager->FinishNtuple(fCurrentNtuple    
149 }                                                 
150                                                   
151 //....oooOO0OOooo........oooOO0OOooo........oo    
152                                                   
153 void Par02Output::CreateHistograms()              
154 {                                                 
155   G4AnalysisManager* analysisManager = G4Analy    
156   analysisManager->CreateH1("Pdiff", "momentum    
157   analysisManager->SetH1XAxisTitle(0, "p_{smea    
158   analysisManager->SetH1YAxisTitle(0, "Entries    
159   analysisManager->CreateH1("EMCalEdiff", "ene    
160   analysisManager->SetH1XAxisTitle(1, "E_{smea    
161   analysisManager->SetH1YAxisTitle(1, "Entries    
162   analysisManager->CreateH1("HCalEdiff", "ener    
163   analysisManager->SetH1XAxisTitle(2, "E_{smea    
164   analysisManager->SetH1YAxisTitle(2, "Entries    
165 }                                                 
166                                                   
167 //....oooOO0OOooo........oooOO0OOooo........oo    
168                                                   
169 void Par02Output::SaveTrack(SaveType aWhatToSa    
170                             G4double aResoluti    
171 {                                                 
172   G4AnalysisManager* analysisManager = G4Analy    
173   switch (aWhatToSave) {                          
174     case Par02Output::eNoSave:                    
175       break;                                      
176     case Par02Output::eSaveMC: {                  
177       analysisManager->FillNtupleIColumn(fCurr    
178       analysisManager->FillNtupleIColumn(fCurr    
179       analysisManager->FillNtupleDColumn(fCurr    
180       analysisManager->FillNtupleDColumn(fCurr    
181       analysisManager->FillNtupleDColumn(fCurr    
182       fCurrentID = aPartID;                       
183       break;                                      
184     }                                             
185     case Par02Output::eSaveTracker: {             
186       if (aPartID != fCurrentID)                  
187         G4cout << " Wrong particle - trying to    
188                << G4endl;                         
189       analysisManager->FillNtupleDColumn(fCurr    
190       analysisManager->FillNtupleDColumn(fCurr    
191       analysisManager->FillNtupleDColumn(fCurr    
192       analysisManager->FillNtupleDColumn(fCurr    
193       analysisManager->FillNtupleDColumn(fCurr    
194       break;                                      
195     }                                             
196     case Par02Output::eSaveEMCal: {               
197       if (aPartID != fCurrentID)                  
198         G4cout << " Wrong particle - trying to    
199                << G4endl;                         
200       analysisManager->FillNtupleDColumn(fCurr    
201       analysisManager->FillNtupleDColumn(fCurr    
202       analysisManager->FillNtupleDColumn(fCurr    
203       analysisManager->FillNtupleDColumn(fCurr    
204       analysisManager->FillNtupleDColumn(fCurr    
205       analysisManager->FillNtupleDColumn(fCurr    
206       break;                                      
207     }                                             
208     case Par02Output::eSaveHCal: {                
209       if (aPartID != fCurrentID)                  
210         G4cout << " Wrong particle - trying to    
211                << G4endl;                         
212       analysisManager->FillNtupleDColumn(fCurr    
213       analysisManager->FillNtupleDColumn(fCurr    
214       analysisManager->FillNtupleDColumn(fCurr    
215       analysisManager->FillNtupleDColumn(fCurr    
216       analysisManager->FillNtupleDColumn(fCurr    
217       analysisManager->FillNtupleDColumn(fCurr    
218       analysisManager->AddNtupleRow(fCurrentNt    
219       break;                                      
220     }                                             
221   }                                               
222 }                                                 
223                                                   
224 //....oooOO0OOooo........oooOO0OOooo........oo    
225                                                   
226 void Par02Output::FillHistogram(G4int aHistNo,    
227 {                                                 
228   G4AnalysisManager* analysisManager = G4Analy    
229   analysisManager->FillH1(aHistNo, aValue);       
230 }                                                 
231                                                   
232 //....oooOO0OOooo........oooOO0OOooo........oo    
233