diff --git a/Tracking/Acts/ActsInterop/CMakeLists.txt.disabled b/Tracking/Acts/ActsInterop/CMakeLists.txt similarity index 100% rename from Tracking/Acts/ActsInterop/CMakeLists.txt.disabled rename to Tracking/Acts/ActsInterop/CMakeLists.txt diff --git a/Tracking/Acts/FaserActsGeometry/CMakeLists.txt.disabled b/Tracking/Acts/FaserActsGeometry/CMakeLists.txt similarity index 95% rename from Tracking/Acts/FaserActsGeometry/CMakeLists.txt.disabled rename to Tracking/Acts/FaserActsGeometry/CMakeLists.txt index bd4c0658954dc8c5e1fb0adde80e36c2e2b0583d..a121316e188cc27c35f3d90f9a81b569089b9d19 100755 --- a/Tracking/Acts/FaserActsGeometry/CMakeLists.txt.disabled +++ b/Tracking/Acts/FaserActsGeometry/CMakeLists.txt @@ -17,7 +17,7 @@ atlas_add_library( FaserActsGeometryLib src/FaserActsDetectorElement.cxx src/FaserActsLayerBuilder.cxx src/CuboidVolumeBuilder.cxx - src/FaserActsJsonGeometryConverter.cxx +# src/FaserActsJsonGeometryConverter.cxx src/util/*.cxx PUBLIC_HEADERS FaserActsGeometry INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS} @@ -51,8 +51,8 @@ atlas_add_component( FaserActsGeometry ##src/*.cxx src/FaserActsSurfaceMappingTool.cxx src/FaserActsMaterialMapping.cxx - src/FaserActsMaterialJsonWriterTool.cxx - src/FaserActsJsonGeometryConverter.cxx +# src/FaserActsMaterialJsonWriterTool.cxx +# src/FaserActsJsonGeometryConverter.cxx src/FaserActsTrackingGeometrySvc.cxx src/FaserActsTrackingGeometryTool.cxx src/FaserActsWriteTrackingGeometry.cxx diff --git a/Tracking/Acts/FaserActsGeometry/src/components/FaserActsGeometry_entries.cxx b/Tracking/Acts/FaserActsGeometry/src/components/FaserActsGeometry_entries.cxx index 9be7649a9397fa25de520848ede7ecad3bcc4cc7..7beb0342f184a3c72a4fa4c154fdc00cc5bd9522 100755 --- a/Tracking/Acts/FaserActsGeometry/src/components/FaserActsGeometry_entries.cxx +++ b/Tracking/Acts/FaserActsGeometry/src/components/FaserActsGeometry_entries.cxx @@ -17,7 +17,7 @@ //#include "FaserActsGeometry/GeomShiftCondAlg.h" //#include "FaserActsGeometry/FaserActsWriteTrackingGeometryTransforms.h" #include "FaserActsGeometry/FaserActsVolumeMappingTool.h" -#include "FaserActsGeometry/FaserActsMaterialJsonWriterTool.h" +//#include "FaserActsGeometry/FaserActsMaterialJsonWriterTool.h" #include "FaserActsGeometry/FaserActsMaterialMapping.h" #include "FaserActsGeometry/FaserActsSurfaceMappingTool.h" @@ -36,6 +36,6 @@ DECLARE_COMPONENT( FaserActsAlignmentCondAlg ) //DECLARE_COMPONENT( FaserActsWriteTrackingGeometryTransforms ) //DECLARE_COMPONENT( FaserGeomShiftCondAlg ) DECLARE_COMPONENT( FaserActsVolumeMappingTool ) -DECLARE_COMPONENT( FaserActsMaterialJsonWriterTool ) +//DECLARE_COMPONENT( FaserActsMaterialJsonWriterTool ) DECLARE_COMPONENT( FaserActsMaterialMapping ) DECLARE_COMPONENT( FaserActsSurfaceMappingTool ) diff --git a/Tracking/Acts/FaserActsGeometryInterfaces/CMakeLists.txt.disabled b/Tracking/Acts/FaserActsGeometryInterfaces/CMakeLists.txt similarity index 100% rename from Tracking/Acts/FaserActsGeometryInterfaces/CMakeLists.txt.disabled rename to Tracking/Acts/FaserActsGeometryInterfaces/CMakeLists.txt diff --git a/Tracking/Acts/FaserActsKalmanFilter/CMakeLists.txt.disabled b/Tracking/Acts/FaserActsKalmanFilter/CMakeLists.txt similarity index 63% rename from Tracking/Acts/FaserActsKalmanFilter/CMakeLists.txt.disabled rename to Tracking/Acts/FaserActsKalmanFilter/CMakeLists.txt index a59281e363f8fd5dde3136a6b753d0eed8c0d0d6..21e5ed799d3caeaf33d4fc85102b9be48e18e599 100755 --- a/Tracking/Acts/FaserActsKalmanFilter/CMakeLists.txt.disabled +++ b/Tracking/Acts/FaserActsKalmanFilter/CMakeLists.txt @@ -22,10 +22,24 @@ atlas_add_library( FaserActsKalmanFilterLib ) atlas_add_component(FaserActsKalmanFilter - src/*.cxx - src/components/*.cxx - FaserActsKalmanFilter/*.h - FaserActsKalmanFilter/src/*.cxx + FaserActsKalmanFilter/CombinatorialKalmanFilterAlg.h + FaserActsKalmanFilter/FaserActsGeometryContainers.h + FaserActsKalmanFilter/FaserActsRecMultiTrajectory.h + FaserActsKalmanFilter/IndexSourceLink.h + FaserActsKalmanFilter/Measurement.h + FaserActsKalmanFilter/SimWriterTool.h + FaserActsKalmanFilter/SPSeedBasedInitialParameterTool.h + FaserActsKalmanFilter/SPSimpleInitialParameterTool.h + FaserActsKalmanFilter/TrajectoryWriterTool.h + FaserActsKalmanFilter/TruthBasedInitialParameterTool.h + src/CombinatorialKalmbanFilterAlg.cxx + src/SimWriterTool.cxx + src/SPSeedBasedInitialParameterTool.cxx + src/SPSimpleInitialParameterTool.cxx + src/TrackFindingAlgorithmFunction.cxx + src/TrajectoryWriterTool.cxx + src/TruthBasedInitialParameterTool.cxx + src/components/FaserActsKalmanFilter_entries.cxx PUBLIC_HEADERS FaserActsKalmanFilter INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS} LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} diff --git a/Tracking/Acts/FaserActsKalmanFilter/FaserActsKalmanFilter/CombinatorialKalmanFilterAlg.h b/Tracking/Acts/FaserActsKalmanFilter/FaserActsKalmanFilter/CombinatorialKalmanFilterAlg.h index db3f086debf367530d61ba47c58bb6602a84ff3e..4b750614a3f496a9cabef0352c223d9b9e5a9658 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/FaserActsKalmanFilter/CombinatorialKalmanFilterAlg.h +++ b/Tracking/Acts/FaserActsKalmanFilter/FaserActsKalmanFilter/CombinatorialKalmanFilterAlg.h @@ -63,8 +63,8 @@ class CombinatorialKalmanFilterAlg : public AthReentrantAlgorithm { ToolHandle<IFaserActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "FaserActsTrackingGeometryTool"}; // ToolHandle<SPSeedBasedInitialParameterTool> m_initialParameterTool{this, "InitialParameterTool", "SPSeedBasedInitialParameterTool"}; - ToolHandle<SPSimpleInitialParameterTool> m_initialParameterTool{this, "InitialParameterTool", "SPSimpleInitialParameterTool"}; - //ToolHandle<TruthBasedInitialParameterTool> m_initialParameterTool{this, "InitialParameterTool", "TruthBasedInitialParameterTool"}; +// ToolHandle<SPSimpleInitialParameterTool> m_initialParameterTool{this, "InitialParameterTool", "SPSimpleInitialParameterTool"}; + ToolHandle<TruthBasedInitialParameterTool> m_initialParameterTool{this, "InitialParameterTool", "TruthBasedInitialParameterTool"}; ToolHandle<TrajectoryWriterTool> m_trajectoryWriterTool{this, "OutputTool", "TrajectoryWriterTool"}; SG::ReadCondHandleKey<FaserFieldCacheCondObj> m_fieldCondObjInputKey {this, "FaserFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; SG::ReadHandleKey<FaserSCT_SpacePointContainer> m_SpacePointContainerKey{this, "SpacePointsSCTName", "SCT_SpacePointContainer", "SCT space point container"}; diff --git a/Tracking/Acts/FaserActsKalmanFilter/src/CombinatorialKalmbanFilterAlg.cxx b/Tracking/Acts/FaserActsKalmanFilter/src/CombinatorialKalmbanFilterAlg.cxx index 08e9f2b2283089fbcda678d65234c3cce03c3c7e..f5c547e61418ca7d5d0e4eb8b1cbdb9651e9316b 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/src/CombinatorialKalmbanFilterAlg.cxx +++ b/Tracking/Acts/FaserActsKalmanFilter/src/CombinatorialKalmbanFilterAlg.cxx @@ -127,10 +127,10 @@ return StatusCode::RECOVERABLE; std::vector<Identifier> sp_ids; std::vector<Tracker::FaserSCT_SpacePoint> sps; - std::vector<Acts::Vector3> pos1; - std::vector<Acts::Vector3> pos2; - std::vector<Acts::Vector3> pos3; - pos1.clear();pos2.clear();pos3.clear(); +// std::vector<Acts::Vector3> pos1; +// std::vector<Acts::Vector3> pos2; +// std::vector<Acts::Vector3> pos3; +// pos1.clear();pos2.clear();pos3.clear(); std::vector<int> layer1; layer1.clear(); FaserSCT_SpacePointContainer::const_iterator coll_it = spcontainer->begin(); @@ -148,12 +148,12 @@ return StatusCode::RECOVERABLE; ThisMeasurement meas(sourceLink, indices, sp->localParameters(), sp->localCovariance()); measurements.emplace_back(std::move(meas)); - if(m_idHelper->station(sp->clusterList().first->identify())==1){ - pos1.push_back(Acts::Vector3(sp->globalPosition().x(),sp->globalPosition().y(),sp->globalPosition().z())); - layer1.push_back(m_idHelper->layer(sp->clusterList().first->identify())); - } - if(m_idHelper->station(sp->clusterList().first->identify())==2)pos2.push_back(Acts::Vector3(sp->globalPosition().x(),sp->globalPosition().y(),sp->globalPosition().z())); - if(m_idHelper->station(sp->clusterList().first->identify())==3)pos3.push_back(Acts::Vector3(sp->globalPosition().x(),sp->globalPosition().y(),sp->globalPosition().z())); +// if(m_idHelper->station(sp->clusterList().first->identify())==1) { +// pos1.push_back(Acts::Vector3(sp->globalPosition().x(),sp->globalPosition().y(),sp->globalPosition().z())); +// layer1.push_back(m_idHelper->layer(sp->clusterList().first->identify())); +// } +// if(m_idHelper->station(sp->clusterList().first->identify())==2)pos2.push_back(Acts::Vector3(sp->globalPosition().x(),sp->globalPosition().y(),sp->globalPosition().z())); +// if(m_idHelper->station(sp->clusterList().first->identify())==3)pos3.push_back(Acts::Vector3(sp->globalPosition().x(),sp->globalPosition().y(),sp->globalPosition().z())); sp_ids.push_back(sp->clusterList().first->identify()); sps.push_back(*sp); } @@ -161,25 +161,24 @@ return StatusCode::RECOVERABLE; // Get initial parameters // FIXME: Get initial parameters from clusterFitter or SeedFinder not MC! - // std::vector<Acts::CurvilinearTrackParameters> initialParameters; - // auto initialParameter = m_initialParameterTool->getInitialParameters(sp_ids); - // initialParameters.push_back(initialParameter); - //std::cout<<"n spacepoints in stations : "<<pos1.size()<<" "<<pos2.size()<<" "<<pos3.size()<<std::endl; + std::vector<Acts::CurvilinearTrackParameters> initialParameters; + auto initialParameter = m_initialParameterTool->getInitialParameters(sp_ids); + initialParameters.push_back(initialParameter); // if(pos1.size()<1||pos2.size()<1||pos3.size()<1) return StatusCode::SUCCESS; - std::vector<Acts::CurvilinearTrackParameters> initialParameters; - initialParameters.clear(); - Acts::Vector3 pos1a(0,0,0); - Acts::Vector3 pos2a(0,0,0); - Acts::Vector3 pos3a(0,0,0); - for(long unsigned int i1=0;i1<pos1.size();i1++)pos1a+=pos1[i1]; - for(long unsigned int i1=0;i1<pos2.size();i1++)pos2a+=pos2[i1]; - for(long unsigned int i1=0;i1<pos3.size();i1++)pos3a+=pos3[i1]; - pos1a/=pos1.size(); - pos2a/=pos2.size(); - pos3a/=pos3.size(); - m_nsp1+=pos1.size(); - m_nsp2+=pos2.size(); - m_nsp3+=pos3.size(); +// std::vector<Acts::CurvilinearTrackParameters> initialParameters; +// initialParameters.clear(); +// Acts::Vector3 pos1a(0,0,0); +// Acts::Vector3 pos2a(0,0,0); +// Acts::Vector3 pos3a(0,0,0); +// for(long unsigned int i1=0;i1<pos1.size();i1++)pos1a+=pos1[i1]; +// for(long unsigned int i1=0;i1<pos2.size();i1++)pos2a+=pos2[i1]; +// for(long unsigned int i1=0;i1<pos3.size();i1++)pos3a+=pos3[i1]; +// pos1a/=pos1.size(); +// pos2a/=pos2.size(); +// pos3a/=pos3.size(); +// m_nsp1+=pos1.size(); +// m_nsp2+=pos2.size(); +// m_nsp3+=pos3.size(); // for(int i1=0;i1<pos1.size();i1++){ // for(int i2=0;i2<pos2.size();i2++){ // for(int i3=0;i3<pos3.size();i3++){ @@ -196,19 +195,19 @@ return StatusCode::RECOVERABLE; initialParameters.push_back(initialParameter); */ // for one stations - if(pos1.size()>2) { - std::vector<Acts::Vector3> pos10; - std::vector<Acts::Vector3> pos11; - std::vector<Acts::Vector3> pos12; - pos10.clear();pos11.clear();pos12.clear(); - for(std::size_t ipos=0;ipos<pos1.size();ipos++){ - if(layer1[ipos]==0)pos10.push_back(pos1[ipos]); - if(layer1[ipos]==1)pos11.push_back(pos1[ipos]); - if(layer1[ipos]==2)pos12.push_back(pos1[ipos]); - } - if(pos10.size()>0&&pos11.size()>0&&pos12.size()>0){ - auto initialParameter=m_initialParameterTool->getInitialParameters_1station(pos10,pos11,pos12); - initialParameters.insert(initialParameters.end(),initialParameter.begin(),initialParameter.end()); +// if(pos1.size()>2) { +// std::vector<Acts::Vector3> pos10; +// std::vector<Acts::Vector3> pos11; +// std::vector<Acts::Vector3> pos12; +// pos10.clear();pos11.clear();pos12.clear(); +// for(std::size_t ipos=0;ipos<pos1.size();ipos++){ +// if(layer1[ipos]==0)pos10.push_back(pos1[ipos]); +// if(layer1[ipos]==1)pos11.push_back(pos1[ipos]); +// if(layer1[ipos]==2)pos12.push_back(pos1[ipos]); +// } +// if(pos10.size()>0&&pos11.size()>0&&pos12.size()>0){ +// auto initialParameter=m_initialParameterTool->getInitialParameters_1station(pos10,pos11,pos12); +// initialParameters.insert(initialParameters.end(),initialParameter.begin(),initialParameter.end()); /* //for two stations if(pos1.size()>1&&pos2.size()>0) { @@ -263,7 +262,7 @@ return StatusCode::RECOVERABLE; {Acts::GeometryIdentifier(), {chi2Max, nMax}}, }; std::unique_ptr<const Acts::Logger> logger - = Acts::getDefaultLogger("CombinatorialKalmanFilter", Acts::Logging::VERBOSE); + = Acts::getDefaultLogger("CombinatorialKalmanFilter", Acts::Logging::INFO); // Set the CombinatorialKalmanFilter options CombinatorialKalmanFilterAlg::TrackFinderOptions options( @@ -292,10 +291,11 @@ return StatusCode::RECOVERABLE; const auto& trackFindingOutput = result.value(); std::unique_ptr<Trk::Track> track = makeTrack(geoContext, result,sps); m_ntracks++; - if(track!=nullptr) - outputTracks->push_back(std::move(track)); - else - ATH_MSG_DEBUG("No Trk::Track is created" ); + if(track!=nullptr) { + outputTracks->push_back(std::move(track)); + } else { + ATH_MSG_DEBUG("No Trk::Track is created" ); + } // Create a Trajectories result struct trajectories.emplace_back(std::move(trackFindingOutput.fittedStates), std::move(trackFindingOutput.lastMeasurementIndices), @@ -310,16 +310,16 @@ return StatusCode::RECOVERABLE; } m_trajectoryWriterTool->writeout(trajectories, geoContext,initialParameters); - } - } +// } +// } - if(outputTracks->size()>0) - ATH_MSG_DEBUG("Found "<<outputTracks->size()<<" tracks"); - else + if(outputTracks->size()>0) { + ATH_MSG_DEBUG("Found " << outputTracks->size() << " tracks"); + } else { ATH_MSG_WARNING("No track is found"); + } ATH_CHECK(trackContainer.record(std::move(outputTracks))); - return StatusCode::SUCCESS; } @@ -327,8 +327,8 @@ return StatusCode::RECOVERABLE; StatusCode CombinatorialKalmanFilterAlg::finalize() { ATH_MSG_INFO("CombinatorialKalmanFilterAlg::finalize"); ATH_MSG_INFO("Summary info"); - ATH_MSG_INFO("In taotal, "<<m_nevents<<" events, and "<<m_nseeds<<" seeds, and "<<m_ntracks<<" tracks"); - ATH_MSG_INFO("In taotal, "<<m_nsp1<<" , "<<m_nsp2<<" , "<<m_nsp3<<" ,"<<m_nsp10<<" , "<<m_nsp11<<" , "<<m_ncom); + ATH_MSG_INFO("In total, "<<m_nevents<<" events, and "<<m_nseeds<<" seeds, and "<<m_ntracks<<" tracks"); + ATH_MSG_INFO("In total, "<<m_nsp1<<" , "<<m_nsp2<<" , "<<m_nsp3<<" ,"<<m_nsp10<<" , "<<m_nsp11<<" , "<<m_ncom); return StatusCode::SUCCESS; } @@ -346,149 +346,77 @@ Acts::MagneticFieldContext CombinatorialKalmanFilterAlg::getMagneticFieldContext return Acts::MagneticFieldContext(fieldCondObj); } -/* -void CombinatorialKalmanFilterAlg::makeTrack(Acts::GeometryContext& tgContext, TrajectoryiesContainer trajectories, - const FaserSCT_SpacePointContainer* seed_spcollection, TrackCollection* outputTracks - ) const { - // Loop over the trajectories - int iTraj = 0; - for (const auto& traj : trajectories) { - - // The trajectory entry indices and the multiTrajectory - const auto& [trackTips, mj] = traj.trajectory(); - if (trackTips.empty()) { - ATH_MSG_WARNING("Empty multiTrajectory."); - continue; - } - // Get the entry index for the single trajectory - auto& trackTip = trackTips.front(); - std::cout<<"trackTip = "<<trackTip<<std::endl; - - // Collect the trajectory summary info - auto trajState = - Acts::MultiTrajectoryHelpers::trajectoryState(mj, trackTip); - if (traj.hasTrackParameters(trackTip)) - { - 242 mj.visitBackwards(trackTip, [&](const auto &state) { - 243 /// Only fill the track states with non-outlier measurement - 244 auto typeFlags = state.typeFlags(); - 245 if (not typeFlags.test(Acts::TrackStateFlag::MeasurementFlag)) - 246 { - 247 return true; - 248 } - 252 /// Get the geometry ID - 253 auto geoID = state.referenceSurface().geometryId(); - 254 m_volumeID.push_back(geoID.volume()); - 255 m_layerID.push_back(geoID.layer()); - 256 m_moduleID.push_back(geoID.sensitive()); - 257 - 258 // expand the local measurements into the full bound space - 259 Acts::BoundVector meas = - 260 state.projector().transpose() * state.calibrated(); - 261 - 262 // extract local and global position - 263 Acts::Vector2 local(meas[Acts::eBoundLoc0], meas[Acts::eBoundLoc1]); - 264 Acts::Vector3 mom(1, 1, 1); - Acts::Vector3 global = - 266 surface.localToGlobal(geoContext, local, mom); - jjjjj - } -} - -*/ std::unique_ptr<Trk::Track> -//CombinatorialKalmanFilterAlg::makeTrack(Acts::GeometryContext& tgContext, FitterResult& fitResult, std::vector<Tracker::FaserSCT_Cluster> sps -CombinatorialKalmanFilterAlg::makeTrack(Acts::GeometryContext& tgContext, FitterResult& fitResult, std::vector<Tracker::FaserSCT_SpacePoint> sps - ) const { +CombinatorialKalmanFilterAlg::makeTrack(Acts::GeometryContext& tgContext, FitterResult& fitResult, std::vector<Tracker::FaserSCT_SpacePoint> sps) const { std::unique_ptr<Trk::Track> newtrack = nullptr; //Get the fit output object const auto& fitOutput = fitResult.value(); -// if (fitOutput.result) if (fitOutput.fittedParameters.size()>0) { - DataVector<const Trk::TrackStateOnSurface>* finalTrajectory=new DataVector<const Trk::TrackStateOnSurface>{}; + DataVector<const Trk::TrackStateOnSurface>* finalTrajectory = new DataVector<const Trk::TrackStateOnSurface>{}; std::vector<std::unique_ptr<const Acts::BoundTrackParameters>> actsSmoothedParam; ATH_MSG_DEBUG("makeTrack : trackTip "<<fitOutput.lastMeasurementIndices.size()); // Loop over all the output state to create track state fitOutput.fittedStates.visitBackwards(fitOutput.lastMeasurementIndices.front(), [&](const auto &state) { - auto flag = state.typeFlags(); - if (state.referenceSurface().associatedDetectorElement() != nullptr) { -// const auto* actsElement = dynamic_cast<const FaserActsDetectorElement*>(state.referenceSurface().associatedDetectorElement()); -// if (actsElement != nullptr ){ - // We need to determine the type of state - std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; - const Trk::TrackParameters *parm; - - // State is a hole (no associated measurement), use predicted para meters - if (flag[Acts::TrackStateFlag::HoleFlag] == true){ - const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), - state.predicted(), - state.predictedCovariance()); - parm = ConvertActsTrackParameterToATLAS(actsParam, tgContext); - // auto boundaryCheck = m_boundaryCheckTool->boundaryCheck(*p arm); - typePattern.set(Trk::TrackStateOnSurface::Hole); - } - // The state was tagged as an outlier, use filtered parameters - else if (flag[Acts::TrackStateFlag::OutlierFlag] == true){ - const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), - state.filtered(), - state.filteredCovariance()); - parm = ConvertActsTrackParameterToATLAS(actsParam, tgContext); - typePattern.set(Trk::TrackStateOnSurface::Outlier); - } - // The state is a measurement state, use smoothed parameters - else{ - const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), - state.smoothed(), - state.smoothedCovariance()); - - actsSmoothedParam.push_back(std::make_unique<const Acts::BoundTrackParameters>(Acts::BoundTrackParameters(actsParam))); - // const auto& psurface=actsParam.referenceSurface(); - // std::cout<<"position "<<psurface.center(tgContext)<<std::endl; - // std::cout<<"position "<<psurface.associatedDetectorElement()->thickness()<<std::endl; - // std::cout<<"geometry "<<psurface.geometryId().volume()<<" "<<psurface.geometryId().layer()<<" "<<psurface.geometryId().sensitive()<<std::endl; - Acts::Vector2 local(actsParam.parameters()[Acts::eBoundLoc0], actsParam.parameters()[Acts::eBoundLoc1]); -// const Acts::Vector3 dir = Acts::makeDirectionUnitFromPhiTheta(actsParam.parameters()[Acts::eBoundPhi], actsParam.parameters()[Acts::eBoundTheta]); -// auto pos=actsParam.position(tgContext); - - parm = ConvertActsTrackParameterToATLAS(actsParam, tgContext); - typePattern.set(Trk::TrackStateOnSurface::Measurement); - } - - Tracker::FaserSCT_ClusterOnTrack* measState = nullptr; - if (state.hasUncalibrated()){ - auto sp= sps.at(state.uncalibrated().index()); - //const Tracker::FaserSCT_Cluster* fitCluster=&sp; - const Tracker::FaserSCT_Cluster* fitCluster=sp.clusterList().first; - if(fitCluster !=nullptr){ - measState = new Tracker::FaserSCT_ClusterOnTrack{ fitCluster, Trk::LocalParameters { Trk::DefinedParameter { fitCluster->localPosition()[0], Trk::loc1 }, Trk::DefinedParameter { fitCluster->localPosition()[1], Trk::loc2 } }, fitCluster->localCovariance(), m_idHelper->wafer_hash(fitCluster->detectorElement()->identify())}; - } - } - double nDoF = state.calibratedSize(); - const Trk::FitQualityOnSurface *quality = new Trk::FitQualityOnSurface(state.chi2(), nDoF); - const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(measState, parm, quality, nullptr, typePattern); - // If a state was succesfully created add it to the trajectory - if (perState) { - finalTrajectory->insert(finalTrajectory->begin(), perState); - - } - // } - } - return; + auto flag = state.typeFlags(); + if (state.referenceSurface().associatedDetectorElement() != nullptr) { + // const auto* actsElement = dynamic_cast<const FaserActsDetectorElement*>(state.referenceSurface().associatedDetectorElement()); + // if (actsElement != nullptr ){ + // We need to determine the type of state + std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; + const Trk::TrackParameters *parm; + + // State is a hole (no associated measurement), use predicted para meters + if (flag[Acts::TrackStateFlag::HoleFlag] == true) { + const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), + state.predicted(), + state.predictedCovariance()); + parm = ConvertActsTrackParameterToATLAS(actsParam, tgContext); + // auto boundaryCheck = m_boundaryCheckTool->boundaryCheck(*p arm); + typePattern.set(Trk::TrackStateOnSurface::Hole); + } + // The state was tagged as an outlier, use filtered parameters + else if (flag[Acts::TrackStateFlag::OutlierFlag] == true) { + const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), + state.filtered(), state.filteredCovariance()); + parm = ConvertActsTrackParameterToATLAS(actsParam, tgContext); + typePattern.set(Trk::TrackStateOnSurface::Outlier); + } + // The state is a measurement state, use smoothed parameters + else { + const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), + state.smoothed(), state.smoothedCovariance()); + actsSmoothedParam.push_back(std::make_unique<const Acts::BoundTrackParameters>(Acts::BoundTrackParameters(actsParam))); + // const auto& psurface=actsParam.referenceSurface(); + Acts::Vector2 local(actsParam.parameters()[Acts::eBoundLoc0], actsParam.parameters()[Acts::eBoundLoc1]); + // const Acts::Vector3 dir = Acts::makeDirectionUnitFromPhiTheta(actsParam.parameters()[Acts::eBoundPhi], actsParam.parameters()[Acts::eBoundTheta]); + // auto pos=actsParam.position(tgContext); + parm = ConvertActsTrackParameterToATLAS(actsParam, tgContext); + typePattern.set(Trk::TrackStateOnSurface::Measurement); + } + Tracker::FaserSCT_ClusterOnTrack* measState = nullptr; + if (state.hasUncalibrated()) { + auto sp= sps.at(state.uncalibrated().index()); + //const Tracker::FaserSCT_Cluster* fitCluster=&sp; + const Tracker::FaserSCT_Cluster* fitCluster=sp.clusterList().first; + if(fitCluster !=nullptr) { + measState = new Tracker::FaserSCT_ClusterOnTrack{ fitCluster, Trk::LocalParameters { Trk::DefinedParameter { fitCluster->localPosition()[0], Trk::loc1 }, Trk::DefinedParameter { fitCluster->localPosition()[1], Trk::loc2 } }, fitCluster->localCovariance(), m_idHelper->wafer_hash(fitCluster->detectorElement()->identify())}; + } + } + double nDoF = state.calibratedSize(); + const Trk::FitQualityOnSurface *quality = new Trk::FitQualityOnSurface(state.chi2(), nDoF); + const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(measState, parm, quality, nullptr, typePattern); + // If a state was succesfully created add it to the trajectory + if (perState) { + finalTrajectory->insert(finalTrajectory->begin(), perState); + } + } + return; }); -/* - // Convert the perigee state and add it to the trajectory - const Acts::BoundTrackParameters actsPer = fitOutput.fittedParameters.value(); - const Trk::TrackParameters *per = ConvertActsTrackParameterToATLAS(actsPer, tgContext); - std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; - typePattern.set(Trk::TrackStateOnSurface::Perigee); - const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(nullptr, per, nullptr, nullptr, typePattern); - if (perState) finalTrajectory->insert(finalTrajectory->begin(), perState); - */ // Create the track using the states const Trk::TrackInfo newInfo(Trk::TrackInfo::TrackFitter::KalmanFitter, Trk::ParticleHypothesis::muon); -// Trk::FitQuality* q = nullptr; - // newInfo.setTrackFitter(Trk::TrackInfo::TrackFitter::KalmanFitter ); //Mark the fitter as KalmanFitter + // Trk::FitQuality* q = nullptr; + // newInfo.setTrackFitter(Trk::TrackInfo::TrackFitter::KalmanFitter ); //Mark the fitter as KalmanFitter newtrack = std::make_unique<Trk::Track>(newInfo, std::move(*finalTrajectory), nullptr); } return newtrack; @@ -499,7 +427,7 @@ CombinatorialKalmanFilterAlg ::ConvertActsTrackParameterToATLAS(const Acts::Boun using namespace Acts::UnitLiterals; std::optional<AmgSymMatrix(5)> cov = std::nullopt; if (actsParameter.covariance()){ - AmgSymMatrix(5) newcov(actsParameter.covariance()->topLeftCorner<5, 5> (0, 0)); + AmgSymMatrix(5) newcov(actsParameter.covariance()->topLeftCorner(5, 5)); // Convert the covariance matrix to GeV for(int i=0; i < newcov.rows(); i++){ newcov(i, 4) = newcov(i, 4)*1_MeV; diff --git a/Tracking/Acts/FaserActsKalmanFilter/src/TrajectoryWriterTool.cxx b/Tracking/Acts/FaserActsKalmanFilter/src/TrajectoryWriterTool.cxx index f742348b0197db4f89a164acee6067aecf9dfe07..aca7bd57a3df15bfbecffc5e6afb996daffb7020 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/src/TrajectoryWriterTool.cxx +++ b/Tracking/Acts/FaserActsKalmanFilter/src/TrajectoryWriterTool.cxx @@ -237,7 +237,6 @@ void TrajectoryWriterTool::writeout(TrajectoriesContainer trajectories, // Get the entry index for the single trajectory auto& trackTip = trackTips.front(); - std::cout<<"trackTip = "<<trackTip<<std::endl; // Collect the trajectory summary info auto trajState = @@ -250,12 +249,7 @@ void TrajectoryWriterTool::writeout(TrajectoriesContainer trajectories, m_nHoles = trajState.nHoles; m_chi2_fit = trajState.chi2Sum; m_ndf_fit = trajState.NDF; - std::cout << "Track has " << trajState.nMeasurements - << " measurements and " << trajState.nHoles - << " holes and " << trajState.nOutliers - << " outliers and " << trajState.nStates - << " states " << std::endl; - + /// If it has track parameters, fill the values if (traj.hasTrackParameters(trackTip)) { @@ -311,10 +305,6 @@ void TrajectoryWriterTool::writeout(TrajectoriesContainer trajectories, // expand the local measurements into the full bound space Acts::BoundVector meas = state.projector().transpose() * state.calibrated(); - std::cout<<state.projector()<<std::endl; - std::cout<<state.projector().transpose()<<std::endl; - std::cout<<state.calibrated()<<std::endl; - std::cout<<meas<<std::endl; // extract local and global position Acts::Vector2 local(meas[Acts::eBoundLoc0], meas[Acts::eBoundLoc1]); diff --git a/Tracking/Acts/FaserActsKalmanFilter/src/components/FaserActsKalmanFilter_entries.cxx b/Tracking/Acts/FaserActsKalmanFilter/src/components/FaserActsKalmanFilter_entries.cxx index bb963dd1927d09d03fa2661efb5913f1c33e4dd4..0b86d895fdd266b4df4bb9ba6ecb3b928581c9db 100755 --- a/Tracking/Acts/FaserActsKalmanFilter/src/components/FaserActsKalmanFilter_entries.cxx +++ b/Tracking/Acts/FaserActsKalmanFilter/src/components/FaserActsKalmanFilter_entries.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -#include "FaserActsKalmanFilter/FaserActsKalmanFilterAlg.h" +//#include "FaserActsKalmanFilter/FaserActsKalmanFilterAlg.h" #include "FaserActsKalmanFilter/CombinatorialKalmanFilterAlg.h" #include "FaserActsKalmanFilter/TruthBasedInitialParameterTool.h" #include "FaserActsKalmanFilter/SPSeedBasedInitialParameterTool.h" @@ -11,7 +11,7 @@ #include "FaserActsKalmanFilter/SimWriterTool.h" -DECLARE_COMPONENT(FaserActsKalmanFilterAlg) +//DECLARE_COMPONENT(FaserActsKalmanFilterAlg) DECLARE_COMPONENT(CombinatorialKalmanFilterAlg) DECLARE_COMPONENT(TruthBasedInitialParameterTool) DECLARE_COMPONENT(SPSeedBasedInitialParameterTool) diff --git a/Tracking/Acts/FaserActsKalmanFilter/test/CombinatorialKalmanFilterAlg.py b/Tracking/Acts/FaserActsKalmanFilter/test/CombinatorialKalmanFilterAlg.py index ab47c4719fcb7ed6b420ddcd691965a82570b600..eef29095e39bc064e2dde11149be503b0d0d79ea 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/test/CombinatorialKalmanFilterAlg.py +++ b/Tracking/Acts/FaserActsKalmanFilter/test/CombinatorialKalmanFilterAlg.py @@ -34,14 +34,14 @@ acc.merge(TrackerSpacePointFinderCfg(ConfigFlags)) acc.merge(TrackerSeedFinderCfg(ConfigFlags)) acc.merge(CombinatorialKalmanFilterCfg(ConfigFlags)) -logging.getLogger('forcomps').setLevel(INFO) -acc.foreach_component("*").OutputLevel = INFO -acc.foreach_component("*ClassID*").OutputLevel = INFO -acc.getService("StoreGateSvc").Dump = True -acc.getService("ConditionStore").Dump = True -acc.printConfig(withDetails=True) -ConfigFlags.dump() - -sc = acc.run(maxEvents=-1) +# logging.getLogger('forcomps').setLevel(INFO) +# acc.foreach_component("*").OutputLevel = INFO +# acc.foreach_component("*ClassID*").OutputLevel = INFO +# acc.getService("StoreGateSvc").Dump = True +# acc.getService("ConditionStore").Dump = True +# acc.printConfig(withDetails=True) +# ConfigFlags.dump() + +sc = acc.run(maxEvents=1000) sys.exit(not sc.isSuccess())