Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OlapRunAction.cc
Go to the documentation of this file.
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 //
28 //
29 //
30 // $Id$
31 //
32 //
33 // --------------------------------------------------------------
34 // OlapRunAction
35 //
36 // Author: Martin Liendl - Martin.Liendl@cern.ch
37 //
38 // --------------------------------------------------------------
39 //
40 #include "OlapRunAction.hh"
41 #include "G4UImanager.hh"
42 #include "G4VVisManager.hh"
43 
44 #include "OlapManager.hh"
45 
46 #include "G4Run.hh"
47 
48 #include "globals.hh"
49 #include <fstream>
50 
52 {
53 }
54 
55 
57 {
58 }
59 
60 
62 {
63  while ( !theOlaps.empty() )
64  {
65  delete theOlaps.back();
66  theOlaps.pop_back();
67  }
68 }
69 
70 
72 {
73  if (!theOlaps.size())
74  return;
75 
76 //output to screen
77  G4cerr << "===== collected overlaps of run [" << aRun->GetRunID() << "] "
78  << "(ol=" << theOlaps.size() << ")"<< G4endl;
79 
81 
82  std::vector<OlapInfo*>::iterator it = theOlaps.begin();
83  G4int i=1;
84  while (it!=theOlaps.end())
85  {
86  G4cerr << "--[" << i << "]--------------------------" << G4endl;
87  G4cerr << "delta=" << ((*it)->v1 - (*it)->v2).mag() << G4endl;
88  G4cerr << *(*it) << G4endl;
89 
90  it++; i++;
91  }
92 
93 //output to file
94 
96  if (logManager->areWeLogging || logManager->areWeLoggingByVolume)
97  {
98  it = theOlaps.begin();
99  i=1;
100  G4String fname;
101 
102  if(logManager->areWeLogging)
103  fname = logManager->filename;
104 
105  else if(logManager->areWeLoggingByVolume)
106  {
107  G4String volume;
108  if((*it)->hist1.GetDepth() >= 1)
109  volume = (*it)->hist1.GetVolume(1)->GetName();
110  else if((*it)->hist2.GetDepth() >= 1)
111  volume = (*it)->hist2.GetVolume(1)->GetName();
112  else
113  G4cerr << "error: did not get the filename" << G4endl;
114 
115  fname = logManager->logPath + volume + ".log";
116  }
117 
118  FILE.open(fname, std::ios::app);
119  FILE << "===== collected overlaps of run [" << aRun->GetRunID() << "] "
120  << "(ol=" << theOlaps.size() << ")"<< G4endl;
121 
122  while (it!=theOlaps.end()) {
123 
124  FILE << "--[" << i << "]--------------------------" << G4endl;
125  FILE << "delta=" << ((*it)->v1 - (*it)->v2).mag() << G4endl;
126  FILE << *(*it) << G4endl;
127 
128  it++; i++;
129  }
130  FILE << "-------------------------------------" << G4endl;
131  FILE.close();
132 
133  G4cerr << "Output has also been put into "<< fname << G4endl;
134  }//end if
135 
136  G4cerr << "-------------------------------------" << G4endl;
137  DrawOlaps();
138 
139 }
140 
141 #include <vector>
142 #include "G4Circle.hh"
143 #include "G4Polyline.hh"
144 #include "G4VisAttributes.hh"
145 #include "G4Colour.hh"
146 #include "G4VSolid.hh"
147 #include "G4Box.hh"
148 #include "G4LogicalVolume.hh"
149 #include "OlapManager.hh"
150 
152 {
153  // iguana takes over ...
154 }