Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B2ActionInitialization.hh 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file B2ActionInitialization.hh
/// \brief Definition of the B2ActionInitialization class
#ifndef B2ActionInitialization_h
#define B2ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
class B4DetectorConstruction;
/// Action initialization class.
///
class B2ActionInitialization : public G4VUserActionInitialization
{
public:
B2ActionInitialization();
virtual ~B2ActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
};
#endif
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B2EventAction.hh 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2EventAction.hh
/// \brief Definition of the B2EventAction class
#ifndef B2EventAction_h
#define B2EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
/// Event action class
class B2EventAction : public G4UserEventAction
{
public:
B2EventAction();
virtual ~B2EventAction();
virtual void BeginOfEventAction(const G4Event* );
virtual void EndOfEventAction(const G4Event* );
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B2PrimaryGeneratorAction.hh 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2PrimaryGeneratorAction.hh
/// \brief Definition of the B2PrimaryGeneratorAction class
#ifndef B2PrimaryGeneratorAction_h
#define B2PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
/// The primary generator action class with particle gum.
///
/// It defines a single particle which hits the Tracker
/// perpendicular to the input face. The type of the particle
/// can be changed via the G4 build-in commands of G4ParticleGun class
/// (see the macros provided with this example).
class B2PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
B2PrimaryGeneratorAction();
virtual ~B2PrimaryGeneratorAction();
virtual void GeneratePrimaries(G4Event* );
G4ParticleGun* GetParticleGun() {return fParticleGun;}
// Set methods
void SetRandomFlag(G4bool );
private:
G4ParticleGun* fParticleGun; // G4 particle gun
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B2RunAction.hh 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2RunAction.hh
/// \brief Definition of the B2RunAction class
#ifndef B2RunAction_h
#define B2RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4Run;
/// Run action class
class B2RunAction : public G4UserRunAction
{
public:
B2RunAction();
virtual ~B2RunAction();
virtual void BeginOfRunAction(const G4Run* run);
virtual void EndOfRunAction(const G4Run* run);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B2TrackerHit.hh 69505 2013-05-07 01:57:27Z asaim $
//
/// \file B2TrackerHit.hh
/// \brief Definition of the B2TrackerHit class
#ifndef B2TrackerHit_h
#define B2TrackerHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "tls.hh"
/// Tracker hit class
///
/// It defines data members to store the trackID, chamberNb, energy deposit,
/// and position of charged particles in a selected volume:
/// - fTrackID, fChamberNB, fEdep, fPos
class B2TrackerHit : public G4VHit
{
public:
B2TrackerHit();
B2TrackerHit(const B2TrackerHit&);
virtual ~B2TrackerHit();
// operators
const B2TrackerHit& operator=(const B2TrackerHit&);
G4int operator==(const B2TrackerHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
// methods from base class
virtual void Draw();
virtual void Print();
// Set methods
void SetTrackID (G4int track) { fTrackID = track; };
void SetChamberNb(G4int chamb) { fChamberNb = chamb; };
void SetEdep (G4double de) { fEdep = de; };
void SetPos (G4ThreeVector xyz){ fPos = xyz; };
// Get methods
G4int GetTrackID() const { return fTrackID; };
G4int GetChamberNb() const { return fChamberNb; };
G4double GetEdep() const { return fEdep; };
G4ThreeVector GetPos() const { return fPos; };
private:
G4int fTrackID;
G4int fChamberNb;
G4double fEdep;
G4ThreeVector fPos;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
typedef G4THitsCollection<B2TrackerHit> B2TrackerHitsCollection;
extern G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void* B2TrackerHit::operator new(size_t)
{
if(!B2TrackerHitAllocator)
B2TrackerHitAllocator = new G4Allocator<B2TrackerHit>;
return (void *) B2TrackerHitAllocator->MallocSingle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void B2TrackerHit::operator delete(void *hit)
{
B2TrackerHitAllocator->FreeSingle((B2TrackerHit*) hit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: B2TrackerSD.hh 66536 2012-12-19 14:32:36Z ihrivnac $
//
/// \file B2TrackerSD.hh
/// \brief Definition of the B2TrackerSD class
#ifndef B2TrackerSD_h
#define B2TrackerSD_h 1
#include "G4VSensitiveDetector.hh"
#include "B2TrackerHit.hh"
#include <vector>
class G4Step;
class G4HCofThisEvent;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// B2Tracker sensitive detector class
///
/// The hits are accounted in hits in ProcessHits() function which is called
/// by Geant4 kernel at each step. A hit is created with each step with non zero
/// energy deposit.
class B2TrackerSD : public G4VSensitiveDetector
{
public:
B2TrackerSD(const G4String& name,
const G4String& hitsCollectionName);
virtual ~B2TrackerSD();
// methods from base class
virtual void Initialize(G4HCofThisEvent* hitCollection);
virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
virtual void EndOfEvent(G4HCofThisEvent* hitCollection);
private:
B2TrackerHitsCollection* fHitsCollection;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file B2bChamberParameterisation.hh
/// \brief Definition of the B2bChamberParameterisation class
#ifndef B2bChamberParameterisation_h
#define B2bChamberParameterisation_h 1
#include "globals.hh"
#include "G4VPVParameterisation.hh"
class G4VPhysicalVolume;
class G4Box;
// Dummy declarations to get rid of warnings ...
class G4Trd;
class G4Trap;
class G4Cons;
class G4Orb;
class G4Sphere;
class G4Ellipsoid;
class G4Torus;
class G4Para;
class G4Hype;
class G4Tubs;
class G4Polycone;
class G4Polyhedra;
/// A parameterisation that describes a series of boxes along Z.
///
/// The boxes have equal width, & their lengths are a linear equation.
/// They are spaced an equal distance apart, starting from given location.
class B2bChamberParameterisation : public G4VPVParameterisation
{
public:
B2bChamberParameterisation(G4int noChambers,
G4double startZ,
G4double spacing,
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal );
virtual ~B2bChamberParameterisation();
void ComputeTransformation (const G4int copyNo,
G4VPhysicalVolume* physVol) const;
void ComputeDimensions (G4Tubs & trackerLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions (G4Box&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Trd&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Trap&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Cons&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Sphere&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Orb&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Ellipsoid&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Torus&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Para&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Hype&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polycone&,const G4int,
const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polyhedra&,const G4int,
const G4VPhysicalVolume*) const {}
private:
G4int fNoChambers;
G4double fStartZ;
G4double fHalfWidth; // The half-width of each tracker chamber
G4double fSpacing; // The distance between the chambers' center
G4double fRmaxFirst; // The first half-length
G4double fRmaxIncr; // The Increment for the half-length
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file B2bDetectorConstruction.hh
/// \brief Definition of the B2bDetectorConstruction class
#ifndef B2bDetectorConstruction_h
#define B2bDetectorConstruction_h 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "tls.hh"
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4Material;
class G4UserLimits;
class G4GlobalMagFieldMessenger;
class B2bDetectorMessenger;
/// Detector construction class to define materials, geometry
/// and global uniform magnetic field.
class B2bDetectorConstruction : public G4VUserDetectorConstruction
{
public:
B2bDetectorConstruction();
virtual ~B2bDetectorConstruction();
public:
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
// Set methods
void SetTargetMaterial (G4String );
void SetChamberMaterial(G4String );
void SetMaxStep (G4double );
void SetCheckOverlaps(G4bool );
private:
// methods
void DefineMaterials();
G4VPhysicalVolume* DefineVolumes();
// data members
G4LogicalVolume* fLogicTarget; // pointer to the logical Target
G4LogicalVolume* fLogicChamber; // pointer to the logical Chamber
G4Material* fTargetMaterial; // pointer to the target material
G4Material* fChamberMaterial; // pointer to the chamber material
G4UserLimits* fStepLimit; // pointer to user step limits
B2bDetectorMessenger* fMessenger; // detector messenger
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
G4bool fCheckOverlaps; // option to activate checking of volumes overlaps
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file B2bDetectorMessenger.hh
/// \brief Definition of the B2bDetectorMessenger class
#ifndef B2bDetectorMessenger_h
#define B2bDetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class B2bDetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/// Messenger class that defines commands for B2bDetectorConstruction.
///
/// It implements commands:
/// - /B2/det/setTargetMaterial name
/// - /B2/det/setChamberMaterial name
/// - /B2/det/stepMax value unit
class B2bDetectorMessenger: public G4UImessenger
{
public:
B2bDetectorMessenger(B2bDetectorConstruction* );
virtual ~B2bDetectorMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
B2bDetectorConstruction* fDetectorConstruction;
G4UIdirectory* fB2Directory;
G4UIdirectory* fDetDirectory;
G4UIcmdWithAString* fTargMatCmd;
G4UIcmdWithAString* fChamMatCmd;
G4UIcmdWithADoubleAndUnit* fStepMaxCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Class description:
//
// This class implements the master model run manager for TBB bases
// application.
// It is instantiated by user main (or equivalent function) instead
// of G4[MT]RunManager. It controls the creation of tbb::tasks.
// See G4MTRunManager for documentation of methods relative to base
// class. Only class specific methods are documented here.
//
// Equivalent in traditional MT:
// G4MTRunManager
//
// History:
// Nov 4th, 2013 A. Dotti - First Implementation
#ifndef TBBMASTERRUNMANAGER_HH
#define TBBMASTERRUNMANAGER_HH
#include "G4MTRunManager.hh"
#include <tbb/task.h>
class tbbMasterRunManager : public G4MTRunManager {
public:
tbbMasterRunManager();
//Default construct, tasklist is the tbb::task_list
//where the created tasks will be added to
//nEvents is the number of events each tbb::task is
//responsible for
virtual ~tbbMasterRunManager();
virtual void RunTermination();
void SetTaskList( tbb::task_list* tl ) { theTasks = tl; }
//Set a reference to the output task list where new tasks will
//be added to
void SetNumberEventsPerTask( G4int nt ) { nEvtsPerTask = nt; }
//Specify number of events that each simulation task is responsible
//for
protected:
virtual void CreateAndStartWorkers();
virtual void TerminateWorkers();
virtual void CreateTask(G4int id,G4int evts);
//Creates a concrete tbb::task with index id
//responsible for evts events
protected:
//Barriers mechanism for TBB is non existing
virtual void WaitForReadyWorkers() {}
virtual void WaitForEndEventLoopWorkers() {}
virtual void ThisWorkerReady() {}
virtual void ThisWorkerEndEventLoop() {}
virtual WorkerActionRequest ThisWorkerWaitForNextAction() { return UNDEFINED; }
virtual void NewActionRequest( WorkerActionRequest /*newRequest*/ ) {}
private:
tbb::task_list* theTasks;
G4int nEvtsPerTask;
};
#endif //TBBMASTERRUNMANAGER_HH
@@ -0,0 +1,48 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef TBBTASK_HH
#define TBBTASK_HH
#include <tbb/task.h>
#include <tbb/concurrent_queue.h>
#include "G4Types.hh"
class G4Run;
class tbbTask : public tbb::task {
public:
tbbTask(G4int anId, tbb::concurrent_queue<const G4Run*>* output=0 , G4int nEvts = 1 );
virtual ~tbbTask();
tbb::task* execute();
private:
G4int nEvents;
G4int thisID;
tbb::concurrent_queue<const G4Run*>* output;
G4bool beamOnCondition;
};
#endif //TBBTASK_HH
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Class Descrition:
// This class implements TBB specific worker initialization.
// It is a sub-class of G4UserWorkerThreadInitialization.
// Its role is to instantiate a tbbWorkerRunManager to be used by
// tbb tasks.
//
// Equivalent in traditional MT:
// G4UserWorkerThreadInitialization
//
// History:
// Oct 31st, 2013 A. Dotti - First Implementation
#ifndef TBBUSERWORKERINITIALIZATION_HH
#define TBBUSERWORKERINITIALIZATION_HH
#include "G4UserWorkerThreadInitialization.hh"
class tbbUserWorkerInitialization : public G4UserWorkerThreadInitialization {
public:
virtual ~tbbUserWorkerInitialization();
virtual G4WorkerRunManager* CreateWorkerRunManager() const;
virtual void JoinWorker(G4Thread*);
virtual G4Thread* CreateAndStartWorker(G4WorkerThread*);
};
#endif //TBBUSERWORKERINITIALIZATION_HH
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Class description:
//
// This class implements the worker model run manager for TBB based
// application.
// It is instantiated by tbbUserWorkerInitialization and used by
// tbbMasterRunManager.
// See G4WorkerRunManager for documentation of methods relative to
// base class. Only class specific methods are documented here.
//
// Equivalent in traditional MT:
// G4WorkerRunManager
//
// History:
// Oct 31st, 2013 A. Dotti - First Implementation
#ifndef TBBWORKERRUNMANAGER_HH
#define TBBWORKERRUNMANAGER_HH
#include "G4WorkerRunManager.hh"
class tbbWorkerRunManager : public G4WorkerRunManager {
public:
tbbWorkerRunManager();
virtual ~tbbWorkerRunManager();
virtual void ConstructScoringWorlds();
virtual void MergePartialResults();
};
#endif