diff --git a/Examples/options/tut_detsim_pandora.py b/Examples/options/tut_detsim_pandora.py new file mode 100644 index 0000000000000000000000000000000000000000..b4ceaf07377898130aea5d39e6e304242cda1262 --- /dev/null +++ b/Examples/options/tut_detsim_pandora.py @@ -0,0 +1,211 @@ +#!/usr/bin/env python + +import os +print(os.environ["DD4HEP_LIBRARY_PATH"]) +import sys +# sys.exit(0) + +from Gaudi.Configuration import * + +############################################################################## +# Random Number Svc +############################################################################## +from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_ + +# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi +rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_() # The default engine in Geant4 +rndmengine.SetSingleton = True +rndmengine.Seeds = [42] + +# rndmgensvc = RndmGenSvc("RndmGenSvc") +# rndmgensvc.Engine = rndmengine.name() + + +############################################################################## +# Event Data Svc +############################################################################## +#from Configurables import CEPCDataSvc +#dsvc = CEPCDataSvc("EventDataSvc") +from Configurables import K4DataSvc +dsvc = K4DataSvc("EventDataSvc") + + +############################################################################## +# Geometry Svc +############################################################################## + +# geometry_option = "CepC_v4-onlyTracker.xml" +geometry_option = "CepC_v4-onlyVXD.xml" + +if not os.getenv("DETCEPCV4ROOT"): + print("Can't find the geometry. Please setup envvar DETCEPCV4ROOT." ) + sys.exit(-1) + +geometry_path = os.path.join(os.getenv("DETCEPCV4ROOT"), "compact", geometry_option) +if not os.path.exists(geometry_path): + print("Can't find the compact geometry file: %s"%geometry_path) + sys.exit(-1) + +from Configurables import GeoSvc +geosvc = GeoSvc("GeoSvc") +geosvc.compact = geometry_path + +############################################################################## +# Physics Generator +############################################################################## +from Configurables import GenAlgo +from Configurables import GtGunTool +from Configurables import StdHepRdr +from Configurables import SLCIORdr +from Configurables import HepMCRdr +from Configurables import GenPrinter + +gun = GtGunTool("GtGunTool") +gun.Particles = ["gamma","gamma"] +gun.EnergyMins= [10, 10] # GeV +gun.EnergyMaxs= [10, 10] # GeV +gun.ThetaMins = [90, 90] # degree +gun.ThetaMaxs = [90, 90] # degree +gun.PhiMins = [0, 1 ] # degree +gun.PhiMaxs = [0, 1 ] # degree + + +stdheprdr = StdHepRdr("StdHepRdr") +#stdheprdr.Input = "/cefs/data/stdhep/CEPC250/2fermions/E250.Pbhabha.e0.p0.whizard195/bhabha.e0.p0.00001.stdhep" +#stdheprdr.Input = "/cefs/data/stdhep/CEPC250/2fermions/E250.Pbhabha.e0.p0.whizard195/bhabha.e0.p0.00001.stdhep" +stdheprdr.Input = "/cefs/data/stdhep/CEPC250/higgs/E250.Pbbh.whizard195/E250.Pbbh_X.e0.p0.whizard195/Pbbh_X.e0.p0.00001.stdhep" + +# lciordr = SLCIORdr("SLCIORdr") +# lciordr.Input = "/cefs/data/stdhep/lcio250/signal/Higgs/E250.Pbbh.whizard195/E250.Pbbh_X.e0.p0.whizard195/Pbbh_X.e0.p0.00001.slcio" + +# hepmcrdr = HepMCRdr("HepMCRdr") +# hepmcrdr.Input = "example_UsingIterators.txt" + +genprinter = GenPrinter("GenPrinter") + +genalg = GenAlgo("GenAlgo") +genalg.GenTools = ["GtGunTool"] +#genalg.GenTools = ["StdHepRdr"] +# genalg.GenTools = ["StdHepRdr", "GenPrinter"] +# genalg.GenTools = ["SLCIORdr", "GenPrinter"] +# genalg.GenTools = ["HepMCRdr", "GenPrinter"] + +############################################################################## +# Detector Simulation +############################################################################## +from Configurables import DetSimSvc + +detsimsvc = DetSimSvc("DetSimSvc") + +# from Configurables import ExampleAnaElemTool +# example_anatool = ExampleAnaElemTool("ExampleAnaElemTool") + +from Configurables import DetSimAlg + +detsimalg = DetSimAlg("DetSimAlg") + +# detsimalg.VisMacs = ["vis.mac"] + +detsimalg.RunCmds = [ +# "/tracking/verbose 1", +] +detsimalg.AnaElems = [ + # example_anatool.name() + # "ExampleAnaElemTool" + "Edm4hepWriterAnaElemTool" +] +detsimalg.RootDetElem = "WorldDetElemTool" + +from Configurables import AnExampleDetElemTool +example_dettool = AnExampleDetElemTool("AnExampleDetElemTool") + +############################################################################## +from Configurables import CaloDigiAlg +example_CaloDigiAlg = CaloDigiAlg("CaloDigiAlg") +example_CaloDigiAlg.Scale = 1 +example_CaloDigiAlg.SimCaloHitCollection = "SimCalorimeterCol" +example_CaloDigiAlg.CaloHitCollection = "ECALBarrel" +example_CaloDigiAlg.CaloAssociationCollection = "RecoCaloAssociation_ECALBarrel" +############################################################################## +from Configurables import GearSvc +gearSvc = GearSvc("GearSvc") +gearSvc.GearXMLFile = "../Detector/DetCEPCv4/compact/FullDetGear.xml" +############################################################################## +from Configurables import PandoraPFAlg + +pandoralg = PandoraPFAlg("PandoraPFAlg") +## KEEP same with lcioinput name for the ReadXXX ########### +pandoralg.ReadMCParticle = "MCParticle" +pandoralg.ReadECALBarrel = "ECALBarrel" +pandoralg.ReadECALEndcap = "ECALEndcap" +pandoralg.ReadECALOther = "ECALOther" +pandoralg.ReadHCALBarrel = "HCALBarrel" +pandoralg.ReadHCALEndcap = "HCALEndcap" +pandoralg.ReadHCALOther = "HCALOther" +pandoralg.ReadMUON = "MUON" +pandoralg.ReadLCAL = "LCAL" +pandoralg.ReadLHCAL = "LHCAL" +pandoralg.ReadBCAL = "BCAL" +pandoralg.ReadKinkVertices = "KinkVertices" +pandoralg.ReadProngVertices = "ProngVertices" +pandoralg.ReadSplitVertices = "SplitVertices" +pandoralg.ReadV0Vertices = "V0Vertices" +pandoralg.ReadTracks = "MarlinTrkTracks" +pandoralg.MCRecoCaloAssociation = "RecoCaloAssociation_ECALBarrel" +pandoralg.WriteClusterCollection = "PandoraClusters" +pandoralg.WriteReconstructedParticleCollection = "PandoraPFOs" +pandoralg.WriteVertexCollection = "PandoraPFANewStartVertices" +pandoralg.AnaOutput = "Ana.root" + +pandoralg.PandoraSettingsDefault_xml = "../Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml" +#### Do not chage the collection name, only add or remove ############### +pandoralg.TrackCollections = ["MarlinTrkTracks"] +pandoralg.ECalCaloHitCollections= ["ECALBarrel", "ECALEndcap", "ECALOther"] +pandoralg.HCalCaloHitCollections= ["HCALBarrel", "HCALEndcap", "HCALOther"] +pandoralg.LCalCaloHitCollections= ["LCAL"] +pandoralg.LHCalCaloHitCollections= ["LHCAL"] +pandoralg.MuonCaloHitCollections= ["MUON"] +pandoralg.MCParticleCollections = ["MCParticle"] +pandoralg.RelCaloHitCollections = ["RecoCaloAssociation_ECALBarrel", "RecoCaloAssociation_ECALEndcap", "RecoCaloAssociation_ECALOther", "RecoCaloAssociation_HCALBarrel", "RecoCaloAssociation_HCALEndcap", "RecoCaloAssociation_HCALOther", "RecoCaloAssociation_LCAL", "RecoCaloAssociation_LHCAL", "RecoCaloAssociation_MUON"] +pandoralg.RelTrackCollections = ["MarlinTrkTracksMCTruthLink"] +pandoralg.KinkVertexCollections = ["KinkVertices"] +pandoralg.ProngVertexCollections= ["ProngVertices"] +pandoralg.SplitVertexCollections= ["SplitVertices"] +pandoralg.V0VertexCollections = ["V0Vertices"] +pandoralg.ECalToMipCalibration = 160.0 +pandoralg.HCalToMipCalibration = 34.8 +pandoralg.ECalMipThreshold = 0.5 +pandoralg.HCalMipThreshold = 0.3 +pandoralg.ECalToEMGeVCalibration= 0.9 #for G2CD Digi, 1.007 for NewLDCaloDigi +pandoralg.HCalToEMGeVCalibration= 1.007 +pandoralg.ECalToHadGeVCalibrationBarrel= 1.12 #very small effect +pandoralg.ECalToHadGeVCalibrationEndCap= 1.12 +pandoralg.HCalToHadGeVCalibration= 1.07 +pandoralg.MuonToMipCalibration= 10.0 +pandoralg.DigitalMuonHits= 0 +pandoralg.MaxHCalHitHadronicEnergy = 1.0 +pandoralg.UseOldTrackStateCalculation= 0 +pandoralg.AbsorberRadLengthECal= 0.2854 #= 1/3.504 mm +pandoralg.AbsorberIntLengthECal= 0.0101 #= 1/99.46 mm +pandoralg.AbsorberRadLengthHCal= 0.0569 +pandoralg.AbsorberIntLengthHCal= 0.006 +pandoralg.AbsorberRadLengthOther= 0.0569 +pandoralg.AbsorberIntLengthOther= 0.006 + +############################################################################## + +# write PODIO file +from Configurables import PodioOutput +write = PodioOutput("write") +write.filename = "test.root" +write.outputCommands = ["keep *"] + +# ApplicationMgr +from Configurables import ApplicationMgr +ApplicationMgr( + TopAlg = [genalg, detsimalg, example_CaloDigiAlg, pandoralg], + EvtSel = 'NONE', + EvtMax = 10, + ExtSvc = [rndmengine, dsvc, geosvc, gearSvc,detsimsvc], + OutputLevel=INFO +) diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt index 94651123bfa524ee7a6808b1f5420518a59a0254..46344f83049f4e45f51d5646fd3d24c142f70402 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt +++ b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt @@ -25,6 +25,7 @@ link_libraries(${LCContent_LIBRARIES}) list(APPEND CMAKE_MODULE_PATH "$ENV{ROOTSYS}/etc/cmake/") find_package(ROOT 5.26.00 REQUIRED COMPONENTS Eve Geom RGL EG) +#In order to use ClusterShape.cc include_directories("../CED/CED/") include_directories("../MarlinUtil/01-08/source/") diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h index 4ea4e9b0bdd245ac9ee8a790cf7f972c196dc0a6..91fd1ccd04f1de4ce7de89d83048171882564ab2 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h @@ -1,5 +1,4 @@ /** - * @file MarlinPandora/include/CaloHitCreator.h * * @brief Header file for the calo hit creator class. * @@ -108,9 +107,7 @@ public: /** * @brief Create calo hits * - * @param pLCEvent the lcio event */ - //pandora::StatusCode CreateCaloHits(const LCEvent *const pLCEvent); pandora::StatusCode CreateCaloHits(const CollectionMaps& collectionMaps); /** @@ -129,54 +126,42 @@ private: /** * @brief Create ecal calo hits * - * @param pLCEvent the lcio event */ - //pandora::StatusCode CreateECalCaloHits(const EVENT::LCEvent *const pLCEvent); pandora::StatusCode CreateECalCaloHits(const CollectionMaps& collectionMaps); /** * @brief Create hcal calo hits * - * @param pLCEvent the lcio event */ pandora::StatusCode CreateHCalCaloHits(const CollectionMaps& collectionMaps); /** * @brief Create muon calo hits * - * @param pLCEvent the lcio event */ pandora::StatusCode CreateMuonCaloHits(const CollectionMaps& collectionMaps); /** * @brief Create lcal calo hits * - * @param pLCEvent the lcio event */ pandora::StatusCode CreateLCalCaloHits(const CollectionMaps& collectionMaps); /** * @brief Create lhcal calo hits * - * @param pLCEvent the lcio event */ pandora::StatusCode CreateLHCalCaloHits(const CollectionMaps& collectionMaps); /** * @brief Get common calo hit properties: position, parent address, input energy and time * - * @param pCaloHit the lcio calorimeter hit - * @param caloHitParameters the calo hit parameters to populate */ void GetCommonCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, PandoraApi::CaloHit::Parameters &caloHitParameters) const; /** * @brief Get end cap specific calo hit properties: cell size, absorber radiation and interaction lengths, normal vector * - * @param pCaloHit the lcio calorimeter hit - * @param layerLayout the gear end cap layer layout - * @param caloHitParameters the calo hit parameters to populate - * @param absorberCorrection to receive the absorber thickness correction for the mip equivalent energy */ void GetEndCapCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const; @@ -184,13 +169,6 @@ private: /** * @brief Get barrel specific calo hit properties: cell size, absorber radiation and interaction lengths, normal vector * - * @param pCaloHit the lcio calorimeter hit - * @param layerLayout the gear barrel layer layout - * @param barrelSymmetryOrder the barrel order of symmetry - * @param barrelPhi0 the barrel orientation - * @param staveNumber the stave number - * @param caloHitParameters the calo hit parameters to populate - * @param absorberCorrection to receive the absorber thickness correction for the mip equivalent energy */ void GetBarrelCaloHitProperties(const edm4hep::CalorimeterHit *const pCaloHit, const gear::LayerLayout &layerLayout, unsigned int barrelSymmetryOrder, float barrelPhi0, unsigned int staveNumber, PandoraApi::CaloHit::Parameters &caloHitParameters, @@ -199,18 +177,12 @@ private: /** * @brief Get number of active layers from position of a calo hit to the edge of the detector * - * @param pCaloHit the lcio calorimeter hit */ int GetNLayersFromEdge(const edm4hep::CalorimeterHit *const pCaloHit) const; /** * @brief Get the maximum radius of a calo hit in a polygonal detector structure * - * @param pCaloHit the lcio calorimeter hit - * @param symmetryOrder the symmetry order - * @param phi0 the angular orientation - * - * @return the maximum radius */ float GetMaximumRadius(const edm4hep::CalorimeterHit *const pCaloHit, const unsigned int symmetryOrder, const float phi0) const; diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/GeometryCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/GeometryCreator.h index 8be08e2f9f93ed30dd9d66ee6d39662f0bb03087..bb43d8a0f86a5211485a1e4cb301e3886da941a9 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/GeometryCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/GeometryCreator.h @@ -1,5 +1,4 @@ /** - * @file MarlinPandora/include/GeometryCreator.h * * @brief Header file for the geometry creator class. * @@ -12,7 +11,6 @@ #include "Api/PandoraApi.h" #include "GaudiKernel/ISvcLocator.h" -//namespace gear { class CalorimeterParameters; } namespace gear { class CalorimeterParameters; class GearMgr; } //------------------------------------------------------------------------------------------------------------------------------------------ @@ -73,7 +71,6 @@ public: /** * @brief Create geometry */ - //pandora::StatusCode CreateGeometry() const; pandora::StatusCode CreateGeometry(ISvcLocator* svcloc); private: diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h index 46dbb55e8b8bf2f63e2c3c28b0f2ccab7ebe374c..0926f870b6dc8738a7122f1a412f2ece40077f7a 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h @@ -1,5 +1,4 @@ /** - * @file MarlinPandora/include/MCParticleCreator.h * * @brief Header file for the mc particle creator class. * @@ -17,8 +16,6 @@ /** * @brief MCParticleCreator class */ -//typedef std::map<unsigned int, edm4hep::MCParticle*> id_MCParticleMap; -//typedef std::map<unsigned int, const edm4hep::MCParticle*> id_MCParticleMap; class CollectionMaps; @@ -60,29 +57,20 @@ public: /** * @brief Create MCParticles * - * @param pLCEvent the lcio event */ - //pandora::StatusCode CreateMCParticles(const EVENT::LCEvent *const pLCEvent) const; - //pandora::StatusCode CreateMCParticles(const std::map<std::string, const podio::CollectionBase*>& collectionMap ) const; pandora::StatusCode CreateMCParticles(const CollectionMaps& collectionMaps ) const; /** * @brief Create Track to mc particle relationships * - * @param pLCEvent the lcio event - * @param trackVector the vector containing all tracks successfully passed to pandora */ - // pandora::StatusCode CreateTrackToMCParticleRelationships(const EVENT::LCEvent *const pLCEvent, const TrackVector &trackVector) const; pandora::StatusCode CreateTrackToMCParticleRelationships(const CollectionMaps& collectionMaps, const TrackVector &trackVector) const; void Reset(); /** * @brief Create calo hit to mc particle relationships * - * @param pLCEvent the lcio event - * @param calorimeterHitVector the vector containing all calorimeter hits successfully passed to pandora */ -// pandora::StatusCode CreateCaloHitToMCParticleRelationships(const EVENT::LCEvent *const pLCEvent, const CalorimeterHitVector &calorimeterHitVector) const; pandora::StatusCode CreateCaloHitToMCParticleRelationships(const CollectionMaps& collectionMaps, const CalorimeterHitVector &calorimeterHitVector) const; private: diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h index 8774006c28267c620fc9d85b78c8ae82710def26..0e447790098de21001fb6c07cc3915af81ca8b8a 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h @@ -3,7 +3,7 @@ #include "FWCore/DataHandle.h" #include "GaudiAlg/GaudiAlgorithm.h" -#include <gsl/gsl_rng.h> +//#include <gsl/gsl_rng.h> #include "edm4hep/ClusterCollection.h" #include "edm4hep/ReconstructedParticleCollection.h" #include "edm4hep/EventHeaderCollection.h" @@ -49,21 +49,12 @@ */ namespace pandora {class Pandora;} -class IEventSeeder; class CollectionMaps { public: - /** - * @brief Default constructor - */ CollectionMaps(); void clear(); - std::map<std::string, const edm4hep::MCParticleCollection*> CollectionMap_MC; - std::map<std::string, const edm4hep::CalorimeterHitCollection*> CollectionMap_CaloHit; - std::map<std::string, const edm4hep::VertexCollection*> CollectionMap_Vertex; - std::map<std::string, const edm4hep::TrackCollection*> CollectionMap_Track; - 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; @@ -76,7 +67,6 @@ public: class PandoraPFAlg : public GaudiAlgorithm { - //friend class AlgFactory<PandoraPFAlg>;//gives error in 97 version public: @@ -95,7 +85,6 @@ public: */ virtual StatusCode finalize() ; - //void FinaliseSteeringParameters(); void FinaliseSteeringParameters(ISvcLocator* svcloc); pandora::StatusCode RegisterUserComponents() const; void Reset(); @@ -129,17 +118,14 @@ public: */ const pandora::Pandora *GetPandora() const; StatusCode updateMap(); - StatusCode updateMap(CollectionMaps & tmp_map); StatusCode Ana(); StatusCode CreateMCRecoParticleAssociation(); - //StatusCode Create_MC(); protected: typedef std::vector<float> FloatVec; int _nEvt ; - IEventSeeder * _SEEDER; Gaudi::Property< std::string > m_PandoraSettingsXmlFile { this, "PandoraSettingsDefault_xml", "/junofs/users/wxfang/MyGit/MarlinPandora/scripts/PandoraSettingsDefault_wx.xml" }; diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h index 85ba02dcd13cfc4c87f5b3350d7d93ea5a1a3c90..7619cd9fb36210b0ee50bf3413d39c18c4a1782f 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h @@ -1,6 +1,4 @@ /** - * @file MarlinPandora/include/PfoCreator.h - * * @brief Header file for the pfo creator class. * * $Log: $ @@ -25,8 +23,6 @@ #include "ClusterShapes.h" #include "Api/PandoraApi.h" -//namespace IMPL { class ClusterImpl; class ReconstructedParticleImpl; } -//namespace EVENT { class LCEvent; } class CollectionMaps; //------------------------------------------------------------------------------------------------------------------------------------------ @@ -60,8 +56,6 @@ public: /** * @brief Constructor * - * @param settings the creator settings - * @param pPandora address of the relevant pandora instance */ PfoCreator(const Settings &settings, const pandora::Pandora *const pPandora); @@ -73,10 +67,7 @@ public: /** * @brief Create particle flow objects * - * @param pLCEvent the lcio event */ - //pandora::StatusCode CreateParticleFlowObjects(EVENT::LCEvent *pLCEvent); - //pandora::StatusCode CreateParticleFlowObjects(const CollectionMaps& collectionMaps); pandora::StatusCode CreateParticleFlowObjects(CollectionMaps& collectionMaps, DataHandle<edm4hep::ClusterCollection>& _pClusterCollection, DataHandle<edm4hep::ReconstructedParticleCollection>& _pReconstructedParticleCollection, DataHandle<edm4hep::VertexCollection>& _pStartVertexCollection); CollectionMaps* m_collectionMaps; @@ -106,7 +97,7 @@ private: * @brief Set sub detector energies for a cluster * * @param subDetectorNames the list of sub detector names - * @param pLcioCluster the address of the lcio cluster to be set sub detector energies + * @param pLcioCluster the address of the cluster to be set sub detector energies * @param pandoraCaloHitList the pandora calorimeter hit list * @param hitE the vector to receive the energy of hits * @param hitX the vector to receive the x position of hits @@ -122,7 +113,7 @@ private: * * @param pPandoraPfo the address of the pandora pfo * @param pPandoraCluster the address of the pandora cluster - * @param pLcioCluster the address of the lcio cluster to be set energies and erros + * @param pLcioCluster the address of the cluster to be set energies and erros * @param clusterCorrectEnergy a number to receive the cluster correct energy */ void SetClusterEnergyAndError(const pandora::ParticleFlowObject *const pPandoraPfo, const pandora::Cluster *const pPandoraCluster, @@ -136,7 +127,7 @@ private: * @param hitX the vector of the x position of hits * @param hitY the vector of the y position of hits * @param hitZ the vector of the z position of hits - * @param pLcioCluster the lcio cluster to be set positions and errors + * @param pLcioCluster the cluster to be set positions and errors * @param clusterPosition a CartesianVector to receive the cluster position */ void SetClusterPositionAndError(const unsigned int nHitsInCluster, pandora::FloatVector &hitE, pandora::FloatVector &hitX, diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h index 5e0367153277629ff2a8f9aa78816587417ca479..de380e3f6d4b921a422ad6414d3d772b0f755820 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h @@ -1,6 +1,4 @@ /** - * @file MarlinPandora/include/TrackCreator.h - * * @brief Header file for the track creator class. * * $Log: $ @@ -9,13 +7,8 @@ #ifndef TRACK_CREATOR_H #define TRACK_CREATOR_H 1 -//#include "lcio.h" -//#include "IMPL/LCCollectionVec.h" -//#include "IMPL/LCFlagImpl.h" -//#include "EVENT/LCEvent.h" -//#include "EVENT/Track.h" #include "GaudiKernel/ISvcLocator.h" @@ -32,9 +25,7 @@ namespace gear { class GearMgr; } class CollectionMaps; typedef std::vector<const edm4hep::Track *> TrackVector; -//typedef std::set<const edm4hep::Track *> TrackList; typedef std::set<unsigned int> TrackList; -//typedef std::map<edm4hep::Track *, int> TrackToPidMap; typedef std::map<edm4hep::ConstTrack, int> TrackToPidMap; /* inline LCCollectionVec *newTrkCol(const std::string &name, LCEvent *evt , bool isSubset) @@ -118,10 +109,7 @@ public: /** * @brief Constructor * - * @param settings the creator settings - * @param pPandora address of the relevant pandora instance */ - //TrackCreator(const Settings &settings, const pandora::Pandora *const pPandora); TrackCreator(const Settings &settings, const pandora::Pandora *const pPandora, ISvcLocator* svcloc); /** @@ -132,17 +120,13 @@ public: /** * @brief Create associations between tracks, V0s, kinks, etc * - * @param pLCEvent the lcio event */ - //pandora::StatusCode CreateTrackAssociations(const EVENT::LCEvent *const pLCEvent); pandora::StatusCode CreateTrackAssociations(const CollectionMaps& collectionMaps); /** * @brief Create tracks, insert user code here * - * @param pLCEvent the lcio event */ - //pandora::StatusCode CreateTracks(EVENT::LCEvent *pLCEvent); pandora::StatusCode CreateTracks(const CollectionMaps& collectionMaps); /** @@ -161,9 +145,7 @@ private: /** * @brief Extract kink information from specified lcio collections * - * @param pLCEvent the lcio event */ - //pandora::StatusCode ExtractKinks(const EVENT::LCEvent *const pLCEvent); pandora::StatusCode ExtractKinks(const CollectionMaps& collectionMaps); /** @@ -185,116 +167,78 @@ private: * * @param trackVec the vector of tracks associated with the vertex */ - //bool IsConflictingRelationship(const EVENT::TrackVec &trackVec) const; - //bool IsConflictingRelationship(edm4hep::ConstTrack &trackVec) const; bool IsConflictingRelationship(const edm4hep::ConstReconstructedParticle &Particle) const; /** * @brief Whether a track is a v0 track * - * @param pTrack the lcio track * - * @return boolean */ - //bool IsV0(const EVENT::Track *const pTrack) const; bool IsV0(unsigned int pTrack_id) const; /** * @brief Whether a track is a parent track * - * @param pTrack the lcio track * - * @return boolean */ - //bool IsParent(const EVENT::Track *const pTrack) const; bool IsParent(unsigned int pTrack_id) const; /** * @brief Whether a track is a daughter track * - * @param pTrack the lcio track - * - * @return boolean */ - //bool IsDaughter(const EVENT::Track *const pTrack) const; bool IsDaughter(unsigned int pTrack_id) const; /** - * @brief Copy track states stored in lcio tracks to pandora track parameters + * @brief Copy track states stored in tracks to pandora track parameters * - * @param pTrack the lcio track - * @param trackParameters the track parameters */ - //void GetTrackStates(const EVENT::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; void GetTrackStates(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; /** - * @brief Copy track state from lcio track state instance to pandora input track state + * @brief Copy track state from track state instance to pandora input track state * - * @param pTrackState the lcio track state instance - * @param inputTrackState the pandora input track state */ - //void CopyTrackState(const TrackState *const pTrackState, pandora::InputTrackState &inputTrackState) const; void CopyTrackState(const edm4hep::TrackState & pTrackState, pandora::InputTrackState &inputTrackState) const; /** * @brief Obtain track time when it reaches ECAL * - * @param pTrack the lcio track */ - //float CalculateTrackTimeAtCalorimeter(const EVENT::Track *const pTrack) const; float CalculateTrackTimeAtCalorimeter(const edm4hep::Track *const pTrack) const; /** * @brief Decide whether track reaches the ecal surface * - * @param pTrack the lcio track - * @param trackParameters the track parameters */ - //void TrackReachesECAL(const EVENT::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; void TrackReachesECAL(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; - //void TrackReachesECAL(const edm4hep::Track& pTrack, PandoraApi::Track::Parameters &trackParameters) const; /** * @brief Determine whether a track can be used to form a pfo under the following conditions: * 1) if the track proves to be associated with a cluster, OR * 2) if the track proves to have no cluster associations * - * @param pTrack the lcio track - * @param trackParameters the track parameters */ - //void DefineTrackPfoUsage(const EVENT::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; void DefineTrackPfoUsage(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const; /** * @brief Whether track passes the quality cuts required in order to be used to form a pfo * - * @param pTrack the lcio track - * @param trackParameters the track parameters * * @return boolean */ - //bool PassesQualityCuts(const EVENT::Track *const pTrack, const PandoraApi::Track::Parameters &trackParameters) const; bool PassesQualityCuts(const edm4hep::Track *const pTrack, const PandoraApi::Track::Parameters &trackParameters) const; /** * @brief Get number of hits in TPC of a track * - * @param pTrack the lcio track - * - * @return number of hits in TPC of a track */ - //int GetNTpcHits(const EVENT::Track *const pTrack) const; int GetNTpcHits(const edm4hep::Track *const pTrack) const; /** * @brief Get number of hits in FTD of a track * - * @param pTrack the lcio track - * - * @return number of hits in FTDof a track */ - //int GetNFtdHits(const EVENT::Track *const pTrack) const; int GetNFtdHits(const edm4hep::Track *const pTrack) const; const Settings m_settings; ///< The track creator settings @@ -350,28 +294,22 @@ inline void TrackCreator::Reset() //------------------------------------------------------------------------------------------------------------------------------------------ -//inline bool TrackCreator::IsV0(const Track *const pTrack) const inline bool TrackCreator::IsV0(unsigned int pTrack_id) const // should check here, if id is correct one to do this { - //return (m_v0TrackList.end() != m_v0TrackList.find(pTrack)); return (m_v0TrackList.end() != m_v0TrackList.find(pTrack_id)); } //------------------------------------------------------------------------------------------------------------------------------------------ -//inline bool TrackCreator::IsParent(const Track *const pTrack) const inline bool TrackCreator::IsParent(unsigned int pTrack_id) const { - //return (m_parentTrackList.end() != m_parentTrackList.find(pTrack)); return (m_parentTrackList.end() != m_parentTrackList.find(pTrack_id)); } //------------------------------------------------------------------------------------------------------------------------------------------ -//inline bool TrackCreator::IsDaughter(const Track *const pTrack) const inline bool TrackCreator::IsDaughter(unsigned int pTrack_id) const { - //return (m_daughterTrackList.end() != m_daughterTrackList.find(pTrack)); return (m_daughterTrackList.end() != m_daughterTrackList.find(pTrack_id)); } diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/cellIDDecoder.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/cellIDDecoder.h index f15159967865ae3ab64def320daf820def08bcf8..6503f352d754fdac3279dab087abd6a359994145 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/cellIDDecoder.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/cellIDDecoder.h @@ -1,10 +1,7 @@ #ifndef cellIDDecoder_h #define cellIDDecoder_h 1 -//#include <vector> -//#include "EVENT/LCObject.h" #include "EVENT/LCCollection.h" -//#include "EVENT/SimTrackerHit.h" #include "UTIL/BitField64.h" #include "lcio.h" #include <string> @@ -12,11 +9,7 @@ // fixes problem in gcc 4.0.3 #include "EVENT/LCParameters.h" -//#include <sstream> -//#include <typeinfo> - //##################### changed for EMD4HEP ######## -//need check !! namespace ID_UTIL{ diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp index e4dc0e2a4d20e51071c425732c7d2251ddd5cda6..9c7fb1da1bcbc516ee597faf3b04d6f8eec33c4a 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp @@ -1,5 +1,4 @@ /** - * @file MarlinPandora/src/CaloHitCreator.cc * * @brief Implementation of the calo hit creator class. * @@ -16,7 +15,6 @@ #include "gear/PadRowLayout2D.h" #include "gear/LayerLayout.h" -#include "UTIL/CellIDDecoder.h" #include "cellIDDecoder.h" #include "GaudiKernel/IService.h" #include "GearSvc/IGearSvc.h" @@ -27,16 +25,6 @@ #include <algorithm> #include <cmath> #include <limits> -/* -template<typename T> -static float* FloatFromFloatThree(T vec, float &){ - float tmp[3]; - for(unsigned i=0; i<3; i++){ - tmp[i] = vec[i]; - } - return tmp; -} -*/ CaloHitCreator::CaloHitCreator(const Settings &settings, const pandora::Pandora *const pPandora, ISvcLocator* svcloc, bool encoder_style) : @@ -47,9 +35,9 @@ CaloHitCreator::CaloHitCreator(const Settings &settings, const pandora::Pandora m_encoder_str_MUON = ""; m_encoder_str_LCal = ""; m_encoder_str_LHCal = ""; - if(encoder_style==0) + if(encoder_style==0) // LCIO style { - m_encoder_str = "M:3,S-1:3,I:9,J:9,K-1:6";// LCIO style + m_encoder_str = "M:3,S-1:3,I:9,J:9,K-1:6"; m_encoder_str_MUON="S-1:4,M:3,K-1:6,I:16,GRZone:3,J:32:16"; m_encoder_str_LCal="I:10,J:10,K:10,S-1:2"; m_encoder_str_LHCal=m_encoder_str; @@ -122,7 +110,6 @@ pandora::StatusCode CaloHitCreator::CreateCaloHits(const CollectionMaps& collect pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& collectionMaps) { - std::cout<<"start CreateECalCaloHits:"<<std::endl; for (StringVector::const_iterator iter = m_settings.m_eCalCaloHitCollections.begin(), iterEnd = m_settings.m_eCalCaloHitCollections.end(); iter != iterEnd; ++iter) { @@ -132,14 +119,12 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; const int nElements(pCaloHitCollection.size()); - std::cout<<(*iter)<<"has nElements="<<nElements<<std::endl; if (0 == nElements) continue; const gear::LayerLayout &endcapLayerLayout(_GEAR->getEcalEndcapParameters().getLayerLayout()); const gear::LayerLayout &barrelLayerLayout(_GEAR->getEcalBarrelParameters().getLayerLayout()); - //UTIL::CellIDDecoder<edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str); ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str); const std::string layerCodingString(m_encoder_str); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); @@ -187,9 +172,8 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col PandoraApi::CaloHit::Parameters caloHitParameters; caloHitParameters.m_hitType = pandora::ECAL; - caloHitParameters.m_isDigital = false;//why false ? - caloHitParameters.m_layer = cellIdDecoder(pCaloHit)[layerCoding.c_str()] + 1;//FIXME, should use + 1? because the decoded layer is start from 0. - //std::cout << "ECAL layer=" << caloHitParameters.m_layer.Get() << std::endl; + caloHitParameters.m_isDigital = false; + caloHitParameters.m_layer = cellIdDecoder(pCaloHit)[layerCoding.c_str()] + 1; caloHitParameters.m_isInOuterSamplingLayer = false; this->GetCommonCaloHitProperties(pCaloHit, caloHitParameters); @@ -201,14 +185,11 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col cellIdDecoder(pCaloHit)[ staveCoding], caloHitParameters, absorberCorrection); caloHitParameters.m_hadronicEnergy = eCalToHadGeVBarrel * pCaloHit->getEnergy(); - - //std::cout << "ECAL: eCalToHadGeVBarrel="<<eCalToHadGeVBarrel<< std::endl; } else { this->GetEndCapCaloHitProperties(pCaloHit, endcapLayerLayout, caloHitParameters, absorberCorrection); caloHitParameters.m_hadronicEnergy = eCalToHadGeVEndCap * pCaloHit->getEnergy(); - //std::cout << "ECAL: eCalToHadGeVEndCap="<<eCalToHadGeVEndCap<< std::endl; } caloHitParameters.m_mipEquivalentEnergy = pCaloHit->getEnergy() * eCalToMip * absorberCorrection; @@ -217,7 +198,6 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col continue; caloHitParameters.m_electromagneticEnergy = eCalToEMGeV * pCaloHit->getEnergy(); - //std::cout << "ECAL: eCalToEMGeV="<<eCalToEMGeV<< std::endl; // ATTN If using strip splitting, must correct cell sizes for use in PFA to minimum of strip width and strip length if (m_settings.m_stripSplittingOn) @@ -229,26 +209,14 @@ 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)); - /* - std::cout<<"i="<<i<<"\n" - <<",layer="<<caloHitParameters.m_layer.Get()<<"\n" - <<",m_hadronicEnergy="<<caloHitParameters.m_hadronicEnergy.Get()<<"\n" - <<",m_electromagneticEnergy="<<caloHitParameters.m_electromagneticEnergy.Get()<<"\n" - <<",m_mipEquivalentEnergy="<<caloHitParameters.m_mipEquivalentEnergy.Get()<<"\n" - <<",m_inputEnergy="<<caloHitParameters.m_inputEnergy.Get()<<"\n" - <<",m_positionVector0="<<caloHitParameters.m_positionVector.Get().GetX()<<"\n" - <<",m_positionVector1="<<caloHitParameters.m_positionVector.Get().GetY()<<"\n" - <<",m_positionVector2="<<caloHitParameters.m_positionVector.Get().GetZ()<<"\n" - <<std::endl; - */ } catch (pandora::StatusCodeException &statusCodeException) { - std::cout<<"ERROR Failed to extract ecal calo hit: " << statusCodeException.ToString() << std::endl; + std::cout<<"Failed to extract ecal calo hit: " << statusCodeException.ToString() << std::endl; } catch (...) { - std::cout<<"WARNING Failed to extract ecal calo hit: " << std::endl; + std::cout<<"Failed to extract ecal calo hit" << std::endl; } } } @@ -274,14 +242,12 @@ pandora::StatusCode CaloHitCreator::CreateHCalCaloHits(const CollectionMaps& col const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; const int nElements(pCaloHitCollection.size()); - std::cout<<(*iter)<<"has nElements="<<nElements<<std::endl; if (0 == nElements) continue; const gear::LayerLayout &endcapLayerLayout(_GEAR->getHcalEndcapParameters().getLayerLayout()); const gear::LayerLayout &barrelLayerLayout(_GEAR->getHcalBarrelParameters().getLayerLayout()); - //UTIL::CellIDDecoder<edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str); ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str); const std::string layerCodingString(m_encoder_str); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); @@ -329,11 +295,11 @@ pandora::StatusCode CaloHitCreator::CreateHCalCaloHits(const CollectionMaps& col } catch (pandora::StatusCodeException &statusCodeException) { - std::cout << "Error, Failed to extract hcal calo hit: " << statusCodeException.ToString() << std::endl; + std::cout << "Failed to extract hcal calo hit: " << statusCodeException.ToString() << std::endl; } catch (...) { - std::cout<<"WARNING Failed to extract hcal calo hit: " << std::endl; + std::cout<<"Failed to extract hcal calo hit" << std::endl; } } } @@ -359,7 +325,6 @@ pandora::StatusCode CaloHitCreator::CreateMuonCaloHits(const CollectionMaps& col const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; const int nElements(pCaloHitCollection.size()); - std::cout<<(*iter)<<"has nElements="<<nElements<<std::endl; if (0 == nElements) continue; @@ -367,7 +332,6 @@ pandora::StatusCode CaloHitCreator::CreateMuonCaloHits(const CollectionMaps& col const gear::LayerLayout &barrelLayerLayout(_GEAR->getYokeBarrelParameters().getLayerLayout()); const gear::LayerLayout &plugLayerLayout(_GEAR->getYokePlugParameters().getLayerLayout()); - //UTIL::CellIDDecoder<edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str_MUON); ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str_MUON); const std::string layerCodingString(m_encoder_str_MUON); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); @@ -385,7 +349,7 @@ pandora::StatusCode CaloHitCreator::CreateMuonCaloHits(const CollectionMaps& col PandoraApi::CaloHit::Parameters caloHitParameters; caloHitParameters.m_hitType = pandora::MUON; - caloHitParameters.m_layer = cellIdDecoder(pCaloHit)[layerCoding.c_str()] + 1;//FIXME, should use +1? it starts from 0. + caloHitParameters.m_layer = cellIdDecoder(pCaloHit)[layerCoding.c_str()] + 1; caloHitParameters.m_isInOuterSamplingLayer = true; this->GetCommonCaloHitProperties(pCaloHit, caloHitParameters); @@ -437,7 +401,7 @@ pandora::StatusCode CaloHitCreator::CreateMuonCaloHits(const CollectionMaps& col } catch (...) { - std::cout << "Failed to extract muon hit: " << std::endl; + std::cout << "Failed to extract muon hit" << std::endl; } } } @@ -463,13 +427,11 @@ pandora::StatusCode CaloHitCreator::CreateLCalCaloHits(const CollectionMaps& col const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; const int nElements(pCaloHitCollection.size()); - std::cout<<(*iter)<<"has nElements="<<nElements<<std::endl; if (0 == nElements) continue; const gear::LayerLayout &endcapLayerLayout(_GEAR->getLcalParameters().getLayerLayout()); - //UTIL::CellIDDecoder<edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str_LCal); ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str_LCal); const std::string layerCodingString(m_encoder_str_LCal); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); @@ -511,7 +473,7 @@ pandora::StatusCode CaloHitCreator::CreateLCalCaloHits(const CollectionMaps& col } catch (...) { - std::cout << "Failed to extract lcal calo hit: " << std::endl; + std::cout << "Failed to extract lcal calo hit" << std::endl; } } } @@ -537,13 +499,11 @@ pandora::StatusCode CaloHitCreator::CreateLHCalCaloHits(const CollectionMaps& co const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; const int nElements(pCaloHitCollection.size()); - std::cout<<(*iter)<<"has nElements="<<nElements<<std::endl; if (0 == nElements) continue; const gear::LayerLayout &endcapLayerLayout(_GEAR->getLHcalParameters().getLayerLayout()); - //UTIL::CellIDDecoder<edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str_LHCal); ID_UTIL::CellIDDecoder<const edm4hep::CalorimeterHit> cellIdDecoder(m_encoder_str_LHCal); const std::string layerCodingString(m_encoder_str_LHCal); const std::string layerCoding(this->GetLayerCoding(layerCodingString)); @@ -585,7 +545,7 @@ pandora::StatusCode CaloHitCreator::CreateLHCalCaloHits(const CollectionMaps& co } catch (...) { - std::cout << "Failed to extract lhcal calo hit: " << std::endl; + std::cout << "Failed to extract lhcal calo hit" << std::endl; } } } @@ -608,7 +568,6 @@ void CaloHitCreator::GetCommonCaloHitProperties(const edm4hep::CalorimeterHit *c caloHitParameters.m_cellGeometry = pandora::RECTANGULAR; caloHitParameters.m_positionVector = positionVector; caloHitParameters.m_expectedDirection = positionVector.GetUnitVector(); - //caloHitParameters.m_pParentAddress = (void*)pCaloHit; caloHitParameters.m_pParentAddress = pCaloHit; caloHitParameters.m_inputEnergy = pCaloHit->getEnergy(); caloHitParameters.m_time = pCaloHit->getTime(); @@ -637,7 +596,6 @@ void CaloHitCreator::GetEndCapCaloHitProperties(const edm4hep::CalorimeterHit *c if (caloHitParameters.m_nCellRadiationLengths.Get() < std::numeric_limits<float>::epsilon() || caloHitParameters.m_nCellInteractionLengths.Get() < std::numeric_limits<float>::epsilon()) { - //std::cout<<"interactionLength="<<interactionLength<<",layerAbsorberThickness="<<layerAbsorberThickness<<",radiationLength="<<radiationLength<<",physicalLayer="<<physicalLayer<<std::endl; std::cout<<"WARNING CaloHitCreator::GetEndCapCaloHitProperties Calo hit has 0 radiation length or interaction length: \ not creating a Pandora calo hit." << std::endl; throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER); @@ -683,10 +641,8 @@ void CaloHitCreator::GetBarrelCaloHitProperties(const edm4hep::CalorimeterHit *c caloHitParameters.m_nCellRadiationLengths = radiationLength * layerAbsorberThickness; caloHitParameters.m_nCellInteractionLengths = interactionLength * layerAbsorberThickness; - //std::cout<<"m_layer="<<caloHitParameters.m_layer.Get()<<",layerLayout.getNLayers() - 1="<<layerLayout.getNLayers() - 1<<",layerAbsorberThickness="<<layerAbsorberThickness<<std::endl; if (caloHitParameters.m_nCellRadiationLengths.Get() < std::numeric_limits<float>::epsilon() || caloHitParameters.m_nCellInteractionLengths.Get() < std::numeric_limits<float>::epsilon()) { - std::cout<<"interactionLength="<<interactionLength<<",layerAbsorberThickness="<<layerAbsorberThickness<<",radiationLength="<<radiationLength<<",physicalLayer="<<physicalLayer<<",l1="<<caloHitParameters.m_layer.Get()<<",l2="<<layerLayout.getNLayers()-1<<std::endl; std::cout<<"WARNIN CaloHitCreator::GetBarrelCaloHitProperties Calo hit has 0 radiation length or interaction length: \ not creating a Pandora calo hit." << std::endl; throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER); diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/GeometryCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/GeometryCreator.cpp index 35e8fedb3d24446c98c8135efb552728d5cecaf0..4c88f7ba826fcf806b9a25f253cf51e06d1a92e2 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/GeometryCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/GeometryCreator.cpp @@ -1,12 +1,10 @@ /** - * @file MarlinPandora/src/GeometryCreator.cc * * @brief Implementation of the geometry creator class. * * $Log: $ */ #include "GaudiKernel/IService.h" - #include "GearSvc/IGearSvc.h" #include "gear/BField.h" #include "gear/GEAR.h" @@ -15,9 +13,7 @@ #include "gear/TPCParameters.h" #include "gear/PadRowLayout2D.h" #include "gear/LayerLayout.h" - #include "GeometryCreator.h" -//#include "PandoraPFANewProcessor.h" GeometryCreator::GeometryCreator(const Settings &settings, const pandora::Pandora *const pPandora) : m_settings(settings), @@ -33,8 +29,6 @@ GeometryCreator::~GeometryCreator() //------------------------------------------------------------------------------------------------------------------------------------------ -//pandora::StatusCode GeometryCreator::CreateGeometry() const -//pandora::StatusCode GeometryCreator::CreateGeometry(ISvcLocator* svcloc) const pandora::StatusCode GeometryCreator::CreateGeometry(ISvcLocator* svcloc) { IGearSvc* iSvc = 0; @@ -44,12 +38,6 @@ pandora::StatusCode GeometryCreator::CreateGeometry(ISvcLocator* svcloc) throw "Failed to find GearSvc ..."; } _GEAR = iSvc->getGearMgr(); - //auto _gear = service<IGearSvc>("GearSvc"); - //if ( !_gear ) - //{ - // throw "Failed to find GearSvc ..."; - //} - //_GEAR = _gear->getGearMgr(); try @@ -204,7 +192,6 @@ void GeometryCreator::SetDefaultSubDetectorParameters(const gear::CalorimeterPar parameters.m_outerSymmetryOrder = inputParameters.getSymmetryOrder(); parameters.m_isMirroredInZ = true; parameters.m_nLayers = layerLayout.getNLayers(); - //std::cout << "m_nLayers="<<layerLayout.getNLayers() << std::endl; // ATTN Not always going to be correct for any optional subdetectors, but impact of this is negligible for ILD const float radiationLength(((pandora::ECAL_BARREL == subDetectorType) || (pandora::ECAL_ENDCAP == subDetectorType)) ? m_settings.m_absorberRadLengthECal : diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/MCParticleCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/MCParticleCreator.cpp index a19788b3c426a26859c6047def94b0f426a79a48..a9042a82183231212b3362656c9d38ab8ef6bbf0 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/MCParticleCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/MCParticleCreator.cpp @@ -1,5 +1,4 @@ /** - * @file MarlinPandora/src/MCParticleCreator.cc * * @brief Implementation of the mc particle creator class. * @@ -15,15 +14,7 @@ #include "edm4hep/Track.h" #include "edm4hep/MCRecoTrackerAssociation.h" #include "edm4hep/SimTrackerHitConst.h" - - -//#include "UTIL/LCRelationNavigator.h" - -//#include "gear/BField.h" - #include "PandoraPFAlg.h" -//#include "CaloHitCreator.h" -//#include "TrackCreator.h" #include "MCParticleCreator.h" #include <cmath> @@ -33,7 +24,6 @@ MCParticleCreator::MCParticleCreator(const Settings &settings, const pandora::Pandora *const pPandora) : m_settings(settings), m_pPandora(pPandora), - //m_bField(marlin::Global::GEAR->getBField().at(gear::Vector3D(0., 0., 0.)).z()) m_bField(settings.m_bField) { m_id_pMC_map = new std::map<unsigned int, const edm4hep::MCParticle*>; @@ -69,7 +59,6 @@ pandora::StatusCode MCParticleCreator::CreateMCParticles(const CollectionMaps& c mcParticleParameters.m_pParentAddress = &pMcParticle; unsigned int p_id = pMcParticle.id(); const edm4hep::MCParticle* p_mc = &pMcParticle; - //m_id_pMC_map [pMcParticle.id()] = &pMcParticle; (*m_id_pMC_map) [p_id] = p_mc; mcParticleParameters.m_momentum = pandora::CartesianVector(pMcParticle.getMomentum()[0], pMcParticle.getMomentum()[1], pMcParticle.getMomentum()[2]); @@ -116,146 +105,9 @@ pandora::StatusCode MCParticleCreator::CreateMCParticles(const CollectionMaps& c return pandora::STATUS_CODE_SUCCESS; } -//------------------------------------------------------------------------------------------------------------------------------------------ -/* -pandora::StatusCode MCParticleCreator::CreateTrackToMCParticleRelationships(const EVENT::LCEvent *const pLCEvent, const TrackVector &trackVector) const -{ - for (StringVector::const_iterator iter = m_settings.m_lcTrackRelationCollections.begin(), iterEnd = m_settings.m_lcTrackRelationCollections.end(); - iter != iterEnd; ++iter) - { - try - { - const EVENT::LCCollection *pMCRelationCollection = pLCEvent->getCollection(*iter); - UTIL::LCRelationNavigator navigate(pMCRelationCollection); - - for (TrackVector::const_iterator trackIter = trackVector.begin(), trackIterEnd = trackVector.end(); - trackIter != trackIterEnd; ++trackIter) - { - try - { - EVENT::Track *pTrack = *trackIter; - const EVENT::LCObjectVec &objectVec = navigate.getRelatedToObjects(*trackIter); - - // Get reconstructed momentum at dca - const pandora::Helix helixFit(pTrack->getPhi(), pTrack->getD0(), pTrack->getZ0(), pTrack->getOmega(), pTrack->getTanLambda(), m_bField); - const float recoMomentum(helixFit.GetMomentum().GetMagnitude()); - - // Use momentum magnitude to identify best mc particle - MCParticle *pBestMCParticle = NULL; - float bestDeltaMomentum(std::numeric_limits<float>::max()); - - for (EVENT::LCObjectVec::const_iterator itRel = objectVec.begin(), itRelEnd = objectVec.end(); itRel != itRelEnd; ++itRel) - { - EVENT::MCParticle *pMCParticle = NULL; - pMCParticle = dynamic_cast<MCParticle *>(*itRel); - - if (NULL == pMCParticle) - continue; - - const float trueMomentum(pandora::CartesianVector(pMCParticle->getMomentum()[0], pMCParticle->getMomentum()[1], - pMCParticle->getMomentum()[2]).GetMagnitude()); - - const float deltaMomentum(std::fabs(recoMomentum - trueMomentum)); - - if (deltaMomentum < bestDeltaMomentum) - { - pBestMCParticle = pMCParticle; - bestDeltaMomentum = deltaMomentum; - } - } - - if (NULL == pBestMCParticle) - continue; - - PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackToMCParticleRelationship(*m_pPandora, pTrack, - pBestMCParticle)); - } - catch (pandora::StatusCodeException &statusCodeException) - { - streamlog_out(ERROR) << "Failed to extract track to mc particle relationship: " << statusCodeException.ToString() << std::endl; - } - catch (EVENT::Exception &exception) - { - streamlog_out(WARNING) << "Failed to extract track to mc particle relationship: " << exception.what() << std::endl; - } - } - } - catch (EVENT::Exception &exception) - { - streamlog_out(DEBUG5) << "Failed to extract track to mc particle relationships collection: " << *iter << ", " << exception.what() << std::endl; - } - } - - return pandora::STATUS_CODE_SUCCESS; -} -*/ -//------------------------------------------------------------------------------------------------------------------------------------------ -/* -pandora::StatusCode MCParticleCreator::CreateCaloHitToMCParticleRelationships(const EVENT::LCEvent *const pLCEvent, const CalorimeterHitVector &calorimeterHitVector) const -{ - typedef std::map<MCParticle *, float> MCParticleToEnergyWeightMap; - MCParticleToEnergyWeightMap mcParticleToEnergyWeightMap; - - for (StringVector::const_iterator iter = m_settings.m_lcCaloHitRelationCollections.begin(), iterEnd = m_settings.m_lcCaloHitRelationCollections.end(); - iter != iterEnd; ++iter) - { - try - { - const EVENT::LCCollection *pMCRelationCollection = pLCEvent->getCollection(*iter); - UTIL::LCRelationNavigator navigate(pMCRelationCollection); - - for (CalorimeterHitVector::const_iterator caloHitIter = calorimeterHitVector.begin(), - caloHitIterEnd = calorimeterHitVector.end(); caloHitIter != caloHitIterEnd; ++caloHitIter) - { - try - { - mcParticleToEnergyWeightMap.clear(); - const EVENT::LCObjectVec &objectVec = navigate.getRelatedToObjects(*caloHitIter); - - for (EVENT::LCObjectVec::const_iterator itRel = objectVec.begin(), itRelEnd = objectVec.end(); itRel != itRelEnd; ++itRel) - { - EVENT::SimCalorimeterHit *pSimHit = dynamic_cast<SimCalorimeterHit *>(*itRel); - - if (NULL == pSimHit) - continue; - for (int iCont = 0, iEnd = pSimHit->getNMCContributions(); iCont < iEnd; ++iCont) - { - mcParticleToEnergyWeightMap[pSimHit->getParticleCont(iCont)] += pSimHit->getEnergyCont(iCont); - } - } - - for (MCParticleToEnergyWeightMap::const_iterator mcParticleIter = mcParticleToEnergyWeightMap.begin(), - mcParticleIterEnd = mcParticleToEnergyWeightMap.end(); mcParticleIter != mcParticleIterEnd; ++mcParticleIter) - { - PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetCaloHitToMCParticleRelationship(*m_pPandora, - *caloHitIter, mcParticleIter->first, mcParticleIter->second)); - } - } - catch (pandora::StatusCodeException &statusCodeException) - { - streamlog_out(ERROR) << "Failed to extract calo hit to mc particle relationship: " << statusCodeException.ToString() << std::endl; - } - catch (EVENT::Exception &exception) - { - streamlog_out(WARNING) << "Failed to extract calo hit to mc particle relationship: " << exception.what() << std::endl; - } - } - } - catch (EVENT::Exception &exception) - { - streamlog_out(DEBUG5) << "Failed to extract calo hit to mc particle relationships collection: " << *iter << ", " << exception.what() << std::endl; - } - } - - return pandora::STATUS_CODE_SUCCESS; -} -*/ - -//-------------- using sim calo hit and digi calo hit, no weight here--------------------------------------------------------------------------------------------------------------- pandora::StatusCode MCParticleCreator::CreateCaloHitToMCParticleRelationships(const CollectionMaps& collectionMaps, const CalorimeterHitVector &calorimeterHitVector) const { - std::cout<<"Do CreateCaloHitToMCParticleRelationships"<<std::endl; typedef std::map<const edm4hep::MCParticle *, float> MCParticleToEnergyWeightMap; MCParticleToEnergyWeightMap mcParticleToEnergyWeightMap; @@ -298,17 +150,17 @@ pandora::StatusCode MCParticleCreator::CreateCaloHitToMCParticleRelationships(co } catch (pandora::StatusCodeException &statusCodeException) { - std::cout<<"ERROR Failed to extract calo hit to mc particle relationship: " << statusCodeException.ToString() << std::endl; + std::cout<<"Failed to extract calo hit to mc particle relationship: " << statusCodeException.ToString() << std::endl; } catch (...) { - std::cout<<"WARNING Failed to extract calo hit to mc particle relationship " << std::endl; + std::cout<<"Failed to extract calo hit to mc particle relationship " << std::endl; } } } catch (...) { - std::cout<<"DEBUG5 Failed to extract calo hit to mc particle relationships collection: " << *iter << std::endl; + std::cout<<"Failed to extract calo hit to mc particle relationships collection: " << *iter << std::endl; } } @@ -316,10 +168,8 @@ pandora::StatusCode MCParticleCreator::CreateCaloHitToMCParticleRelationships(co } -//-------------- using sim tracker hit and tracker hit, no weight here--------------------------------------------------------------------------------------------------------------- pandora::StatusCode MCParticleCreator::CreateTrackToMCParticleRelationships(const CollectionMaps& collectionMaps, const TrackVector &trackVector) const { - std::cout<<"Do CreateTrackToMCParticleRelationships"<<std::endl; for (unsigned ik = 0; ik < trackVector.size(); ik++) { const edm4hep::Track *pTrack = trackVector.at(ik); @@ -359,19 +209,17 @@ pandora::StatusCode MCParticleCreator::CreateTrackToMCParticleRelationships(cons } catch (pandora::StatusCodeException &statusCodeException) { - std::cout<<"ERROR Failed to extract track to mc particle relationship: " << statusCodeException.ToString() << std::endl; + std::cout<<"Failed to extract track to mc particle relationship: " << statusCodeException.ToString() << std::endl; } catch (...) { - std::cout<<"WARNING Failed to extract track to mc particle relationship: " << std::endl; + std::cout<<"Failed to extract track to mc particle relationship" << std::endl; } } return pandora::STATUS_CODE_SUCCESS; } -//------------------------------------------------------------------------------------------------------------------------------------------ -//------------------------------------------------------------------------------------------------------------------------------------------ MCParticleCreator::Settings::Settings() { diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp index 9489897f0c482c467cc35b9f5fd84d2cad8481bf..d2e9db69f1a2184b3bbf1f3c6d27d344a2432a2c 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp @@ -1,4 +1,3 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ #include "GearSvc/IGearSvc.h" #include "PandoraPFAlg.h" #include "EventSeeder/IEventSeeder.h" @@ -7,7 +6,7 @@ #include "edm4hep/SimCalorimeterHit.h" #include "edm4hep/CaloHitContribution.h" #include "edm4hep/ClusterConst.h" -#include "UTIL/ILDConf.h" +//#include "UTIL/ILDConf.h" #include <cmath> #include <algorithm> #include "gear/BField.h" @@ -84,7 +83,6 @@ void PandoraPFAlg::FinaliseSteeringParameters(ISvcLocator* svcloc) m_trackCreatorSettings.m_prongSplitVertexCollections.insert(m_trackCreatorSettings.m_prongSplitVertexCollections.end(), m_trackCreatorSettings.m_splitVertexCollections.begin(), m_trackCreatorSettings.m_splitVertexCollections.end()); - //m_settings.m_innerBField = marlin::Global::GEAR->getBField().at(gear::Vector3D(0., 0., 0.)).z(); IGearSvc* iSvc = 0; StatusCode sc = svcloc->service("GearSvc", iSvc, false); if ( !sc ) @@ -103,7 +101,7 @@ void PandoraPFAlg::FinaliseSteeringParameters(ISvcLocator* svcloc) StatusCode PandoraPFAlg::initialize() { - std::cout<<"hi init PandoraPFAlg"<<std::endl; + std::cout<<"init PandoraPFAlg"<<std::endl; std::string s_output =m_AnaOutput; m_fout = new TFile(s_output.c_str(),"RECREATE"); @@ -297,17 +295,9 @@ StatusCode PandoraPFAlg::initialize() StatusCode PandoraPFAlg::execute() { - /* - if (_nEvt < m_settings.m_nEventsToSkip) - { - _nEvt++; - return StatusCode::SUCCESS; - } - */ try { - std::cout<<"execute PandoraPFAlg"<<std::endl; updateMap(); PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, m_pMCParticleCreator->CreateMCParticles(*m_CollectionMaps)); @@ -366,19 +356,12 @@ pandora::StatusCode PandoraPFAlg::RegisterUserComponents() const PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, LCContent::RegisterAlgorithms(*m_pPandora)); PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, LCContent::RegisterBasicPlugins(*m_pPandora)); - PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, LCContent::RegisterBFieldPlugin(*m_pPandora, m_settings.m_innerBField, m_settings.m_muonBarrelBField, m_settings.m_muonEndCapBField)); PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, LCContent::RegisterNonLinearityEnergyCorrection(*m_pPandora, "NonLinearity", pandora::HADRONIC, m_settings.m_inputEnergyCorrectionPoints, m_settings.m_outputEnergyCorrectionPoints)); - - /* - PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::RegisterAlgorithmFactory(*m_pPandora, - "ExternalClustering", new ExternalClusteringAlgorithm::Factory)); - */ - return pandora::STATUS_CODE_SUCCESS; } @@ -427,10 +410,6 @@ CollectionMaps::CollectionMaps() } void CollectionMaps::clear() { -CollectionMap_MC.clear(); -CollectionMap_CaloHit.clear(); -CollectionMap_Vertex.clear(); -CollectionMap_Track.clear(); collectionMap_MC.clear(); collectionMap_CaloHit.clear(); collectionMap_Vertex.clear(); @@ -482,112 +461,96 @@ StatusCode PandoraPFAlg::updateMap() if (NULL != MCParticle ) { std::vector<edm4hep::MCParticle> v_mc; - m_CollectionMaps->CollectionMap_MC ["MCParticle"] = MCParticle ; m_CollectionMaps->collectionMap_MC ["MCParticle"] = v_mc; for(unsigned int i=0 ; i< MCParticle->size(); i++) m_CollectionMaps->collectionMap_MC ["MCParticle"].push_back(MCParticle->at(i)); } if (NULL != ECALBarrel ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["ECALBarrel"] = ECALBarrel ; m_CollectionMaps->collectionMap_CaloHit["ECALBarrel"] = v_cal ; for(unsigned int i=0 ; i< ECALBarrel->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["ECALBarrel"].push_back(ECALBarrel->at(i)); } if (NULL != ECALEndcap ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["ECALEndcap"] = ECALEndcap ; m_CollectionMaps->collectionMap_CaloHit["ECALEndcap"] = v_cal ; for(unsigned int i=0 ; i< ECALEndcap->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["ECALEndcap"].push_back(ECALEndcap->at(i)); } if (NULL != ECALOther ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["ECALOther"] = ECALOther ; m_CollectionMaps->collectionMap_CaloHit["ECALOther"] = v_cal ; for(unsigned int i=0 ; i< ECALOther->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["ECALOther"].push_back(ECALOther->at(i)); } if (NULL != HCALBarrel ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["HCALBarrel"] = HCALBarrel ; m_CollectionMaps->collectionMap_CaloHit["HCALBarrel"] = v_cal ; for(unsigned int i=0 ; i< HCALBarrel->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["HCALBarrel"].push_back(HCALBarrel->at(i)); } if (NULL != HCALEndcap ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["HCALEndcap"] = HCALEndcap ; m_CollectionMaps->collectionMap_CaloHit["HCALEndcap"] = v_cal ; for(unsigned int i=0 ; i< HCALEndcap->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["HCALEndcap"].push_back(HCALEndcap->at(i)); } if (NULL != HCALOther ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["HCALOther"] = HCALOther ; m_CollectionMaps->collectionMap_CaloHit["HCALOther"] = v_cal ; for(unsigned int i=0 ; i< HCALOther->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["HCALOther"].push_back(HCALOther->at(i)); } if (NULL != MUON ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["MUON"] = MUON ; m_CollectionMaps->collectionMap_CaloHit["MUON"] = v_cal ; for(unsigned int i=0 ; i< MUON->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["MUON"].push_back(MUON->at(i)); } if (NULL != LCAL ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["LCAL"] = LCAL ; m_CollectionMaps->collectionMap_CaloHit["LCAL"] = v_cal ; for(unsigned int i=0 ; i< LCAL->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["LCAL"].push_back(LCAL->at(i)); } if (NULL != LHCAL ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["LHCAL"] = LHCAL ; m_CollectionMaps->collectionMap_CaloHit["LHCAL"] = v_cal ; for(unsigned int i=0 ; i< LHCAL->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["LHCAL"].push_back(LHCAL->at(i)); } if (NULL != BCAL ) { std::vector<edm4hep::CalorimeterHit> v_cal; - m_CollectionMaps->CollectionMap_CaloHit["BCAL"] = BCAL ; m_CollectionMaps->collectionMap_CaloHit["BCAL"] = v_cal ; for(unsigned int i=0 ; i< BCAL->size(); i++) m_CollectionMaps->collectionMap_CaloHit ["BCAL"].push_back(BCAL->at(i)); } if (NULL != KinkVertices ) { std::vector<edm4hep::Vertex> v_cal; - m_CollectionMaps->CollectionMap_Vertex["KinkVertices"] = KinkVertices ; m_CollectionMaps->collectionMap_Vertex["KinkVertices"] = v_cal ; for(unsigned int i=0 ; i< KinkVertices->size(); i++) m_CollectionMaps->collectionMap_Vertex ["KinkVertices"].push_back(KinkVertices->at(i)); } if (NULL != ProngVertices ) { std::vector<edm4hep::Vertex> v_cal; - m_CollectionMaps->CollectionMap_Vertex["ProngVertices"] = ProngVertices ; m_CollectionMaps->collectionMap_Vertex["ProngVertices"] = v_cal ; for(unsigned int i=0 ; i< ProngVertices->size(); i++) m_CollectionMaps->collectionMap_Vertex ["ProngVertices"].push_back(ProngVertices->at(i)); } if (NULL != SplitVertices ) { std::vector<edm4hep::Vertex> v_cal; - m_CollectionMaps->CollectionMap_Vertex["SplitVertices"] = SplitVertices ; m_CollectionMaps->collectionMap_Vertex["SplitVertices"] = v_cal ; for(unsigned int i=0 ; i< SplitVertices->size(); i++) m_CollectionMaps->collectionMap_Vertex ["SplitVertices"].push_back(SplitVertices->at(i)); } if (NULL != V0Vertices ) { std::vector<edm4hep::Vertex> v_cal; - m_CollectionMaps->CollectionMap_Vertex["V0Vertices"] = V0Vertices ; m_CollectionMaps->collectionMap_Vertex["V0Vertices"] = v_cal ; for(unsigned int i=0 ; i< V0Vertices->size(); i++) m_CollectionMaps->collectionMap_Vertex ["V0Vertices"].push_back(V0Vertices->at(i)); } if (NULL != MarlinTrkTracks ) { std::vector<edm4hep::Track> v_cal; - m_CollectionMaps->CollectionMap_Track["MarlinTrkTracks"] = MarlinTrkTracks ; m_CollectionMaps->collectionMap_Track["MarlinTrkTracks"] = v_cal ; for(unsigned int i=0 ; i< MarlinTrkTracks->size(); i++) m_CollectionMaps->collectionMap_Track ["MarlinTrkTracks"].push_back(MarlinTrkTracks->at(i)); } @@ -597,39 +560,6 @@ StatusCode PandoraPFAlg::updateMap() m_CollectionMaps->collectionMap_CaloRel["RecoCaloAssociation"] = v_cal ; for(unsigned int i=0 ; i< mcRecoCaloAssociation->size(); i++) m_CollectionMaps->collectionMap_CaloRel ["RecoCaloAssociation"].push_back(mcRecoCaloAssociation->at(i)); } - else - { - if (NULL != MCParticle ) - { - for(unsigned int i=0 ; i< MCParticle->size(); i++) - { - if(MCParticle->at(i).parents_size()==0) - { - std::cout<<"create recoCaloAssociation by hand now"<<std::endl; - for(std::map<std::string, std::vector<edm4hep::CalorimeterHit> >::iterator iter = m_CollectionMaps->collectionMap_CaloHit.begin(); iter != m_CollectionMaps->collectionMap_CaloHit.end(); iter++) - { - std::string prefix = "RecoCaloAssociation_"; - std::string key = prefix + iter->first; - std::cout<<"create for "<<key<<std::endl; - std::vector<edm4hep::MCRecoCaloAssociation> v_cal; - m_CollectionMaps->collectionMap_CaloRel[key] = v_cal ; - for(std::vector<edm4hep::CalorimeterHit>::iterator it=iter->second.begin(); it != iter->second.end(); it ++) - { - edm4hep::SimCalorimeterHit sim_hit( it->getCellID(), it->getEnergy(), it->getPosition() ); - edm4hep::CaloHitContribution conb ( MCParticle->at(i).getPDG(), it->getEnergy(), 0, it->getPosition() ); - conb.setParticle( MCParticle->at(i) ); - sim_hit.addToContributions(conb); - edm4hep::MCRecoCaloAssociation calo_association; - calo_association.setRec(*it); - calo_association.setSim(sim_hit); - m_CollectionMaps->collectionMap_CaloRel[key].push_back(calo_association); - } - } - break; - } - } - } - } if (NULL != mcRecoTrackerAssociation ) { std::vector<edm4hep::MCRecoTrackerAssociation> v_cal; @@ -640,172 +570,6 @@ StatusCode PandoraPFAlg::updateMap() } -StatusCode PandoraPFAlg::updateMap(CollectionMaps & tmp_map) -{ - const edm4hep::MCParticleCollection* MCParticle = nullptr; - const edm4hep::CalorimeterHitCollection* ECALBarrel = nullptr; - const edm4hep::CalorimeterHitCollection* ECALEndcap = nullptr; - const edm4hep::CalorimeterHitCollection* ECALOther = nullptr; - const edm4hep::CalorimeterHitCollection* HCALBarrel = nullptr; - const edm4hep::CalorimeterHitCollection* HCALEndcap = nullptr; - const edm4hep::CalorimeterHitCollection* HCALOther = nullptr; - const edm4hep::CalorimeterHitCollection* MUON = nullptr; - const edm4hep::CalorimeterHitCollection* LCAL = nullptr; - const edm4hep::CalorimeterHitCollection* LHCAL = nullptr; - const edm4hep::CalorimeterHitCollection* BCAL = nullptr; - const edm4hep::VertexCollection* KinkVertices = nullptr; - const edm4hep::VertexCollection* ProngVertices = nullptr; - const edm4hep::VertexCollection* SplitVertices = nullptr; - const edm4hep::VertexCollection* V0Vertices = nullptr; - const edm4hep::TrackCollection* MarlinTrkTracks = nullptr; - const edm4hep::MCRecoCaloAssociationCollection* mcRecoCaloAssociation = nullptr; - const edm4hep::MCRecoTrackerAssociationCollection* mcRecoTrackerAssociation = nullptr; - StatusCode sc = StatusCode::SUCCESS; - sc = getCol(m_mcParCol_r , MCParticle ); - sc = getCol(m_ECALBarrel_r, ECALBarrel ); - sc = getCol(m_ECALEndcap_r, ECALEndcap ); - sc = getCol(m_ECALOther_r , ECALOther ); - sc = getCol(m_HCALBarrel_r, HCALBarrel ); - sc = getCol(m_HCALEndcap_r, HCALEndcap ); - sc = getCol(m_HCALOther_r , HCALOther ); - sc = getCol(m_MUON_r , MUON ); - sc = getCol(m_LCAL_r , LCAL ); - sc = getCol(m_LHCAL_r , LHCAL ); - sc = getCol(m_BCAL_r , BCAL ); - sc = getCol(m_KinkVertices_r , KinkVertices ); - sc = getCol(m_ProngVertices_r , ProngVertices); - sc = getCol(m_SplitVertices_r , SplitVertices); - sc = getCol(m_V0Vertices_r , V0Vertices ); - sc = getCol(m_MarlinTrkTracks_r , MarlinTrkTracks ); - sc = getCol(m_MCRecoCaloAssociation_r , mcRecoCaloAssociation ); - sc = getCol(m_MCRecoTrackerAssociation_r , mcRecoTrackerAssociation ); - - if (NULL != MCParticle ) - { - std::vector<edm4hep::MCParticle> v_mc; - tmp_map.CollectionMap_MC ["MCParticle"] = MCParticle ; - tmp_map.collectionMap_MC ["MCParticle"] = v_mc; - for(unsigned int i=0 ; i< MCParticle->size(); i++) tmp_map.collectionMap_MC ["MCParticle"].push_back(MCParticle->at(i)); - } - if (NULL != ECALBarrel ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["ECALBarrel"] = ECALBarrel ; - tmp_map.collectionMap_CaloHit["ECALBarrel"] = v_cal ; - for(unsigned int i=0 ; i< ECALBarrel->size(); i++) tmp_map.collectionMap_CaloHit ["ECALBarrel"].push_back(ECALBarrel->at(i)); - } - if (NULL != ECALEndcap ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["ECALEndcap"] = ECALEndcap ; - tmp_map.collectionMap_CaloHit["ECALEndcap"] = v_cal ; - for(unsigned int i=0 ; i< ECALEndcap->size(); i++) tmp_map.collectionMap_CaloHit ["ECALEndcap"].push_back(ECALEndcap->at(i)); - } - if (NULL != ECALOther ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["ECALOther"] = ECALOther ; - tmp_map.collectionMap_CaloHit["ECALOther"] = v_cal ; - for(unsigned int i=0 ; i< ECALOther->size(); i++) tmp_map.collectionMap_CaloHit ["ECALOther"].push_back(ECALOther->at(i)); - } - if (NULL != HCALBarrel ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["HCALBarrel"] = HCALBarrel ; - tmp_map.collectionMap_CaloHit["HCALBarrel"] = v_cal ; - for(unsigned int i=0 ; i< HCALBarrel->size(); i++) tmp_map.collectionMap_CaloHit ["HCALBarrel"].push_back(HCALBarrel->at(i)); - } - if (NULL != HCALEndcap ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["HCALEndcap"] = HCALEndcap ; - tmp_map.collectionMap_CaloHit["HCALEndcap"] = v_cal ; - for(unsigned int i=0 ; i< HCALEndcap->size(); i++) tmp_map.collectionMap_CaloHit ["HCALEndcap"].push_back(HCALEndcap->at(i)); - } - if (NULL != HCALOther ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["HCALOther"] = HCALOther ; - tmp_map.collectionMap_CaloHit["HCALOther"] = v_cal ; - for(unsigned int i=0 ; i< HCALOther->size(); i++) tmp_map.collectionMap_CaloHit ["HCALOther"].push_back(HCALOther->at(i)); - } - if (NULL != MUON ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["MUON"] = MUON ; - tmp_map.collectionMap_CaloHit["MUON"] = v_cal ; - for(unsigned int i=0 ; i< MUON->size(); i++) tmp_map.collectionMap_CaloHit ["MUON"].push_back(MUON->at(i)); - } - if (NULL != LCAL ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["LCAL"] = LCAL ; - tmp_map.collectionMap_CaloHit["LCAL"] = v_cal ; - for(unsigned int i=0 ; i< LCAL->size(); i++) tmp_map.collectionMap_CaloHit ["LCAL"].push_back(LCAL->at(i)); - } - if (NULL != LHCAL ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["LHCAL"] = LHCAL ; - tmp_map.collectionMap_CaloHit["LHCAL"] = v_cal ; - for(unsigned int i=0 ; i< LHCAL->size(); i++) tmp_map.collectionMap_CaloHit ["LHCAL"].push_back(LHCAL->at(i)); - } - if (NULL != BCAL ) - { - std::vector<edm4hep::CalorimeterHit> v_cal; - tmp_map.CollectionMap_CaloHit["BCAL"] = BCAL ; - tmp_map.collectionMap_CaloHit["BCAL"] = v_cal ; - for(unsigned int i=0 ; i< BCAL->size(); i++) tmp_map.collectionMap_CaloHit ["BCAL"].push_back(BCAL->at(i)); - } - if (NULL != KinkVertices ) - { - std::vector<edm4hep::Vertex> v_cal; - tmp_map.CollectionMap_Vertex["KinkVertices"] = KinkVertices ; - tmp_map.collectionMap_Vertex["KinkVertices"] = v_cal ; - for(unsigned int i=0 ; i< KinkVertices->size(); i++) tmp_map.collectionMap_Vertex ["KinkVertices"].push_back(KinkVertices->at(i)); - } - if (NULL != ProngVertices ) - { - std::vector<edm4hep::Vertex> v_cal; - tmp_map.CollectionMap_Vertex["ProngVertices"] = ProngVertices ; - tmp_map.collectionMap_Vertex["ProngVertices"] = v_cal ; - for(unsigned int i=0 ; i< ProngVertices->size(); i++) tmp_map.collectionMap_Vertex ["ProngVertices"].push_back(ProngVertices->at(i)); - } - if (NULL != SplitVertices ) - { - std::vector<edm4hep::Vertex> v_cal; - tmp_map.CollectionMap_Vertex["SplitVertices"] = SplitVertices ; - tmp_map.collectionMap_Vertex["SplitVertices"] = v_cal ; - for(unsigned int i=0 ; i< SplitVertices->size(); i++) tmp_map.collectionMap_Vertex ["SplitVertices"].push_back(SplitVertices->at(i)); - } - if (NULL != V0Vertices ) - { - std::vector<edm4hep::Vertex> v_cal; - tmp_map.CollectionMap_Vertex["V0Vertices"] = V0Vertices ; - tmp_map.collectionMap_Vertex["V0Vertices"] = v_cal ; - for(unsigned int i=0 ; i< V0Vertices->size(); i++) tmp_map.collectionMap_Vertex ["V0Vertices"].push_back(V0Vertices->at(i)); - } - if (NULL != MarlinTrkTracks ) - { - std::vector<edm4hep::Track> v_cal; - tmp_map.CollectionMap_Track["MarlinTrkTracks"] = MarlinTrkTracks ; - tmp_map.collectionMap_Track["MarlinTrkTracks"] = v_cal ; - for(unsigned int i=0 ; i< MarlinTrkTracks->size(); i++) tmp_map.collectionMap_Track ["MarlinTrkTracks"].push_back(MarlinTrkTracks->at(i)); - } - if (NULL != mcRecoCaloAssociation ) - { - std::vector<edm4hep::MCRecoCaloAssociation> v_cal; - tmp_map.collectionMap_CaloRel["RecoCaloAssociation"] = v_cal ; - for(unsigned int i=0 ; i< mcRecoCaloAssociation->size(); i++) tmp_map.collectionMap_CaloRel ["RecoCaloAssociation"].push_back(mcRecoCaloAssociation->at(i)); - } - if (NULL != mcRecoTrackerAssociation ) - { - std::vector<edm4hep::MCRecoTrackerAssociation> v_cal; - tmp_map.collectionMap_TrkRel["RecoTrackerAssociation"] = v_cal ; - for(unsigned int i=0 ; i< mcRecoTrackerAssociation->size(); i++) tmp_map.collectionMap_TrkRel ["RecoTrackerAssociation"].push_back(mcRecoTrackerAssociation->at(i)); - } - return StatusCode::SUCCESS; -} StatusCode PandoraPFAlg::Ana() @@ -813,10 +577,8 @@ StatusCode PandoraPFAlg::Ana() int n_current = m_tree->GetEntries()+1; const edm4hep::ReconstructedParticleCollection* reco_col = m_ReconstructedParticleCollection_w.get(); const edm4hep::MCRecoParticleAssociationCollection* reco_associa_col = m_MCRecoParticleAssociation_w.get(); - std::cout<<"reco_col size="<<reco_col->size()<<std::endl; for(int i=0; i<reco_col->size();i++) { - std::cout<<"reco="<<i<<std::endl; const edm4hep::ReconstructedParticle pReco = reco_col->at(i); const float px = pReco.getMomentum()[0]; const float py = pReco.getMomentum()[1]; @@ -825,7 +587,6 @@ StatusCode PandoraPFAlg::Ana() const float mass = pReco.getMass(); const float charge = pReco.getCharge(); const int type = pReco.getType(); - //std::cout<<"MYDBUG evt="<<n_current<<",rec i="<<i<<",particleId="<<type<<",mass="<<mass<<",charge="<<charge<<",energy="<<energy<<",px="<<px<<",py="<<py<<",pz="<<pz<<std::endl; m_pReco_PID.push_back(type); m_pReco_mass.push_back(mass); m_pReco_charge.push_back(charge); @@ -836,7 +597,7 @@ StatusCode PandoraPFAlg::Ana() for(int j=0; j < reco_associa_col->size(); j++) { if(reco_associa_col->at(j).getRec().id() != pReco.id() ) continue; - std::cout<<"MC pid ="<<reco_associa_col->at(j).getSim().getPDG()<<", px="<<reco_associa_col->at(j).getSim().getMomentum()[0]<<", py="<<reco_associa_col->at(j).getSim().getMomentum()[1]<<",pz="<<reco_associa_col->at(j).getSim().getMomentum()[2]<<std::endl; + std::cout<<"MC pid ="<<reco_associa_col->at(j).getSim().getPDG()<<",weight="<<reco_associa_col->at(j).getWeight()<<", px="<<reco_associa_col->at(j).getSim().getMomentum()[0]<<", py="<<reco_associa_col->at(j).getSim().getMomentum()[1]<<",pz="<<reco_associa_col->at(j).getSim().getMomentum()[2]<<std::endl; } } const edm4hep::MCParticleCollection* MCParticle = nullptr; @@ -853,8 +614,7 @@ StatusCode PandoraPFAlg::Ana() m_mc_py .push_back(MCParticle->at(i).getMomentum()[1]); m_mc_pz .push_back(MCParticle->at(i).getMomentum()[2]); m_mc_charge.push_back(MCParticle->at(i).getCharge()); - //for(unsigned int j =0 ; j< MCParticle->at(i).daughters_size(); j++) da_pids.push_back( MCParticle->at(i).getDaughters(j).getPDG()); - if(MCParticle->at(i).parents_size()==0) std::cout<<"MYDBUG evt="<<n_current<<", mc i="<<i<<",px="<<MCParticle->at(i).getMomentum()[0]<<",py="<<MCParticle->at(i).getMomentum()[1]<<",pz="<<MCParticle->at(i).getMomentum()[2]<<std::endl; + //if(MCParticle->at(i).parents_size()==0) std::cout<<"MYDBUG evt="<<n_current<<", mc i="<<i<<",px="<<MCParticle->at(i).getMomentum()[0]<<",py="<<MCParticle->at(i).getMomentum()[1]<<",pz="<<MCParticle->at(i).getMomentum()[2]<<std::endl; if (MCParticle->at(i).getPDG() != 22) continue; int hasEm = 0; int hasEp = 0; @@ -870,15 +630,17 @@ StatusCode PandoraPFAlg::Ana() return StatusCode::SUCCESS; } -// create simple MCRecoParticleAssociation using calorimeter hit only + +// create simple MCRecoParticleAssociation using calorimeter hit only now StatusCode PandoraPFAlg::CreateMCRecoParticleAssociation() { edm4hep::MCRecoParticleAssociationCollection* pMCRecoParticleAssociationCollection = m_MCRecoParticleAssociation_w.createAndPut(); const edm4hep::ReconstructedParticleCollection* reco_col = m_ReconstructedParticleCollection_w.get(); - std::cout<<"CreateMCRecoParticleAssociation, reco_col size="<<reco_col->size()<<std::endl; for(int i=0; i<reco_col->size();i++) { 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); for(int j=0; j < pReco.clusters_size(); j++) { @@ -894,6 +656,9 @@ StatusCode PandoraPFAlg::CreateMCRecoParticleAssociation() for(std::vector<edm4hep::ConstCaloHitContribution>::const_iterator 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() ; + else id_edep_map[itc->getParticle().id()] = itc->getEnergy() ; + tot_en += itc->getEnergy() ; } } } @@ -904,7 +669,16 @@ StatusCode PandoraPFAlg::CreateMCRecoParticleAssociation() edm4hep::MCRecoParticleAssociation association = pMCRecoParticleAssociationCollection->create(); association.setRec(pReco); association.setSim(it->second); + if(tot_en==0) + { + association.setWeight(0); + std::cout<<"Found 0 cluster energy"<<std::endl; + } + else if(id_edep_map.find(it->first) != id_edep_map.end()) association.setWeight(id_edep_map[it->first]/tot_en); + else std::cout<<"Error in creating MCRecoParticleAssociation"<<std::endl; } } return StatusCode::SUCCESS; } + + diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/PfoCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/PfoCreator.cpp index a8c9f0c4b1c1f7fe2ec7bf32666ce3a1a4bd096c..ce3cedd677748da435ee71bd1897c94a20ac7f67 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/PfoCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/PfoCreator.cpp @@ -1,12 +1,9 @@ /** - * @file MarlinPandora/src/PfoCreator.cc - * * @brief Implementation of the pfo creator class. * * $Log: $ */ -//#include "CalorimeterHitType.h" #include "Api/PandoraApi.h" @@ -45,28 +42,19 @@ pandora::StatusCode PfoCreator::CreateParticleFlowObjects(CollectionMaps& collec const pandora::PfoList *pPandoraPfoList = NULL; PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::GetCurrentPfoList(*m_pPandora, pPandoraPfoList)); - - //IMPL::LCFlagImpl lcFlagImpl(pClusterCollection->getFlag()); - //lcFlagImpl.setBit(LCIO::CLBIT_HITS); - //pClusterCollection->setFlag(lcFlagImpl.getFlag()); - pandora::StringVector subDetectorNames; this->InitialiseSubDetectorNames(subDetectorNames); - //pClusterCollection->parameters().setValues("ClusterSubdetectorNames", subDetectorNames); - // Create lcio "reconstructed particles" from the pandora "particle flow objects" std::cout<<"pPandoraPfoList size="<<pPandoraPfoList->size()<<std::endl; for (pandora::PfoList::const_iterator pIter = pPandoraPfoList->begin(), pIterEnd = pPandoraPfoList->end(); pIter != pIterEnd; ++pIter) { const pandora::ParticleFlowObject *const pPandoraPfo(*pIter); - //IMPL::ReconstructedParticleImpl *const pReconstructedParticle(new ReconstructedParticleImpl()); edm4hep::ReconstructedParticle pReconstructedParticle0 = pReconstructedParticleCollection->create(); edm4hep::ReconstructedParticle* pReconstructedParticle = &pReconstructedParticle0; const bool hasTrack(!pPandoraPfo->GetTrackList().empty()); const pandora::ClusterList &clusterList(pPandoraPfo->GetClusterList()); - //std::cout<<"ClusterList size="<<clusterList.size()<<std::endl; float clustersTotalEnergy(0.f); pandora::CartesianVector referencePoint(0.f, 0.f, 0.f), clustersWeightedPosition(0.f, 0.f, 0.f); for (pandora::ClusterList::const_iterator cIter = clusterList.begin(), cIterEnd = clusterList.end(); cIter != cIterEnd; ++cIter) @@ -77,7 +65,6 @@ pandora::StatusCode PfoCreator::CreateParticleFlowObjects(CollectionMaps& collec pandoraCaloHitList.insert(pandoraCaloHitList.end(), pPandoraCluster->GetIsolatedCaloHitList().begin(), pPandoraCluster->GetIsolatedCaloHitList().end()); pandora::FloatVector hitE, hitX, hitY, hitZ; - //IMPL::ClusterImpl *const p_Cluster(new ClusterImpl()); edm4hep::Cluster p_Cluster0 = pClusterCollection->create(); edm4hep::Cluster* p_Cluster = &p_Cluster0; this->SetClusterSubDetectorEnergies(subDetectorNames, p_Cluster, pandoraCaloHitList, hitE, hitX, hitY, hitZ); @@ -95,7 +82,6 @@ pandora::StatusCode PfoCreator::CreateParticleFlowObjects(CollectionMaps& collec clustersTotalEnergy += clusterCorrectEnergy; } - //pClusterCollection->addElement(p_Cluster); edm4hep::ConstCluster p_ClusterCon = *p_Cluster; pReconstructedParticle->addToClusters(p_ClusterCon); } @@ -123,7 +109,6 @@ pandora::StatusCode PfoCreator::CreateParticleFlowObjects(CollectionMaps& collec edm4hep::Vertex pStartVertex0 = pStartVertexCollection->create(); edm4hep::Vertex* pStartVertex = &pStartVertex0; - //pStartVertex->setAlgorithmType(m_settings.m_startVertexAlgName.c_str()); pStartVertex->setAlgorithmType(0); const float ref_value[3] = {referencePoint.GetX(),referencePoint.GetY(),referencePoint.GetZ()}; pStartVertex->setPosition(edm4hep::Vector3f(ref_value)); @@ -164,7 +149,7 @@ void PfoCreator::SetClusterSubDetectorEnergies(const pandora::StringVector &subD hitX.push_back(pCalorimeterHit.getPosition()[0]); hitY.push_back(pCalorimeterHit.getPosition()[1]); hitZ.push_back(pCalorimeterHit.getPosition()[2]); - /* + /*Can be added later std::vector<float> &subDetectorEnergies = p_Cluster->subdetectorEnergies(); subDetectorEnergies.resize(subDetectorNames.size()); @@ -206,16 +191,13 @@ void PfoCreator::SetClusterEnergyAndError(const pandora::ParticleFlowObject *con void PfoCreator::SetClusterPositionAndError(const unsigned int nHitsInCluster, pandora::FloatVector &hitE, pandora::FloatVector &hitX, pandora::FloatVector &hitY, pandora::FloatVector &hitZ, edm4hep::Cluster *const p_Cluster, pandora::CartesianVector &clusterPositionVec) const { - ClusterShapes *const pClusterShapes(new ClusterShapes(nHitsInCluster, hitE.data(), hitX.data(), hitY.data(), hitZ.data())); + ClusterShapes *const pClusterShapes(new ClusterShapes(nHitsInCluster, hitE.data(), hitX.data(), hitY.data(), hitZ.data()));//this need GSL/1.14 try { p_Cluster->setPhi(std::atan2(pClusterShapes->getEigenVecInertia()[1], pClusterShapes->getEigenVecInertia()[0])); p_Cluster->setITheta(std::acos(pClusterShapes->getEigenVecInertia()[2])); p_Cluster->setPosition(pClusterShapes->getCentreOfGravity()); - //ATTN these two lines below would only compile with ilcsoft HEAD V2015-10-13 and above - //p_Cluster->setPositionError(pClusterShapes->getCenterOfGravityErrors()); - //p_Cluster->setDirectionError(pClusterShapes->getEigenVecInertiaErrors()); clusterPositionVec.SetValues(pClusterShapes->getCentreOfGravity()[0], pClusterShapes->getCentreOfGravity()[1], pClusterShapes->getCentreOfGravity()[2]); } catch (...) @@ -260,7 +242,6 @@ pandora::StatusCode PfoCreator::CalculateTrackBasedReferencePoint(const pandora: const float z0(pPandoraTrack->GetZ0()); pandora::CartesianVector intersectionPoint(0.f, 0.f, 0.f); - //intersectionPoint.SetValues(pLcioTrack->getD0() * std::cos(pLcioTrack->getPhi()), pLcioTrack->getD0() * std::sin(pLcioTrack->getPhi()), z0); if(pLcioTrack.trackStates_size()==0) throw "zero trackStates size find"; intersectionPoint.SetValues(pLcioTrack.getTrackStates(0).D0 * std::cos(pLcioTrack.getTrackStates(0).phi), pLcioTrack.getTrackStates(0).D0 * std::sin(pLcioTrack.getTrackStates(0).phi), z0); const float trackMomentumAtDca((pPandoraTrack->GetMomentumAtDca()).GetMagnitude()); diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp index a57bd9b2667968cf66d21d854bab25489f83833d..8dc23c5725546cdb3626cbe3b4c1281648e4da8a 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp @@ -1,18 +1,12 @@ /** - * @file MarlinPandora/src/TrackCreator.cc * * @brief Implementation of the track creator class. * * $Log: $ */ -//#include "marlin/Global.h" -//#include "marlin/Processor.h" -//#include "EVENT/LCCollection.h" -//#include "EVENT/ReconstructedParticle.h" -//#include "EVENT/Vertex.h" -#include "UTIL/ILDConf.h" +//#include "UTIL/ILDConf.h" #include "edm4hep/Vertex.h" #include "edm4hep/ReconstructedParticle.h" @@ -144,9 +138,9 @@ TrackCreator::~TrackCreator() //------------------------------------------------------------------------------------------------------------------------------------------ -pandora::StatusCode TrackCreator::CreateTrackAssociations(const CollectionMaps& collectionMaps) +pandora::StatusCode TrackCreator::CreateTrackAssociations(const CollectionMaps& collectionMaps)//TODO, due to the lack of full Vertex information { -// Don't use it now, because the Vertex.getAssociatedParticle() doesn't work for LCIO to plcio transfer +// TODO, because the Vertex.getAssociatedParticle() doesn't work for LCIO to plcio transfer // PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->ExtractKinks(collectionMaps)); // PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->ExtractProngsAndSplits(const CollectionMaps& collectionMaps)); // PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->ExtractV0s(const CollectionMaps& collectionMaps)); @@ -444,16 +438,11 @@ pandora::StatusCode TrackCreator::ExtractV0s(const EVENT::LCEvent *const pLCEven bool TrackCreator::IsConflictingRelationship(const edm4hep::ConstReconstructedParticle &Particle) const { - //for (unsigned int iTrack = 0, nTracks = trackVec.size(); iTrack < nTracks; ++iTrack) - //for (unsigned int iTrack = 0, nTracks = trackVec.tracks_size(); iTrack < nTracks; ++iTrack) - std::cout<<"Particle en="<<Particle.getEnergy()<<std::endl; for (unsigned int iTrack = 0, nTracks = Particle.tracks_size(); iTrack < nTracks; ++iTrack) { - //EVENT::Track *pTrack = trackVec[iTrack]; edm4hep::ConstTrack pTrack = Particle.getTracks(iTrack) ; unsigned int pTrack_id = pTrack.id() ; - //if (this->IsDaughter(pTrack) || this->IsParent(pTrack) || this->IsV0(pTrack)) if (this->IsDaughter(pTrack_id) || this->IsParent(pTrack_id) || this->IsV0(pTrack_id)) return true; } @@ -473,7 +462,6 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM try { const std::vector<edm4hep::Track>& pTrackCollection = (collectionMaps.collectionMap_Track.find(*iter))->second; - std::cout<<(*iter)<<" size="<<pTrackCollection.size()<<std::endl; for (int i = 0, iMax = pTrackCollection.size(); i < iMax; ++i) { @@ -485,8 +473,6 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM if (NULL == pTrack) throw ("Collection type mismatch"); int minTrackHits = m_settings.m_minTrackHits; - //const float tanLambda(std::fabs(pTrack->getTanLambda())); - //std::cout<<"track states size="<<pTrack->trackStates_size()<<std::endl; const float tanLambda(std::fabs(pTrack->getTrackStates(0).tanLambda)); if (tanLambda > m_tanLambdaFtd) @@ -512,9 +498,7 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM // Proceed to create the pandora track PandoraApi::Track::Parameters trackParameters; - //trackParameters.m_d0 = pTrack->getD0(); trackParameters.m_d0 = pTrack->getTrackStates(0).D0; - //trackParameters.m_z0 = pTrack->getZ0(); trackParameters.m_z0 = pTrack->getTrackStates(0).Z0; trackParameters.m_pParentAddress = pTrack; // By default, assume tracks are charged pions @@ -543,17 +527,17 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM } catch (pandora::StatusCodeException &statusCodeException) { - std::cout<<"ERROR Failed to extract a track: " << statusCodeException.ToString() << std::endl; + std::cout<<"Failed to extract a track: " << statusCodeException.ToString() << std::endl; } catch (...) { - std::cout << "WARNNING Failed to extract a track "<< std::endl; + std::cout << "Failed to extract a track "<< std::endl; } } } catch (...) { - std::cout<<"WARNING Failed to extract track collection: " << *iter << std::endl; + std::cout<<"Failed to extract track collection: " << *iter << std::endl; } } @@ -564,29 +548,15 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM void TrackCreator::GetTrackStates(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const { - //const TrackState *pTrackState = pTrack->getTrackState(TrackState::AtIP); edm4hep::TrackState pTrackState = pTrack->getTrackStates(1); // ref /cvmfs/cepcsw.ihep.ac.cn/prototype/LCIO/include/EVENT/TrackState.h - //if (!pTrackState) throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED); - - //const double pt(m_bField * 2.99792e-4 / std::fabs(pTrackState->getOmega())); const double pt(m_bField * 2.99792e-4 / std::fabs(pTrackState.omega)); - //trackParameters.m_momentumAtDca = pandora::CartesianVector(std::cos(pTrackState->getPhi()), std::sin(pTrackState->getPhi()), pTrackState->getTanLambda()) * pt; trackParameters.m_momentumAtDca = pandora::CartesianVector(std::cos(pTrackState.phi), std::sin(pTrackState.phi), pTrackState.tanLambda) * pt; - //this->CopyTrackState(pTrack->getTrackState(TrackState::AtFirstHit), trackParameters.m_trackStateAtStart); this->CopyTrackState(pTrack->getTrackStates(2), trackParameters.m_trackStateAtStart); - //fg: curling TPC tracks have pointers to track segments stored -> need to get track states from last segment! - //const EVENT::Track *pEndTrack = (pTrack->getTracks().empty() ? pTrack : pTrack->getTracks().back()); auto pEndTrack = (pTrack->tracks_size() ==0 ) ? *pTrack : pTrack->getTracks(pTrack->tracks_size()-1); - //std::cout<<"GetTrackStates 1.6"<<", end track trackStates_size()="<<pEndTrack.trackStates_size()<<std::endl; - - //this->CopyTrackState(pEndTrack->getTrackState(TrackState::AtLastHit), trackParameters.m_trackStateAtEnd); - //this->CopyTrackState(pEndTrack->getTrackState(TrackState::AtCalorimeter), trackParameters.m_trackStateAtCalorimeter); - this->CopyTrackState(pEndTrack.getTrackStates(3), trackParameters.m_trackStateAtEnd); - //this->CopyTrackState(pEndTrack.getTrackStates(4), trackParameters.m_trackStateAtCalorimeter); //FIXME ? LCIO input only has 4 states, so 4 can't be used. this->CopyTrackState(pEndTrack.getTrackStates(3), trackParameters.m_trackStateAtCalorimeter); @@ -604,7 +574,6 @@ void TrackCreator::GetTrackStates(const edm4hep::Track *const pTrack, PandoraApi float TrackCreator::CalculateTrackTimeAtCalorimeter(const edm4hep::Track *const pTrack) const { - //const pandora::Helix helix(pTrack->getPhi(), pTrack->getD0(), pTrack->getZ0(), pTrack->getOmega(), pTrack->getTanLambda(), m_bField); 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()); @@ -660,15 +629,10 @@ float TrackCreator::CalculateTrackTimeAtCalorimeter(const edm4hep::Track *const void TrackCreator::CopyTrackState(const edm4hep::TrackState & pTrackState, pandora::InputTrackState &inputTrackState) const { - //if (!pTrackState) throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED); - //const double pt(m_bField * 2.99792e-4 / std::fabs(pTrackState->getOmega())); const double pt(m_bField * 2.99792e-4 / std::fabs(pTrackState.omega)); - //const double px(pt * std::cos(pTrackState->getPhi())); const double px(pt * std::cos(pTrackState.phi)); - //const double py(pt * std::sin(pTrackState->getPhi())); const double py(pt * std::sin(pTrackState.phi)); - //const double pz(pt * pTrackState->getTanLambda()); const double pz(pt * pTrackState.tanLambda); const double xs(pTrackState.referencePoint[0]); @@ -718,7 +682,6 @@ void TrackCreator::TrackReachesECAL(const edm4hep::Track *const pTrack, PandoraA (std::fabs(z) - m_settings.m_reachesECalFtdZMaxDistance < m_ftdZPositions[j]) && (std::fabs(z) + m_settings.m_reachesECalFtdZMaxDistance > m_ftdZPositions[j])) { - //if (static_cast<int>(j) > maxOccupiedFtdLayer) maxOccupiedFtdLayer = static_cast<int>(j); if ( j > maxOccupiedFtdLayer) maxOccupiedFtdLayer = j; break; } @@ -770,19 +733,14 @@ void TrackCreator::DefineTrackPfoUsage(const edm4hep::Track *const pTrack, Pando bool canFormPfo(false); bool canFormClusterlessPfo(false); - //if (trackParameters.m_reachesCalorimeter.Get() && !this->IsParent(pTrack)) if (trackParameters.m_reachesCalorimeter.Get() && !this->IsParent(pTrack->id())) { - //const float d0(std::fabs(pTrack->getD0())), z0(std::fabs(pTrack->getZ0())); const float d0(std::fabs(pTrack->getTrackStates(0).D0)), z0(std::fabs(pTrack->getTrackStates(0).Z0)); - //EVENT::TrackerHitVec trackerHitvec(pTrack->getTrackerHits()); float rInner(std::numeric_limits<float>::max()), zMin(std::numeric_limits<float>::max()); - //for (EVENT::TrackerHitVec::const_iterator iter = trackerHitvec.begin(), iterEnd = trackerHitvec.end(); iter != iterEnd; ++iter) for (std::vector<edm4hep::ConstTrackerHit>::const_iterator iter = pTrack->trackerHits_begin(), iterEnd = pTrack->trackerHits_end(); iter != iterEnd; ++iter) { - //const double *pPosition((*iter)->getPosition()); const edm4hep::Vector3d pPosition = (*iter).getPosition(); const float x(pPosition[0]), y(pPosition[1]), absoluteZ(std::fabs(pPosition[2])); const float r(std::sqrt(x * x + y * y)); @@ -860,7 +818,6 @@ bool TrackCreator::PassesQualityCuts(const edm4hep::Track *const pTrack, const P if (trackParameters.m_trackStateAtCalorimeter.Get().GetPosition().GetMagnitude() < m_settings.m_minTrackECalDistanceFromIp) return false; - //if (std::fabs(pTrack->getOmega()) < std::numeric_limits<float>::epsilon()) if (std::fabs(pTrack->getTrackStates(0).omega) < std::numeric_limits<float>::epsilon()) { std::cout<<"ERROR Track has Omega = 0 " << std::endl; @@ -869,7 +826,6 @@ bool TrackCreator::PassesQualityCuts(const edm4hep::Track *const pTrack, const P // Check momentum uncertainty is reasonable to use track const pandora::CartesianVector &momentumAtDca(trackParameters.m_momentumAtDca.Get()); - //const float sigmaPOverP(std::sqrt(pTrack->getCovMatrix()[5]) / std::fabs(pTrack->getOmega())); const float sigmaPOverP(std::sqrt(pTrack->getTrackStates(0).covMatrix[5]) / std::fabs(pTrack->getTrackStates(0).omega)); if (sigmaPOverP > m_settings.m_maxTrackSigmaPOverP) @@ -941,7 +897,7 @@ int TrackCreator::GetNTpcHits(const edm4hep::Track *const pTrack) const // trk->subdetectorHitNumbers()[ 2 * ILDDetID::TPC - 2 ] = hitCount ; // ---- use hitsInFit : //return pTrack->getSubdetectorHitNumbers()[ 2 * lcio::ILDDetID::TPC - 1 ]; - return pTrack->getSubDetectorHitNumbers(2 * lcio::ILDDetID::TPC - 1);// still use LCIO code now + return pTrack->getSubDetectorHitNumbers(2 * 4 - 1);// lcio::ILDDetID::TPC=4, still use LCIO code now } //------------------------------------------------------------------------------------------------------------------------------------------ @@ -954,7 +910,7 @@ int TrackCreator::GetNFtdHits(const edm4hep::Track *const pTrack) const // trk->subdetectorHitNumbers()[ 2 * ILDDetID::TPC - 2 ] = hitCount ; // ---- use hitsInFit : //return pTrack->getSubdetectorHitNumbers()[ 2 * lcio::ILDDetID::FTD - 1 ]; - return pTrack->getSubDetectorHitNumbers( 2 * lcio::ILDDetID::FTD - 1 ); + return pTrack->getSubDetectorHitNumbers( 2 * 3 - 1 );// lcio::ILDDetID::FTD=3 } //------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml b/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml new file mode 100644 index 0000000000000000000000000000000000000000..8bf0e965b235f94400e68629ec565f5f9fd14db2 --- /dev/null +++ b/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml @@ -0,0 +1,447 @@ +<!-- Pandora settings xml file --> + +<pandora> + <!-- GLOBAL SETTINGS --> + <IsMonitoringEnabled>true</IsMonitoringEnabled> + <ShouldDisplayAlgorithmInfo>false</ShouldDisplayAlgorithmInfo> + <ShouldCollapseMCParticlesToPfoTarget>true</ShouldCollapseMCParticlesToPfoTarget> + + <!-- PLUGIN SETTINGS --> + <!--HadronicEnergyCorrectionPlugins>SoftwareCompensation</HadronicEnergyCorrectionPlugins--> + <EmShowerPlugin>LCEmShowerId</EmShowerPlugin> + <PhotonPlugin>LCPhotonId</PhotonPlugin> + <ElectronPlugin>LCElectronId</ElectronPlugin> + <MuonPlugin>LCMuonId</MuonPlugin> + + <!-- ALGORITHM SETTINGS --> + + <!-- Set calo hit properties, then select tracks and hits to use for clustering --> + <algorithm type = "CaloHitPreparation"/> + <algorithm type = "EventPreparation"> + <OutputTrackListName>Tracks</OutputTrackListName> + <OutputCaloHitListName>CaloHits</OutputCaloHitListName> + <OutputMuonCaloHitListName>MuonYokeHits</OutputMuonCaloHitListName> + <ReplacementTrackListName>Tracks</ReplacementTrackListName> + <ReplacementCaloHitListName>CaloHits</ReplacementCaloHitListName> + </algorithm> + + <!-- Standalone muon clustering --> + <algorithm type = "MuonReconstruction"> + <algorithm type = "ConeClustering" description = "MuonClusterFormation"> + <TanConeAngleCoarse>0.3</TanConeAngleCoarse> + <ConeApproachMaxSeparation>2000</ConeApproachMaxSeparation> + <MaxClusterDirProjection>2000</MaxClusterDirProjection> + <ShouldUseIsolatedHits>true</ShouldUseIsolatedHits> + <LayersToStepBackCoarse>30</LayersToStepBackCoarse> + <AdditionalPadWidthsCoarse>1</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsCoarse>1.8</SameLayerPadWidthsCoarse> + <ShouldUseTrackSeed>false</ShouldUseTrackSeed> + <MaxTrackSeedSeparation>0</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <!-- Input lists --> + <InputTrackListName>Tracks</InputTrackListName> + <InputCaloHitListName>CaloHits</InputCaloHitListName> + <InputMuonCaloHitListName>MuonYokeHits</InputMuonCaloHitListName> + <!-- Output lists --> + <OutputTrackListName>MuonRemovedTracks</OutputTrackListName> + <OutputCaloHitListName>MuonRemovedCaloHits</OutputCaloHitListName> + <OutputMuonCaloHitListName>MuonRemovedYokeHits</OutputMuonCaloHitListName> + <OutputMuonClusterListName>MuonClusters</OutputMuonClusterListName> + <OutputMuonPfoListName>MuonPfos</OutputMuonPfoListName> + <!-- Current list management --> + <ReplacementTrackListName>MuonRemovedTracks</ReplacementTrackListName> + <ReplacementCaloHitListName>MuonRemovedCaloHits</ReplacementCaloHitListName> + <ReplaceCurrentClusterList>false</ReplaceCurrentClusterList> + <ReplaceCurrentPfoList>false</ReplaceCurrentPfoList> + </algorithm> + + <!-- Standalone photon clustering --> + <algorithm type = "PhotonReconstruction"> + <algorithm type = "ConeClustering" description = "PhotonClusterFormation"> + <ClusterSeedStrategy>0</ClusterSeedStrategy> + <ShouldUseTrackSeed>false</ShouldUseTrackSeed> + <ShouldUseOnlyECalHits>true</ShouldUseOnlyECalHits> + <ConeApproachMaxSeparation>250.</ConeApproachMaxSeparation> + </algorithm> + <ClusterListName>PhotonClusters</ClusterListName> + <ReplaceCurrentClusterList>false</ReplaceCurrentClusterList> + <ShouldMakePdfHistograms>false</ShouldMakePdfHistograms> + <HistogramFile>/junofs/users/wxfang/MyGit/MarlinPandora/scripts/PandoraLikelihoodData9EBin.xml</HistogramFile> + </algorithm> + + <!-- Clustering parent algorithm runs a daughter clustering algorithm --> + <algorithm type = "ClusteringParent"> + <algorithm type = "ConeClustering" description = "ClusterFormation"/> + <algorithm type = "TopologicalAssociationParent" description = "ClusterAssociation"> + <associationAlgorithms> + <algorithm type = "LoopingTracks"/> + <algorithm type = "BrokenTracks"/> + <algorithm type = "ShowerMipMerging"/> + <algorithm type = "ShowerMipMerging2"/> + <algorithm type = "BackscatteredTracks"/> + <algorithm type = "BackscatteredTracks2"/> + <algorithm type = "ShowerMipMerging3"/> + <algorithm type = "ShowerMipMerging4"/> + <algorithm type = "ProximityBasedMerging"> + <algorithm type = "TrackClusterAssociation"/> + </algorithm> + <algorithm type = "ConeBasedMerging"> + <algorithm type = "TrackClusterAssociation"/> + </algorithm> + <algorithm type = "MipPhotonSeparation"> + <algorithm type = "TrackClusterAssociation"/> + </algorithm> + <algorithm type = "HighEnergyPhotonRecovery"> + <algorithm type = "TrackClusterAssociation"/> + <AdditionalClusterListNames>PhotonClusters</AdditionalClusterListNames> + </algorithm> + <algorithm type = "SoftClusterMerging"> + <algorithm type = "TrackClusterAssociation"/> + <AdditionalClusterListNames>PhotonClusters</AdditionalClusterListNames> + </algorithm> + <algorithm type = "IsolatedHitMerging"> + <AdditionalClusterListNames>PhotonClusters</AdditionalClusterListNames> + </algorithm> + </associationAlgorithms> + </algorithm> + <ClusterListName>PrimaryClusters</ClusterListName> + <ReplaceCurrentClusterList>true</ReplaceCurrentClusterList> + </algorithm> + + <!-- Reclustering algorithms run multiple clustering algorithms --> + <algorithm type = "SplitTrackAssociations" instance = "SplitTrackAssociations1"> + <clusteringAlgorithms> + <algorithm type = "ConeClustering" instance = "Reclustering1"> + <TanConeAngleFine>0.24</TanConeAngleFine> + <TanConeAngleCoarse>0.4</TanConeAngleCoarse> + <AdditionalPadWidthsFine>2</AdditionalPadWidthsFine> + <AdditionalPadWidthsCoarse>2</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsFine>2.24</SameLayerPadWidthsFine> + <SameLayerPadWidthsCoarse>1.44</SameLayerPadWidthsCoarse> + <MaxTrackSeedSeparation>100</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering2"> + <TanConeAngleFine>0.18</TanConeAngleFine> + <TanConeAngleCoarse>0.3</TanConeAngleCoarse> + <AdditionalPadWidthsFine>1.5</AdditionalPadWidthsFine> + <AdditionalPadWidthsCoarse>1.5</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsFine>1.68</SameLayerPadWidthsFine> + <SameLayerPadWidthsCoarse>1.08</SameLayerPadWidthsCoarse> + <MaxTrackSeedSeparation>100</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering3"> + <TanConeAngleFine>0.15</TanConeAngleFine> + <TanConeAngleCoarse>0.25</TanConeAngleCoarse> + <AdditionalPadWidthsFine>1.25</AdditionalPadWidthsFine> + <AdditionalPadWidthsCoarse>1.25</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsFine>1.4</SameLayerPadWidthsFine> + <SameLayerPadWidthsCoarse>0.9</SameLayerPadWidthsCoarse> + <MaxTrackSeedSeparation>100</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering4"> + <TanConeAngleFine>0.12</TanConeAngleFine> + <TanConeAngleCoarse>0.2</TanConeAngleCoarse> + <AdditionalPadWidthsFine>1</AdditionalPadWidthsFine> + <AdditionalPadWidthsCoarse>1</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsFine>1.12</SameLayerPadWidthsFine> + <SameLayerPadWidthsCoarse>0.72</SameLayerPadWidthsCoarse> + <MaxTrackSeedSeparation>100</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering5"> + <TanConeAngleFine>0.09</TanConeAngleFine> + <TanConeAngleCoarse>0.15</TanConeAngleCoarse> + <AdditionalPadWidthsFine>0.75</AdditionalPadWidthsFine> + <AdditionalPadWidthsCoarse>0.75</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsFine>0.84</SameLayerPadWidthsFine> + <SameLayerPadWidthsCoarse>0.54</SameLayerPadWidthsCoarse> + <MaxTrackSeedSeparation>100</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering6"> + <TanConeAngleFine>0.075</TanConeAngleFine> + <TanConeAngleCoarse>0.125</TanConeAngleCoarse> + <AdditionalPadWidthsFine>0.625</AdditionalPadWidthsFine> + <AdditionalPadWidthsCoarse>0.625</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsFine>0.7</SameLayerPadWidthsFine> + <SameLayerPadWidthsCoarse>0.45</SameLayerPadWidthsCoarse> + <MaxTrackSeedSeparation>100</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering7"> + <TanConeAngleFine>0.06</TanConeAngleFine> + <TanConeAngleCoarse>0.1</TanConeAngleCoarse> + <AdditionalPadWidthsFine>0.5</AdditionalPadWidthsFine> + <AdditionalPadWidthsCoarse>0.5</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsFine>0.56</SameLayerPadWidthsFine> + <SameLayerPadWidthsCoarse>0.36</SameLayerPadWidthsCoarse> + <MaxTrackSeedSeparation>100</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering8"> + <TanConeAngleFine>0.045</TanConeAngleFine> + <TanConeAngleCoarse>0.075</TanConeAngleCoarse> + <AdditionalPadWidthsFine>0.375</AdditionalPadWidthsFine> + <AdditionalPadWidthsCoarse>0.375</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsFine>0.42</SameLayerPadWidthsFine> + <SameLayerPadWidthsCoarse>0.27</SameLayerPadWidthsCoarse> + <MaxTrackSeedSeparation>100</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering9"> + <TanConeAngleFine>0.03</TanConeAngleFine> + <TanConeAngleCoarse>0.05</TanConeAngleCoarse> + <AdditionalPadWidthsFine>0.25</AdditionalPadWidthsFine> + <AdditionalPadWidthsCoarse>0.25</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsFine>0.28</SameLayerPadWidthsFine> + <SameLayerPadWidthsCoarse>0.18</SameLayerPadWidthsCoarse> + <MaxTrackSeedSeparation>100</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering10"> + <MaxTrackSeedSeparation>250</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>3</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>3</MaxLayersToTrackLikeHit> + <TrackPathWidth>2</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering11"> + <ShouldUseTrackSeed>false</ShouldUseTrackSeed> + <MaxTrackSeedSeparation>0</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <algorithm type = "ConeClustering" instance = "Reclustering12"> + <MaxTrackSeedSeparation>1000</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>6</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>3</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + </clusteringAlgorithms> + <algorithm type = "TopologicalAssociationParent" description = "ClusterAssociation" instance = "reclusterAssociation"> + <associationAlgorithms> + <algorithm type = "LoopingTracks"/> + <algorithm type = "BrokenTracks"/> + <algorithm type = "ShowerMipMerging"/> + <algorithm type = "ShowerMipMerging2"/> + <algorithm type = "BackscatteredTracks"/> + <algorithm type = "BackscatteredTracks2"/> + <algorithm type = "ShowerMipMerging3"/> + <algorithm type = "ShowerMipMerging4"/> + <algorithm type = "ProximityBasedMerging"> + <algorithm type = "TrackClusterAssociation"/> + </algorithm> + <algorithm type = "ConeBasedMerging"> + <algorithm type = "TrackClusterAssociation"/> + </algorithm> + <algorithm type = "MipPhotonSeparation"> + <algorithm type = "TrackClusterAssociation"/> + </algorithm> + <algorithm type = "SoftClusterMerging"> + <algorithm type = "TrackClusterAssociation"/> + </algorithm> + <algorithm type = "IsolatedHitMerging"/> + </associationAlgorithms> + </algorithm> + <algorithm type = "TrackClusterAssociation" description = "TrackClusterAssociation"></algorithm> + <UsingOrderedAlgorithms>true</UsingOrderedAlgorithms> + <ShouldUseForcedClustering>true</ShouldUseForcedClustering> + <algorithm type = "ForcedClustering" description = "ForcedClustering"/> + </algorithm> + + <algorithm type = "SplitMergedClusters" instance = "SplitMergedClusters1"> + <clusteringAlgorithms> + <algorithm type = "ConeClustering" instance = "Reclustering1"/> + <algorithm type = "ConeClustering" instance = "Reclustering2"/> + <algorithm type = "ConeClustering" instance = "Reclustering3"/> + <algorithm type = "ConeClustering" instance = "Reclustering4"/> + <algorithm type = "ConeClustering" instance = "Reclustering5"/> + <algorithm type = "ConeClustering" instance = "Reclustering6"/> + <algorithm type = "ConeClustering" instance = "Reclustering7"/> + <algorithm type = "ConeClustering" instance = "Reclustering8"/> + <algorithm type = "ConeClustering" instance = "Reclustering9"/> + <algorithm type = "ConeClustering" instance = "Reclustering10"/> + <algorithm type = "ConeClustering" instance = "Reclustering11"/> + <algorithm type = "ConeClustering" instance = "Reclustering12"/> + </clusteringAlgorithms> + <algorithm type = "TopologicalAssociationParent" description = "ClusterAssociation" instance = "reclusterAssociation"></algorithm> + <algorithm type = "TrackClusterAssociation" description = "TrackClusterAssociation"></algorithm> + <UsingOrderedAlgorithms>true</UsingOrderedAlgorithms> + <ShouldUseForcedClustering>true</ShouldUseForcedClustering> + <algorithm type = "ForcedClustering" description = "ForcedClustering"/> + </algorithm> + + <algorithm type = "TrackDrivenMerging"> + <algorithm type = "TrackClusterAssociation" description = "TrackClusterAssociation"></algorithm> + </algorithm> + + <algorithm type = "ResolveTrackAssociations"> + <clusteringAlgorithms> + <algorithm type = "ConeClustering" instance = "Reclustering1"/> + <algorithm type = "ConeClustering" instance = "Reclustering2"/> + <algorithm type = "ConeClustering" instance = "Reclustering3"/> + <algorithm type = "ConeClustering" instance = "Reclustering4"/> + <algorithm type = "ConeClustering" instance = "Reclustering5"/> + <algorithm type = "ConeClustering" instance = "Reclustering6"/> + <algorithm type = "ConeClustering" instance = "Reclustering7"/> + <algorithm type = "ConeClustering" instance = "Reclustering8"/> + <algorithm type = "ConeClustering" instance = "Reclustering9"/> + <algorithm type = "ConeClustering" instance = "Reclustering10"/> + <algorithm type = "ConeClustering" instance = "Reclustering11"/> + <algorithm type = "ConeClustering" instance = "Reclustering12"/> + </clusteringAlgorithms> + <algorithm type = "TopologicalAssociationParent" description = "ClusterAssociation" instance = "reclusterAssociation"></algorithm> + <algorithm type = "TrackClusterAssociation" description = "TrackClusterAssociation"></algorithm> + <UsingOrderedAlgorithms>true</UsingOrderedAlgorithms> + <ShouldUseForcedClustering>true</ShouldUseForcedClustering> + <algorithm type = "ForcedClustering" description = "ForcedClustering"/> + </algorithm> + + <algorithm type = "SplitTrackAssociations" instance = "SplitTrackAssociations1"/> + <algorithm type = "SplitMergedClusters" instance = "SplitMergedClusters1"/> + + <algorithm type = "TrackDrivenAssociation"> + <clusteringAlgorithms> + <algorithm type = "ConeClustering" instance = "Reclustering1"/> + <algorithm type = "ConeClustering" instance = "Reclustering2"/> + <algorithm type = "ConeClustering" instance = "Reclustering3"/> + <algorithm type = "ConeClustering" instance = "Reclustering4"/> + <algorithm type = "ConeClustering" instance = "Reclustering5"/> + <algorithm type = "ConeClustering" instance = "Reclustering6"/> + <algorithm type = "ConeClustering" instance = "Reclustering7"/> + <algorithm type = "ConeClustering" instance = "Reclustering8"/> + <algorithm type = "ConeClustering" instance = "Reclustering9"/> + <algorithm type = "ConeClustering" instance = "Reclustering10"/> + <algorithm type = "ConeClustering" instance = "Reclustering11"/> + <algorithm type = "ConeClustering" instance = "Reclustering12"/> + </clusteringAlgorithms> + <algorithm type = "TopologicalAssociationParent" description = "ClusterAssociation" instance = "reclusterAssociation"></algorithm> + <algorithm type = "TrackClusterAssociation" description = "TrackClusterAssociation"></algorithm> + <UsingOrderedAlgorithms>true</UsingOrderedAlgorithms> + </algorithm> + + <algorithm type = "SplitTrackAssociations" instance = "SplitTrackAssociations1"/> + <algorithm type = "SplitMergedClusters" instance = "SplitMergedClusters1"/> + + <algorithm type = "ExitingTrack"> + <clusteringAlgorithms> + <algorithm type = "ConeClustering" instance = "Reclustering1"/> + <algorithm type = "ConeClustering" instance = "Reclustering2"/> + <algorithm type = "ConeClustering" instance = "Reclustering3"/> + <algorithm type = "ConeClustering" instance = "Reclustering4"/> + <algorithm type = "ConeClustering" instance = "Reclustering5"/> + <algorithm type = "ConeClustering" instance = "Reclustering6"/> + <algorithm type = "ConeClustering" instance = "Reclustering7"/> + <algorithm type = "ConeClustering" instance = "Reclustering8"/> + <algorithm type = "ConeClustering" instance = "Reclustering9"/> + <algorithm type = "ConeClustering" instance = "Reclustering10"/> + <algorithm type = "ConeClustering" instance = "Reclustering11"/> + <algorithm type = "ConeClustering" instance = "Reclustering12"/> + </clusteringAlgorithms> + <algorithm type = "TopologicalAssociationParent" description = "ClusterAssociation" instance = "reclusterAssociation"></algorithm> + <algorithm type = "TrackClusterAssociation" description = "TrackClusterAssociation"></algorithm> + <UsingOrderedAlgorithms>true</UsingOrderedAlgorithms> + <ShouldUseForcedClustering>true</ShouldUseForcedClustering> + <algorithm type = "ForcedClustering" description = "ForcedClustering"/> + </algorithm> + + <!-- Muon clustering --> + <algorithm type = "ClusteringParent"> + <algorithm type = "ConeClustering" description = "ClusterFormation"> + <TanConeAngleCoarse>0.75</TanConeAngleCoarse> + <AdditionalPadWidthsCoarse>12.5</AdditionalPadWidthsCoarse> + <SameLayerPadWidthsCoarse>14</SameLayerPadWidthsCoarse> + <ShouldUseTrackSeed>false</ShouldUseTrackSeed> + <MaxClusterDirProjection>1000</MaxClusterDirProjection> + <MaxTrackSeedSeparation>0</MaxTrackSeedSeparation> + <MaxLayersToTrackSeed>0</MaxLayersToTrackSeed> + <MaxLayersToTrackLikeHit>0</MaxLayersToTrackLikeHit> + <TrackPathWidth>0</TrackPathWidth> + </algorithm> + <InputCaloHitListName>MuonRemovedYokeHits</InputCaloHitListName> + <RestoreOriginalCaloHitList>true</RestoreOriginalCaloHitList> + <ClusterListName>MuonRemovedYokeClusters</ClusterListName> + <ReplaceCurrentClusterList>false</ReplaceCurrentClusterList> + </algorithm> + + <algorithm type = "MuonClusterAssociation"> + <TargetClusterListName>PrimaryClusters</TargetClusterListName> + <MuonClusterListName>MuonRemovedYokeClusters</MuonClusterListName> + </algorithm> + + <!-- Photon recovery --> + <algorithm type = "PhotonRecovery"> + <algorithm type = "TrackClusterAssociation"/> + </algorithm> + + <algorithm type = "MuonPhotonSeparation"> + <algorithm type = "TrackClusterAssociation"/> + </algorithm> + + <!-- Prepare particle flow objects --> + <algorithm type = "TrackPreparation"> + <CandidateListNames>Input</CandidateListNames> + <MergedCandidateListName>PfoCandidates</MergedCandidateListName> + <PfoTrackListName>PfoCreation</PfoTrackListName> + <trackClusterAssociationAlgorithms> + <algorithm type = "TrackClusterAssociation"/> + <algorithm type = "LoopingTrackAssociation"/> + <algorithm type = "TrackRecovery"/> + <algorithm type = "TrackRecoveryHelix"/> + <algorithm type = "TrackRecoveryInteractions"/> + </trackClusterAssociationAlgorithms> + </algorithm> + + <algorithm type = "MainFragmentRemoval"/> + <algorithm type = "NeutralFragmentRemoval"/> + <algorithm type = "PhotonFragmentRemoval"/> + + <algorithm type = "ClusterPreparation"> + <CandidateListNames>PrimaryClusters PhotonClusters</CandidateListNames> + <MergedCandidateListName>PfoCreation</MergedCandidateListName> + </algorithm> + + <algorithm type = "PhotonSplitting"/> + <algorithm type = "PhotonFragmentMerging"/> + + <!-- Create particle flow objects --> + <algorithm type = "ForceSplitTrackAssociations"/> + <algorithm type = "PfoCreation"> + <OutputPfoListName>PrimaryAndPhotonPfos</OutputPfoListName> + </algorithm> + + <algorithm type = "PfoPreparation"> + <CandidateListNames>PrimaryAndPhotonPfos MuonPfos</CandidateListNames> + <MergedCandidateListName>OutputPfos</MergedCandidateListName> + </algorithm> + + <!-- Particle flow object modification algorithms --> + <algorithm type = "FinalParticleId"/> + <algorithm type = "V0PfoCreation"/> + <!--algorithm type = "DumpPfosMonitoring"/--> + <!--algorithm type = "VisualMonitoring"/--> +</pandora>