9 #include <G4RunManager.hh>
10 #include <G4UImanager.hh>
11 #include <G4VisManager.hh>
12 #include <G4VisExecutive.hh>
14 #include <G4GeometryManager.hh>
15 #include <G4PhysicalVolumeStore.hh>
16 #include <G4LogicalVolumeStore.hh>
17 #include <G4SolidStore.hh>
19 #include <fwk/CentralConfig.h>
20 #include <fwk/RandomEngineRegistry.h>
22 #include <evt/Event.h>
23 #include <mevt/CounterSimData.h>
24 #include <mdet/Counter.h>
25 #include <det/Detector.h>
27 #include <utl/ErrorLogger.h>
28 #include <utl/Reader.h>
29 #include <utl/Particle.h>
30 #include <utl/ShowerParticleIterator.h>
31 #include <utl/TimeDistribution.h>
32 #include <utl/TimeDistributionAlgorithm.h>
33 #include <utl/AugerUnits.h>
40 #include <CLHEP/Random/Random.h>
42 #include <tls/Geant4Manager.h>
51 using namespace GroundPropagatorAG;
53 const mdet::Counter* GroundPropagator::fCurrentDetectorCounter = 0;
57 GroundPropagator::GroundPropagator() :
74 INFO(
"\n++++\nReading XML parameters");
88 G4cerr <<
"Error opening file " << filename << G4endl;
91 string strfname( filename );
92 size_t found = strfname.rfind (
".ascii" );
93 if( found != string::npos )
94 strfname = strfname.substr( 0, found) +
"_undergrd" + strfname.substr( found , string::npos);
95 cout <<
"Ascii Underground filename " << strfname << endl;
98 cout <<
"Error opening file: " << strfname << endl;
101 fStatUFile <<
"#Id PartName Energy(MeV) PDGCode Time(ns) TrackId X Y Z Parent\n";
125 fRunManager = tls::Geant4Manager::GetInstance().GetRunManager();
133 oss <<
"/run/verbose " << verbosity;
137 oss <<
"/event/verbose " << verbosity;
141 oss <<
"/tracking/verbose " << verbosity;
145 tls::Geant4Manager::GetInstance().AddVisManager(
fVisManager);
147 INFO(
"using global PhysicsList from Geant4Manager");
150 INFO(
"\n++++\nConstructing G4 ground");
155 INFO(
"\n++++\nInitializing G4 stepping action");
159 INFO(
"\n++++\nInitializing G4 primary generator");
162 tls::Geant4Manager::GetInstance().AddCustomization(custom);
165 INFO(
"using PhysicsList from MdGroundPropagator");
168 INFO(
"\n++++\nConstructing G4 ground");
172 INFO(
"\n++++\nInitializing G4 stepping action");
176 INFO(
"\n++++\nInitializing G4 primary generator");
179 fUImanager->ApplyCommand(
"/physlist/CutsAll 1 mm");
183 oss <<
"/physlist/Physics " << physList;
189 fUImanager->ApplyCommand(
"/vis/open HepRepFile");
190 fUImanager->ApplyCommand(
"/vis/scene/create");
191 fUImanager->ApplyCommand(
"/vis/sceneHandler/attach");
192 fUImanager->ApplyCommand(
"/vis/scene/add/volume");
194 fUImanager->ApplyCommand(
"/vis/scene/notifyHandlers");
195 fUImanager->ApplyCommand(
"/vis/viewer/update");
198 fUImanager->ApplyCommand(
"/tracking/storeTrajectory 1");
199 fUImanager->ApplyCommand(
"/vis/scene/add/trajectories rich");
208 INFO(
"\n++++\nStarting MdGroundPropagator run");
211 ERROR(
"\n++++\nMEvent does not exist.");
216 MEvent& mEvent =
event.GetMEvent();
219 INFO(
"\n++++\nActivating G4 for this run");
223 tls::Geant4Manager::GetInstance().Customize(
"MdGroundPropagator");
228 const MDetector& mDetector = Detector::GetInstance().GetMDetector();
233 if (cIt->HasSimData()) {
237 const int counterId = cIt->GetId();
240 G4cerr << numParticles <<
" particles in Counter Id :" << counterId << G4endl;
243 G4cerr <<
"Id "<< counterId <<
"->inj. part " << numParticles <<
" : " << flush;
289 << pData.
Pname <<
" "
297 << pData.
PParent->GetType() <<
" "
324 tls::Geant4Manager::GetInstance().NotifyDelete();
Branch GetTopBranch() const
boost::indirect_iterator< InternalGrdParticleIterator, utl::Particle & > GrdParticleIterator
int GetNumberOfCounters() const
CounterConstIterator CountersBegin() const
void AddUGrdParticle(const utl::Particle &particle)
void SetPrimaryGenerator(G4VUserPrimaryGeneratorAction *const action)
Report success to RunController.
GrdParticleIterator GrdParticlesBegin()
boost::shared_ptr< utl::Particle > smartPointer
Describes a particle for Simulation.
static mevt::MEvent::CounterIterator fCurrentEventCounterIt
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Local system based on position and configured rotations.
#define INFO(message)
Macro for logging informational messages.
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
void SetImpingingParticle(smartPointer p)
vector< t2list > out
output of the algorithm: a list of clusters
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Detector associated to muon detector hierarchy.
friend class PrimaryGenerator
G4VisManager * fVisManager
SteppingAction * fSteppingAction
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
fwk::VModule::ResultFlag Run(evt::Event &theEvent)
Run: invoked once per event.
Class representing a document branch.
static mevt::CounterSimData::GrdParticleIterator fCurrentParticleIt
vector< PartData >::iterator PartCollectionIt
virtual ~GroundPropagator()
static const mdet::Counter * fCurrentDetectorCounter
G4RunManager * fRunManager
Private G4 members.
Data structure to hold the different Geant4 global objects required to run a single module...
void GetData(bool &b) const
Overloads of the GetData member template function.
Root detector of the muon detector hierarchy.
Counter level simulation data.
ResultFlag
Flag returned by module methods to the RunController.
InternalCounterCollection::ComponentIterator CounterIterator
allow customization of the standard global PhysicsList that are handled by the Geant4Manager ...
Report failure to RunController, causing RunController to terminate execution.
CounterConstIterator CountersEnd() const
void SetParent(Particle &parent)
bool fUseGlobalPhysicsList
const Counter & GetCounter(int id) const
Retrieve Counter by id.
#define ERROR(message)
Macro for logging error messages.
Root of the Muon event hierarchy.
void SetSteppingAction(G4UserSteppingAction *const action)
GrdParticleIterator GrdParticlesEnd()
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
unsigned int GetNumberOfGrdParticles() const