diff --git a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql index 738ea5cb7e829f57cb57e1bd47123528a63bdd89..d2c66167e2f77fdb7f531147a93102d0f2cb0af3 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql +++ b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql @@ -1057,8 +1057,8 @@ INSERT INTO "SCTTOPLEVEL_DATA2TAG" VALUES(106788,3); -- -- DROP TABLE IF EXISTS "SCTFASERGENERAL_DATA"; -CREATE TABLE "SCTFASERGENERAL_DATA" ("SCTFASERGENERAL_DATA_ID" SLONGLONG, "NUMLAYERS" INT, "LAYERPITCH" DOUBLE, "ROWSPERLAYER" INT, "MODULESPERROW" INT, UNIQUE ( "SCTFASERGENERAL_DATA_ID") ); -INSERT INTO "SCTFASERGENERAL_DATA" VALUES (0, 3, 100.0, 4, 2); +CREATE TABLE "SCTFASERGENERAL_DATA" ("SCTFASERGENERAL_DATA_ID" SLONGLONG, "NUMLAYERS" INT, "LAYERPITCH" DOUBLE, "ETAHALFPITCH" DOUBLE, "PHIHALFPITCH" DOUBLE, "DEPTHHALFPITCH" DOUBLE, "SIDEHALFPITCH" DOUBLE, UNIQUE ( "SCTFASERGENERAL_DATA_ID") ); +INSERT INTO "SCTFASERGENERAL_DATA" VALUES (0, 3, 100.0, 60.0, 30.0, 2.5, 2.5); DROP TABLE IF EXISTS "SCTFASERGENERAL_DATA2TAG"; CREATE TABLE "SCTFASERGENERAL_DATA2TAG" ( "SCTFASERGENERAL_TAG_ID" SLONGLONG ,"SCTFASERGENERAL_DATA_ID" SLONGLONG ); INSERT INTO "SCTFASERGENERAL_DATA2TAG" VALUES(106789, 0); diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py b/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py index bee84266c6e510f3c1e5fd58c2104349ff695332..e4815c75ce07c9a98352390d265f0269d7a8f48b 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py +++ b/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py @@ -24,7 +24,7 @@ if __name__ == "__main__": Configurable.configurableRun3Behavior = True ConfigFlags.addFlag("GeoModel.FaserVersion", "Faser-00") ConfigFlags.addFlag("Detector.SimulateVeto", True) - ConfigFlags.addFlag("Detector.SimulateSCT", True) + ConfigFlags.addFlag("Detector.SimulateFaserSCT", True) # from AthenaConfiguration.TestDefaults import defaultTestFiles # Provide MC input diff --git a/DetectorDescription/GeoModel/GeoAdaptors/CMakeLists.txt b/DetectorDescription/GeoModel/GeoAdaptors/CMakeLists.txt index 4b05ff389f457e3dde3173bbbcb22ac2d1c0f79a..31028e32cf8b34cbef5ac6264cdc2c2333f10160 100644 --- a/DetectorDescription/GeoModel/GeoAdaptors/CMakeLists.txt +++ b/DetectorDescription/GeoModel/GeoAdaptors/CMakeLists.txt @@ -13,9 +13,9 @@ atlas_depends_on_subdirs( PUBLIC Scintillator/ScintDetDescr/ScintIdentifier Scintillator/ScintDetDescr/ScintReadoutGeometry Scintillator/ScintSimEvent -# InnerDetector/InDetDetDescr/InDetIdentifier -# InnerDetector/InDetDetDescr/InDetReadoutGeometry -# InnerDetector/InDetSimEvent + Tracker/TrackerDetDescr/TrackerIdentifier + Tracker/TrackerDetDescr/TrackerReadoutGeometry + Tracker/TrackerSimEvent ) # External dependencies: @@ -27,5 +27,5 @@ atlas_add_library( GeoAdaptors PUBLIC_HEADERS GeoAdaptors INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} 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 ) diff --git a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoFaserSiHit.h b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoFaserSiHit.h new file mode 100644 index 0000000000000000000000000000000000000000..c68a59b509df4265c2404324d1d1c2c1219938c2 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoFaserSiHit.h @@ -0,0 +1,53 @@ +/* + 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 diff --git a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoFaserSiHit.icc b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoFaserSiHit.icc new file mode 100644 index 0000000000000000000000000000000000000000..c0cf0a7c0f95e1921f46e96b355104a720014337 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoFaserSiHit.icc @@ -0,0 +1,50 @@ +/* + 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); +} diff --git a/DetectorDescription/GeoModel/GeoAdaptors/src/statics.cxx b/DetectorDescription/GeoModel/GeoAdaptors/src/statics.cxx index 7f0b684ffb7b425a2fd882507bb573b241f1d672..675d7726b063a36d0cbf3cd0cc1a60d8be8f0a07 100644 --- a/DetectorDescription/GeoModel/GeoAdaptors/src/statics.cxx +++ b/DetectorDescription/GeoModel/GeoAdaptors/src/statics.cxx @@ -3,11 +3,14 @@ */ #include "GeoAdaptors/GeoScintHit.h" +#include "GeoAdaptors/GeoFaserSiHit.h" const ScintDD::VetoDetectorManager *GeoScintHit::s_veto = 0; const ScintDD::TriggerDetectorManager *GeoScintHit::s_trigger = 0; const ScintDD::PreshowerDetectorManager *GeoScintHit::s_preshower = 0; +const TrackerDD::SCT_DetectorManager *GeoFaserSiHit::s_sct; const VetoID *GeoScintHit::s_vID = 0; const TriggerID *GeoScintHit::s_tID = 0; const PreshowerID *GeoScintHit::s_pID = 0; +const FaserSCT_ID *GeoFaserSiHit::s_sID = 0; diff --git a/Scintillator/ScintEventCnv/ScintSimAthenaPool/CMakeLists.txt b/Scintillator/ScintEventCnv/ScintSimEventAthenaPool/CMakeLists.txt similarity index 100% rename from Scintillator/ScintEventCnv/ScintSimAthenaPool/CMakeLists.txt rename to Scintillator/ScintEventCnv/ScintSimEventAthenaPool/CMakeLists.txt diff --git a/Scintillator/ScintEventCnv/ScintSimAthenaPool/ScintSimEventAthenaPool/ScintSimDataCollection_p1.h b/Scintillator/ScintEventCnv/ScintSimEventAthenaPool/ScintSimEventAthenaPool/ScintSimDataCollection_p1.h similarity index 100% rename from Scintillator/ScintEventCnv/ScintSimAthenaPool/ScintSimEventAthenaPool/ScintSimDataCollection_p1.h rename to Scintillator/ScintEventCnv/ScintSimEventAthenaPool/ScintSimEventAthenaPool/ScintSimDataCollection_p1.h diff --git a/Scintillator/ScintEventCnv/ScintSimAthenaPool/ScintSimEventAthenaPool/ScintSimData_p1.h b/Scintillator/ScintEventCnv/ScintSimEventAthenaPool/ScintSimEventAthenaPool/ScintSimData_p1.h similarity index 100% rename from Scintillator/ScintEventCnv/ScintSimAthenaPool/ScintSimEventAthenaPool/ScintSimData_p1.h rename to Scintillator/ScintEventCnv/ScintSimEventAthenaPool/ScintSimEventAthenaPool/ScintSimData_p1.h diff --git a/Scintillator/ScintEventCnv/ScintSimAthenaPool/ScintSimEventAthenaPool/ScintSimEventAthenaPoolCnvDict.h b/Scintillator/ScintEventCnv/ScintSimEventAthenaPool/ScintSimEventAthenaPool/ScintSimEventAthenaPoolCnvDict.h similarity index 100% rename from Scintillator/ScintEventCnv/ScintSimAthenaPool/ScintSimEventAthenaPool/ScintSimEventAthenaPoolCnvDict.h rename to Scintillator/ScintEventCnv/ScintSimEventAthenaPool/ScintSimEventAthenaPool/ScintSimEventAthenaPoolCnvDict.h diff --git a/Scintillator/ScintEventCnv/ScintSimAthenaPool/ScintSimEventAthenaPool/selection.xml b/Scintillator/ScintEventCnv/ScintSimEventAthenaPool/ScintSimEventAthenaPool/selection.xml similarity index 100% rename from Scintillator/ScintEventCnv/ScintSimAthenaPool/ScintSimEventAthenaPool/selection.xml rename to Scintillator/ScintEventCnv/ScintSimEventAthenaPool/ScintSimEventAthenaPool/selection.xml diff --git a/Scintillator/ScintEventCnv/ScintSimAthenaPool/src/ScintHitCollectionCnv.cxx b/Scintillator/ScintEventCnv/ScintSimEventAthenaPool/src/ScintHitCollectionCnv.cxx similarity index 100% rename from Scintillator/ScintEventCnv/ScintSimAthenaPool/src/ScintHitCollectionCnv.cxx rename to Scintillator/ScintEventCnv/ScintSimEventAthenaPool/src/ScintHitCollectionCnv.cxx diff --git a/Scintillator/ScintEventCnv/ScintSimAthenaPool/src/ScintHitCollectionCnv.h b/Scintillator/ScintEventCnv/ScintSimEventAthenaPool/src/ScintHitCollectionCnv.h similarity index 100% rename from Scintillator/ScintEventCnv/ScintSimAthenaPool/src/ScintHitCollectionCnv.h rename to Scintillator/ScintEventCnv/ScintSimEventAthenaPool/src/ScintHitCollectionCnv.h diff --git a/Scintillator/ScintEventCnv/ScintSimEventTPCnv/ScintSimEventTPCnv/ScintHits/ScintHitCollectionCnv_p1.h b/Scintillator/ScintEventCnv/ScintSimEventTPCnv/ScintSimEventTPCnv/ScintHits/ScintHitCollectionCnv_p1.h index 8353e92b849a7d3dbbfd7db92f0dbe9e09d65b3e..1eff6aeb677b7f599a4a83f0bdc837e0fb72dfef 100644 --- a/Scintillator/ScintEventCnv/ScintSimEventTPCnv/ScintSimEventTPCnv/ScintHits/ScintHitCollectionCnv_p1.h +++ b/Scintillator/ScintEventCnv/ScintSimEventTPCnv/ScintSimEventTPCnv/ScintHits/ScintHitCollectionCnv_p1.h @@ -5,7 +5,7 @@ #ifndef 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 O.Arnaez <olivier.arnaez@cern.ch> diff --git a/Simulation/G4Faser/G4FaserApp/test/runG4.py b/Simulation/G4Faser/G4FaserApp/test/runG4.py index 311e0e091d503b628cbfb9470605905a227941fe..09832c329434257fba89b90f29947823487e380a 100644 --- a/Simulation/G4Faser/G4FaserApp/test/runG4.py +++ b/Simulation/G4Faser/G4FaserApp/test/runG4.py @@ -22,6 +22,7 @@ if __name__ == "__main__": from G4AtlasTools.G4AtlasToolsConf import SensitiveDetectorMasterTool from G4FaserTools.G4FaserToolsConfig import generateSensitiveDetectorList from VetoG4_SD.VetoG4_SDToolConfig import VetoSensorSDCfg + from FaserSCT_G4_SD.FaserSCT_G4_SDToolConfig import SctSensorSDCfg # # Set up logging and new style config # @@ -65,8 +66,8 @@ if __name__ == "__main__": # ConfigFlags.Detector.SimulateVeto = True ConfigFlags.Detector.GeometryVeto = True - ConfigFlags.Detector.SimulateSCT = True - ConfigFlags.Detector.GeometrySCT = True + ConfigFlags.Detector.SimulateFaserSCT = True + ConfigFlags.Detector.GeometryFaserSCT = True ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.Sim.ReleaseGeoModel = False # @@ -85,8 +86,8 @@ if __name__ == "__main__": pg.McEventKey = "GEN_EVENT" pg.randomSeed = 123456 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.pos = PG.PosSampler(x=[-10, 10], y=[-10, 10], z=-2100.0, t=0.0) + 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=[-5, 5], y=[-5, 5], z=-2100.0, t=0.0) acc.addEventAlgo(pg, "AthBeginSeq") # to run *before* G4 # # Only one of these two should be used in a given job @@ -103,7 +104,8 @@ if __name__ == "__main__": ["EventInfo#*", "McEventCollection#TruthEvent", "McEventCollection#GEN_EVENT", - "ScintHitCollection#*" + "ScintHitCollection#*", + "FaserSiHitCollection#*" ])) acc.getEventAlgo("OutputStreamHITS").AcceptAlgs = ["G4FaserAlg"] # optional acc.getEventAlgo("OutputStreamHITS").WritingTool.ProcessingTag = "StreamHITS" # required @@ -114,10 +116,12 @@ if __name__ == "__main__": acc.merge(G4FaserAlgCfg(ConfigFlags)) algo = acc.getEventAlgo("G4FaserAlg") veto, vetosd = VetoSensorSDCfg(ConfigFlags) - sendet = SensitiveDetectorMasterTool(SensitiveDetectors = [vetosd]) + sct, sctsd = SctSensorSDCfg(ConfigFlags) + sendet = SensitiveDetectorMasterTool(SensitiveDetectors = [vetosd,sctsd]) acc.addPublicTool(sendet) algo.SenDetMasterTool = sendet acc.merge(veto) + acc.merge(sct) acc.addService(G4GeometryNotifierSvcCfg(ConfigFlags, ActivateLVNotifier=True)) # # Verbosity diff --git a/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfigNew.py b/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfigNew.py index 96c702359e5b874d13e96d97cbbda05db3b15a34..b26b6b33dbb94a949ab7274c71d52d2b317faa5c 100644 --- a/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfigNew.py +++ b/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfigNew.py @@ -8,7 +8,7 @@ from G4AtlasServices.G4AtlasServicesConf import DetectorGeometrySvc, G4AtlasSvc, # # Physics region tools # -from G4FaserTools.G4PhysicsRegionConfigNew import ScintillatorPhysicsRegionToolCfg #, TrackerPhysicsRegionToolCfg, FaserCaloPhysicsRegionToolCfg +from G4FaserTools.G4PhysicsRegionConfigNew import ScintillatorPhysicsRegionToolCfg, TrackerPhysicsRegionToolCfg #, FaserCaloPhysicsRegionToolCfg from G4FaserServices.G4FaserServicesConf import ISF__FaserGeoIDSvc # # Geometry tools @@ -21,7 +21,8 @@ from G4FaserTools.G4FieldConfigNew import FASERFieldManagerToolCfg, VetoFieldMan # # Future field managers (?) # -# from G4FaserTools.G4FieldConfigNew import TriggerFieldManagerToolCfg, PreshowerFieldManagerToolCfg, UpstreamTrackerFieldManagerToolCfg, CentralTrackerFieldManagerToolCfg, DownstreamTrackerFieldManagerToolCfg, UpstreamDipoleFieldManagerToolCfg, CentralDipoleFieldManagerToolCfg, DownstreamDipleFieldManagerToolCfg, FaserCaloFieldManagerToolCfg +# from G4FaserTools.G4FieldConfigNew import TriggerFieldManagerToolCfg, PreshowerFieldManagerToolCfg, UpstreamDipoleFieldManagerToolCfg, CentralDipoleFieldManagerToolCfg, DownstreamDipleFieldManagerToolCfg, FaserCaloFieldManagerToolCfg +from G4FaserTools.G4FieldConfigNew import TrackerFieldManagerToolCfg # # def FaserGeoIDSvcCfg(ConfigFlags, name="ISF_FaserGeoIDSvc", **kwargs): @@ -41,8 +42,8 @@ def getFASER_RegionCreatorList(ConfigFlags): if ConfigFlags.Detector.SimulateScintillator: regionCreatorList += [ScintillatorPhysicsRegionToolCfg(ConfigFlags)] - # if ConfigFlags.Detector.SimulateTracker: - # regionCreatorList += [TrackerPhysicsRegionToolCfg(ConfigFlags)] + if ConfigFlags.Detector.SimulateTracker: + regionCreatorList += [TrackerPhysicsRegionToolCfg(ConfigFlags)] # if ConfigFlags.Detector.SimulateFaserCalo: # regionCreatorList += [FaserCaloPhysicsRegionToolCfg(ConfigFlags)] @@ -82,16 +83,10 @@ def FASER_FieldMgrListCfg(ConfigFlags): # acc = PreshowerFieldManagerToolCfg(ConfigFlags) # tool = result.popToolsAndMerge(acc) # fieldMgrList += [tool] - # if ConfigFlags.Detector.SimulateTracker: - # acc = UpstreamTrackerFieldManagerToolCfg(ConfigFlags) - # tool = result.popToolsAndMerge(acc) - # fieldMgrList += [tool] - # acc = CentralTrackerFieldManagerToolCfg(ConfigFlags) - # tool = result.popToolsAndMerge(acc) - # fieldMgrList += [tool] - # acc = DownstreamTrackerFieldManagerToolCfg(ConfigFlags) - # tool = result.popToolsAndMerge(acc) - # fieldMgrList += [tool] + if ConfigFlags.Detector.SimulateTracker: + acc = TrackerFieldManagerToolCfg(ConfigFlags) + tool = result.popToolsAndMerge(acc) + fieldMgrList += [tool] # if ConfigFlags.Detector.SimulateFaserCalo: # acc = FaserCaloFieldManagerToolCfg(ConfigFlags) # tool = result.popToolsAndMerge(acc) diff --git a/Simulation/G4Faser/G4FaserTools/python/G4FaserToolsConfig.py b/Simulation/G4Faser/G4FaserTools/python/G4FaserToolsConfig.py index f81b5f675b58b5a492c93ad25d150ddca2e7b4ba..39bb811698c8fecbd7852a948f3d170f9c89a607 100644 --- a/Simulation/G4Faser/G4FaserTools/python/G4FaserToolsConfig.py +++ b/Simulation/G4Faser/G4FaserTools/python/G4FaserToolsConfig.py @@ -81,9 +81,10 @@ def generateScintillatorSensitiveDetectorList(): def generateTrackerSensitiveDetectorList(): SensitiveDetectorList=[] - # from CalypsoConfiguration.AllFlags import ConfigFlags - # if (ConfigFlags.Detector.SimulateTracker): - # SensitiveDetectorList += [ 'SctSensorSD' ] + from CalypsoConfiguration.AllFlags import ConfigFlags + if (ConfigFlags.Detector.SimulateTracker): + if (ConfigFlags.Detector.SimulateFaserSCT): + SensitiveDetectorList += [ 'SctSensorSD' ] return SensitiveDetectorList def generateFaserCaloSensitiveDetectorList(): diff --git a/Simulation/G4Faser/G4FaserTools/python/G4FieldConfigNew.py b/Simulation/G4Faser/G4FaserTools/python/G4FieldConfigNew.py index 2b2ede247f2da24f2b2d1b9cfe29665486ab99ce..64ae21259f0012fefe66b293858841607b4e8bf1 100644 --- a/Simulation/G4Faser/G4FaserTools/python/G4FieldConfigNew.py +++ b/Simulation/G4Faser/G4FaserTools/python/G4FieldConfigNew.py @@ -96,6 +96,16 @@ def VetoFieldManagerToolCfg(ConfigFlags, name='VetoFieldManager', **kwargs): kwargs.setdefault('MinimumEpsilonStep', 0.00001) return BasicDetectorConstantFieldManagerToolCfg(ConfigFlags, name, **kwargs) + +def TrackerFieldManagerToolCfg(ConfigFlags, name='TrackerFieldManager', **kwargs): + kwargs.setdefault("LogicalVolumes", ['SCT::Station']) + #kwargs.setdefault('DeltaChord', 0.00001) + kwargs.setdefault('DeltaIntersection', 0.00001) + kwargs.setdefault('DeltaOneStep', 0.0001) + kwargs.setdefault('MaximumEpsilonStep', 0.001) + kwargs.setdefault('MinimumEpsilonStep', 0.00001) + return BasicDetectorConstantFieldManagerToolCfg(ConfigFlags, name, **kwargs) + # def BeamPipeFieldManagerToolCfg(ConfigFlags, name='BeamPipeFieldManager', **kwargs): # kwargs.setdefault("LogicalVolumes", ['BeamPipe::BeamPipe']) # #kwargs.setdefault('DeltaChord', 0.00001) diff --git a/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py b/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py index b48c9ebe78ad134f8c8df2ade5f83ec7467e1c1b..7cc2a317a8144e1f63a96cab1dea4bc27063b1e1 100644 --- a/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py +++ b/Simulation/G4Faser/G4FaserTools/python/G4GeometryToolConfig.py @@ -7,6 +7,7 @@ from G4AtlasTools.G4AtlasToolsConf import CylindricalEnvelope, PolyconicalEnvelo from AthenaCommon.SystemOfUnits import mm, cm, m from VetoGeoModel.VetoGeoModelConfig import VetoGeometryCfg +from FaserSCT_GeoModel.FaserSCT_GeoModelConfig import FaserSCT_GeometryCfg #ToDo - finish migrating this (dnoel) #Todo - just return component accumulator @@ -19,6 +20,12 @@ def VetoGeoDetectorToolCfg(ConfigFlags, name='Veto', **kwargs): kwargs.setdefault("DetectorName", "Veto") return result, GeoDetectorTool(name, **kwargs) +def SCTGeoDetectorToolCfg(ConfigFlags, name='SCT', **kwargs): + #set up geometry + result=FaserSCT_GeometryCfg(ConfigFlags) + kwargs.setdefault("DetectorName", "SCT") + return result, GeoDetectorTool(name, **kwargs) + def generateSubDetectorList(ConfigFlags): result = ComponentAccumulator() SubDetectorList=[] @@ -28,6 +35,11 @@ def generateSubDetectorList(ConfigFlags): SubDetectorList += [ toolVeto ] result.merge(accVeto) + if ConfigFlags.Detector.SimulateFaserSCT: + accSCT, toolSCT = SCTGeoDetectorToolCfg(ConfigFlags) + SubDetectorList += [ toolSCT ] + result.merge(accSCT) + return result, SubDetectorList def FASEREnvelopeCfg(ConfigFlags, name="Faser", **kwargs): diff --git a/Simulation/G4Faser/G4FaserTools/python/G4PhysicsRegionConfigNew.py b/Simulation/G4Faser/G4FaserTools/python/G4PhysicsRegionConfigNew.py index 3dab4476d1c012d3b05d2d297b40ce34c71bb3cd..092950bd0a8cfa7bea901fab22bb4305780a3cfb 100644 --- a/Simulation/G4Faser/G4FaserTools/python/G4PhysicsRegionConfigNew.py +++ b/Simulation/G4Faser/G4FaserTools/python/G4PhysicsRegionConfigNew.py @@ -71,6 +71,14 @@ def ScintillatorPhysicsRegionToolCfg(ConfigFlags, name='ScintillatorPhysicsRegio kwargs.setdefault("GammaCut", 0.05) return RegionCreator(name, **kwargs) +def TrackerPhysicsRegionToolCfg(ConfigFlags, name="TrackerPhysicsRegionTool", **kwargs): + kwargs.setdefault("RegionName", "Tracker") + volumeList = ['SCT::BRLSensor'] + kwargs.setdefault("VolumeList", volumeList) + kwargs.setdefault("ElectronCut", 0.05) + kwargs.setdefault("PositronCut", 0.05) + kwargs.setdefault("GammaCut", 0.05) + return RegionCreator(name, **kwargs) # def SCTPhysicsRegionToolCfg(ConfigFlags, name='SCTPhysicsRegionTool', **kwargs): # kwargs.setdefault("RegionName", 'SCT') diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Barrel.h b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Barrel.h index 2a4f370cdef52cf0046ad173975b730b7cde272c..63a780e167de903702b489d9b0554e525579a8ae 100644 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Barrel.h +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Barrel.h @@ -11,7 +11,7 @@ class GeoVPhysVol; class GeoFullPhysVol; class GeoLogVol; class SCT_Identifier; -class SCT_Layer; +class SCT_Plane; class SCT_Barrel : public SCT_UniqueComponentFactory { @@ -34,7 +34,7 @@ private: void getParameters(); virtual const GeoLogVol * preBuild(); - SCT_Layer* m_layer; + SCT_Plane* m_plane; int m_numLayers; double m_layerPitch; diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_BarrelParameters.h b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_BarrelParameters.h index 0c94262c03f2042aa7c8a079ef0c7c5eb2694e81..9005a5a20d496808cb95cdfd75183ef966d45379 100644 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_BarrelParameters.h +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_BarrelParameters.h @@ -16,14 +16,15 @@ public: // Constructor SCT_BarrelParameters(SCT_DataBase* rdb); - int modulesPerRow() const; - int rowsPerLayer() const; - + double etaHalfPitch() const; + double phiHalfPitch() const; + double depthHalfPitch() const; + double sideHalfPitch() const; // Barrel General int numLayers() const; double layerPitch() const; - private: +private: SCT_DataBase * m_rdb; }; diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_HalfPlane.h b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_HalfPlane.h new file mode 100644 index 0000000000000000000000000000000000000000..3fa09c9ad87e0fb1688d62e302cc4744286155c8 --- /dev/null +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_HalfPlane.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FASERSCT_GEOMODEL_SCT_HALFPLANE_H +#define FASERSCT_GEOMODEL_SCT_HALFPLANE_H + +#include "FaserSCT_GeoModel/SCT_ComponentFactory.h" + +#include <string> + +class GeoMaterial; +class GeoVPhysVol; +class GeoLogVol; +class SCT_Module; +class SCT_Identifier; + +class SCT_HalfPlane: public SCT_UniqueComponentFactory +{ +public: + SCT_HalfPlane(const std::string & name, + TrackerDD::SCT_DetectorManager* detectorManager, + const SCT_GeometryManager* geometryManager, + SCT_MaterialManager* materials); + + ~SCT_HalfPlane(); + //Explicitly disallow copy, assign to appease coverity + SCT_HalfPlane(const SCT_HalfPlane &) = delete; + SCT_HalfPlane & operator=(const SCT_HalfPlane &) = delete; + + virtual GeoVPhysVol* build(SCT_Identifier id) { return build(id, +1); } + virtual GeoVPhysVol * build(SCT_Identifier id, int etaSign); + + +public: + + double width() const { return m_width; } // y dimension of half-plane (local/module) + double length() const { return m_length; } // z dimension of half-plane (local/module) + double thickness() const { return m_thickness; } // x dimension of half-plane (local/module) + +private: + void getParameters(); + virtual const GeoLogVol * preBuild(); + + void activeEnvelopeExtent(double & dx, double & dy, double & dz); + + // Layer number + double m_safety; + double m_etaHalfPitch; // horizontal global direction + double m_phiHalfPitch; // vertical global direction + double m_depthHalfPitch; // axial global direction + + double m_width; + double m_length; + double m_thickness; + // double m_activeWidth; + // double m_activeThickness; + // double m_activeLength; + + SCT_Module* m_module; + const GeoLogVol* m_logVolume; +}; + +#endif // FASERSCT_GEOMODEL_SCT_HALFPLANE_H diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Layer.h b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Plane.h similarity index 64% rename from Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Layer.h rename to Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Plane.h index f9e29180059fa885462e6bff3a419e8b414226ac..d52658a5f25e9031847b1fdd2c87fadb391cd496 100644 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Layer.h +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Plane.h @@ -3,11 +3,8 @@ */ // -// CPW 17/8/06 -// Version using new model of services from A. Tricoli -// -#ifndef FASERSCT_GEOMODEL_SCT_LAYER_H -#define FASERSCT_GEOMODEL_SCT_LAYER_H +#ifndef FASERSCT_GEOMODEL_SCT_PLANE_H +#define FASERSCT_GEOMODEL_SCT_PLANE_H #include "FaserSCT_GeoModel/SCT_ComponentFactory.h" @@ -16,31 +13,31 @@ class GeoMaterial; class GeoVPhysVol; class GeoLogVol; -class SCT_Ski; +class SCT_HalfPlane; class SCT_Module; class SCT_Identifier; -class SCT_Layer: public SCT_UniqueComponentFactory +class SCT_Plane: public SCT_UniqueComponentFactory { public: - SCT_Layer(const std::string & name, + SCT_Plane(const std::string & name, TrackerDD::SCT_DetectorManager* detectorManager, const SCT_GeometryManager* geometryManager, SCT_MaterialManager* materials); - ~SCT_Layer(); + ~SCT_Plane(); //Explicitly disallow copy, assign to appease coverity - SCT_Layer(const SCT_Layer &) = delete; - SCT_Layer & operator=(const SCT_Layer &) = delete; + SCT_Plane(const SCT_Plane &) = delete; + SCT_Plane & operator=(const SCT_Plane &) = delete; virtual GeoVPhysVol * build(SCT_Identifier id); public: - double width() const {return m_width;} // x dimension of layer - double height() const {return m_height;} // y dimension of layer - double thickness() const {return m_thickness;} // z dimension of layer + double width() const {return m_width;} // x dimension of layer (global) + double height() const {return m_height;} // y dimension of layer (global) + double thickness() const {return m_thickness;} // z dimension of layer (global) private: void getParameters(); @@ -54,14 +51,11 @@ private: double m_width; double m_height; double m_thickness; - double m_activeWidth; - double m_activeHeight; - double m_activeThickness; - int m_rowsPerLayer; + double m_sideHalfPitch; - SCT_Ski* m_ski; + SCT_HalfPlane* m_halfPlane; const GeoLogVol* m_logVolume; }; -#endif // FASERSCT_GEOMODEL_SCT_LAYER_H +#endif // FASERSCT_GEOMODEL_SCT_PLANE_H diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Ski.h b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Ski.h deleted file mode 100644 index 35c2b819546a7c520e8474a1234ef9381ebb96ce..0000000000000000000000000000000000000000 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/FaserSCT_GeoModel/SCT_Ski.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// -// CPW 17/8/06 -// Version using new model of services from A. Tricoli -// -#ifndef FASERSCT_GEOMODEL_SCT_SKI_H -#define FASERSCT_GEOMODEL_SCT_SKI_H - -#include "FaserSCT_GeoModel/SCT_ComponentFactory.h" - -#include <string> - -class GeoMaterial; -class GeoVPhysVol; -class GeoLogVol; -class SCT_Module; -class SCT_Identifier; - -class SCT_Ski: public SCT_UniqueComponentFactory -{ -public: - SCT_Ski(const std::string & name, - TrackerDD::SCT_DetectorManager* detectorManager, - const SCT_GeometryManager* geometryManager, - SCT_MaterialManager* materials); - - ~SCT_Ski(); - //Explicitly disallow copy, assign to appease coverity - SCT_Ski(const SCT_Ski &) = delete; - SCT_Ski & operator=(const SCT_Ski &) = delete; - - virtual GeoVPhysVol * build(SCT_Identifier id); - - -public: - - double width() const { return m_width; } // y dimension of ski - double length() const { return m_length; } // z dimension of ski - double thickness() const { return m_thickness; } // x dimension of ski - -private: - void getParameters(); - virtual const GeoLogVol * preBuild(); - - void activeEnvelopeExtent(double & dx, double & dy, double & dz); - - // Layer number - double m_safety; - - double m_width; - double m_length; - double m_thickness; - double m_activeWidth; - double m_activeThickness; - double m_activeLength; - - int m_modulesPerRow; - - SCT_Module* m_module; - const GeoLogVol* m_logVolume; -}; - -#endif // FASERSCT_GEOMODEL_SCT_SKI_H diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/python/FaserSCT_GeoModelConfig.py b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/python/FaserSCT_GeoModelConfig.py index 647e449c21f3f140b203c678455f038884f3b62a..7c8e771ce4ba573bce6ecc35d779cec5584500be 100644 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/python/FaserSCT_GeoModelConfig.py +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/python/FaserSCT_GeoModelConfig.py @@ -38,12 +38,12 @@ def FaserSCT_GeometryCfg( flags ): # acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL2/SCT","/Indet/AlignL2/SCT",className="CondAttrListCollection")) # acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL3","/Indet/AlignL3",className="AlignableTransformContainer")) # else: - # if (not flags.Detector.SimulateSCT) or flags.Detector.OverlaySCT: + # if (not flags.Detector.SimulateFaserSCT) or flags.Detector.OverlaySCT: # acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align",className="AlignableTransformContainer")) # else: # acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align")) # if flags.Common.Project is not "AthSimulation": # Protection for AthSimulation builds - # if (not flags.Detector.SimulateSCT) or flags.Detector.OverlaySCT: + # if (not flags.Detector.SimulateFaserSCT) or flags.Detector.OverlaySCT: # from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_AlignCondAlg # sctAlignCondAlg = SCT_AlignCondAlg(name = "SCT_AlignCondAlg", # UseDynamicAlignFolders = flags.GeoModel.Align.Dynamic) diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Barrel.cxx b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Barrel.cxx index d1801935270cf7eb1878a8d6f0e6b3def296ae01..55748efd38e872a9ffbca8416185d2a459c24146 100644 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Barrel.cxx +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Barrel.cxx @@ -11,7 +11,7 @@ #include "FaserSCT_GeoModel/SCT_GeneralParameters.h" #include "FaserSCT_GeoModel/SCT_Identifier.h" -#include "FaserSCT_GeoModel/SCT_Layer.h" +#include "FaserSCT_GeoModel/SCT_Plane.h" #include "TrackerReadoutGeometry/SCT_DetectorManager.h" @@ -54,29 +54,22 @@ SCT_Barrel::getParameters() m_numLayers = parameters->numLayers(); m_layerPitch = parameters->layerPitch(); - int modulesPerRow = parameters->modulesPerRow(); - int rowsPerLayer = parameters->rowsPerLayer(); - std::cout << "Retrieved parameters: " << m_numLayers << " "<< m_layerPitch << " " << modulesPerRow << " " << rowsPerLayer << std::endl; - // Set numerology - std::cout << "Setting num layers" << std::endl; // Set numerology m_detectorManager->numerology().setNumLayers(m_numLayers); - std::cout << "Setting modules per layer" << std::endl; for (int i = 0; i < m_numLayers; i++) { - m_detectorManager->numerology().setNumEtaModulesForLayer(i, modulesPerRow); - m_detectorManager->numerology().setNumPhiModulesForLayer(i, rowsPerLayer); + m_detectorManager->numerology().setNumEtaModulesForLayer(i, 2); + m_detectorManager->numerology().setNumPhiModulesForLayer(i, 4); } } const GeoLogVol * SCT_Barrel::preBuild() { - std::cout << "Instantiating Layer" << std::endl; - m_layer = new SCT_Layer("Layer", m_detectorManager, m_geometryManager, m_materials); - m_width = m_layer->width() + m_safety; - m_height = m_layer->height() + m_safety; - m_thickness = m_layer->thickness() * m_numLayers + m_layerPitch * (m_numLayers - 1) + m_safety; + m_plane = new SCT_Plane("Plane", m_detectorManager, m_geometryManager, m_materials); + m_width = m_plane->width() + m_safety; + m_height = m_plane->height() + m_safety; + m_thickness = m_plane->thickness() * m_numLayers + m_layerPitch * (m_numLayers - 1) + m_safety; // Create the barrel volume // Tube envelope containing the barrel. @@ -93,20 +86,20 @@ SCT_Barrel::build(SCT_Identifier id) double activeDepth = m_thickness - m_safety/2; - double layerThickness = m_layer->thickness(); + double layerThickness = m_plane->thickness(); for (int iLayer = 0; iLayer < m_numLayers; iLayer++) { // Create the layers - barrel->add(new GeoNameTag("Layer#"+intToString(iLayer))); + barrel->add(new GeoNameTag("Plane#"+intToString(iLayer))); barrel->add(new GeoIdentifierTag(iLayer)); // Identifier layer= iLayer id.setLayer(iLayer); GeoAlignableTransform* transform = new GeoAlignableTransform(GeoTrf::Translate3D(0.0, 0.0, (layerThickness - activeDepth)/2 + iLayer * m_layerPitch) ); barrel->add(transform); - GeoVPhysVol * layerPV = m_layer->build(id); - barrel->add(layerPV); + GeoVPhysVol * planePV = m_plane->build(id); + barrel->add(planePV); // Store alignable transform - m_detectorManager->addAlignableTransform(2, id.getWaferId(), transform, layerPV); + m_detectorManager->addAlignableTransform(2, id.getWaferId(), transform, planePV); } // Extra Material diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_BarrelParameters.cxx b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_BarrelParameters.cxx index 4798f4b508ad6713cc9473c9091898c04f6b7ec5..749a239be75b577b442ea62d5d9c01f01183e0ce 100644 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_BarrelParameters.cxx +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_BarrelParameters.cxx @@ -23,17 +23,30 @@ SCT_BarrelParameters::SCT_BarrelParameters(SCT_DataBase* rdb) // Barrel Layer // - int - SCT_BarrelParameters::modulesPerRow() const + double + SCT_BarrelParameters::etaHalfPitch() const { - return m_rdb->brlGeneral()->getInt("MODULESPERROW"); + return m_rdb->brlGeneral()->getDouble("ETAHALFPITCH"); } - int - SCT_BarrelParameters::rowsPerLayer() const + double + SCT_BarrelParameters::phiHalfPitch() const { - return m_rdb->brlGeneral()->getInt("ROWSPERLAYER"); + return m_rdb->brlGeneral()->getDouble("PHIHALFPITCH"); } + + double + SCT_BarrelParameters::depthHalfPitch() const + { + return m_rdb->brlGeneral()->getDouble("DEPTHHALFPITCH"); + } + + double + SCT_BarrelParameters::sideHalfPitch() const + { + return m_rdb->brlGeneral()->getDouble("SIDEHALFPITCH"); + } + // // Barrel General // diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_HalfPlane.cxx b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_HalfPlane.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f3be127ef462622d4b1826dc5b5a71bb2654660c --- /dev/null +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_HalfPlane.cxx @@ -0,0 +1,143 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FaserSCT_GeoModel/SCT_HalfPlane.h" +#include "FaserSCT_GeoModel/SCT_Identifier.h" +#include "FaserSCT_GeoModel/SCT_GeometryManager.h" +#include "FaserSCT_GeoModel/SCT_MaterialManager.h" +#include "FaserSCT_GeoModel/SCT_BarrelParameters.h" +#include "FaserSCT_GeoModel/SCT_GeneralParameters.h" +#include "FaserSCT_GeoModel/SCT_Module.h" + +#include "TrackerGeoModelUtils/ExtraMaterial.h" +#include "TrackerReadoutGeometry/SCT_DetectorManager.h" + +#include "GeoModelKernel/GeoBox.h" +#include "GeoModelKernel/GeoLogVol.h" +#include "GeoModelKernel/GeoPhysVol.h" +#include "GeoModelKernel/GeoFullPhysVol.h" +#include "GeoModelKernel/GeoNameTag.h" +#include "GeoModelKernel/GeoIdentifierTag.h" +#include "GeoModelKernel/GeoTransform.h" +#include "GeoModelKernel/GeoAlignableTransform.h" +#include "GeoModelKernel/GeoMaterial.h" +#include "GeoModelKernel/GeoShapeSubtraction.h" +#include "GeoModelKernel/GeoDefinitions.h" +#include "GaudiKernel/SystemOfUnits.h" + +#include <sstream> +#include <cmath> + +inline double sqr(double x) {return x * x;} + +SCT_HalfPlane::SCT_HalfPlane(const std::string & name, + TrackerDD::SCT_DetectorManager* detectorManager, + const SCT_GeometryManager* geometryManager, + SCT_MaterialManager* materials) + : SCT_UniqueComponentFactory(name, detectorManager, geometryManager, materials) +{ + getParameters(); + m_logVolume = preBuild(); +} + +SCT_HalfPlane::~SCT_HalfPlane() +{ + if (m_module != nullptr) delete m_module; +} + +void +SCT_HalfPlane::getParameters() +{ + const SCT_BarrelParameters * parameters = m_geometryManager->barrelParameters(); + const SCT_GeneralParameters * generalParameters = m_geometryManager->generalParameters(); + + m_safety = generalParameters->safety(); + m_etaHalfPitch = parameters->etaHalfPitch(); + m_phiHalfPitch = parameters->phiHalfPitch(); + m_depthHalfPitch = parameters->depthHalfPitch(); +} + +const GeoLogVol * +SCT_HalfPlane::preBuild() +{ + m_module = new SCT_Module("Module", m_detectorManager, m_geometryManager, m_materials); + // + // Active Layer Envelope extent + // Envelope for the active part (ie containing all the skis for the layer) + // + double activeWidth, activeThickness, activeLength; + + // Returns the outer dimensions of the active envelope + activeEnvelopeExtent(activeThickness, activeWidth, activeLength); + + // Add some safety + activeWidth += m_safety; + activeThickness += m_safety; + activeLength += m_safety; + + // + // Overall Layer Envelope extent + // + m_width = activeWidth; + m_thickness = activeThickness; + m_length = activeLength; + // + // Make envelope for layer + // + const GeoBox* halfPlaneEnvelopeBox = new GeoBox(0.5 * m_thickness, 0.5 * m_width, 0.5 * m_length); + GeoLogVol* logVolume = new GeoLogVol(getName(), halfPlaneEnvelopeBox, m_materials->gasMaterial()); + + // Check for overlap. + + return logVolume; +} + +GeoVPhysVol * +SCT_HalfPlane::build(SCT_Identifier id, int etaSign) +{ + // We make this a fullPhysVol + GeoFullPhysVol * halfPlane = new GeoFullPhysVol(m_logVolume); + + for (int module = 0; module < 4; module++) + { + int iz = 1 - 2 * (module % 2); + int iy = -3 + 2 * module; + int ix = iz; + int iEta = iz * etaSign; + halfPlane->add(new GeoNameTag("Module#" + intToString(module))); + halfPlane->add(new GeoIdentifierTag(module)); + id.setPhiModule(module); + id.setEtaModule(iEta); + GeoTrf::Transform3D position(GeoTrf::Translation3D(ix * m_depthHalfPitch, iy * m_phiHalfPitch, iz * m_etaHalfPitch)); + GeoAlignableTransform* transform = nullptr; + if ( module%2 == 0 ) + { + transform = new GeoAlignableTransform(position * GeoTrf::RotateX3D(180*Gaudi::Units::deg)); + } + else + { + transform = new GeoAlignableTransform(position); + } + halfPlane->add(transform); + GeoVPhysVol* modulePV = m_module->build(id); + halfPlane->add(modulePV); + m_detectorManager->addAlignableTransform(1, id.getWaferId(), transform, modulePV); + } + return halfPlane; +} + +void +SCT_HalfPlane::activeEnvelopeExtent(double & dx, double & dy, double & dz) +{ + double layerThickness = 2 * m_depthHalfPitch + m_module->thickness() + m_safety; // this is the x-coordinate (depth) of the modules + const GeoTrf::Vector3D* refPt = m_module->env1RefPointVector(); + double moduleHalfWidth = std::fabs(-refPt->y()-m_module->env1Width()/2); + double layerWidth = 2 * moduleHalfWidth + 6 * m_phiHalfPitch + m_safety; // this is the y-coordinate (phi) of the modules + double moduleHalfLength = std::fabs(-refPt->z()-m_module->env1Length()/2); + double layerLength = 2 * moduleHalfLength + 2 * m_etaHalfPitch + m_safety; // this is the z-coordinate (eta) of the modules + + dx = layerThickness; + dy = layerWidth; + dz = layerLength; +} diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Layer.cxx b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Plane.cxx similarity index 57% rename from Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Layer.cxx rename to Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Plane.cxx index d8dfcd75684c59d0dd8269af0a6955889e33df2f..164c40df58e84638d4bd1f1f56a7f80925d4a201 100644 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Layer.cxx +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Plane.cxx @@ -6,13 +6,13 @@ // CPW 17/8/06 // Version using new model of services from A. Tricoli // -#include "FaserSCT_GeoModel/SCT_Layer.h" +#include "FaserSCT_GeoModel/SCT_Plane.h" #include "FaserSCT_GeoModel/SCT_Identifier.h" #include "FaserSCT_GeoModel/SCT_GeometryManager.h" #include "FaserSCT_GeoModel/SCT_MaterialManager.h" #include "FaserSCT_GeoModel/SCT_BarrelParameters.h" #include "FaserSCT_GeoModel/SCT_GeneralParameters.h" -#include "FaserSCT_GeoModel/SCT_Ski.h" +#include "FaserSCT_GeoModel/SCT_HalfPlane.h" #include "FaserSCT_GeoModel/SCT_Module.h" #include "TrackerGeoModelUtils/ExtraMaterial.h" @@ -36,7 +36,7 @@ inline double sqr(double x) {return x * x;} -SCT_Layer::SCT_Layer(const std::string & name, +SCT_Plane::SCT_Plane(const std::string & name, TrackerDD::SCT_DetectorManager* detectorManager, const SCT_GeometryManager* geometryManager, SCT_MaterialManager* materials) @@ -46,29 +46,28 @@ SCT_Layer::SCT_Layer(const std::string & name, m_logVolume = preBuild(); } -SCT_Layer::~SCT_Layer() +SCT_Plane::~SCT_Plane() { } void -SCT_Layer::getParameters() +SCT_Plane::getParameters() { const SCT_BarrelParameters * parameters = m_geometryManager->barrelParameters(); const SCT_GeneralParameters * generalParameters = m_geometryManager->generalParameters(); - m_safety = generalParameters->safety(); - m_rowsPerLayer = parameters->rowsPerLayer(); + m_safety = generalParameters->safety(); + m_sideHalfPitch = parameters->sideHalfPitch(); } const GeoLogVol * -SCT_Layer::preBuild() +SCT_Plane::preBuild() { - std::cout << "Instantiating Ski" << std::endl; - m_ski = new SCT_Ski("Row", m_detectorManager, m_geometryManager, m_materials); + m_halfPlane = new SCT_HalfPlane("HalfPlane", m_detectorManager, m_geometryManager, m_materials); // // Active Layer Envelope extent - // Envelope for the active part (ie containing all the skis for the layer) + // Envelope for the active part (ie containing both half-planes for the layer) // double activeWidth, activeHeight, activeThickness; @@ -80,16 +79,12 @@ SCT_Layer::preBuild() activeHeight += m_safety; activeThickness += m_safety; - m_activeWidth = activeWidth; - m_activeHeight = activeHeight; - m_activeThickness = activeThickness; // // Overall Layer Envelope extent // - // Same as active dimensions, since there is no support material yet - m_width = m_activeWidth; - m_height = m_activeHeight; - m_thickness = m_activeThickness; + m_width = activeWidth; + m_height = activeHeight; + m_thickness = activeThickness; // // Make envelope for layer // @@ -102,43 +97,39 @@ SCT_Layer::preBuild() } GeoVPhysVol * -SCT_Layer::build(SCT_Identifier id) +SCT_Plane::build(SCT_Identifier id) { // We make this a fullPhysVol - GeoFullPhysVol * layer = new GeoFullPhysVol(m_logVolume); + GeoFullPhysVol * plane = new GeoFullPhysVol(m_logVolume); - double activeHeight = m_height - m_safety/2; - double rowHeight = m_ski->width(); - for (int iPhi = 0; iPhi < m_rowsPerLayer; iPhi++) + for (int side = 0; side < 2; side++) { - layer->add(new GeoNameTag("Row#"+intToString(iPhi))); - layer->add(new GeoIdentifierTag(iPhi)); - id.setPhiModule(iPhi); - GeoAlignableTransform* transform = new GeoAlignableTransform(GeoTrf::Translate3D(0.0, - (rowHeight - activeHeight)/2 + iPhi * rowHeight, - 0.0 ) * - GeoTrf::RotateY3D(90*Gaudi::Units::deg)); - layer->add(transform); - GeoVPhysVol * skiPV = m_ski->build(id); - layer->add(skiPV); - // Store alignable transform - m_detectorManager->addAlignableTransform(2, id.getWaferId(), transform, skiPV); + plane->add(new GeoNameTag("Side#" + intToString(side))); + plane->add(new GeoIdentifierTag(side)); + int iz = -1 + 2 * side; + GeoAlignableTransform* transform = new GeoAlignableTransform(GeoTrf::Translate3D(0.0, 0.0, iz * m_sideHalfPitch) * + GeoTrf::RotateY3D(-iz * 90 * Gaudi::Units::deg)); + plane->add(transform); + GeoVPhysVol* halfPlanePV = m_halfPlane->build(id, -iz); + plane->add(halfPlanePV); + // Store alignable transform; unclear if we can do this... + m_detectorManager->addAlignableTransform(2, id.getWaferId(), transform, halfPlanePV); } // Extra Material // TrackerDD::ExtraMaterial xMat(m_geometryManager->distortedMatManager()); // xMat.add(layer, "SCTLayer"); - return layer; + return plane; } void -SCT_Layer::activeEnvelopeExtent(double & dx, double & dy, double & dz) +SCT_Plane::activeEnvelopeExtent(double & dx, double & dy, double & dz) { // Do this in a very simple-minded and unrealistic way to start - double layerThickness = m_ski->thickness() + m_safety; // this is the x-coordinate of the module/ski and the z-coordinate of the layer - double layerWidth = m_ski->length() + m_safety; // this is the z-coordinate (eta) of the module/ski, and the x-coordinate of the layer - double layerHeight = m_rowsPerLayer * m_ski->width() + m_safety; // this is the y-coordinate (phi) of the module/ski, and the y-coordinate of the layer + double layerThickness = m_halfPlane->thickness() + 2 * m_sideHalfPitch + m_safety;// this is the x-coordinate of the modules and the z-coordinate of the plane + double layerWidth = m_halfPlane->length() + m_safety; // this is the z-coordinate (eta) of the modules, and the x-coordinate of the plane + double layerHeight = m_halfPlane->width() + m_safety; // this is the y-coordinate (phi) of the modules, and the y-coordinate of the plane dx = layerWidth; dy = layerHeight; diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Ski.cxx b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Ski.cxx deleted file mode 100644 index c01541f6d9e552d27ed0e44e59d403b703d12990..0000000000000000000000000000000000000000 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Ski.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// -// CPW 17/8/06 -// Version using new model of services from A. Tricoli -// -#include "FaserSCT_GeoModel/SCT_Ski.h" -#include "FaserSCT_GeoModel/SCT_Identifier.h" -#include "FaserSCT_GeoModel/SCT_GeometryManager.h" -#include "FaserSCT_GeoModel/SCT_MaterialManager.h" -#include "FaserSCT_GeoModel/SCT_BarrelParameters.h" -#include "FaserSCT_GeoModel/SCT_GeneralParameters.h" -#include "FaserSCT_GeoModel/SCT_Module.h" - -#include "TrackerGeoModelUtils/ExtraMaterial.h" -#include "TrackerReadoutGeometry/SCT_DetectorManager.h" - -#include "GeoModelKernel/GeoBox.h" -#include "GeoModelKernel/GeoLogVol.h" -#include "GeoModelKernel/GeoPhysVol.h" -#include "GeoModelKernel/GeoFullPhysVol.h" -#include "GeoModelKernel/GeoNameTag.h" -#include "GeoModelKernel/GeoIdentifierTag.h" -#include "GeoModelKernel/GeoTransform.h" -#include "GeoModelKernel/GeoAlignableTransform.h" -#include "GeoModelKernel/GeoMaterial.h" -#include "GeoModelKernel/GeoShapeSubtraction.h" -#include "GeoModelKernel/GeoDefinitions.h" -#include "GaudiKernel/SystemOfUnits.h" - -#include <sstream> -#include <cmath> - -inline double sqr(double x) {return x * x;} - -SCT_Ski::SCT_Ski(const std::string & name, - TrackerDD::SCT_DetectorManager* detectorManager, - const SCT_GeometryManager* geometryManager, - SCT_MaterialManager* materials) - : SCT_UniqueComponentFactory(name, detectorManager, geometryManager, materials) -{ - getParameters(); - m_logVolume = preBuild(); -} - -SCT_Ski::~SCT_Ski() -{ -} - -void -SCT_Ski::getParameters() -{ - const SCT_BarrelParameters * parameters = m_geometryManager->barrelParameters(); - const SCT_GeneralParameters * generalParameters = m_geometryManager->generalParameters(); - - m_safety = generalParameters->safety(); - m_modulesPerRow = parameters->modulesPerRow(); - -} - -const GeoLogVol * -SCT_Ski::preBuild() -{ - std::cout << "Instantiating Module" << std::endl; - m_module = new SCT_Module("Module", m_detectorManager, m_geometryManager, m_materials); - std::cout << "Module created" << std::endl; - // - // Active Layer Envelope extent - // Envelope for the active part (ie containing all the skis for the layer) - // - double activeWidth, activeThickness, activeLength; - - // Returns the outer dimensions of the active envelope - activeEnvelopeExtent(activeThickness, activeWidth, activeLength); - - // Add some safety - activeWidth += m_safety; - activeThickness += m_safety; - activeLength += m_safety; - - m_activeWidth = activeWidth; - m_activeThickness = activeThickness; - m_activeLength = activeLength; - // - // Overall Layer Envelope extent - // - // Same as active dimensions, since there is no support material yet - m_width = m_activeWidth; - m_thickness = m_activeThickness; - m_length = m_activeLength; - // - // Make envelope for layer - // - const GeoBox* skiEnvelopeBox = new GeoBox(0.5 * m_thickness, 0.5 * m_width, 0.5 * m_length); - GeoLogVol* logVolume = new GeoLogVol(getName(), skiEnvelopeBox, m_materials->gasMaterial()); - - // Check for overlap. - - return logVolume; -} - -GeoVPhysVol * -SCT_Ski::build(SCT_Identifier id) -{ - // We make this a fullPhysVol - GeoFullPhysVol * ski = new GeoFullPhysVol(m_logVolume); - - double activeLength = m_length - m_safety/2; - double moduleLength = m_module->length(); - for (int iEta = -m_modulesPerRow/2; iEta <= m_modulesPerRow/2; iEta++) - { - if (iEta == 0) continue; - ski->add(new GeoNameTag("Module#"+intToString(iEta))); - ski->add(new GeoIdentifierTag(iEta)); - id.setEtaModule(iEta); - double zEta = (iEta < 0 ? iEta + 0.5 : iEta - 0.5); - GeoAlignableTransform* transform = new GeoAlignableTransform(GeoTrf::Translate3D(0.0, - 0.0, - (moduleLength - activeLength)/2 + zEta * moduleLength)); - ski->add(transform); - GeoVPhysVol * modulePV = m_module->build(id); - ski->add(modulePV); - // Store alignable transform - m_detectorManager->addAlignableTransform(1, id.getWaferId(), transform, modulePV); - } - - return ski; -} - -void -SCT_Ski::activeEnvelopeExtent(double & dx, double & dy, double & dz) -{ - // Do this in a very simple-minded and unrealistic way to start - double layerThickness = m_module->thickness() + m_safety; // this is the x-coordinate of the module/ski - double layerWidth = m_module->width() + m_safety; // this is the y-coordinate (phi) of the module/ski - double layerLength = m_modulesPerRow * m_module->length() + m_safety; // this is the z-coordinate (eta) of the module/ski - - dx = layerThickness; - dy = layerWidth; - dz = layerLength; -} diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py index c72b8ad2eeacccbea9b2385ed3703fe64603c1f7..13b78ebe608baec81bfbdc0f57dbbd6cb5783f1e 100755 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py @@ -11,7 +11,7 @@ if __name__ == "__main__": ConfigFlags.Input.Files = defaultTestFiles.HITS ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" - ConfigFlags.Detector.SimulateSCT = False + ConfigFlags.Detector.SimulateFaserSCT = False ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.lock() diff --git a/Tracker/TrackerDetDescr/TrackerGeoModelUtils/CMakeLists.txt b/Tracker/TrackerDetDescr/TrackerGeoModelUtils/CMakeLists.txt index ba356f000cb5ef240c93ee37f217c41e6d972c41..c1afb08a4b29c743cb308c06e7817749ae292c76 100644 --- a/Tracker/TrackerDetDescr/TrackerGeoModelUtils/CMakeLists.txt +++ b/Tracker/TrackerDetDescr/TrackerGeoModelUtils/CMakeLists.txt @@ -14,6 +14,7 @@ atlas_depends_on_subdirs( PUBLIC Control/StoreGate DetectorDescription/GeoModel/GeoModelInterfaces DetectorDescription/GeoModel/GeoModelUtilities + DetectorDescription/GeoModel/GeoModelFaserUtilities DetectorDescription/GeoPrimitives DetectorDescription/GeometryDBSvc ) @@ -30,5 +31,5 @@ atlas_add_library( TrackerGeoModelUtils INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaKernel GaudiKernel StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES GeoModelUtilities ) + PRIVATE_LINK_LIBRARIES GeoModelUtilities GeoModelFaserUtilities ) diff --git a/Tracker/TrackerDetDescr/TrackerGeoModelUtils/src/DistortedMaterialManager.cxx b/Tracker/TrackerDetDescr/TrackerGeoModelUtils/src/DistortedMaterialManager.cxx index 321fa22cc07756332ee070522ae413e63c83ed7b..329f28e07372a713cd44c50d1aed73a2d7dce3a5 100755 --- a/Tracker/TrackerDetDescr/TrackerGeoModelUtils/src/DistortedMaterialManager.cxx +++ b/Tracker/TrackerDetDescr/TrackerGeoModelUtils/src/DistortedMaterialManager.cxx @@ -5,7 +5,7 @@ #include "TrackerGeoModelUtils/DistortedMaterialManager.h" #include "GeoModelInterfaces/StoredMaterialManager.h" -#include "GeoModelUtilities/DecodeVersionKey.h" +#include "GeoModelFaserUtilities/DecodeFaserVersionKey.h" #include "AthenaKernel/MsgStreamMember.h" #include "StoreGate/StoreGate.h" #include "RDBAccessSvc/IRDBAccessSvc.h" @@ -29,7 +29,7 @@ namespace TrackerDD { if (sc.isFailure()) log << MSG::FATAL << "Could not locate RDBAccessSvc" << endmsg; // Get version tag and node for Tracker. - DecodeVersionKey versionKey("Tracker"); + DecodeFaserVersionKey versionKey("Tracker"); std::string detectorKey = versionKey.tag(); std::string detectorNode = versionKey.node(); diff --git a/Tracker/TrackerDetDescr/TrackerGeoModelUtils/src/ServiceVolumeMaker.cxx b/Tracker/TrackerDetDescr/TrackerGeoModelUtils/src/ServiceVolumeMaker.cxx index f3e409f4d86b3ef8335aa8ced657b4deb409c724..d930bf90d4fd157c90901798e46fa8629fcebbc5 100755 --- a/Tracker/TrackerDetDescr/TrackerGeoModelUtils/src/ServiceVolumeMaker.cxx +++ b/Tracker/TrackerDetDescr/TrackerGeoModelUtils/src/ServiceVolumeMaker.cxx @@ -6,7 +6,7 @@ #include "TrackerGeoModelUtils/ServiceVolume.h" #include "TrackerGeoModelUtils/TrackerDDAthenaComps.h" -#include "GeoModelUtilities/DecodeVersionKey.h" +#include "GeoModelFaserUtilities/DecodeFaserVersionKey.h" #include "RDBAccessSvc/IRDBRecordset.h" #include "GeometryDBSvc/IGeometryDBSvc.h" diff --git a/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/CMakeLists.txt b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff1dad0f13a7f756d9226cd816b8e304d7d30f36 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/CMakeLists.txt @@ -0,0 +1,37 @@ +################################################################################ +# Package: TrackerSimEventAthenaPool +################################################################################ + +# Declare the package name: +atlas_subdir( TrackerSimEventAthenaPool ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PRIVATE + AtlasTest/TestTools + Database/AthenaPOOL/AthenaPoolCnvSvc + Database/AthenaPOOL/AthenaPoolUtilities + Database/AtlasSealCLHEP + GaudiKernel + Tracker/TrackerEventCnv/TrackerSimEventTPCnv + Tracker/TrackerSimEvent ) + +# External dependencies: +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_poolcnv_library( TrackerSimEventAthenaPoolPoolCnv + src/*.cxx + FILES TrackerSimEvent/FaserSiHitCollection.h + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib AthenaPoolUtilities AtlasSealCLHEP GaudiKernel TrackerSimEventTPCnv TrackerSimEvent ) + +atlas_add_dictionary( TrackerSimEventAthenaPoolCnvDict + TrackerSimEventAthenaPool/TrackerSimEventAthenaPoolCnvDict.h + TrackerSimEventAthenaPool/selection.xml + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib AthenaPoolUtilities AtlasSealCLHEP GaudiKernel TrackerSimEventTPCnv TrackerSimEvent ) + +# Install files from the package: +atlas_install_headers( TrackerSimEventAthenaPool ) +atlas_install_joboptions( share/*.py ) + diff --git a/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/TrackerSimDataCollection_p1.h b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/TrackerSimDataCollection_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..2298acdeb1092567af4e6b0e3d194a7184f22b62 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/TrackerSimDataCollection_p1.h @@ -0,0 +1,4 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + diff --git a/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/TrackerSimData_p1.h b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/TrackerSimData_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..2298acdeb1092567af4e6b0e3d194a7184f22b62 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/TrackerSimData_p1.h @@ -0,0 +1,4 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + diff --git a/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/TrackerSimEventAthenaPoolCnvDict.h b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/TrackerSimEventAthenaPoolCnvDict.h new file mode 100644 index 0000000000000000000000000000000000000000..e17d593c961a0c4b94b7ac70fa0aeee3e98353d1 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/TrackerSimEventAthenaPoolCnvDict.h @@ -0,0 +1,9 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SCINTSIMEVENTATHENAPOOLDICT_H +#define SCINTSIMEVENTATHENAPOOLDICT_H + + +#endif diff --git a/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/selection.xml b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..2eff49dff6688999d781e8922c8138fc7a36b1e8 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/TrackerSimEventAthenaPool/selection.xml @@ -0,0 +1,2 @@ +<lcgdict> +</lcgdict> diff --git a/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/src/FaserSiHitCollectionCnv.cxx b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/src/FaserSiHitCollectionCnv.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a4725975ac05e81da114e34f703a482c8df7fbf5 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/src/FaserSiHitCollectionCnv.cxx @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollectionCnv_p1.h" +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHit_p1.h" +#include "FaserSiHitCollectionCnv.h" + + +FaserSiHitCollection_PERS* FaserSiHitCollectionCnv::createPersistent(FaserSiHitCollection* transCont) { + MsgStream mlog(msgSvc(), "FaserSiHitCollectionConverter" ); + FaserSiHitCollectionCnv_PERS converter; + FaserSiHitCollection_PERS *persObj = converter.createPersistent( transCont, mlog ); + return persObj; +} + + +FaserSiHitCollection* FaserSiHitCollectionCnv::createTransient() { + MsgStream mlog(msgSvc(), "FaserSiHitCollectionConverter" ); + FaserSiHitCollectionCnv_p1 converter_p1; + + static const pool::Guid p1_guid("FF9508DE-3E25-425D-9556-16D319DCE0E1"); + + FaserSiHitCollection *trans_cont(0); + if( this->compareClassGuid(p1_guid)) { + std::unique_ptr< FaserSiHitCollection_p1 > col_vect( this->poolReadObject< FaserSiHitCollection_p1 >() ); + trans_cont = converter_p1.createTransient( col_vect.get(), mlog ); + } else { + throw std::runtime_error("Unsupported persistent version of Data container"); + } + return trans_cont; +} diff --git a/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/src/FaserSiHitCollectionCnv.h b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/src/FaserSiHitCollectionCnv.h new file mode 100644 index 0000000000000000000000000000000000000000..1467731fec80812428550f9c75cc3393dcf07047 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventAthenaPool/src/FaserSiHitCollectionCnv.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FASERSIHITCOLLECTIONCNV +#define FASERSIHITCOLLECTIONCNV + +#include "TrackerSimEvent/FaserSiHitCollection.h" +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollection_p1.h" +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollectionCnv_p1.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +// Gaudi +#include "GaudiKernel/MsgStream.h" +// typedef to the latest persistent version +typedef FaserSiHitCollection_p1 FaserSiHitCollection_PERS; +typedef FaserSiHitCollectionCnv_p1 FaserSiHitCollectionCnv_PERS; + +class FaserSiHitCollectionCnv : public T_AthenaPoolCustomCnv<FaserSiHitCollection, FaserSiHitCollection_PERS > { + friend class CnvFactory<FaserSiHitCollectionCnv>; +public: + FaserSiHitCollectionCnv(ISvcLocator* svcloc) : + T_AthenaPoolCustomCnv<FaserSiHitCollection, FaserSiHitCollection_PERS >( svcloc) {} +protected: + FaserSiHitCollection_PERS* createPersistent(FaserSiHitCollection* transCont); + FaserSiHitCollection* createTransient (); +}; + + +#endif diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/CMakeLists.txt b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..2272315026127c4232d2a10bbdfd4334458bfa63 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/CMakeLists.txt @@ -0,0 +1,37 @@ +############################################################################### +# Package: TrackerSimEventTPCnv +################################################################################ + +# Declare the package name: +atlas_subdir( TrackerSimEventTPCnv ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Database/AthenaPOOL/AthenaPoolCnvSvc + GaudiKernel + Generators/GeneratorObjectsTPCnv + Tracker/TrackerSimEvent + PRIVATE + AtlasTest/TestTools + Control/StoreGate + DetectorDescription/Identifier ) + +# External dependencies: +find_package( CLHEP ) +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_library( TrackerSimEventTPCnv + src/TrackerHits/*.cxx + PUBLIC_HEADERS TrackerSimEventTPCnv + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} + LINK_LIBRARIES GaudiKernel GeneratorObjectsTPCnv TrackerSimEvent AthenaPoolCnvSvcLib StoreGateLib SGtests + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} TestTools Identifier ) + +atlas_add_dictionary( TrackerSimEventTPCnvDict + TrackerSimEventTPCnv/TrackerSimEventTPCnvDict.h + TrackerSimEventTPCnv/selection.xml + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv TrackerSimEvent TestTools StoreGateLib SGtests Identifier TrackerSimEventTPCnv ) + diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHitCnv_p1.h b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHitCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..3a4bec3cdaca91575a51d5589310e9b89306c395 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHitCnv_p1.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FASERSIHITCNV_P1_H +#define FASERSIHITCNV_P1_H + +/* +Transient/Persistent converter for FaserSiHit class +*/ + +#include "TrackerSimEvent/FaserSiHit.h" +#include "FaserSiHit_p1.h" + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class MsgStream; + + +class FaserSiHitCnv_p1 : public T_AthenaPoolTPCnvBase<FaserSiHit, FaserSiHit_p1> +{ +public: + + FaserSiHitCnv_p1() {} + + virtual void persToTrans(const FaserSiHit_p1* persObj, FaserSiHit* +transObj, MsgStream &log); + virtual void transToPers(const FaserSiHit* transObj, FaserSiHit_p1* +persObj, MsgStream &log); +}; + + +#endif diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollectionCnv_p1.h b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollectionCnv_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..488221edc81c645ae56e453a2cafb18195f1242d --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollectionCnv_p1.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FASERSIHITCOLLECTIONCNV_P1_H +#define FASERSIHITCOLLECTIONCNV_P1_H + +// FaserSiHitCollectionCnv_p1, T/P separation of FaserSi Hits +// author D.Costanzo <davide.costanzo@cern.ch> +// author O.Arnaez <olivier.arnaez@cern.ch> + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "TrackerSimEvent/FaserSiHitCollection.h" +#include "FaserSiHitCollection_p1.h" + + +class FaserSiHitCollectionCnv_p1 : public T_AthenaPoolTPCnvBase<FaserSiHitCollection, FaserSiHitCollection_p1> +{ + public: + + FaserSiHitCollectionCnv_p1() {}; + + virtual FaserSiHitCollection* createTransient(const FaserSiHitCollection_p1* persObj, MsgStream &log); + + virtual void persToTrans(const FaserSiHitCollection_p1* persCont, + FaserSiHitCollection* transCont, + MsgStream &log) ; + virtual void transToPers(const FaserSiHitCollection* transCont, + FaserSiHitCollection_p1* persCont, + MsgStream &log) ; + + private: + + static const double m_persEneUnit; + static const double m_persLenUnit; + static const double m_persAngUnit; + static const double m_2bHalfMaximum; + static const int m_2bMaximum; +}; + +#endif diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollection_p1.h b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollection_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..fa4018a016b99d2bc7baf9e46a8711fa6278e787 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollection_p1.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FASERSIHITCOLLECTION_P1_H +#define FASERSIHITCOLLECTION_P1_H + +/* + +Authors: Davide Costanzo Rob Duxfield + +*/ + +#include <vector> +#include <string> + +class FaserSiHitCollection_p1 +{ + public: +/// Default constructor + FaserSiHitCollection_p1 (); + //private: + + std::vector<float> m_hit1_meanTime; // 1 element per string + std::vector<float> m_hit1_x0; // + std::vector<float> m_hit1_y0; // + std::vector<float> m_hit1_z0; // + std::vector<float> m_hit1_theta; // + std::vector<float> m_hit1_phi; // + std::vector<unsigned short> m_nHits; // + + std::vector<unsigned short> m_hitEne_2b; // 1 element per hit + std::vector<unsigned short> m_hitLength_2b; // + + std::vector<unsigned short> m_dTheta; // 1 element per hit except for first hit in string + std::vector<unsigned short> m_dPhi; // + + std::vector<float> m_hitEne_4b; // 1 element per hit with m_hitEne_2b[i] == 2**16 + + std::vector<float> m_hitLength_4b; // 1 element per hit with m_hitLength_2b[i] == 2**16 + + std::vector<unsigned long> m_barcode; + std::vector<unsigned short> m_mcEvtIndex; + std::vector<char> m_evtColl; + std::vector<unsigned short> m_nBC; + + std::vector<unsigned long> m_id; + std::vector<unsigned short> m_nId; +}; + + +// inlines + +inline +FaserSiHitCollection_p1::FaserSiHitCollection_p1 () {} + +#endif diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHit_p1.h b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHit_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..159caf56dd047bd4d7d7fa505b3076dd96b07534 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerHits/FaserSiHit_p1.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FASERSIHIT_P1_H +#define FASERSIHIT_P1_H + +#include "GeneratorObjectsTPCnv/HepMcParticleLink_p2.h" + +class FaserSiHit_p1 { + public: + float m_stX, m_stY, m_stZ; + float m_enX, m_enY, m_enZ; + float m_energyLoss; // deposited energy + float m_meanTime; // time of energy deposition + HepMcParticleLink_p2 m_partLink; + unsigned int m_ID; +}; +#endif diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnvDict.h b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnvDict.h new file mode 100644 index 0000000000000000000000000000000000000000..6146be90a917d1eaf49b9a7c9996f5cc4eb66262 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnvDict.h @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRACKERSIMEVENTTPCNV_TRACKERSIMEVENTTPCNVDICT_H +#define TRACKERSIMEVENTTPCNV_TRACKERSIMEVENTTPCNVDICT_H + +//----------------------------------------------------------------------------- +// +// file: TrackerSimEventTPCnvDict_p1.h +// +//----------------------------------------------------------------------------- + + +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHitCnv_p1.h" +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollectionCnv_p1.h" +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollection_p1.h" +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHit_p1.h" + +#endif // TRACKERSIMEVENTTPCNV_TRACKERSIMEVENTTPCNVDICT_H diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/selection.xml b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..72a04265e6367e090af8a543dd0a550d4e948af5 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/TrackerSimEventTPCnv/selection.xml @@ -0,0 +1,6 @@ +<lcgdict> + <!-- FaserSiHits --> + <class name="FaserSiHit_p1" /> + <class name="std::vector<FaserSiHit_p1>" /> + <class name="FaserSiHitCollection_p1" id="FF9508DE-3E25-425D-9556-16D319DCE0E1" /> +</lcgdict> diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCnv_p1.cxx b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a6e9c320e1118143f505e4f3ad3f7234a3afd498 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCnv_p1.cxx @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrackerSimEvent/FaserSiHit.h" +#include "Identifier/Identifier.h" +#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p2.h" + +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHit_p1.h" +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHitCnv_p1.h" + + +void +FaserSiHitCnv_p1::persToTrans(const FaserSiHit_p1* persObj, FaserSiHit* transObj, MsgStream &log) +{ + HepMcParticleLinkCnv_p2 HepMcPLCnv; + HepMcParticleLink link; + HepMcPLCnv.persToTrans(&(persObj->m_partLink),&link, log); + + *transObj = FaserSiHit (HepGeom::Point3D<double> (persObj->m_stX, + persObj->m_stY, + persObj->m_stZ), + HepGeom::Point3D<double> (persObj->m_enX, + persObj->m_enY, + persObj->m_enZ), + persObj->m_energyLoss, + persObj->m_meanTime, + link, + persObj->m_ID + ); +} + + +void +FaserSiHitCnv_p1::transToPers(const FaserSiHit* transObj, FaserSiHit_p1* persObj, MsgStream &log) +{ +// if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "FaserSiHitCnv_p1::transToPers called " << endmsg; + HepMcParticleLinkCnv_p2 HepMcPLCnv; + + HepGeom::Point3D<double> st = transObj->localStartPosition(); + persObj->m_stX = st.x(); + persObj->m_stY = st.y(); + persObj->m_stZ = st.z(); + + HepGeom::Point3D<double> en = transObj->localEndPosition(); + persObj->m_enX = en.x(); + persObj->m_enY = en.y(); + persObj->m_enZ = en.z(); + + persObj->m_energyLoss = transObj->energyLoss(); + persObj->m_meanTime = transObj->meanTime(); + persObj->m_ID = transObj->identify(); + HepMcPLCnv.transToPers(&(transObj->particleLink()),&(persObj->m_partLink), log); +} diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCollectionCnv_p1.cxx b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCollectionCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c31eed267329943e8a0627881057281bcb7248df --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCollectionCnv_p1.cxx @@ -0,0 +1,312 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrackerSimEvent/FaserSiHit.h" +#include "TrackerSimEvent/FaserSiHitCollection.h" +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollection_p1.h" +#include "TrackerSimEventTPCnv/TrackerHits/FaserSiHitCollectionCnv_p1.h" +#include "GeneratorObjects/HepMcParticleLink.h" + +#include <cmath> + +//CLHEP +#include "CLHEP/Geometry/Point3D.h" +// Gaudi +#include "GaudiKernel/MsgStream.h" +// Athena +#include "StoreGate/StoreGateSvc.h" + +// * * * stolen from eflowRec * * * // +inline double phicorr(double a) +{ + if (a <= -M_PI) + { + return a+(2*M_PI*floor(-(a-M_PI)/(2*M_PI))); + } + else if (a > M_PI) + { + return a-(2*M_PI*floor((a+M_PI)/(2*M_PI))); + } + else + { + return a; + } +} + +// * * * stolen from eflowRec * * * // +inline double cycle(double a, double b) +{ + double del = b-a; + if (del > M_PI) + { + return a+2.0*M_PI; + } + else if (del < -M_PI) + { + return a-2.0*M_PI; + } + else + { + return a; + } +} + + +const double FaserSiHitCollectionCnv_p1::m_persEneUnit = 1.0e-5; +const double FaserSiHitCollectionCnv_p1::m_persLenUnit = 1.0e-5; +const double FaserSiHitCollectionCnv_p1::m_persAngUnit = 1.0e-5; +const double FaserSiHitCollectionCnv_p1::m_2bHalfMaximum = pow(2.0, 15.0); +const int FaserSiHitCollectionCnv_p1::m_2bMaximum = (unsigned short)(-1); + + +void FaserSiHitCollectionCnv_p1::transToPers(const FaserSiHitCollection* transCont, FaserSiHitCollection_p1* persCont, MsgStream &/*log*/) +{ + // Finds hits belonging to a "string" (in which the end point of one hit is the same as the start point of the next) and + // persistifies the end point of each hit plus the start point of the first hit in each string. + // + // Further compression is achieved by optimising the storage of the position vectors:- start (x,y,z) and (theta,phi) of + // first hit are stored as floats, (delta_theta,delta_phi) relative to the fisrst hit are stored as 2 byte numbers and + // used to specify the hit direction. All hit lengths are stored as 2 byte numbers. + // + // Additional savings are achieved by storing the energy loss for each hit as a 2 byte number and only storing the mean + // time of the first hit per string. + // + // See http://indico.cern.ch/getFile.py/access?contribId=11&resId=2&materialId=slides&confId=30893 for more info. + + static const double dRcut = 1.0e-7; + static const double dTcut = 1.0; + + const HepMcParticleLink * lastLink=nullptr; + int lastId = -1; + double stringFirstTheta = 0.0; + double stringFirstPhi = 0.0; + double lastT = 0.0; + double persSumE = 0.0; + double transSumE = 0.0; + unsigned int idx = 0; + unsigned int endBC = 0; + unsigned int endId = 0; + unsigned int endHit = 0; + HepGeom::Point3D<double> lastTransEnd(0.0, 0.0, 0.0); + HepGeom::Point3D<double> lastPersEnd(0.0, 0.0, 0.0); + + for (FaserSiHitCollection::const_iterator it = transCont->begin(); it != transCont->end(); ++it) { + + FaserSiHitCollection::const_iterator siHit = it; + + + if ( !lastLink || (siHit->particleLink() != *lastLink) ) { + + // store barcode once for set of consecutive hits with same barcode + + lastLink = &(siHit->particleLink()); + persCont->m_barcode.push_back(lastLink->barcode()); + persCont->m_mcEvtIndex.push_back(lastLink->eventIndex()); + persCont->m_evtColl.push_back(lastLink->getEventCollectionAsChar()); + + if (idx > 0) { + persCont->m_nBC.push_back(idx - endBC); + endBC = idx; + } + } + + if ( (int)siHit->identify() != lastId ) { + + // store id once for set of consecutive hits with same barcode + + lastId = siHit->identify(); + persCont->m_id.push_back(lastId); + + if (idx > 0) { + persCont->m_nId.push_back(idx - endId); + endId = idx; + } + } + + HepGeom::Point3D<double> st = siHit->localStartPosition(); + HepGeom::Point3D<double> en = siHit->localEndPosition(); + + const double dx = st.x() - lastTransEnd.x(); + const double dy = st.y() - lastTransEnd.y(); + const double dz = st.z() - lastTransEnd.z(); + const double t = siHit->meanTime(); + + const double dRLast = sqrt(dx * dx + dy * dy + dz * dz); // dR between end of previous hit and start of current one + const double dTLast = fabs(t - lastT); + + CLHEP::Hep3Vector direction(0.0, 0.0, 0.0); + double theta = 0.0; + double phi = 0.0; + bool startNewString = false; + + if (dRLast < dRcut && dTLast < dTcut) { + + // hit is part of existing string + + direction = CLHEP::Hep3Vector( en.x() - lastPersEnd.x(), en.y() - lastPersEnd.y(), en.z() - lastPersEnd.z() ); + + theta = direction.theta(); + phi = phicorr( direction.phi() ); + + const int dTheta_2b = (int)( (theta - stringFirstTheta) / m_persAngUnit + m_2bHalfMaximum + 0.5 ); + const int dPhi_2b = (int)( (cycle(phi, stringFirstPhi) - stringFirstPhi) / m_persAngUnit + m_2bHalfMaximum + 0.5 ); + + if ( dTheta_2b < m_2bMaximum && dTheta_2b >= 0 && dPhi_2b < m_2bMaximum && dPhi_2b >= 0) { + persCont->m_dTheta.push_back(dTheta_2b); + persCont->m_dPhi.push_back(dPhi_2b); + theta = stringFirstTheta + ( (double)dTheta_2b - m_2bHalfMaximum ) * m_persAngUnit; + phi = stringFirstPhi + ( (double)dPhi_2b - m_2bHalfMaximum ) * m_persAngUnit; + phi = phicorr(phi); + } + else { + startNewString = true; + } + } + + if (startNewString || dRLast >= dRcut || dTLast >= dTcut) { + + // begin new hit string + + direction = CLHEP::Hep3Vector( en.x() - st.x(), en.y() - st.y(), en.z() - st.z() ); + + theta = direction.theta(); + phi = phicorr( direction.phi() ); + + persCont->m_hit1_meanTime.push_back(t); + persCont->m_hit1_x0.push_back(st.x()); + persCont->m_hit1_y0.push_back(st.y()); + persCont->m_hit1_z0.push_back(st.z()); + persCont->m_hit1_theta.push_back(theta); + persCont->m_hit1_phi.push_back(phi); + + lastPersEnd = HepGeom::Point3D<double>(st.x(), st.y(), st.z()); + + stringFirstTheta = theta; + stringFirstPhi = phi; + + if (idx > 0) { + persCont->m_nHits.push_back(idx - endHit); + endHit = idx; + } + } + + lastTransEnd = HepGeom::Point3D<double>(en.x(), en.y(), en.z()); + transSumE += siHit->energyLoss(); + + const int eneLoss_2b = (int)((transSumE - persSumE) / m_persEneUnit + 0.5); // calculated to allow recovery sum over + // whole hit string to chosen precision + + const int hitLength_2b = (int)(direction.mag() / m_persLenUnit + 0.5); // calculated to give the correct position to + // the chosen precision, NOT the length of the + // hit (small difference in practice). + double eneLoss = 0.0; + + if (eneLoss_2b >= m_2bMaximum) { + eneLoss = siHit->energyLoss(); + persCont->m_hitEne_2b.push_back(m_2bMaximum); + persCont->m_hitEne_4b.push_back(eneLoss); + } + else { + eneLoss = eneLoss_2b * m_persEneUnit; + persCont->m_hitEne_2b.push_back(eneLoss_2b); + } + + double length = 0.0; + + if (hitLength_2b >= m_2bMaximum) { + length = direction.mag(); + persCont->m_hitLength_2b.push_back(m_2bMaximum); + persCont->m_hitLength_4b.push_back(direction.mag()); + } + else { + length = hitLength_2b * m_persLenUnit; + persCont->m_hitLength_2b.push_back(hitLength_2b); + } + + CLHEP::Hep3Vector persDir(length, 0.0, 0.0); + persDir.setTheta(theta); + persDir.setPhi(phi); + + lastPersEnd = (CLHEP::Hep3Vector)lastPersEnd + persDir; + persSumE += eneLoss; + lastT = t; + + ++idx; + } + + persCont->m_nBC.push_back(idx - endBC); + persCont->m_nId.push_back(idx - endId); + persCont->m_nHits.push_back(idx - endHit); +} + + +FaserSiHitCollection* FaserSiHitCollectionCnv_p1::createTransient(const FaserSiHitCollection_p1* persObj, MsgStream &log) { + std::unique_ptr<FaserSiHitCollection> trans(std::make_unique<FaserSiHitCollection>("DefaultCollectionName",persObj->m_nHits.size())); + persToTrans(persObj, trans.get(), log); + return(trans.release()); +} + + +void FaserSiHitCollectionCnv_p1::persToTrans(const FaserSiHitCollection_p1* persCont, FaserSiHitCollection* transCont, MsgStream &/*log*/) +{ + unsigned int hitCount = 0; + unsigned int angleCount = 0; + unsigned int idxBC = 0; + unsigned int idxId = 0; + unsigned int idxEne4b = 0; + unsigned int idxLen4b = 0; + unsigned int endHit = 0; + unsigned int endBC = 0; + unsigned int endId = 0; + + for (unsigned int i = 0; i < persCont->m_nHits.size(); i++) { + + if (persCont->m_nHits[i]) { + + const unsigned int start = endHit; + endHit += persCont->m_nHits[i]; + + const double t0 = persCont->m_hit1_meanTime[i]; + const double theta0 = persCont->m_hit1_theta[i]; + const double phi0 = persCont->m_hit1_phi[i]; + HepGeom::Point3D<double> endLast(persCont->m_hit1_x0[i], persCont->m_hit1_y0[i], persCont->m_hit1_z0[i]); + + for (unsigned int j = start; j < endHit; j++) { + + if (j >= endBC + persCont->m_nBC[idxBC]) + endBC += persCont->m_nBC[idxBC++]; + + if (j >= endId + persCont->m_nId[idxId]) + endId += persCont->m_nId[idxId++]; + + const double eneLoss_2b = persCont->m_hitEne_2b[hitCount]; + const double hitLength_2b = persCont->m_hitLength_2b[hitCount]; + + const double eneLoss = (eneLoss_2b < m_2bMaximum) ? eneLoss_2b * m_persEneUnit : persCont->m_hitEne_4b[idxEne4b++]; + const double length = (hitLength_2b < m_2bMaximum) ? hitLength_2b * m_persLenUnit : persCont->m_hitLength_4b[idxLen4b++]; + + const double dTheta = (j > start) ? ((double)persCont->m_dTheta[angleCount] - m_2bHalfMaximum) * m_persAngUnit : 0.0; + const double dPhi = (j > start) ? ((double)persCont->m_dPhi[angleCount] - m_2bHalfMaximum) * m_persAngUnit : 0.0; + + const double meanTime = t0; + const double theta = theta0 + dTheta; + const double phi = phicorr(phi0 + dPhi); + + CLHEP::Hep3Vector r(length, 0.0, 0.0); + r.setTheta(theta); + r.setPhi(phi); + + HepGeom::Point3D<double> endThis( endLast + r ); + + HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), HepMcParticleLink::IS_INDEX ); + transCont->Emplace( endLast, endThis, eneLoss, meanTime, partLink, persCont->m_id[idxId]); + + endLast = endThis; + + ++hitCount; + if (j > start) ++angleCount; + } + } + } +} diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/CMakeLists.txt b/Tracker/TrackerG4/FaserSCT_G4_SD/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..25db44ba37ad1e3b7a377d53c72abe6e22791559 --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/CMakeLists.txt @@ -0,0 +1,36 @@ +################################################################################ +# 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 ) + diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/python/FaserSCT_G4_SDConfig.py b/Tracker/TrackerG4/FaserSCT_G4_SD/python/FaserSCT_G4_SDConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..57f860eb09e03351e8a362c17ed81a132742ec5c --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/python/FaserSCT_G4_SDConfig.py @@ -0,0 +1,19 @@ +# 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) + diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/python/FaserSCT_G4_SDConfigDb.py b/Tracker/TrackerG4/FaserSCT_G4_SD/python/FaserSCT_G4_SDConfigDb.py new file mode 100644 index 0000000000000000000000000000000000000000..6b53b95fcdabc04f0f8e61ec45ce38fc68a6c30b --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/python/FaserSCT_G4_SDConfigDb.py @@ -0,0 +1,5 @@ +# 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" ) diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/python/FaserSCT_G4_SDToolConfig.py b/Tracker/TrackerG4/FaserSCT_G4_SD/python/FaserSCT_G4_SDToolConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..7e93bcde411b7062402a3b9971ad98d6e9909918 --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/python/FaserSCT_G4_SDToolConfig.py @@ -0,0 +1,21 @@ +# 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) diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSD.cxx b/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSD.cxx new file mode 100644 index 0000000000000000000000000000000000000000..94f93a212927fdebe2e6e807200069a4fbf0aefe --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSD.cxx @@ -0,0 +1,122 @@ +/* + 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; +} diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSD.h b/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSD.h new file mode 100644 index 0000000000000000000000000000000000000000..cf9010c61e599d60865330d4c81d3a77577d3ff3 --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSD.h @@ -0,0 +1,50 @@ +/* + 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 diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSDTool.cxx b/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSDTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b1b3e9dd6b17ec4d18de340512e2fbc6835781f8 --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSDTool.cxx @@ -0,0 +1,32 @@ +/* + 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]); +} + diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSDTool.h b/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSDTool.h new file mode 100644 index 0000000000000000000000000000000000000000..2f53305d4514a2439b52cc2fabdf963241a24beb --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/src/FaserSctSensorSDTool.h @@ -0,0 +1,36 @@ +/* + 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 diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/src/components/FaserSCT_G4_SD_entries.cxx b/Tracker/TrackerG4/FaserSCT_G4_SD/src/components/FaserSCT_G4_SD_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d370c6e67b4cf22f51f67b8c382188c39e131628 --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/src/components/FaserSCT_G4_SD_entries.cxx @@ -0,0 +1,3 @@ +#include "../FaserSctSensorSDTool.h" + +DECLARE_COMPONENT( FaserSctSensorSDTool ) diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/test/FaserSCT_G4_SDToolConfig_test.py b/Tracker/TrackerG4/FaserSCT_G4_SD/test/FaserSCT_G4_SDToolConfig_test.py new file mode 100644 index 0000000000000000000000000000000000000000..8107803fba622d3ce39d4858417a587ecba8e116 --- /dev/null +++ b/Tracker/TrackerG4/FaserSCT_G4_SD/test/FaserSCT_G4_SDToolConfig_test.py @@ -0,0 +1,54 @@ +#!/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 SctSensorSDCfg + + acc, tool = SctSensorSDCfg(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----------------------" diff --git a/Tracker/TrackerSimEvent/CMakeLists.txt b/Tracker/TrackerSimEvent/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..50e54b552625898b5a04952b1f0cd1144aefddaf --- /dev/null +++ b/Tracker/TrackerSimEvent/CMakeLists.txt @@ -0,0 +1,39 @@ +################################################################################ +# Package: TrackerSimEvent +################################################################################ + +# Declare the package name: +atlas_subdir( TrackerSimEvent ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaKernel + Control/AthAllocators + Control/CxxUtils + Generators/GeneratorObjects + Simulation/HitManagement + PRIVATE + Control/StoreGate + Tracker/TrackerDetDescr/TrackerIdentifier ) + +# External dependencies: +find_package( CLHEP ) +find_package( Geant4 ) +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_library( TrackerSimEvent + src/*.cxx + PUBLIC_HEADERS TrackerSimEvent + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} + DEFINITIONS ${CLHEP_DEFINITIONS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} AthAllocators AthenaKernel CxxUtils GeneratorObjects HitManagement StoreGateLib SGtests + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} TrackerIdentifier ) + +atlas_add_dictionary( TrackerSimEventDict + TrackerSimEvent/TrackerSimEventDict.h + TrackerSimEvent/selection.xml + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthAllocators CxxUtils GeneratorObjects HitManagement StoreGateLib SGtests TrackerIdentifier TrackerSimEvent ) + diff --git a/Tracker/TrackerSimEvent/TrackerSimEvent/FaserSiHit.h b/Tracker/TrackerSimEvent/TrackerSimEvent/FaserSiHit.h new file mode 100644 index 0000000000000000000000000000000000000000..8669b8809f5a98c6c0e579dd4703f72448bcf539 --- /dev/null +++ b/Tracker/TrackerSimEvent/TrackerSimEvent/FaserSiHit.h @@ -0,0 +1,189 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// FaserSiHit.h +// Header file for class FaserSiHit +/////////////////////////////////////////////////////////////////// +// Class for the Faser SCT hits +/////////////////////////////////////////////////////////////////// + +#ifndef TRACKERSIMEVENT_FASERSIHIT_H +#define TRACKERSIMEVENT_FASERSIHIT_H + +// Data members classes +#include "CLHEP/Geometry/Point3D.h" +#include "GeneratorObjects/HepMcParticleLink.h" + +class FaserSiHit { + + /////////////////////////////////////////////////////////////////// + // Public methods: + /////////////////////////////////////////////////////////////////// +public: + + // Constructor with parameters: + // local start position of the energy deposit + // local end position of the energy deposit + // deposited energy + // time of energy deposition + // number of track which released this energy + // + FaserSiHit(const HepGeom::Point3D<double> &localStartPosition, + const HepGeom::Point3D<double> &localEndPosition, + const double energyLoss, + const double meanTime, + const int trackNumber, + const unsigned int id); + + FaserSiHit(const HepGeom::Point3D<double> &localStartPosition, + const HepGeom::Point3D<double> &localEndPosition, + const double energyLoss, + const double meanTime, + const int trackNumber, + const int, const int, const int, const int, const int); + // Constructor with parameters: + // local start position of the energy deposit + // local end position of the energy deposit + // deposited energy + // time of energy deposition + // link to particle which released this energy + // + FaserSiHit(const HepGeom::Point3D<double> &localStartPosition, + const HepGeom::Point3D<double> &localEndPosition, + const double energyLoss, + const double meanTime, + const HepMcParticleLink &track, + const unsigned int id); + + FaserSiHit(const HepGeom::Point3D<double> &localStartPosition, + const HepGeom::Point3D<double> &localEndPosition, + const double energyLoss, + const double meanTime, + const HepMcParticleLink &track, + const int, const int, const int, const int, const int); + // needed by athenaRoot + FaserSiHit(); + + // Destructor: + virtual ~FaserSiHit(); + + //move assignment defaulted + FaserSiHit & operator = (FaserSiHit &&) = default; + //assignment defaulted + FaserSiHit & operator = (const FaserSiHit &) = default; + //copy c'tor defaulted + FaserSiHit(const FaserSiHit &) = default; + + /////////////////////////////////////////////////////////////////// + // Const methods: + /////////////////////////////////////////////////////////////////// + + unsigned int identify() const; + + // local start position of the energy deposit: + HepGeom::Point3D<double> localStartPosition() const; + + HepGeom::Point3D<double> localEndPosition() const; + + // deposited energy: + double energyLoss() const; + + // time of energy deposition: FIXME name! + double meanTime() const; + + // Set the time of energy deposition: FIXME name! + void setMeanTime(float meanTime); + + // number of track which released this energy: + int trackNumber() const; + + // link to the particle generating the hit + const HepMcParticleLink& particleLink() const; + + // Station + int getStation() const; + + // Plane + int getPlane() const; + + // Row + int getRow() const; + + // Module + int getModule() const; + + // Sensor + int getSensor() const; + + // some print-out: + void print() const; + + bool operator < (const FaserSiHit& rhs) const + {return m_ID < rhs.m_ID;} + + /////////////////////////////////////////////////////////////////// + // Non-const methods: + /////////////////////////////////////////////////////////////////// + // Scale the length, used to go from cm to mm, of whatever we like. + void ScaleLength(double); + + /////////////////////////////////////////////////////////////////// + // Private data: + /////////////////////////////////////////////////////////////////// +private: + + float m_stX, m_stY, m_stZ; + float m_enX, m_enY, m_enZ; + float m_energyLoss; // deposited energy + float m_meanTime; // time of energy deposition + HepMcParticleLink m_partLink; + unsigned int m_ID; +public: + // enum + // { xDep = 2, xPhi = 0, xEta = 1}; +}; + + +/////////////////////////////////////////////////////////////////// +// Inline methods: +/////////////////////////////////////////////////////////////////// + +inline unsigned int FaserSiHit::identify() const +{ + return m_ID; +} + +inline double FaserSiHit::energyLoss() const +{ + return (double) m_energyLoss; +} + +inline double FaserSiHit::meanTime() const +{ + return (double) m_meanTime; +} + +inline void FaserSiHit::setMeanTime(float meanTime) +{ + m_meanTime=meanTime; +} + +inline const HepMcParticleLink& FaserSiHit::particleLink() const +{ + return m_partLink; +} + + + +/////////////////////////////////////////////////////////////////// +// open functions: +/////////////////////////////////////////////////////////////////// + +inline float hitTime(const FaserSiHit& hit) +{ + return (float) hit.meanTime(); +} + +#endif // TRACKERSIMEVENT_FASERSIHIT_H diff --git a/Tracker/TrackerSimEvent/TrackerSimEvent/FaserSiHitCollection.h b/Tracker/TrackerSimEvent/TrackerSimEvent/FaserSiHitCollection.h new file mode 100644 index 0000000000000000000000000000000000000000..bd3043b76023cc9faf95f333d86b12b5d274dfa6 --- /dev/null +++ b/Tracker/TrackerSimEvent/TrackerSimEvent/FaserSiHitCollection.h @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRACKERSIMEVENT_FASERSIHITCOLLECTION_H +#define TRACKERSIMEVENT_FASERSIHITCOLLECTION_H + +#include "TrackerSimEvent/FaserSiHit.h" +#include "HitManagement/AtlasHitsVector.h" +#include "AthenaKernel/CLASS_DEF.h" + +typedef AtlasHitsVector<FaserSiHit> FaserSiHitCollection; +typedef AtlasHitsVector<FaserSiHit>::iterator FaserSiHitIterator; +typedef AtlasHitsVector<FaserSiHit>::const_iterator FaserSiHitConstIterator; + +#ifndef __CINT__ + CLASS_DEF(FaserSiHitCollection, 1272740890, 1 ) +#endif + +#endif // TRACKERSIMEVENT_FASERSIHITCOLLECTION_H diff --git a/Tracker/TrackerSimEvent/TrackerSimEvent/FaserSiHitIdHelper.h b/Tracker/TrackerSimEvent/TrackerSimEvent/FaserSiHitIdHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..f4f7ddf0be4de47caabd993e5a0519702b896bcf --- /dev/null +++ b/Tracker/TrackerSimEvent/TrackerSimEvent/FaserSiHitIdHelper.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRACKERSIMEVENT_FASERSIHITIDHELPER +#define TRACKERSIMEVENT_FASERSIHITIDHELPER + +// +// This is a helper class to build an identifing integer used by +// the simulation. It inherits from HitIdHelper, in order to get +// all the packing and shifting for free. +// The class is a singleton and a static GetHelper() is provided +// the constructor calls the Initialize() method which sets all the +// field dimensions +// Methods are provided to get access to the ScintTracker Geometry +// description +// + + +// +// Base Class +#include "HitManagement/HitIdHelper.h" + +// This class is singleton and static method and variable are used. +#include "CxxUtils/checker_macros.h" +ATLAS_NO_CHECK_FILE_THREAD_SAFETY; + +class FaserSiHitIdHelper : HitIdHelper { + public: + // + // Access to the helper + static FaserSiHitIdHelper* GetHelper(); + // + // Info retrieval: + + // Station + int getStation(const int& hid) const; + + // Plane + int getPlane(const int& hid) const; + + // Row + int getRow(const int& hid) const; + + // Module + int getModule(const int& hid) const; + + // Sensor + int getSensor(const int& hid) const; + + // + // Info packing: + int buildHitId(const int, const int, const int, const int, const int) const; + + private: + // + // private constructor to have a singleton + FaserSiHitIdHelper(); + // + // Initialize the helper, only called by the constructor + void Initialize(); +}; + +#endif // TRACKERSIMEVENT_FASERSIHITIDHELPER diff --git a/Tracker/TrackerSimEvent/TrackerSimEvent/TrackerSimEventDict.h b/Tracker/TrackerSimEvent/TrackerSimEvent/TrackerSimEventDict.h new file mode 100644 index 0000000000000000000000000000000000000000..fe9005ae912fd5ba6e42d50df931f8de01113bf3 --- /dev/null +++ b/Tracker/TrackerSimEvent/TrackerSimEvent/TrackerSimEventDict.h @@ -0,0 +1,10 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRACKERSIMEVENT_TRACKERSIMEVENTDICT_H +#define TRACKERSIMEVENT_TRACKERSIMEVENTDICT_H + +#include "TrackerSimEvent/FaserSiHitCollection.h" + +#endif \ No newline at end of file diff --git a/Tracker/TrackerSimEvent/TrackerSimEvent/selection.xml b/Tracker/TrackerSimEvent/TrackerSimEvent/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..5a42f6d0a2567271333947308db269e8c145fe5f --- /dev/null +++ b/Tracker/TrackerSimEvent/TrackerSimEvent/selection.xml @@ -0,0 +1,5 @@ +<lcgdict> + <class name="AtlasHitsVector<FaserSiHit>" /> + <class name="std::vector<FaserSiHit>" /> + <class name="FaserSiHit" /> +</lcgdict> diff --git a/Tracker/TrackerSimEvent/src/FaserSiHit.cxx b/Tracker/TrackerSimEvent/src/FaserSiHit.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c622b461245d5c074d510f29c4f7f4dd83fdb8fd --- /dev/null +++ b/Tracker/TrackerSimEvent/src/FaserSiHit.cxx @@ -0,0 +1,175 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrackerSimEvent/FaserSiHit.h" +#include "TrackerSimEvent/FaserSiHitIdHelper.h" + +// Default consdtructor needed by athenaroot +// +FaserSiHit::FaserSiHit( ) : + m_stX(0.), + m_stY(0.), + m_stZ(0.), + m_enX(0.), + m_enY(0.), + m_enZ(0.), + m_energyLoss(0.), + m_meanTime(0.), + m_partLink(), + m_ID(0xffff) +{ + +} + +FaserSiHit::~FaserSiHit() {} + + +// Constructor +FaserSiHit::FaserSiHit(const HepGeom::Point3D<double> &localStartPosition, + const HepGeom::Point3D<double> &localEndPosition, + const double energyLoss, + const double meanTime, + const int trackNumber, + const unsigned int id) : + m_stX( (float) localStartPosition.x() ), + m_stY( (float) localStartPosition.y() ), + m_stZ( (float) localStartPosition.z() ), + m_enX( (float) localEndPosition.x() ), + m_enY( (float) localEndPosition.y() ), + m_enZ( (float) localEndPosition.z() ), + m_energyLoss(energyLoss), + m_meanTime(meanTime), + m_partLink(trackNumber), + m_ID(id) +{ +} + +// Constructor +FaserSiHit::FaserSiHit(const HepGeom::Point3D<double> &localStartPosition, + const HepGeom::Point3D<double> &localEndPosition, + const double energyLoss, + const double meanTime, + const int trackNumber, + const int station, + const int plane, + const int row, + const int module, + const int sensor) : + m_stX( (float) localStartPosition.x() ), + m_stY( (float) localStartPosition.y() ), + m_stZ( (float) localStartPosition.z() ), + m_enX( (float) localEndPosition.x() ), + m_enY( (float) localEndPosition.y() ), + m_enZ( (float) localEndPosition.z() ), + m_energyLoss(energyLoss), + m_meanTime(meanTime), + m_partLink(trackNumber), + m_ID(0) +{ + // Compress the location info into the integer: + m_ID = FaserSiHitIdHelper::GetHelper()->buildHitId(station, + plane, + row, + module, + sensor); +} + +// Constructor +FaserSiHit::FaserSiHit(const HepGeom::Point3D<double> &localStartPosition, + const HepGeom::Point3D<double> &localEndPosition, + const double energyLoss, + const double meanTime, + const HepMcParticleLink &track, + const unsigned int id) : + m_stX( (float) localStartPosition.x() ), + m_stY( (float) localStartPosition.y() ), + m_stZ( (float) localStartPosition.z() ), + m_enX( (float) localEndPosition.x() ), + m_enY( (float) localEndPosition.y() ), + m_enZ( (float) localEndPosition.z() ), + m_energyLoss(energyLoss), + m_meanTime(meanTime), + m_partLink(track), + m_ID(id) +{ +} + +// Constructor +FaserSiHit::FaserSiHit(const HepGeom::Point3D<double> &localStartPosition, + const HepGeom::Point3D<double> &localEndPosition, + const double energyLoss, + const double meanTime, + const HepMcParticleLink &track, + const int station, + const int plane, + const int row, + const int module, + const int sensor) : + m_stX( (float) localStartPosition.x() ), + m_stY( (float) localStartPosition.y() ), + m_stZ( (float) localStartPosition.z() ), + m_enX( (float) localEndPosition.x() ), + m_enY( (float) localEndPosition.y() ), + m_enZ( (float) localEndPosition.z() ), + m_energyLoss(energyLoss), + m_meanTime(meanTime), + m_partLink(track), + m_ID(0) +{ + // Compress the location info into the integer: + m_ID = FaserSiHitIdHelper::GetHelper()->buildHitId(station, + plane, + row, + module, + sensor); +} + +void FaserSiHit::ScaleLength(double sfactor) { + m_stX *= (float) sfactor; + m_stY *= (float) sfactor; + m_stZ *= (float) sfactor; + m_enX *= (float) sfactor; + m_enY *= (float) sfactor; + m_enZ *= (float) sfactor; +} + +HepGeom::Point3D<double> FaserSiHit::localStartPosition() const +{ + return HepGeom::Point3D<double>((double) m_stX, (double) m_stY, (double) m_stZ); +} + +HepGeom::Point3D<double> FaserSiHit::localEndPosition() const +{ + return HepGeom::Point3D<double>((double) m_enX, (double) m_enY, (double) m_enZ); +} + +int FaserSiHit::getStation() const { + return FaserSiHitIdHelper::GetHelper()->getStation(m_ID); +} +int FaserSiHit::getPlane() const { + return FaserSiHitIdHelper::GetHelper()->getPlane(m_ID); +} +int FaserSiHit::getRow() const { + return FaserSiHitIdHelper::GetHelper()->getRow(m_ID); +} +int FaserSiHit::getModule() const { + return FaserSiHitIdHelper::GetHelper()->getModule(m_ID); +} +int FaserSiHit::getSensor() const { + return FaserSiHitIdHelper::GetHelper()->getSensor(m_ID); +} + +void FaserSiHit::print() const { + std::cout << "*** Veto Hit " << std::endl; + std::cout << " Station Number " << getStation() << std::endl; + std::cout << " Plane Number " << getPlane() << std::endl; + std::cout << " Row Number " << getRow() << std::endl; + std::cout << " Module Number " << getModule() << std::endl; + std::cout << " Sensor " << getSensor() << std::endl; +} + +int FaserSiHit::trackNumber() const +{ + return m_partLink.barcode(); +} diff --git a/Tracker/TrackerSimEvent/src/FaserSiHitIdHelper.cxx b/Tracker/TrackerSimEvent/src/FaserSiHitIdHelper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6d3882dcd603a3d032abea775e181187844978bb --- /dev/null +++ b/Tracker/TrackerSimEvent/src/FaserSiHitIdHelper.cxx @@ -0,0 +1,105 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include <mutex> + +#include "TrackerSimEvent/FaserSiHitIdHelper.h" +#include "StoreGate/StoreGateSvc.h" +#include "StoreGate/StoreGate.h" +#include "TrackerIdentifier/FaserSCT_ID.h" + +#include "G4Types.hh" +#ifdef G4MULTITHREADED +# include "GaudiKernel/ContextSpecificPtr.h" +#endif + +static std::mutex sgMutex; + +// This class is singleton and static method and variable are used. +ATLAS_NO_CHECK_FILE_THREAD_SAFETY; + +// +// private constructor +FaserSiHitIdHelper::FaserSiHitIdHelper() :HitIdHelper() { + Initialize(); +} + +FaserSiHitIdHelper* FaserSiHitIdHelper::GetHelper() { +#ifdef G4MULTITHREADED + // Context-specific singleton + static Gaudi::Hive::ContextSpecificPtr<FaserSiHitIdHelper> helperPtr; + if(!helperPtr) helperPtr = new FaserSiHitIdHelper(); + return helperPtr.get(); +#else + static FaserSiHitIdHelper helper; + return &helper; +#endif +} + +void FaserSiHitIdHelper::Initialize() { + + // in which case eta module field is expanded. + // Need to lock this thread-unsafe retrieval + const FaserSCT_ID* pix; + StoreGateSvc* detStore(nullptr); + { + std::lock_guard<std::mutex> lock(sgMutex); + detStore = StoreGate::pointer("DetectorStore"); + if (detStore->retrieve(pix, "FaserSCT_ID").isFailure()) { pix = 0; } + } + + InitializeField("Station", -1, 1); + InitializeField("Plane", 0, 3); + InitializeField("Row", 0, 4); + InitializeField("Module", -1, 1); + InitializeField("Sensor", 0, 1); +} + +// Info retrieval: +// Station +int FaserSiHitIdHelper::getStation(const int& hid) const +{ + return this->GetFieldValue("Station", hid); +} + +// Plane +int FaserSiHitIdHelper::getPlane(const int& hid) const +{ + return this->GetFieldValue("Plane", hid); +} + +// Row +int FaserSiHitIdHelper::getRow(const int& hid) const +{ + return this->GetFieldValue("Row", hid); +} + +// Module +int FaserSiHitIdHelper::getModule(const int& hid) const +{ + return this->GetFieldValue("Module", hid); +} + +// Sensor +int FaserSiHitIdHelper::getSensor(const int& hid) const +{ + return this->GetFieldValue("Sensor", hid); +} + +// +// Info packing: +int FaserSiHitIdHelper::buildHitId(const int station, + const int plane, + const int row, + const int module, + const int sensor) const +{ + int theID(0); + this->SetFieldValue("Station", station, theID); + this->SetFieldValue("Plane", plane, theID); + this->SetFieldValue("Row", row, theID); + this->SetFieldValue("Module", module, theID); + this->SetFieldValue("Sensor", sensor, theID); + return theID; +} diff --git a/graphics/VTI12/README.md b/graphics/VTI12/README.md index 48657faa65a350efd6e421506ac61be7058056b4..c8b26dcb1ca074b01d5475be44aebd3cdaede6ae 100644 --- a/graphics/VTI12/README.md +++ b/graphics/VTI12/README.md @@ -4,6 +4,6 @@ To run on Calypso MC data (from an installation (run) directory): % export VP1PLUGINPATH=./lib -% vti12 -mc -noautoconf <input HITS or EVNT file> +% vti12 -mc -noautoconf -nosortdbreplicas <input HITS or EVNT file> -Note that VP1PLUGINPATH can be ninja-changed by asetup, and if it does not include the installation library folder, nothing will work \ No newline at end of file +Note that VP1PLUGINPATH can be ninja-changed by asetup, and if it does not include the Calypso installation library folder, nothing will work \ No newline at end of file diff --git a/graphics/VTI12/VTI12Systems/VTI12GeometrySystems/src/VP1GeometrySystem.cxx b/graphics/VTI12/VTI12Systems/VTI12GeometrySystems/src/VP1GeometrySystem.cxx index 787f6d923823995c5851697eb3fd3b51b3abb41a..75b176e5001cddedb229e06b3f3371c52ad9a302 100644 --- a/graphics/VTI12/VTI12Systems/VTI12GeometrySystems/src/VP1GeometrySystem.cxx +++ b/graphics/VTI12/VTI12Systems/VTI12GeometrySystems/src/VP1GeometrySystem.cxx @@ -270,7 +270,10 @@ void VP1GeometrySystem::Imp::addSubSystem(const VP1GeoFlags::SubSystemFlag& f, const std::string& matname, bool negatetreetopregexp, bool negatechildrenregexp, const QString& grandchildrenregexp, bool negategrandchildrenregexp) { - theclass->message("VP1GeometrySystem::Imp::addSubSystem - flag: '" + QString(f) + "' - matName: '" + str(matname.c_str()) + "'." ); + std::stringstream sstream; + sstream << std::hex << f; + std::string fHex = sstream.str(); + theclass->message("VP1GeometrySystem::Imp::addSubSystem - flag: '0x" + str(fHex.c_str()) + "' - matName: '" + str(matname.c_str()) + "'." ); QCheckBox * cb = controller->subSystemCheckBox(f); if (!cb) { diff --git a/graphics/VTI12/VTI12Systems/VTI12SimHitSystems/CMakeLists.txt b/graphics/VTI12/VTI12Systems/VTI12SimHitSystems/CMakeLists.txt index e70a808b9b2b84958e373f24c927ed66e07f625f..d4a5ab0c3deef552ee65ee9ba5f9f695806dfcf0 100644 --- a/graphics/VTI12/VTI12Systems/VTI12SimHitSystems/CMakeLists.txt +++ b/graphics/VTI12/VTI12Systems/VTI12SimHitSystems/CMakeLists.txt @@ -13,6 +13,7 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/GeoModel/GeoAdaptors DetectorDescription/GeoPrimitives Scintillator/ScintSimEvent + Tracker/TrackerSimEvent graphics/VTI12/VTI12Utils ) # External dependencies: @@ -34,5 +35,5 @@ atlas_add_library( VTI12SimHitSystems VTI12SimHitSystems/*.h src/*.h src/*.cxx s PUBLIC_HEADERS VTI12SimHitSystems PRIVATE_INCLUDE_DIRS ${COIN3D_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES VP1Base Qt5::Core Qt5::Widgets GL StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${EIGEN_LIBRARIES} GeoAdaptors GeoPrimitives ScintSimEvent VTI12Utils ) + PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${EIGEN_LIBRARIES} GeoAdaptors GeoPrimitives ScintSimEvent TrackerSimEvent VTI12Utils ) diff --git a/graphics/VTI12/VTI12Systems/VTI12SimHitSystems/src/VP1SimHitSystem.cxx b/graphics/VTI12/VTI12Systems/VTI12SimHitSystems/src/VP1SimHitSystem.cxx index 2d5b5be432692ec494929987ca115e3d69e9892b..3ac3e5063293a14e642f450dbe39fbdac333e86a 100755 --- a/graphics/VTI12/VTI12Systems/VTI12SimHitSystems/src/VP1SimHitSystem.cxx +++ b/graphics/VTI12/VTI12Systems/VTI12SimHitSystems/src/VP1SimHitSystem.cxx @@ -21,10 +21,10 @@ #include "ScintSimEvent/ScintHitCollection.h" #include "GeoAdaptors/GeoScintHit.h" -// #include "InDetSimEvent/SiHitCollection.h" +#include "TrackerSimEvent/FaserSiHitCollection.h" // #include "InDetSimEvent/TRTUncompressedHitCollection.h" // #include "GeoAdaptors/GeoTRTUncompressedHit.h" -// #include "GeoAdaptors/GeoSiHit.h" +#include "GeoAdaptors/GeoFaserSiHit.h" #include "VTI12Utils/VP1SGContentsHelper.h" @@ -241,6 +241,23 @@ void VP1SimHitSystem::buildHitTree(const QString& detector) else message("Unable to retrieve Preshower Hits"); } + else if (detector=="Tracker") + { + const FaserSiHitCollection* p_collection = nullptr; + if(sg->retrieve(p_collection, "SCT_Hits")==StatusCode::SUCCESS) + { + std::cout<<"Retrieved Si hit container with " << p_collection->size() << " hits" << std::endl; + for(FaserSiHitConstIterator i_hit=p_collection->begin(); i_hit!=p_collection->end(); ++i_hit) + { + GeoFaserSiHit ghit(*i_hit); + if(!ghit) continue; + HepGeom::Point3D<double> u = ghit.getGlobalPosition(); + hitVtxProperty->vertex.set1Value(hitCount++,u.x(),u.y(),u.z()); + } + } + else + message("Unable to retrieve SCT Hits"); + } // Add to the switch hitPointSet->numPoints=hitCount; hitPointSet->vertexProperty.setValue(hitVtxProperty); diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/CMakeLists.txt b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/CMakeLists.txt index bdb4b5753b0e5c250ee8f4e56bb2b13338fba023..69cf2097669434ab5cd30dfdeabacd842d9dc9eb 100644 --- a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/CMakeLists.txt +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/CMakeLists.txt @@ -26,12 +26,11 @@ atlas_depends_on_subdirs( Control/StoreGate DetectorDescription/FaserDetDescr Event/EventPrimitives -# ForwardDetectors/ForwardSimulation/ForwardRegion_SimEv Tracker/TrackerDetDescr/TrackerIdentifier Tracker/TrackerDetDescr/TrackerReadoutGeometry # InnerDetector/InDetRecEvent/InDetPrepRawData # InnerDetector/InDetRecEvent/InDetRIO_OnTrack - InnerDetector/InDetSimEvent + Tracker/TrackerSimEvent Scintillator/ScintDetDescr/ScintIdentifier Scintillator/ScintDetDescr/ScintReadoutGeometry Scintillator/ScintSimEvent @@ -81,7 +80,7 @@ atlas_add_library( VTI12TrackSystems VTI12TrackSystems/*.h src/*.cxx PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthContainers FaserDetDescr EventPrimitives ScintIdentifier ScintSimEvent ScintReadoutGeometry - TrackerIdentifier TrackerReadoutGeometry InDetSimEvent + TrackerIdentifier TrackerReadoutGeometry TrackerSimEvent #InDetPrepRawData InDetRIO_OnTrack Particle TrkDetDescrUtils TrkDetElementBase TrkVolumes TrkCompetingRIOsOnTrack diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/SimHitHandle_FaserSiHit.h b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/SimHitHandle_FaserSiHit.h new file mode 100644 index 0000000000000000000000000000000000000000..90e484473442e53fa9540af7011dd49e4f7d7f73 --- /dev/null +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/SimHitHandle_FaserSiHit.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +//////////////////////////////////////////////////////////////// +// // +// Header file for class SimHitHandle_SiHit // +// // +// Description: Handle for SiHit's // +// // +// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) // +// Initial version: March 2008 // +// // +//////////////////////////////////////////////////////////////// + +#ifndef SIMHITHANDLE_FASERSIHIT_H +#define SIMHITHANDLE_FASERSIHIT_H + +#include "VTI12TrackSystems/SimHitHandleBase.h" + +#include "GeoPrimitives/GeoPrimitives.h" +#include "TrkParameters/TrackParameters.h" + +class FaserSiHit; +class SimHitHandle_FaserSiHit : public SimHitHandleBase { +public: + + SimHitHandle_FaserSiHit( const FaserSiHit * ); + virtual ~SimHitHandle_FaserSiHit(); + + QString type() const { return "FaserSiHit"; }; + + Amg::Vector3D momentumDirection() const; + Amg::Vector3D posStart() const; + Amg::Vector3D posEnd() const; + double hitTime() const; + + const HepMcParticleLink& particleLink() const; + + Trk::TrackParameters * createTrackParameters() const; + +private: + + class Imp; + Imp * m_d; + +}; + +#endif diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/SimHitHandle_ScintHit.h b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/SimHitHandle_ScintHit.h index 36b75c49c20fbe38161ced69ae9bdb1e166a977c..0a85a21228b09d70239dde1144f2cfb7fd436b9a 100644 --- a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/SimHitHandle_ScintHit.h +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/SimHitHandle_ScintHit.h @@ -5,17 +5,17 @@ //////////////////////////////////////////////////////////////// // // -// Header file for class SimHitHandle_SiHit // +// Header file for class SimHitHandle_ScintHit // // // -// Description: Handle for SiHit's // +// Description: Handle for ScintHit's // // // // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) // // Initial version: March 2008 // // // //////////////////////////////////////////////////////////////// -#ifndef SIMHITHANDLE_SIHIT_H -#define SIMHITHANDLE_SIHIT_H +#ifndef SIMHITHANDLE_SCINTHIT_H +#define SIMHITHANDLE_SCINTHIT_H #include "VTI12TrackSystems/SimHitHandleBase.h" diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/TrackCollHandleBase.h b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/TrackCollHandleBase.h index 24bd5b39a4fe0cc693d259ce5a3f49b454f10c06..a9f4d894675278445ec8467c842019c451746492 100644 --- a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/TrackCollHandleBase.h +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/TrackCollHandleBase.h @@ -186,10 +186,7 @@ public slots: void setLabelTrkOffset(float); void setLabelPosOffsets(QList<int>); void setCustomColouredTSOSParts(TrackCommonFlags::TSOSPartsFlags); - void setUseShortTRTMeasurements(bool); - void setUseShortMDTMeasurements(bool); void setDrawMeasGlobalPositions(bool); - void setMeasurementsShorttubesScale(double); void setNStdDevForParamErrors(const double&); void setNumberOfPointsOnCircles(int); void setMaterialEffectsOnTrackScale(double); diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/TrackSystemController.h b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/TrackSystemController.h index b95ba96f06fb22b7304a23d5fda3f0b3d7170eeb..089a0a06231bc1d458f0ef26692ee65a1c37e77e 100644 --- a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/TrackSystemController.h +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/VTI12TrackSystems/TrackSystemController.h @@ -100,7 +100,6 @@ public: bool hideCustomSurfaces() const; bool hideTubeSurfaces() const; - double measurementsShorttubesScale() const; double nStdDevForParamErrors() const; bool parTubeErrorsDrawCylinders() const; int numberOfPointsOnCircles() const;//will return numbers in {4,8,12,16,...} @@ -188,7 +187,6 @@ signals: void shownTSOSPartsChanged(TrackCommonFlags::TSOSPartsFlags); void customColouredTSOSPartsChanged(TrackCommonFlags::TSOSPartsFlags); void drawMeasGlobalPositionsChanged(bool); - void measurementsShorttubesScaleChanged(double); void nStdDevForParamErrorsChanged(const double&); void parTubeErrorsDrawCylindersChanged(bool); void numberOfPointsOnCirclesChanged(int); @@ -243,7 +241,6 @@ private slots: void possibleChange_shownTSOSParts(); void possibleChange_customColouredTSOSParts(); void possibleChange_drawMeasGlobalPositions(); - void possibleChange_measurementsShorttubesScale(); void possibleChange_nStdDevForParamErrors(); void possibleChange_parTubeErrorsDrawCylinders(); void possibleChange_numberOfPointsOnCircles(); diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/SimHitHandle_FaserSiHit.cxx b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/SimHitHandle_FaserSiHit.cxx new file mode 100644 index 0000000000000000000000000000000000000000..afe89adfd5c53c740de609823d875a292a91b906 --- /dev/null +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/SimHitHandle_FaserSiHit.cxx @@ -0,0 +1,157 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +//////////////////////////////////////////////////////////////// +// // +// Implementation of class SimHitHandle_FaserSiHit // +// // +// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) // +// Initial version: March 2008 // +// // +//////////////////////////////////////////////////////////////// + +#include "VTI12TrackSystems/SimHitHandle_FaserSiHit.h" +#include "VP1Base/VP1Msg.h" +#include "VTI12Utils/VP1DetInfo.h" +#include "VTI12Utils/VP1ParticleData.h" + +#include "TrackerSimEvent/FaserSiHit.h" +#include "TrackerReadoutGeometry/SiDetectorElement.h" +#include "TrackerReadoutGeometry/SCT_DetectorManager.h" +#include "TrackerIdentifier/FaserSCT_ID.h" +#include "VTI12TrackSystems/VP1TrackSanity.h" + +//____________________________________________________________________ +class SimHitHandle_FaserSiHit::Imp { +public: + Imp( const FaserSiHit * h ) : thehit(h),detelem(0) {} + const FaserSiHit * thehit; + mutable const TrackerDD::SiDetectorElement * detelem; + bool ensureDetElemInit() const; + Amg::Vector3D localToGlobal(const HepGeom::Point3D<double>&) const; +}; + + +//____________________________________________________________________ +SimHitHandle_FaserSiHit::SimHitHandle_FaserSiHit(const FaserSiHit * h) + : SimHitHandleBase(), m_d(new Imp(h)) +{ + if (!h) + VP1Msg::message("SimHitHandle_FaserSiHit constructor ERROR: Received null hit pointer"); +} + +//____________________________________________________________________ +SimHitHandle_FaserSiHit::~SimHitHandle_FaserSiHit() +{ + delete m_d; +} + +//____________________________________________________________________ +bool SimHitHandle_FaserSiHit::Imp::ensureDetElemInit() const +{ + if (detelem) + return true; + int Station = thehit->getStation(); + + Identifier id = VP1DetInfo::sctIDHelper()->wafer_id( Station, + thehit->getPlane(), thehit->getRow(), thehit->getModule(), thehit->getSensor() ); + //fixme: id is_valid ? + detelem = VP1DetInfo::sctDetMgr()->getDetectorElement(id); + //Fixme : Handle case where detelem can not be found gracefully. And check pointers from VP1DetInfo!! + if (!detelem) + VP1Msg::messageDebug("SimHitHandle_FaserSiHit ERROR: Could not get detector element for hit!"); + return detelem!=0; +} + +//____________________________________________________________________ +//Trk::GlobalMomentum SimHitHandle_SiHit::momentumDirection() const +Amg::Vector3D SimHitHandle_FaserSiHit::momentumDirection() const +{ + if (VP1Msg::verbose()&&m_d->thehit->localEndPosition()==m_d->thehit->localStartPosition()) + VP1Msg::messageVerbose("SimHitHandle_SiHit::momentumDirection() ERROR: posStart()==posEnd()"); + return (posEnd()-posStart()).unit(); +} + +//____________________________________________________________________ +Amg::Vector3D SimHitHandle_FaserSiHit::Imp::localToGlobal( const HepGeom::Point3D<double>& local ) const +{ + if (!ensureDetElemInit()) + return Amg::Vector3D(0,0,0); + return Amg::Vector3D(Amg::EigenTransformToCLHEP(detelem->transformHit()) * local); +} + +//____________________________________________________________________ +Amg::Vector3D SimHitHandle_FaserSiHit::posStart() const +{ + return m_d->localToGlobal(m_d->thehit->localStartPosition()); +} + +//____________________________________________________________________ +Amg::Vector3D SimHitHandle_FaserSiHit::posEnd() const +{ + return m_d->localToGlobal(m_d->thehit->localEndPosition()); +} + +//____________________________________________________________________ +double SimHitHandle_FaserSiHit::hitTime() const +{ + return m_d->thehit->meanTime(); +} + +//____________________________________________________________________ +const HepMcParticleLink& SimHitHandle_FaserSiHit::particleLink() const +{ + return m_d->thehit->particleLink(); +} + +//____________________________________________________________________ +Trk::TrackParameters * SimHitHandle_FaserSiHit::createTrackParameters() const +{ + //Find charge and magnitude of momentum: + double c; + if ( !hasCharge() ) { + bool ok; + c = VP1ParticleData::particleCharge(pdg(),ok); + if (!ok) { + VP1Msg::message("SimHitHandle_FaserSiHit::createTrackParameters ERROR: Could not find particle charge (pdg=" + +QString::number(pdg())+"). Assuming charge=+1."); + c = +1.0; + } else { + if (VP1Msg::verbose()) + VP1Msg::messageVerbose("Looked up particle charge for tracker simhit with pdg code "+VP1Msg::str(pdg())+": "+VP1Msg::str(c)); + } + const_cast<SimHitHandle_FaserSiHit*>(this)->setCharge(c); + } else { + c = charge(); + } + + double mom = momentum(); + if (mom<=0) { + VP1Msg::message("SimHitHandle_FaserSiHit::createTrackParameters ERROR: Unknown momentum. Using 1 GeV"); + mom = 1*CLHEP::GeV; + } + + ////We could in principle get a surface like this: + // if (!m_d->ensureDetElemInit()) { + // VP1Msg::messageDebug("SimHitHandle_SiHit WARNING: Could not get detector element!"); + // return 0; + // } + // const Trk::PlaneSurface * surf + // = dynamic_cast<const Trk::PlaneSurface *>( &(m_d->detelem->surface())); + // if (!surf) { + // VP1Msg::message("SimHitHandle_SiHit::createTrackParameters ERROR: could not get Trk::PlaneSurface"); + // return 0; + // } + ////And then proceed to construct a new AtaPlane parameter with that + ////surface. However, that gives some problems, so instead we simply + ////create a perigee: + + const Amg::Vector3D globpos = posStart(); + +// const Trk::GlobalMomentum u(momentumDirection()); + const Amg::Vector3D u(momentumDirection()); + + return new Trk::Perigee(0, 0, u.phi(), u.theta(), c/mom, globpos); +} diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/SimHitHandle_ScintHit.cxx b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/SimHitHandle_ScintHit.cxx index bde3998c6407bf15c88f16c49276368982ed92b5..539aba6c5db193b62a8a0466d3e0e97fd8cd18fe 100644 --- a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/SimHitHandle_ScintHit.cxx +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/SimHitHandle_ScintHit.cxx @@ -58,7 +58,6 @@ bool SimHitHandle_ScintHit::Imp::ensureDetElemInit() const if (detelem) return true; int Station = thehit->getStation(); - //Not needed anymore and spoils stuff for slhc studies: if (Barrel== 1) Barrel = -2;//Found this hack in GeoSiHit. if (thehit->isVeto()) { Identifier id = VP1DetInfo::vetoIDHelper()->plate_id( Station, @@ -81,7 +80,6 @@ bool SimHitHandle_ScintHit::Imp::ensureDetElemInit() const } //____________________________________________________________________ -//Trk::GlobalMomentum SimHitHandle_SiHit::momentumDirection() const Amg::Vector3D SimHitHandle_ScintHit::momentumDirection() const { if (VP1Msg::verbose()&&m_d->thehit->localEndPosition()==m_d->thehit->localStartPosition()) @@ -150,13 +148,13 @@ Trk::TrackParameters * SimHitHandle_ScintHit::createTrackParameters() const ////We could in principle get a surface like this: // if (!m_d->ensureDetElemInit()) { - // VP1Msg::messageDebug("SimHitHandle_SiHit WARNING: Could not get detector element!"); + // VP1Msg::messageDebug("SimHitHandle_ScintHit WARNING: Could not get detector element!"); // return 0; // } // const Trk::PlaneSurface * surf // = dynamic_cast<const Trk::PlaneSurface *>( &(m_d->detelem->surface())); // if (!surf) { - // VP1Msg::message("SimHitHandle_SiHit::createTrackParameters ERROR: could not get Trk::PlaneSurface"); + // VP1Msg::message("SimHitHandle_ScintHit::createTrackParameters ERROR: could not get Trk::PlaneSurface"); // return 0; // } ////And then proceed to construct a new AtaPlane parameter with that diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollHandleBase.cxx b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollHandleBase.cxx index a37d36c151efcfc06c04a37bd879d627c8172e4a..66311b98c291f97be1d6f42ad024fa2baf32d89b 100644 --- a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollHandleBase.cxx +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollHandleBase.cxx @@ -65,10 +65,7 @@ public: TrackCommonFlags::TSOSPartsFlags shownTSOSParts; TrackCommonFlags::TSOSPartsFlags customColouredTSOSParts; - bool tsos_useShortTRTMeasurements; - bool tsos_useShortMDTMeasurements; bool tsos_drawMeasGlobalPositions; - double tsos_measurementsShorttubesScale; double tsos_nStdDevForParamErrors; int tsos_numberOfPointsOnCircles; double tsos_materialEffectsOnTrackScale; @@ -124,10 +121,7 @@ TrackCollHandleBase::TrackCollHandleBase( TrackSysCommonData * cd, m_d->customColouredTSOSParts = TrackCommonFlags::TSOS_NoObjects; //Fixme: to avoid double work on startup, these should have the same //values here as the controller defaults: - m_d->tsos_useShortTRTMeasurements = true; - m_d->tsos_useShortMDTMeasurements = true; m_d->tsos_drawMeasGlobalPositions = false; - m_d->tsos_measurementsShorttubesScale = 2.0; m_d->tsos_nStdDevForParamErrors = false; m_d->tsos_numberOfPointsOnCircles = 12; m_d->tsos_materialEffectsOnTrackScale = 2.0; @@ -260,9 +254,6 @@ void TrackCollHandleBase::setupSettingsFromController(TrackSystemController* con connect(controller,SIGNAL(drawMeasGlobalPositionsChanged(bool)),this,SLOT(setDrawMeasGlobalPositions(bool))); setDrawMeasGlobalPositions(controller->drawMeasGlobalPositions()); - connect(controller,SIGNAL(measurementsShorttubesScaleChanged(double)),this,SLOT(setMeasurementsShorttubesScale(double))); - setMeasurementsShorttubesScale(controller->measurementsShorttubesScale()); - connect(controller,SIGNAL(nStdDevForParamErrorsChanged(const double&)),this,SLOT(setNStdDevForParamErrors(const double&))); setNStdDevForParamErrors(controller->nStdDevForParamErrors()); @@ -887,35 +878,6 @@ void TrackCollHandleBase::setCustomColouredTSOSParts(TrackCommonFlags::TSOSParts actualSetCustomColouredTSOSPartsOnHandles(); } -//____________________________________________________________________ -void TrackCollHandleBase::setUseShortTRTMeasurements(bool b) -{ - if (m_d->tsos_useShortTRTMeasurements==b) - return; - m_d->tsos_useShortTRTMeasurements=b; - largeChangesBegin(); - trackHandleIterationBegin(); - TrackHandleBase* handle; - while ((handle=getNextTrackHandle())) - handle->updateShapes_TSOSWithMeasurements(); - largeChangesEnd(); -} - - -//____________________________________________________________________ -void TrackCollHandleBase::setUseShortMDTMeasurements(bool b) -{ - if (m_d->tsos_useShortMDTMeasurements==b) - return; - m_d->tsos_useShortMDTMeasurements=b; - largeChangesBegin(); - trackHandleIterationBegin(); - TrackHandleBase* handle; - while ((handle=getNextTrackHandle())) - handle->updateShapes_TSOSWithMeasurements(); - largeChangesEnd(); -} - //____________________________________________________________________ void TrackCollHandleBase::setDrawMeasGlobalPositions(bool b) { @@ -933,20 +895,6 @@ void TrackCollHandleBase::setDrawMeasGlobalPositions(bool b) largeChangesEnd(); } -//____________________________________________________________________ -void TrackCollHandleBase::setMeasurementsShorttubesScale(double n) -{ - if (m_d->tsos_measurementsShorttubesScale==n) - return; - m_d->tsos_useShortMDTMeasurements=n; - largeChangesBegin(); - trackHandleIterationBegin(); - TrackHandleBase* handle; - while ((handle=getNextTrackHandle())) - handle->updateShapes_TSOSWithMeasurements(); - largeChangesEnd(); -} - //____________________________________________________________________ void TrackCollHandleBase::setNStdDevForParamErrors(const double& nstddev) { diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollHandle_TruthTracks.cxx b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollHandle_TruthTracks.cxx index 950460e5de7a880a1d859b1a01ff681005d889a4..6fc90eb2de242f690a53a53ac7259aa6010cdda8 100644 --- a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollHandle_TruthTracks.cxx +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollHandle_TruthTracks.cxx @@ -17,7 +17,7 @@ #include "VTI12TrackSystems/SimHitHandleBase.h" #include "VTI12TrackSystems/SimHitHandle_TrackRecord.h" #include "VTI12TrackSystems/SimHitHandle_ScintHit.h" -// #include "VTI12TrackSystems/SimHitHandle_SiHit.h" +#include "VTI12TrackSystems/SimHitHandle_FaserSiHit.h" #include "VTI12TrackSystems/SimBarCode.h" #include "VTI12TrackSystems/TrackSystemController.h" #include "VP1Base/IVP1System.h" @@ -36,7 +36,7 @@ #include "VTI12Utils/VP1SGAccessHelper.h" #include "ScintSimEvent/ScintHitCollection.h" -#include "InDetSimEvent/SiHitCollection.h" +#include "TrackerSimEvent/FaserSiHitCollection.h" #include "CLHEP/Units/PhysicalConstants.h" @@ -66,7 +66,7 @@ public: // static SimHitHandleBase * createHitHandle( const TrackRecord * h ) { return new SimHitHandle_TrackRecord(h); } static SimHitHandleBase * createHitHandle( const TrackRecord& h ) { return new SimHitHandle_TrackRecord(&h); } static SimHitHandleBase * createHitHandle( const ScintHit& h ) { return new SimHitHandle_ScintHit(&h); } - // static SimHitHandleBase * createHitHandle( const SiHit& h ) { return new SimHitHandle_SiHit(&h); } + static SimHitHandleBase * createHitHandle( const FaserSiHit& h ) { return new SimHitHandle_FaserSiHit(&h); } static QString nameHepMCAugmentedEnd; static QString nameAugmentedOnly; @@ -120,8 +120,8 @@ QStringList TrackCollHandle_TruthTracks::availableCollections( IVP1System*sys ) VP1JobConfigInfo::hasTriggerGeometry() || VP1JobConfigInfo::hasPreshowerGeometry()) keys_scintillatorhits = sgcont.getKeys<ScintHitCollection>();//"VetoHits", "TriggerHits" and "PreshowerHits" - // if (VP1JobConfigInfo::hasSCTGeometry()) - // keys_siliconhits = sgcont.getKeys<SiHitCollection>();//"SCT_Hits" + if (VP1JobConfigInfo::hasSCTGeometry()) + keys_siliconhits = sgcont.getKeys<FaserSiHitCollection>();//"SCT_Hits" bool extrainfo = ! ( keys_scintillatorhits.empty() && keys_siliconhits.empty() && @@ -255,8 +255,8 @@ bool TrackCollHandle_TruthTracks::Imp::loadHitLists(std::map<SimBarCode,SimHitLi VP1JobConfigInfo::hasPreshowerGeometry()) // std::cout << "Called addHitCollections" << std::endl; addHitCollections<ScintHitCollection>(hitLists); - // if (VP1JobConfigInfo::hasSCTGeometry()) - // addHitCollections<SiHitCollection>(hitLists); + if (VP1JobConfigInfo::hasSCTGeometry()) + addHitCollections<FaserSiHitCollection>(hitLists); if (VP1Msg::verbose()) theclass->messageVerbose( "Found " + str( hitLists.size() ) + " lists of sim. hits."); diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollectionSettingsButton.cxx b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollectionSettingsButton.cxx index e66d9382e8b5fcb08cc31161498081aefb8b526a..9a19855b54743f4d3da3dfdcc6f09b228023ee29 100644 --- a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollectionSettingsButton.cxx +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackCollectionSettingsButton.cxx @@ -133,7 +133,6 @@ TrackCollectionSettingsButton::TrackCollectionSettingsButton(QWidget * parent,in connect(m_d->editwindow_ui.checkBox_cut_maxpt,SIGNAL(toggled(bool)),this,SLOT(possibleChange_cutAllowedPt())); connect(m_d->editwindow_ui.doubleSpinBox_cut_minpt_gev,SIGNAL(valueChanged(double)),this,SLOT(possibleChange_cutAllowedPt())); connect(m_d->editwindow_ui.doubleSpinBox_cut_maxpt_gev,SIGNAL(valueChanged(double)),this,SLOT(possibleChange_cutAllowedPt())); - connect(m_d->editwindow_ui.checkBox_cut_minpt,SIGNAL(toggled(bool)),this,SLOT(possibleChange_cutAllowedPt())); //connect(m_d->editwindow_ui.comboBox_momtype,SIGNAL(valueChanged(bool)),this,SLOT(possibleChange_cutAllowedPt())); connect(m_d->editwindow_ui.comboBox_momtype,SIGNAL(currentIndexChanged(int)),this,SLOT(possibleChange_cutAllowedPt())); @@ -403,16 +402,13 @@ QByteArray TrackCollectionSettingsButton::saveState() const{ serialise.save(m_d->editwindow_ui.checkBox_tracksUseBaseLightModel); serialise.save(m_d->editwindow_ui.checkBox_hideactualpaths); serialise.save(m_d->editwindow_ui.checkBox_defaultCuts); - serialise.save(m_d->editwindow_ui.checkBox_defaultCuts); serialise.save(m_d->editwindow_ui.checkBox_cut_minpt); serialise.save(m_d->editwindow_ui.checkBox_cut_maxpt); serialise.save(m_d->editwindow_ui.doubleSpinBox_cut_minpt_gev); serialise.save(m_d->editwindow_ui.doubleSpinBox_cut_maxpt_gev); - serialise.save(m_d->editwindow_ui.checkBox_cut_minpt); serialise.save(m_d->editwindow_ui.comboBox_momtype); serialise.save(m_d->editwindow_ui.etaPhiCutWidget); - serialise.save(m_d->editwindow_ui.etaPhiCutWidget); serialise.save(m_d->editwindow_ui.checkBox_cut_nhits_pixel); serialise.save(m_d->editwindow_ui.checkBox_cut_nhits_sct); serialise.save(m_d->editwindow_ui.checkBox_cut_nhits_trt); @@ -453,10 +449,8 @@ void TrackCollectionSettingsButton::restoreFromState( const QByteArray& ba){ state.restore(m_d->editwindow_ui.checkBox_cut_maxpt); state.restore(m_d->editwindow_ui.doubleSpinBox_cut_minpt_gev); state.restore(m_d->editwindow_ui.doubleSpinBox_cut_maxpt_gev); - state.restore(m_d->editwindow_ui.checkBox_cut_minpt); state.restore(m_d->editwindow_ui.comboBox_momtype); state.restore(m_d->editwindow_ui.etaPhiCutWidget); - state.restore(m_d->editwindow_ui.etaPhiCutWidget); state.restore(m_d->editwindow_ui.checkBox_cut_nhits_pixel); state.restore(m_d->editwindow_ui.checkBox_cut_nhits_sct); state.restore(m_d->editwindow_ui.checkBox_cut_nhits_trt); diff --git a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackSystemController.cxx b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackSystemController.cxx index d9aefef6f43e5bddbf049715f698f3879e521260..52301b7da6a25f090175b24e789b6de68b200ae1 100644 --- a/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackSystemController.cxx +++ b/graphics/VTI12/VTI12Systems/VTI12TrackSystems/src/TrackSystemController.cxx @@ -121,10 +121,7 @@ public: TrackCommonFlags::DETAILLEVEL last_assocObjDetailLevel; TrackCommonFlags::TSOSPartsFlags last_shownTSOSParts; TrackCommonFlags::TSOSPartsFlags last_customColouredTSOSParts; - bool last_useShortTRTMeasurements; - bool last_useShortMDTMeasurements; bool last_drawMeasGlobalPositions; - double last_measurementsShorttubesScale; double last_nStdDevForParamErrors; bool last_parTubeErrorsDrawCylinders; int last_numberOfPointsOnCircles; @@ -381,18 +378,6 @@ TrackSystemController::TrackSystemController(IVP1System * sys) connectToLastUpdateSlot(m_d->ui_ascobjs.checkBox_usecolour_materialeffectsontrack); connectToLastUpdateSlot(m_d->ui_ascobjs.checkBox_usecolour_surfaces); - // -> useShortTRTMeasurements - addUpdateSlot(SLOT(possibleChange_useShortTRTMeasurements())); - connectToLastUpdateSlot(m_d->ui_ascobjs.checkBox_measurements_shorttubes_trt); - - // -> useShortMDTMeasurements - addUpdateSlot(SLOT(possibleChange_useShortMDTMeasurements())); - connectToLastUpdateSlot(m_d->ui_ascobjs.checkBox_measurements_shorttubes_mdt); - - // -> useShortMDTMeasurements - addUpdateSlot(SLOT(possibleChange_measurementsShorttubesScale())); - connectToLastUpdateSlot(m_d->ui_ascobjs.doubleSpinBox_measurements_shorttubes_scale); - // -> nStdDevForParamErrors addUpdateSlot(SLOT(possibleChange_nStdDevForParamErrors())); connectToLastUpdateSlot(m_d->ui_ascobjs.doubleSpinBox_parerror_stddev); @@ -1542,13 +1527,6 @@ bool TrackSystemController::drawMeasGlobalPositions() const return m_d->ui_ascobjs.checkBox_measurements_drawGP->isChecked(); } - -//____________________________________________________________________ -double TrackSystemController::measurementsShorttubesScale() const -{ - return std::max(0.1*CLHEP::mm,m_d->ui_ascobjs.doubleSpinBox_measurements_shorttubes_scale->value()*CLHEP::cm); -} - //____________________________________________________________________ double TrackSystemController::nStdDevForParamErrors() const { @@ -2183,7 +2161,6 @@ POSSIBLECHANGE_IMP(trackLabelPosOffset) POSSIBLECHANGE_IMP(shownTSOSParts) POSSIBLECHANGE_IMP(customColouredTSOSParts) POSSIBLECHANGE_IMP(drawMeasGlobalPositions) -POSSIBLECHANGE_IMP(measurementsShorttubesScale) POSSIBLECHANGE_IMP(nStdDevForParamErrors) POSSIBLECHANGE_IMP(parTubeErrorsDrawCylinders) POSSIBLECHANGE_IMP(numberOfPointsOnCircles) diff --git a/graphics/VTI12/VTI12Utils/VTI12Utils/VP1JobConfigInfo.h b/graphics/VTI12/VTI12Utils/VTI12Utils/VP1JobConfigInfo.h index c4bc57979a3d5c499719f1d44c931a024530d698..6e13b37701a031f03161232c15fd0a2b85f407fe 100644 --- a/graphics/VTI12/VTI12Utils/VTI12Utils/VP1JobConfigInfo.h +++ b/graphics/VTI12/VTI12Utils/VTI12Utils/VP1JobConfigInfo.h @@ -37,7 +37,7 @@ public: static bool hasPreshowerGeometry(); // static bool hasPixelGeometry(); - static bool hasSCTGeometry() { return false; } + static bool hasSCTGeometry(); // static bool hasTRTGeometry(); //Top geomodel volume link (not strictly "JobConfig", but here it is): diff --git a/graphics/VTI12/VTI12Utils/src/VP1DetInfo.cxx b/graphics/VTI12/VTI12Utils/src/VP1DetInfo.cxx index c1a2c5b347b8a2aff96793cb318455108808d5b9..b1f26b327cabf70abf00404ee979e7a6d6b41b01 100644 --- a/graphics/VTI12/VTI12Utils/src/VP1DetInfo.cxx +++ b/graphics/VTI12/VTI12Utils/src/VP1DetInfo.cxx @@ -150,10 +150,6 @@ bool VP1DetInfo::isUnsafe( const Identifier& id ) { } if (idhelper->is_tracker(id)) { - // if (!VP1JobConfigInfo::hasTRTGeometry() && idhelper->is_trt(id)) - // return true; - // if (!VP1JobConfigInfo::hasPixelGeometry() && idhelper->is_pixel(id)) - // return true; if (!VP1JobConfigInfo::hasSCTGeometry() && idhelper->is_sct(id)) return true; } diff --git a/graphics/VTI12/VTI12Utils/src/VP1JobConfigInfo.cxx b/graphics/VTI12/VTI12Utils/src/VP1JobConfigInfo.cxx index 6e7fe53a7ba5128c3b7f60b0741316f0d6400362..443516f2344bc1622621a1456d8a182aa328746b 100644 --- a/graphics/VTI12/VTI12Utils/src/VP1JobConfigInfo.cxx +++ b/graphics/VTI12/VTI12Utils/src/VP1JobConfigInfo.cxx @@ -89,7 +89,7 @@ void VP1JobConfigInfo::Imp::ensureInit() VP1Msg::messageVerbose("VP1JobConfigInfo => hasPreshowerGeometry = "+QString(hasPreshowerGeometry?"On":"Off")); // VP1Msg::messageVerbose("VP1JobConfigInfo => hasPixelGeometry = "+QString(hasPixelGeometry?"On":"Off")); - // VP1Msg::messageVerbose("VP1JobConfigInfo => hasSCTGeometry = "+QString(hasSCTGeometry?"On":"Off")); + VP1Msg::messageVerbose("VP1JobConfigInfo => hasSCTGeometry = "+QString(hasSCTGeometry?"On":"Off")); // VP1Msg::messageVerbose("VP1JobConfigInfo => hasTRTGeometry = "+QString(hasTRTGeometry?"On":"Off")); } @@ -102,7 +102,7 @@ bool VP1JobConfigInfo::hasTriggerGeometry() { if (!Imp::initialised) Imp::ensure bool VP1JobConfigInfo::hasPreshowerGeometry() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasPreshowerGeometry; } // bool VP1JobConfigInfo::hasPixelGeometry() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasPixelGeometry; } -// bool VP1JobConfigInfo::hasSCTGeometry() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasSCTGeometry; } +bool VP1JobConfigInfo::hasSCTGeometry() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasSCTGeometry; } // bool VP1JobConfigInfo::hasTRTGeometry() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasTRTGeometry; } //____________________________________________________________________ @@ -154,6 +154,8 @@ bool VP1JobConfigInfo::Imp::actualInit( StoreGateSvc* detStore ) if ( !hasVetoGeometry && name=="Veto") hasVetoGeometry = true; if ( !hasTriggerGeometry && name=="Trigger") hasTriggerGeometry = true; if ( !hasPreshowerGeometry && name=="Preshower") hasPreshowerGeometry = true; + if ( !hasSCTGeometry && name=="SCT") hasSCTGeometry = true; + //FIXME: Look for CavernInfra as well!!! av.next(); // increment volume cursor.