Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -24,8 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "CCalActionInitializer.hh"
|
||||
|
||||
@@ -33,52 +31,23 @@
|
||||
#include "CCalRunAction.hh"
|
||||
#include "CCalPrimaryGeneratorAction.hh"
|
||||
#include "CCalSteppingAction.hh"
|
||||
#include "CCalStackingAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
CCalActionInitializer::CCalActionInitializer() {}
|
||||
|
||||
CCalActionInitializer::CCalActionInitializer()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void CCalActionInitializer::Build() const
|
||||
{
|
||||
////////////////////////////
|
||||
// User action classes. //
|
||||
// -------------------- //
|
||||
////////////////////////////
|
||||
|
||||
//////////////////////////////////
|
||||
// PRIMARY PARTICLEs GENERATION //
|
||||
//////////////////////////////////
|
||||
|
||||
CCalPrimaryGeneratorAction* primaryGenerator =
|
||||
new CCalPrimaryGeneratorAction;
|
||||
SetUserAction(primaryGenerator);
|
||||
|
||||
//////////
|
||||
// STEP //
|
||||
//////////
|
||||
CCalSteppingAction* theSteppingAction =
|
||||
new CCalSteppingAction;
|
||||
SetUserAction(theSteppingAction);
|
||||
|
||||
/////////
|
||||
// RUN //
|
||||
/////////
|
||||
|
||||
SetUserAction(new CCalRunAction);
|
||||
|
||||
///////////
|
||||
// EVENT //
|
||||
///////////
|
||||
SetUserAction(new CCalEventAction(primaryGenerator,theSteppingAction));
|
||||
void CCalActionInitializer::Build() const {
|
||||
CCalPrimaryGeneratorAction* primaryGenerator = new CCalPrimaryGeneratorAction;
|
||||
SetUserAction( primaryGenerator );
|
||||
CCalSteppingAction* theSteppingAction = new CCalSteppingAction;
|
||||
SetUserAction( theSteppingAction );
|
||||
SetUserAction( new CCalRunAction );
|
||||
SetUserAction( new CCalEventAction( primaryGenerator, theSteppingAction ) );
|
||||
SetUserAction( new CCalStackingAction );
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void CCalActionInitializer::BuildForMaster() const
|
||||
{;}
|
||||
|
||||
void CCalActionInitializer::BuildForMaster() const {
|
||||
SetUserAction( new CCalRunAction );
|
||||
}
|
||||
|
||||
@@ -66,10 +66,13 @@
|
||||
#include "G4CashKarpRKF45.hh"
|
||||
#include "G4RKG3_Stepper.hh"
|
||||
|
||||
CCalDetectorConstruction::CCalDetectorConstruction() {}
|
||||
|
||||
CCalDetectorConstruction::CCalDetectorConstruction() : testBeamHCal96( nullptr ) {}
|
||||
|
||||
|
||||
CCalDetectorConstruction::~CCalDetectorConstruction() {}
|
||||
|
||||
|
||||
G4VPhysicalVolume* CCalDetectorConstruction::Construct() {
|
||||
|
||||
/////////
|
||||
@@ -84,6 +87,30 @@ G4VPhysicalVolume* CCalDetectorConstruction::Construct() {
|
||||
#endif
|
||||
CCalRotationMatrixFactory::getInstance("rotation.cms");
|
||||
|
||||
#ifdef debug
|
||||
G4cout << tab << "CCalDetectorConstruction: Starting timer!!!"
|
||||
<< G4endl;
|
||||
G4Timer timer;
|
||||
timer.Start();
|
||||
#endif
|
||||
|
||||
//HCAL Test Beam 96
|
||||
testBeamHCal96 = new CCalG4Hall("HcalTB96");
|
||||
testBeamHCal96->constructHierarchy();
|
||||
#ifdef debug
|
||||
timer.Stop();
|
||||
G4cout << tab << "CCalDetectorConstruction: Total time to "
|
||||
<< "construct the geometry: " << timer << G4endl;
|
||||
#endif //debug
|
||||
G4VPhysicalVolume* volume = testBeamHCal96->PhysicalVolume(0);
|
||||
|
||||
return volume;
|
||||
}
|
||||
|
||||
|
||||
void CCalDetectorConstruction::ConstructSDandField() {
|
||||
// Create global magnetic field messenger.
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Magnetic field
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -138,41 +165,16 @@ G4VPhysicalVolume* CCalDetectorConstruction::Construct() {
|
||||
fieldIsInitialized = true;
|
||||
}
|
||||
|
||||
#ifdef debug
|
||||
G4cout << tab << "CCalDetectorConstruction: Starting timer!!!"
|
||||
<< G4endl;
|
||||
G4Timer timer;
|
||||
timer.Start();
|
||||
#endif
|
||||
|
||||
//HCAL Test Beam 96
|
||||
CCalG4Hall* testBeamHCal96 = new CCalG4Hall("HcalTB96");
|
||||
testBeamHCal96->constructHierarchy();
|
||||
#ifdef debug
|
||||
timer.Stop();
|
||||
G4cout << tab << "CCalDetectorConstruction: Total time to "
|
||||
<< "construct the geometry: " << timer << G4endl;
|
||||
#endif //debug
|
||||
G4VPhysicalVolume* volume = testBeamHCal96->PhysicalVolume(0);
|
||||
|
||||
//Addsenistive detector types
|
||||
//G4bool result;
|
||||
G4int sensitive;
|
||||
sensitive = CCalSensitiveConfiguration::getInstance()->
|
||||
getSensitiveFlag("HadronCalorimeter");
|
||||
if (sensitive>0) /*result =*/ CCalSensAssign::getInstance()->
|
||||
addCaloSD("HadronCalorimeter", new CCalHcalOrganization);
|
||||
sensitive = CCalSensitiveConfiguration::getInstance()->
|
||||
getSensitiveFlag("CrystalMatrixModule");
|
||||
if (sensitive>0) /*result =*/ CCalSensAssign::getInstance()->
|
||||
addCaloSD("CrystalMatrix", new CCalEcalOrganization);
|
||||
|
||||
//Assign the sensitive detectors
|
||||
/*result =*/ CCalSensAssign::getInstance()->assign();
|
||||
|
||||
//Create the stacking manager required by Calorimeter
|
||||
/*result =*/ CCalSensAssign::getInstance()->stackingAction();
|
||||
|
||||
return volume;
|
||||
|
||||
//Add sensitive detector types
|
||||
testBeamHCal96->sensitiveHandling();
|
||||
G4int sensitive = CCalSensitiveConfiguration::getInstance()->getSensitiveFlag("HadronCalorimeter");
|
||||
if ( sensitive > 0 ) {
|
||||
CCalSensAssign::getInstance()->addCaloSD("HadronCalorimeter", new CCalHcalOrganization);
|
||||
}
|
||||
sensitive = CCalSensitiveConfiguration::getInstance()->getSensitiveFlag("CrystalMatrixModule");
|
||||
if ( sensitive > 0 ) {
|
||||
CCalSensAssign::getInstance()->addCaloSD("CrystalMatrix", new CCalEcalOrganization);
|
||||
}
|
||||
// Assign the sensitive detectors
|
||||
CCalSensAssign::getInstance()->assign();
|
||||
}
|
||||
|
||||
@@ -46,26 +46,23 @@
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
|
||||
CCalG4Able::CCalG4Able(G4String name):
|
||||
CCalG4Able::CCalG4Able( G4String name ) :
|
||||
detPhysicalVolume(0), g4ableName(name), sensitivity(false),
|
||||
visProperties(CCalSensitiveConfiguration::getInstance()->getFileName(name)+".vis") {
|
||||
//Initialize g4VisAtt pointers
|
||||
for (G4int i=0; i<CCalVisualisable::TotalVisTypes; ++i) {
|
||||
g4VisAtt[i]=0;
|
||||
}
|
||||
sensitivity =
|
||||
CCalSensitiveConfiguration::getInstance()->getSensitiveFlag(name);
|
||||
for (G4int i=0; i<CCalVisualisable::TotalVisTypes; ++i) g4VisAtt[i]=0;
|
||||
sensitivity = CCalSensitiveConfiguration::getInstance()->getSensitiveFlag(name);
|
||||
}
|
||||
|
||||
|
||||
CCalG4Able::~CCalG4Able() {
|
||||
if (detPhysicalVolume)
|
||||
delete[] detPhysicalVolume;
|
||||
if (detPhysicalVolume) delete[] detPhysicalVolume;
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* CCalG4Able::PhysicalVolume(G4VPhysicalVolume* pv) {
|
||||
//If detPhysicalVolume is not (nil) the volume has already been built
|
||||
//so return it. In other case, construct it and its daughters, then
|
||||
//check for sensitivity and build it if set.
|
||||
|
||||
G4VPhysicalVolume* CCalG4Able::PhysicalVolume( G4VPhysicalVolume* pv ) {
|
||||
//If detPhysicalVolume is not null the volume has already been built
|
||||
//so return it. In other case, construct it and its daughters.
|
||||
#ifdef ddebug
|
||||
G4Timer timer;
|
||||
timer.Start();
|
||||
@@ -76,49 +73,50 @@ G4VPhysicalVolume* CCalG4Able::PhysicalVolume(G4VPhysicalVolume* pv) {
|
||||
for (unsigned int i = 0; i < theG4DetectorsInside.size(); i++) {
|
||||
theG4DetectorsInside[i]->PhysicalVolume(detPhysicalVolume);
|
||||
}
|
||||
if (sensitivity) {
|
||||
#ifdef debug
|
||||
G4cout << "==> Making " << detPhysicalVolume->GetName() << " sensitive..."
|
||||
<< G4endl;
|
||||
#endif
|
||||
constructSensitive();
|
||||
} //if sensitivity
|
||||
} //if sensitive
|
||||
} //if construct
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4cout << "NOTE: You decided to skip the construction of "
|
||||
<< G4Name() << G4endl;
|
||||
G4cout << "NOTE: You decided to skip the construction of " << G4Name() << G4endl;
|
||||
}
|
||||
#ifdef ddebug
|
||||
timer.Stop();
|
||||
G4cout << tab << "CCalG4Able::PhysicalVolume(...) --> time spent: "
|
||||
<< timer << G4endl;
|
||||
G4cout << tab << "CCalG4Able::PhysicalVolume(...) --> time spent: " << timer << G4endl;
|
||||
#endif
|
||||
return detPhysicalVolume;
|
||||
}
|
||||
|
||||
void CCalG4Able::AddCCalG4Able(CCalG4Able* det) {
|
||||
|
||||
void CCalG4Able::sensitiveHandling() {
|
||||
if ( CCalGeometryConfiguration::getInstance()->getConstructFlag( G4Name() ) != 0 &&
|
||||
sensitivity ) {
|
||||
for (unsigned int i = 0; i < theG4DetectorsInside.size(); i++) {
|
||||
#ifdef debug
|
||||
G4cout << "==> Making " << detPhysicalVolume->GetName() << " sensitive..." << G4endl;
|
||||
#endif
|
||||
theG4DetectorsInside[i]->constructSensitive();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCalG4Able::AddCCalG4Able( CCalG4Able* det ) {
|
||||
theG4DetectorsInside.push_back(det);
|
||||
}
|
||||
|
||||
void CCalG4Able::setVisType(CCalVisualisable::visType vt, G4LogicalVolume* log) {
|
||||
|
||||
void CCalG4Able::setVisType( CCalVisualisable::visType vt, G4LogicalVolume* log ) {
|
||||
if (!g4VisAtt[vt]) {
|
||||
#ifdef debug
|
||||
G4cout << "CCalG4Able::setVisType: Constructing G4VisAttributes for "
|
||||
<< log->GetName() << " as " << vt << G4endl;
|
||||
#endif
|
||||
G4Color col(visProperties.colorRed(vt),
|
||||
visProperties.colorGreen(vt),
|
||||
visProperties.colorBlue(vt));
|
||||
G4Color col( visProperties.colorRed(vt), visProperties.colorGreen(vt),
|
||||
visProperties.colorBlue(vt) );
|
||||
G4bool wf = visProperties.isWireFrame(vt);
|
||||
G4bool visible = visProperties.isVisible(vt);
|
||||
|
||||
#ifdef debug
|
||||
G4cout << "Color: "
|
||||
<< visProperties.colorRed(vt) << ", "
|
||||
<< visProperties.colorGreen(vt) << ", "
|
||||
<< visProperties.colorBlue(vt) << tab
|
||||
<< "Wireframe: " << wf << tab
|
||||
G4cout << "Color: " << visProperties.colorRed(vt) << ", " << visProperties.colorGreen(vt)
|
||||
<< ", " << visProperties.colorBlue(vt) << tab << "Wireframe: " << wf << tab
|
||||
<< "Visible: " << visible << G4endl;
|
||||
#endif
|
||||
g4VisAtt[vt] = new G4VisAttributes(col);
|
||||
@@ -129,28 +127,15 @@ void CCalG4Able::setVisType(CCalVisualisable::visType vt, G4LogicalVolume* log)
|
||||
}
|
||||
|
||||
|
||||
|
||||
G4bool CCalG4Able::operator==(const CCalG4Able& right) const {
|
||||
G4bool CCalG4Able::operator==( const CCalG4Able& right ) const {
|
||||
return detPhysicalVolume==right.detPhysicalVolume;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//========================================================================
|
||||
//Protected and private methods.
|
||||
|
||||
//========================================================================
|
||||
//Global operators
|
||||
std::ostream& operator<<(std::ostream& os, const CCalG4Able& det) {
|
||||
if (det.detPhysicalVolume)
|
||||
os << "Physical volume already constructed." << G4endl;
|
||||
else
|
||||
os << "Physical volume still not constructed." << G4endl;
|
||||
|
||||
if (det.isSensitive())
|
||||
os << "and it is Sensitive" << G4endl;
|
||||
else
|
||||
os << "and it is not Sensitive" << G4endl;
|
||||
|
||||
std::ostream& operator<<( std::ostream& os, const CCalG4Able& det ) {
|
||||
if (det.detPhysicalVolume) os << "Physical volume already constructed." << G4endl;
|
||||
else os << "Physical volume still not constructed." << G4endl;
|
||||
if (det.isSensitive()) os << "and it is Sensitive" << G4endl;
|
||||
else os << "and it is not Sensitive" << G4endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -58,23 +58,16 @@ G4LogicalVolume* CCalG4Ecal::crystalmatrixLog = 0;
|
||||
//Initialize static prefix name
|
||||
G4String CCalG4Ecal::idName = "CrystalMatrix";
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// CCalG4Ecal constructor & destructor...
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
CCalG4Ecal::CCalG4Ecal(const G4String &name):
|
||||
CCalEcal(name), CCalG4Able(name), type(module1) {}
|
||||
CCalG4Ecal::CCalG4Ecal(const G4String &name) : CCalEcal(name), CCalG4Able(name), type(module1) {}
|
||||
|
||||
|
||||
CCalG4Ecal::~CCalG4Ecal() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// CCalG4Ecal methods...
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
G4VPhysicalVolume* CCalG4Ecal::constructIn(G4VPhysicalVolume* mother) {
|
||||
G4VPhysicalVolume* CCalG4Ecal::constructIn( G4VPhysicalVolume* mother ) {
|
||||
G4cout << "==>> Constructing CCalG4Ecal..." << G4endl;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Construction of global volume as a Box
|
||||
|
||||
if (!crystalmatrixLog) {
|
||||
@@ -273,8 +266,8 @@ G4LogicalVolume* CCalG4Ecal::constructGlobal() {
|
||||
return glog;
|
||||
}
|
||||
|
||||
void CCalG4Ecal::constructSensitive() {
|
||||
|
||||
void CCalG4Ecal::constructSensitive() {
|
||||
#ifdef debug
|
||||
G4cout << "Now registering CrystalMatrix LogicalVolume's to SD's:" << G4endl;
|
||||
#endif
|
||||
@@ -290,6 +283,4 @@ void CCalG4Ecal::constructSensitive() {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -46,24 +46,17 @@
|
||||
//#define debug
|
||||
//#define pdebug
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// CCalG4Hall constructor & destructor...
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
CCalG4Hall::CCalG4Hall(const G4String &name):
|
||||
CCalHall(name),CCalG4Able(name) {}
|
||||
CCalG4Hall::CCalG4Hall( const G4String &name ) : CCalHall(name), CCalG4Able(name) {}
|
||||
|
||||
|
||||
CCalG4Hall::~CCalG4Hall() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// CCalG4Hall methods...
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
G4VPhysicalVolume* CCalG4Hall::constructIn(G4VPhysicalVolume* mother) {
|
||||
G4VPhysicalVolume* CCalG4Hall::constructIn( G4VPhysicalVolume* mother ) {
|
||||
|
||||
G4cout << "==>> Constructing CCalG4Hall..." << G4endl;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//Pointers to the Rotation Matrices and to the Materials
|
||||
CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance();
|
||||
|
||||
@@ -98,7 +91,8 @@ G4VPhysicalVolume* CCalG4Hall::constructIn(G4VPhysicalVolume* mother) {
|
||||
return volume;
|
||||
}
|
||||
|
||||
void CCalG4Hall::constructDaughters(){
|
||||
|
||||
void CCalG4Hall::constructDaughters() {
|
||||
//Hadron Calorimeter
|
||||
CCalG4Hcal* hcal = new CCalG4Hcal("HadronCalorimeter");
|
||||
addDetector(hcal);
|
||||
@@ -110,3 +104,6 @@ void CCalG4Hall::constructDaughters(){
|
||||
addDetector(ecal);
|
||||
AddCCalG4Able(ecal);
|
||||
}
|
||||
|
||||
|
||||
void CCalG4Hall::constructSensitive() {}
|
||||
|
||||
@@ -50,25 +50,21 @@
|
||||
//#define pdebug
|
||||
//#define sdebug
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// CCalG4Hcal constructor & destructor...
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
CCalG4Hcal::CCalG4Hcal(const G4String &name):
|
||||
CCalHcal(name), CCalG4Able(name), sclLog(0), absLog(0) {}
|
||||
CCalG4Hcal::CCalG4Hcal( const G4String &name ) :
|
||||
CCalHcal(name), CCalG4Able(name), sclLog(0), absLog(0)
|
||||
{}
|
||||
|
||||
CCalG4Hcal::~CCalG4Hcal(){
|
||||
|
||||
CCalG4Hcal::~CCalG4Hcal() {
|
||||
if (sclLog)
|
||||
delete[] sclLog;
|
||||
if (absLog)
|
||||
delete[] absLog;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// CCalG4Hcal methods...
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
G4VPhysicalVolume* CCalG4Hcal::constructIn(G4VPhysicalVolume* mother) {
|
||||
G4VPhysicalVolume* CCalG4Hcal::constructIn( G4VPhysicalVolume* mother ) {
|
||||
G4cout << "==>> Constructing CCalG4Hcal..." << G4endl;
|
||||
|
||||
//Common logical volumes between methods.
|
||||
@@ -208,7 +204,7 @@ G4VPhysicalVolume* CCalG4Hcal::constructIn(G4VPhysicalVolume* mother) {
|
||||
}
|
||||
|
||||
|
||||
G4LogicalVolume* CCalG4Hcal::constructScintillatorLayer(G4int lay) {
|
||||
G4LogicalVolume* CCalG4Hcal::constructScintillatorLayer( G4int lay ) {
|
||||
|
||||
//Pointers to the Materials
|
||||
CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance();
|
||||
@@ -317,16 +313,13 @@ G4LogicalVolume* CCalG4Hcal::constructScintillatorLayer(G4int lay) {
|
||||
}
|
||||
|
||||
|
||||
G4LogicalVolume* CCalG4Hcal::constructAbsorberLayer(G4int lay) {
|
||||
|
||||
G4LogicalVolume* CCalG4Hcal::constructAbsorberLayer( G4int lay ) {
|
||||
//Pointers to the Materials
|
||||
CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance();
|
||||
|
||||
CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance();
|
||||
//Now the absorber layer
|
||||
G4Material* matter = matfact->findMaterial(getAbsMat());
|
||||
G4String name = Name() + "Absorber" + lay;
|
||||
G4VSolid* solid = new G4Box (name, getDx_2Abs(lay)*mm, getDy_2Abs()*mm,
|
||||
getDy_2Abs()*mm);
|
||||
G4VSolid* solid = new G4Box (name, getDx_2Abs(lay)*mm, getDy_2Abs()*mm, getDy_2Abs()*mm);
|
||||
G4LogicalVolume* log = new G4LogicalVolume(solid, matter, name);
|
||||
setVisType(CCalVisualisable::Absorber,log);
|
||||
#ifdef debug
|
||||
@@ -334,13 +327,14 @@ G4LogicalVolume* CCalG4Hcal::constructAbsorberLayer(G4int lay) {
|
||||
<< getDx_2Abs(lay)*mm << " " << getDy_2Abs()*mm << " "
|
||||
<< getDy_2Abs()*mm << G4endl;
|
||||
#endif
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
|
||||
void CCalG4Hcal::constructSensitive(){
|
||||
void CCalG4Hcal::constructDaughters() {}
|
||||
|
||||
|
||||
void CCalG4Hcal::constructSensitive() {
|
||||
if (allSensitiveLogs.size()>0) {
|
||||
CCalSensitiveDetectors* sensDets = CCalSensitiveDetectors::getInstance();
|
||||
G4String SDname = Name();
|
||||
@@ -358,4 +352,3 @@ void CCalG4Hcal::constructSensitive(){
|
||||
}
|
||||
}
|
||||
|
||||
void CCalG4Hcal::constructDaughters() {}
|
||||
|
||||
@@ -35,46 +35,64 @@
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "CCalAnalysis.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
|
||||
CCalRunAction::CCalRunAction()
|
||||
{
|
||||
numberOfTimeSlices = 200;
|
||||
Book();
|
||||
}
|
||||
|
||||
|
||||
CCalRunAction::~CCalRunAction()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
|
||||
void CCalRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
numberOfTimeSlices = 200;
|
||||
|
||||
if (aRun->GetRunID() == 0) //first run
|
||||
Book();
|
||||
|
||||
G4AnalysisManager* analysis = G4AnalysisManager::Instance();
|
||||
|
||||
//cleanup
|
||||
G4int timeHist = analysis->GetH1Id("h300");
|
||||
for (G4int i=0; i<numberOfTimeSlices; ++i) {
|
||||
analysis->GetH1(timeHist+i)->reset();
|
||||
}
|
||||
|
||||
// Open an output file
|
||||
analysis->OpenFile("ccal");
|
||||
G4cout << "********************************************" << G4endl
|
||||
<< "* o/p file ccal" << G4endl
|
||||
<< "********************************************" << G4endl
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
|
||||
void CCalRunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " end." << G4endl;
|
||||
|
||||
// Close-out analysis: save histograms and ntuple
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
}
|
||||
|
||||
|
||||
void CCalRunAction::Book()
|
||||
{
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetFirstHistoId(1);
|
||||
analysisManager->SetFirstNtupleId(1);
|
||||
|
||||
// Open an output file
|
||||
analysisManager->OpenFile("ccal");
|
||||
G4cout << "********************************************" << G4endl
|
||||
<< "* o/p file ccal" << G4endl
|
||||
<< "********************************************" << G4endl
|
||||
<< G4endl;
|
||||
|
||||
|
||||
// Create a tuple :
|
||||
|
||||
// Note: merging ntuples is available only with Root output
|
||||
if ( G4Threading::IsMultithreadedApplication() ) analysisManager->SetNtupleMerging(true);
|
||||
|
||||
// Create ntuple
|
||||
analysisManager->CreateNtuple("ntuple1", "Event info");
|
||||
for (G4int i=0;i<28;++i) {
|
||||
|
||||
@@ -29,30 +29,35 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include "CCalSDList.hh"
|
||||
|
||||
CCalSDList* CCalSDList::theList = 0;
|
||||
G4ThreadLocal CCalSDList* CCalSDList::theList = nullptr;
|
||||
|
||||
CCalSDList::CCalSDList(){}
|
||||
CCalSDList::~CCalSDList(){ delete theList;}
|
||||
|
||||
CCalSDList* CCalSDList::getInstance(){
|
||||
CCalSDList::CCalSDList() {}
|
||||
|
||||
if (theList == 0)
|
||||
theList = new CCalSDList;
|
||||
|
||||
CCalSDList::~CCalSDList() {}
|
||||
|
||||
|
||||
CCalSDList* CCalSDList::getInstance() {
|
||||
if ( theList == nullptr ) {
|
||||
static G4ThreadLocalSingleton< CCalSDList > inst;
|
||||
theList = inst.Instance();
|
||||
}
|
||||
return theList;
|
||||
}
|
||||
|
||||
void CCalSDList::addCalo(nameType name){
|
||||
|
||||
|
||||
|
||||
void CCalSDList::addCalo( nameType name ) {
|
||||
theList->caloSD.push_back(name);
|
||||
}
|
||||
|
||||
void CCalSDList::addTracker(nameType name){
|
||||
|
||||
void CCalSDList::addTracker( nameType name ) {
|
||||
theList->trackerSD.push_back(name);
|
||||
}
|
||||
|
||||
nameType CCalSDList::getCaloSDName(G4int i){
|
||||
|
||||
|
||||
nameType CCalSDList::getCaloSDName( G4int i ) {
|
||||
if (i>=theList->getNumberOfCaloSD() || i<0) {
|
||||
G4cout << "CCalSDList invalid calo SD no: " << i << " max is "
|
||||
<< theList->getNumberOfCaloSD() << G4endl;
|
||||
@@ -61,30 +66,28 @@ nameType CCalSDList::getCaloSDName(G4int i){
|
||||
return theList->caloSD[i];
|
||||
}
|
||||
|
||||
nameType CCalSDList::getTrackerSDName(G4int i){
|
||||
|
||||
nameType CCalSDList::getTrackerSDName( G4int i ) {
|
||||
if (i>=theList->getNumberOfTrackerSD() || i<0) {
|
||||
G4cout << "CCalSDList invalid tracker SD no: " << i << " max is "
|
||||
<< theList->getNumberOfTrackerSD() << G4endl;
|
||||
return " ";
|
||||
}
|
||||
else
|
||||
} else {
|
||||
return theList->trackerSD[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
G4int CCalSDList::getNumberOfCaloSD(){
|
||||
|
||||
G4int CCalSDList::getNumberOfCaloSD() {
|
||||
return theList->caloSD.size();
|
||||
}
|
||||
|
||||
G4int CCalSDList::getNumberOfTrackerSD(){
|
||||
|
||||
G4int CCalSDList::getNumberOfTrackerSD() {
|
||||
return theList->trackerSD.size();
|
||||
}
|
||||
|
||||
|
||||
CCalSDList& CCalSDList::operator=(CCalSDList&){
|
||||
|
||||
CCalSDList& CCalSDList::operator=( CCalSDList& ) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -28,21 +28,22 @@
|
||||
// Description: CCalSenAssign creates and assigns the sensitive detetctors
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include "CCalSensAssign.hh"
|
||||
#include "CCalStackingAction.hh"
|
||||
#include "CCalSensitiveDetectors.hh"
|
||||
#include "CCaloSD.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
//#define debug
|
||||
|
||||
CCalSensAssign* CCalSensAssign::theInstance = 0;
|
||||
G4ThreadLocal CCalSensAssign* CCalSensAssign::theInstance = nullptr;
|
||||
|
||||
|
||||
CCalSensAssign* CCalSensAssign::getInstance() {
|
||||
if (!theInstance) theInstance = new CCalSensAssign;
|
||||
return theInstance;
|
||||
if ( theInstance == nullptr ) {
|
||||
static G4ThreadLocalSingleton< CCalSensAssign > inst;
|
||||
theInstance = inst.Instance();
|
||||
}
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +52,6 @@ CCalSensAssign::CCalSensAssign() {}
|
||||
|
||||
G4bool CCalSensAssign::assign() {
|
||||
G4bool result = false;
|
||||
|
||||
CCalSensitiveDetectors* sensDets = CCalSensitiveDetectors::getInstance();
|
||||
for (std::map<G4String,G4VSensitiveDetector*>::const_iterator sens_it = sens_.begin();
|
||||
sens_it!=sens_.end(); ++sens_it) {
|
||||
@@ -60,34 +60,15 @@ G4bool CCalSensAssign::assign() {
|
||||
if (sensDets->setSensitive(name, sens)) {
|
||||
G4SDManager::GetSDMpointer()->AddNewDetector(sens);
|
||||
#ifdef debug
|
||||
G4cout << "Add " << sens->GetName()
|
||||
<< " to the list of Sensitive detetctors" << G4endl;
|
||||
G4cout << "Add " << sens->GetName() << " to the list of Sensitive detectors" << G4endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
G4bool CCalSensAssign::stackingAction() {
|
||||
|
||||
G4bool result = false;
|
||||
//Create the stacking manager required by Calorimeter
|
||||
if (G4RunManager::GetRunManager()->GetUserStackingAction() == 0) {
|
||||
G4cout << "***CCalSensAssign creating a CCalStackingAction ***" << G4endl;
|
||||
G4RunManager::GetRunManager()->SetUserAction(new CCalStackingAction);
|
||||
result = true;
|
||||
} else {
|
||||
G4cout << "***CCalSens: a StackingAction already exists. "
|
||||
<< "Maybe not the one CCaloSD needs?" << G4endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
G4bool CCalSensAssign::addCaloSD(G4String name,
|
||||
CCalVOrganization* numberingScheme) {
|
||||
sens_[name] = new CCaloSD(name, numberingScheme);
|
||||
G4bool CCalSensAssign::addCaloSD( G4String name, CCalVOrganization* numberingScheme ) {
|
||||
sens_[name] = new CCaloSD(name, numberingScheme);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -32,29 +32,29 @@
|
||||
|
||||
//#define debug
|
||||
|
||||
CCalSensitiveDetectors* CCalSensitiveDetectors::theInstance = 0;
|
||||
G4ThreadLocal CCalSensitiveDetectors* CCalSensitiveDetectors::theInstance = nullptr;
|
||||
|
||||
|
||||
CCalSensitiveDetectors* CCalSensitiveDetectors::getInstance()
|
||||
{
|
||||
if (!theInstance) theInstance = new CCalSensitiveDetectors;
|
||||
return theInstance;
|
||||
CCalSensitiveDetectors* CCalSensitiveDetectors::getInstance() {
|
||||
if ( theInstance == nullptr ) {
|
||||
static G4ThreadLocalSingleton< CCalSensitiveDetectors > inst;
|
||||
theInstance = inst.Instance();
|
||||
}
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
|
||||
void CCalSensitiveDetectors::registerVolume (const G4String& string,
|
||||
G4LogicalVolume* logv)
|
||||
{
|
||||
void CCalSensitiveDetectors::registerVolume( const G4String& string, G4LogicalVolume* logv ) {
|
||||
theLVs.insert(mmslv::value_type(string, logv));
|
||||
#ifdef debug
|
||||
G4cout << "CCalSensitiveDetectors : Register " << logv->GetName()
|
||||
<< " in category " << string << G4endl;
|
||||
G4cout << "CCalSensitiveDetectors : Register " << logv->GetName()
|
||||
<< " in category " << string << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
std::vector<G4LogicalVolume*>
|
||||
CCalSensitiveDetectors::getVolumes (const G4String& string, G4bool exist)
|
||||
{
|
||||
CCalSensitiveDetectors::getVolumes( const G4String& string, G4bool exist ) {
|
||||
mmslv::const_iterator mmscite;
|
||||
std::pair<mmslv::iterator, mmslv::iterator> mmsdi;
|
||||
mmsdi = theLVs.equal_range(string);
|
||||
@@ -62,17 +62,13 @@ CCalSensitiveDetectors::getVolumes (const G4String& string, G4bool exist)
|
||||
for (mmscite = mmsdi.first; mmscite != mmsdi.second; mmscite++ ) {
|
||||
lvs.push_back(const_cast<G4LogicalVolume*>((*mmscite).second));
|
||||
}
|
||||
|
||||
if (exist) G4cout << "CCalSensitiveDetector : " << lvs.size()
|
||||
<< " detectors for " << string << G4endl;
|
||||
|
||||
if (exist) G4cout << "CCalSensitiveDetector : " << lvs.size()
|
||||
<< " detectors for " << string << G4endl;
|
||||
return lvs;
|
||||
}
|
||||
|
||||
|
||||
G4bool CCalSensitiveDetectors::setSensitive(const G4String& string,
|
||||
G4VSensitiveDetector* sens)
|
||||
{
|
||||
G4bool CCalSensitiveDetectors::setSensitive( const G4String& string, G4VSensitiveDetector* sens ) {
|
||||
G4bool result=false;
|
||||
mmslv::const_iterator mmscite;
|
||||
std::pair<mmslv::iterator, mmslv::iterator> mmsdi;
|
||||
@@ -82,8 +78,7 @@ G4bool CCalSensitiveDetectors::setSensitive(const G4String& string,
|
||||
lv ->SetSensitiveDetector(sens);
|
||||
result = true;
|
||||
#ifdef debug
|
||||
G4cout << " Associate SD " << sens->GetName() << " to " << lv->GetName()
|
||||
<< G4endl;
|
||||
G4cout << " Associate SD " << sens->GetName() << " to " << lv->GetName() << G4endl;
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user