diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt index 82163d59885262cbc8ca009f70e9eca9ad811e48..01a0267f1890ca67df4831a5067719b65e73d88c 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt +++ b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt @@ -30,6 +30,7 @@ target_include_directories(GaudiPandora PUBLIC ${GEAR_INCLUDE_DIRS} ${PandoraSDK_INCLUDE_DIRS} ${LCContent_INCLUDE_DIRS} + ${LCIO_INCLUDE_DIRS} ) install(TARGETS GaudiPandora diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h index df9793abc42eca3ebf7c83ae6a968077ec65ee3a..7be4f3eda09de92d827794c49f94d740a838b41d 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h @@ -25,7 +25,7 @@ #include <string> -typedef std::vector<edm4hep::CalorimeterHit *> CalorimeterHitVector; +typedef std::vector<edm4hep::ConstCalorimeterHit *> CalorimeterHitVector; namespace gear { class GearMgr; } @@ -174,25 +174,25 @@ private: * @brief Get common calo hit properties: position, parent address, input energy and time * */ - void GetCommonCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, PandoraApi::CaloHit::Parameters &caloHitParameters) const; + void GetCommonCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, PandoraApi::CaloHit::Parameters &caloHitParameters) const; /** * @brief Get end cap specific calo hit properties: cell size, absorber radiation and interaction lengths, normal vector * */ - void GetEndCapCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, + void GetEndCapCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const; - void GetEndCapCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers, + void GetEndCapCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers, PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const; /** * @brief Get barrel specific calo hit properties: cell size, absorber radiation and interaction lengths, normal vector * */ - void GetBarrelCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, + void GetBarrelCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, unsigned int barrelSymmetryOrder, float barrelPhi0, unsigned int staveNumber, PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const; - void GetBarrelCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers, + void GetBarrelCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers, unsigned int barrelSymmetryOrder, float barrelPhi0, unsigned int staveNumber, PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const; @@ -200,13 +200,13 @@ private: * @brief Get number of active layers from position of a calo hit to the edge of the detector * */ - int GetNLayersFromEdge(const edm4hep::CalorimeterHit *const pCaloHit) const; + int GetNLayersFromEdge(edm4hep::ConstCalorimeterHit *const pCaloHit) const; /** * @brief Get the maximum radius of a calo hit in a polygonal detector structure * */ - float GetMaximumRadius(const edm4hep::CalorimeterHit *const pCaloHit, const unsigned int symmetryOrder, const float phi0) const; + float GetMaximumRadius(edm4hep::ConstCalorimeterHit *const pCaloHit, const unsigned int symmetryOrder, const float phi0) const; /** * @brief Get the layer coding string from the provided cell id encoding string diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h index 4e446cf9c59ed15ea3f28034f99adedd8f407917..90281ef238e4b9eaad4b94814e2e29f5e66d9deb 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h @@ -78,7 +78,7 @@ private: const Settings m_settings; ///< The mc particle creator settings const pandora::Pandora *m_pPandora; ///< Address of the pandora object to create the mc particles const float m_bField; ///< The bfield - std::map<unsigned int, const edm4hep::MCParticle*>* m_id_pMC_map; + std::map<unsigned int, edm4hep::ConstMCParticle*>* m_id_pMC_map; }; inline void MCParticleCreator::Reset() diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h index 6a7a1bacfe9a26b462c645215dcc63370707d35a..7f6b57d2aa0ff26dae5b450d5da1a976f264c217 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h @@ -54,12 +54,12 @@ class CollectionMaps public: CollectionMaps(); void clear(); - std::map<std::string, std::vector<edm4hep::MCParticle> > collectionMap_MC; - std::map<std::string, std::vector<edm4hep::CalorimeterHit> > collectionMap_CaloHit; - std::map<std::string, std::vector<edm4hep::Vertex> > collectionMap_Vertex; - std::map<std::string, std::vector<edm4hep::Track> > collectionMap_Track; - std::map<std::string, std::vector<edm4hep::MCRecoCaloAssociation> > collectionMap_CaloRel; - std::map<std::string, std::vector<edm4hep::MCRecoTrackerAssociation> > collectionMap_TrkRel; + std::map<std::string, std::vector<edm4hep::ConstMCParticle> > collectionMap_MC; + std::map<std::string, std::vector<edm4hep::ConstCalorimeterHit> > collectionMap_CaloHit; + std::map<std::string, std::vector<edm4hep::ConstVertex> > collectionMap_Vertex; + std::map<std::string, std::vector<edm4hep::ConstTrack> > collectionMap_Track; + std::map<std::string, std::vector<edm4hep::ConstMCRecoCaloAssociation> > collectionMap_CaloRel; + std::map<std::string, std::vector<edm4hep::ConstMCRecoTrackerAssociation> > collectionMap_TrkRel; }; diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h index ad8f903451f4cea1a2a9b2a1879a615fd01d4139..1094a3dd7803c140a008ba109855e2f2d4a3db37 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h @@ -24,7 +24,7 @@ namespace gear { class GearMgr; } class CollectionMaps; -typedef std::vector<const edm4hep::Track *> TrackVector; +typedef std::vector<edm4hep::ConstTrack *> TrackVector; typedef std::set<unsigned int> TrackList; typedef std::map<edm4hep::ConstTrack, int> TrackToPidMap; /* @@ -125,7 +125,7 @@ public: */ pandora::StatusCode CreateTrackAssociations(const CollectionMaps& collectionMaps); - const edm4hep::Track* GetTrackAddress(const CollectionMaps& collectionMaps, const edm4hep::ConstTrack& pTrack ); + edm4hep::ConstTrack* GetTrackAddress(const CollectionMaps& collectionMaps, const edm4hep::ConstTrack& pTrack ); /** * @brief Create tracks, insert user code here * @@ -198,7 +198,7 @@ private: * @brief Copy track states stored in tracks to pandora track parameters * */ - void GetTrackStates(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; + void GetTrackStates(edm4hep::ConstTrack *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; /** * @brief Copy track state from track state instance to pandora input track state @@ -210,13 +210,13 @@ private: * @brief Obtain track time when it reaches ECAL * */ - float CalculateTrackTimeAtCalorimeter(const edm4hep::Track *const pTrack) const; + float CalculateTrackTimeAtCalorimeter(edm4hep::ConstTrack *const pTrack) const; /** * @brief Decide whether track reaches the ecal surface * */ - void TrackReachesECAL(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; + void TrackReachesECAL(edm4hep::ConstTrack *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; /** * @brief Determine whether a track can be used to form a pfo under the following conditions: @@ -224,7 +224,7 @@ private: * 2) if the track proves to have no cluster associations * */ - void DefineTrackPfoUsage(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; + void DefineTrackPfoUsage(edm4hep::ConstTrack *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; /** * @brief Whether track passes the quality cuts required in order to be used to form a pfo @@ -232,19 +232,19 @@ private: * * @return boolean */ - bool PassesQualityCuts(const edm4hep::Track *const pTrack, const PandoraApi::Track::Parameters &trackParameters) const; + bool PassesQualityCuts(edm4hep::ConstTrack *const pTrack, const PandoraApi::Track::Parameters &trackParameters) const; /** * @brief Get number of hits in TPC of a track * */ - int GetNTpcHits(const edm4hep::Track *const pTrack) const; + int GetNTpcHits(edm4hep::ConstTrack *const pTrack) const; /** * @brief Get number of hits in FTD of a track * */ - int GetNFtdHits(const edm4hep::Track *const pTrack) const; + int GetNFtdHits(edm4hep::ConstTrack *const pTrack) const; const Settings m_settings; ///< The track creator settings const pandora::Pandora *m_pPandora; ///< Address of the pandora object to create tracks and track relationships diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp index e3bd6e3c3e9812a2fe75637c9ca3a0782c7b3933..ae958c84b875b7d50ed759182a22c6145e0b06ce 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp @@ -240,14 +240,15 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col try { if(m_settings.m_debug) std::cout<<"CaloHitCreator for "<<tmp_col_name<<std::endl; - const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(tmp_col_name))->second; + auto pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(tmp_col_name))->second; const int nElements(pCaloHitCollection.size()); if (0 == nElements) continue; + auto tmpCaloHit0 = pCaloHitCollection.at(0); - ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str); + ID_UTIL::CellIDDecoder<decltype(tmpCaloHit0)> cellIdDecoder(m_encoder_str); const std::string layerCodingString(m_encoder_str); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); const std::string staveCoding(this->GetStaveCoding(layerCodingString)); @@ -275,8 +276,8 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col { try { - const edm4hep::CalorimeterHit& pCaloHit0 = pCaloHitCollection.at(i); - const edm4hep::CalorimeterHit* pCaloHit = &(pCaloHit0); + auto pCaloHit0 = pCaloHitCollection.at(i); + auto pCaloHit = &(pCaloHit0); if (NULL == pCaloHit) throw ("CreateECalCaloHits pCaloHit Collection type mismatch"); @@ -363,7 +364,7 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col } PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::CaloHit::Create(*m_pPandora, caloHitParameters)); - m_calorimeterHitVector.push_back(const_cast<edm4hep::CalorimeterHit*>(pCaloHit)); + m_calorimeterHitVector.push_back((pCaloHit)); } catch (pandora::StatusCodeException &statusCodeException) { @@ -394,14 +395,15 @@ pandora::StatusCode CaloHitCreator::CreateHCalCaloHits(const CollectionMaps& col if(collectionMaps.collectionMap_CaloHit.find(tmp_col_name) == collectionMaps.collectionMap_CaloHit.end()) { if(m_settings.m_debug) std::cout<<"not find "<<tmp_col_name<<std::endl; continue;} try { - const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(tmp_col_name))->second; + auto pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(tmp_col_name))->second; const int nElements(pCaloHitCollection.size()); if (0 == nElements) continue; + auto tmpCaloHit0 = pCaloHitCollection.at(0); - ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str); + ID_UTIL::CellIDDecoder<decltype(tmpCaloHit0)> cellIdDecoder(m_encoder_str); const std::string layerCodingString(m_encoder_str); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); const std::string staveCoding(this->GetStaveCoding(layerCodingString)); @@ -429,8 +431,8 @@ pandora::StatusCode CaloHitCreator::CreateHCalCaloHits(const CollectionMaps& col { try { - const edm4hep::CalorimeterHit& pCaloHit0 = pCaloHitCollection.at(i); - const edm4hep::CalorimeterHit* pCaloHit = &(pCaloHit0); + auto pCaloHit0 = pCaloHitCollection.at(i); + auto pCaloHit = &(pCaloHit0); if (NULL == pCaloHit) throw ("CreateHCalCaloHits Collection type mismatch"); @@ -487,7 +489,7 @@ pandora::StatusCode CaloHitCreator::CreateHCalCaloHits(const CollectionMaps& col caloHitParameters.m_electromagneticEnergy = m_settings.m_hCalToEMGeV * pCaloHit->getEnergy(); PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::CaloHit::Create(*m_pPandora, caloHitParameters)); - m_calorimeterHitVector.push_back(const_cast<edm4hep::CalorimeterHit*>(pCaloHit)); + m_calorimeterHitVector.push_back((pCaloHit)); } catch (pandora::StatusCodeException &statusCodeException) { @@ -518,14 +520,15 @@ pandora::StatusCode CaloHitCreator::CreateMuonCaloHits(const CollectionMaps& col if(collectionMaps.collectionMap_CaloHit.find(tmp_col_name) == collectionMaps.collectionMap_CaloHit.end()) {if(m_settings.m_debug) std::cout<<"not find "<<tmp_col_name<<std::endl; continue;} try { - const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(tmp_col_name))->second; + auto pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(tmp_col_name))->second; const int nElements(pCaloHitCollection.size()); if (0 == nElements) continue; + auto tmpCaloHit0 = pCaloHitCollection.at(0); - ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str_MUON); + ID_UTIL::CellIDDecoder<decltype(tmpCaloHit0)> cellIdDecoder(m_encoder_str_MUON); const std::string layerCodingString(m_encoder_str_MUON); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); const std::string staveCoding(this->GetStaveCoding(layerCodingString)); @@ -555,8 +558,8 @@ pandora::StatusCode CaloHitCreator::CreateMuonCaloHits(const CollectionMaps& col { try { - const edm4hep::CalorimeterHit& pCaloHit0 = pCaloHitCollection.at(i); - const edm4hep::CalorimeterHit* pCaloHit = &(pCaloHit0); + auto pCaloHit0 = pCaloHitCollection.at(i); + auto pCaloHit = &(pCaloHit0); if (NULL == pCaloHit) throw ("Muon Collection type mismatch"); @@ -627,7 +630,7 @@ pandora::StatusCode CaloHitCreator::CreateMuonCaloHits(const CollectionMaps& col } PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::CaloHit::Create(*m_pPandora, caloHitParameters)); - m_calorimeterHitVector.push_back(const_cast<edm4hep::CalorimeterHit*>(pCaloHit)); + m_calorimeterHitVector.push_back((pCaloHit)); } catch (pandora::StatusCodeException &statusCodeException) { @@ -658,15 +661,17 @@ pandora::StatusCode CaloHitCreator::CreateLCalCaloHits(const CollectionMaps& col if(collectionMaps.collectionMap_CaloHit.find(*iter) == collectionMaps.collectionMap_CaloHit.end()) {if(m_settings.m_debug)std::cout<<"not find "<<(*iter)<<std::endl; continue;} try { - const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; + auto pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; const int nElements(pCaloHitCollection.size()); if (0 == nElements) continue; + auto tmpCaloHit0 = pCaloHitCollection.at(0); + const gear::LayerLayout &endcapLayerLayout(_GEAR->getLcalParameters().getLayerLayout()); - ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str_LCal); + ID_UTIL::CellIDDecoder<decltype(tmpCaloHit0)> cellIdDecoder(m_encoder_str_LCal); const std::string layerCodingString(m_encoder_str_LCal); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); @@ -674,8 +679,8 @@ pandora::StatusCode CaloHitCreator::CreateLCalCaloHits(const CollectionMaps& col { try { - const edm4hep::CalorimeterHit& pCaloHit0 = pCaloHitCollection.at(i); - const edm4hep::CalorimeterHit* pCaloHit = &(pCaloHit0); + auto pCaloHit0 = pCaloHitCollection.at(i); + auto pCaloHit = &(pCaloHit0); if (NULL == pCaloHit) throw ("LCal Collection type mismatch"); @@ -700,7 +705,7 @@ pandora::StatusCode CaloHitCreator::CreateLCalCaloHits(const CollectionMaps& col caloHitParameters.m_hadronicEnergy = m_settings.m_eCalToHadGeVEndCap * pCaloHit->getEnergy(); PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::CaloHit::Create(*m_pPandora, caloHitParameters)); - m_calorimeterHitVector.push_back(const_cast<edm4hep::CalorimeterHit*>(pCaloHit)); + m_calorimeterHitVector.push_back((pCaloHit)); } catch (pandora::StatusCodeException &statusCodeException) { @@ -731,15 +736,16 @@ pandora::StatusCode CaloHitCreator::CreateLHCalCaloHits(const CollectionMaps& co if(collectionMaps.collectionMap_CaloHit.find(*iter) == collectionMaps.collectionMap_CaloHit.end()) {if(m_settings.m_debug) std::cout<<"not find "<<(*iter)<<std::endl; continue;} try { - const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; + auto pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; const int nElements(pCaloHitCollection.size()); if (0 == nElements) continue; const gear::LayerLayout &endcapLayerLayout(_GEAR->getLHcalParameters().getLayerLayout()); + auto tmpCaloHit0 = pCaloHitCollection.at(0); - ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str_LHCal); + ID_UTIL::CellIDDecoder<decltype(tmpCaloHit0)> cellIdDecoder(m_encoder_str_LHCal); const std::string layerCodingString(m_encoder_str_LHCal); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); @@ -747,8 +753,8 @@ pandora::StatusCode CaloHitCreator::CreateLHCalCaloHits(const CollectionMaps& co { try { - const edm4hep::CalorimeterHit& pCaloHit0 = pCaloHitCollection.at(i); - const edm4hep::CalorimeterHit* pCaloHit = &(pCaloHit0); + auto pCaloHit0 = pCaloHitCollection.at(i); + auto pCaloHit = &(pCaloHit0); if (NULL == pCaloHit) throw ("LHCal Collection type mismatch"); @@ -773,7 +779,7 @@ pandora::StatusCode CaloHitCreator::CreateLHCalCaloHits(const CollectionMaps& co caloHitParameters.m_electromagneticEnergy = m_settings.m_hCalToEMGeV * pCaloHit->getEnergy(); PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::CaloHit::Create(*m_pPandora, caloHitParameters)); - m_calorimeterHitVector.push_back(const_cast<edm4hep::CalorimeterHit*>(pCaloHit)); + m_calorimeterHitVector.push_back((pCaloHit)); } catch (pandora::StatusCodeException &statusCodeException) { @@ -796,7 +802,7 @@ pandora::StatusCode CaloHitCreator::CreateLHCalCaloHits(const CollectionMaps& co //------------------------------------------------------------------------------------------------------------------------------------------ -void CaloHitCreator::GetCommonCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, PandoraApi::CaloHit::Parameters &caloHitParameters) const +void CaloHitCreator::GetCommonCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, PandoraApi::CaloHit::Parameters &caloHitParameters) const { const float pCaloHitPosition[3]={pCaloHit->getPosition()[0], pCaloHit->getPosition()[1], pCaloHit->getPosition()[2]}; const pandora::CartesianVector positionVector(pCaloHitPosition[0], pCaloHitPosition[1], pCaloHitPosition[2]); @@ -811,7 +817,7 @@ void CaloHitCreator::GetCommonCaloHitProperties(const edm4hep::CalorimeterHit *c //------------------------------------------------------------------------------------------------------------------------------------------ -void CaloHitCreator::GetEndCapCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, +void CaloHitCreator::GetEndCapCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const { caloHitParameters.m_hitRegion = pandora::ENDCAP; @@ -856,7 +862,7 @@ void CaloHitCreator::GetEndCapCaloHitProperties(const edm4hep::CalorimeterHit *c } //------------------------------------------------------------------------------------------------------------------------------------------ -void CaloHitCreator::GetEndCapCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers, +void CaloHitCreator::GetEndCapCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers, PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const { caloHitParameters.m_hitRegion = pandora::ENDCAP; @@ -908,7 +914,7 @@ void CaloHitCreator::GetEndCapCaloHitProperties(const edm4hep::CalorimeterHit *c } //------------------------------------------------------------------------------------------------------------------------------------------ -void CaloHitCreator::GetBarrelCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, +void CaloHitCreator::GetBarrelCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, unsigned int barrelSymmetryOrder, float barrelPhi0, unsigned int staveNumber, PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const { @@ -971,7 +977,7 @@ void CaloHitCreator::GetBarrelCaloHitProperties(const edm4hep::CalorimeterHit *c } } -void CaloHitCreator::GetBarrelCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers, +void CaloHitCreator::GetBarrelCaloHitProperties(edm4hep::ConstCalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers, unsigned int barrelSymmetryOrder, float barrelPhi0, unsigned int staveNumber, PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const { @@ -1048,7 +1054,7 @@ void CaloHitCreator::GetBarrelCaloHitProperties(const edm4hep::CalorimeterHit *c //------------------------------------------------------------------------------------------------------------------------------------------ -int CaloHitCreator::GetNLayersFromEdge(const edm4hep::CalorimeterHit *const pCaloHit) const +int CaloHitCreator::GetNLayersFromEdge(edm4hep::ConstCalorimeterHit *const pCaloHit) const { // Calo hit coordinate calculations const float barrelMaximumRadius(this->GetMaximumRadius(pCaloHit, m_hCalBarrelOuterSymmetry, m_hCalBarrelOuterPhi0)); @@ -1090,7 +1096,7 @@ int CaloHitCreator::GetNLayersFromEdge(const edm4hep::CalorimeterHit *const pCal //------------------------------------------------------------------------------------------------------------------------------------------ -float CaloHitCreator::GetMaximumRadius(const edm4hep::CalorimeterHit *const pCaloHit, const unsigned int symmetryOrder, const float phi0) const +float CaloHitCreator::GetMaximumRadius(edm4hep::ConstCalorimeterHit *const pCaloHit, const unsigned int symmetryOrder, const float phi0) const { const float pCaloHitPosition[3]={pCaloHit->getPosition()[0], pCaloHit->getPosition()[1], pCaloHit->getPosition()[2]}; diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/MCParticleCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/MCParticleCreator.cpp index a9042a82183231212b3362656c9d38ab8ef6bbf0..ce8b42d8519f51ec472103c402c41a0088b0e776 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/MCParticleCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/MCParticleCreator.cpp @@ -26,7 +26,7 @@ MCParticleCreator::MCParticleCreator(const Settings &settings, const pandora::Pa m_pPandora(pPandora), m_bField(settings.m_bField) { -m_id_pMC_map = new std::map<unsigned int, const edm4hep::MCParticle*>; +m_id_pMC_map = new std::map<unsigned int, edm4hep::ConstMCParticle*>; } //------------------------------------------------------------------------------------------------------------------------------------------ @@ -45,20 +45,20 @@ pandora::StatusCode MCParticleCreator::CreateMCParticles(const CollectionMaps& c if(collectionMaps.collectionMap_MC.find(*iter) == collectionMaps.collectionMap_MC.end()) continue; try { - const std::vector<edm4hep::MCParticle>& pMCParticleCollection = (collectionMaps.collectionMap_MC.find(*iter))->second; + auto pMCParticleCollection = (collectionMaps.collectionMap_MC.find(*iter))->second; std::cout<<"Do CreateMCParticles, collection:"<<(*iter)<<", size="<<pMCParticleCollection.size()<<std::endl; for (int im = 0; im < pMCParticleCollection.size(); im++) { try { - const edm4hep::MCParticle& pMcParticle = pMCParticleCollection.at(im); + auto pMcParticle = pMCParticleCollection.at(im); PandoraApi::MCParticle::Parameters mcParticleParameters; mcParticleParameters.m_energy = sqrt(pMcParticle.getMomentum()[0] * pMcParticle.getMomentum()[0] + pMcParticle.getMomentum()[1] * pMcParticle.getMomentum()[1] + pMcParticle.getMomentum()[2] * pMcParticle.getMomentum()[2] + pMcParticle.getMass() * pMcParticle.getMass()); mcParticleParameters.m_particleId = pMcParticle.getPDG(); mcParticleParameters.m_mcParticleType = pandora::MC_3D; mcParticleParameters.m_pParentAddress = &pMcParticle; unsigned int p_id = pMcParticle.id(); - const edm4hep::MCParticle* p_mc = &pMcParticle; + auto p_mc = &pMcParticle; (*m_id_pMC_map) [p_id] = p_mc; mcParticleParameters.m_momentum = pandora::CartesianVector(pMcParticle.getMomentum()[0], pMcParticle.getMomentum()[1], pMcParticle.getMomentum()[2]); @@ -78,7 +78,7 @@ pandora::StatusCode MCParticleCreator::CreateMCParticles(const CollectionMaps& c if(pMCParticleCollection.at(ida).id()==(*itDaughter).id()) { - const edm4hep::MCParticle& dMcParticle = pMCParticleCollection.at(ida); + auto dMcParticle = pMCParticleCollection.at(ida); if(&pMcParticle == &dMcParticle){std::cout<< "error, mother and daughter are the same mc particle, don't save SetMCParentDaughterRelationship"<<std::endl;} else PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetMCParentDaughterRelationship(*m_pPandora, &pMcParticle, &dMcParticle)); break; @@ -108,7 +108,7 @@ pandora::StatusCode MCParticleCreator::CreateMCParticles(const CollectionMaps& c pandora::StatusCode MCParticleCreator::CreateCaloHitToMCParticleRelationships(const CollectionMaps& collectionMaps, const CalorimeterHitVector &calorimeterHitVector) const { - typedef std::map<const edm4hep::MCParticle *, float> MCParticleToEnergyWeightMap; + typedef std::map<edm4hep::ConstMCParticle *, float> MCParticleToEnergyWeightMap; MCParticleToEnergyWeightMap mcParticleToEnergyWeightMap; for (StringVector::const_iterator iter = m_settings.m_CaloHitRelationCollections.begin(), iterEnd = m_settings.m_CaloHitRelationCollections.end(); @@ -117,7 +117,7 @@ pandora::StatusCode MCParticleCreator::CreateCaloHitToMCParticleRelationships(co if(collectionMaps.collectionMap_CaloRel.find(*iter) == collectionMaps.collectionMap_CaloRel.end()) continue; try { - const std::vector<edm4hep::MCRecoCaloAssociation>& pMCRecoCaloAssociationCollection = (collectionMaps.collectionMap_CaloRel.find(*iter))->second; + auto pMCRecoCaloAssociationCollection = (collectionMaps.collectionMap_CaloRel.find(*iter))->second; for (unsigned i_calo=0; i_calo < calorimeterHitVector.size(); i_calo++) { @@ -128,14 +128,14 @@ pandora::StatusCode MCParticleCreator::CreateCaloHitToMCParticleRelationships(co { if( pMCRecoCaloAssociationCollection.at(ic).getRec().id() != (*(calorimeterHitVector.at(i_calo))).id() ) continue; - const edm4hep::ConstSimCalorimeterHit pSimHit = pMCRecoCaloAssociationCollection.at(ic).getSim(); + auto pSimHit = pMCRecoCaloAssociationCollection.at(ic).getSim(); for (int iCont = 0, iEnd = pSimHit.contributions_size(); iCont < iEnd; ++iCont) { - edm4hep::ConstCaloHitContribution conb = pSimHit.getContributions(iCont); - const edm4hep::ConstMCParticle ipa = conb.getParticle(); + auto conb = pSimHit.getContributions(iCont); + auto ipa = conb.getParticle(); float ien = conb.getEnergy(); if( m_id_pMC_map->find(ipa.id()) == m_id_pMC_map->end() ) continue; - const edm4hep::MCParticle * p_tmp = (*m_id_pMC_map)[ipa.id()]; + auto p_tmp = (*m_id_pMC_map)[ipa.id()]; mcParticleToEnergyWeightMap[p_tmp] += ien; } @@ -172,32 +172,32 @@ pandora::StatusCode MCParticleCreator::CreateTrackToMCParticleRelationships(cons { for (unsigned ik = 0; ik < trackVector.size(); ik++) { - const edm4hep::Track *pTrack = trackVector.at(ik); + auto pTrack = trackVector.at(ik); // Get reconstructed momentum at dca const pandora::Helix helixFit(pTrack->getTrackStates(0).phi, pTrack->getTrackStates(0).D0, pTrack->getTrackStates(0).Z0, pTrack->getTrackStates(0).omega, pTrack->getTrackStates(0).tanLambda, m_bField); const float recoMomentum(helixFit.GetMomentum().GetMagnitude()); // Use momentum magnitude to identify best mc particle - edm4hep::MCParticle *pBestMCParticle = NULL; + edm4hep::ConstMCParticle *pBestMCParticle = NULL; float bestDeltaMomentum(std::numeric_limits<float>::max()); try { for (StringVector::const_iterator iter = m_settings.m_TrackRelationCollections.begin(), iterEnd = m_settings.m_TrackRelationCollections.end(); iter != iterEnd; ++iter) { if(collectionMaps.collectionMap_TrkRel.find(*iter) == collectionMaps.collectionMap_TrkRel.end()) continue; - const std::vector<edm4hep::MCRecoTrackerAssociation>& pMCRecoTrackerAssociationCollection = (collectionMaps.collectionMap_TrkRel.find(*iter))->second; + auto pMCRecoTrackerAssociationCollection = (collectionMaps.collectionMap_TrkRel.find(*iter))->second; for(unsigned ith=0 ; ith<pTrack->trackerHits_size(); ith++) { for(unsigned ic=0; ic < pMCRecoTrackerAssociationCollection.size(); ic++) { if( pMCRecoTrackerAssociationCollection.at(ic).getRec().id() != pTrack->getTrackerHits(ith).id() ) continue; - const edm4hep::ConstSimTrackerHit pSimHit = pMCRecoTrackerAssociationCollection.at(ic).getSim(); - const edm4hep::ConstMCParticle ipa = pSimHit.getMCParticle(); + auto pSimHit = pMCRecoTrackerAssociationCollection.at(ic).getSim(); + auto ipa = pSimHit.getMCParticle(); if( m_id_pMC_map->find(ipa.id()) == m_id_pMC_map->end() ) continue; const float trueMomentum(pandora::CartesianVector(ipa.getMomentum()[0], ipa.getMomentum()[1], ipa.getMomentum()[2]).GetMagnitude()); const float deltaMomentum(std::fabs(recoMomentum - trueMomentum)); if (deltaMomentum < bestDeltaMomentum) { - pBestMCParticle =const_cast<edm4hep::MCParticle*>((*m_id_pMC_map)[ipa.id()]); + pBestMCParticle =((*m_id_pMC_map)[ipa.id()]); bestDeltaMomentum = deltaMomentum; } } diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp index 18030dbdb33cf0a5f62876fe64e237e550753855..0e16f4e61e09dc01e9913d8349585045f99a3ec7 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp @@ -479,8 +479,8 @@ StatusCode PandoraPFAlg::updateMap() auto handle = dynamic_cast<DataHandle<edm4hep::MCParticleCollection>*> (v.second); auto po = handle->get(); if(po != NULL){ - std::vector<edm4hep::MCParticle> v_mc; - m_CollectionMaps->collectionMap_MC [v.first] = v_mc; + // std::vector<edm4hep::MCParticle> v_mc; + // m_CollectionMaps->collectionMap_MC [v.first] = v_mc; for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_MC [v.first].push_back(po->at(i)); debug()<<"saved col name="<<v.first<<endmsg; } @@ -493,8 +493,8 @@ StatusCode PandoraPFAlg::updateMap() auto handle = dynamic_cast<DataHandle<edm4hep::CalorimeterHitCollection>*> (v.second); auto po = handle->get(); if(po != NULL){ - std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->collectionMap_CaloHit[v.first] = v_cal ; + // std::vector<edm4hep::CalorimeterHit> v_cal; + // m_CollectionMaps->collectionMap_CaloHit[v.first] = v_cal ; for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_CaloHit [v.first].push_back(po->at(i)); debug()<<"saved col name="<<v.first<<endmsg; } @@ -507,8 +507,8 @@ StatusCode PandoraPFAlg::updateMap() auto handle = dynamic_cast<DataHandle<edm4hep::TrackCollection>*> (v.second); auto po = handle->get(); if(po != NULL){ - std::vector<edm4hep::Track> v_cal; - m_CollectionMaps->collectionMap_Track[v.first] = v_cal ; + // std::vector<edm4hep::Track> v_cal; + // m_CollectionMaps->collectionMap_Track[v.first] = v_cal ; for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_Track [v.first].push_back(po->at(i)); debug() <<"saved col name="<<v.first<<endmsg; m_marlinTrack = po->size(); @@ -522,8 +522,8 @@ StatusCode PandoraPFAlg::updateMap() auto handle = dynamic_cast<DataHandle<edm4hep::VertexCollection>*> (v.second); auto po = handle->get(); if(po != NULL){ - std::vector<edm4hep::Vertex> v_cal; - m_CollectionMaps->collectionMap_Vertex[v.first] = v_cal ; + // std::vector<edm4hep::Vertex> v_cal; + // m_CollectionMaps->collectionMap_Vertex[v.first] = v_cal ; for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_Vertex [v.first].push_back(po->at(i)); debug() <<"saved col name="<<v.first<<endmsg; } @@ -536,8 +536,8 @@ StatusCode PandoraPFAlg::updateMap() auto handle = dynamic_cast<DataHandle<edm4hep::MCRecoCaloAssociationCollection>*> (v.second); auto po = handle->get(); if(po != NULL){ - std::vector<edm4hep::MCRecoCaloAssociation> v_cal; - m_CollectionMaps->collectionMap_CaloRel[v.first] = v_cal ; + // std::vector<edm4hep::MCRecoCaloAssociation> v_cal; + // m_CollectionMaps->collectionMap_CaloRel[v.first] = v_cal ; for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_CaloRel [v.first].push_back(po->at(i)); debug() <<"saved col name="<<v.first<<endmsg; } @@ -550,8 +550,8 @@ StatusCode PandoraPFAlg::updateMap() auto handle = dynamic_cast<DataHandle<edm4hep::MCRecoTrackerAssociationCollection>*> (v.second); auto po = handle->get(); if(po != NULL){ - std::vector<edm4hep::MCRecoTrackerAssociation> v_cal; - m_CollectionMaps->collectionMap_TrkRel[v.first] = v_cal ; + // std::vector<edm4hep::MCRecoTrackerAssociation> v_cal; + // m_CollectionMaps->collectionMap_TrkRel[v.first] = v_cal ; for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_TrkRel [v.first].push_back(po->at(i)); debug() <<"saved col name="<<v.first<<endmsg; } @@ -584,7 +584,7 @@ StatusCode PandoraPFAlg::Ana() for(int i=0; i<reco_col->size();i++) { if( m_n_rec >= m_max_rec) break; - const edm4hep::ReconstructedParticle pReco = reco_col->at(i); + auto pReco = reco_col->at(i); const float px = pReco.getMomentum()[0]; const float py = pReco.getMomentum()[1]; const float pz = pReco.getMomentum()[2]; @@ -656,19 +656,19 @@ StatusCode PandoraPFAlg::CreateMCRecoParticleAssociation() std::map<int, edm4hep::ConstMCParticle> mc_map; std::map<int, float > id_edep_map; float tot_en = 0 ; - const edm4hep::ReconstructedParticle pReco = reco_col->at(i); + auto pReco = reco_col->at(i); for(int j=0; j < pReco.clusters_size(); j++) { edm4hep::ConstCluster cluster = pReco.getClusters(j); for(int k=0; k < cluster.hits_size(); k++) { edm4hep::ConstCalorimeterHit hit = cluster.getHits(k); - for(std::map<std::string, std::vector<edm4hep::MCRecoCaloAssociation> >::iterator iter = m_CollectionMaps->collectionMap_CaloRel.begin(); iter != m_CollectionMaps->collectionMap_CaloRel.end(); iter++) + for(auto iter = m_CollectionMaps->collectionMap_CaloRel.begin(); iter != m_CollectionMaps->collectionMap_CaloRel.end(); iter++) { - for(std::vector<edm4hep::MCRecoCaloAssociation>::iterator it = iter->second.begin(); it != iter->second.end(); it ++) + for(auto it = iter->second.begin(); it != iter->second.end(); it ++) { if(it->getRec().id() != hit.id()) continue; - for(std::vector<edm4hep::ConstCaloHitContribution>::const_iterator itc = it->getSim().contributions_begin(); itc != it->getSim().contributions_end(); itc++) + for(auto itc = it->getSim().contributions_begin(); itc != it->getSim().contributions_end(); itc++) { if(mc_map.find(itc->getParticle().id()) == mc_map.end()) mc_map[itc->getParticle().id()] = itc->getParticle() ; if(id_edep_map.find(itc->getParticle().id()) != id_edep_map.end()) id_edep_map[itc->getParticle().id()] = id_edep_map[itc->getParticle().id()] + itc->getEnergy() ; @@ -679,7 +679,7 @@ StatusCode PandoraPFAlg::CreateMCRecoParticleAssociation() } } } - for(std::map<int, edm4hep::ConstMCParticle>::iterator it = mc_map.begin(); it != mc_map.end(); it ++) + for(auto it = mc_map.begin(); it != mc_map.end(); it ++) { edm4hep::MCRecoParticleAssociation association = pMCRecoParticleAssociationCollection->create(); association.setRec(pReco); diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp index 4b67db277fcb73218e559c6acd1521b7a28a637f..82d60b63a231b85bc5ca2cf29a6b8dc6f1a68b7c 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp @@ -291,20 +291,20 @@ pandora::StatusCode TrackCreator::ExtractKinks(const CollectionMaps& collectionM if(collectionMaps.collectionMap_Vertex.find(*iter) == collectionMaps.collectionMap_Vertex.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;} try { - const std::vector<edm4hep::Vertex>& pKinkCollection = (collectionMaps.collectionMap_Vertex.find(*iter))->second; + auto pKinkCollection = (collectionMaps.collectionMap_Vertex.find(*iter))->second; for (int i = 0, iMax = pKinkCollection.size(); i < iMax; ++i) { try { - const edm4hep::Vertex pVertex0 = pKinkCollection.at(i); - const edm4hep::Vertex* pVertex = &(pVertex0); + auto pVertex0 = pKinkCollection.at(i); + auto pVertex = &(pVertex0); if (NULL == pVertex) throw ("Collection type mismatch"); //std::cout<<"pVertex getChi2="<<pVertex->getChi2()<<std::endl; //std::cout<<"pReconstructedParticle en="<<pReconstructedParticle.getEnergy()<<",type="<<pReconstructedParticle.getType()<<std::endl; - const edm4hep::ConstReconstructedParticle pReconstructedParticle = pVertex->getAssociatedParticle(); + auto pReconstructedParticle = pVertex->getAssociatedParticle(); if (this->IsConflictingRelationship(pReconstructedParticle))continue; const int vertexPdgCode(pReconstructedParticle.getType()); @@ -312,7 +312,7 @@ pandora::StatusCode TrackCreator::ExtractKinks(const CollectionMaps& collectionM // Extract the kink vertex information for (unsigned int iTrack = 0, nTracks = pReconstructedParticle.tracks_size(); iTrack < nTracks; ++iTrack) { - edm4hep::ConstTrack pTrack = pReconstructedParticle.getTracks(iTrack); + auto pTrack = pReconstructedParticle.getTracks(iTrack); (0 == iTrack) ? m_parentTrackList.insert(pTrack.id()) : m_daughterTrackList.insert(pTrack.id()); int trackPdgCode = pandora::UNKNOWN_PARTICLE_TYPE; @@ -395,14 +395,14 @@ pandora::StatusCode TrackCreator::ExtractProngsAndSplits(const CollectionMaps& c if(collectionMaps.collectionMap_Vertex.find(*iter) == collectionMaps.collectionMap_Vertex.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;} try { - const std::vector<edm4hep::Vertex>& pProngOrSplitCollection = (collectionMaps.collectionMap_Vertex.find(*iter))->second; + auto pProngOrSplitCollection = (collectionMaps.collectionMap_Vertex.find(*iter))->second; for (int i = 0, iMax = pProngOrSplitCollection.size(); i < iMax; ++i) { try { - const edm4hep::Vertex pVertex0 = pProngOrSplitCollection.at(i); - const edm4hep::Vertex* pVertex = &(pVertex0); + auto pVertex0 = pProngOrSplitCollection.at(i); + auto pVertex = &(pVertex0); if (NULL == pVertex) throw ("Collection type mismatch"); const edm4hep::ConstReconstructedParticle pReconstructedParticle = pVertex->getAssociatedParticle(); @@ -461,14 +461,14 @@ pandora::StatusCode TrackCreator::ExtractV0s(const CollectionMaps& collectionMap if(collectionMaps.collectionMap_Vertex.find(*iter) == collectionMaps.collectionMap_Vertex.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;} try { - const std::vector<edm4hep::Vertex>& pV0Collection = (collectionMaps.collectionMap_Vertex.find(*iter))->second; + auto pV0Collection = (collectionMaps.collectionMap_Vertex.find(*iter))->second; for (int i = 0, iMax = pV0Collection.size(); i < iMax; ++i) { try { - const edm4hep::Vertex pVertex0 = pV0Collection.at(i); - const edm4hep::Vertex* pVertex = &(pVertex0); + auto pVertex0 = pV0Collection.at(i); + auto pVertex = &(pVertex0); if (NULL == pVertex) throw ("Collection type mismatch"); @@ -547,16 +547,16 @@ bool TrackCreator::IsConflictingRelationship(const edm4hep::ConstReconstructedPa return false; } -const edm4hep::Track* TrackCreator::GetTrackAddress(const CollectionMaps& collectionMaps, const edm4hep::ConstTrack& pTrack ) +edm4hep::ConstTrack* TrackCreator::GetTrackAddress(const CollectionMaps& collectionMaps, const edm4hep::ConstTrack& pTrack ) { for (StringVector::const_iterator iter = m_settings.m_trackCollections.begin(), iterEnd = m_settings.m_trackCollections.end(); iter != iterEnd; ++iter) { if(collectionMaps.collectionMap_Track.find(*iter) == collectionMaps.collectionMap_Track.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;} - const std::vector<edm4hep::Track>& pTrackCollection = (collectionMaps.collectionMap_Track.find(*iter))->second; + auto pTrackCollection = (collectionMaps.collectionMap_Track.find(*iter))->second; for (int i = 0, iMax = pTrackCollection.size(); i < iMax; ++i) { - const edm4hep::Track& pTrack0 = pTrackCollection.at(i); - if (pTrack.id() == pTrack0.id()) return (const edm4hep::Track*) (&pTrack0); + auto pTrack0 = pTrackCollection.at(i); + if (pTrack.id() == pTrack0.id()) return (&pTrack0); } } return NULL; @@ -572,20 +572,20 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM if(collectionMaps.collectionMap_Track.find(*iter) == collectionMaps.collectionMap_Track.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;} try { - const std::vector<edm4hep::Track>& pTrackCollection = (collectionMaps.collectionMap_Track.find(*iter))->second; + auto pTrackCollection = (collectionMaps.collectionMap_Track.find(*iter))->second; if(m_settings.m_debug) std::cout<<"TrackSize:"<<pTrackCollection.size()<<std::endl; for (int i = 0, iMax = pTrackCollection.size(); i < iMax; ++i) { try { - const edm4hep::Track& pTrack0 = pTrackCollection.at(i); - const edm4hep::Track* pTrack = (const edm4hep::Track*)(&pTrack0); + auto pTrack0 = pTrackCollection.at(i); + auto pTrack = (&pTrack0); if (NULL == pTrack) throw ("Collection type mismatch"); if(m_settings.m_debug){ for(int ip=0; ip<pTrack->trackStates_size(); ip++){ - edm4hep::TrackState tmp_pTrackState = pTrack->getTrackStates(ip); + auto tmp_pTrackState = pTrack->getTrackStates(ip); const double tmp_pt(m_bField * 2.99792e-4 / std::fabs(tmp_pTrackState.omega)); edm4hep::Vector3f pref = tmp_pTrackState.referencePoint; std::cout<<"ip="<<ip<<",pt=" << tmp_pt <<",refx="<<pref[0]<<",refy="<<pref[1]<<",refz="<<pref[2]<<",tanLambda=" << tmp_pTrackState.tanLambda<<",D0="<<tmp_pTrackState.D0<<",Z0="<<tmp_pTrackState.Z0<<",phi="<<tmp_pTrackState.phi<< std::endl; @@ -665,7 +665,7 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM //------------------------------------------------------------------------------------------------------------------------------------------ -void TrackCreator::GetTrackStates(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const +void TrackCreator::GetTrackStates(edm4hep::ConstTrack *const pTrack, PandoraApi::Track::Parameters &trackParameters) const { // for DD4HEP, 0 is IP, 1 is AtFirstHit, 2 is AtLastHit, 3 is AtCalo edm4hep::TrackState pTrackState = pTrack->getTrackStates(0); @@ -691,7 +691,7 @@ void TrackCreator::GetTrackStates(const edm4hep::Track *const pTrack, PandoraApi //------------------------------------------------------------------------------------------------------------------------------------------ -float TrackCreator::CalculateTrackTimeAtCalorimeter(const edm4hep::Track *const pTrack) const +float TrackCreator::CalculateTrackTimeAtCalorimeter(edm4hep::ConstTrack *const pTrack) const { const pandora::Helix helix(pTrack->getTrackStates(0).phi, pTrack->getTrackStates(0).D0, pTrack->getTrackStates(0).Z0, pTrack->getTrackStates(0).omega, pTrack->getTrackStates(0).tanLambda, m_bField); const pandora::CartesianVector &referencePoint(helix.GetReferencePoint()); @@ -764,7 +764,7 @@ void TrackCreator::CopyTrackState(const edm4hep::TrackState & pTrackState, pando //------------------------------------------------------------------------------------------------------------------------------------------ -void TrackCreator::TrackReachesECAL(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const +void TrackCreator::TrackReachesECAL(edm4hep::ConstTrack *const pTrack, PandoraApi::Track::Parameters &trackParameters) const { // Calculate hit position information @@ -847,7 +847,7 @@ void TrackCreator::TrackReachesECAL(const edm4hep::Track *const pTrack, PandoraA //------------------------------------------------------------------------------------------------------------------------------------------ -void TrackCreator::DefineTrackPfoUsage(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const +void TrackCreator::DefineTrackPfoUsage(edm4hep::ConstTrack *const pTrack, PandoraApi::Track::Parameters &trackParameters) const { bool canFormPfo(false); bool canFormClusterlessPfo(false); @@ -858,7 +858,7 @@ void TrackCreator::DefineTrackPfoUsage(const edm4hep::Track *const pTrack, Pando float rInner(std::numeric_limits<float>::max()), zMin(std::numeric_limits<float>::max()); - for (std::vector<edm4hep::ConstTrackerHit>::const_iterator iter = pTrack->trackerHits_begin(), iterEnd = pTrack->trackerHits_end(); iter != iterEnd; ++iter) + for (auto iter = pTrack->trackerHits_begin(), iterEnd = pTrack->trackerHits_end(); iter != iterEnd; ++iter) { const edm4hep::Vector3d pPosition = (*iter).getPosition(); const float x(pPosition[0]), y(pPosition[1]), absoluteZ(std::fabs(pPosition[2])); @@ -932,7 +932,7 @@ void TrackCreator::DefineTrackPfoUsage(const edm4hep::Track *const pTrack, Pando //------------------------------------------------------------------------------------------------------------------------------------------ -bool TrackCreator::PassesQualityCuts(const edm4hep::Track *const pTrack, const PandoraApi::Track::Parameters &trackParameters) const +bool TrackCreator::PassesQualityCuts(edm4hep::ConstTrack *const pTrack, const PandoraApi::Track::Parameters &trackParameters) const { // First simple sanity checks if (trackParameters.m_trackStateAtCalorimeter.Get().GetPosition().GetMagnitude() < m_settings.m_minTrackECalDistanceFromIp) @@ -1009,7 +1009,7 @@ bool TrackCreator::PassesQualityCuts(const edm4hep::Track *const pTrack, const P //------------------------------------------------------------------------------------------------------------------------------------------ -int TrackCreator::GetNTpcHits(const edm4hep::Track *const pTrack) const +int TrackCreator::GetNTpcHits(edm4hep::ConstTrack *const pTrack) const { // ATTN //fg: hit numbers are now given in different order wrt LOI: @@ -1028,7 +1028,7 @@ int TrackCreator::GetNTpcHits(const edm4hep::Track *const pTrack) const //------------------------------------------------------------------------------------------------------------------------------------------ -int TrackCreator::GetNFtdHits(const edm4hep::Track *const pTrack) const +int TrackCreator::GetNFtdHits(edm4hep::ConstTrack *const pTrack) const { // ATTN //fg: hit numbers are now given in different order wrt LOI: