diff --git a/analysis/common/analysis_tree_converter/CbmPsdModulesConverter.cxx b/analysis/common/analysis_tree_converter/CbmPsdModulesConverter.cxx index 10240fff5ce4706de270f2e8ab79244bc837581a..14db617c5af04f46bbbb6ac7a6cebc18ff5c6cc5 100644 --- a/analysis/common/analysis_tree_converter/CbmPsdModulesConverter.cxx +++ b/analysis/common/analysis_tree_converter/CbmPsdModulesConverter.cxx @@ -40,7 +40,6 @@ void CbmPsdModulesConverter::ProcessData(CbmEvent* event) psd_modules_->ClearChannels(); CbmPsdHit* hit {nullptr}; - Float_t psd_energy {0.}; auto* data_header = AnalysisTree::TaskManager::GetInstance()->GetDataHeader(); auto* config = AnalysisTree::TaskManager::GetInstance()->GetConfig(); @@ -66,7 +65,6 @@ void CbmPsdModulesConverter::ProcessData(CbmEvent* event) auto& module = psd_modules_->Channel(hit->GetModuleID() - 1); module.SetNumber(i + 1); module.SetSignal(hit->GetEdep()); - psd_energy += hit->GetEdep(); } } diff --git a/analysis/common/analysis_tree_converter/CbmRecEventHeaderConverter.cxx b/analysis/common/analysis_tree_converter/CbmRecEventHeaderConverter.cxx index ffa8efd019498e87e006900a4acbeaaab89a6035..496c6229753216d3efc32ed8dccc6814aede1c68 100644 --- a/analysis/common/analysis_tree_converter/CbmRecEventHeaderConverter.cxx +++ b/analysis/common/analysis_tree_converter/CbmRecEventHeaderConverter.cxx @@ -54,9 +54,6 @@ void CbmRecEventHeaderConverter::Init() void CbmRecEventHeaderConverter::ProcessData(CbmEvent* event) { - auto* out_config_ = AnalysisTree::TaskManager::GetInstance()->GetConfig(); - const auto& branch = out_config_->GetBranchConfig(out_branch_); - if (event) { cbm_prim_vertex_ = event->GetVertex(); } if (!cbm_prim_vertex_) { throw std::runtime_error("No fPrimVtx"); } diff --git a/analysis/common/analysis_tree_converter/CbmSimEventHeaderConverter.cxx b/analysis/common/analysis_tree_converter/CbmSimEventHeaderConverter.cxx index a244b01467e9d1473686303717e3b296c901f5f3..9e704094fe9fdf1beddadd7d4bc095dfb6abd38e 100644 --- a/analysis/common/analysis_tree_converter/CbmSimEventHeaderConverter.cxx +++ b/analysis/common/analysis_tree_converter/CbmSimEventHeaderConverter.cxx @@ -69,8 +69,6 @@ void CbmSimEventHeaderConverter::ProcessData(CbmEvent* event) LOG(info) << "MCEvent " << cbm_header->GetEventID() << " " << cbm_header->GetT(); if (!cbm_header) { throw std::runtime_error("CbmSimEventHeaderConverter::Exec - ERROR! No fHeader!"); } - auto* out_config_ = AnalysisTree::TaskManager::GetInstance()->GetConfig(); - const auto& branch = out_config_->GetBranchConfig(out_branch_); TVector3 pos {cbm_header->GetX(), cbm_header->GetY(), cbm_header->GetZ()}; sim_event_header_->SetVertexPosition3(pos); diff --git a/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx b/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx index 6632f83b52586ed4911289d1a07cca2b44d0a69f..d91e3babe73dc85949dc7b3e5caa4b9e0f6fd960 100644 --- a/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx +++ b/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx @@ -10,18 +10,20 @@ void ATKFParticleFinder::InitInput(const std::string& file_name, const std::stri { std::cout << "ATKFParticleFinder::InitInput()\n"; - // topo_reconstructor_ = new KFParticleTopoReconstructor; - // topo_reconstructor_->Clear(); + in_chain_ = new AnalysisTree::Chain(file_name.c_str(), tree_name.c_str()); - in_file_ = TFile::Open(file_name.c_str(), "read"); - config_ = (AnalysisTree::Configuration*) in_file_->Get("Configuration"); - - in_chain_ = new TChain(tree_name.c_str()); - in_chain_->Add(file_name.c_str()); - in_chain_->SetBranchAddress("VtxTracks", &kf_tracks_); - in_chain_->SetBranchAddress("RecEventHeader", &rec_event_header_); + if (in_chain_->CheckBranchExistence("VtxTracks") == 1) { in_chain_->SetBranchAddress("VtxTracks", &kf_tracks_); } + else if (in_chain_->CheckBranchExistence("VtxTracks") == 2) { + in_chain_->SetBranchAddress("VtxTracks.", &kf_tracks_); + } + if (in_chain_->CheckBranchExistence("RecEventHeader") == 1) { + in_chain_->SetBranchAddress("RecEventHeader", &rec_event_header_); + } + else if (in_chain_->CheckBranchExistence("RecEventHeader") == 2) { + in_chain_->SetBranchAddress("RecEventHeader.", &rec_event_header_); + } - auto branch_conf_kftr = config_->GetBranchConfig("VtxTracks"); + auto branch_conf_kftr = in_chain_->GetConfiguration()->GetBranchConfig("VtxTracks"); q_field_id_ = branch_conf_kftr.GetFieldId("q"); par_field_id_ = branch_conf_kftr.GetFieldId("x"); // par0 @@ -33,6 +35,14 @@ void ATKFParticleFinder::InitInput(const std::string& file_name, const std::stri nhits_field_id_ = branch_conf_kftr.GetFieldId("nhits"); nhits_mvd_field_id_ = branch_conf_kftr.GetFieldId("nhits_mvd"); vtx_chi2_field_id_ = branch_conf_kftr.GetFieldId("vtx_chi2"); + + topo_reconstructor_ = new KFParticleTopoReconstructor; + // cuts setting + topo_reconstructor_->GetKFParticleFinder()->SetChiPrimaryCut2D(cuts_.GetCutChi2Prim()); + topo_reconstructor_->GetKFParticleFinder()->SetMaxDistanceBetweenParticlesCut(cuts_.GetCutDistance()); + topo_reconstructor_->GetKFParticleFinder()->SetChi2Cut2D(cuts_.GetCutChi2Geo()); + topo_reconstructor_->GetKFParticleFinder()->SetLCut(cuts_.GetCutLDown()); + topo_reconstructor_->GetKFParticleFinder()->SetLdLCut2D(cuts_.GetCutLdL()); } void ATKFParticleFinder::InitOutput(const std::string& file_name) @@ -51,6 +61,7 @@ void ATKFParticleFinder::InitOutput(const std::string& file_name) out_tree_ = new TTree("aTree", "AnalysisTree ParticlesReco"); out_tree_->Branch("ParticlesReconstructed", "AnalysisTree::Particles", &particles_reco_); + out_tree_->SetAutoSave(0); out_config_.Write("Configuration"); daughter1_id_field_id_ = out_config_.GetBranchConfig(particles_reco_->GetId()).GetFieldId("daughter1id"); @@ -61,6 +72,7 @@ void ATKFParticleFinder::Finish() { std::cout << "ATKFParticleFinder::Finish()\n"; + delete topo_reconstructor_; out_tree_->Write(); out_file_->Close(); } @@ -74,35 +86,30 @@ void ATKFParticleFinder::Run(int n_events) for (int i_event = 0; i_event < n_events; i_event++) { std::cout << "eveNo = " << i_event << "\n"; in_chain_->GetEntry(i_event); - KFParticleTopoReconstructor* eventTopoReconstructor = CreateTopoReconstructor(); + InitTopoReconstructor(); // const KFPTrackVector* tv = eventTopoReconstructor->GetTracks(); // KFPTrackVector tvv = *tv; // tvv.Print(); - eventTopoReconstructor->SortTracks(); - eventTopoReconstructor->ReconstructParticles(); + topo_reconstructor_->SortTracks(); + topo_reconstructor_->ReconstructParticles(); - WriteCandidates(eventTopoReconstructor); + WriteCandidates(topo_reconstructor_); } Finish(); } -KFParticleTopoReconstructor* ATKFParticleFinder::CreateTopoReconstructor() +void ATKFParticleFinder::InitTopoReconstructor() { // - // Creates the pointer on the KFParticleTopoReconstructor object - // with all necessary input information in order to perform particle selection using + // Initializes KFParticleTopoReconstructor + // with all necessary input information (tracks and PV) of the current events + // in order to perform particle selection using // non-simplified "standard" KFParticle algorithm. // - auto* TR = new KFParticleTopoReconstructor; - // cuts setting - TR->GetKFParticleFinder()->SetChiPrimaryCut2D(cuts_.GetCutChi2Prim()); - TR->GetKFParticleFinder()->SetMaxDistanceBetweenParticlesCut(cuts_.GetCutDistance()); - TR->GetKFParticleFinder()->SetChi2Cut2D(cuts_.GetCutChi2Geo()); - TR->GetKFParticleFinder()->SetLCut(cuts_.GetCutLDown()); - TR->GetKFParticleFinder()->SetLdLCut2D(cuts_.GetCutLdL()); + topo_reconstructor_->Clear(); int n_good_tracks = 0; @@ -145,7 +152,7 @@ KFParticleTopoReconstructor* ATKFParticleFinder::CreateTopoReconstructor() track_vector1.SetId(rec_track.GetId(), j_track); j_track++; } - TR->Init(track_vector1, track_vector2); + topo_reconstructor_->Init(track_vector1, track_vector2); KFPVertex primVtx_tmp; primVtx_tmp.SetXYZ(rec_event_header_->GetVertexX(), rec_event_header_->GetVertexY(), rec_event_header_->GetVertexZ()); @@ -154,11 +161,11 @@ KFParticleTopoReconstructor* ATKFParticleFinder::CreateTopoReconstructor() primVtx_tmp.SetChi2(-100); std::vector<int> pvTrackIds; KFVertex pv(primVtx_tmp); - TR->AddPV(pv, pvTrackIds); + topo_reconstructor_->AddPV(pv, pvTrackIds); std::cout << track_vector1.Size() << "\n"; - return TR; + // return TR; } void ATKFParticleFinder::WriteCandidates(const KFParticleTopoReconstructor* eventTR) @@ -176,8 +183,6 @@ void ATKFParticleFinder::WriteCandidates(const KFParticleTopoReconstructor* even particlerec->SetField(particle.DaughterIds()[1], daughter2_id_field_id_); particlerec->SetMomentum(particle.GetPx(), particle.GetPy(), particle.GetPz()); particlerec->SetPid(particle.GetPDG()); - - // topo_reconstructor_->AddParticle(particle); } out_tree_->Fill(); } diff --git a/analysis/common/at_kfpf_interface/ATKFParticleFinder.h b/analysis/common/at_kfpf_interface/ATKFParticleFinder.h index 9521a33ebb1f9cb840ac58b93bd232842bc741d2..697aa727e957c8612ee9ae55c0a19a0740e027d3 100644 --- a/analysis/common/at_kfpf_interface/ATKFParticleFinder.h +++ b/analysis/common/at_kfpf_interface/ATKFParticleFinder.h @@ -5,13 +5,13 @@ #ifndef ATKFParticleFinder_HH #define ATKFParticleFinder_HH -#include "TChain.h" #include "TFile.h" #include "TTree.h" #include <string> #include <utility> +#include "AnalysisTree/Chain.hpp" #include "AnalysisTree/Configuration.hpp" #include "AnalysisTree/Detector.hpp" #include "AnalysisTree/EventHeader.hpp" @@ -31,13 +31,11 @@ public: void Run(int n_events = -1); private: - KFParticleTopoReconstructor* CreateTopoReconstructor(); + void InitTopoReconstructor(); std::string in_file_name_; std::string in_tree_name_; - TFile* in_file_ {nullptr}; - TChain* in_chain_ {nullptr}; - AnalysisTree::Configuration* config_ {nullptr}; + AnalysisTree::Chain* in_chain_ {nullptr}; AnalysisTree::EventHeader* rec_event_header_ {nullptr}; AnalysisTree::TrackDetector* kf_tracks_ {nullptr}; @@ -60,7 +58,7 @@ private: int daughter2_id_field_id_ {-999}; CutsContainer cuts_; - // KFParticleTopoReconstructor* topo_reconstructor_{nullptr}; + KFParticleTopoReconstructor* topo_reconstructor_ {nullptr}; std::vector<float> GetCovMatrixCbm(const AnalysisTree::Track& track) const; diff --git a/analysis/common/at_kfpf_interface/CMakeLists.txt b/analysis/common/at_kfpf_interface/CMakeLists.txt index 8aef1fdf8f12fa645b086136d54188c22517b80f..d0cf3fedafa1f620cf75b2a5be6f6866f887703a 100644 --- a/analysis/common/at_kfpf_interface/CMakeLists.txt +++ b/analysis/common/at_kfpf_interface/CMakeLists.txt @@ -23,6 +23,7 @@ set(LIBRARY_NAME AnalysisTreeKfpfInterface) set(LINKDEF ${LIBRARY_NAME}LinkDef.h) set(PUBLIC_DEPENDENCIES AnalysisTreeBase + AnalysisTreeInfra ) set(PRIVATE_DEPENDENCIES diff --git a/external/AnalysisTree.patch b/external/AnalysisTree.patch index 0b79724ec96a06f3d3a25794b25c82db5e8c30cc..3aa04a714d226dc31a7fad8cefb31c0e81123dd6 100644 --- a/external/AnalysisTree.patch +++ b/external/AnalysisTree.patch @@ -1,5 +1,5 @@ diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt -index ab4c300..765e1db 100644 +index 789179c..6d4d73c 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -16,7 +16,28 @@ string(REPLACE ".cpp" ".hpp" HEADERS "${SOURCES}") @@ -31,34 +31,12 @@ index ab4c300..765e1db 100644 + target_link_libraries(AnalysisTreeBase ${ROOT_LIBRARIES} EG) - add_custom_command(TARGET AnalysisTreeBase PRE_BUILD -diff --git a/core/Constants.hpp b/core/Constants.hpp -index ed7b9c6..f9cbcc3 100644 ---- a/core/Constants.hpp -+++ b/core/Constants.hpp -@@ -109,4 +109,4 @@ enum EventHeaderFields : ShortInt_t { - - }// namespace AnalysisTree - --#endif -\ No newline at end of file -+#endif -diff --git a/core/Module.hpp b/core/Module.hpp -index 9c523aa..c54d17e 100644 ---- a/core/Module.hpp -+++ b/core/Module.hpp -@@ -93,4 +93,4 @@ class ModulePosition : public IndexedObject { - }; - }// namespace AnalysisTree - --#endif -\ No newline at end of file -+#endif + add_custom_target(AnalysisTreeBaseCopyHeaders ALL diff --git a/infra/CMakeLists.txt b/infra/CMakeLists.txt -index ed7bd9b..a63a7b1 100644 +index af1d392..97dcb15 100644 --- a/infra/CMakeLists.txt +++ b/infra/CMakeLists.txt -@@ -30,12 +30,34 @@ add_library(AnalysisTreeInfra SHARED ${SOURCES} G__AnalysisTreeInfra.cxx) +@@ -26,12 +26,34 @@ add_library(AnalysisTreeInfra SHARED ${SOURCES} G__AnalysisTreeInfra.cxx) target_compile_definitions(AnalysisTreeInfra PUBLIC $<$<BOOL:${Boost_FOUND}>:ANALYSISTREE_BOOST_FOUND>) @@ -98,15 +76,4 @@ index ed7bd9b..a63a7b1 100644 +endif() target_link_libraries(AnalysisTreeInfra PUBLIC - ${ROOT_LIBRARIES} -diff --git a/infra/SimpleCut.hpp b/infra/SimpleCut.hpp -index 4ec5458..21fe68c 100644 ---- a/infra/SimpleCut.hpp -+++ b/infra/SimpleCut.hpp -@@ -116,4 +116,4 @@ SimpleCut RangeCut(const std::string& variable_name, float lo, float hi, const s - SimpleCut EqualsCut(const std::string& variable_name, int value, const std::string& title = ""); - - }// namespace AnalysisTree --#endif//ANALYSISTREE_SIMPLECUT_H -\ No newline at end of file -+#endif//ANALYSISTREE_SIMPLECUT_H + AnalysisTreeBase diff --git a/external/AnalysisTreeQA.patch b/external/AnalysisTreeQA.patch index eda48c5c76daaf5b3fdaf238393428f9747befcd..c353b872a9befff3893858b92e8f9340ea7bf01e 100644 --- a/external/AnalysisTreeQA.patch +++ b/external/AnalysisTreeQA.patch @@ -1,8 +1,8 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index ee90134..0861bc8 100644 +index 61b9059..3cdaba1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -20,11 +20,35 @@ endif () +@@ -20,12 +20,33 @@ endif () #add_dependencies(AnalysisTreeQA ${PROJECT_DEPENDENCIES}) @@ -10,6 +10,7 @@ index ee90134..0861bc8 100644 - ${HEADERS} - LINKDEF AnalysisTreeQALinkDef.h - OPTIONS -I${CMAKE_BINARY_DIR}/include +- OPTIONS -I${AnalysisTree_BINARY_DIR}/include - ) +if(${ROOT_VERSION} VERSION_GREATER 6.18.0) + message(STATUS "ROOT ${ROOT_VERSION}, use the standard ROOT_GENERATE_DICTIONARY macro.") @@ -17,6 +18,7 @@ index ee90134..0861bc8 100644 + ${HEADERS} + LINKDEF AnalysisTreeQALinkDef.h + OPTIONS -I${CMAKE_BINARY_DIR}/include ++ OPTIONS -I${AnalysisTree_BINARY_DIR}/include + ) +else() + message(STATUS "ROOT ${ROOT_VERSION} has a broken ROOT_GENERATE_DICTIONARY macro, so build the dictionary ourself.") @@ -37,9 +39,6 @@ index ee90134..0861bc8 100644 + DEPENDS ${dictionary_includes} ${dictionary_linkdef} + ) +endif() -+ -+ -+ target_link_libraries(AnalysisTreeQA PUBLIC AnalysisTreeBase diff --git a/external/InstallAnalysisTree.cmake b/external/InstallAnalysisTree.cmake index 171f420b80d7e106291f12d22f83cee360ed9031..8f232b3bd31bdda1b76c5b00a33634a02609827e 100644 --- a/external/InstallAnalysisTree.cmake +++ b/external/InstallAnalysisTree.cmake @@ -1,4 +1,4 @@ -set(ANALYSISTREE_VERSION c338c2b7b47cf47c0d6f2a53871374d2c416bb8a) #v2.2.6 +set(ANALYSISTREE_VERSION d4bcf4f2f2aa502a66e698d17fbb4af91787714e) #v2.3.0 set(ANALYSISTREE_SRC_URL "https://github.com/HeavyIonAnalysis/AnalysisTree.git") set(ANALYSISTREE_DESTDIR "${CMAKE_BINARY_DIR}/external/ANALYSISTREE-prefix") diff --git a/external/InstallAnalysisTreeQA.cmake b/external/InstallAnalysisTreeQA.cmake index 059aa6e35ce4c6d4013bc7ccc43a646c12f118f1..c4d16078e4c6005088c31a47831744c7ac4983c4 100644 --- a/external/InstallAnalysisTreeQA.cmake +++ b/external/InstallAnalysisTreeQA.cmake @@ -1,4 +1,4 @@ -set(ANALYSISTREEQA_VERSION e3feeef9c50303a6f17a271ff0bcf1cd62b48a4e) #v2.1.0 +set(ANALYSISTREEQA_VERSION 582bdbff72c8ea05bf26bdceb92c767bd641ed47) #v2.1.1 set(ANALYSISTREEQA_SRC_URL "https://github.com/HeavyIonAnalysis/AnalysisTreeQA.git") set(ANALYSISTREEQA_DESTDIR "${CMAKE_BINARY_DIR}/external/ANALYSISTREEQA-prefix")