Skip to content
Snippets Groups Projects
Commit 0d0a4798 authored by Dave Casper's avatar Dave Casper
Browse files

Simulation, persistence and display of Tracker hits

parent 738b7704
No related branches found
No related tags found
No related merge requests found
Showing
with 501 additions and 20 deletions
...@@ -13,9 +13,9 @@ atlas_depends_on_subdirs( PUBLIC ...@@ -13,9 +13,9 @@ atlas_depends_on_subdirs( PUBLIC
Scintillator/ScintDetDescr/ScintIdentifier Scintillator/ScintDetDescr/ScintIdentifier
Scintillator/ScintDetDescr/ScintReadoutGeometry Scintillator/ScintDetDescr/ScintReadoutGeometry
Scintillator/ScintSimEvent Scintillator/ScintSimEvent
# InnerDetector/InDetDetDescr/InDetIdentifier Tracker/TrackerDetDescr/TrackerIdentifier
# InnerDetector/InDetDetDescr/InDetReadoutGeometry Tracker/TrackerDetDescr/TrackerReadoutGeometry
# InnerDetector/InDetSimEvent Tracker/TrackerSimEvent
) )
# External dependencies: # External dependencies:
...@@ -27,5 +27,5 @@ atlas_add_library( GeoAdaptors ...@@ -27,5 +27,5 @@ atlas_add_library( GeoAdaptors
PUBLIC_HEADERS GeoAdaptors PUBLIC_HEADERS GeoAdaptors
INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
DEFINITIONS ${CLHEP_DEFINITIONS} DEFINITIONS ${CLHEP_DEFINITIONS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} Identifier ScintIdentifier ScintReadoutGeometry ScintSimEvent StoreGateLib SGtests ) LINK_LIBRARIES ${CLHEP_LIBRARIES} Identifier ScintIdentifier ScintReadoutGeometry ScintSimEvent TrackerIdentifier TrackerReadoutGeometry TrackerSimEvent StoreGateLib SGtests )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef GEOADAPTORS_GEOFASERSIHIT_h
#define GEOADAPTORS_GEOFASERSIHIT_h
//----------------------------------------------------------//
// //
// An adaptor for SiHits. //
// //
// Joe Boudreau Feb 04. //
// //
// This adaptor class allows SiHits to behave //
// as if they knew which detector they were in. //
// //
// //
//----------------------------------------------------------//
#include "CLHEP/Geometry/Point3D.h"
class FaserSiHit;
class FaserSCT_ID;
namespace TrackerDD {
class SCT_DetectorManager;
}
class GeoFaserSiHit {
public:
// Constructor:
GeoFaserSiHit(const FaserSiHit & h);
// Get the absolute global position:
HepGeom::Point3D<double> getGlobalPosition() const;
// Underlying hit.
const FaserSiHit &data() const { return *m_hit;}
// Is this hit ok?
operator bool () const { return s_sct; }
private:
static void init();
const FaserSiHit *m_hit;
static const TrackerDD::SCT_DetectorManager *s_sct;
static const FaserSCT_ID *s_sID;
};
#include "GeoAdaptors/GeoFaserSiHit.icc"
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "TrackerSimEvent/FaserSiHit.h"
#include "TrackerReadoutGeometry/SiDetectorElement.h"
#include "TrackerReadoutGeometry/SCT_DetectorManager.h"
#include "StoreGate/StoreGateSvc.h"
#include "StoreGate/StoreGate.h"
#include "TrackerIdentifier/FaserSCT_ID.h"
#include "GeoPrimitives/CLHEPtoEigenConverter.h"
inline void GeoFaserSiHit::init() {
StoreGateSvc *detStore = StoreGate::pointer("DetectorStore");
if(detStore->retrieve(s_sct,"SCT").isFailure())
s_sct = 0;
if(detStore->retrieve(s_sID,"FaserSCT_ID").isFailure())
s_sID = 0;
}
inline GeoFaserSiHit::GeoFaserSiHit (const FaserSiHit & h) {
m_hit = &h;
if (!s_sct) init();
}
inline HepGeom::Point3D<double> GeoFaserSiHit::getGlobalPosition() const {
Identifier id;
const TrackerDD::SiDetectorElement *geoelement=NULL;
id = s_sID->wafer_id(m_hit->getStation(),
m_hit->getPlane(),
m_hit->getRow(),
m_hit->getModule(),
m_hit->getSensor() );
geoelement = s_sct->getDetectorElement(id);
if (geoelement) {
const HepGeom::Point3D<double> globalStartPos = Amg::EigenTransformToCLHEP(geoelement->transformHit()) * HepGeom::Point3D<double>(m_hit->localStartPosition());
double x=globalStartPos.x();
double y=globalStartPos.y();
double z=globalStartPos.z();
return HepGeom::Point3D<double>(x,y,z);
}
return HepGeom::Point3D<double>(0.0,0.0,0.0);
}
...@@ -3,11 +3,14 @@ ...@@ -3,11 +3,14 @@
*/ */
#include "GeoAdaptors/GeoScintHit.h" #include "GeoAdaptors/GeoScintHit.h"
#include "GeoAdaptors/GeoFaserSiHit.h"
const ScintDD::VetoDetectorManager *GeoScintHit::s_veto = 0; const ScintDD::VetoDetectorManager *GeoScintHit::s_veto = 0;
const ScintDD::TriggerDetectorManager *GeoScintHit::s_trigger = 0; const ScintDD::TriggerDetectorManager *GeoScintHit::s_trigger = 0;
const ScintDD::PreshowerDetectorManager *GeoScintHit::s_preshower = 0; const ScintDD::PreshowerDetectorManager *GeoScintHit::s_preshower = 0;
const TrackerDD::SCT_DetectorManager *GeoFaserSiHit::s_sct;
const VetoID *GeoScintHit::s_vID = 0; const VetoID *GeoScintHit::s_vID = 0;
const TriggerID *GeoScintHit::s_tID = 0; const TriggerID *GeoScintHit::s_tID = 0;
const PreshowerID *GeoScintHit::s_pID = 0; const PreshowerID *GeoScintHit::s_pID = 0;
const FaserSCT_ID *GeoFaserSiHit::s_sID = 0;
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef SCINTHITCOLLECTIONCNV_P1_H #ifndef SCINTHITCOLLECTIONCNV_P1_H
#define SCINTHITCOLLECTIONCNV_P1_H #define SCINTHITCOLLECTIONCNV_P1_H
// SiHitCollectionCnv_p1, T/P separation of Scint Hits // ScintHitCollectionCnv_p1, T/P separation of Scint Hits
// author D.Costanzo <davide.costanzo@cern.ch> // author D.Costanzo <davide.costanzo@cern.ch>
// author O.Arnaez <olivier.arnaez@cern.ch> // author O.Arnaez <olivier.arnaez@cern.ch>
......
...@@ -22,6 +22,7 @@ if __name__ == "__main__": ...@@ -22,6 +22,7 @@ if __name__ == "__main__":
from G4AtlasTools.G4AtlasToolsConf import SensitiveDetectorMasterTool from G4AtlasTools.G4AtlasToolsConf import SensitiveDetectorMasterTool
from G4FaserTools.G4FaserToolsConfig import generateSensitiveDetectorList from G4FaserTools.G4FaserToolsConfig import generateSensitiveDetectorList
from VetoG4_SD.VetoG4_SDToolConfig import VetoSensorSDCfg from VetoG4_SD.VetoG4_SDToolConfig import VetoSensorSDCfg
from FaserSCT_G4_SD.FaserSCT_G4_SDToolConfig import SctSensorSDCfg
# #
# Set up logging and new style config # Set up logging and new style config
# #
...@@ -85,8 +86,8 @@ if __name__ == "__main__": ...@@ -85,8 +86,8 @@ if __name__ == "__main__":
pg.McEventKey = "GEN_EVENT" pg.McEventKey = "GEN_EVENT"
pg.randomSeed = 123456 pg.randomSeed = 123456
pg.sampler.pid = -13 pg.sampler.pid = -13
pg.sampler.mom = PG.EThetaMPhiSampler(energy=1*TeV, theta=[0, pi/10], phi=[0, 2*pi], mass=105.71) pg.sampler.mom = PG.EThetaMPhiSampler(energy=1*TeV, theta=[0, pi/20], phi=[0, 2*pi], mass=105.71)
pg.sampler.pos = PG.PosSampler(x=[-10, 10], y=[-10, 10], z=-2100.0, t=0.0) pg.sampler.pos = PG.PosSampler(x=[-5, 5], y=[-5, 5], z=-2100.0, t=0.0)
acc.addEventAlgo(pg, "AthBeginSeq") # to run *before* G4 acc.addEventAlgo(pg, "AthBeginSeq") # to run *before* G4
# #
# Only one of these two should be used in a given job # Only one of these two should be used in a given job
...@@ -103,7 +104,8 @@ if __name__ == "__main__": ...@@ -103,7 +104,8 @@ if __name__ == "__main__":
["EventInfo#*", ["EventInfo#*",
"McEventCollection#TruthEvent", "McEventCollection#TruthEvent",
"McEventCollection#GEN_EVENT", "McEventCollection#GEN_EVENT",
"ScintHitCollection#*" "ScintHitCollection#*",
"FaserSiHitCollection#*"
])) ]))
acc.getEventAlgo("OutputStreamHITS").AcceptAlgs = ["G4FaserAlg"] # optional acc.getEventAlgo("OutputStreamHITS").AcceptAlgs = ["G4FaserAlg"] # optional
acc.getEventAlgo("OutputStreamHITS").WritingTool.ProcessingTag = "StreamHITS" # required acc.getEventAlgo("OutputStreamHITS").WritingTool.ProcessingTag = "StreamHITS" # required
...@@ -114,10 +116,12 @@ if __name__ == "__main__": ...@@ -114,10 +116,12 @@ if __name__ == "__main__":
acc.merge(G4FaserAlgCfg(ConfigFlags)) acc.merge(G4FaserAlgCfg(ConfigFlags))
algo = acc.getEventAlgo("G4FaserAlg") algo = acc.getEventAlgo("G4FaserAlg")
veto, vetosd = VetoSensorSDCfg(ConfigFlags) veto, vetosd = VetoSensorSDCfg(ConfigFlags)
sendet = SensitiveDetectorMasterTool(SensitiveDetectors = [vetosd]) sct, sctsd = SctSensorSDCfg(ConfigFlags)
sendet = SensitiveDetectorMasterTool(SensitiveDetectors = [vetosd,sctsd])
acc.addPublicTool(sendet) acc.addPublicTool(sendet)
algo.SenDetMasterTool = sendet algo.SenDetMasterTool = sendet
acc.merge(veto) acc.merge(veto)
acc.merge(sct)
acc.addService(G4GeometryNotifierSvcCfg(ConfigFlags, ActivateLVNotifier=True)) acc.addService(G4GeometryNotifierSvcCfg(ConfigFlags, ActivateLVNotifier=True))
# #
# Verbosity # Verbosity
......
...@@ -81,9 +81,10 @@ def generateScintillatorSensitiveDetectorList(): ...@@ -81,9 +81,10 @@ def generateScintillatorSensitiveDetectorList():
def generateTrackerSensitiveDetectorList(): def generateTrackerSensitiveDetectorList():
SensitiveDetectorList=[] SensitiveDetectorList=[]
# from CalypsoConfiguration.AllFlags import ConfigFlags from CalypsoConfiguration.AllFlags import ConfigFlags
# if (ConfigFlags.Detector.SimulateTracker): if (ConfigFlags.Detector.SimulateTracker):
# SensitiveDetectorList += [ 'SctSensorSD' ] if (ConfigFlags.Detector.SimulateFaserSCT):
SensitiveDetectorList += [ 'SctSensorSD' ]
return SensitiveDetectorList return SensitiveDetectorList
def generateFaserCaloSensitiveDetectorList(): def generateFaserCaloSensitiveDetectorList():
......
...@@ -54,12 +54,8 @@ SCT_Barrel::getParameters() ...@@ -54,12 +54,8 @@ SCT_Barrel::getParameters()
m_numLayers = parameters->numLayers(); m_numLayers = parameters->numLayers();
m_layerPitch = parameters->layerPitch(); m_layerPitch = parameters->layerPitch();
std::cout << "Retrieved parameters: " << m_numLayers << " "<< m_layerPitch << std::endl;
// Set numerology
std::cout << "Setting num layers" << std::endl;
// Set numerology // Set numerology
m_detectorManager->numerology().setNumLayers(m_numLayers); m_detectorManager->numerology().setNumLayers(m_numLayers);
std::cout << "Setting modules per layer" << std::endl;
for (int i = 0; i < m_numLayers; i++) for (int i = 0; i < m_numLayers; i++)
{ {
m_detectorManager->numerology().setNumEtaModulesForLayer(i, 2); m_detectorManager->numerology().setNumEtaModulesForLayer(i, 2);
...@@ -70,7 +66,6 @@ SCT_Barrel::getParameters() ...@@ -70,7 +66,6 @@ SCT_Barrel::getParameters()
const GeoLogVol * const GeoLogVol *
SCT_Barrel::preBuild() SCT_Barrel::preBuild()
{ {
std::cout << "Instantiating Plane" << std::endl;
m_plane = new SCT_Plane("Plane", m_detectorManager, m_geometryManager, m_materials); m_plane = new SCT_Plane("Plane", m_detectorManager, m_geometryManager, m_materials);
m_width = m_plane->width() + m_safety; m_width = m_plane->width() + m_safety;
m_height = m_plane->height() + m_safety; m_height = m_plane->height() + m_safety;
......
...@@ -61,9 +61,7 @@ SCT_HalfPlane::getParameters() ...@@ -61,9 +61,7 @@ SCT_HalfPlane::getParameters()
const GeoLogVol * const GeoLogVol *
SCT_HalfPlane::preBuild() SCT_HalfPlane::preBuild()
{ {
std::cout << "Instantiating Module" << std::endl;
m_module = new SCT_Module("Module", m_detectorManager, m_geometryManager, m_materials); m_module = new SCT_Module("Module", m_detectorManager, m_geometryManager, m_materials);
std::cout << "Module created" << std::endl;
// //
// Active Layer Envelope extent // Active Layer Envelope extent
// Envelope for the active part (ie containing all the skis for the layer) // Envelope for the active part (ie containing all the skis for the layer)
......
...@@ -64,7 +64,6 @@ SCT_Plane::getParameters() ...@@ -64,7 +64,6 @@ SCT_Plane::getParameters()
const GeoLogVol * const GeoLogVol *
SCT_Plane::preBuild() SCT_Plane::preBuild()
{ {
std::cout << "Instantiating Half Plane" << std::endl;
m_halfPlane = new SCT_HalfPlane("HalfPlane", m_detectorManager, m_geometryManager, m_materials); m_halfPlane = new SCT_HalfPlane("HalfPlane", m_detectorManager, m_geometryManager, m_materials);
// //
// Active Layer Envelope extent // Active Layer Envelope extent
......
################################################################################
# Package: FaserSCT_G4_SD
################################################################################
# Declare the package name:
atlas_subdir( FaserSCT_G4_SD )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PRIVATE
Control/StoreGate
GaudiKernel
Tracker/TrackerSimEvent
Simulation/G4Atlas/G4AtlasTools
Simulation/G4Sim/MCTruth
)
# External dependencies:
find_package( CLHEP )
find_package( Geant4 )
find_package( XercesC )
# Component(s) in the package:
atlas_add_component( FaserSCT_G4_SD
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib SGtests GaudiKernel TrackerSimEvent G4AtlasToolsLib MCTruth )
atlas_add_test( FaserSCT_G4_SDToolConfig_test
SCRIPT test/FaserSCT_G4_SDToolConfig_test.py
PROPERTIES TIMEOUT 300 )
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_scripts( test/*.py )
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from AthenaCommon import CfgMgr
from G4AtlasApps.SimFlags import simFlags
from ISF_Algorithms.collection_merger_helpers import generate_mergeable_collection_name
def getSctSensorSD(name="SctSensorSD", **kwargs):
bare_collection_name = "SCT_Hits"
mergeable_collection_suffix = "_G4"
merger_input_property = "SCTHits"
hits_collection_name = generate_mergeable_collection_name(bare_collection_name,
mergeable_collection_suffix,
merger_input_property)
kwargs.setdefault("LogicalVolumeNames", ["SCT::BRLSensor"])
kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
return CfgMgr.FaserSctSensorSDTool(name, **kwargs)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.CfgGetter import addTool
addTool("FaserSCT_G4_SD.FaserSCT_G4_SDConfig.getSctSensorSD" , "SctSensorSD" )
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from ISF_Algorithms.collection_merger_helpersNew import CollectionMergerCfg
# from VetoG4_SD.VetoG4_SDConf import VetoSensorSDTool
from FaserSCT_G4_SD.FaserSCT_G4_SDConfig import getSctSensorSD
def SctSensorSDCfg(ConfigFlags, name="SctSensorSD", **kwargs):
result = ComponentAccumulator()
bare_collection_name = "SCT_Hits"
mergeable_collection_suffix = "_G4"
merger_input_property = "SCTHits"
acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name, mergeable_collection_suffix, merger_input_property)
kwargs.setdefault("LogicalVolumeNames", ["SCT::BRLSensor"])
kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
result.merge(acc)
return result, getSctSensorSD(name, **kwargs)
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
//
// SCT Sensitive Detector.
// The Hits are processed here. For every hit I get the position and
// an information on the sensor in which the interaction happened
//
// class headers
#include "FaserSctSensorSD.h"
// athena includes
#include "MCTruth/TrackHelper.h"
// Geant4 includes
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4Geantino.hh"
#include "G4ChargedGeantino.hh"
// CLHEP transform
#include "CLHEP/Geometry/Transform3D.h"
#include <memory> // For make unique
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
FaserSctSensorSD::FaserSctSensorSD( const std::string& name, const std::string& hitCollectionName )
: G4VSensitiveDetector( name )
, m_HitColl( hitCollectionName )
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void FaserSctSensorSD::Initialize(G4HCofThisEvent *)
{
if (!m_HitColl.isValid()) m_HitColl = std::make_unique<FaserSiHitCollection>();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool FaserSctSensorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* /*ROhist*/)
{
double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) {
if(aStep->GetTrack()->GetDefinition()!=G4Geantino::GeantinoDefinition() &&
aStep->GetTrack()->GetDefinition()!=G4ChargedGeantino::ChargedGeantinoDefinition())
return false;
}
edep *= CLHEP::MeV;
//
// Get the Touchable History:
//
const G4TouchableHistory *myTouch = dynamic_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
//
// Get the hit coordinates. Start and End Point
//
G4ThreeVector coord1 = aStep->GetPreStepPoint()->GetPosition();
G4ThreeVector coord2 = aStep->GetPostStepPoint()->GetPosition();
//
// Calculate the local step begin and end position.
// From a G4 FAQ:
// http://geant4-hn.slac.stanford.edu:5090/HyperNews/public/get/geometry/17/1.html
//
const G4AffineTransform transformation = myTouch->GetHistory()->GetTopTransform();
G4ThreeVector localPosition1 = transformation.TransformPoint(coord1);
G4ThreeVector localPosition2 = transformation.TransformPoint(coord2);
//
// Get it into a vector in local coords and with the right units:
//
HepGeom::Point3D<double> lP1,lP2;
// No funny business with coordinates like ATLAS...
lP1[2] = localPosition1[2]*CLHEP::mm;
lP1[1] = localPosition1[1]*CLHEP::mm;
lP1[0] = localPosition1[0]*CLHEP::mm;
lP2[2] = localPosition2[2]*CLHEP::mm;
lP2[1] = localPosition2[1]*CLHEP::mm;
lP2[0] = localPosition2[0]*CLHEP::mm;
// Now Navigate the history to know in what detector the step is:
// and finally set the ID of det element in which the hit is.
//
//G4int History;
//
// Get station and plate
//
int station = 0;
int plane = 0;
int row = 0;
int module = 0;
int sensor = 0;
this->indexMethod(myTouch, station, plane, row, module, sensor);
// get the HepMcParticleLink from the TrackHelper
TrackHelper trHelp(aStep->GetTrack());
m_HitColl->Emplace(lP1,
lP2,
edep,
aStep->GetPreStepPoint()->GetGlobalTime(),//use the global time. i.e. the time from the beginning of the event
trHelp.GetParticleLink(),
station,plane,row,module,sensor);
return true;
}
void FaserSctSensorSD::indexMethod(const G4TouchableHistory *myTouch,
int &station, int &plane, int &row, int &module, int &sensor) {
sensor = myTouch->GetVolume(1)->GetCopyNo();
row = myTouch->GetVolume(2)->GetCopyNo(); // module # within half-plane is also row #
int halfPlaneSide = myTouch->GetVolume(3)->GetCopyNo(); // 0 = upstream, 1 = downstream
module = (2*halfPlaneSide - 1) * (2*(row%2) - 1);
plane = myTouch->GetVolume(4)->GetCopyNo();
station = myTouch->GetVolume(5)->GetCopyNo();
return;
}
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/****************************************************************
SCT Sensitive Detector class
****************************************************************/
#ifndef FASERSCT_G4_SD_FASERSCTSENSORSD_H
#define FASERSCT_G4_SD_FASERSCTSENSORSD_H
// Base class
#include "G4VSensitiveDetector.hh"
// For the hits
#include "TrackerSimEvent/FaserSiHitCollection.h"
#include "StoreGate/WriteHandle.h"
// G4 needed classes
class G4Step;
class G4TouchableHistory;
class FaserSctSensorSD : public G4VSensitiveDetector
{
public:
// Constructor
FaserSctSensorSD(const std::string& name, const std::string& hitCollectionName);
// Destructor
~FaserSctSensorSD() { /* If all goes well we do not own myHitColl here */ }
// Deal with each G4 hit
G4bool ProcessHits(G4Step*, G4TouchableHistory*) override;
// For setting up the hit collection
void Initialize(G4HCofThisEvent*) override final;
/** Templated method to stuff a single hit into the sensitive detector class. This
could get rather tricky, but the idea is to allow fast simulations to use the very
same SD classes as the standard simulation. */
template <class... Args> void AddHit(Args&&... args){ m_HitColl->Emplace( args... ); }
private:
void indexMethod(const G4TouchableHistory *myTouch, int &station, int &plane, int &row, int &module, int &sensor);
protected:
// The hits collection
SG::WriteHandle<FaserSiHitCollection> m_HitColl;
};
#endif //FASERSCT_G4_SD_FASERSCTSENSORSD_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Veto Sensitive Detector Tool.
//
// class header
#include "FaserSctSensorSDTool.h"
// package includes
#include "FaserSctSensorSD.h"
// STL includes
#include <exception>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
FaserSctSensorSDTool::FaserSctSensorSDTool(const std::string& type, const std::string& name, const IInterface* parent)
: SensitiveDetectorBase( type , name , parent )
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VSensitiveDetector* FaserSctSensorSDTool::makeSD()
{
ATH_MSG_DEBUG( "Creating FaserSCT SD: " << name() );
return new FaserSctSensorSD(name(), m_outputCollectionNames[0]);
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/****************************************************************
SCT Sensitive Detector Tool
****************************************************************/
#ifndef FASERSCT_G4_SD_FASERSCTSENSORSDTOOL_H
#define FASERSCT_G4_SD_FASERSCTSENSORSDTOOL_H
// Base class
#include "G4AtlasTools/SensitiveDetectorBase.h"
// STL headers
#include <string>
class G4VSensitiveDetector;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
class FaserSctSensorSDTool : public SensitiveDetectorBase
{
public:
// Constructor
FaserSctSensorSDTool(const std::string& type, const std::string& name, const IInterface *parent);
// Destructor
~FaserSctSensorSDTool() { /* If all goes well we do not own myHitColl here */ }
protected:
// Make me an SD!
G4VSensitiveDetector* makeSD() override final;
};
#endif //FASERSCT_G4_SD_FASERSCTSENSORSDTOOL_H
#include "../FaserSctSensorSDTool.h"
DECLARE_COMPONENT( FaserSctSensorSDTool )
#!/usr/bin/env python
"""Run tests on FaserSCT_G4_SD configuration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
if __name__ == '__main__':
#import config flags
from CalypsoConfiguration.AllConfigFlags import ConfigFlags
# Set up logging and config behaviour
from AthenaCommon.Logging import log
from AthenaCommon.Constants import DEBUG
from AthenaCommon.Configurable import Configurable
log.setLevel(DEBUG)
Configurable.configurableRun3Behavior = 1
# ConfigFlags.Sim.ISF.Run = True
ConfigFlags.Detector.SimulateFaserSCT = True
#Provide input
from AthenaConfiguration.TestDefaults import defaultTestFiles
inputDir = defaultTestFiles.d
ConfigFlags.Input.Files = defaultTestFiles.EVNT
# Finalize
ConfigFlags.lock()
## Initialize a new component accumulator
cfg = ComponentAccumulator()
from FaserSCT_G4_SD.FaserSCT_G4_SDToolConfig import FaserSCT_SensorSDCfg
acc, tool = FaserSCT_SensorSDCfg(ConfigFlags)
acc.addPublicTool(tool)
cfg.merge(acc)
cfg.printConfig(withDetails=True, summariseProps = True)
ConfigFlags.dump()
f=open("test.pkl","w")
cfg.store(f)
f.close()
print cfg._publicTools
print "-----------------finished----------------------"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment