Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CexmcRunAction Class Reference

#include <CexmcRunAction.hh>

Inheritance diagram for CexmcRunAction:
Collaboration diagram for CexmcRunAction:

Public Member Functions

 CexmcRunAction (CexmcPhysicsManager *physicsManager)
 
G4RunGenerateRun (void)
 
void EndOfRunAction (const G4Run *run)
 
- Public Member Functions inherited from G4UserRunAction
 G4UserRunAction ()
 
virtual ~G4UserRunAction ()
 
virtual void BeginOfRunAction (const G4Run *aRun)
 
virtual void SetMaster (G4bool val=true)
 
G4bool IsMaster () const
 

Static Public Member Functions

static void PrintResults (const CexmcNmbOfHitsInRanges &nmbOfHitsSampled, const CexmcNmbOfHitsInRanges &nmbOfHitsSampledFull, const CexmcNmbOfHitsInRanges &nmbOfHitsTriggeredRealRange, const CexmcNmbOfHitsInRanges &nmbOfHitsTriggeredRecRange, const CexmcNmbOfHitsInRanges &nmbOfOrphanHits, const CexmcAngularRangeList &angularRanges, G4int nmbOfFalseHitsTriggeredEDT, G4int nmbOfFalseHitsTriggeredRec)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserRunAction
G4bool isMaster
 

Detailed Description

Definition at line 54 of file CexmcRunAction.hh.

Constructor & Destructor Documentation

CexmcRunAction::CexmcRunAction ( CexmcPhysicsManager physicsManager)
explicit

Definition at line 56 of file CexmcRunAction.cc.

56  :
57  physicsManager( physicsManager )
58 {
59 }

Member Function Documentation

void CexmcRunAction::EndOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

Definition at line 230 of file CexmcRunAction.cc.

231 {
232  const CexmcRun * theRun( static_cast< const CexmcRun * >( run ) );
233 
234  const CexmcNmbOfHitsInRanges & nmbOfHitsSampled(
235  theRun->GetNmbOfHitsSampled() );
236  const CexmcNmbOfHitsInRanges & nmbOfHitsSampledFull(
237  theRun->GetNmbOfHitsSampledFull() );
238  const CexmcNmbOfHitsInRanges & nmbOfHitsTriggeredRealRange(
239  theRun->GetNmbOfHitsTriggeredRealRange() );
240  const CexmcNmbOfHitsInRanges & nmbOfHitsTriggeredRecRange(
241  theRun->GetNmbOfHitsTriggeredRecRange() );
242  const CexmcNmbOfHitsInRanges & nmbOfOrphanHits(
243  theRun->GetNmbOfOrphanHits() );
244 
245  CexmcProductionModel * productionModel(
246  physicsManager->GetProductionModel() );
247  if ( ! productionModel )
249 
250  const CexmcAngularRangeList & angularRanges(
251  productionModel->GetAngularRanges() );
252 
253  G4cout << G4endl;
254  PrintResults( nmbOfHitsSampled, nmbOfHitsSampledFull,
255  nmbOfHitsTriggeredRealRange, nmbOfHitsTriggeredRecRange,
256  nmbOfOrphanHits, angularRanges,
257  theRun->GetNmbOfFalseHitsTriggeredEDT(),
258  theRun->GetNmbOfFalseHitsTriggeredRec() );
259  G4cout << G4endl;
260 }
G4GLOB_DLL std::ostream G4cout
static void PrintResults(const CexmcNmbOfHitsInRanges &nmbOfHitsSampled, const CexmcNmbOfHitsInRanges &nmbOfHitsSampledFull, const CexmcNmbOfHitsInRanges &nmbOfHitsTriggeredRealRange, const CexmcNmbOfHitsInRanges &nmbOfHitsTriggeredRecRange, const CexmcNmbOfHitsInRanges &nmbOfOrphanHits, const CexmcAngularRangeList &angularRanges, G4int nmbOfFalseHitsTriggeredEDT, G4int nmbOfFalseHitsTriggeredRec)
std::vector< CexmcAngularRange > CexmcAngularRangeList
#define G4endl
Definition: G4ios.hh:61
virtual CexmcProductionModel * GetProductionModel(void)=0
std::map< G4int, G4int > CexmcNmbOfHitsInRanges
Definition: CexmcRun.hh:51

Here is the call graph for this function:

G4Run * CexmcRunAction::GenerateRun ( void  )
virtual

Reimplemented from G4UserRunAction.

Definition at line 62 of file CexmcRunAction.cc.

63 {
64  return new CexmcRun;
65 }
void CexmcRunAction::PrintResults ( const CexmcNmbOfHitsInRanges nmbOfHitsSampled,
const CexmcNmbOfHitsInRanges nmbOfHitsSampledFull,
const CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRealRange,
const CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRecRange,
const CexmcNmbOfHitsInRanges nmbOfOrphanHits,
const CexmcAngularRangeList angularRanges,
G4int  nmbOfFalseHitsTriggeredEDT,
G4int  nmbOfFalseHitsTriggeredRec 
)
static

Definition at line 68 of file CexmcRunAction.cc.

77 {
78  /* there are 7 auxiliary columns:
79  * 1. acc real, [floating point number]
80  * 2. triggered real,
81  * 3. total hits sampled and monitored,
82  * 4. acc reconstructed, [floating point number]
83  * 5. triggered reconstructed,
84  * 6. total hits sampled and monitored (identical with #3),
85  * 7. total hits sampled.
86  * As far as #3 and #6 are identical, nmbOfAuxColumns = 6 */
87  const size_t nmbOfAuxColumns( 6 );
88  const std::streamsize prec( 8 );
89  std::vector< std::vector< std::string > > auxStrings;
90  size_t maxSize[ nmbOfAuxColumns ];
91 
92  for ( size_t i( 0 ); i < nmbOfAuxColumns; ++i )
93  maxSize[ i ] = 0;
94 
95  /* addition of 2 (for '0.') for acceptances, that are floating point
96  * numbers, is correct as far as ios::fixed will be used, and no negative
97  * values are expected, and values will be less than 1. */
98  maxSize[ 0 ] = prec + 2;
99  maxSize[ 3 ] = prec + 2;
100 
101  for ( CexmcAngularRangeList::const_iterator k( angularRanges.begin() );
102  k != angularRanges.end(); ++k )
103  {
104  G4int total( 0 );
105  G4int totalFull( 0 );
106  G4int triggered( 0 );
107  G4double acc( std::numeric_limits< G4double >::quiet_NaN() );
108 
109  CexmcNmbOfHitsInRanges::const_iterator found(
110  nmbOfHitsSampled.find( k->index ) );
111  if ( found != nmbOfHitsSampled.end() )
112  {
113  total = found->second;
114  acc = 0;
115  }
116 
117  found = nmbOfHitsSampledFull.find( k->index );
118  if ( found != nmbOfHitsSampledFull.end() )
119  {
120  totalFull = found->second;
121  }
122 
123  G4double accSave( acc );
124  found = nmbOfHitsTriggeredRealRange.find( k->index );
125  if ( found != nmbOfHitsTriggeredRealRange.end() )
126  {
127  triggered = found->second;
128  if ( total > 0 )
129  acc = G4double( triggered ) / total;
130  }
131 
132  std::ostringstream auxStringStream[ nmbOfAuxColumns ];
133 
134  for ( size_t i( 0 ); i < nmbOfAuxColumns; ++i )
135  {
136  auxStringStream[ i ].precision( prec );
137  auxStringStream[ i ].flags( std::ios::fixed );
138  }
139 
140  G4int i( 0 );
141 
142  auxStringStream[ i ] << acc;
143  auxStringStream[ ++i ] << triggered;
144  size_t size( auxStringStream[ i ].str().size() );
145  maxSize[ i ] = maxSize[ i ] > size ? maxSize[ i ] : size;
146  auxStringStream[ ++i ] << total;
147  size = auxStringStream[ i ].str().size();
148  maxSize[ i ] = maxSize[ i ] > size ? maxSize[ i ] : size;
149 
150  triggered = 0;
151  acc = accSave;
152  found = nmbOfHitsTriggeredRecRange.find( k->index );
153  if ( found != nmbOfHitsTriggeredRecRange.end() )
154  {
155  triggered = found->second;
156  if ( total > 0 )
157  acc = G4double( triggered ) / total;
158  }
159 
160  auxStringStream[ ++i ] << acc;
161  auxStringStream[ ++i ] << triggered;
162  size = auxStringStream[ i ].str().size();
163  maxSize[ i ] = maxSize[ i ] > size ? maxSize[ i ] : size;
164  auxStringStream[ ++i ] << totalFull;
165  size = auxStringStream[ i ].str().size();
166  maxSize[ i ] = maxSize[ i ] > size ? maxSize[ i ] : size;
167 
168  std::vector< std::string > auxString( nmbOfAuxColumns );
169 
170  for ( size_t i( 0 ); i < nmbOfAuxColumns; ++i )
171  auxString[ i ] = auxStringStream[ i ].str();
172 
173  auxStrings.push_back( auxString );
174  }
175 
176  G4cout << " --- Setup acceptances (range | real (trg / mon) | "
177  "rec (trg / mon / all)):" << G4endl;
178 
179  G4int i( 0 );
180  for ( CexmcAngularRangeList::const_iterator k( angularRanges.begin() );
181  k != angularRanges.end(); ++k )
182  {
183  G4cout << " " << *k;
184  G4int j( 0 );
185  G4cout << " | " << std::setw( maxSize[ j ] );
186  G4cout << auxStrings[ i ][ j++ ];
187  G4cout << " ( " << std::setw( maxSize[ j ] );
188  G4cout << auxStrings[ i ][ j++ ];
189  G4cout << " / " << std::setw( maxSize[ j ] );
190  G4cout << auxStrings[ i ][ j++ ];
191  G4cout << " ) | " << std::setw( maxSize[ j ] );
192  G4cout << auxStrings[ i ][ j++ ];
193  G4cout << " ( " << std::setw( maxSize[ j ] );
194  G4cout << auxStrings[ i ][ j++ ];
195  G4cout << " / " << std::setw( maxSize[ 2 ] );
196  G4cout << auxStrings[ i ][ 2 ];
197  G4cout << " / " << std::setw( maxSize[ j ] );
198  G4cout << auxStrings[ i++ ][ j++ ] << " )" << G4endl;
199  }
200 
201  CexmcAngularRangeList angularGaps;
202  GetAngularGaps( angularRanges, angularGaps );
203 
204  if ( ! angularGaps.empty() )
205  {
206  G4cout << " orphans detected: " << G4endl;
207  for ( CexmcAngularRangeList::const_iterator k( angularGaps.begin() );
208  k != angularGaps.end(); ++k )
209  {
210  G4cout << " " << *k;
211  G4int total( 0 );
212 
213  CexmcNmbOfHitsInRanges::const_iterator found(
214  nmbOfOrphanHits.find( k->index ) );
215  if ( found != nmbOfHitsSampled.end() )
216  {
217  total = found->second;
218  }
219  G4cout << " " << total << G4endl;
220  }
221  }
222 
223  G4cout << " ---" << G4endl;
224  G4cout << " False hits (edt | rec): " <<
225  nmbOfFalseHitsTriggeredEDT << " | " << nmbOfFalseHitsTriggeredRec <<
226  G4endl;
227 }
int G4int
Definition: G4Types.hh:78
static const double prec
Definition: RanecuEngine.cc:58
G4GLOB_DLL std::ostream G4cout
G4double total(Particle const *const p1, Particle const *const p2)
std::vector< CexmcAngularRange > CexmcAngularRangeList
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void GetAngularGaps(const CexmcAngularRangeList &src, CexmcAngularRangeList &dst)

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: