diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsMaterialTrackWriterSvc.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsMaterialTrackWriterSvc.h index d36b5c8bdd603b30f9957ae125ae14c5b1dabe19..1274e8fa4c99302b08ffe3c03a0195745229700b 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsMaterialTrackWriterSvc.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsMaterialTrackWriterSvc.h @@ -20,60 +20,56 @@ #include "TTree.h" #include "TFile.h" -namespace Acts { - class MaterialTrack; -} - class ActsMaterialTrackWriterSvc : public extends<AthService, IActsMaterialTrackWriterSvc> { public: - + virtual StatusCode initialize() override; virtual StatusCode finalize() override; - + ActsMaterialTrackWriterSvc( const std::string& name, ISvcLocator* svc ); void - write(const Acts::MaterialTrack& mTrack) override; + write(const Acts::RecordedMaterialTrack& mTrack) override; private: - std::deque<Acts::MaterialTrack> m_mTracks; + std::deque<Acts::RecordedMaterialTrack> m_mTracks; std::mutex m_writeMutex; std::thread m_writeThread; std::atomic<bool> m_doEnd; TFile* p_tFile; TTree* p_tree; - // tree branches - double m_treeX0; - double m_treeL0; - double m_treeTheta; - double m_treePhi; - double m_treeT; - double m_treedInX0; - double m_treedInL0; - - //std::vector<std::array<double, 3>> m_treeStepPos; - std::vector<double> m_treeStepX0; - std::vector<double> m_treeStepL0; - std::vector<double> m_treeStepA; - std::vector<double> m_treeStepZ; - std::vector<double> m_treeStepRho; - std::vector<double> m_treeStepT; - std::vector<double> m_treeStepdInX0; - std::vector<double> m_treeStepdInL0; - - std::vector<double> m_treeStepPosX; - std::vector<double> m_treeStepPosY; - std::vector<double> m_treeStepPosZ; - std::vector<double> m_treeStepPosR; - std::vector<double> m_treeStepPosPhi; - - std::vector<ULong64_t> m_treeStepGeoID; + float m_v_x; ///< start global x + float m_v_y; ///< start global y + float m_v_z; ///< start global z + float m_v_px; ///< start global momentum x + float m_v_py; ///< start global momentum y + float m_v_pz; ///< start global momentum z + float m_v_phi; ///< start phi direction + float m_v_eta; ///< start eta direction + float m_tX0; ///< thickness in X0/L0 + float m_tL0; ///< thickness in X0/L0 + + std::vector<float> m_step_sx; ///< step x (start) position (optional) + std::vector<float> m_step_sy; ///< step y (start) position (optional) + std::vector<float> m_step_sz; ///< step z (start) position (optional) + std::vector<float> m_step_x; ///< step x position + std::vector<float> m_step_y; ///< step y position + std::vector<float> m_step_z; ///< step z position + std::vector<float> m_step_ex; ///< step x (end) position (optional) + std::vector<float> m_step_ey; ///< step y (end) position (optional) + std::vector<float> m_step_ez; ///< step z (end) position (optional) + std::vector<float> m_step_length; ///< step length + std::vector<float> m_step_X0; ///< step material x0 + std::vector<float> m_step_L0; ///< step material l0 + std::vector<float> m_step_A; ///< step material A + std::vector<float> m_step_Z; ///< step material Z + std::vector<float> m_step_rho; ///< step material rho void writerThread(); - void doWrite(const Acts::MaterialTrack &mTrack); + void doWrite(const Acts::RecordedMaterialTrack &mTrack); // jobOptions properties Gaudi::Property<std::string> m_filePath{this, "FilePath", "MaterialTracks.root", "Output root file for charged particle"}; @@ -83,4 +79,4 @@ private: }; -#endif +#endif diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/IActsMaterialTrackWriterSvc.h b/Tracking/Acts/ActsGeometry/ActsGeometry/IActsMaterialTrackWriterSvc.h index 8f3804142e7656afd9b17835078149bc659a1f8f..22c7e6cbdd93f6d4c9cc6f06112d554ec19990d8 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/IActsMaterialTrackWriterSvc.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/IActsMaterialTrackWriterSvc.h @@ -8,21 +8,19 @@ #include "GaudiKernel/IInterface.h" #include "Acts/EventData/TrackParameters.hpp" -namespace Acts { -class MaterialTrack; -} +#include "Acts/Propagator/MaterialInteractor.hpp" class IActsMaterialTrackWriterSvc : virtual public IInterface { public: - + DeclareInterfaceID(IActsMaterialTrackWriterSvc, 1, 0); IActsMaterialTrackWriterSvc() {;} - + void virtual - write(const Acts::MaterialTrack& mTrack) = 0; + write(const Acts::RecordedMaterialTrack& mTrack) = 0; }; -#endif +#endif diff --git a/Tracking/Acts/ActsGeometry/CMakeLists.txt b/Tracking/Acts/ActsGeometry/CMakeLists.txt index 54fc8386ae0b2b31daefb0c3a8883a747a4e2fc6..285603e381f6c1ec7e8ba488b8d4650e5a6565ab 100755 --- a/Tracking/Acts/ActsGeometry/CMakeLists.txt +++ b/Tracking/Acts/ActsGeometry/CMakeLists.txt @@ -18,7 +18,8 @@ atlas_depends_on_subdirs( PUBLIC MagneticField/MagFieldInterfaces Calorimeter/CaloDetDescr Tracking/Acts/ActsGeometryInterfaces - Tracking/Acts/ActsInterop ) + Tracking/Acts/ActsInterop + Tracking/TrkDetDescr/TrkGeometry) # External dependencies: find_package( CLHEP ) @@ -42,16 +43,21 @@ atlas_add_library( ActsGeometryLib AthenaKernel ActsInteropLib ActsGeometryInterfacesLib - ActsCore) + ActsCore + TrkGeometry) atlas_add_component( ActsGeometry src/ActsExtrapolationAlg.cxx src/ActsWriteTrackingGeometry.cxx src/ActsWriteTrackingGeometryTransforms.cxx src/ActsExtrapolationTool.cxx + src/ActsMaterialMapping.cxx + src/ActsSurfaceMappingTool.cxx src/ActsObjWriterTool.cxx #src/ActsExCellWriterSvc.cxx - #src/ActsMaterialTrackWriterSvc.cxx + src/ActsMaterialStepConverterTool.cxx + #src/ActsMaterialJsonWriterTool.cxx + src/ActsMaterialTrackWriterSvc.cxx #src/GeomShiftCondAlg.cxx src/ActsAlignmentCondAlg.cxx src/NominalAlignmentCondAlg.cxx @@ -61,10 +67,10 @@ atlas_add_component( ActsGeometry src/components/*.cxx PUBLIC_HEADERS ActsGeometry INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} EventInfo CaloDetDescrLib - ActsInteropLib + ActsInteropLib ActsGeometryLib ActsGeometryInterfacesLib ActsCore) @@ -73,4 +79,3 @@ atlas_add_component( ActsGeometry atlas_install_headers( ActsGeometry ) atlas_install_joboptions( share/*.py ) atlas_install_python_modules( python/*.py ) - diff --git a/Tracking/Acts/ActsGeometry/share/ActsExtrapolationAlg.py b/Tracking/Acts/ActsGeometry/share/ActsExtrapolationAlg.py index 76328e786a3b4f3a57062c2d5e89486cefdc592d..68aeec525e28a34e8d162dbc0054cef73c2a30df 100644 --- a/Tracking/Acts/ActsGeometry/share/ActsExtrapolationAlg.py +++ b/Tracking/Acts/ActsGeometry/share/ActsExtrapolationAlg.py @@ -76,7 +76,6 @@ condSeq += ActsGeometryConf.ActsAlignmentCondAlg("ActsAlignCondAlg", # OutputLevel=VERBOSE) ## END OF CONDITIONS SETUP - from AthenaCommon.AppMgr import ServiceMgr # set up and configure the acts geometry construction diff --git a/Tracking/Acts/ActsGeometry/share/ActsMaterialMapping_jobOptions.py b/Tracking/Acts/ActsGeometry/share/ActsMaterialMapping_jobOptions.py index 6283e09a0e480e0e1f1bb99cbfdb3af71915cf3c..f8890a8aa8558462fbee65ca3e47e49940c6809a 100644 --- a/Tracking/Acts/ActsGeometry/share/ActsMaterialMapping_jobOptions.py +++ b/Tracking/Acts/ActsGeometry/share/ActsMaterialMapping_jobOptions.py @@ -18,13 +18,13 @@ ServiceMgr.MessageSvc.defaultLimit = 20000 DetFlags.ID_setOn() DetFlags.detdescr.pixel_setOn() DetFlags.detdescr.SCT_setOn() - +DetFlags.Calo_setOff() # MC or data - affects which conditions database instance is used globalflags.DataSource='geant4' #globalflags.DataSource='data' -# Select the geometry version. +# Select the geometry version. globalflags.DetDescrVersion = 'ATLAS-R2-2016-00-00-00' # print "HERE" @@ -43,15 +43,11 @@ from IOVDbSvc.CondDB import conddb conddb.setGlobalTag('OFLCOND-SIM-00-00-00') # conddb.addOverride("/Indet/Align", "InDetAlign_R2_Nominal") -import glob -fileList = glob.glob("*root*") #/tmp/salzburg/*/*.root*") - from AthenaCommon.AppMgr import ServiceMgr # Read material step file -import AthenaPoolCnvSvc.ReadAthenaPool -ServiceMgr.EventSelector.InputCollections = ["MaterialStepFile_1e6.root"] - +import AthenaPoolCnvSvc.ReadAthenaPool +ServiceMgr.EventSelector.InputCollections = ["MaterialStepFile_test.root"] from AthenaCommon.AlgScheduler import AlgScheduler @@ -69,32 +65,52 @@ svcMgr += CondSvc( OutputLevel=INFO ) # ServiceMgr.THistSvc.Output += ["MATTRACKVAL DATAFILE='MaterialTracks.root' OPT='RECREATE'"] # ServiceMgr.ToolSvc.OutputLevel = VERBOSE + # Set up ACTS tracking geometry service -from ActsGeometry.ActsGeometryConfig import TrackingGeometrySvc -trkGeomSvc = TrackingGeometrySvc() +from ActsGeometry.ActsGeometryConfig import ActsTrackingGeometrySvc +trkGeomSvc = ActsTrackingGeometrySvc() trkGeomSvc.OutputLevel = INFO trkGeomSvc.BarrelMaterialBins = [40, 60] # phi z trkGeomSvc.EndcapMaterialBins = [50, 20] # phi r +trkGeomSvc.BuildSubDetectors = [ + "Pixel", + "SCT", + "TRT", + # "Calo", +] ServiceMgr += trkGeomSvc -# Set up ACTS extrapolation cell writer service -exCellWriterSvc = CfgMgr.Acts__ExCellWriterSvc("ExCellWriterSvc") -exCellWriterSvc.FilePath = "excells_charged_mapping.root" -ServiceMgr += exCellWriterSvc +trkGeomTool = CfgMgr.ActsTrackingGeometryTool("ActsTrackingGeometryTool") +trkGeomTool.OutputLevel = INFO; -mTrackWriterSvc = CfgMgr.Acts__MaterialTrackWriterSvc("MaterialTrackWriterSvc") +# Set up ACTS extrapolation cell writer service +# exCellWriterSvc = CfgMgr.ActsExCellWriterSvc("ActsExCellWriterSvc") +# exCellWriterSvc.FilePath = "excells_charged_mapping.root" +# ServiceMgr += exCellWriterSvc +mTrackWriterSvc = CfgMgr.ActsMaterialTrackWriterSvc("ActsMaterialTrackWriterSvc") mTrackWriterSvc.OutputLevel = DEBUG mTrackWriterSvc.FilePath = "MaterialTracks_mapping.root" # mTrackWriterSvc.MaxQueueSize = 10 ServiceMgr += mTrackWriterSvc +mMaterialStepConverterTool = CfgMgr.ActsMaterialStepConverterTool("ActsMaterialStepConverterTool") +mMaterialStepConverterTool.OutputLevel = VERBOSE + +mActsSurfaceMappingTool = CfgMgr.ActsSurfaceMappingTool("ActsSurfaceMappingTool") +mActsSurfaceMappingTool.OutputLevel = VERBOSE +mActsSurfaceMappingTool.TrackingGeometryTool = trkGeomTool + +# mActsMaterialJsonWriterTool = CfgMgr.ActsMaterialJsonWriterTool("ActsMaterialJsonWriterTool") +# mActsMaterialJsonWriterTool.OutputLevel = VERBOSE +# mActsMaterialJsonWriterTool.MaterialOutputFile = "material-maps.json" + from ActsGeometry import ActsGeometryConf ## SET UP ALIGNMENT CONDITIONS ALGORITHM -from AthenaCommon.AlgSequence import AthSequencer -condSeq = AthSequencer("AthCondSeq") -condSeq += ActsGeometryConf.NominalAlignmentCondAlg("NominalAlignmentCondAlg", - OutputLevel=VERBOSE) +from AthenaCommon.AlgSequence import AthSequencer +condSeq = AthSequencer("AthCondSeq") +condSeq += ActsGeometryConf.NominalAlignmentCondAlg("NominalAlignmentCondAlg", + OutputLevel=VERBOSE) ## END OF CONDITIONS SETUP # Set up algorithm sequence @@ -116,12 +132,7 @@ from ActsGeometry.ActsGeometryConf import ActsMaterialMapping alg = ActsMaterialMapping() alg.Cardinality = 0#nThreads +alg.MaterialStepConverterTool = mMaterialStepConverterTool +alg.SurfaceMappingTool = mActsSurfaceMappingTool alg.OutputLevel = VERBOSE -alg.ExtrapolationTool.FieldMode = "Constant" -alg.ExtrapolationTool.ConstantFieldVector = [0, 0, 0] -alg.ExtrapolationTool.OutputLevel = INFO - - -alg.OutputLevel = INFO job += alg - diff --git a/Tracking/Acts/ActsGeometry/share/ActsWriteTrackingGeometry.py b/Tracking/Acts/ActsGeometry/share/ActsWriteTrackingGeometry.py index af95eb1b81e1808f065610745ceb6cae537c0801..ae6895c6692afb0c682f7bdc2d304c7a5fac592f 100644 --- a/Tracking/Acts/ActsGeometry/share/ActsWriteTrackingGeometry.py +++ b/Tracking/Acts/ActsGeometry/share/ActsWriteTrackingGeometry.py @@ -106,4 +106,3 @@ if hasattr(ServiceMgr,"AthenaHiveEventLoopMgr"): theApp.EvtMax = 1 - diff --git a/Tracking/Acts/ActsGeometry/share/GeantinoMapping_jobOptions.py b/Tracking/Acts/ActsGeometry/share/GeantinoMapping_jobOptions.py index 1bd322b752cc7167957005efe845c0109fa66eaf..bbb0d51cac134736af1d45b0f12066cf8ee99166 100644 --- a/Tracking/Acts/ActsGeometry/share/GeantinoMapping_jobOptions.py +++ b/Tracking/Acts/ActsGeometry/share/GeantinoMapping_jobOptions.py @@ -66,7 +66,7 @@ print globalflags.ConditionsTag from AthenaCommon.AthenaCommonFlags import athenaCommonFlags athenaCommonFlags.PoolEvgenInput.set_Off() ### is this necessary? athenaCommonFlags.PoolHitsOutput = 'Hits.pool.root' -athenaCommonFlags.EvtMax = 1000 +athenaCommonFlags.EvtMax = 100000 #--- Simulation flags ----------------------------------------- from G4AtlasApps.SimFlags import simFlags @@ -80,13 +80,13 @@ myMaxEta = 6.0 myPDG = 999 # 999 = Geantinos, 13 = Muons include("GeneratorUtils/StdEvgenSetup.py") -theApp.EvtMax = 1000 +theApp.EvtMax = 100000 import ParticleGun as PG pg = PG.ParticleGun() pg.sampler.pid = 999 pg.randomSeed = 123456 -pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[-6.,6.]) +pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[-6.0,6.0]) topSeq += pg simFlags.RandomSeedOffset = myRandomOffset @@ -151,4 +151,3 @@ if not hasattr(condSeq, "BeamSpotCondAlg"): #--- End jobOptions.GeantinoMapping.py file ------------------------------ - diff --git a/Tracking/Acts/ActsGeometry/src/ActsExtrapolationAlg.cxx b/Tracking/Acts/ActsGeometry/src/ActsExtrapolationAlg.cxx index c5804e38955135adbb3d617e931789c17490eb70..833fb8eb5c7e251b16c507848f8c9308bf3b714c 100755 --- a/Tracking/Acts/ActsGeometry/src/ActsExtrapolationAlg.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsExtrapolationAlg.cxx @@ -114,6 +114,8 @@ StatusCode ActsExtrapolationAlg::execute(const EventContext &ctx) const { auto anygctx = gctx.any(); Acts::BoundParameters startParameters( anygctx, std::move(cov), std::move(pars), std::move(surface)); + + std::cout << startParameters << std::endl; steps = m_extrapolationTool->propagate(ctx, startParameters); m_propStepWriterSvc->write(steps); } diff --git a/Tracking/Acts/ActsGeometry/src/ActsMaterialTrackWriterSvc.cxx b/Tracking/Acts/ActsGeometry/src/ActsMaterialTrackWriterSvc.cxx index c307ada289638de80a38e8b38a0602cf64c7a4d9..95c25e0f8b148f9d38ba7721d734647097bcd1bd 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsMaterialTrackWriterSvc.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsMaterialTrackWriterSvc.cxx @@ -8,7 +8,6 @@ #include "TTree.h" #include "TFile.h" -#include "Acts/Plugins/MaterialMapping/MaterialTrack.hpp" #include "Acts/Material/MaterialProperties.hpp" #include "Acts/Utilities/Helpers.hpp" @@ -33,30 +32,27 @@ ActsMaterialTrackWriterSvc::initialize() p_tFile->cd(); p_tree = new TTree(treeName.c_str(), treeName.c_str()); - p_tree->Branch("X0", &m_treeX0); - p_tree->Branch("L0", &m_treeL0); - p_tree->Branch("phi", &m_treePhi); - p_tree->Branch("theta", &m_treeTheta); - p_tree->Branch("T", &m_treeT); - p_tree->Branch("dInX0", &m_treedInX0); - p_tree->Branch("dInL0", &m_treedInL0); - - p_tree->Branch("step_X0", &m_treeStepX0); - p_tree->Branch("step_L0", &m_treeStepL0); - p_tree->Branch("step_A", &m_treeStepA); - p_tree->Branch("step_Z", &m_treeStepZ); - p_tree->Branch("step_rho", &m_treeStepRho); - p_tree->Branch("step_t", &m_treeStepT); - p_tree->Branch("step_dInX0", &m_treeStepdInX0); - p_tree->Branch("step_dInL0", &m_treeStepdInL0); - - p_tree->Branch("step_x", &m_treeStepPosX); - p_tree->Branch("step_y", &m_treeStepPosY); - p_tree->Branch("step_z", &m_treeStepPosZ); - p_tree->Branch("step_r", &m_treeStepPosR); - p_tree->Branch("step_phi", &m_treeStepPosPhi); - - p_tree->Branch("step_geo_id", &m_treeStepGeoID); + p_tree->Branch("v_x", &m_v_x); + p_tree->Branch("v_y", &m_v_y); + p_tree->Branch("v_z", &m_v_z); + p_tree->Branch("v_px", &m_v_px); + p_tree->Branch("v_py", &m_v_py); + p_tree->Branch("v_pz", &m_v_pz); + p_tree->Branch("v_phi", &m_v_phi); + p_tree->Branch("v_eta", &m_v_eta); + + p_tree->Branch("t_X0", &m_tX0); + p_tree->Branch("t_L0", &m_tL0); + + p_tree->Branch("mat_x", &m_step_x); + p_tree->Branch("mat_y", &m_step_y); + p_tree->Branch("mat_z", &m_step_z); + p_tree->Branch("mat_step_length", &m_step_length); + p_tree->Branch("mat_X0", &m_step_X0); + p_tree->Branch("mat_L0", &m_step_L0); + p_tree->Branch("mat_A", &m_step_A); + p_tree->Branch("mat_Z", &m_step_Z); + p_tree->Branch("mat_rho", &m_step_rho); ATH_MSG_INFO("Starting writer thread"); ATH_MSG_DEBUG("Maximum queue size is set to:" << m_maxQueueSize); @@ -65,8 +61,8 @@ ActsMaterialTrackWriterSvc::initialize() return StatusCode::SUCCESS; } - -StatusCode + +StatusCode ActsMaterialTrackWriterSvc::finalize() { @@ -74,7 +70,7 @@ ActsMaterialTrackWriterSvc::finalize() m_doEnd = true; m_writeThread.join(); ATH_MSG_INFO("Writer thread has terminated."); - + ATH_MSG_INFO("Closing TFile"); p_tFile->cd(); p_tree->FlushBaskets(); @@ -86,8 +82,8 @@ ActsMaterialTrackWriterSvc::finalize() return StatusCode::SUCCESS; } -void -ActsMaterialTrackWriterSvc::write(const Acts::MaterialTrack& mTrack) +void +ActsMaterialTrackWriterSvc::write(const Acts::RecordedMaterialTrack& mTrack) { std::lock_guard<std::mutex> lock(m_writeMutex); @@ -109,7 +105,7 @@ ActsMaterialTrackWriterSvc::writerThread() while(true) { ATH_MSG_VERBOSE("Obtaining write lock"); std::unique_lock<std::mutex> lock(m_writeMutex); - + if (m_mTracks.empty()) { lock.unlock(); if (!m_doEnd) { @@ -126,16 +122,16 @@ ActsMaterialTrackWriterSvc::writerThread() //if(m_mTracks.size() < m_maxQueueSize) { // just pop one - ATH_MSG_VERBOSE("Queue at " << m_mTracks.size() << "/" << m_maxQueueSize + ATH_MSG_VERBOSE("Queue at " << m_mTracks.size() << "/" << m_maxQueueSize << ": Pop entry and write"); - Acts::MaterialTrack mTrack = std::move(m_mTracks.front()); + Acts::RecordedMaterialTrack mTrack = std::move(m_mTracks.front()); m_mTracks.pop_front(); // writing can now happen without lock lock.unlock(); doWrite(std::move(mTrack)); //} //else { - //ATH_MSG_DEBUG("Queue at " << m_mTracks.size() << "/" << m_maxQueueSize + //ATH_MSG_DEBUG("Queue at " << m_mTracks.size() << "/" << m_maxQueueSize //<< ": Lock and write until empty"); //while(!m_mTracks.empty()) { //ATH_MSG_VERBOSE("Pop entry and write"); @@ -153,77 +149,88 @@ ActsMaterialTrackWriterSvc::writerThread() } void -ActsMaterialTrackWriterSvc::doWrite(const Acts::MaterialTrack& mTrack) +ActsMaterialTrackWriterSvc::doWrite(const Acts::RecordedMaterialTrack& mTrack) { ATH_MSG_VERBOSE("Write to tree"); - size_t nSteps = mTrack.materialSteps().size(); - //m_treeStepPos.clear(); - //m_treeStepPos.reserve(nSteps); - m_treeStepX0.clear(); - m_treeStepX0.reserve(nSteps); - m_treeStepL0.clear(); - m_treeStepL0.reserve(nSteps); - m_treeStepA.clear(); - m_treeStepA.reserve(nSteps); - m_treeStepZ.clear(); - m_treeStepZ.reserve(nSteps); - m_treeStepRho.clear(); - m_treeStepRho.reserve(nSteps); - m_treeStepT.clear(); - m_treeStepT.reserve(nSteps); - m_treeStepdInX0.clear(); - m_treeStepdInX0.reserve(nSteps); - m_treeStepdInL0.clear(); - m_treeStepdInL0.reserve(nSteps); - - m_treeStepPosX.clear(); - m_treeStepPosX.reserve(nSteps); - m_treeStepPosY.clear(); - m_treeStepPosY.reserve(nSteps); - m_treeStepPosZ.clear(); - m_treeStepPosZ.reserve(nSteps); - m_treeStepPosR.clear(); - m_treeStepPosR.reserve(nSteps); - m_treeStepPosPhi.clear(); - m_treeStepPosPhi.reserve(nSteps); - - m_treeStepGeoID.clear(); - m_treeStepGeoID.reserve(nSteps); - - - m_treeX0 = mTrack.thicknessInX0(); // name? - m_treeL0 = mTrack.thicknessInL0(); // name? - m_treeTheta = mTrack.theta(); - m_treePhi = mTrack.phi(); - m_treeT = 0; - m_treedInX0 = 0; - m_treedInL0 = 0; - - for(const auto& step : mTrack.materialSteps()) { - const Acts::MaterialProperties& matProp = step.materialProperties(); - const Acts::Material& mat = matProp.material(); - const Acts::Vector3D pos = step.position(); - - m_treeStepPosX.push_back(pos.x()); - m_treeStepPosY.push_back(pos.y()); - m_treeStepPosZ.push_back(pos.z()); - m_treeStepPosR.push_back(perp(pos)); - m_treeStepPosPhi.push_back(phi(pos)); - - m_treeStepX0.push_back(mat.X0()); - m_treeStepL0.push_back(mat.L0()); - m_treeStepA.push_back(mat.A()); - m_treeStepZ.push_back(mat.Z()); - m_treeStepRho.push_back(mat.rho()); - m_treeStepT.push_back(matProp.thickness()); - m_treeStepdInX0.push_back(matProp.thicknessInX0()); - m_treeStepdInX0.push_back(matProp.thicknessInL0()); - - m_treeT += matProp.thickness(); - m_treedInX0 += matProp.thicknessInX0(); - m_treedInL0 += matProp.thicknessInL0(); - - m_treeStepGeoID.push_back(step.geoID()); + size_t mints = mTrack.second.materialInteractions.size(); + + // Clearing the vector first + m_step_sx.clear(); + m_step_sy.clear(); + m_step_sz.clear(); + m_step_x.clear(); + m_step_y.clear(); + m_step_z.clear(); + m_step_ex.clear(); + m_step_ey.clear(); + m_step_ez.clear(); + m_step_length.clear(); + m_step_X0.clear(); + m_step_L0.clear(); + m_step_A.clear(); + m_step_Z.clear(); + m_step_rho.clear(); + + // Reserve the vector then + + m_step_sx.reserve(mints); + m_step_sy.reserve(mints); + m_step_sz.reserve(mints); + m_step_x.reserve(mints); + m_step_y.reserve(mints); + m_step_ez.reserve(mints); + m_step_ex.reserve(mints); + m_step_ey.reserve(mints); + m_step_ez.reserve(mints); + m_step_length.reserve(mints); + m_step_X0.reserve(mints); + m_step_L0.reserve(mints); + m_step_A.reserve(mints); + m_step_Z.reserve(mints); + m_step_rho.reserve(mints); + + + // reset the global counter + m_tX0 = mTrack.second.materialInX0; + m_tL0 = mTrack.second.materialInL0; + + // set the track information at vertex + m_v_x = mTrack.first.first.x(); + m_v_y = mTrack.first.first.y(); + m_v_z = mTrack.first.first.z(); + m_v_px = mTrack.first.second.x(); + m_v_py = mTrack.first.second.y(); + m_v_pz = mTrack.first.second.z(); + m_v_phi = phi(mTrack.first.second); + m_v_eta = eta(mTrack.first.second); + + // an now loop over the material + for (auto& mint : mTrack.second.materialInteractions) { + // The material step position information + m_step_x.push_back(mint.position.x()); + m_step_y.push_back(mint.position.y()); + m_step_z.push_back(mint.position.z()); + + Acts::Vector3D prePos + = mint.position - 0.5 * mint.pathCorrection * mint.direction; + Acts::Vector3D posPos + = mint.position + 0.5 * mint.pathCorrection * mint.direction; + m_step_sx.push_back(prePos.x()); + m_step_sy.push_back(prePos.y()); + m_step_sz.push_back(prePos.z()); + m_step_ex.push_back(posPos.x()); + m_step_ey.push_back(posPos.y()); + m_step_ez.push_back(posPos.z()); + + // the material information + const auto& mprops = mint.materialProperties; + m_step_length.push_back(mprops.thickness()); + m_step_X0.push_back(mprops.averageX0()); + m_step_L0.push_back(mprops.averageL0()); + m_step_A.push_back(mprops.averageA()); + m_step_Z.push_back(mprops.averageZ()); + m_step_rho.push_back(mprops.averageRho()); + } diff --git a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx index 76cb9dad074fcdee9f35dada7ca50faa11e43be7..49717d0da5f5dcc2d0e9f9543803a0ad42166696 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx @@ -16,7 +16,7 @@ #include <memory> ActsTrackingGeometryTool::ActsTrackingGeometryTool(const std::string& type, const std::string& name, - const IInterface* parent) + const IInterface* parent) : base_class(type, name, parent), m_trackingGeometrySvc("ActsTrackingGeometrySvc", name) { diff --git a/Tracking/Acts/ActsGeometry/src/components/ActsGeometry_entries.cxx b/Tracking/Acts/ActsGeometry/src/components/ActsGeometry_entries.cxx index 5c7f1a4f204aa5c6fe4277fc8e83b894febbba1f..116e6c09d659d9c93058dd31101370913834ddec 100755 --- a/Tracking/Acts/ActsGeometry/src/components/ActsGeometry_entries.cxx +++ b/Tracking/Acts/ActsGeometry/src/components/ActsGeometry_entries.cxx @@ -7,9 +7,12 @@ #include "ActsGeometry/ActsWriteTrackingGeometryTransforms.h" #include "ActsGeometry/ActsTrackingGeometrySvc.h" #include "ActsGeometry/ActsExtrapolationTool.h" + +#include "ActsGeometry/ActsMaterialMapping.h" +#include "ActsGeometry/ActsSurfaceMappingTool.h" #include "ActsGeometry/ActsObjWriterTool.h" //#include "ActsGeometry/ActsExCellWriterSvc.h" -//#include "ActsGeometry/ActsMaterialTrackWriterSvc.h" +#include "ActsGeometry/ActsMaterialTrackWriterSvc.h" //#include "ActsGeometry/GeomShiftCondAlg.h" #include "ActsGeometry/NominalAlignmentCondAlg.h" @@ -18,15 +21,23 @@ #include "ActsGeometry/ActsPropStepRootWriterSvc.h" #include "ActsGeometry/ActsCaloTrackingVolumeBuilder.h" +#include "ActsGeometry/ActsMaterialStepConverterTool.h" +// #include "ActsGeometry/ActsMaterialJsonWriterTool.h" + DECLARE_COMPONENT( ActsExtrapolationAlg ) DECLARE_COMPONENT( ActsWriteTrackingGeometry ) DECLARE_COMPONENT( ActsWriteTrackingGeometryTransforms ) DECLARE_COMPONENT( ActsTrackingGeometrySvc ) DECLARE_COMPONENT( ActsExtrapolationTool ) + +DECLARE_COMPONENT( ActsMaterialMapping ) +DECLARE_COMPONENT( ActsSurfaceMappingTool ) DECLARE_COMPONENT( ActsObjWriterTool ) //DECLARE_COMPONENT( ActsExCellWriterSvc ) -//DECLARE_COMPONENT( ActsMaterialTrackWriterSvc ) +DECLARE_COMPONENT( ActsMaterialTrackWriterSvc ) +DECLARE_COMPONENT( ActsMaterialStepConverterTool ) +// DECLARE_COMPONENT( ActsMaterialJsonWriterTool ) //DECLARE_COMPONENT( GeomShiftCondAlg ) DECLARE_COMPONENT( NominalAlignmentCondAlg )