diff --git a/analysis/CMakeLists.txt b/analysis/CMakeLists.txt index fa199975cef55f68bea25c02f15d123bf2152b13..fd38d028ee22ac32e55497953027690f4900d935 100644 --- a/analysis/CMakeLists.txt +++ b/analysis/CMakeLists.txt @@ -5,7 +5,7 @@ add_subdirectory (PWGDIL/dielectron/pi0eta) add_subdirectory (PWGDIL/dielectron/lmvm) add_subdirectory (PWGDIL/dimuon) -add_subdirectory (PWGC2F/femtoscopy/nicafemto) +add_subdirectory (PWGC2F/femtoscopy/hal) add_subdirectory (PWGCHA/jpsi) diff --git a/analysis/PWGC2F/femtoscopy/hal/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/hal/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..abfabf4c395fced91229672b6979b381e75ee8a0 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/CMakeLists.txt @@ -0,0 +1,46 @@ + +set(HAL_CBM + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set(HAL_DIR ${CBMROOT_SOURCE_DIR}/external/) +set(KF_HEADERS + ${CBMROOT_SOURCE_DIR}/L1 + ${CBMROOT_SOURCE_DIR}/L1/L1Algo + ${CBMROOT_SOURCE_DIR}/L1/ParticleFinder + ${CLHEP_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} + ${VC_INCLUDE_DIRS} + ${KFParticle_INCLUDE_DIR} + ${CBMROOT_SOURCE_DIR}/KF + ${CBMROOT_SOURCE_DIR}/KF/Interface + ${CBMROOT_SOURCE_DIR}/external/KFParticle/KFParticle +) +set(HAL_CBM_FORMAT + ${CBMBASE_DIR} + ${CBMDATA_DIR} + ${CBMDATA_DIR}/global + ${CBMDATA_DIR}/sts + ${CBMDATA_DIR}/tof + ${CBMDATA_DIR}/trd + ${CBMDATA_DIR}/rich + ${CBMDATA_DIR}/much + ${CBMDATA_DIR}/mvd + ${HAL_CBM}/format + ${HAL_CBM}/format/combined + ${HAL_CBM}/format/anatree + ${HAL_CBM}/format/anatree/reco + ${HAL_CBM}/format/anatree/mc + ${HAL_CBM}/format/anatree/femto + ${HAL_CBM}/format/unigen +) + +set(HAL_CBM_CUTS + ${HAL_CBM}/cuts/pair + ${HAL_CBM}/cuts/track +) +#set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1) +add_subdirectory(format) +add_subdirectory(cuts) +add_subdirectory(helpers) +add_subdirectory(qa) diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/README.md b/analysis/PWGC2F/femtoscopy/hal/README.md similarity index 100% rename from analysis/PWGC2F/femtoscopy/nicafemto/README.md rename to analysis/PWGC2F/femtoscopy/hal/README.md diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/hal/cuts/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdec986157a0f2ac755847eff4478d438405f03b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/CMakeLists.txt @@ -0,0 +1,54 @@ +# Create a library called "" which includes the source files given in +# the array . +# The extension is already found. Any number of sources could be listed here. +Set(INCLUDE_DIRECTORIES +${BASE_INCLUDE_DIRECTORIES} +${CMAKE_SOURCE_FAIRMCSTACK} +${KF_HEADERS} +${HAL_CBM}/helpers +${HAL_CBM}/format +${HAL_CBM}/cuts +${HAL_CBM}/cuts/pair +${HAL_CBM}/cuts/track +${Hal_INCLUDE_DIR} +${HAL_CBM_FORMAT} +) + +Set(SYSTEM_INCLUDE_DIRECTORIES + ${ROOT_INCLUDE_DIR} + ${CLHEP_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} +) + +Include_Directories(${INCLUDE_DIRECTORIES}) +Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES}) + +# List of source files +set(SRCS + pair/HalCbmBasicFemtoPairCut.cxx + pair/HalCbmDeltaPhiDeltaThetaCut.cxx + pair/HalCbmStsSepCut.cxx + pair/HalCbmPairSeparationCut2D.cxx + pair/HalCbmPairCut.cxx + pair/HalCbmDeltaPhiDeltaThetaStarMinCut.cxx + + track/HalCbmBasicTrackCuts.cxx + track/HalCbmNHitsCut.cxx + track/HalCbmTofCut.cxx + track/HalCbmTofM2PolyCut.cxx +) + +Set(HEADERS ) +Set(LINKDEF HalCbmCutsLinkDef.h) +Set(LIBRARY_NAME HalCbmCuts) +Set(PUBLIC_DEPENDENCIES + HalFeatures + HalData + HalCut + CbmData + HalCbmFormat +) + +generate_cbm_library() + +add_dependencies(G__HalCbmCuts ANALYSISTREE HAL) diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/HalCbmCutsLinkDef.h b/analysis/PWGC2F/femtoscopy/hal/cuts/HalCbmCutsLinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..23b6a916a33f7c0528f87ba4be39a508cb82348a --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/HalCbmCutsLinkDef.h @@ -0,0 +1,23 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + + +#pragma link C++ class HalCbmTofM2PolyCut + ; +#pragma link C++ class HalCbmStsExitSepCut + ; +#pragma link C++ class HalCbmDeltaPhiDeltaThetaStarCut + ; +#pragma link C++ class HalCbmDeltaPhiDeltaThetaCut + ; +#pragma link C++ class HalCbmPairCut + ; +#pragma link C++ class HalCbmPairSeparationCut2D + ; +#pragma link C++ class HalCbmDeltaPhiDeltaThetaStarMinCut + ; +#pragma link C++ class HalCbmStsEntranceSepCut + ; +#pragma link C++ class HalCbmDeltaPhiDeltaThetaStarCutLayers + ; +#pragma link C++ class HalCbmStsSeparationCutLayers + ; + +#pragma link C++ class HalCbmBasicTrackCuts + ; +#pragma link C++ class HalCbmNHitsCut + ; +#pragma link C++ class HalCbmTofCut + ; +#pragma link C++ class HalCbmBasicFemtoPairCut + ; diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmBasicFemtoPairCut.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmBasicFemtoPairCut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..efc53163f92d7e58f4753ee4045345b6c9bf5726 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmBasicFemtoPairCut.cxx @@ -0,0 +1,77 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmBasicFemtoPairCut.h" + +#include "HalCbmDeltaPhiDeltaThetaCut.h" +#include "HalCbmStsSepCut.h" + +#include <iostream> + +#include <Hal/CutMonitorX.h> +#include <Hal/CutMonitorXY.h> + +HalCbmBasicFemtoPairCut::HalCbmBasicFemtoPairCut() + : fDeltaEtaAx("HalCbmDeltaPhiDeltaThetaStarCut", 1, 100, -0.1, 0.1) + , fDeltaPhiStarAx("HalCbmDeltaPhiDeltaThetaStarCut", 0, 100, -0.1, 0.1) + , fStsExitSepAx("HalCbmStsExitSepCut", 0, 100, 0, 10) +{ + AddCut(HalCbmStsExitSepCut()); + AddCut(HalCbmDeltaPhiDeltaThetaStarCut()); + SetSeparationMonitorAxis(100, 0, 10); + SetDeltaPhiStarAxis(100, -0.1, 0.1); + SetDeltaEtaStarAxis(100, -0.1, 0.1); +} + +void HalCbmBasicFemtoPairCut::SetDeltaPhiStarCut(Double_t min, Double_t max) +{ + GetDeltaPhiEtaStarCut()->SetMinMax(min, max, 0); +} + +void HalCbmBasicFemtoPairCut::SetDeltaEtaStarCut(Double_t min, Double_t max) +{ + GetDeltaPhiEtaStarCut()->SetMinMax(min, max, 1); +} + +void HalCbmBasicFemtoPairCut::SetR(Double_t R) { GetDeltaPhiEtaStarCut()->SetR(R); } + +void HalCbmBasicFemtoPairCut::SetStsExitSeparationCut(Double_t min, Double_t max) +{ + GetStsExitCut()->SetMinMax(min, max); +} +/* +void HalCbmBasicFemtoPairCut::CreateBasicMonitors() +{ + TString opt = ""; + Int_t step = 0; + TString params = GetGlobalCutOption(); + if (Hal::Std::FindParam(params, "re")) { opt = "re"; } + if (Hal::Std::FindParam(params, "im")) { + opt = "im"; + step = 1; + } + Hal::CutMonitorX exitM(GetStsExitCut()->CutName(opt), step); + exitM.SetXaxis(fStsExitSepAx.GetNBins(), fStsExitSepAx.GetMin(), fStsExitSepAx.GetMax()); + AddCutMonitor(exitM); + Hal::CutMonitorXY phiM(GetDeltaPhiEtaStarCut()->CutName(opt), 0 + step, GetDeltaPhiEtaStarCut()->CutName(opt), + 1 + step); + phiM.SetXaxis(fDeltaPhiStarAx.GetNBins(), fDeltaPhiStarAx.GetMin(), fDeltaPhiStarAx.GetMax()); + phiM.SetYaxis(fDeltaEtaAx.GetNBins(), fDeltaEtaAx.GetMin(), fDeltaEtaAx.GetMax()); + AddCutMonitor(phiM); +} +*/ +HalCbmBasicFemtoPairCut::~HalCbmBasicFemtoPairCut() {} + +void HalCbmBasicFemtoPairCut::AddAllCutMonitorRequests(Option_t* opt) +{ + TString option = opt; + std::cout << "ENABLED ALL" << std::endl; + if (Hal::Std::FindParam(option, "all")) { + std::cout << "ENABLED ALL" << std::endl; + AddCutMonitorRequest(fStsExitSepAx); + AddCutMonitorRequest(fDeltaPhiStarAx, fDeltaEtaAx); + return; + } + if (Hal::Std::FindParam(option, "exit")) AddCutMonitorRequest(fStsExitSepAx); + if (Hal::Std::FindParam(option, "phistar")) AddCutMonitorRequest(fDeltaPhiStarAx, fDeltaEtaAx); +} diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmBasicFemtoPairCut.h b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmBasicFemtoPairCut.h new file mode 100644 index 0000000000000000000000000000000000000000..7c58feba4cea74221ae53e01416d45b8e4773b10 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmBasicFemtoPairCut.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMBASICFEMTOPAIRCUT_H_ +#define CBMBASICFEMTOPAIRCUT_H_ + +#include <TVector3.h> + +#include <Hal/CutsAndMonitors.h> + +class HalCbmStsExitSepCut; +class HalCbmDeltaPhiDeltaThetaStarCut; + +class HalCbmBasicFemtoPairCut : public Hal::CutsAndMonitors { + Hal::CutMonAxisConf fDeltaEtaAx; + Hal::CutMonAxisConf fDeltaPhiStarAx; + Hal::CutMonAxisConf fStsExitSepAx; + HalCbmStsExitSepCut* GetStsExitCut() const { return (HalCbmStsExitSepCut*) CutAt(0); } + HalCbmDeltaPhiDeltaThetaStarCut* GetDeltaPhiEtaStarCut() const { return (HalCbmDeltaPhiDeltaThetaStarCut*) CutAt(1); } + + protected: + virtual void AddAllCutMonitorRequests(Option_t* opt); + + public: + HalCbmBasicFemtoPairCut(); + void SetSeparationMonitorAxis(Int_t nbins, Double_t min, Double_t max) { fStsExitSepAx.SetAxis(nbins, min, max); } + void SetDeltaPhiStarAxis(Int_t bin, Double_t min, Double_t max) { fDeltaPhiStarAx.SetAxis(bin, min, max); } + void SetDeltaEtaStarAxis(Int_t bin, Double_t min, Double_t max) { fDeltaEtaAx.SetAxis(bin, min, max); } + void SetDeltaPhiStarCut(Double_t min, Double_t max); + void SetDeltaEtaStarCut(Double_t min, Double_t max); + void SetR(Double_t R); + void SetStsExitSeparationCut(Double_t min, Double_t max); + virtual ~HalCbmBasicFemtoPairCut(); + ClassDef(HalCbmBasicFemtoPairCut, 1) +}; + +#endif /* CBMBASICFEMTOPAIRCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaCut.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaCut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..960e1fc93dcb0341a70b31253dee4dd5706b69b4 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaCut.cxx @@ -0,0 +1,212 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmDeltaPhiDeltaThetaCut.h" + +#include "CbmHelix.h" +#include "HalCbmHbtTrack.h" +#include "HalCbmTrack.h" + +#include <TLorentzVector.h> +#include <TVector3.h> + +#include <Hal/Cut.h> +#include <Hal/Event.h> +#include <Hal/Package.h> +#include <Hal/Parameter.h> +#include <Hal/Std.h> +#include <Hal/Track.h> +#include <Hal/TwoTrack.h> + +HalCbmDeltaPhiDeltaThetaStarCut::HalCbmDeltaPhiDeltaThetaStarCut() : HalCbmPairCut(2), fR(0.0) +{ + SetUnitName("#Delta#phi^{*} [rad]", 0); + SetUnitName("#Delta#eta^{*} []", 1); +} + +Bool_t HalCbmDeltaPhiDeltaThetaStarCut::PassHbt(Hal::TwoTrack* pair) +{ + TVector3 mom1, mom2; + HalCbmHbtTrack* tr1 = static_cast<HalCbmHbtTrack*>(pair->GetTrack1()); + HalCbmHbtTrack* tr2 = static_cast<HalCbmHbtTrack*>(pair->GetTrack2()); + tr1->CalculateAtR(fR); + tr2->CalculateAtR(fR); + mom1 = tr1->GetMomAtCustom(); + mom2 = tr2->GetMomAtCustom(); + SetValue(mom1.Phi() - mom2.Phi(), 0); //dleta phi + SetValue(mom1.Theta() - mom2.Theta(), 1); + if (GetValue(0) > GetMin(0) && GetValue(0) < GetMax(0) && GetValue(1) > GetMin(1) && GetValue(1) < GetMax(1)) { + return ForcedUpdate(kFALSE); + } + return ForcedUpdate(kTRUE); +} + +Bool_t HalCbmDeltaPhiDeltaThetaStarCut::PassAnaTree(Hal::TwoTrack* pair) +{ + TVector3 mom1, mom2; + HalCbmTrack* tr1 = static_cast<HalCbmTrack*>(pair->GetTrack1()); + HalCbmTrack* tr2 = static_cast<HalCbmTrack*>(pair->GetTrack2()); + CbmHelix& h1 = tr1->GetHelix(); + CbmHelix& h2 = tr2->GetHelix(); + h1.Eval(fR + tr1->GetEvent()->GetVertex()->Z(), mom1); + h2.Eval(fR + tr2->GetEvent()->GetVertex()->Z(), mom2); + SetValue(mom1.Phi() - mom2.Phi(), 0); //dleta phi + SetValue(mom1.Theta() - mom2.Theta(), 1); + if (GetValue(0) > GetMin(0) && GetValue(0) < GetMax(0) && GetValue(1) > GetMin(1) && GetValue(1) < GetMax(1)) { + return ForcedUpdate(kFALSE); + } + return ForcedUpdate(kTRUE); +} + +//=============================================================================== +Hal::Package* HalCbmDeltaPhiDeltaThetaStarCut::Report() const +{ + Hal::Package* pack = HalCbmPairCut::Report(); + pack->AddObject(new Hal::ParameterDouble("R", fR)); + return pack; +} + +HalCbmDeltaPhiDeltaThetaStarCut& +HalCbmDeltaPhiDeltaThetaStarCut::operator=(const HalCbmDeltaPhiDeltaThetaStarCut& other) +{ + if (this == &other) return *this; + HalCbmPairCut::operator=(other); + fDataType = other.fDataType; + return *this; +} + +HalCbmDeltaPhiDeltaThetaStarCut::~HalCbmDeltaPhiDeltaThetaStarCut() {} + +HalCbmDeltaPhiDeltaThetaCut::HalCbmDeltaPhiDeltaThetaCut() : HalCbmPairCut(2) +{ + SetUnitName("#Delta#phi [rad]", 0); + SetUnitName("#Delta#eta [rad]", 1); +} + +Bool_t HalCbmDeltaPhiDeltaThetaCut::Pass(Hal::TwoTrack* pair) +{ + Hal::Track* tr1 = static_cast<Hal::Track*>(pair->GetTrack1()); + Hal::Track* tr2 = static_cast<Hal::Track*>(pair->GetTrack2()); + SetValue(tr1->GetMomentum().Phi() - tr2->GetMomentum().Phi(), 0); + SetValue(tr1->GetMomentum().Theta() - tr2->GetMomentum().Theta(), 1); + if (GetValue(0) > GetMin(0) && GetValue(0) < GetMax(0) && GetValue(1) > GetMin(1) && GetValue(1) < GetMax(1)) { + return ForcedUpdate(kFALSE); + } + return ForcedUpdate(kTRUE); +} + +HalCbmDeltaPhiDeltaThetaCut::~HalCbmDeltaPhiDeltaThetaCut() {} + +//=============================================================================== + +HalCbmDeltaPhiDeltaThetaStarCutLayers::HalCbmDeltaPhiDeltaThetaStarCutLayers() : HalCbmPairCut(22), fR(0.0) +{ + for (int i = 0; i < 9; i++) { + SetUnitName(Form("#Delta#phi^{*}_{lay%i} [rad]", i), i * 2); + SetUnitName(Form("#Delta#eta^{*}_{lay%i} [AU]", i), i * 2 + 1); + SetMinMax(1, -1, i * 2); + SetMinMax(1, -1, i * 2 + 1); + } + SetUnitName("#Delta#phi_{min}^{*} [rad]", 18); + SetUnitName("#Delta#eta_{min}^{*} [AU]", 19); + SetUnitName("#Delta#phi_{max}^{*} [rad]", 20); + SetUnitName("#Delta#eta_{max}^{*} [AU]", 21); + for (int i = 18; i < 22; i++) { + SetMinMax(1, -1, i); + } +} + +Bool_t HalCbmDeltaPhiDeltaThetaStarCutLayers::PassHbt(Hal::TwoTrack* pair) +{ + TVector3 mom1, mom2; + TVector3 pos1, pos2; + HalCbmHbtTrack* tr1 = static_cast<HalCbmHbtTrack*>(pair->GetTrack1()); + HalCbmHbtTrack* tr2 = static_cast<HalCbmHbtTrack*>(pair->GetTrack2()); + Double_t phiMin = 9E+9, etaMin = 9e+9; + Double_t phiMax = 0, etaMax = 0; + + for (int i = 0; i < 9; i++) { + mom1 = tr1->GetMomAtPlane(i); + mom2 = tr2->GetMomAtPlane(i); + pos1 = tr1->GetPosAtPlane(i); + pos2 = tr2->GetPosAtPlane(i); + Double_t dphi = TVector2::Phi_mpi_pi(mom1.Phi() - mom2.Phi()); + Double_t deta = mom1.Theta() - mom2.Theta(); + + SetValue(dphi, 2 * i); + SetValue(deta, 2 * i + 1); + if (TMath::Abs(dphi) < TMath::Abs(phiMin)) phiMin = dphi; + if (TMath::Abs(deta) < TMath::Abs(etaMin)) etaMin = deta; + + if (TMath::Abs(dphi) > TMath::Abs(phiMax)) phiMax = dphi; + if (TMath::Abs(deta) > TMath::Abs(etaMax)) etaMax = deta; + } + SetValue(phiMin, 18); + SetValue(etaMin, 19); + SetValue(phiMax, 20); + SetValue(etaMax, 21); + Int_t passed = 0; + for (int i = 0; i < 22; i++) { + if (GetValue(i) > GetMin(i) && GetValue(i) < GetMax(i)) passed++; + } + if (passed != 0) return ForcedUpdate(kFALSE); + return ForcedUpdate(kTRUE); +} + +Bool_t HalCbmDeltaPhiDeltaThetaStarCutLayers::PassAnaTree(Hal::TwoTrack* pair) +{ + TVector3 mom1, mom2; + HalCbmTrack* tr1 = static_cast<HalCbmTrack*>(pair->GetTrack1()); + HalCbmTrack* tr2 = static_cast<HalCbmTrack*>(pair->GetTrack2()); + CbmHelix& h1 = tr1->GetHelix(); + CbmHelix& h2 = tr2->GetHelix(); + Double_t phiMin = 9E+9, etaMin = 9e+9; + Double_t phiMax = 0, etaMax = 0; + const Double_t R[9] = {20, 30, 40, 50, 60, 70, 80, 90, 100}; + + for (int i = 0; i < 9; i++) { + h1.Eval(R[i] + tr1->GetEvent()->GetVertex()->Z(), mom1); + h2.Eval(R[i] + tr2->GetEvent()->GetVertex()->Z(), mom2); + Double_t dphi = TVector2::Phi_mpi_pi(mom1.Phi() - mom2.Phi()); + Double_t deta = mom1.Theta() - mom2.Theta(); + + SetValue(dphi, 2 * i); + SetValue(deta, 2 * i + 1); + if (TMath::Abs(dphi) < TMath::Abs(phiMin)) phiMin = dphi; + if (TMath::Abs(deta) < TMath::Abs(etaMin)) etaMin = deta; + + if (TMath::Abs(dphi) > TMath::Abs(phiMax)) phiMax = dphi; + if (TMath::Abs(deta) > TMath::Abs(etaMax)) etaMax = deta; + } + SetValue(phiMin, 18); + SetValue(etaMin, 19); + SetValue(phiMax, 20); + SetValue(etaMax, 21); + Int_t passed = 0; + for (int i = 0; i < 22; i++) { + if (GetValue(i) > GetMin(i) && GetValue(i) < GetMax(i)) passed++; + } + if (passed != 0) return ForcedUpdate(kFALSE); + return ForcedUpdate(kTRUE); +} + + +Hal::Package* HalCbmDeltaPhiDeltaThetaStarCutLayers::Report() const +{ + Hal::Package* pack = HalCbmPairCut::Report(); + pack->AddObject(new Hal::ParameterDouble("R", fR)); + return pack; +} + +HalCbmDeltaPhiDeltaThetaStarCutLayers& +HalCbmDeltaPhiDeltaThetaStarCutLayers::operator=(const HalCbmDeltaPhiDeltaThetaStarCutLayers& other) +{ + if (this == &other) return *this; + HalCbmPairCut::operator=(other); + fDataType = other.fDataType; + return *this; +} + +HalCbmDeltaPhiDeltaThetaStarCutLayers::~HalCbmDeltaPhiDeltaThetaStarCutLayers() {} + +//=============================================================================== diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaCut.h b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaCut.h new file mode 100644 index 0000000000000000000000000000000000000000..eb9ddc1d9297e6b7b09e497a23fd5bcf6f31bfae --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaCut.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMDELTAPHIDELTATHETACUT_H_ +#define CBMDELTAPHIDELTATHETACUT_H_ +#include "HalCbmFormatTypes.h" +#include "HalCbmPairCut.h" + +class HalCbmDeltaPhiDeltaThetaStarCut : public HalCbmPairCut { + protected: + Double_t fR; + virtual Bool_t PassHbt(Hal::TwoTrack* pair); + virtual Bool_t PassAnaTree(Hal::TwoTrack* pair); + + public: + HalCbmDeltaPhiDeltaThetaStarCut(); + HalCbmDeltaPhiDeltaThetaStarCut& operator=(const HalCbmDeltaPhiDeltaThetaStarCut& other); + void SetR(Double_t r) { fR = r; } + virtual Hal::Package* Report() const; + virtual ~HalCbmDeltaPhiDeltaThetaStarCut(); + ClassDef(HalCbmDeltaPhiDeltaThetaStarCut, 1) +}; + +class HalCbmDeltaPhiDeltaThetaCut : public HalCbmPairCut { + protected: + public: + HalCbmDeltaPhiDeltaThetaCut(); + Bool_t Pass(Hal::TwoTrack* pair); + virtual ~HalCbmDeltaPhiDeltaThetaCut(); + ClassDef(HalCbmDeltaPhiDeltaThetaCut, 1) +}; + + +class HalCbmDeltaPhiDeltaThetaStarCutLayers : public HalCbmPairCut { + protected: + Double_t fR; + virtual Bool_t PassHbt(Hal::TwoTrack* pair); + virtual Bool_t PassAnaTree(Hal::TwoTrack* pair); + + public: + HalCbmDeltaPhiDeltaThetaStarCutLayers(); + HalCbmDeltaPhiDeltaThetaStarCutLayers& operator=(const HalCbmDeltaPhiDeltaThetaStarCutLayers& other); + void SetR(Double_t r) { fR = r; } + virtual Hal::Package* Report() const; + virtual ~HalCbmDeltaPhiDeltaThetaStarCutLayers(); + ClassDef(HalCbmDeltaPhiDeltaThetaStarCutLayers, 1) +}; + + +#endif /* CBMDELTAPHIDELTATHETACUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaStarMinCut.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaStarMinCut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..267df9ce58c6b066b242d2e9a1ab2f4d61dc62c9 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaStarMinCut.cxx @@ -0,0 +1,80 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmDeltaPhiDeltaThetaStarMinCut.h" + +#include "CbmHelix.h" +#include "HalCbmHbtTrack.h" +#include "HalCbmTrack.h" + +#include <TLorentzVector.h> +#include <TVector3.h> + +#include <Hal/Cut.h> +#include <Hal/Event.h> +#include <Hal/Package.h> +#include <Hal/Parameter.h> +#include <Hal/Std.h> +#include <Hal/Track.h> +#include <Hal/TwoTrack.h> + + +Bool_t HalCbmDeltaPhiDeltaThetaStarMinCut::PassHbt(Hal::TwoTrack* pair) +{ + TVector3 mom1, mom2; + HalCbmHbtTrack* tr1 = static_cast<HalCbmHbtTrack*>(pair->GetTrack1()); + HalCbmHbtTrack* tr2 = static_cast<HalCbmHbtTrack*>(pair->GetTrack2()); + + Double_t phiMin = 1E+9; + Double_t etaMin = 1E+9; + for (int i = 0; i < 8; i++) { + mom1 = tr1->GetMomAtPlane(i + 1); + mom2 = tr2->GetMomAtPlane(i + 1); + Double_t dphi = TVector2::Phi_mpi_pi(mom1.Phi() - mom2.Phi()); + if (TMath::Abs(dphi) < TMath::Abs(phiMin)) phiMin = dphi; + etaMin = TMath::Min(TMath::Abs(mom1.Eta() - mom2.Eta()), etaMin); + } + + SetValue(mom1.Phi() - mom2.Phi(), 0); //dleta phi + SetValue(mom1.Theta() - mom2.Theta(), 1); + if (GetValue(0) > GetMin(0) && GetValue(0) < GetMax(0) && GetValue(1) > GetMin(1) && GetValue(1) < GetMax(1)) { + return ForcedUpdate(kFALSE); + } + return ForcedUpdate(kTRUE); +} + +Bool_t HalCbmDeltaPhiDeltaThetaStarMinCut::PassAnaTree(Hal::TwoTrack* pair) +{ + TVector3 mom1, mom2; + HalCbmTrack* tr1 = static_cast<HalCbmTrack*>(pair->GetTrack1()); + HalCbmTrack* tr2 = static_cast<HalCbmTrack*>(pair->GetTrack2()); + CbmHelix& h1 = tr1->GetHelix(); + CbmHelix& h2 = tr2->GetHelix(); + Double_t phiMin = 1E+9; + Double_t etaMin = 1E+9; + const Double_t R[8] = {30, 40, 50, 60, 70, 80, 90, 100}; + for (int i = 0; i < 8; i++) { + h1.Eval(R[i] + tr1->GetEvent()->GetVertex()->Z(), mom1); + h2.Eval(R[i] + tr2->GetEvent()->GetVertex()->Z(), mom2); + Double_t dphi = TVector2::Phi_mpi_pi(mom1.Phi() - mom2.Phi()); + if (TMath::Abs(dphi) < TMath::Abs(phiMin)) phiMin = dphi; + etaMin = TMath::Min(TMath::Abs(mom1.Eta() - mom2.Eta()), etaMin); + } + + SetValue(phiMin, 0); //dleta phi + SetValue(etaMin, 1); + + + if (GetValue(0) > GetMin(0) && GetValue(0) < GetMax(0) && GetValue(1) > GetMin(1) && GetValue(1) < GetMax(1)) { + return ForcedUpdate(kFALSE); + } + return ForcedUpdate(kTRUE); +} + +HalCbmDeltaPhiDeltaThetaStarMinCut::HalCbmDeltaPhiDeltaThetaStarMinCut() : HalCbmPairCut(2) +{ + SetUnitName("#Delta#phi^{*}_{min}", 0); + SetUnitName("#Delta#eta^{*}_{min}", 1); + SetMinMax(0, 0, 0); + SetMinMax(0, 0, 1); +} diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaStarMinCut.h b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaStarMinCut.h new file mode 100644 index 0000000000000000000000000000000000000000..c9413c41527daac4ef35e57b14fb7209c36d8e02 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmDeltaPhiDeltaThetaStarMinCut.h @@ -0,0 +1,22 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_PAIR_CBMDELTAPHIDELTATHETASTARMINCUT_H_ +#define CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_PAIR_CBMDELTAPHIDELTATHETASTARMINCUT_H_ + +#include "HalCbmFormatTypes.h" +#include "HalCbmPairCut.h" + +class HalCbmDeltaPhiDeltaThetaStarMinCut : public HalCbmPairCut { + protected: + virtual Bool_t PassHbt(Hal::TwoTrack* pair); + virtual Bool_t PassAnaTree(Hal::TwoTrack* pair); + + public: + HalCbmDeltaPhiDeltaThetaStarMinCut(); + virtual ~HalCbmDeltaPhiDeltaThetaStarMinCut(){}; + ClassDef(HalCbmDeltaPhiDeltaThetaStarMinCut, 1) +}; + + +#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_PAIR_CBMDELTAPHIDELTATHETASTARMINCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairCut.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairCut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9a7b1770070c4dd86635c4a2fe3174c03b904552 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairCut.cxx @@ -0,0 +1,35 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmPairCut.h" + + +HalCbmPairCut::HalCbmPairCut(Int_t pairNo) : Hal::TwoTrackCut(pairNo), fDataType(HalCbm::EFormatType::kUnknown) {} + +HalCbmPairCut::~HalCbmPairCut() {} + +HalCbmPairCut& HalCbmPairCut::operator=(const HalCbmPairCut& other) +{ + if (this == &other) return *this; + Hal::TwoTrackCut::operator=(other); + fDataType = other.fDataType; + return *this; +} + +Bool_t HalCbmPairCut::Pass(Hal::TwoTrack* pair) +{ + switch (fDataType) { + case HalCbm::EFormatType::kHbt: return PassHbt(pair); break; + case HalCbm::EFormatType::kAnaTree: return PassAnaTree(pair); break; + default: return kFALSE; break; + } +} + +Bool_t HalCbmPairCut::Init(Int_t format_id) +{ + fDataType = HalCbm::GetFormatType(format_id, Hal::EFormatDepth::kBuffered); + if (fDataType == HalCbm::EFormatType::kUnknown) return kFALSE; + return kTRUE; +} + +HalCbmPairCut::HalCbmPairCut(const HalCbmPairCut& other) : Hal::TwoTrackCut(other), fDataType(other.fDataType) {} diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairCut.h b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairCut.h new file mode 100644 index 0000000000000000000000000000000000000000..7eeb42c71da81491ddc509dc61840e2dd0d27f5b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairCut.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_PAIR_CBMPAIRCUT_H_ +#define CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_PAIR_CBMPAIRCUT_H_ + +#include "HalCbmFormatTypes.h" + +#include <Hal/TwoTrackCut.h> + +class HalCbmPairCut : public Hal::TwoTrackCut { + protected: + HalCbm::EFormatType fDataType; + /** + * pass pair of hbt particles + * @param pair + * @return + */ + virtual Bool_t PassHbt(Hal::TwoTrack* pair) = 0; + /** + * pass pair of cbm tracks from analysis tree + * @param pair + * @return + */ + virtual Bool_t PassAnaTree(Hal::TwoTrack* pair) = 0; + + public: + HalCbmPairCut(Int_t parNo = 1); + virtual Bool_t Pass(Hal::TwoTrack* pair); + virtual Bool_t Init(Int_t format_id); + virtual ~HalCbmPairCut(); + HalCbmPairCut& operator=(const HalCbmPairCut& other); + HalCbmPairCut(const HalCbmPairCut& other); + ClassDef(HalCbmPairCut, 1) +}; + + +#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_PAIR_CBMPAIRCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairSeparationCut2D.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairSeparationCut2D.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8162a9eb153310ef07381cd6be07c935cfe7834f --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairSeparationCut2D.cxx @@ -0,0 +1,78 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmPairSeparationCut2D.h" + +#include "CbmHelix.h" +#include "HalCbmHbtTrack.h" +#include "HalCbmPairCut.h" +#include "HalCbmTrack.h" + +#include <RtypesCore.h> +#include <TLorentzVector.h> +#include <TVector3.h> + +#include <Hal/Event.h> +#include <Hal/Package.h> +#include <Hal/Parameter.h> +#include <Hal/Track.h> +#include <Hal/TwoTrack.h> + + +HalCbmPairSeparationCut2D::HalCbmPairSeparationCut2D() : HalCbmPairCut(2), fR(-10) +{ + SetUnitName("#Delta Z [cm[", 0); + SetUnitName("#Delta XY [cm]", 1); +} + +Bool_t HalCbmPairSeparationCut2D::PassHbt(Hal::TwoTrack* pair) +{ + TVector3 mom1, mom2; + HalCbmHbtTrack* tr1 = static_cast<HalCbmHbtTrack*>(pair->GetTrack1()); + HalCbmHbtTrack* tr2 = static_cast<HalCbmHbtTrack*>(pair->GetTrack2()); + tr1->CalculateAtR(fR); + tr2->CalculateAtR(fR); + mom1 = tr1->GetMomAtCustom(); + mom2 = tr2->GetMomAtCustom(); + Double_t dxy = (mom1 - mom2).Pt(); + if (mom1.Y() < mom2.Y()) dxy = -dxy; + Double_t dz = mom1.Z() - mom2.Z(); + SetValue(dz, 0); + SetValue(dxy, 1); + if (GetValue(0) > GetMin(0) && GetValue(0) < GetMax(0) && GetValue(1) > GetMin(1) && GetValue(1) < GetMax(1)) { + return ForcedUpdate(kFALSE); + } + return ForcedUpdate(kTRUE); +} + +Bool_t HalCbmPairSeparationCut2D::PassAnaTree(Hal::TwoTrack* pair) +{ + TVector3 mom1, mom2; + HalCbmTrack* tr1 = static_cast<HalCbmTrack*>(pair->GetTrack1()); + HalCbmTrack* tr2 = static_cast<HalCbmTrack*>(pair->GetTrack2()); + CbmHelix& h1 = tr1->GetHelix(); + CbmHelix& h2 = tr2->GetHelix(); + h1.Eval(fR + tr1->GetEvent()->GetVertex()->Z(), mom1); + h2.Eval(fR + tr2->GetEvent()->GetVertex()->Z(), mom2); + Double_t dxy = (mom1 - mom2).Pt(); + if (mom1.Y() < mom2.Y()) dxy = -dxy; + Double_t dz = mom1.Z() - mom2.Z(); + SetValue(dz, 0); + SetValue(dxy, 1); + if (GetValue(0) > GetMin(0) && GetValue(0) < GetMax(0) && GetValue(1) > GetMin(1) && GetValue(1) < GetMax(1)) { + return ForcedUpdate(kFALSE); + } + return ForcedUpdate(kTRUE); +} + +Hal::Package* HalCbmPairSeparationCut2D::Report() const +{ + Hal::Package* pack = HalCbmPairCut::Report(); + pack->AddObject(new Hal::ParameterDouble("R", fR)); + return pack; +} + +HalCbmPairSeparationCut2D::~HalCbmPairSeparationCut2D() +{ + // TODO Auto-generated destructor stub +} diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairSeparationCut2D.h b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairSeparationCut2D.h new file mode 100644 index 0000000000000000000000000000000000000000..c5249f3999fc134857e8b24b9b3568cd9545e9e1 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmPairSeparationCut2D.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_PAIR_CBMPAIRSEPARATIONCUT2D_H_ +#define CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_PAIR_CBMPAIRSEPARATIONCUT2D_H_ + + +#include "HalCbmPairCut.h" + +namespace Hal +{ + class TwoTrack; +} /* namespace Hal */ + +class HalCbmPairSeparationCut2D : public HalCbmPairCut { + protected: + Double_t fR; + virtual Bool_t PassHbt(Hal::TwoTrack* pair); + virtual Bool_t PassAnaTree(Hal::TwoTrack* pair); + + public: + HalCbmPairSeparationCut2D(); + void SetDeltaZ(Double_t min, Double_t max) { SetMinMax(min, max, 0); } + void SetDeltaXY(Double_t min, Double_t max) { SetMinMax(min, max, 1); } + void SetR(Double_t r) { fR = r; } + virtual Hal::Package* Report() const; + virtual ~HalCbmPairSeparationCut2D(); + ClassDef(HalCbmPairSeparationCut2D, 1) +}; + +#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_PAIR_CBMPAIRSEPARATIONCUT2D_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmStsSepCut.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmStsSepCut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f10b52eb8769d03a09128de79c6f69398cac57d0 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmStsSepCut.cxx @@ -0,0 +1,162 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmStsSepCut.h" + +#include "CbmHelix.h" +#include "HalCbmHbtTrack.h" +#include "HalCbmTrack.h" + +#include <TLorentzVector.h> +#include <TVector3.h> + +#include <Hal/ExpEvent.h> +#include <Hal/TwoTrack.h> + + +HalCbmStsExitSepCut::HalCbmStsExitSepCut() : HalCbmPairCut(1) +{ + SetUnitName("StsExitSep [cm]"); + SetMinMax(0, 1E+5); +} + +HalCbmStsExitSepCut::~HalCbmStsExitSepCut() {} + +Bool_t HalCbmStsExitSepCut::PassHbt(Hal::TwoTrack* pair) +{ + HalCbmHbtTrack* tr1 = static_cast<HalCbmHbtTrack*>(pair->GetTrack1()); + HalCbmHbtTrack* tr2 = static_cast<HalCbmHbtTrack*>(pair->GetTrack2()); + Double_t dist = (tr1->GetPosAtStsExit() - tr2->GetPosAtStsExit()).Mag(); + SetValue(dist); + return Validate(); +} + +Bool_t HalCbmStsExitSepCut::PassAnaTree(Hal::TwoTrack* pair) +{ + Double_t dist = 0; + TLorentzVector *Pos1 = nullptr, *Pos2 = nullptr; + HalCbmTrack* tr1 = static_cast<HalCbmTrack*>(pair->GetTrack1()); + HalCbmTrack* tr2 = static_cast<HalCbmTrack*>(pair->GetTrack2()); + Pos1 = static_cast<Hal::ExpEvent*>(tr1->GetEvent())->GetVertex(); + Pos2 = static_cast<Hal::ExpEvent*>(tr2->GetEvent())->GetVertex(); + CbmHelix& h1 = tr1->GetHelix(); + CbmHelix& h2 = tr2->GetHelix(); + TVector3 pos1 = h1.Eval(101.1 + Pos1->Z()); + TVector3 pos2 = h2.Eval(101.1 + Pos2->Z()); + pos1.SetX(pos1.X() - Pos1->X()); + pos1.SetY(pos1.Y() - Pos1->Y()); + pos2.SetX(pos2.X() - Pos2->X()); + pos2.SetY(pos2.Y() - Pos2->Y()); + dist = (pos1 - pos2).Mag(); + SetValue(dist); + return Validate(); +} + +Bool_t HalCbmStsEntranceSepCut::PassHbt(Hal::TwoTrack* pair) +{ + HalCbmHbtTrack* tr1 = static_cast<HalCbmHbtTrack*>(pair->GetTrack1()); + HalCbmHbtTrack* tr2 = static_cast<HalCbmHbtTrack*>(pair->GetTrack2()); + Double_t dist = (tr1->GetPosAtStsEntrance() - tr2->GetPosAtStsEntrance()).Mag(); + SetValue(dist); + return Validate(); +} + +Bool_t HalCbmStsEntranceSepCut::PassAnaTree(Hal::TwoTrack* pair) +{ + Double_t dist = 0; + TLorentzVector *Pos1 = nullptr, *Pos2 = nullptr; + HalCbmTrack* tr1 = static_cast<HalCbmTrack*>(pair->GetTrack1()); + HalCbmTrack* tr2 = static_cast<HalCbmTrack*>(pair->GetTrack2()); + Pos1 = static_cast<Hal::ExpEvent*>(tr1->GetEvent())->GetVertex(); + Pos2 = static_cast<Hal::ExpEvent*>(tr2->GetEvent())->GetVertex(); + CbmHelix& h1 = tr1->GetHelix(); + CbmHelix& h2 = tr2->GetHelix(); + TVector3 pos1 = h1.Eval(30 + Pos1->Z()); + TVector3 pos2 = h2.Eval(30 + Pos2->Z()); + pos1.SetX(pos1.X() - Pos1->X()); + pos1.SetY(pos1.Y() - Pos1->Y()); + pos2.SetX(pos2.X() - Pos2->X()); + pos2.SetY(pos2.Y() - Pos2->Y()); + dist = (pos1 - pos2).Mag(); + SetValue(dist); + return Validate(); +} + +HalCbmStsEntranceSepCut::HalCbmStsEntranceSepCut() : HalCbmPairCut(1) +{ + SetUnitName("StsEntranceSep [cm]"); + SetMinMax(0, 1E+5); +} + +Bool_t HalCbmStsSeparationCutLayers::PassHbt(Hal::TwoTrack* pair) +{ + HalCbmHbtTrack* tr1 = static_cast<HalCbmHbtTrack*>(pair->GetTrack1()); + HalCbmHbtTrack* tr2 = static_cast<HalCbmHbtTrack*>(pair->GetTrack2()); + TVector3 poz1, poz2, dif; + Double_t x_min = 9E+4, y_min = 9E+4, xy_min = 9E+4; + Double_t x_max = 0, y_max = 0, xy_max = 0; + for (int i = 0; i < 9; i++) { + poz1 = tr1->GetPosAtPlane(i); + poz2 = tr2->GetPosAtPlane(i); + dif = poz1 - poz2; + Double_t dx = dif.X(); + Double_t dy = dif.Y(); + Double_t adx = TMath::Abs(dif.X()); + Double_t ady = TMath::Abs(dif.Y()); + Double_t adxy = dif.Pt(); + SetValue(dx, i * 3); + SetValue(dy, i * 3 + 1); + SetValue(adxy, i * 3 + 2); + if (adx < x_min) x_min = dx; + if (ady < y_min) y_min = dy; + if (adxy < xy_min) xy_min = adxy; + if (adx > x_max) x_max = dx; + if (ady > y_max) y_max = dy; + if (adxy > xy_max) xy_max = adxy; + } + SetValue(x_min, 27); + SetValue(y_min, 28); + SetValue(xy_min, 29); + SetValue(x_max, 30); + SetValue(y_max, 31); + SetValue(xy_max, 32); + + Int_t passed = 0; + for (int i = 0; i < 33; i++) { + if (GetValue(i) > GetMin(i) && GetValue(i) < GetMax(i)) passed++; + } + if (passed != 0) return ForcedUpdate(kFALSE); + return ForcedUpdate(kTRUE); +} + +Bool_t HalCbmStsSeparationCutLayers::PassAnaTree(Hal::TwoTrack* /*pair*/) +{ + LOG(warning) << "not implemented"; + return kTRUE; +} + +HalCbmStsSeparationCutLayers::HalCbmStsSeparationCutLayers() : HalCbmPairCut(33) +{ + for (int i = 0; i < 9; i++) { + SetUnitName(Form("#Delta#X^{*}_{lay%i} [cm]", i), i * 3); + SetUnitName(Form("#Delta#Y^{*}_{lay%i} [cm]", i), i * 3 + 1); + SetUnitName(Form("#Delta#XY^{*}_{lay%i} [cm]", i), i * 3 + 2); + SetMinMax(1, -1, i * 3); + SetMinMax(1, -1, i * 3 + 1); + SetMinMax(1, -1, i * 3 + 2); + } + SetUnitName("#Delta#X^{*}_{min} [cm]", 27); + SetUnitName("#Delta#Y^{*}_{min} [cm]", 28); + SetUnitName("#Delta#XY^{*}_{min} [cm]", 29); + SetUnitName("#Delta#X^{*}_{max} [cm]", 30); + SetUnitName("#Delta#Y^{*}_{max} [cm]", 31); + SetUnitName("#Delta#XY^{*}_{max} [cm]", 32); + SetMinMax(1, -1, 27); + SetMinMax(1, -1, 28); + SetMinMax(1, -1, 29); + SetMinMax(1, -1, 30); + SetMinMax(1, -1, 31); + SetMinMax(1, -1, 32); +} + +HalCbmStsSeparationCutLayers::~HalCbmStsSeparationCutLayers() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmStsSepCut.h b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmStsSepCut.h new file mode 100644 index 0000000000000000000000000000000000000000..3592550d85009b01bb955e416035d30e489b7542 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/pair/HalCbmStsSepCut.h @@ -0,0 +1,44 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef PAIRCUTS_CBMSTSEXITSEPCUT_H_ +#define PAIRCUTS_CBMSTSEXITSEPCUT_H_ + +#include "HalCbmFormatTypes.h" +#include "HalCbmPairCut.h" + +class HalCbmStsExitSepCut : public HalCbmPairCut { + protected: + Bool_t PassHbt(Hal::TwoTrack* pair); + Bool_t PassAnaTree(Hal::TwoTrack* pair); + + public: + HalCbmStsExitSepCut(); + virtual ~HalCbmStsExitSepCut(); + ClassDef(HalCbmStsExitSepCut, 1) +}; + +class HalCbmStsEntranceSepCut : public HalCbmPairCut { + protected: + Bool_t PassHbt(Hal::TwoTrack* pair); + Bool_t PassAnaTree(Hal::TwoTrack* pair); + + public: + HalCbmStsEntranceSepCut(); + virtual ~HalCbmStsEntranceSepCut(){}; + ClassDef(HalCbmStsEntranceSepCut, 1) +}; + +class HalCbmStsSeparationCutLayers : public HalCbmPairCut { + protected: + Bool_t PassHbt(Hal::TwoTrack* pair); + Bool_t PassAnaTree(Hal::TwoTrack* pair); + + public: + HalCbmStsSeparationCutLayers(); + virtual ~HalCbmStsSeparationCutLayers(); + ClassDef(HalCbmStsSeparationCutLayers, 1); +}; + + +#endif /* PAIRCUTS_CBMSTSEXITSEPCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmBasicTrackCuts.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmBasicTrackCuts.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fa6e85b975910482da44ceb8ff01b0e6f379f70b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmBasicTrackCuts.cxx @@ -0,0 +1,154 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmBasicTrackCuts.h" + +#include "HalCbmNHitsCut.h" +#include "HalCbmTofCut.h" + +#include <TString.h> + +#include <Hal/Cut.h> +#include <Hal/CutMonitorRequest.h> +#include <Hal/TrackChargeCut.h> +#include <Hal/TrackChi2Cut.h> +#include <Hal/TrackDCACut.h> +#include <Hal/TrackEtaCut.h> +#include <Hal/TrackPCut.h> +#include <Hal/TrackPtCut.h> + + +HalCbmBasicTrackCuts::HalCbmBasicTrackCuts() + : fKinPt("Hal::TrackPtCut", 0, 100, 0, 4) + , fKinEta("Hal::TrackEtaCut", 0, 200, -2, 4) + , fTofP("Hal::TrackPCut", 0, 200, 0, 2) + , fTofM2("HalCbmTofCut", 0, 100, -0.1, 1.2) + , fHits("HalCbmNHitsCut", 0, 12, 0.5, 12.5) + , fHitsSts("HalCbmNHitsCut", 2, 10, -0.5, 9.5) + , fChi2("Hal::TrackChi2Cut", 0, 100, 0, 25) + , fDCAxy("Hal::TrackDCACut", 1, 100, 0, 10) + , fDCAz("Hal::TrackDCACut", 2, 100, -5, 5) +{ + AddCut(Hal::TrackChargeCut()); //0 + AddCut(HalCbmNHitsCut()); //1 + AddCut(Hal::TrackChi2Cut()); //2 + AddCut(Hal::TrackPCut()); //3 + AddCut(Hal::TrackPtCut()); //4 + AddCut(Hal::TrackEtaCut()); //5 + AddCut(Hal::TrackDCACut()); //6 + AddCut(HalCbmTofCut()); //7 +} + +Hal::TrackChargeCut* HalCbmBasicTrackCuts::GetChargeCut() const { return (Hal::TrackChargeCut*) this->CutAt(0); } + +HalCbmNHitsCut* HalCbmBasicTrackCuts::GetNHitsCut() const { return (HalCbmNHitsCut*) this->CutAt(1); } + +Hal::TrackChi2Cut* HalCbmBasicTrackCuts::GetChi2Cut() const { return (Hal::TrackChi2Cut*) this->CutAt(2); } + +Hal::TrackPCut* HalCbmBasicTrackCuts::GetPCut() const { return (Hal::TrackPCut*) this->CutAt(3); } + +Hal::TrackPtCut* HalCbmBasicTrackCuts::GetPtCut() const { return (Hal::TrackPtCut*) this->CutAt(4); } + +Hal::TrackEtaCut* HalCbmBasicTrackCuts::GetEtaCut() const { return (Hal::TrackEtaCut*) this->CutAt(5); } + +Hal::TrackDCACut* HalCbmBasicTrackCuts::GetDCACut() const { return (Hal::TrackDCACut*) this->CutAt(6); } + +void HalCbmBasicTrackCuts::AddAllCutMonitorRequests(Option_t* opt) +{ + //Hal::HistogramAxisConf requestHits(bins, min, max); + TString option = opt; + if (Hal::Std::FindParam(option, "all")) { + AddCutMonitorRequest(fHits); + AddCutMonitorRequest(fHitsSts); + AddCutMonitorRequest(fChi2); + AddCutMonitorRequest(fKinEta, fKinPt); + AddCutMonitorRequest(fTofP, fTofM2); + AddCutMonitorRequest(fDCAz, fDCAxy); + return; + } + if (Hal::Std::FindParam(option, "chi2")) AddCutMonitorRequest(fChi2); + if (Hal::Std::FindParam(option, "hits")) AddCutMonitorRequest(fHits); + if (Hal::Std::FindParam(option, "hits_sts")) AddCutMonitorRequest(fHitsSts); + if (Hal::Std::FindParam(option, "tof")) AddCutMonitorRequest(fTofP, fTofM2); + if (Hal::Std::FindParam(option, "dca")) AddCutMonitorRequest(fDCAz, fDCAxy); +} + +void HalCbmBasicTrackCuts::SetCharge(Int_t charge) { GetChargeCut()->SetMinAndMax(charge); } + +void HalCbmBasicTrackCuts::SetNHits(Int_t min, Int_t max) { GetNHitsCut()->SetMinMax(min, max); } + +void HalCbmBasicTrackCuts::SetNMvdHits(Int_t min, Int_t max) { GetNHitsCut()->SetMinMax(min, max, 1); } + +void HalCbmBasicTrackCuts::SetNStsHits(Int_t min, Int_t max) { GetNHitsCut()->SetMinMax(min, max, 2); } + +void HalCbmBasicTrackCuts::SetNTrdHits(Int_t min, Int_t max) { GetNHitsCut()->SetMinMax(min, max, 3); } + +void HalCbmBasicTrackCuts::SetPt(Double_t min, Double_t max) { GetPtCut()->SetMinMax(min, max); } + +void HalCbmBasicTrackCuts::SetEta(Double_t min, Double_t max) { GetEtaCut()->SetMinMax(min, max); } + +void HalCbmBasicTrackCuts::SetM2(Double_t min, Double_t max) { GetTofCut()->SetMinMax(min, max); } + +void HalCbmBasicTrackCuts::SetDCAXY(Double_t min, Double_t max) +{ + GetDCACut()->SetMinMax(min, max, GetDCACut()->DCAxy()); +} + +void HalCbmBasicTrackCuts::SetDCAZ(Double_t min, Double_t max) +{ + GetDCACut()->SetMinMax(min, max, GetDCACut()->DCAz()); +} + +void HalCbmBasicTrackCuts::SetTofMonitorPAxis(Int_t nbins, Double_t min, Double_t max) +{ + fTofP.SetAxis(nbins, min, max); +} + +void HalCbmBasicTrackCuts::SetTofMonitorM2Axis(Int_t nbins, Double_t min, Double_t max) +{ + fTofM2.SetAxis(nbins, min, max); +} + +void HalCbmBasicTrackCuts::SetPtEtaMonitorPtAxis(Int_t nbins, Double_t min, Double_t max) +{ + fKinPt.SetAxis(nbins, min, max); +} + +void HalCbmBasicTrackCuts::SetPtEtaMonitorEtaAxis(Int_t nbins, Double_t min, Double_t max) +{ + fKinEta.SetAxis(nbins, min, max); +} + +void HalCbmBasicTrackCuts::SetNHitsMonitorAxis(Int_t nbins, Double_t min, Double_t max) +{ + fHits.SetAxis(nbins, min, max); +} + +void HalCbmBasicTrackCuts::SetChi2MonitorAxis(Int_t nbins, Double_t min, Double_t max) +{ + fChi2.SetAxis(nbins, min, max); +} + +void HalCbmBasicTrackCuts::SetDCAMonitorZAxis(Int_t nbins, Double_t min, Double_t max) +{ + fDCAz.SetAxis(nbins, min, max); +} + +void HalCbmBasicTrackCuts::SetDCAMonitorXYAxis(Int_t nbins, Double_t min, Double_t max) +{ + fDCAxy.SetAxis(nbins, min, max); +} + +HalCbmTofCut* HalCbmBasicTrackCuts::GetTofCut() const { return (HalCbmTofCut*) this->CutAt(7); } + +void HalCbmBasicTrackCuts::AcceptOnlyWithTofHit(Bool_t val) +{ + if (val) + GetTofCut()->AcceptTracksOnlyWithToF(); + else + GetTofCut()->SetMinMax(0, 1, 1); +} + +HalCbmBasicTrackCuts::~HalCbmBasicTrackCuts() {} + +void HalCbmBasicTrackCuts::SetChi2(Double_t min, Double_t max) { GetChi2Cut()->SetMinMax(min, max); }; diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmBasicTrackCuts.h b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmBasicTrackCuts.h new file mode 100644 index 0000000000000000000000000000000000000000..bbb740fbd6b82cc2f84b4d938ba7a3ac47511c46 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmBasicTrackCuts.h @@ -0,0 +1,77 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMBASICTRACKCUT_H_ +#define CBMBASICTRACKCUT_H_ + +#include <Rtypes.h> +#include <RtypesCore.h> + +#include <Hal/CutMonitorRequest.h> +#include <Hal/CutsAndMonitors.h> + +namespace Hal +{ + class TrackPCut; + class TrackChargeCut; + class TrackChi2Cut; + class TrackPtCut; + class TrackEtaCut; + class TrackDCACut; +} // namespace Hal + +class HalCbmTofCut; +class HalCbmHalCbmNHitsCut; +class HalCbmNHitsCut; + +/**collection of basic cuts and cut monitors for track in AnaTree format **/ + +class HalCbmBasicTrackCuts : public Hal::CutsAndMonitors { + + Hal::TrackChargeCut* GetChargeCut() const; + HalCbmNHitsCut* GetNHitsCut() const; + Hal::TrackChi2Cut* GetChi2Cut() const; + Hal::TrackPCut* GetPCut() const; + Hal::TrackPtCut* GetPtCut() const; + Hal::TrackEtaCut* GetEtaCut() const; + Hal::TrackDCACut* GetDCACut() const; + Hal::CutMonAxisConf fKinPt; + Hal::CutMonAxisConf fKinEta; + Hal::CutMonAxisConf fTofP; + Hal::CutMonAxisConf fTofM2; + Hal::CutMonAxisConf fHits; + Hal::CutMonAxisConf fHitsSts; + Hal::CutMonAxisConf fChi2; + Hal::CutMonAxisConf fDCAxy; + Hal::CutMonAxisConf fDCAz; + + protected: + virtual void AddAllCutMonitorRequests(Option_t* opt); + + public: + HalCbmBasicTrackCuts(); + void SetCharge(Int_t charge); + void SetChi2(Double_t min, Double_t max); + void SetNHits(Int_t min, Int_t max); + void SetNMvdHits(Int_t min, Int_t max); + void SetNStsHits(Int_t min, Int_t max); + void SetNTrdHits(Int_t min, Int_t max); + void SetPt(Double_t min, Double_t max); + void SetEta(Double_t min, Double_t max); + void AcceptOnlyWithTofHit(Bool_t val); + void SetM2(Double_t min, Double_t max); + void SetDCAXY(Double_t min, Double_t max); + void SetDCAZ(Double_t min, Double_t max); + void SetTofMonitorPAxis(Int_t nbins, Double_t min, Double_t max); + void SetTofMonitorM2Axis(Int_t nbins, Double_t min, Double_t max); + void SetPtEtaMonitorPtAxis(Int_t nbins, Double_t min, Double_t max); + void SetPtEtaMonitorEtaAxis(Int_t nbins, Double_t min, Double_t max); + void SetNHitsMonitorAxis(Int_t nbins, Double_t min, Double_t max); + void SetChi2MonitorAxis(Int_t nbins, Double_t min, Double_t max); + void SetDCAMonitorZAxis(Int_t nbins, Double_t min, Double_t max); + void SetDCAMonitorXYAxis(Int_t nbins, Double_t min, Double_t max); + HalCbmTofCut* GetTofCut() const; + virtual ~HalCbmBasicTrackCuts(); + ClassDef(HalCbmBasicTrackCuts, 1) +}; +#endif /* CBMBASICTRACKCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmNHitsCut.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmNHitsCut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..94309a0d714f1837076b937ffdc29e677e664daa --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmNHitsCut.cxx @@ -0,0 +1,28 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmNHitsCut.h" + +#include "HalCbmTrack.h" + +HalCbmNHitsCut::HalCbmNHitsCut() : Hal::TrackExpCut(4) +{ + SetUnitName("N_{hits}", 0); + SetUnitName("N_{hits MVD}", 1); + SetUnitName("N_{hits STS}", 2); + SetUnitName("N_{hits TRD}", 3); +} + +Bool_t HalCbmNHitsCut::Init(Int_t task_id) { return FormatInhertis("HalCbmEvent", task_id); } + +Bool_t HalCbmNHitsCut::Pass(Hal::Track* track) +{ + HalCbmTrack* tr = (HalCbmTrack*) track; + SetValue(tr->GetNHits(), 0); + SetValue(tr->GetNMvdHits(), 1); + SetValue(tr->GetNStsHits(), 2); + SetValue(tr->GetNTrdHits(), 3); + return Validate(); +} + +HalCbmNHitsCut::~HalCbmNHitsCut() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmNHitsCut.h b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmNHitsCut.h new file mode 100644 index 0000000000000000000000000000000000000000..0a0af433415a3b3f71ba87f06df459cdac98f2bc --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmNHitsCut.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMNHITSCUT_H_ +#define CBMNHITSCUT_H_ + +#include <Rtypes.h> +#include <RtypesCore.h> + +#include <Hal/TrackExpCut.h> + +namespace Hal +{ + class Track; +} /* namespace Hal */ + +/** + * set cut on number of hits + * 0 - total number of hits (MVD + STS + TRD) + * 1 - MVD hits + * 2 - STS hits + * 3 - TRD hits + */ +class HalCbmNHitsCut : public Hal::TrackExpCut { + public: + HalCbmNHitsCut(); + void SetNTotalHits(Int_t min, Int_t max) { SetMinMax(min, max, 0); }; + void SetNMvdHits(Int_t min, Int_t max) { SetMinMax(min, max, 1); }; + void SetNStsHits(Int_t min, Int_t max) { SetMinMax(min, max, 2); }; + void SetNTrdHits(Int_t min, Int_t max) { SetMinMax(min, max, 3); }; + virtual Bool_t Init(Int_t task_id); + virtual Bool_t Pass(Hal::Track* track); + virtual ~HalCbmNHitsCut(); + ClassDef(HalCbmNHitsCut, 1) +}; +#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_ANATREECUTS_TRACK_CBMNHITSCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofCut.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofCut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fba8790396f12c69a9f757e8899fb47c8f68cedb --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofCut.cxx @@ -0,0 +1,35 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmTofCut.h" + +#include "Hal/Std.h" +#include "HalCbmTrack.h" + +HalCbmTofCut::HalCbmTofCut() : Hal::TrackToFMass2Cut(2) { SetUnitName("Flag [AU]", 1); } + +Bool_t HalCbmTofCut::Init(Int_t task_id) +{ + if (FormatInhertis("HalCbmEvent", task_id, Hal::EFormatDepth::kNonBuffered)) return kTRUE; + return kFALSE; +} + +Bool_t HalCbmTofCut::Pass(Hal::Track* track) +{ + HalCbmTrack* reco = (HalCbmTrack*) track; + Hal::ToFTrack* tof = reco->GetTofTrack(); + SetValue(tof->GetFlag(), Flag()); + SetValue(tof->GetMass2(), M2()); + Double_t m2 = tof->GetMass2(); + Double_t p = reco->GetMomentum().P(); + SetValue(m2, 0); + SetValue(tof->GetFlag(), 1); + Double_t min = fLowLine[0] + fLowLine[1] * p + fLowLine[2] * p * p; + Double_t max = fHighLine[0] + fHighLine[1] * p + fHighLine[2] * p * p; + if (m2 > max || m2 < min) { + return ForcedUpdate(kFALSE); + } + return Validate(); +} + +HalCbmTofCut::~HalCbmTofCut() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofCut.h b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofCut.h new file mode 100644 index 0000000000000000000000000000000000000000..d62ee960b0cb92d78bd95d34c1ee6dfcd21a3e57 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofCut.h @@ -0,0 +1,22 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMTOFCUT_H_ +#define CBMTOFCUT_H_ +#include "Hal/TrackToFMass2Cut.h" + + +class HalCbmTofCut : public Hal::TrackToFMass2Cut { + public: + HalCbmTofCut(); + void AcceptTracksWithoutTof() { SetMinMax(0, 1, 1); }; + void AcceptTracksOnlyWithToF() { SetMinMax(1, 1, 1); }; + static Int_t Flag() { return 1; }; + static Int_t M2() { return 0; }; + virtual Bool_t Init(Int_t task_id); + virtual Bool_t Pass(Hal::Track* track); + virtual ~HalCbmTofCut(); + ClassDef(HalCbmTofCut, 1) +}; + +#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_ANATREECUTS_TRACK_CBMTOFCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofM2PolyCut.cxx b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofM2PolyCut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0a07c27b5ea45b060a6ae4307e94c0074357c1d6 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofM2PolyCut.cxx @@ -0,0 +1,25 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmTofM2PolyCut.h" + +#include "HalCbmDetectorID.h" + +#include <Hal/Cut.h> +#include <Hal/ExpTrack.h> +#include <Hal/Track.h> + + +HalCbmTofM2PolyCut::HalCbmTofM2PolyCut() {} + +Bool_t HalCbmTofM2PolyCut::Pass(Hal::Track* track) +{ + Hal::ToFTrack* tof = (Hal::ToFTrack*) static_cast<Hal::ExpTrack*>(track)->GetDetTrack(HalCbm::DetectorID::kTOF); + if (tof->GetFlag() == 0) { + SetValue(Hal::ToFTrack::DummyVal()); + } + SetValue(tof->GetMass2()); + return Validate(); +} + +HalCbmTofM2PolyCut::~HalCbmTofM2PolyCut() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofM2PolyCut.h b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofM2PolyCut.h new file mode 100644 index 0000000000000000000000000000000000000000..de711a1401f0c91a8944ee0a53bf1789a98c7948 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/cuts/track/HalCbmTofM2PolyCut.h @@ -0,0 +1,21 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef COMMONCUTS_TRACK_CBMTOFM2POLYCUT_H_ +#define COMMONCUTS_TRACK_CBMTOFM2POLYCUT_H_ + +#include <Hal/TrackToFMass2Cut.h> + +namespace Hal +{ + class Track; +} + +class HalCbmTofM2PolyCut : public Hal::TrackToFMass2Cut { + public: + HalCbmTofM2PolyCut(); + Bool_t Pass(Hal::Track* track); + virtual ~HalCbmTofM2PolyCut(); + ClassDef(HalCbmTofM2PolyCut, 1) +}; +#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_COMMONCUTS_TRACK_CBMTOFM2POLYCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/hal/format/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..28e89c3e7ab19207af7e9f33103f9a4cc5067200 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/CMakeLists.txt @@ -0,0 +1,69 @@ +# Create a library called "" which includes the source files given in +# the array . +# The extension is already found. Any number of sources could be listed here. +Set(INCLUDE_DIRECTORIES + ${BASE_INCLUDE_DIRECTORIES} + ${CMAKE_SOURCE_FAIRMCSTACK} + ${KF_HEADERS} + ${CBMROOT_SOURCE_DIR}/sim/transport/generators/unigen + ${CBMROOT_SOURCE_DIR}/core/data + ${HAL_CBM}/helpers + ${HAL_CBM}/helpers/anatree + ${HAL_CBM_FORMAT} + ${AnalysisTree_INCLUDE_DIR} + ${Hal_INCLUDE_DIR} +) +Set(SYSTEM_INCLUDE_DIRECTORIES + ${ROOT_INCLUDE_DIR} + ${CLHEP_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} +) + +Include_Directories(${INCLUDE_DIRECTORIES}) +Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES}) + +# List of source files +set(SRCS + + +HalCbmFormatTypes.cxx + +combined/HalCbmFullEvent.cxx +combined/HalCbmHbtFullEvent.cxx + +unigen/CbmUnigenSource.cxx +unigen/HalCbmUnigenEvent.cxx +unigen/HalCbmUnigenEventInterface.cxx +unigen/HalCbmUnigenTrack.cxx +unigen/HalCbmUnigenTrackInterface.cxx + +anatree/mc/HalCbmMCEvent.cxx +anatree/mc/HalCbmMCEventInterface.cxx +anatree/mc/HalCbmMCTrack.cxx +anatree/mc/HalCbmMCTrackInterface.cxx +anatree/reco/HalCbmEvent.cxx +anatree/reco/HalCbmEventInterface.cxx +anatree/reco/HalCbmTrack.cxx +anatree/reco/HalCbmTrackInterface.cxx +anatree/femto/HalCbmHbtTrack.cxx +anatree/femto/HalCbmHbtEvent.cxx + +) + +Set(HEADERS ) +Set(LINKDEF HalCbmFormatLinkDef.h) +Set(LIBRARY_NAME HalCbmFormat) + +Set(PUBLIC_DEPENDENCIES + ${_AnalysisTree_LIB} + CbmData + HalFeatures + HalData + HalCbmHelpers + CbmSimGenerators + ROOT::Tree + ) + +generate_cbm_library() + +add_dependencies(G__HalCbmFormat ANALYSISTREE HAL) diff --git a/analysis/PWGC2F/femtoscopy/hal/format/HalCbmFormatLinkDef.h b/analysis/PWGC2F/femtoscopy/hal/format/HalCbmFormatLinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..012a9623b96c32780c29d9e2b15a88047584c195 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/HalCbmFormatLinkDef.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ enum HalCbm::Formats; + +#pragma link C++ class HalCbmHbtFullEvent + ; +#pragma link C++ class HalCbmFullEvent + ; +#pragma link C++ class HalCbmHbtEvent + ; +#pragma link C++ class HalCbmHbtTrack + ; + +#pragma link C++ class HalCbmUnigenEvent + ; +#pragma link C++ class HalCbmUnigenEventInterface + ; +#pragma link C++ class CbmUnigenSource + ; +#pragma link C++ class HalCbmUnigenTrack + ; +#pragma link C++ class HalCbmUnigenTrackInterface + ; + +#pragma link C++ class HalCbmMCEvent + ; +#pragma link C++ class HalCbmMCEventInterface + ; +#pragma link C++ class HalCbmMCTrack + ; +#pragma link C++ class HalCbmMCTrackInterface + ; + +#pragma link C++ class HalCbmEvent + ; +#pragma link C++ class HalCbmEventInterface + ; +#pragma link C++ class HalCbmTrack + ; +#pragma link C++ class HalCbmTrackInterface + ; diff --git a/analysis/PWGC2F/femtoscopy/hal/format/HalCbmFormatTypes.cxx b/analysis/PWGC2F/femtoscopy/hal/format/HalCbmFormatTypes.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ae3e2b793636c5ad65529a8029bea1549d0fd1e3 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/HalCbmFormatTypes.cxx @@ -0,0 +1,25 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmFormatTypes.h" + +#include <Hal/DataFormatManager.h> +#include <Hal/Event.h> +#include <Hal/Std.h> + + +namespace HalCbm +{ + + EFormatType GetFormatType(Int_t task_id, Hal::EFormatDepth depth) + { + const Hal::Event* ev = Hal::DataFormatManager::Instance()->GetFormat(task_id, depth); + if (ev->InheritsFrom("HalCbmEvent")) { + return EFormatType::kAnaTree; + } + else if (ev->InheritsFrom("HalCbmHbtEvent")) { + return EFormatType::kHbt; + } + return EFormatType::kUnknown; + } +} // namespace HalCbm diff --git a/analysis/PWGC2F/femtoscopy/hal/format/HalCbmFormatTypes.h b/analysis/PWGC2F/femtoscopy/hal/format/HalCbmFormatTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..798448d90ce6ca8ced0d45d6997761bf281a0054 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/HalCbmFormatTypes.h @@ -0,0 +1,23 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMFORMATTYPES_H_ +#define CBMFORMATTYPES_H_ + +#include <Hal/DataFormatManager.h> +#include <Hal/Std.h> + +namespace HalCbm +{ + + enum class EFormatType + { + kAnaTree, + kHbt, + kUnknown + }; + EFormatType GetFormatType(Int_t task_id, Hal::EFormatDepth depht = Hal::EFormatDepth::kAll); + +} // namespace HalCbm + +#endif /* CBMFORMATTYPES_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtEvent.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtEvent.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ebc74a2fef41c2a2c6d65c8122da2b1cd273515f --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtEvent.cxx @@ -0,0 +1,19 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmHbtEvent.h" + +#include "HalCbmEvent.h" +#include "HalCbmHbtTrack.h" + +HalCbmHbtEvent::HalCbmHbtEvent() : Hal::ExpEvent("HalCbmHbtTrack") {} + +Bool_t HalCbmHbtEvent::IsCompatible(const Hal::Event* non_buffered) const +{ + if (non_buffered->InheritsFrom("HalCbm::HalCbmEvent")) return kTRUE; + return kFALSE; +} + +HalCbmHbtEvent::~HalCbmHbtEvent() {} + +Hal::EventInterface* HalCbmHbtEvent::CreateInterface() const { return nullptr; } diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtEvent.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..4e40ba19f57e4bedb923421ac2738c8fe599a6f9 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtEvent.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMHBTEVENT_H_ +#define CBMHBTEVENT_H_ + +#include <Hal/Event.h> +#include <Hal/ExpEvent.h> +/** + * class for HBT analysis, note: CAN BE USED ONLY AS BUFFERED EVENT! + */ + +namespace Hal +{ + class EventInterface; +} + +class HalCbmHbtEvent : public Hal::ExpEvent { + protected: + public: + HalCbmHbtEvent(); + virtual Hal::EventInterface* CreateInterface() const; + virtual Bool_t IsCompatible(const Hal::Event* non_buffered) const; + virtual Hal::Event* GetNewEvent() const { return new HalCbmHbtEvent(); }; + virtual ~HalCbmHbtEvent(); + ClassDef(HalCbmHbtEvent, 1) +}; +#endif /* CBMHBTEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtTrack.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtTrack.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e6982cb1468d43d0ac3d4c11a0316a3a5e0eecfe --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtTrack.cxx @@ -0,0 +1,67 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmHbtTrack.h" + +#include "HalCbmHbtEvent.h" +#include "HalCbmTrack.h" + +#include <Hal/Event.h> + + +HalCbmHbtTrack::HalCbmHbtTrack() : Hal::ExpTrack(), fHelix(CbmHelix()), fR(-1) {} + +HalCbmHbtTrack::~HalCbmHbtTrack() {} + +HalCbmHbtTrack::HalCbmHbtTrack(const HalCbmHbtTrack& other) : Hal::ExpTrack(other) +{ + fHelix = other.fHelix; + fR = other.fR; + for (int i = 0; i < 9; i++) { + fPosAt[i] = other.fPosAt[i]; + fMomAt[i] = other.fMomAt[i]; + } + fPosAtCustom = other.fPosAtCustom; + fMomAtCustom = other.fMomAtCustom; +} + +HalCbmHbtTrack& HalCbmHbtTrack::operator=(const HalCbmHbtTrack& other) +{ + if (this == &other) return *this; + Hal::ExpTrack::operator=(other); + fHelix = other.fHelix; + fR = other.fR; + for (int i = 0; i < 9; i++) { + fPosAt[i] = other.fPosAt[i]; + fMomAt[i] = other.fMomAt[i]; + } + fPosAtCustom = other.fPosAtCustom; + fMomAtCustom = other.fMomAtCustom; + return *this; +} + +void HalCbmHbtTrack::CopyData(Hal::Track* other) +{ + Hal::ExpTrack::CopyData(other); + fHelix = ((HalCbmTrack*) other)->GetHelix(); + Double_t x = GetEvent()->GetVertex()->X(); + Double_t y = GetEvent()->GetVertex()->Y(); + Double_t z = GetEvent()->GetVertex()->Z(); + const Double_t R[9] = {20, 30, 40, 50, 60, 70, 80, 90, 100}; + for (int i = 0; i < 9; i++) { + fPosAt[i] = fHelix.Eval(R[i] + z, fMomAt[i]); + fPosAt[i] -= TVector3(x, y, z); + } + fR = -1; +} + +void HalCbmHbtTrack::CalculateAtR(Double_t R) +{ + if (fR == R) return; + Double_t x = GetEvent()->GetVertex()->X(); + Double_t y = GetEvent()->GetVertex()->Y(); + Double_t z = GetEvent()->GetVertex()->Z(); + fPosAtCustom = GetHelix().Eval(z + R, fMomAtCustom); + fPosAtCustom -= TVector3(x, y, z); + fR = R; +} diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtTrack.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtTrack.h new file mode 100644 index 0000000000000000000000000000000000000000..70c9480103f1b0cf252fb4a0bb68a02546e34b82 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/femto/HalCbmHbtTrack.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMHBTTRACK_H_ +#define CBMHBTTRACK_H_ + +#include "CbmHelix.h" + +#include <TVector3.h> + +#include <Hal/ExpTrack.h> + +namespace Hal +{ + class Track; +} + +class HalCbmHbtTrack : public Hal::ExpTrack { + TVector3 fPosAt[9]; + TVector3 fMomAt[9]; + TVector3 fPosAtCustom; + TVector3 fMomAtCustom; + CbmHelix fHelix; + Double_t fR; + + public: + HalCbmHbtTrack(); + inline const TVector3& GetPosAtMiddle() const { return fPosAt[3]; }; + inline const TVector3& GetPosAtStsEntrance() const { return fPosAt[1]; }; + inline const TVector3& GetPosAtStsExit() const { return fPosAt[8]; }; + inline const TVector3& GetPosAtCustom() const { return fPosAtCustom; } + inline const TVector3& GetPosAtPlane(Int_t plane) const { return fPosAt[plane]; } + inline const TVector3& GetMomAtMiddle() const { return fMomAt[3]; }; + inline const TVector3& GetMomAtStsEntrance() const { return fMomAt[1]; }; + inline const TVector3& GetMomAtStsExit() const { return fMomAt[8]; }; + inline const TVector3& GetMomAtCustom() const { return fMomAtCustom; } + inline const TVector3& GetMomAtPlane(Int_t plane) const { return fMomAt[plane]; } + + CbmHelix& GetHelix() { return fHelix; }; + void CalculateAtR(Double_t R); + virtual void CopyData(Hal::Track* other); + HalCbmHbtTrack(const HalCbmHbtTrack& other); + HalCbmHbtTrack& operator=(const HalCbmHbtTrack& other); + virtual ~HalCbmHbtTrack(); + ClassDef(HalCbmHbtTrack, 1) +}; + +#endif /* CBMHBTTRACK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEvent.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEvent.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bb86515bcc80ba91d9518d065c2a81e58a30a439 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEvent.cxx @@ -0,0 +1,121 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmMCEvent.h" + +#include "AnalysisTree/EventHeader.hpp" +#include "AnalysisTree/Particle.hpp" +#include "CbmAnaTreeSource.h" +#include "CbmMCTrack.h" +#include "HalCbmMCEventInterface.h" +#include "HalCbmMCTrack.h" + +#include <FairMCEventHeader.h> + +HalCbmMCEvent::HalCbmMCEvent() : Hal::McEvent("HalCbmMCTrack") {} + +HalCbmMCEvent::HalCbmMCEvent(const HalCbmMCEvent& other) : Hal::McEvent(other) {} + +void HalCbmMCEvent::Update(Hal::EventInterface* interface) +{ + HalCbmMCEventInterface* s = static_cast<HalCbmMCEventInterface*>(interface); + fTotalTracksNo = s->GetTotalTrackNo(); + fTracks->Clear(); + fTracks->ExpandCreateFast(fTotalTracksNo); + switch (s->fFormatType) { + case HalCbm::DataFormat::kAnalysisTree: { + UpdateAnalysisTree(s); + } break; + case HalCbm::DataFormat::kDST: { + UpdateDst(s); + } break; + case HalCbm::DataFormat::kUnknown: { + //Do nothing + } break; + } +} + +Bool_t HalCbmMCEvent::ExistInTree() const +{ + Bool_t exist = CheckBranches(1, "CbmAnaTreeMcSourceContainer."); + Bool_t exist2 = CheckBranches(1, "CbmMCTrack"); + if (exist || exist2) return kTRUE; + return kFALSE; +} + +HalCbmMCEvent::~HalCbmMCEvent() {} + +void HalCbmMCEvent::ShallowCopyTracks(Hal::Event* event) +{ + fTracks->Clear(); + Hal::McEvent* mc_event = (Hal::McEvent*) event; + fTotalTracksNo = mc_event->GetTotalTrackNo(); + for (int i = 0; i < fTotalTracksNo; i++) { + Hal::McTrack* to = (Hal::McTrack*) fTracks->ConstructedAt(i); + Hal::McTrack* from = (Hal::McTrack*) mc_event->GetTrack(i); + to->ResetTrack(i, this); + to->CopyData(from); + } +} + +void HalCbmMCEvent::UpdateAnalysisTree(Hal::EventInterface* source) +{ + HalCbmMCEventInterface* s = static_cast<HalCbmMCEventInterface*>(source); + CbmAnaTreeMcSourceContainer* data = (CbmAnaTreeMcSourceContainer*) s->GetRawEventPointer(); + AnaTreeMcIds conf = data->GetFieldIds(); + Bool_t UseFreez = kTRUE; + if (conf.freezX == AnalysisTree::UndefValueShort) { + UseFreez = kFALSE; + } + fB = data->GetEventHeader()->GetField<Float_t>(conf.event_b); + fPhi = data->GetEventHeader()->GetField<Float_t>(conf.event_psi); + + for (int i = 0; i < fTotalTracksNo; i++) { + HalCbmMCTrack* track = (HalCbmMCTrack*) fTracks->UncheckedAt(i); + track->ResetTrack(i, this); + AnalysisTree::Particle particle = data->GetParticles()->GetChannel(i); + Double_t px = particle.GetField<float>(conf.px); + Double_t py = particle.GetField<float>(conf.py); + Double_t pz = particle.GetField<float>(conf.pz); + Double_t mass = particle.GetField<float>(conf.mass); + + Int_t mother_id = particle.GetField<int>(conf.motherId); + Int_t pid = particle.GetField<int>(conf.pdg); + Double_t e = TMath::Sqrt(px * px + py * py + pz * pz + mass * mass); + track->SetMomentum(px, py, pz, e); + track->SetPdg(pid); + if (UseFreez) { + Double_t x = particle.GetField<float>(conf.freezX); + Double_t y = particle.GetField<float>(conf.freezY); + Double_t z = particle.GetField<float>(conf.freezZ); + Double_t t = particle.GetField<float>(conf.freezT); + track->SetFreezoutPosition(x, y, z, t); + } + + if (mother_id == -1) { + track->SetPrimary(); + } + else { + track->SetMotherIndex(track->GetMotherIndex()); + } + track->SetCharge(CalculateCharge(pid)); + } +} + +void HalCbmMCEvent::UpdateDst(Hal::EventInterface* source) +{ + HalCbmMCEventInterface* s = static_cast<HalCbmMCEventInterface*>(source); + TClonesArray* mcTracks = s->fCbmMCtracks; + fB = s->fEventHeader->GetB(); + for (int i = 0; i < fTotalTracksNo; i++) { + HalCbmMCTrack* track = (HalCbmMCTrack*) fTracks->UncheckedAt(i); + track->ResetTrack(i, this); + CbmMCTrack* mc = (CbmMCTrack*) mcTracks->UncheckedAt(i); + track->SetMomentum(mc->GetPx(), mc->GetPy(), mc->GetPz(), mc->GetEnergy()); + track->SetMotherIndex(mc->GetMotherId()); + track->SetPdg(mc->GetPdgCode()); + track->SetCharge(mc->GetCharge()); + } +} + +Hal::EventInterface* HalCbmMCEvent::CreateInterface() const { return new HalCbmMCEventInterface(); } diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEvent.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..4750b981df5a65137af89e36ec3fc6e0845a098d --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEvent.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICACBMATMCEVENT_H_ +#define NICACBMATMCEVENT_H_ + +#include <Hal/McEvent.h> +namespace Hal +{ + class EventInterface; +} +class HalCbmMCEvent : public Hal::McEvent { + + protected: + virtual void ShallowCopyTracks(Hal::Event* event); + void UpdateAnalysisTree(Hal::EventInterface* interface); + void UpdateDst(Hal::EventInterface* interface); + + public: + HalCbmMCEvent(); + HalCbmMCEvent(const HalCbmMCEvent& other); + virtual void Update(Hal::EventInterface* interface); + virtual Hal::EventInterface* CreateInterface() const; + virtual Hal::Event* GetNewEvent() const { return new HalCbmMCEvent(); }; + virtual Bool_t ExistInTree() const; + virtual TString GetFormatName() const { return "CbmMCEvent"; }; + virtual ~HalCbmMCEvent(); + ClassDef(HalCbmMCEvent, 1) +}; + +#endif /* NICACBMATMCEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEventInterface.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEventInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2b0242885dd46d941ba9d7f7c37eec623ee91195 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEventInterface.cxx @@ -0,0 +1,97 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmMCEventInterface.h" + +#include "CbmAnaTreeContainer.h" +#include "HalCbmDetectorID.h" + +#include <FairMCEventHeader.h> + +#include <Hal/DataManager.h> +#include <Hal/Event.h> +#include <Hal/EventInterface.h> + + +HalCbmMCEventInterface::HalCbmMCEventInterface() {} + +void HalCbmMCEventInterface::Register(Bool_t write) +{ + Hal::DataManager* manager = Hal::DataManager::Instance(); + switch (fFormatType) { + case HalCbm::DataFormat::kAnalysisTree: { + manager->Register("CbmAnaTreeMcSourceContainer.", "CbmAnaTreeMcSourceContainer.", fDataContainer, write); + } break; + case HalCbm::DataFormat::kDST: { + manager->Register("CbmMCTrack", "Tracks", fCbmMCtracks, write); + manager->Register("MCEventHeader", "Tracks", fEventHeader, write); + if (fStsMatches) manager->Register("StsTrackMatch", "Tracks", fStsMatches, write); + if (fTofMatches) manager->Register("TofHitMatch", "Tracks", fTofMatches, write); + if (fTrdMatches) manager->Register("TrdTrackMatch", "Tracks", fTrdMatches, write); + if (fRichMatches) manager->Register("RichRingMatch", "Tracks", fRichMatches, write); + if (fMuchMatches) manager->Register("MuchTrackMatch", "Tracks", fMuchMatches, write); + } break; + case HalCbm::DataFormat::kUnknown: { + // DO nothing + } break; + } +} + +void HalCbmMCEventInterface::FillTrackInterface(Hal::TrackInterface* /*track*/, Int_t /*index*/) {} + +Int_t HalCbmMCEventInterface::GetTotalTrackNo() const +{ + switch (fFormatType) { + case HalCbm::DataFormat::kAnalysisTree: { + return fDataContainer->GetParticles()->GetNumberOfChannels(); + } break; + case HalCbm::DataFormat::kDST: { + return fCbmMCtracks->GetEntriesFast(); + } break; + case HalCbm::DataFormat::kUnknown: { + // DO nothing + } break; + } + return 0; +} + +TObject* HalCbmMCEventInterface::GetRawTrackPointer(Int_t /*index*/) const { return nullptr; } + +TLorentzVector HalCbmMCEventInterface::GetVertexError() const { return TLorentzVector(0, 0, 0, 0); } + +TLorentzVector HalCbmMCEventInterface::GetVertex() const +{ + switch (fFormatType) { + case HalCbm::DataFormat::kAnalysisTree: { + AnalysisTree::EventHeader* header = fDataContainer->GetEventHeader(); + return TLorentzVector(header->GetVertexX(), header->GetVertexY(), header->GetVertexZ(), 0); + } break; + case HalCbm::DataFormat::kDST: { + return TLorentzVector(fEventHeader->GetX(), fEventHeader->GetY(), fEventHeader->GetZ(), fEventHeader->GetT()); + } break; + case HalCbm::DataFormat::kUnknown: { + // DO nothing + } break; + } + return TLorentzVector(0, 0, 0, 0); +} + +HalCbmMCEventInterface::~HalCbmMCEventInterface() {} + +void HalCbmMCEventInterface::ConnectToTreeInternal(eMode /*mode*/) +{ + Hal::DataManager* manager = Hal::DataManager::Instance(); + fDataContainer = (CbmAnaTreeMcSourceContainer*) manager->GetObject("CbmAnaTreeMcSourceContainer."); + if (fDataContainer) { + fFormatType = HalCbm::DataFormat::kAnalysisTree; + } + else { + fCbmMCtracks = (TClonesArray*) manager->GetObject("CbmMCTrack"); + fEventHeader = (FairMCEventHeader*) manager->GetObject("MCEventHeader"); + fStsMatches = (TClonesArray*) manager->GetObject("StsTrackMatch"); + fTofMatches = (TClonesArray*) manager->GetObject("TofHitMatch"); + fTrdMatches = (TClonesArray*) manager->GetObject("TrdTrackMatch"); + fRichMatches = (TClonesArray*) manager->GetObject("RichRingMatch"); + fMuchMatches = (TClonesArray*) manager->GetObject("MuchTrackMatch"); + } +} diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEventInterface.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEventInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..04ecbd8512ef00aafde24d59d4d19c0a0c1d28c1 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCEventInterface.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICACBMATMCEVENTINTERFACE_H_ +#define NICACBMATMCEVENTINTERFACE_H_ + +#include "CbmAnaTreeContainer.h" +#include "HalCbmDetectorID.h" +#include "HalCbmMCTrackInterface.h" + +#include <TVector3.h> + +#include <Hal/EventInterface.h> + +class TClonesArray; +class FairMCEventHeader; +class CbmAnaTreeMcSourceContainer; +class HalCbmFullEvent; + +class HalCbmMCEventInterface : public Hal::EventInterface { + friend class HalCbmMCEvent; + friend class HalCbmFullEvent; + + protected: + HalCbm::DataFormat fFormatType = {HalCbm::DataFormat::kUnknown}; + CbmAnaTreeMcSourceContainer* fDataContainer = {nullptr}; + FairMCEventHeader* fEventHeader = {nullptr}; + TClonesArray* fCbmMCtracks = {nullptr}; + TClonesArray* fStsMatches = {nullptr}; + TClonesArray* fTofMatches = {nullptr}; + TClonesArray* fTrdMatches = {nullptr}; + TClonesArray* fRichMatches = {nullptr}; + TClonesArray* fMuchMatches = {nullptr}; + virtual void ConnectToTreeInternal(eMode mode); + + void Register(Bool_t write); + + public: + HalCbmMCEventInterface(); + virtual void FillTrackInterface(Hal::TrackInterface* track, Int_t index); + virtual Int_t GetTotalTrackNo() const; + virtual TObject* GetRawEventPointer() const { return fDataContainer; }; + virtual Hal::TrackInterface* GetTrackInterface() const { return new HalCbmMCTrackInterface(); } + virtual TObject* GetRawTrackPointer(Int_t index) const; + /** GETTERS AND SETTERS **/ + virtual void SetRunInfoId(Int_t /*i*/){}; + virtual Int_t GetRunInfoId() const { return 0; }; + virtual void SetMagneticField(TVector3 /*mag*/) const {}; + virtual TVector3 GetMagneticField() const { return TVector3(0, 0, 0); }; + virtual TLorentzVector GetVertexError() const; + virtual TLorentzVector GetVertex() const; + virtual ~HalCbmMCEventInterface(); + ClassDef(HalCbmMCEventInterface, 1) +}; +#endif /* NICACBMATMCEVENTINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrack.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrack.cxx new file mode 100644 index 0000000000000000000000000000000000000000..df884fef8c8ef526169f0f0e246490650cd67bec --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrack.cxx @@ -0,0 +1,8 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmMCTrack.h" + +HalCbmMCTrack::HalCbmMCTrack() {} + +HalCbmMCTrack::~HalCbmMCTrack() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrack.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrack.h new file mode 100644 index 0000000000000000000000000000000000000000..0d4f3e366f160a8e0d4374a4d699b3f251db6d7d --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrack.h @@ -0,0 +1,14 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICACBMATMCTRACK_H_ +#define NICACBMATMCTRACK_H_ + +#include <Hal/McTrack.h> +class HalCbmMCTrack : public Hal::McTrack { + public: + HalCbmMCTrack(); + virtual ~HalCbmMCTrack(); + ClassDef(HalCbmMCTrack, 1) +}; +#endif /* NICACBMATMCTRACK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrackInterface.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrackInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a9a7c3b3979f2bc58c7426d13889f0950c74facc --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrackInterface.cxx @@ -0,0 +1,8 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmMCTrackInterface.h" + +HalCbmMCTrackInterface::HalCbmMCTrackInterface() {} + +HalCbmMCTrackInterface::~HalCbmMCTrackInterface() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrackInterface.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrackInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..f6b05342249caef92fd009c8f08b6cde82fcce6f --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/mc/HalCbmMCTrackInterface.h @@ -0,0 +1,17 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICACBMATMMCTRACKINTERFACE_H_ +#define NICACBMATMMCTRACKINTERFACE_H_ + +#include <Hal/McTrackInterface.h> + + +class HalCbmMCTrackInterface : public Hal::McTrackInterface { + public: + HalCbmMCTrackInterface(); + virtual ~HalCbmMCTrackInterface(); + ClassDef(HalCbmMCTrackInterface, 1) +}; + +#endif /* NICACBMATMMCTRACKINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEvent.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEvent.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bc0cd90608521721bd3ba06b47a5f668e8e60528 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEvent.cxx @@ -0,0 +1,153 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmEvent.h" + +#include "CbmAnaTreeContainer.h" +#include "CbmGlobalTrack.h" +#include "CbmTofHit.h" +#include "HalCbmEventInterface.h" +#include "HalCbmTrack.h" + +#include <TLorentzVector.h> +#include <TMath.h> + +#include <AnalysisTree/Constants.hpp> +#include <AnalysisTree/Matching.hpp> + +#include <Hal/DataFormat.h> +#include <Hal/Event.h> +#include <Hal/ExpEvent.h> + +HalCbmEvent::HalCbmEvent() : Hal::ExpEvent("HalCbmTrack") {} + +HalCbmEvent::HalCbmEvent(const HalCbmEvent& other) : Hal::ExpEvent(other) {} + +void HalCbmEvent::Update(Hal::EventInterface* interface) +{ + fTracks->Clear(); + HalCbmEventInterface* source = (HalCbmEventInterface*) interface; + + switch (source->fFormatType) { + case HalCbm::DataFormat::kAnalysisTree: { + UpdateAnaTree(source); + } break; + case HalCbm::DataFormat::kDST: { + UpdateDST(source); + } break; + default: break; + } +} + +HalCbmEvent::HalCbmEvent(TString classname) : Hal::ExpEvent(classname) {} + +HalCbmEvent::~HalCbmEvent() {} + +Bool_t HalCbmEvent::ExistInTree() const +{ + Bool_t exist = CheckBranches(1, "CbmAnaTreeSourceContainer."); + Bool_t exist2 = CheckBranches(1, "GlobalTrack"); + if (exist || exist2) return kTRUE; + return kFALSE; +} + +void HalCbmEvent::UpdateDST(HalCbmEventInterface* ei) +{ + fTotalTracksNo = ei->GetTotalTrackNo(); + TLorentzVector start = ei->GetVertex(); + fVertex->SetXYZT(start.X(), start.Y(), start.Z(), start.T()); + fTracks->ExpandCreateFast(fTotalTracksNo); + for (int i = 0; i < fTotalTracksNo; i++) { + HalCbmTrack* track = (HalCbmTrack*) fTracks->UncheckedAt(i); + track->ResetTrack(i, this); + CbmGlobalTrack* glob = (CbmGlobalTrack*) ei->fGlobalTracks->UncheckedAt(i); + track->SetChi2(glob->GetChi2()); + track->SetVertexChi2(0); + track->SetTrackLenght(glob->GetLength()); + + const CbmTrackParam* track_param = glob->GetParamVertex(); + track->SetMomentum(track_param->GetPx(), track_param->GetPy(), track_param->GetPz(), 0); + track->SetDCA(track_param->GetX() - fVertex->X(), track_param->GetY() - fVertex->Y(), + track_param->GetZ() - fVertex->Z()); + Int_t sts_index = glob->GetStsTrackIndex(); + Int_t tof_index = glob->GetTofHitIndex(); + if (track_param->GetQp() > 0) { + track->SetCharge(1); + } + else { + track->SetCharge(-1); + } + if (sts_index >= 0) { + CbmStsTrack* sts = (CbmStsTrack*) ei->fStsTracks->UncheckedAt(sts_index); + track->SetNMvdHits(sts->GetNofMvdHits()); + track->SetNStsHits(sts->GetNofStsHits()); + } + else { + track->SetNMvdHits(0); + track->SetNStsHits(0); + } + track->BuildHelix(); + Hal::ToFTrack* tof = (Hal::ToFTrack*) track->GetDetTrack(Hal::DetectorID::kTOF); + + if (tof_index >= 0) { + CbmTofHit* hit = (CbmTofHit*) ei->fTofHits->UncheckedAt(tof_index); + Double_t t = hit->GetTime(); + Double_t beta = track->GetTrackLenght() / t / (29.9792458); + Double_t p = track->GetMomentum().P(); + Double_t m2 = p * p * (1. / beta / beta - 1.); + tof->SetMass2(m2); + tof->SetBeta(beta); + tof->SetFlag(1); + } + else { + tof->SetMass2(Hal::ToFTrack::DummyVal()); + tof->SetBeta(Hal::ToFTrack::DummyVal()); + tof->SetFlag(0); + } + } +} + +void HalCbmEvent::UpdateAnaTree(HalCbmEventInterface* ei) +{ + CbmAnaTreeRecoSourceContainer* container = ei->GetContainer(); + fTotalTracksNo = ei->GetTotalTrackNo(); + TLorentzVector start = ei->GetVertex(); + fVertex->SetXYZT(start.X(), start.Y(), start.Z(), start.T()); + fTracks->ExpandCreateFast(fTotalTracksNo); + AnaTreeRecoIds ids = container->GetFieldIds(); + for (int i = 0; i < fTotalTracksNo; i++) { + AnalysisTree::Track p = container->GetVtxTracks()->GetChannel(i); + AnalysisTree::ShortInt_t match = container->GetVtx2ToFMatch()->GetMatchDirect(i); + HalCbmTrack* track = (HalCbmTrack*) fTracks->UncheckedAt(i); + track->ResetTrack(i, this); + track->SetChi2(p.GetField<float>(ids.vtx_chi2)); + track->SetVertexChi2(p.GetField<float>(ids.vtx_vtxchi2)); + track->SetMomentum(p.GetPx(), p.GetPy(), p.GetPz(), 0); + track->SetDCA(p.GetField<float>(ids.vtx_dcax), p.GetField<float>(ids.vtx_dcay), p.GetField<float>(ids.vtx_dcaz)); + track->SetNMvdHits(p.GetField<int>(ids.vtx_mvdhits)); + track->SetNStsHits(p.GetField<int>(ids.vtx_nhits) - track->GetNMvdHits()); + track->SetCharge(p.GetField<int>(ids.vtx_q)); + track->BuildHelix(); + Hal::ToFTrack* tof = (Hal::ToFTrack*) track->GetDetTrack(Hal::DetectorID::kTOF); + if (match == AnalysisTree::UndefValueShort) { + /*no tof*/ + tof->SetMass2(Hal::ToFTrack::DummyVal()); + tof->SetBeta(Hal::ToFTrack::DummyVal()); + tof->SetFlag(0); + } + else { + AnalysisTree::Hit tof_hit = container->GetTofHits()->GetChannel(match); + Double_t P = track->GetMomentum().P(); + Double_t m2 = tof_hit.GetField<float>(ids.tof_mass2); + const TLorentzVector& vec = track->GetMomentum(); + Double_t mom2 = vec.Px() * vec.Px() + vec.Py() * vec.Py() + vec.Pz() * vec.Pz(); + Double_t E = TMath::Sqrt(mom2 + m2); + Double_t beta = P / E; + tof->SetMass2(m2); + tof->SetBeta(beta); + tof->SetFlag(1); + } + } +} + +Hal::EventInterface* HalCbmEvent::CreateInterface() const { return new HalCbmEventInterface(); } diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEvent.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..36409f07ab77f41713ab6353797b3da676d3be24 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEvent.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICACBMDSTEVENT_H_ +#define NICACBMDSTEVENT_H_ + +#include "HalCbmTrack.h" + +#include <Rtypes.h> +#include <RtypesCore.h> +#include <TString.h> + +#include <Hal/ExpEvent.h> +namespace Hal +{ + class Event; + class EventInterface; +} // namespace Hal +class HalCbmEventInterface; +class HalCbmEvent : public Hal::ExpEvent { + protected: + HalCbmEvent(TString classname); + void UpdateDST(HalCbmEventInterface* ei); + void UpdateAnaTree(HalCbmEventInterface* ei); + + public: + HalCbmEvent(); + HalCbmEvent(const HalCbmEvent& other); + virtual void Update(Hal::EventInterface* interface); + virtual Bool_t ExistInTree() const; + virtual Hal::EventInterface* CreateInterface() const; + virtual Hal::Track* GetNewTrack() const { return new HalCbmTrack(); }; + virtual Hal::Event* GetNewEvent() const { return new HalCbmEvent(); }; + virtual TString GetFormatName() const { return "HalCbmEvent"; }; + virtual ~HalCbmEvent(); + ClassDef(HalCbmEvent, 1) +}; +#endif /* NICACBMDSTEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEventInterface.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEventInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9157b9b6302da747e5be35b6b82e395c2a47c550 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEventInterface.cxx @@ -0,0 +1,106 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmEventInterface.h" + +#include "CbmAnaTreeSource.h" +#include "CbmGlobalTrack.h" +#include "CbmStsTrack.h" +#include "CbmTofTrack.h" +#include "CbmVertex.h" +#include "FairRootManager.h" + +#include <RtypesCore.h> +#include <TObjArray.h> + +#include <Hal/DataManager.h> +#include <Hal/EventInterfaceAdvanced.h> +#include <Hal/RootIOManager.h> +#include <stddef.h> + +HalCbmEventInterface::HalCbmEventInterface() {} + +void HalCbmEventInterface::ConnectToTreeInternal(eMode /*mode*/) +{ + Hal::DataManager* manager = Hal::DataManager::Instance(); + fDataContainer = (CbmAnaTreeRecoSourceContainer*) manager->GetObject("CbmAnaTreeSourceContainer."); + auto branchList = manager->GetBranchNameList(); + for (auto name : branchList) { + std::cout << name << std::endl; + } + manager->GetIOManagerInfo(); + if (fDataContainer == nullptr) { + fCbmVertex = (CbmVertex*) manager->GetObject("PrimaryVertex."); + fGlobalTracks = (TClonesArray*) manager->GetObject("GlobalTrack"); + fStsTracks = (TClonesArray*) manager->GetObject("StsTrack"); + fTofHits = (TClonesArray*) manager->GetObject("TofHit"); + fTrdTracks = (TClonesArray*) manager->GetObject("TrdTrack"); + fRichRings = (TClonesArray*) manager->GetObject("RichRing"); + fMuchTracks = (TClonesArray*) manager->GetObject("MuchTrack"); + if (fCbmVertex && fGlobalTracks) + fFormatType = HalCbm::DataFormat::kDST; + else + fFormatType = HalCbm::DataFormat::kUnknown; + } + else { + fFormatType = HalCbm::DataFormat::kAnalysisTree; + } +} + +void HalCbmEventInterface::Register(Bool_t write) +{ + Hal::DataManager* manager = Hal::DataManager::Instance(); + switch (fFormatType) { + case HalCbm::DataFormat::kAnalysisTree: { + manager->Register("CbmAnaTreeSourceContainer.", "CbmAnaTreeSourceContainer.", fDataContainer, write); + } break; + case HalCbm::DataFormat::kDST: { + manager->Register("PrimaryVertex.", "PrimaryVertex", fCbmVertex, write); + manager->Register("GlobalTrack", "Tracks", fGlobalTracks, write); + + if (fStsTracks) manager->Register("StsTrack", "Tracks", fStsTracks, write); + if (fTofHits) manager->Register("TofHit", "Tracks", fTofHits, write); + if (fTrdTracks) manager->Register("TrdTrack", "Tracks", fTrdTracks, write); + if (fRichRings) manager->Register("RichRing", "Tracks", fRichRings, write); + if (fMuchTracks) manager->Register("MuchTrack", "Tracks", fMuchTracks, write); + } break; + default: break; + } +} + +Int_t HalCbmEventInterface::GetTotalTrackNo() const +{ + switch (fFormatType) { + case HalCbm::DataFormat::kAnalysisTree: { + return fDataContainer->GetVtxTracks()->GetNumberOfChannels(); + } break; + case HalCbm::DataFormat::kDST: { + return fGlobalTracks->GetEntriesFast(); + } break; + default: break; + } + return 0; +} + +TObject* HalCbmEventInterface::GetRawTrackPointer(Int_t /*index*/) const { return nullptr; } + +TLorentzVector HalCbmEventInterface::GetVertex() const +{ + switch (fFormatType) { + case HalCbm::DataFormat::kAnalysisTree: { + AnalysisTree::EventHeader* header = fDataContainer->GetEventHeader(); + return TLorentzVector(header->GetVertexX(), header->GetVertexY(), header->GetVertexZ(), 0); + } break; + case HalCbm::DataFormat::kDST: { + TLorentzVector vec(fCbmVertex->GetX(), fCbmVertex->GetY(), fCbmVertex->GetZ(), 0); + return vec; + } break; + default: return TLorentzVector(0, 0, 0, 0); break; + } +} + +HalCbmEventInterface::~HalCbmEventInterface() {} + +void HalCbmEventInterface::UpdateDst(HalCbmMCEventInterface* /*ie*/) {} + +void HalCbmEventInterface::UpdateAnaTree(HalCbmMCEventInterface* /*ie*/) {} diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEventInterface.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEventInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..3ae2e5e8d250b8eedf261338544c09a1636a6b83 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmEventInterface.h @@ -0,0 +1,61 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICACBMATRECOEVENTINTERFACE_H_ +#define NICACBMATRECOEVENTINTERFACE_H_ + +#include "CbmAnaTreeContainer.h" +#include "HalCbmDetectorID.h" +#include "HalCbmTrackInterface.h" + +#include <Rtypes.h> +#include <RtypesCore.h> +#include <TVector3.h> + +#include <Hal/ExpEventInterface.h> +#include <Hal/TrackClones.h> + +namespace Hal +{ + class EventInterface; +} + +class HalCbmEvent; +class CbmVertex; +class HalCbmFullEvent; +class HalCbmMCEventInterface; +class HalCbmEventInterface : public Hal::EventInterface { + friend class HalCbmEvent; + friend class HalCbmFullEvent; + + protected: + HalCbm::DataFormat fFormatType = {HalCbm::DataFormat::kUnknown}; + CbmAnaTreeRecoSourceContainer* fDataContainer = {nullptr}; + TClonesArray* fGlobalTracks = {nullptr}; + TClonesArray* fStsTracks = {nullptr}; + TClonesArray* fTrdTracks = {nullptr}; + TClonesArray* fTofHits = {nullptr}; + TClonesArray* fRichRings = {nullptr}; + TClonesArray* fMuchTracks = {nullptr}; + CbmVertex* fCbmVertex = {nullptr}; + void UpdateDst(HalCbmMCEventInterface* ie); + void UpdateAnaTree(HalCbmMCEventInterface* ie); + virtual void ConnectToTreeInternal(eMode mode); + void Register(Bool_t write); + + public: + HalCbmEventInterface(); + HalCbm::DataFormat GetFormatType() const { return fFormatType; }; + virtual Int_t GetTotalTrackNo() const; + virtual Hal::TrackInterface* GetTrackInterface() const { return new HalCbmTrackInterface(); } + CbmAnaTreeRecoSourceContainer* GetContainer() const { return fDataContainer; } + virtual TObject* GetRawTrackPointer(Int_t index) const; + /** GETTERS AND SETTERS **/ + virtual void SetRunInfoId(Int_t /*i*/){}; + virtual Int_t GetRunInfoId() const { return 0; }; + virtual TLorentzVector GetVertex() const; + virtual ~HalCbmEventInterface(); + ClassDef(HalCbmEventInterface, 1) +}; + +#endif /* NICACBMATRECOEVENTINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrack.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrack.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5f5dda1d76da48578003038ef5a4be20a06f528c --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrack.cxx @@ -0,0 +1,75 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmTrack.h" + +#include "CbmHelix.h" +#include "HalCbmDetectorID.h" +#include "HalCbmEventInterface.h" + +#include <Hal/DataFormat.h> +#include <Hal/Event.h> +#include <Hal/ExpEvent.h> +#include <Hal/Track.h> + +HalCbmTrack::HalCbmTrack() + : fTofTrack(new Hal::ToFTrack()) + , fHelix() + , fChi2Vertex(0) + , fMvdHits(0) + , fStsHits(0) + , fTrdHits(0) +{ +} + +Hal::DetectorTrack* HalCbmTrack::GetDetTrack(const UInt_t detID) const +{ + if (detID == HalCbm::DetectorID::kTOF) { + return fTofTrack; + } + return nullptr; +} + +HalCbmTrack::HalCbmTrack(const HalCbmTrack& other) : Hal::ExpTrack(other) +{ + fTofTrack = new Hal::ToFTrack(*other.fTofTrack); + fHelix = other.fHelix; + fChi2Vertex = other.fChi2Vertex; + fMvdHits = other.fMvdHits; + fStsHits = other.fStsHits; + fTrdHits = other.fTrdHits; +} + +HalCbmTrack& HalCbmTrack::operator=(const HalCbmTrack& other) +{ + if (this == &other) return *this; + Hal::ExpTrack::operator=(other); + *fTofTrack = *other.fTofTrack; + fHelix = other.fHelix; + fChi2Vertex = other.fChi2Vertex; + fMvdHits = other.fMvdHits; + fStsHits = other.fStsHits; + fTrdHits = other.fTrdHits; + return *this; +} + +void HalCbmTrack::BuildHelix() +{ + TVector3 mom(GetPx(), GetPy(), GetPz()); + TVector3 pos(GetDCA().X() + GetEvent()->GetVertex()->X(), GetDCA().Y() + GetEvent()->GetVertex()->Y(), + GetDCA().Z() + GetEvent()->GetVertex()->Z()); + fHelix.Build(pos, mom, GetCharge()); +} + +HalCbmTrack::~HalCbmTrack() { delete fTofTrack; } + +void HalCbmTrack::CopyData(Hal::Track* other) +{ + Hal::ExpTrack::CopyData(other); + fTofTrack = (static_cast<HalCbmTrack*>(other))->fTofTrack; + fHelix = (static_cast<HalCbmTrack*>(other))->fHelix; + fChi2Vertex = (static_cast<HalCbmTrack*>(other))->fChi2Vertex; + fMvdHits = (static_cast<HalCbmTrack*>(other))->fMvdHits; + fStsHits = (static_cast<HalCbmTrack*>(other))->fStsHits; + fTrdHits = (static_cast<HalCbmTrack*>(other))->fTrdHits; +} diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrack.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrack.h new file mode 100644 index 0000000000000000000000000000000000000000..2cc3d25d086d5dc6edf8c3528d0011dfef15254b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrack.h @@ -0,0 +1,54 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICACBMATRECOTRACK_H_ +#define NICACBMATRECOTRACK_H_ + +#include "CbmGlobalTrack.h" +#include "CbmHelix.h" +#include "HalCbmEventInterface.h" + +#include <AnalysisTree/Detector.hpp> +#include <AnalysisTree/Particle.hpp> + +#include <Hal/ExpTrack.h> +#include <Hal/ToFTrack.h> + +class CbmHelix; +namespace Hal +{ + class Track; +} +class HalCbmTrackInterface; + + +class HalCbmTrack : public Hal::ExpTrack { + Hal::ToFTrack* fTofTrack; + CbmHelix fHelix; + Float_t fChi2Vertex; + Int_t fMvdHits; + Int_t fStsHits; + Int_t fTrdHits; + + public: + HalCbmTrack(); + HalCbmTrack(const HalCbmTrack& other); + HalCbmTrack& operator=(const HalCbmTrack& other); + Hal::ToFTrack* GetTofTrack() { return fTofTrack; }; + CbmHelix& GetHelix() { return fHelix; }; + Double_t GetVertexChi2() const { return fChi2Vertex; }; + Int_t GetNMvdHits() const { return fMvdHits; }; + Int_t GetNStsHits() const { return fStsHits; } + Int_t GetNTrdHits() const { return fTrdHits; } + Int_t GetNHits() const { return GetNMvdHits() + GetNStsHits() + GetNTrdHits(); }; + void SetVertexChi2(Double_t v) { fChi2Vertex = v; }; + void SetNMvdHits(Int_t h) { fMvdHits = h; }; + void SetNStsHits(Int_t h) { fStsHits = h; }; + void SetNTrdHits(Int_t h) { fTrdHits = h; }; + void BuildHelix(); + virtual void CopyData(Hal::Track* other); + virtual Hal::DetectorTrack* GetDetTrack(const UInt_t detID) const; + virtual ~HalCbmTrack(); + ClassDef(HalCbmTrack, 1) +}; +#endif /* NICACBMATRECOTRACK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrackInterface.cxx b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrackInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..949f4faa15e5be975541451027a90f273513a0d0 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrackInterface.cxx @@ -0,0 +1,8 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmTrackInterface.h" + +HalCbmTrackInterface::HalCbmTrackInterface() {} + +HalCbmTrackInterface::~HalCbmTrackInterface() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrackInterface.h b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrackInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..99b8855bc23e3934ebd9ca6aa233bce61abd1aee --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/anatree/reco/HalCbmTrackInterface.h @@ -0,0 +1,17 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICACBMATRECOTRACKINTERFACE_H_ +#define NICACBMATRECOTRACKINTERFACE_H_ + +#include "CbmStsTrack.h" + +#include <Hal/TrackInterface.h> + +class HalCbmTrackInterface : public Hal::TrackInterface { + public: + HalCbmTrackInterface(); + virtual ~HalCbmTrackInterface(); + ClassDef(HalCbmTrackInterface, 1) +}; +#endif /* NICACBMATTRACKINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmFullEvent.cxx b/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmFullEvent.cxx new file mode 100644 index 0000000000000000000000000000000000000000..13ece70b227314c14bf33312fe048368a30f52bd --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmFullEvent.cxx @@ -0,0 +1,95 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmFullEvent.h" + +#include "CbmMCEvent.h" +#include "CbmTrackMatchNew.h" +#include "HalCbmEvent.h" +#include "HalCbmEventInterface.h" +#include "HalCbmMCEvent.h" +#include "HalCbmMCEventInterface.h" + +#include <AnalysisTree/Constants.hpp> + +#include <Hal/ComplexEvent.h> +#include <Hal/ComplexEventInterface.h> +#include <Hal/ComplexTrack.h> + + +HalCbmFullEvent::HalCbmFullEvent() : Hal::ComplexEvent(new HalCbmEvent(), new HalCbmMCEvent()) {} + +void HalCbmFullEvent::Update(Hal::EventInterface* interface) +{ + Hal::ComplexEventInterface* interf = static_cast<Hal::ComplexEventInterface*>(interface); + fImgEvent->Update(interf->GetImag()); + fRealEvent->Update(interf->GetReal()); + Hal::Event::ShallowCopyEvent(fRealEvent); + fTracks->Clear(); + fTotalTracksNo = fRealEvent->GetTotalTrackNo(); + fTracks->ExpandCreateFast(fTotalTracksNo); + HalCbmEventInterface* evInt = (HalCbmEventInterface*) interf->GetReal(); + switch (evInt->GetFormatType()) { + case HalCbm::DataFormat::kAnalysisTree: { + UpdateAnalysisTree(interf); + } break; + case HalCbm::DataFormat::kDST: { + UpdateDst(interf); + } break; + + case HalCbm::DataFormat::kUnknown: { + //Do nothing + } break; + } +} + +Hal::Event* HalCbmFullEvent::GetNewEvent() const { return new HalCbmFullEvent(); } + +HalCbmFullEvent::~HalCbmFullEvent() {} + +HalCbmFullEvent::HalCbmFullEvent(Hal::Event* re, Hal::Event* im) : Hal::ComplexEvent(re, im) {} + +void HalCbmFullEvent::UpdateAnalysisTree(Hal::ComplexEventInterface* interface) +{ + HalCbmEventInterface* s = (HalCbmEventInterface*) interface->GetReal(); + CbmAnaTreeRecoSourceContainer* reco = (CbmAnaTreeRecoSourceContainer*) s->GetContainer(); + auto vecToSim = reco->GetVtx2Sim(); + for (Int_t i = 0; i < fTotalTracksNo; i++) { + Hal::ComplexTrack* track = (Hal::ComplexTrack*) fTracks->UncheckedAt(i); + track->ResetTrack(i, this); + track->SetRealTrack(fRealEvent->GetTrack(i)); + track->Hal::Track::CopyData(fRealEvent->GetTrack(i)); + Int_t match = vecToSim->GetMatchDirect(i); + + if (match < 0 || match == AnalysisTree::UndefValueInt) { + track->SetImgTrack(nullptr); + } + else { + track->SetImgTrack(fImgEvent->GetTrack(match)); + track->SetMatchID(match); + } + } +} + +void HalCbmFullEvent::UpdateDst(Hal::ComplexEventInterface* interface) +{ + HalCbmEventInterface* s = (HalCbmEventInterface*) interface; + HalCbmMCEventInterface* ims = (HalCbmMCEventInterface*) interface->GetImag(); + for (Int_t i = 0; i < fTotalTracksNo; i++) { + Hal::ComplexTrack* track = (Hal::ComplexTrack*) fTracks->UncheckedAt(i); + track->ResetTrack(i, this); + track->SetRealTrack(fRealEvent->GetTrack(i)); + track->Hal::Track::CopyData(fRealEvent->GetTrack(i)); + CbmGlobalTrack* glob = (CbmGlobalTrack*) s->fGlobalTracks->UncheckedAt(i); + Int_t sts_index = glob->GetStsTrackIndex(); + if (sts_index >= 0) { + CbmTrackMatchNew* match = (CbmTrackMatchNew*) ims->fStsMatches->UncheckedAt(sts_index); + Int_t mcId = match->GetMatchedLink().GetIndex(); + if (mcId > 0) { + track->SetImgTrack(fImgEvent->GetTrack(mcId)); + track->SetMatchID(mcId); + } + } + } + // +} diff --git a/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmFullEvent.h b/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmFullEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..8f9309f8df7810d51ca9ab9fbb0c53795afbde8c --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmFullEvent.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICACBMATEVENT_H_ +#define NICACBMATEVENT_H_ +#include <Hal/ComplexEvent.h> + +/** + * class for analyses that base on anatree events + */ +namespace Hal +{ + class Event; + class EventInterface; + class ComplexEventInterface; +} // namespace Hal + + +class HalCbmFullEvent : public Hal::ComplexEvent { + + + protected: + HalCbmFullEvent(Hal::Event* re, Hal::Event* im); + void UpdateAnalysisTree(Hal::ComplexEventInterface* interface); + void UpdateDst(Hal::ComplexEventInterface* interface); + + public: + HalCbmFullEvent(); + virtual void Update(Hal::EventInterface* interface); + virtual TString GetFormatName() const { return "HalCbmFullEvent"; }; + virtual Hal::Event* GetNewEvent() const; + virtual ~HalCbmFullEvent(); + ClassDef(HalCbmFullEvent, 1) +}; +#endif /* NICACBMATEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmHbtFullEvent.cxx b/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmHbtFullEvent.cxx new file mode 100644 index 0000000000000000000000000000000000000000..16ce3393a6c5db9ceb84bef9fff5400511e0d766 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmHbtFullEvent.cxx @@ -0,0 +1,18 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmHbtFullEvent.h" + +#include "HalCbmHbtEvent.h" +#include "HalCbmMCEvent.h" + + +HalCbmHbtFullEvent::HalCbmHbtFullEvent() : Hal::ComplexEvent(new HalCbmHbtEvent(), new HalCbmMCEvent()) {} + +HalCbmHbtFullEvent::~HalCbmHbtFullEvent() {} +/* +Bool_t CbmHbtFullEvent::IsCompatible(const NicaEvent *non_buffered) const { + if(non_buffered->InheritsFrom("NicaCbmATFullEvent")) return kTRUE; + return kFALSE; +} +*/ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmHbtFullEvent.h b/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmHbtFullEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..d0009eb3f6e8b7221d48be5bf0faa9cd078b3570 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/combined/HalCbmHbtFullEvent.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMHBTFULLEVENT_H_ +#define CBMHBTFULLEVENT_H_ + +#include <Hal/ComplexEvent.h> + +namespace Hal +{ + class Event; + class EventInterface; +} // namespace Hal +/** + * class for ana tree data and HBT analysis + */ +class HalCbmHbtFullEvent : public Hal::ComplexEvent { + public: + HalCbmHbtFullEvent(); + virtual TString GetFormatName() const { return "CbmHbtFullEvent"; }; + virtual Hal::Event* GetNewEvent() const { return new HalCbmHbtFullEvent(); }; + // virtual Bool_t IsCompatible(const NicaEvent *non_buffered) const; + virtual ~HalCbmHbtFullEvent(); + ClassDef(HalCbmHbtFullEvent, 1) +}; +#endif /* CBMHBTFULLEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenSource.cxx b/analysis/PWGC2F/femtoscopy/hal/format/unigen/CbmUnigenSource.cxx similarity index 58% rename from analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenSource.cxx rename to analysis/PWGC2F/femtoscopy/hal/format/unigen/CbmUnigenSource.cxx index d3818b2d19026317c8d66c560052f4e74cb7359a..5c3017bd30d00ca7cbc76e9c4bffdd5595f54beb 100644 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenSource.cxx +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/CbmUnigenSource.cxx @@ -1,39 +1,34 @@ -/* Copyright (C) 2017-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "CbmUnigenSource.h" -/* - * NicaUnigenSource.cxx - * - * Created on: 27 mar 2017 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaUnigenSource.h" +#include "UEvent.h" +#include "UParticle.h" +#include <FairLogger.h> #include <FairRootManager.h> -#include <Logger.h> #include <TBranch.h> #include <fstream> #include <iostream> -#include "UEvent.h" -#include "UParticle.h" - -NicaUnigenSource::NicaUnigenSource() : fUnigenChain(NULL), fEvent(NULL) {} +CbmUnigenSource::CbmUnigenSource() : fUnigenChain(nullptr), fEvent(nullptr), fPrintTreeInfo(kFALSE) {} -NicaUnigenSource::NicaUnigenSource(TString inFile) : fUnigenChain(NULL), fEvent(NULL) { fFileName.push_back(inFile); } +CbmUnigenSource::CbmUnigenSource(TString inFile) : fUnigenChain(nullptr), fEvent(nullptr), fPrintTreeInfo(kFALSE) +{ + fFileName.push_back(inFile); +} -NicaUnigenSource::~NicaUnigenSource() +CbmUnigenSource::~CbmUnigenSource() { - if (fUnigenChain) delete fUnigenChain; + //if (fUnigenChain) delete fUnigenChain; + //is owned by FairRoot ? } -Bool_t NicaUnigenSource::Init() +Bool_t CbmUnigenSource::Init() { FairRootManager* mngr = FairRootManager::Instance(); fUnigenChain = new TChain("events"); @@ -49,7 +44,9 @@ Bool_t NicaUnigenSource::Init() do { TString temp; list >> temp; - if (temp.Length() > 1) { fUnigenChain->Add(temp); } + if (temp.Length() > 1) { + fUnigenChain->Add(temp); + } else { break; } @@ -60,12 +57,12 @@ Bool_t NicaUnigenSource::Init() fEvent = new UEvent(); if (fUnigenChain->GetBranch("event")) { - fUnigenChain->Print(); + if (fPrintTreeInfo) fUnigenChain->Print(); fUnigenChain->SetBranchStatus("event", 1); fUnigenChain->SetBranchAddress("event", &fEvent); } else { - std::cout << "Event read II" << std::endl; + if (fPrintTreeInfo) std::cout << "Event read II" << std::endl; fUnigenChain->SetBranchStatus("UEvent.", 1); fUnigenChain->SetBranchAddress("UEvent.", &fEvent); } @@ -74,7 +71,7 @@ Bool_t NicaUnigenSource::Init() return kTRUE; } -Int_t NicaUnigenSource::ReadEvent(UInt_t unsignedInt) +Int_t CbmUnigenSource::ReadEvent(UInt_t unsignedInt) { //std::cout<<"READING EVENT " <<unsignedInt<<std::endl; fUnigenChain->GetEntry(unsignedInt); @@ -82,9 +79,9 @@ Int_t NicaUnigenSource::ReadEvent(UInt_t unsignedInt) return 0; } -void NicaUnigenSource::Close() {} +void CbmUnigenSource::Close() {} -void NicaUnigenSource::Boost(Double_t vx, Double_t vy, Double_t vz) +void CbmUnigenSource::Boost(Double_t vx, Double_t vy, Double_t vz) { for (int i = 0; i < fEvent->GetNpa(); i++) { UParticle* p = fEvent->GetParticle(i); @@ -97,4 +94,6 @@ void NicaUnigenSource::Boost(Double_t vx, Double_t vy, Double_t vz) } } -Int_t NicaUnigenSource::CheckMaxEventNo(Int_t /*int1*/) { return fUnigenChain->GetEntries(); } +Int_t CbmUnigenSource::CheckMaxEventNo(Int_t /*int1*/) { return fUnigenChain->GetEntries(); } + +Bool_t CbmUnigenSource::SpecifyRunId() { return kFALSE; } diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenSource.h b/analysis/PWGC2F/femtoscopy/hal/format/unigen/CbmUnigenSource.h similarity index 56% rename from analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenSource.h rename to analysis/PWGC2F/femtoscopy/hal/format/unigen/CbmUnigenSource.h index e5f4a840773fdf0163f479c588d906c2c719e9a9..2990a5b6f2678da7947dd0ff76b46c14031b1d29 100644 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenSource.h +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/CbmUnigenSource.h @@ -1,15 +1,6 @@ -/* Copyright (C) 2017-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaUnigenSource.h - * - * Created on: 27 mar 2017 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ #ifndef NICAUNIGENSOURCE_H_ #define NICAUNIGENSOURCE_H_ /** @@ -17,52 +8,55 @@ */ +#include "UEvent.h" + #include <FairFileSource.h> #include <TChain.h> -#include "UEvent.h" - -class NicaUnigenSource : public FairSource { +class CbmUnigenSource : public FairSource { TChain* fUnigenChain; std::vector<TString> fFileName; UEvent* fEvent; + Bool_t fPrintTreeInfo; -public: + public: /** * defaut constructor should not be used */ - NicaUnigenSource(); + CbmUnigenSource(); /** * main constructor * @param inFile unigen file */ - NicaUnigenSource(TString inFile); + CbmUnigenSource(TString inFile); /** * copy constructor * @param source */ - NicaUnigenSource(const NicaUnigenSource& source) = delete; + CbmUnigenSource(const CbmUnigenSource& source) = delete; + void PrintTreeInfo() { fPrintTreeInfo = kTRUE; }; void AddFile(TString name) { fFileName.push_back(name); }; - NicaUnigenSource& operator=(const NicaUnigenSource&) = delete; + CbmUnigenSource& operator=(const CbmUnigenSource&) = delete; virtual void Boost(Double_t vx, Double_t vy, Double_t vz); - virtual ~NicaUnigenSource(); + virtual ~CbmUnigenSource(); virtual Bool_t Init(); virtual Int_t ReadEvent(UInt_t = 0); virtual void Close(); - virtual void Reset() {}; + virtual void Reset(){}; virtual Bool_t ActivateObject(TObject**, const char*) { return kFALSE; } virtual Source_Type GetSourceType() { return kFILE; }; - virtual void SetParUnpackers() {}; + virtual void SetParUnpackers(){}; virtual Bool_t InitUnpackers() { return kTRUE; }; virtual Bool_t ReInitUnpackers() { return kTRUE; }; virtual Int_t CheckMaxEventNo(Int_t = 0); - virtual void ReadBranchEvent(const char* /*BrName*/) {}; - virtual void ReadBranchEvent(const char* /*BrName*/, Int_t /*Event*/) {}; - virtual void FillEventHeader(FairEventHeader* /*feh*/) {}; + virtual void ReadBranchEvent(const char* /*BrName*/){}; + virtual void ReadBranchEvent(const char* /*BrName*/, Int_t /*Event*/){}; + virtual void FillEventHeader(FairEventHeader* /*feh*/){}; + virtual Bool_t SpecifyRunId(); void SetRunId(Int_t runId) { fRunId = runId; } Int_t GetRunId() const { return fRunId; } - ClassDef(NicaUnigenSource, 1) + ClassDef(CbmUnigenSource, 1) }; #endif /* NICAUNIGENSOURCE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEvent.cxx b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEvent.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c365be1b00aec2dbf958e1c59fe114e5597f2ce3 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEvent.cxx @@ -0,0 +1,67 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmUnigenEvent.h" + +#include "HalCbmUnigenEventInterface.h" + +#include <TClonesArray.h> +#include <TDatabasePDG.h> +#include <TLorentzVector.h> +#include <TParticlePDG.h> + +#include <Hal/DataManager.h> +#include <Hal/EventInterface.h> +#include <Hal/McTrack.h> +#include <Hal/Track.h> + +HalCbmUnigenEvent::HalCbmUnigenEvent() : Hal::McEvent("HalCbmUnigenTrack") {} + +void HalCbmUnigenEvent::Update(Hal::EventInterface* interface) +{ + UEvent* temp = ((HalCbmUnigenEventInterface*) interface)->fEvent; + fB = temp->GetB(); + fPhi = temp->GetPhi(); + fTotalTracksNo = temp->GetNpa(); + fTracks->Clear(); + for (int i = 0; i < fTotalTracksNo; i++) { + UParticle* particle = temp->GetParticle(i); + TParticlePDG* pdg_part = fPDG->GetParticle(particle->GetPdg()); + Double_t charge = 0; + if (pdg_part) { + charge = pdg_part->Charge() / 3.0; + } + Hal::McTrack* target_track = (Hal::McTrack*) fTracks->ConstructedAt(i); + target_track->ResetTrack(i, this); + target_track->SetCharge(charge); + target_track->SetPdg(particle->GetPdg()); + if (particle->GetParent() < 0) { + target_track->SetPrimary(); + } + else { + target_track->SetMotherIndex(particle->GetParent()); + } + target_track->SetMomentum(particle->Px(), particle->Py(), particle->Pz(), particle->E()); + target_track->SetFreezoutPosition(particle->X(), particle->Y(), particle->Z(), particle->T()); + target_track->SetStatus(particle->GetStatus()); + } +} + +void HalCbmUnigenEvent::Clear(Option_t* opt) { Hal::McEvent::Clear(opt); } + +HalCbmUnigenEvent::HalCbmUnigenEvent(const HalCbmUnigenEvent& other) : Hal::McEvent(other) {} + +HalCbmUnigenEvent::~HalCbmUnigenEvent() {} + +TString HalCbmUnigenEvent::GetFormatName() const { return "UnigenFormat"; } + +Bool_t HalCbmUnigenEvent::ExistInTree() const +{ + Hal::DataManager* manager = Hal::DataManager::Instance(); + if (manager->CheckBranch("UEvent.")) { + return kTRUE; + } + return kFALSE; +} + +Hal::EventInterface* HalCbmUnigenEvent::CreateInterface() const { return new HalCbmUnigenEventInterface(); } diff --git a/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEvent.h b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..1c58bdee9df045995edcbaa3fcb8c092f31038a6 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEvent.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICAUNIGENEVENT_H_ +#define NICAUNIGENEVENT_H_ + +#include "UEvent.h" +#include "UParticle.h" + +#include <Hal/McEvent.h> +#include <HalCbmUnigenTrack.h> +/** + * class used for representation of unigen event in "fake" format + */ +namespace Hal +{ + class EventInterface; +} +class HalCbmUnigenEvent : public Hal::McEvent { + + public: + /** + * default constructor + */ + HalCbmUnigenEvent(); + HalCbmUnigenEvent(const HalCbmUnigenEvent& other); + virtual Hal::EventInterface* CreateInterface() const; + virtual void Update(Hal::EventInterface* interface); + virtual void Clear(Option_t* opt = " "); + virtual Bool_t ExistInTree() const; + virtual TString GetFormatName() const; + virtual ~HalCbmUnigenEvent(); + ClassDef(HalCbmUnigenEvent, 1) +}; + +#endif /* NICAUNIGENEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEventInterface.cxx b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEventInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..640b6528b99383cb6cabc68fb6e541fe11159910 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEventInterface.cxx @@ -0,0 +1,87 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmUnigenEventInterface.h" + +#include <Hal/DataManager.h> +#include <Hal/TrackInterface.h> +#include <HalCbmUnigenTrackInterface.h> + +HalCbmUnigenEventInterface::HalCbmUnigenEventInterface() : fEvent(nullptr) { fEvent = new UEvent(); } + +void HalCbmUnigenEventInterface::Compress(Int_t* map, Int_t map_size) +{ + Int_t track_pos = 0; + for (int i = 0; i < map_size; i++) { + Int_t good_track = map[i]; + for (int j = track_pos; j < good_track; j++) { + fEvent->RemoveAt(j); + } + track_pos = good_track + 1; + } +} + +void HalCbmUnigenEventInterface::CopyData(Hal::EventInterface* s) +{ +#ifdef UNIGEN_OLD + CopyUnigen(((HalCbmUnigenEventInterface*) s)->fEvent, fEvent); +#else + *fEvent = *((HalCbmUnigenEventInterface*) s)->fEvent; +#endif +} + +void HalCbmUnigenEventInterface::CopyAndCompress(Hal::EventInterface* s, Int_t* map, Int_t map_size) +{ + HalCbmUnigenEventInterface* ev = (HalCbmUnigenEventInterface*) s; + fEvent->SetB(ev->fEvent->GetB()); + fEvent->SetPhi(ev->fEvent->GetPhi()); + fEvent->SetNes(ev->fEvent->GetNes()); + fEvent->SetStepNr(ev->fEvent->GetStepNr()); + fEvent->SetStepT(ev->fEvent->GetStepT()); +#ifdef UNIGEN_OLD + fEvent->GetParticleList()->Clear(); +#else + TString comment; + ev->fEvent->GetComment(comment); + fEvent->SetComment(comment); + fEvent->Clear(); +#endif + for (int i = 0; i < map_size; i++) { + fEvent->AddParticle(*ev->fEvent->GetParticle(map[i])); + } +} + +void HalCbmUnigenEventInterface::ConnectToTreeInternal(EventInterface::eMode /*mode*/) +{ + Hal::DataManager* manager = Hal::DataManager::Instance(); + fEvent = (UEvent*) manager->GetObject("UEvent."); +} + +void HalCbmUnigenEventInterface::Boost(Double_t vx, Double_t vy, Double_t vz) +{ + for (int i = 0; i < fEvent->GetNpa(); i++) { + UParticle* p = fEvent->GetParticle(i); + TLorentzVector mom = p->GetMomentum(); + TLorentzVector pos = p->GetPosition(); + mom.Boost(vx, vy, vz); + pos.Boost(vx, vy, vz); + p->SetMomentum(mom); + p->SetPosition(pos); + } +} + +HalCbmUnigenEventInterface::~HalCbmUnigenEventInterface() {} + +Hal::TrackInterface* HalCbmUnigenEventInterface::GetTrackInterface() const { return new HalCbmUnigenTrackInterface(); } + +void HalCbmUnigenEventInterface::Register(Bool_t write) +{ + if (fEvent == NULL) fEvent = new UEvent(); + Hal::DataManager* manager = Hal::DataManager::Instance(); + manager->Register("Event", "", (TNamed*) fEvent, write); +} + +void HalCbmUnigenEventInterface::FillTrackInterface(Hal::TrackInterface* track, Int_t index) +{ + track->SetRawTrack(fEvent->GetParticle(index)); +} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEventInterface.h b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEventInterface.h similarity index 53% rename from analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEventInterface.h rename to analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEventInterface.h index aa519dd960c9cf3ebd8c4b2efced6dbaee4bcd64..3dab59d7a6239b32af9ca84ddf4c92b19130ba3e 100644 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEventInterface.h +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenEventInterface.h @@ -1,57 +1,55 @@ -/* Copyright (C) 2017-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaUnigenSource.h - * - * Created on: 2 sie 2017 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ #ifndef NICAUNIGENEVENTINTERFACE_H_ #define NICAUNIGENEVENTINTERFACE_H_ +#include "HalCbmUnigenEvent.h" + #include <TObject.h> -#include "NicaEventInterface.h" -#include "NicaUnigenEvent.h" +#include <Hal/EventInterfaceAdvanced.h> /** * event interface for UnigenData */ -class NicaUnigenEventInterface : public NicaEventInterface { - friend class NicaUnigenEvent; + +namespace Hal +{ + class TrackInterface; +} + +class HalCbmUnigenEventInterface : public Hal::EventInterfaceAdvanced { + friend class HalCbmUnigenEvent; UEvent* fEvent; -protected: - virtual void ConnectToTree(); + protected: + virtual void ConnectToTreeInternal(EventInterface::eMode mode); #ifdef UNIGEN_OLD void CopyUnigen(UEvent* from, UEvent* to); #endif -public: - NicaUnigenEventInterface(); + public: + HalCbmUnigenEventInterface(); virtual Int_t GetTotalTrackNo() const { return fEvent->GetNpa(); } virtual void Boost(Double_t vx, Double_t vy, Double_t vz); virtual void Register(Bool_t write); virtual void Compress(Int_t* map, Int_t map_size); - virtual void CopyData(NicaEventInterface* s); - virtual void CopyAndCompress(NicaEventInterface* s, Int_t* map, Int_t map_size); - virtual void FillTrackInterface(NicaTrackInterface* track, Int_t index); + virtual void CopyData(Hal::EventInterface* s); + virtual void CopyAndCompress(Hal::EventInterface* s, Int_t* map, Int_t map_size); + virtual void FillTrackInterface(Hal::TrackInterface* track, Int_t index); TObject* GetRawEventPointer() const { return fEvent; }; virtual TObject* GetRawTrackPointer(Int_t index) const { return fEvent->GetParticle(index); }; - virtual NicaTrackInterface* GetTrackInterface() const; + virtual Hal::TrackInterface* GetTrackInterface() const; virtual void Clear(Option_t* opt = "") { fEvent->Clear(opt); }; /** GETTER SETTER SECTION*/ virtual void SetB(Double_t b) { fEvent->SetB(b); }; - virtual void SetVertex(Double_t /*x*/, Double_t /*y*/, Double_t /*z*/) {}; + virtual void SetVertex(Double_t /*x*/, Double_t /*y*/, Double_t /*z*/){}; virtual void SetPhi(Double_t phi, Double_t /*phi_error*/) { fEvent->SetPhi(phi); }; virtual Double_t GetB() const { return fEvent->GetB(); }; virtual Double_t GetPhi() const { return fEvent->GetPhi(); }; - virtual ~NicaUnigenEventInterface(); - ClassDef(NicaUnigenEventInterface, 1) + virtual ~HalCbmUnigenEventInterface(); + ClassDef(HalCbmUnigenEventInterface, 1) }; #endif /* NICAUNIGENEVENTINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrack.cxx b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrack.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f83727b4052d27b63bbe778fa985a40ccfcb4856 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrack.cxx @@ -0,0 +1,8 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmUnigenTrack.h" + +HalCbmUnigenTrack::HalCbmUnigenTrack() {} + +HalCbmUnigenTrack::~HalCbmUnigenTrack() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrack.h b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrack.h new file mode 100644 index 0000000000000000000000000000000000000000..b44d7dd8d0687bcae30d160e202be687f91c1743 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrack.h @@ -0,0 +1,24 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef NICAUNIGENTRACK_H_ +#define NICAUNIGENTRACK_H_ + +#include "UParticle.h" + +#include <iostream> + +#include <Hal/McTrack.h> + +/** + * class for representation of track from unigen in "fake" format + */ + +class HalCbmUnigenTrack : public Hal::McTrack { + public: + HalCbmUnigenTrack(); + virtual ~HalCbmUnigenTrack(); + ClassDef(HalCbmUnigenTrack, 1) +}; + +#endif /* NICAUNIGENTRACK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrackInterface.cxx b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrackInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0c307707479c9103160f199822d4e9621f6acd0b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrackInterface.cxx @@ -0,0 +1,8 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmUnigenTrackInterface.h" + +HalCbmUnigenTrackInterface::HalCbmUnigenTrackInterface() : fRawObject(nullptr) {} + +HalCbmUnigenTrackInterface::~HalCbmUnigenTrackInterface() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrackInterface.h b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrackInterface.h similarity index 52% rename from analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrackInterface.h rename to analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrackInterface.h index 06cd2f4e7f0fce05199b24c5012170c6568778ce..25ebcc852454d7f25c42f0f8e9d1caeb3cb73f37 100644 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrackInterface.h +++ b/analysis/PWGC2F/femtoscopy/hal/format/unigen/HalCbmUnigenTrackInterface.h @@ -1,33 +1,28 @@ -/* Copyright (C) 2017-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef UNIGENTRACKINTERFACE_H_ +#define UNIGENTRACKINTERFACE_H_ -/* - * NicaUnigenTrackInterface.h - * - * Created on: 2 sie 2017 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICAUNIGENTRACKINTERFACE_H_ -#define NICAUNIGENTRACKINTERFACE_H_ - -#include "NicaMCTrackInterface.h" #include "UParticle.h" + +#include <Hal/McTrackInterface.h> /** * interface to UParticle */ -class NicaUnigenTrackInterface : public NicaMCTrackInterface { -public: - NicaUnigenTrackInterface(); + +class HalCbmUnigenTrackInterface : public Hal::McTrackInterface { + TObject* fRawObject; + + public: + HalCbmUnigenTrackInterface(); void SetID(Int_t id) { ((UParticle*) fRawObject)->SetUniqueID(id); }; void SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e) { ((UParticle*) fRawObject)->SetMomentum(px, py, pz, e); }; void SetStatus(Int_t stat) { ((UParticle*) fRawObject)->SetStatus(stat); }; - void SetPrimary(Int_t /*prim*/) {}; + void SetPrimary(Int_t /*prim*/){}; Double_t GetPx() const { return ((UParticle*) fRawObject)->Px(); }; Double_t GetPy() const { return ((UParticle*) fRawObject)->Py(); }; Double_t GetPz() const { return ((UParticle*) fRawObject)->Pz(); }; @@ -35,8 +30,8 @@ public: Int_t GetMotherIndex() const { return ((UParticle*) fRawObject)->GetMate(); }; Int_t GetStatus() const { return ((UParticle*) fRawObject)->GetStatus(); }; Bool_t IsPrimary() const { return kTRUE; }; - virtual ~NicaUnigenTrackInterface(); - ClassDef(NicaUnigenTrackInterface, 1) + virtual ~HalCbmUnigenTrackInterface(); + ClassDef(HalCbmUnigenTrackInterface, 1) }; -#endif /* NICAROOT_DATAFORMAT_FORMATS_NICAUNIGENTRACKINTERFACE_H_ */ +#endif /* ROOT_DATAFORMAT_FORMATS_NICAUNIGENTRACKINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/hal/helpers/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8adf62e130be4fdc1fd0c12365d185147652cfe0 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/CMakeLists.txt @@ -0,0 +1,63 @@ +# Create a library called "" which includes the source files given in +# the array . +# The extension is already found. Any number of sources could be listed here. + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") +Set(INCLUDE_DIRECTORIES + ${CMAKE_SOURCE_FAIRMCSTACK} + ${Hal_INCLUDE_DIR} + ${KF_HEADERS} + ${CBMDATA_DIR} + ${CBMDATA_DIR}/global + ${CBMDATA_DIR}/sts + ${CMAKE_SOURCE_DIR}/core/field + ${HAL_CBM}/helpers + ${HAL_CBM}/helpers/anatree + ${AnalysisTree_INCLUDE_DIR} +) +Set(SYSTEM_INCLUDE_DIRECTORIES + ${ROOT_INCLUDE_DIR} + ${BASE_INCLUDE_DIRECTORIES} + ${CLHEP_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} +) + + +Include_Directories(${INCLUDE_DIRECTORIES}) +Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES}) + +Link_Directories(${LINK_DIRECTORIES}) + +# List of source files +set(SRCS + HalCbmDetectorID.cxx + HalCbmTaskManager.cxx + HalCbmCompressionTask.cxx + HalCbmAnalysisManager.cxx + CbmHelix.cxx + HalCbmField.cxx + anatree/CbmAnaTreeContainer.cxx + anatree/CbmAnaTreeSource.cxx + anatree/HalCbmSource.cxx +) + +Set(LINKDEF HalCbmHelpersLinkDef.h) +Set(LIBRARY_NAME HalCbmHelpers) +set(PUBLIC_DEPENDENCIES + FairRoot::Base + CbmField + FairRoot::Base + HalCut + HalFair + HalFeatures + HalData + KF + KFParticle + AnalysisTreeBase + ) + +generate_cbm_library() + +add_dependencies(G__HalCbmHelpers ANALYSISTREE HAL) + + diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/CbmHelix.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/CbmHelix.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9f80d9b776acdef4396068f524d5b85dad4f3cda --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/CbmHelix.cxx @@ -0,0 +1,259 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "CbmHelix.h" + +#include <TMath.h> + +#include <vector> + +#include <Hal/Field.h> +// matrix x, y, tx,ty, qp, z +Hal::MagField* CbmHelix::fgField = NULL; +CbmHelix::CbmHelix() {} + +void CbmHelix::Build(const CbmGlobalTrack* tr) +{ + const FairTrackParam* parameters = tr->GetParamVertex(); + SetParameters(parameters); +} + +void CbmHelix::Build(const CbmStsTrack* tr, Bool_t firstPoint) +{ + if (firstPoint) { + SetParameters(tr->GetParamFirst()); + } + else { + SetParameters(tr->GetParamLast()); + } +} + +TVector3 CbmHelix::Eval(Double_t z) +{ + Propagate(z); + return TVector3(GetTrack()[0], GetTrack()[1], GetTrack()[5]); +} + +TVector3 CbmHelix::Eval(Double_t z, TVector3& mom) +{ + Propagate(z); + Double_t p = (TMath::Abs(Qp()) > 1.e-4) ? 1. / TMath::Abs(Qp()) : 1.e4; + Double_t pz = TMath::Sqrt(p * p / (Tx() * Tx() + Ty() * Ty() + 1)); + Double_t px = Tx() * pz; + Double_t py = Ty() * pz; + mom.SetXYZ(px, py, pz); + return TVector3(GetTrack()[0], GetTrack()[1], GetTrack()[5]); +} + +void CbmHelix::SetParameters(const FairTrackParam* param) +{ + fTb[0] = param->GetX(); + fTb[1] = param->GetY(); + fTb[2] = param->GetTx(); + fTb[3] = param->GetTy(); + fTb[4] = param->GetQp(); + fTb[5] = param->GetZ(); +} + +void CbmHelix::Build(const TVector3& pos, const TVector3& mom, Double_t charge) +{ + fTb[0] = pos.X(); + fTb[1] = pos.Y(); + Double_t p = mom.Mag(); + fTb[2] = mom.Px() / mom.Pz(); + fTb[3] = mom.Py() / mom.Pz(); + fTb[4] = charge / p; + fTb[5] = pos.Z(); +} + +CbmHelix::~CbmHelix() {} + +CbmHelix::CbmHelix(const CbmHelix& other) : TObject() +{ + for (int i = 0; i < 6; i++) { + fT[i] = other.fT[i]; + fTb[i] = other.fTb[i]; + } +} + +CbmHelix& CbmHelix::operator=(const CbmHelix& other) +{ + if (&other == this) return *this; + for (int i = 0; i < 6; i++) { + fT[i] = other.fT[i]; + fTb[i] = other.fTb[i]; + } + return *this; +} + +Int_t CbmHelix::Propagate(Double_t z) +{ + Bool_t err = 0; + for (int i = 0; i < 6; i++) { + fT[i] = fTb[i]; + } + if (fabs(fT[5] - z) < 1.e-5) return 0; + + Double_t zz = z; + if (z < 300. && 300 <= fT[5]) ExtrapolateLine(300.); + + if (fT[5] < 300. && 300. < z) { + zz = 300.; + } + Bool_t repeat = 1; + while (!err && repeat) { + const Double_t max_step = 5.; + Double_t zzz; + if (fabs(fT[5] - zz) > max_step) + zzz = fT[5] + ((zz > fT[5]) ? max_step : -max_step); + else { + zzz = zz; + repeat = 0; + } + err = err || ExtrapolateALight(zzz); + } + if (fT[5] != z) ExtrapolateLine(z); + return err; +} + +void CbmHelix::ExtrapolateLine(Double_t z_out) +{ + Double_t dz = z_out - fT[5]; + + fT[0] += dz * fT[2]; + fT[1] += dz * fT[3]; + fT[5] = z_out; +} + +Int_t CbmHelix::ExtrapolateALight(Double_t z_out) +{ + // + // Part of the analytic extrapolation formula with error (c_light*B*dz)^4/4! + // + { + bool ok = 1; + for (int i = 0; i < 6; i++) + ok = ok && !TMath::IsNaN(fT[i]) && (fT[i] < 1.e5); + } + const Double_t c_light = 0.000299792458; + + //Double_t qp_in = fT[4]; + Double_t z_in = fT[5]; + Double_t dz = z_out - z_in; + + // construct coefficients + + Double_t x = fT[2], // tx !! + y = fT[3], // ty !! + + xx = x * x, xy = x * y, yy = y * y, xx31 = xx * 3 + 1, xx159 = xx * 15 + 9; + + const Double_t Ax = xy, Ay = -xx - 1, Az = y, Ayy = x * (xx * 3 + 3), Ayz = -2 * xy, + Ayyy = -(15 * xx * xx + 18 * xx + 3), Bx = yy + 1, By = -xy, Bz = -x, Byy = y * xx31, Byz = 2 * xx + 1, + Byyy = -xy * xx159; + + // end of coefficients calculation + + Double_t t2 = 1. + xx + yy; + if (t2 > 1.e4) return 1; + Double_t t = sqrt(t2), h = Qp() * c_light, ht = h * t; + + Double_t sx = 0, sy = 0, sz = 0, syy = 0, syz = 0, syyy = 0, Sx = 0, Sy = 0, Sz = 0, Syy = 0, Syz = 0, Syyy = 0; + + { // get field integrals + + Double_t B[3][3]; + Double_t r0[3], r1[3], r2[3]; + + // first order track approximation + + r0[0] = fT[0]; + r0[1] = fT[1]; + r0[2] = fT[5]; + + r2[0] = fT[0] + fT[2] * dz; + r2[1] = fT[1] + fT[3] * dz; + r2[2] = z_out; + + r1[0] = 0.5 * (r0[0] + r2[0]); + r1[1] = 0.5 * (r0[1] + r2[1]); + r1[2] = 0.5 * (r0[2] + r2[2]); + + fgField->GetFieldValue(r0, B[0]); + fgField->GetFieldValue(r1, B[1]); + fgField->GetFieldValue(r2, B[2]); + + Sy = (7 * B[0][1] + 6 * B[1][1] - B[2][1]) * dz * dz / 96.; + r1[0] = fT[0] + x * dz / 2 + ht * Sy * Ay; + r1[1] = fT[1] + y * dz / 2 + ht * Sy * By; + + Sy = (B[0][1] + 2 * B[1][1]) * dz * dz / 6.; + r2[0] = fT[0] + x * dz + ht * Sy * Ay; + r2[1] = fT[1] + y * dz + ht * Sy * By; + + Sy = 0; + + // integrals + + fgField->GetFieldValue(r0, B[0]); + fgField->GetFieldValue(r1, B[1]); + fgField->GetFieldValue(r2, B[2]); + + sx = (B[0][0] + 4 * B[1][0] + B[2][0]) * dz / 6.; + sy = (B[0][1] + 4 * B[1][1] + B[2][1]) * dz / 6.; + sz = (B[0][2] + 4 * B[1][2] + B[2][2]) * dz / 6.; + + Sx = (B[0][0] + 2 * B[1][0]) * dz * dz / 6.; + Sy = (B[0][1] + 2 * B[1][1]) * dz * dz / 6.; + Sz = (B[0][2] + 2 * B[1][2]) * dz * dz / 6.; + + Double_t c2[3][3] = {{5, -4, -1}, {44, 80, -4}, {11, 44, 5}}; // /=360. + Double_t C2[3][3] = {{38, 8, -4}, {148, 208, -20}, {3, 36, 3}}; // /=2520. + for (Int_t n = 0; n < 3; n++) + for (Int_t m = 0; m < 3; m++) { + syz += c2[n][m] * B[n][1] * B[m][2]; + Syz += C2[n][m] * B[n][1] * B[m][2]; + } + + syz *= dz * dz / 360.; + Syz *= dz * dz * dz / 2520.; + + syy = (B[0][1] + 4 * B[1][1] + B[2][1]) * dz; + syyy = syy * syy * syy / 1296; + syy = syy * syy / 72; + + Syy = (B[0][1] * (38 * B[0][1] + 156 * B[1][1] - B[2][1]) + B[1][1] * (208 * B[1][1] + 16 * B[2][1]) + + B[2][1] * (3 * B[2][1])) + * dz * dz * dz / 2520.; + Syyy = (B[0][1] + * (B[0][1] * (85 * B[0][1] + 526 * B[1][1] - 7 * B[2][1]) + B[1][1] * (1376 * B[1][1] + 84 * B[2][1]) + + B[2][1] * (19 * B[2][1])) + + B[1][1] * (B[1][1] * (1376 * B[1][1] + 256 * B[2][1]) + B[2][1] * (62 * B[2][1])) + + B[2][1] * B[2][1] * (3 * B[2][1])) + * dz * dz * dz * dz / 90720.; + } + + const Double_t + + sA1 = sx * Ax + sy * Ay + sz * Az, + + sB1 = sx * Bx + sy * By + sz * Bz, + + SA1 = Sx * Ax + Sy * Ay + Sz * Az, + + SB1 = Sx * Bx + Sy * By + Sz * Bz, + + sA2 = syy * Ayy + syz * Ayz, sB2 = syy * Byy + syz * Byz, + + SA2 = Syy * Ayy + Syz * Ayz, SB2 = Syy * Byy + Syz * Byz, + + sA3 = syyy * Ayyy, sB3 = syyy * Byyy, + + SA3 = Syyy * Ayyy, SB3 = Syyy * Byyy; + fT[0] = fT[0] + x * dz + ht * (SA1 + ht * (SA2 + ht * SA3)); + fT[1] = fT[1] + y * dz + ht * (SB1 + ht * (SB2 + ht * SB3)); + fT[2] = fT[2] + ht * (sA1 + ht * (sA2 + ht * sA3)); + fT[3] = fT[3] + ht * (sB1 + ht * (sB2 + ht * sB3)); + fT[5] = z_out; + return 0; +} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmHelix.h b/analysis/PWGC2F/femtoscopy/hal/helpers/CbmHelix.h similarity index 70% rename from analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmHelix.h rename to analysis/PWGC2F/femtoscopy/hal/helpers/CbmHelix.h index a24eb7192e63863c053ba51bf7872eb305dd3bd5..a925f525c46e946724c47aab72e7aa5a234af3ad 100644 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmHelix.h +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/CbmHelix.h @@ -1,22 +1,11 @@ -/* Copyright (C) 2019-2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmHelix.h - * - * Created on: 27 sie 2019 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - * version of CbmKFTrack without any additional dependencies - */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ #ifndef CBMHELIX_H_ #define CBMHELIX_H_ #include "CbmGlobalTrack.h" #include "CbmStsTrack.h" - #include "FairField.h" #include <TObject.h> @@ -25,10 +14,13 @@ /** * smmaerl version of CbmKFTrack */ -#define SKIP_LOSSES +namespace Hal +{ + class MagField; +} class CbmHelix : public TObject { -protected: + protected: Double_t fT[6], fTb[15]; Double_t Qp() const { return fT[4]; }; void SetQp(Double_t qp) { fT[4] = qp; } @@ -37,18 +29,16 @@ protected: Double_t Z() const { return fT[5]; } Double_t Tx() const { return fT[2]; } Double_t Ty() const { return fT[3]; } - static FairField* fgField; + static Hal::MagField* fgField; Int_t indexS(Int_t i, Int_t j) { return (j <= i) ? i * (i + 1) / 2 + j : j * (j + 1) / 2 + i; } - void multQtSQ(const Int_t N, Double_t Q[]); void ExtrapolateLine(Double_t z_out); - Int_t ExtrapolateRK4(Double_t z_out); Int_t ExtrapolateALight(Double_t z_out); Int_t Propagate(Double_t Z); void SetParameters(const FairTrackParam* param); -public: + public: CbmHelix(); - static void SetField(FairField* field) { fgField = field; }; + static void SetField(Hal::MagField* field) { fgField = field; }; CbmHelix(const CbmHelix& other); CbmHelix& operator=(const CbmHelix& other); void Build(const FairTrackParam* params) { SetParameters(params); } @@ -59,6 +49,8 @@ public: { std::cout << Form("T={%4.2f\t%4.2f\t%4.2f\t%4.2f\t%4.2f\t%4.2f}", fT[0], fT[1], fT[2], fT[3], fT[4], fT[5]) << std::endl; + std::cout << Form("Tb={%4.2f\t%4.2f\t%4.2f\t%4.2f\t%4.2f\t%4.2f}", fTb[0], fTb[1], fTb[2], fTb[3], fTb[4], fTb[5]) + << std::endl; } Double_t* GetTrack() { return fT; } TVector3 Eval(Double_t z); diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmAnalysisManager.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmAnalysisManager.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b21aeb5a8bfe7284614f39830d3a25d77cf2870a --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmAnalysisManager.cxx @@ -0,0 +1,27 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmAnalysisManager.h" + +#include "CbmFieldMapSym3.h" +#include "CbmHelix.h" +#include "HalCbmField.h" + +HalCbmAnalysisManager::HalCbmAnalysisManager() {} + +Bool_t HalCbmAnalysisManager::Init() +{ + if (fMagField == nullptr) { + fMagField = new CbmFieldMapSym3("field_v18a"); + fMagField->Init(); + SetField(new HalCbmField(fMagField)); + } + Bool_t stat = Hal::AnalysisManager::Init(); + CbmHelix::SetField(GetField()); + return stat; +} + +HalCbmAnalysisManager::~HalCbmAnalysisManager() +{ + if (fMagField) delete fMagField; +} diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmAnalysisManager.h b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmAnalysisManager.h new file mode 100644 index 0000000000000000000000000000000000000000..ef09be53d590459ea76667b51f62d48abc5c6d58 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmAnalysisManager.h @@ -0,0 +1,24 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMROOT_2023_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMANALYSISMANAGER_H_ +#define CBMROOT_2023_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMANALYSISMANAGER_H_ + +#include <Hal/AnalysisManager.h> +/** + * class that is used only to + */ + +class FairField; +class HalCbmAnalysisManager : public Hal::AnalysisManager { + FairField* fMagField = {nullptr}; + + public: + HalCbmAnalysisManager(); + HalCbmAnalysisManager(const HalCbmAnalysisManager& other) = delete; + virtual Bool_t Init(); + virtual ~HalCbmAnalysisManager(); + ClassDef(HalCbmAnalysisManager, 1) +}; + +#endif /* CBMROOT_2023_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMANALYSISMANAGER_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmNicaCompression.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmCompressionTask.cxx similarity index 80% rename from analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmNicaCompression.cxx rename to analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmCompressionTask.cxx index 72e7d212ce3d031a7878d3991ac203ebf011b399..0895cc261502ccf4114129be04ad8c46b9194d4c 100644 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmNicaCompression.cxx +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmCompressionTask.cxx @@ -1,31 +1,21 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmNicaCompression.cxx - * - * Created on: 7 lut 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmNicaCompression.h" +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmCompressionTask.h" #include "CbmMCTrack.h" #include "CbmTrackMatchNew.h" #include "CbmVertex.h" - #include "FairRootManager.h" -CbmNicaCompression::CbmNicaCompression() : fAllDep(kFALSE), fStsLinks(nullptr), fTofLinks(nullptr) +HalCbmCompressionTask::HalCbmCompressionTask() : fStsLinks(nullptr), fTofLinks(nullptr), fAllDep(kFALSE) { - fStsMatches = new NicaTrackClones("CbmTrackMatchNew", "StsTrackMatch", "STS"); - fTofMatches = new NicaTrackClones("CbmTrackMatchNew", "TofHitMatch", "TOF"); - fMCTracks = new NicaTrackClones("CbmMCTrack", "MCTrack", "MC"); + fStsMatches = new Hal::TrackClones("CbmTrackMatchNew", "StsTrackMatch", "STS"); + fTofMatches = new Hal::TrackClones("CbmTrackMatchNew", "TofHitMatch", "TOF"); + fMCTracks = new Hal::TrackClones("CbmMCTrack", "MCTrack", "MC"); } -InitStatus CbmNicaCompression::Init() +InitStatus HalCbmCompressionTask::Init() { FairRootManager* mngr = FairRootManager::Instance(); fTofMatches->GetFromTree(); @@ -53,7 +43,7 @@ InitStatus CbmNicaCompression::Init() return kSUCCESS; } -void CbmNicaCompression::Exec(Option_t* opt) +void HalCbmCompressionTask::Exec(Option_t* /*opt*/) { fMapUse.MakeBigger(fMCTracks->GetEntriesFast()); fMapIndex.MakeBigger(fMCTracks->GetEntriesFast()); @@ -65,13 +55,15 @@ void CbmNicaCompression::Exec(Option_t* opt) fMapUse[i] = 0; fMapIndex[i] = -2; } - if (fAllDep) { WithDep(); } + if (fAllDep) { + WithDep(); + } else { NoDep(); } } -void CbmNicaCompression::NoDep() +void HalCbmCompressionTask::NoDep() { for (int i = 0; i < fStsMatches->GetEntriesFast(); i++) { CbmTrackMatchNew* match = (CbmTrackMatchNew*) fStsMatches->UncheckedAt(i); @@ -83,7 +75,9 @@ void CbmNicaCompression::NoDep() for (int i = 0; i < fTofMatches->GetEntriesFast(); i++) { CbmTrackMatchNew* match = (CbmTrackMatchNew*) fTofMatches->UncheckedAt(i); int index = match->GetMatchedLink().GetIndex(); - if (index >= 0) { fMapUse[index] = 1; } + if (index >= 0) { + fMapUse[index] = 1; + } } int count = 0; for (int i = 0; i < fMCTracks->GetEntriesFast(); i++) { @@ -99,7 +93,9 @@ void CbmNicaCompression::NoDep() for (int i = 0; i < fMCTracks->GetEntriesFast(); i++) { CbmMCTrack* mc = (CbmMCTrack*) fMCTracks->UncheckedAt(i); int mom = mc->GetMotherId(); - if (mom >= 0) { mc->SetMotherId(fMapIndex[mom]); } + if (mom >= 0) { + mc->SetMotherId(fMapIndex[mom]); + } } //ok let's fix matches @@ -129,20 +125,24 @@ void CbmNicaCompression::NoDep() } } -void CbmNicaCompression::WithDep() +void HalCbmCompressionTask::WithDep() { for (int i = 0; i < fStsMatches->GetEntriesFast(); i++) { CbmTrackMatchNew* match = (CbmTrackMatchNew*) fStsMatches->UncheckedAt(i); for (int j = 0; j < match->GetNofLinks(); j++) { int index = match->GetLink(j).GetIndex(); - if (index >= 0) { fMapUse[index] = 1; } + if (index >= 0) { + fMapUse[index] = 1; + } } } for (int i = 0; i < fTofMatches->GetEntriesFast(); i++) { CbmTrackMatchNew* match = (CbmTrackMatchNew*) fTofMatches->UncheckedAt(i); for (int j = 0; j < match->GetNofLinks(); j++) { int index = match->GetLink(j).GetIndex(); - if (index >= 0) { fMapUse[index] = 1; } + if (index >= 0) { + fMapUse[index] = 1; + } } } int count = 0; @@ -159,7 +159,9 @@ void CbmNicaCompression::WithDep() for (int i = 0; i < fMCTracks->GetEntriesFast(); i++) { CbmMCTrack* mc = (CbmMCTrack*) fMCTracks->UncheckedAt(i); int mom = mc->GetMotherId(); - if (mom >= 0) { mc->SetMotherId(fMapIndex[mom]); } + if (mom >= 0) { + mc->SetMotherId(fMapIndex[mom]); + } } //ok let's fix matches @@ -170,7 +172,9 @@ void CbmNicaCompression::WithDep() for (int iLink = 0; iLink < match->GetNofLinks(); iLink++) { CbmLink link = match->GetLink(iLink); int index = link.GetIndex(); - if (index >= 0) { link.SetIndex(fMapIndex[index]); } + if (index >= 0) { + link.SetIndex(fMapIndex[index]); + } match2->AddLink(link); } } @@ -181,10 +185,12 @@ void CbmNicaCompression::WithDep() for (int iLink = 0; iLink < match->GetNofLinks(); iLink++) { CbmLink link = match->GetLink(iLink); int index = link.GetIndex(); - if (index >= 0) { link.SetIndex(fMapIndex[index]); } + if (index >= 0) { + link.SetIndex(fMapIndex[index]); + } match2->AddLink(link); } } } -CbmNicaCompression::~CbmNicaCompression() {} +HalCbmCompressionTask::~HalCbmCompressionTask() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmCompressionTask.h b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmCompressionTask.h new file mode 100644 index 0000000000000000000000000000000000000000..8b65fb7f4f8cc1cff9c1f89516709af3a0be0f8e --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmCompressionTask.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMNICACOMPRESSION_H_ +#define CBMNICACOMPRESSION_H_ + +#include "FairTask.h" + +#include <TClonesArray.h> + +#include <Hal/Array.h> +#include <Hal/TrackClones.h> + + +class HalCbmCompressionTask : public FairTask { + Hal::TrackClones* fStsMatches; + Hal::TrackClones* fTofMatches; + Hal::TrackClones* fMCTracks; + TClonesArray* fStsLinks; + TClonesArray* fTofLinks; + Hal::Array_1<Int_t> fMapUse; + Hal::Array_1<Int_t> fMapIndex; + Bool_t fAllDep; + void NoDep(); + void WithDep(); + + public: + HalCbmCompressionTask(); + InitStatus Init(); + void AllDependencies() { fAllDep = kTRUE; }; + void Exec(Option_t* opt); + virtual ~HalCbmCompressionTask(); + ClassDef(HalCbmCompressionTask, 1) +}; + +#endif /* CBMNICACOMPRESSION_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmDetectorID.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmDetectorID.cxx new file mode 100644 index 0000000000000000000000000000000000000000..06dcc2cde71cd22cad0e7a7ea1c4d40827e049d8 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmDetectorID.cxx @@ -0,0 +1,4 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmDetectorID.h" diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmDetectorID.h b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmDetectorID.h new file mode 100644 index 0000000000000000000000000000000000000000..a9557842be1be20048515da5cf8e140142b237e5 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmDetectorID.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMROOT_NICA_CBM_HELPERS_CBMDETECTORID_H_ +#define CBMROOT_NICA_CBM_HELPERS_CBMDETECTORID_H_ + +#include <Hal/DataFormat.h> +namespace HalCbm +{ + namespace DetectorID + { + const UInt_t kTOF = Hal::DetectorID::kTOF; + const UInt_t kSTS = Hal::DetectorID::kSTS; + const UInt_t kMVD = 29641; + const UInt_t kRICH = 1283489; + const UInt_t kTRD = 38569; + const UInt_t kECAL = 669117; + const UInt_t kPSD = 33421; + const UInt_t kMUCH = 1065761; + }; // namespace DetectorID + enum class GeoSetup + { + kSis100Hadron = 0, + kSis100Electron = 1, + kSis100Muon = 2, + kSis100Mini = 3 + }; + enum class DataFormat + { + kDST = 0, + kAnalysisTree = 1, + kUnknown = 2 + }; +} // namespace HalCbm + + +#endif /* CBMROOT_NICA_CBM_HELPERS_CBMDETECTORID_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmField.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmField.cxx new file mode 100644 index 0000000000000000000000000000000000000000..403c660a35f646cf2398b578d57f1578d29cbbe1 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmField.cxx @@ -0,0 +1,21 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmField.h" + +#include <FairField.h> + +HalCbmField::~HalCbmField() { fField = nullptr; } + +HalCbmField::HalCbmField(FairField* f) : fField(f) {} + +TVector3 HalCbmField::GetField(Double_t x, Double_t y, Double_t z) const +{ + return TVector3(fField->GetBx(x, y, z), fField->GetBy(x, y, z), fField->GetBz(x, y, z)); +} + +HalCbmField::HalCbmField(const HalCbmField& other) +{ + // TODO Auto-generated constructor stub + fField = other.fField; +} diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmField.h b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmField.h new file mode 100644 index 0000000000000000000000000000000000000000..427ff1a58b00b9ee351dbffae5e09a5851c92a69 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmField.h @@ -0,0 +1,22 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMROOT_2023_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMFIELD_H_ +#define CBMROOT_2023_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMFIELD_H_ + +#include <Hal/MagField.h> + +class FairField; + +class HalCbmField : public Hal::MagField { + FairField* fField = {nullptr}; + + public: + HalCbmField(FairField* f = nullptr); + TVector3 GetField(Double_t x, Double_t y, Double_t z) const; + virtual ~HalCbmField(); + HalCbmField(const HalCbmField& other); + ClassDef(HalCbmField, 1) +}; + +#endif /* CBMROOT_2023_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMFIELD_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmHelpersLinkDef.h b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmHelpersLinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..5f4b2c89824ab84fbb3d1e2044de85c77e29a20b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmHelpersLinkDef.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ namespace HalCbm; +#pragma link C++ namespace HalCbm::DetectorID; +#pragma link C++ enum HalCbm::GeoSetup; +#pragma link C++ enum HalCbm::DataFormat; +#pragma link C++ class HalCbmTaskManager + ; +#pragma link C++ class HalCbmCompressionTask + ; +#pragma link C++ class CbmHelix + ; +#pragma link C++ class HalCbmField + ; +#pragma link C++ class HalCbmAnalysisManager + ; + +#pragma link C++ class CbmAnaTreeRecoSourceContainer + ; +#pragma link C++ class CbmAnaTreeMcSourceContainer + ; +#pragma link C++ class CbmAnaTreeSource + ; +#pragma link C++ class CbmAnaTreeObjectTrack + ; +#pragma link C++ class HalCbmATIOManager + ; +#pragma link C++ class HalCbmSource + ; + +//#pragma link C++ class CbmNicaCompression + ; diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmTaskManager.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmTaskManager.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fd662951d318a504ac98eaa147339cfcab27f74a --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmTaskManager.cxx @@ -0,0 +1,40 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmTaskManager.h" + +#include "CbmFieldMap.h" +#include "CbmFieldMapSym3.h" +#include "HalCbmField.h" + +#include <FairRunAna.h> + +#include <iostream> +#include <vector> + +#include <Hal/IOManager.h> +#include <Hal/RootManager.h> + + +HalCbmTaskManager::HalCbmTaskManager() : fMagField(nullptr) {} + +InitStatus HalCbmTaskManager::Init() +{ + if (!FairRunAna::Instance()->GetField()) { + FairField* field = new CbmFieldMapSym3("field_v18a"); + field->Init(); + fMagField = new HalCbmField(field); + } + else { + fMagField = new HalCbmField(FairRunAna::Instance()->GetField()); + } + CbmHelix::SetField(fMagField); + fManager = new Hal::Fair::RootManager(); + return Hal::Fair::TaskManager::Init(); +} + +HalCbmTaskManager::~HalCbmTaskManager() +{ + delete fMagField; + delete fManager; +} diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmTaskManager.h b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmTaskManager.h new file mode 100644 index 0000000000000000000000000000000000000000..d68ba0752868ce6e9a059775af9c20f3d22c2307 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/HalCbmTaskManager.h @@ -0,0 +1,32 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef HALCBMTASKMANAGER_H_ +#define HALCBMTASKMANAGER_H_ +#include "CbmHelix.h" +#include "FairField.h" +#include "FairTask.h" + +#include <Hal/TaskManager.h> + +namespace Hal +{ + class IOManager; + class Task; + class MagField; +} // namespace Hal +/** + * wrapper based on FairTask to use Hal::Task from FairRoot + */ +class HalCbmTaskManager : public Hal::Fair::TaskManager { + Hal::MagField* fMagField; + + protected: + InitStatus Init(); + + public: + HalCbmTaskManager(); + virtual ~HalCbmTaskManager(); + ClassDef(HalCbmTaskManager, 1) +}; +#endif /* HALCBMTASKMANAGER_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeContainer.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeContainer.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f56b6300082bbe2bc7242bea617168f7ed68598b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeContainer.cxx @@ -0,0 +1,126 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "CbmAnaTreeContainer.h" + +#include "AnalysisTree/Matching.hpp" + +#include <TChain.h> +#include <TFile.h> + +#include <AnalysisTree/Configuration.hpp> + +#include <Hal/Cout.h> + +Bool_t CbmAnaTreeRecoSourceContainer::ConnectToTree(TChain* tree) +{ + fEvent = new AnalysisTree::EventHeader(); + fVtxTracks = new AnalysisTree::TrackDetector(); + fTofHits = new AnalysisTree::HitDetector(); + fVtx2Tof = new AnalysisTree::Matching(); + fVtx2Mc = new AnalysisTree::Matching(); + if (tree->GetBranch("VtxTracks.") == nullptr) { + Hal::Cout::PrintInfo("Lack of VtxTracks in AT", Hal::EInfo::kError); + return kFALSE; + } + if (tree->GetBranch("RecEventHeader.") == nullptr) { + Hal::Cout::PrintInfo("Lack of RecEventHeader in AT", Hal::EInfo::kError); + return kFALSE; + } + if (tree->GetBranch("TofHits.") == nullptr) { + Hal::Cout::PrintInfo("Lack of TofHits in AT", Hal::EInfo::kError); + return kFALSE; + } + if (tree->GetBranch("VtxTracks2TofHits.") == nullptr) { + Hal::Cout::PrintInfo("Lack of VtxTracks2TofHits tracks in AT", Hal::EInfo::kError); + return kFALSE; + } + tree->SetBranchAddress("VtxTracks.", &fVtxTracks); + tree->SetBranchAddress("RecEventHeader.", &fEvent); + tree->SetBranchAddress("TofHits.", &fTofHits); + tree->SetBranchAddress("VtxTracks2TofHits.", &fVtx2Tof); + tree->SetBranchStatus("VtxTracks.", 1); + tree->SetBranchStatus("RecEventHeader.", 1); + tree->SetBranchStatus("TofHits.", 1); + tree->SetBranchStatus("VtxTracks2TofHits.", 1); + if (tree->GetBranch("VtxTracks2SimParticles.")) { + tree->SetBranchAddress("VtxTracks2SimParticles.", &fVtx2Mc); + tree->SetBranchStatus("VtxTracks2SimParticles.", 1); + } + + return kTRUE; +} + +Bool_t CbmAnaTreeMcSourceContainer::ConnectToTree(TChain* tree) +{ + fEvent = new AnalysisTree::EventHeader(); + fParticles = new AnalysisTree::Particles(); + if (tree->GetBranch("SimEventHeader.") == nullptr) return kFALSE; + if (tree->GetBranch("SimParticles.") == nullptr) return kFALSE; + tree->SetBranchAddress("SimEventHeader.", &fEvent); + tree->SetBranchAddress("SimParticles.", &fParticles); + tree->SetBranchStatus("SimEventHeader.", 1); + tree->SetBranchStatus("SimParticles.", 1); + return kTRUE; +} + +void CbmAnaTreeRecoSourceContainer::LoadFields(TString file) +{ + TFile* oldFile = gFile; + TDirectory* oldDir = gDirectory; + + TFile* f = new TFile(file); + AnalysisTree::Configuration* conf = (AnalysisTree::Configuration*) f->Get("Configuration"); + GetFieldIds().vtx_px = conf->GetBranchConfig("VtxTracks").GetFieldId("px"); + GetFieldIds().vtx_py = conf->GetBranchConfig("VtxTracks").GetFieldId("py"); + GetFieldIds().vtx_pz = conf->GetBranchConfig("VtxTracks").GetFieldId("pz"); + GetFieldIds().vtx_dcax = conf->GetBranchConfig("VtxTracks").GetFieldId("dcax"); + GetFieldIds().vtx_dcay = conf->GetBranchConfig("VtxTracks").GetFieldId("dcay"); + GetFieldIds().vtx_dcaz = conf->GetBranchConfig("VtxTracks").GetFieldId("dcaz"); + + GetFieldIds().vtx_chi2 = conf->GetBranchConfig("VtxTracks").GetFieldId("chi2"); + GetFieldIds().vtx_vtxchi2 = conf->GetBranchConfig("VtxTracks").GetFieldId("vtx_chi2"); + GetFieldIds().vtx_q = conf->GetBranchConfig("VtxTracks").GetFieldId("q"); + GetFieldIds().vtx_nhits = conf->GetBranchConfig("VtxTracks").GetFieldId("nhits"); + GetFieldIds().vtx_mvdhits = conf->GetBranchConfig("VtxTracks").GetFieldId("nhits_mvd"); + + + GetFieldIds().tof_mass2 = conf->GetBranchConfig("TofHits").GetFieldId("mass2"); + + GetFieldIds().vtx_x = conf->GetBranchConfig("VtxTracks").GetFieldId("x"); + GetFieldIds().vtx_cx0 = conf->GetBranchConfig("VtxTracks").GetFieldId("cx0"); + GetFieldIds().vtx_cov1 = conf->GetBranchConfig("VtxTracks").GetFieldId("cov1"); + gFile = oldFile; + gDirectory = oldDir; + + f->Close(); + delete f; +} + +void CbmAnaTreeMcSourceContainer::LoadFields(TString inFile) +{ + TFile* oldFile = gFile; + TDirectory* oldDir = gDirectory; + + TFile* f = new TFile(inFile); + + AnalysisTree::Configuration* conf = (AnalysisTree::Configuration*) f->Get("Configuration"); + + GetFieldIds().px = conf->GetBranchConfig("SimParticles").GetFieldId("px"); + GetFieldIds().py = conf->GetBranchConfig("SimParticles").GetFieldId("py"); + GetFieldIds().pz = conf->GetBranchConfig("SimParticles").GetFieldId("pz"); + GetFieldIds().mass = conf->GetBranchConfig("SimParticles").GetFieldId("mass"); + GetFieldIds().pdg = conf->GetBranchConfig("SimParticles").GetFieldId("pid"); + GetFieldIds().motherId = conf->GetBranchConfig("SimParticles").GetFieldId("mother_id"); + GetFieldIds().event_b = conf->GetBranchConfig("SimEventHeader").GetFieldId("b"); + GetFieldIds().event_psi = conf->GetBranchConfig("SimEventHeader").GetFieldId("psi_RP"); + GetFieldIds().freezX = conf->GetBranchConfig("SimParticles").GetFieldId("xfreez"); + GetFieldIds().freezY = conf->GetBranchConfig("SimParticles").GetFieldId("yfreez"); + GetFieldIds().freezZ = conf->GetBranchConfig("SimParticles").GetFieldId("zfreez"); + GetFieldIds().freezT = conf->GetBranchConfig("SimParticles").GetFieldId("tfreez"); + gFile = oldFile; + gDirectory = oldDir; + + f->Close(); + delete f; +} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeContainer.h b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeContainer.h similarity index 64% rename from analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeContainer.h rename to analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeContainer.h index c89fc7dfa5702aea09721790464bda7b5314ee09..4c6d77cc108bd32928f7d28abadf9a4894cc49b3 100644 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeContainer.h +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeContainer.h @@ -1,23 +1,14 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmDstAnaTreeContainer.h - * - * Created on: 17 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ #ifndef NICACBMATCONTAINER_H_ #define NICACBMATCONTAINER_H_ #include <TNamed.h> -#include "AnalysisTree/Detector.hpp" -#include "AnalysisTree/EventHeader.hpp" -#include "AnalysisTree/Matching.hpp" +#include <AnalysisTree/Detector.hpp> +#include <AnalysisTree/EventHeader.hpp> +#include <AnalysisTree/Matching.hpp> class TChain; @@ -31,20 +22,16 @@ struct AnaTreeRecoIds { }; class CbmAnaTreeRecoSourceContainer : public TNamed { - AnalysisTree::EventHeader* fEvent; - AnalysisTree::TrackDetector* fVtxTracks; - AnalysisTree::Matching* fVtx2Tof; - AnalysisTree::HitDetector* fTofHits; - AnalysisTree::Matching* fVtx2Mc; + AnalysisTree::EventHeader* fEvent = {nullptr}; + AnalysisTree::TrackDetector* fVtxTracks = {nullptr}; + AnalysisTree::Matching* fVtx2Tof = {nullptr}; + AnalysisTree::HitDetector* fTofHits = {nullptr}; + AnalysisTree::Matching* fVtx2Mc = {nullptr}; AnaTreeRecoIds fVtxIds; -public: - CbmAnaTreeRecoSourceContainer() - : fEvent(nullptr) - , fVtxTracks(nullptr) - , fVtx2Tof(nullptr) - , fTofHits(nullptr) - , fVtx2Mc(nullptr) {}; + public: + CbmAnaTreeRecoSourceContainer(){}; + void LoadFields(TString file); Bool_t ConnectToTree(TChain* tree); inline AnalysisTree::EventHeader* GetEventHeader() const { return fEvent; }; inline AnalysisTree::TrackDetector* GetVtxTracks() const { return fVtxTracks; }; @@ -74,12 +61,13 @@ struct AnaTreeMcIds { }; class CbmAnaTreeMcSourceContainer : public TNamed { - AnalysisTree::EventHeader* fEvent; - AnalysisTree::Particles* fParticles; + AnalysisTree::EventHeader* fEvent = {nullptr}; + AnalysisTree::Particles* fParticles = {nullptr}; AnaTreeMcIds fIds; -public: - CbmAnaTreeMcSourceContainer() : fEvent(nullptr), fParticles(nullptr) {}; + public: + CbmAnaTreeMcSourceContainer(){}; + void LoadFields(TString inFile); Bool_t ConnectToTree(TChain* tree); inline AnaTreeMcIds& GetFieldIds() { return fIds; }; inline AnalysisTree::EventHeader* GetEventHeader() const { return fEvent; }; diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeObjectTrack.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeObjectTrack.cxx new file mode 100644 index 0000000000000000000000000000000000000000..02bfb5f8df29feb5e97672c86b582dd3b3068b8b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeObjectTrack.cxx @@ -0,0 +1,25 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "CbmAnaTreeObjectTrack.h" + +CbmAnaTreeObjectTrack::CbmAnaTreeObjectTrack() {} + +CbmAnaTreeObjectTrack::~CbmAnaTreeObjectTrack() {} + +CbmAnaTreeObjectTrack::CbmAnaTreeObjectTrack(const CbmAnaTreeObjectTrack& other) + : TObject() + , fTreeParticle(other.fTreeParticle) + , fTreeTrack(other.fTreeTrack) + , fTreeHit(other.fTreeHit) +{ +} + +CbmAnaTreeObjectTrack& CbmAnaTreeObjectTrack::operator=(const CbmAnaTreeObjectTrack& other) +{ + if (this == &other) return *this; + fTreeParticle = other.fTreeParticle; + fTreeTrack = other.fTreeTrack; + fTreeHit = other.fTreeHit; + return *this; +} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeObjectTrack.h b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeObjectTrack.h similarity index 58% rename from analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeObjectTrack.h rename to analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeObjectTrack.h index 0564e3610040010c9e7737b1fd27ba0350dcef12..3301f16b83661660bf571fc1d27c1bb78fbbeea8 100644 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeObjectTrack.h +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeObjectTrack.h @@ -1,40 +1,32 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmAnaTreeObjectTrack.h - * - * Created on: 14 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ #ifndef CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_FORMAT_ANATREE_CBMANATREEOBJECTTRACK_H_ #define CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_FORMAT_ANATREE_CBMANATREEOBJECTTRACK_H_ #include <TObject.h> -#include "AnalysisTree/Detector.hpp" -#include "AnalysisTree/Hit.hpp" -#include "AnalysisTree/Particle.hpp" +#include <AnalysisTree/Detector.hpp> +#include <AnalysisTree/Hit.hpp> +#include <AnalysisTree/Particle.hpp> class CbmAnaTreeObjectTrack : public TObject { - AnalysisTree::Particle* fTreeParticle; - AnalysisTree::Track* fTreeTrack; - AnalysisTree::Hit* fTreeHit; + AnalysisTree::Particle* fTreeParticle = {nullptr}; + AnalysisTree::Track* fTreeTrack = {nullptr}; + AnalysisTree::Hit* fTreeHit = {nullptr}; -public: + public: CbmAnaTreeObjectTrack(); AnalysisTree::Particle* GetTreeParticle() const { return fTreeParticle; }; AnalysisTree::Track* GetTreeTrack() const { return fTreeTrack; }; AnalysisTree::Hit* GetTreeHit() const { return fTreeHit; }; void SetTreeParticle(AnalysisTree::Particle* p) { fTreeParticle = p; }; void SetTreeTrack(AnalysisTree::Track* t) { fTreeTrack = t; }; - void SetTreeTof(AnalysisTree::Hit* h) { fTreeHit = t; }; + void SetTreeTof(AnalysisTree::Hit* h) { fTreeHit = h; }; virtual ~CbmAnaTreeObjectTrack(); CbmAnaTreeObjectTrack(const CbmAnaTreeObjectTrack& other); CbmAnaTreeObjectTrack& operator=(const CbmAnaTreeObjectTrack& other); + ClassDef(CbmAnaTreeObjectTrack, 1) }; #endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_FORMAT_ANATREE_CBMANATREEOBJECTTRACK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeSource.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeSource.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2122087bbd73f340ad72d64e70c0e2d9fd17d6aa --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeSource.cxx @@ -0,0 +1,137 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "CbmAnaTreeSource.h" + +#include "CbmAnaTreeContainer.h" + +#include <FairLogger.h> +#include <FairRootManager.h> + +#include <TBranch.h> +#include <TChain.h> +#include <TFile.h> + +#include <AnalysisTree/Configuration.hpp> +#include <fstream> + + +CbmAnaTreeSource::CbmAnaTreeSource() : CbmAnaTreeSource("", "aTree") {} + +CbmAnaTreeSource::CbmAnaTreeSource(TString inFile, TString treeName) + : fNFiles(1) + , fTreeName(treeName) + , fChain(nullptr) + , fFileName(nullptr) + , fContainerReco(nullptr) + , fContainerSim(nullptr) +{ + fFileName = new TString[1]; + fFileName[0] = inFile; +} + +CbmAnaTreeSource::~CbmAnaTreeSource() +{ + if (fFileName) delete[] fFileName; +} + +Bool_t CbmAnaTreeSource::Init() +{ + LOG(debug) << "Init source "; + FairRootManager* mngr = FairRootManager::Instance(); + fChain = new TChain(fTreeName); //new name of tree? + TString first_file_name; + if (fFileName[0].EndsWith(".root")) { + for (int i = 0; i < fNFiles; i++) { + LOG(debug) << "CbmAnaTree: opening single file" << fFileName[i]; + fChain->Add(fFileName[i]); + } + first_file_name = fFileName[0]; + } + else { // this is long list + std::ifstream list; + list.open(fFileName[0]); + bool first = true; + do { + TString temp; + list >> temp; + if (temp.Length() > 1) { + fChain->Add(temp); + if (first) { + first_file_name = temp; + first = false; + } + } + else { + break; + } + LOG(debug) << "Adding file " << temp << " to chain"; + } while (!list.eof()); + list.close(); + } + LOG(debug) << "load container "; + fContainerReco = new CbmAnaTreeRecoSourceContainer(); + fContainerSim = new CbmAnaTreeMcSourceContainer(); + Bool_t recoAvail = fContainerReco->ConnectToTree(fChain); + Bool_t simAvail = fContainerSim->ConnectToTree(fChain); + if (recoAvail == kFALSE) { + delete fContainerReco; + fContainerReco = nullptr; + } + if (simAvail == kFALSE) { + delete fContainerSim; + fContainerSim = nullptr; + } + LOG(debug) << "load conf "; + LoadConf(first_file_name); + mngr->SetInChain(fChain, -1); + if (fContainerReco) { + LOG(debug) << "Loading reco data"; + mngr->Register("CbmAnaTreeSourceContainer.", "CbmAnaTreeSourceContainer", fContainerReco, kFALSE); + } + if (fContainerSim) { + LOG(debug) << "Loading sim ana"; + mngr->Register("CbmAnaTreeMcSourceContainer.", "CbmAnaTreeMcSourceContainer", fContainerSim, kFALSE); + } + return kTRUE; +} + +Int_t CbmAnaTreeSource::ReadEvent(UInt_t unsignedInt) +{ + fChain->GetEntry(unsignedInt); + return 0; +} + +void CbmAnaTreeSource::Close() {} + +void CbmAnaTreeSource::LoadConf(TString name) +{ + /// Save old global file and folder pointer to avoid messing with FairRoot + TFile* oldFile = gFile; + TDirectory* oldDir = gDirectory; + + if (fContainerReco) { + fContainerReco->LoadFields(name); + } + if (fContainerSim) { + fContainerSim->LoadFields(name); + } + + /// Restore old global file and folder pointer to avoid messing with FairRoot + gFile = oldFile; + gDirectory = oldDir; +} + +void CbmAnaTreeSource::AddFile(TString file) +{ + TString* temp = fFileName; + fFileName = new TString[fNFiles + 1]; + for (int i = 0; i < fNFiles; i++) { + fFileName[i] = temp[i]; + } + delete[] temp; + fFileName[fNFiles] = file; + fNFiles = fNFiles + 1; +} + +Int_t CbmAnaTreeSource::CheckMaxEventNo(Int_t /*int1*/) { return fChain->GetEntries(); } diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeSource.h b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeSource.h similarity index 75% rename from analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeSource.h rename to analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeSource.h index b7e1f5acfb5eafac6307246f66e0eee7ad478d5a..2460c4674a161a43c54dd0dd494d7f06c0c3b6e5 100644 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeSource.h +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/CbmAnaTreeSource.h @@ -1,15 +1,6 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmAnaTreeSource.h - * - * Created on: 15 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ #ifndef CBMANATREESOURCE_H_ #define CBMANATREESOURCE_H_ /** @@ -33,10 +24,10 @@ class CbmAnaTreeSource : public FairSource { CbmAnaTreeRecoSourceContainer* fContainerReco; CbmAnaTreeMcSourceContainer* fContainerSim; -protected: + protected: void LoadConf(TString name); -public: + public: /** * defaut constructor should not be used */ @@ -58,17 +49,17 @@ public: virtual Int_t ReadEvent(UInt_t = 0); virtual void AddFile(TString file); virtual void Close(); - virtual void Reset() {}; + virtual void Reset(){}; virtual Bool_t ActivateObject(TObject**, const char*) { return kFALSE; } virtual Source_Type GetSourceType() { return kFILE; }; - virtual void SetParUnpackers() {}; + virtual void SetParUnpackers(){}; virtual Bool_t SpecifyRunId() { return kTRUE; }; virtual Bool_t InitUnpackers() { return kTRUE; }; virtual Bool_t ReInitUnpackers() { return kTRUE; }; virtual Int_t CheckMaxEventNo(Int_t = 0); - virtual void ReadBranchEvent(const char* /*BrName*/) {}; - virtual void ReadBranchEvent(const char* /*BrName*/, Int_t /*Event*/) {}; - virtual void FillEventHeader(FairEventHeader* /*feh*/) {}; + virtual void ReadBranchEvent(const char* /*BrName*/){}; + virtual void ReadBranchEvent(const char* /*BrName*/, Int_t /*Event*/){}; + virtual void FillEventHeader(FairEventHeader* /*feh*/){}; CbmAnaTreeRecoSourceContainer* GetRecoContainer() const { return fContainerReco; }; CbmAnaTreeMcSourceContainer* GetSimContainer() const { return fContainerSim; } void SetRunId(Int_t runId) { fRunId = runId; } diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/HalCbmSource.cxx b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/HalCbmSource.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dd8dae3baf3f6c7ef3c9ebe0fd3a7c413d83ad0b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/HalCbmSource.cxx @@ -0,0 +1,59 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "HalCbmSource.h" + +#include "CbmAnaTreeContainer.h" + +#include <TBranch.h> +#include <TNamed.h> +#include <TObjArray.h> + +#include <Hal/RootIOManager.h> + +HalCbmSource::HalCbmSource(TString filename) : Source(filename) { fManager = new HalCbmATIOManager(filename); } + +void HalCbmSource::AddFile(TString fileName) { fManager->AddFile(fileName); } + +void HalCbmSource::AddFriend(TString friendName, Int_t level) { fManager->AddFriend(friendName, level); } + +HalCbmSource::~HalCbmSource() { delete fManager; } + +void HalCbmATIOManager::FillBranches() +{ + auto inchain = GetInChain(); + fRecoContainer = new CbmAnaTreeRecoSourceContainer(); + fSimContainer = new CbmAnaTreeMcSourceContainer(); + Bool_t recoAvail = fRecoContainer->ConnectToTree(inchain[0]); + Bool_t simAvail = fSimContainer->ConnectToTree(inchain[0]); + fRecoContainer->LoadFields(GetInputFileName()); + fSimContainer->LoadFields(GetInputFileName()); + int count = -1; + for (auto chain : inchain) { + count++; + if (count == 0) { + if (recoAvail) { + AddBranch("CbmAnaTreeSourceContainer.", fRecoContainer, Hal::BranchInfo::EFlag::kInActive); + } + if (simAvail) { + AddBranch("CbmAnaTreeMcSourceContainer.", fSimContainer, Hal::BranchInfo::EFlag::kInActive); + } + continue; //skip first chain - we are looking for AT data + } + TObjArray* list_branch = chain->GetListOfBranches(); + for (int i = 0; i < list_branch->GetEntries(); i++) { + TBranch* branch = (TBranch*) list_branch->At(i); + TString name = branch->GetName(); + TObject** obj = new TObject*(); + PushTObject(obj); + chain->SetBranchAddress(name, obj); + AddBranch(branch->GetName(), obj[0], Hal::BranchInfo::EFlag::kInActive); + } + } +} + +HalCbmATIOManager::~HalCbmATIOManager() +{ + if (fRecoContainer) delete fRecoContainer; + if (fSimContainer) delete fSimContainer; +} diff --git a/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/HalCbmSource.h b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/HalCbmSource.h new file mode 100644 index 0000000000000000000000000000000000000000..2746315511b25ada74fc726da02987722ad01cad --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/helpers/anatree/HalCbmSource.h @@ -0,0 +1,49 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMROOT_2023_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMSOURCE_H_ +#define CBMROOT_2023_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMSOURCE_H_ + +#include <RtypesCore.h> +#include <TChain.h> +#include <TFile.h> +#include <TString.h> + +#include <vector> + +#include <Hal/IOManager.h> +#include <Hal/RootIOManager.h> +#include <Hal/Source.h> + +/** + * ugly work-around for AT that doesn't contain TObject based object + */ +class CbmAnaTreeRecoSourceContainer; +class CbmAnaTreeMcSourceContainer; + +class HalCbmATIOManager : public Hal::RootIOManager { + protected: + virtual void FillBranches(); + CbmAnaTreeRecoSourceContainer* fRecoContainer = {nullptr}; + CbmAnaTreeMcSourceContainer* fSimContainer = {nullptr}; + + public: + HalCbmATIOManager(TString name = "") : Hal::RootIOManager(name){}; + virtual ~HalCbmATIOManager(); + ClassDef(HalCbmATIOManager, 1) +}; + +class HalCbmSource : public Hal::Source { + protected: + HalCbmATIOManager* fManager; + + public: + HalCbmSource(TString filename = ""); + virtual void AddFile(TString fileName = ""); + virtual void AddFriend(TString friendName = "", Int_t level = 0); + Hal::IOManager* GetIOManager() const { return fManager; }; + virtual ~HalCbmSource(); + ClassDef(HalCbmSource, 1) +}; + +#endif /* CBMROOT_2023_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMSOURCE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/qa/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/hal/qa/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..19c6e6436d097c07dcf307cf9f331ae34a4b6b7e --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/qa/CMakeLists.txt @@ -0,0 +1,59 @@ +# Create a library called "" which includes the source files given in +# the array . +# The extension is already found. Any number of sources could be listed here. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") +Set(INCLUDE_DIRECTORIES + ${CMAKE_SOURCE_FAIRMCSTACK} + ${KF_HEADERS} + ${CBMDATA_DIR} + ${CBMDATA_DIR}/global + ${CBMDATA_DIR}/sts + ${HAL_CBM}/helpers + ${HAL_CBM}/qa + ${HAL_CBM_FORMAT} + ${HAL_CBM_CUTS} + ${Hal_INCLUDE_DIR} +) +Set(SYSTEM_INCLUDE_DIRECTORIES + ${ROOT_INCLUDE_DIR} + ${BASE_INCLUDE_DIRECTORIES} + ${CLHEP_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} +) + +Set(LINK_DIRECTORIES + ${ROOT_LIBRARY_DIR} + ${FAIRROOT_LIBRARY_DIR} + ${Boost_LIBRARY_DIRS} + ${Vc_LIB_DIR} + ${KFParticle_LIB_DIR} +) + +Include_Directories(${INCLUDE_DIRECTORIES}) +Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES}) + +Link_Directories(${LINK_DIRECTORIES}) + +# List of source files +set(SRCS +CbmQACoreManager.cxx +) + +Set(HEADERS ) +Set(LINKDEF HalCbmQALinkDef.h) +Set(LIBRARY_NAME HalCbmQa) +Set(PUBLIC_DEPENDENCIES + HalFeatures + HalCbmFormat + HalData + HalCbmCuts + FairRoot::Base + HalCut + HalAna + HalQA + KF + KFParticle) +generate_cbm_library() + +add_dependencies(G__HalCbmQa ANALYSISTREE HAL) + diff --git a/analysis/PWGC2F/femtoscopy/hal/qa/CbmQACoreManager.cxx b/analysis/PWGC2F/femtoscopy/hal/qa/CbmQACoreManager.cxx new file mode 100644 index 0000000000000000000000000000000000000000..07465fa5edf80419680d0cce350546400c283c94 --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/qa/CbmQACoreManager.cxx @@ -0,0 +1,134 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#include "CbmQACoreManager.h" + +#include "CbmAnaTreeSource.h" +#include "HalCbmBasicTrackCuts.h" +#include "HalCbmEvent.h" +#include "HalCbmFullEvent.h" +#include "HalCbmHbtEvent.h" +#include "HalCbmHbtFullEvent.h" +#include "HalCbmMCEvent.h" +#include "HalCbmTofCut.h" + +#include <FairRunAna.h> + +#include <TString.h> + +#include <Hal/TrackAna.h> + + +CbmQACoreManager::CbmQACoreManager() +{ + fEta[0] = -2; + fEta[1] = 4; + fDCAz[0] = 0; + fDCAz[1] = 10; +} + +Hal::Event* CbmQACoreManager::GetFormat(eFormatType type, eAnaType ana) +{ + switch (ana) { + case eAnaType::kDefault: + switch (type) { + case eFormatType::kComplex: return new HalCbmFullEvent(); break; + case eFormatType::kReco: return new HalCbmEvent(); break; + case eFormatType::kSim: return new HalCbmMCEvent(); break; + } + break; + case eAnaType::kHbt: + switch (type) { + case eFormatType::kComplex: return new HalCbmHbtFullEvent(); break; + case eFormatType::kReco: return new HalCbmHbtEvent(); break; + case eFormatType::kSim: return new HalCbmMCEvent(); break; + } + break; + } + return nullptr; +} + +void CbmQACoreManager::SetRecoTrackCut(Hal::TrackAna* ana, ePidCut cut, eParticleType primary, TString flag) +{ + HalCbmBasicTrackCuts cuts; + switch (cut) { + case ePidCut::kAntiProton: + cuts.SetCharge(-1); + cuts.SetNHits(4, 20); + cuts.SetM2(0.75, 1.1); + break; + case ePidCut::kKaonMinus: + cuts.SetCharge(-1); + cuts.SetNHits(4, 20); + cuts.SetM2(0.15, 0.29); + break; + case ePidCut::kKaonPlus: + cuts.SetCharge(1); + cuts.SetNHits(4, 20); + cuts.SetM2(0.15, 0.29); + break; + case ePidCut::kPionMinus: + cuts.SetCharge(-1); + cuts.SetNHits(4, 20); + cuts.SetM2(-0.1, 0.15); + break; + case ePidCut::kPionPlus: + cuts.SetCharge(1); + cuts.SetNHits(4, 20); + cuts.SetM2(0.0, 0.05); + cuts.SetPt(0.2, 10); + break; + case ePidCut::kProton: + cuts.SetPt(0.2, 10); + cuts.SetEta(1, 3.5); + cuts.SetCharge(1); + cuts.SetNHits(0, 20); + cuts.SetNStsHits(5, 20); + cuts.SetM2(0.75, 1.1); + //cuts.SetChi2(0, 12); + cuts.GetTofCut()->SetDownPoints(0.5, 1, 0.7, 0.8, 20, 0.76); + break; + default: break; + } + if (fUsetPid == kFALSE) { + cuts.SetM2(-1E+9, 1E+9); + } + switch (primary) { + case eParticleType::kPrimaryOnly: + cuts.SetDCAXY(0, 1); + cuts.SetDCAZ(-0.01, 0.01); + switch (cut) { + case ePidCut::kProton: { + cuts.SetDCAXY(0, 0.5); + } break; + default: break; + } + break; + case eParticleType::kSecondaryOnly: { + cuts.SetDCAXY(1, 1E+3); + cuts.SetDCAZ(0.00, 1E+3); + switch (cut) { + case ePidCut::kProton: { + cuts.SetDCAXY(1, 1E+3); + } break; + default: break; + } + break; + } break; + case eParticleType::kAll: break; + } + cuts.SetOptionForAllCuts(flag); + + ana->AddCutsAndMonitors(cuts); +} + +FairRunAna* CbmQACoreManager::GetRunAna(TString outFile, TString simFile, TString /*recoFile*/, TString /*parFile*/) +{ + FairRunAna* run = new FairRunAna(); + CbmAnaTreeSource* file = new CbmAnaTreeSource(simFile); + run->SetOutputFile(outFile); + run->SetSource(file); + return run; +} + +CbmQACoreManager::~CbmQACoreManager() {} diff --git a/analysis/PWGC2F/femtoscopy/hal/qa/CbmQACoreManager.h b/analysis/PWGC2F/femtoscopy/hal/qa/CbmQACoreManager.h new file mode 100644 index 0000000000000000000000000000000000000000..801837e805cae5277dc2b8d9901739934a01f3ab --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/qa/CbmQACoreManager.h @@ -0,0 +1,32 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#ifndef CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_HELPERS_CBMQACOREMANAGER_H_ +#define CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_HELPERS_CBMQACOREMANAGER_H_ + +#include <Hal/QAManager.h> +#include <Hal/QAManagerBasic.h> + +namespace Hal +{ + class Event; + class TrackAna; + class TwoTrackAna; +} // namespace Hal +class CbmQACoreManager : public Hal::Fair::QAManagerBasic { + public: + CbmQACoreManager(); + virtual FairRunAna* GetRunAna(TString outFile, TString simFile, TString recoFile, TString parFile = ""); + virtual Hal::Event* GetFormat(Hal::QAManager::eFormatType type, + Hal::QAManager::eAnaType ana = Hal::QAManager::eAnaType::kDefault); + virtual void SetRecoTrackCut(Hal::TrackAna* ana, Hal::QAManager::ePidCut cut, Hal::QAManager::eParticleType primary, + TString flag = ""); + virtual void SetEventCut(Hal::TrackAna* /*ana*/, Int_t /*col*/, TString /*flag = ""*/){}; + virtual void SetPairCut(Hal::TwoTrackAna* /*ana*/, Hal::QAManager::ePidCut /*pid1*/, + Hal::QAManager::ePidCut /*pid2*/){}; + virtual ~CbmQACoreManager(); + ClassDef(CbmQACoreManager, 1) +}; + + +#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_HELPERS_CBMQACOREMANAGER_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/hal/qa/HalCbmQALinkDef.h b/analysis/PWGC2F/femtoscopy/hal/qa/HalCbmQALinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..ae4bfa1e12e15e142d9fb42f12f3212a8b81772b --- /dev/null +++ b/analysis/PWGC2F/femtoscopy/hal/qa/HalCbmQALinkDef.h @@ -0,0 +1,9 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class CbmQACoreManager + ; +//#pragma link C++ class CbmNicaCompression + ; diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/nicafemto/CMakeLists.txt deleted file mode 100644 index 32b7475bcd7d6b9abe64b37c879a5182add59612..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ - -set(NICA_CBM - ${CMAKE_CURRENT_SOURCE_DIR} -) - -set(KF_HEADERS - ${CLHEP_INCLUDE_DIR} - ${Boost_INCLUDE_DIRS} - ${KFParticle_INCLUDE_DIR} - ${CBMROOT_SOURCE_DIR}/external/KFParticle/KFParticle -# ${CBMROOT_SOURCE_DIR}/analysis/nica_cbm/helpers -) -set(NICA_CBM_FORMAT - ${CBMBASE_DIR} - ${CBMDATA_DIR} - ${CBMDATA_DIR}/global - ${CBMDATA_DIR}/sts - ${CBMDATA_DIR}/tof - ${CBMDATA_DIR}/trd - ${CBMDATA_DIR}/rich - ${CBMDATA_DIR}/much - ${CBMDATA_DIR}/mvd - ${NICA_CBM}/format - ${NICA_CBM}/format/combined - ${NICA_CBM}/format/anatree - ${NICA_CBM}/format/anatree/reco - ${NICA_CBM}/format/anatree/mc - ${NICA_CBM}/format/anatree/femto - ${NICA_CBM}/format/unigen -) - -set(NICAFEMTO_CUTS - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/eventcuts - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/trackcuts - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/trackcuts/detector - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/trackcuts/kinematics - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/trackcuts/mc - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/trackcuts/resolution - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/twotrackcuts - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/twotrackcuts/detector - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/twotrackcuts/kinematics - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/twotrackcuts/mc - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/cuts/cutmonitors -) - -set(NICAFEMTO_FEATURES - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/features - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/features/hist - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/features/io - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/features/io/html - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/features/std -) - -set(NICAFEMTO_DATA - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/dataformat - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/dataformat/formats/fair - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/dataformat/formats/fairextended - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/dataformat/formats/unigen - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/dataformat/detector - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/dataformat/compound -) - -set(NICAFEMTO_ANA - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/base - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/base/chains - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/base/on_the_fly - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/base/on_the_fly/smear_codes -) -set(NICAFEMTO_HBT - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto/ana - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto/base - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto/weights - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto/corrfit - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto/corrfit/mapgenerators - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto/corrfit/fittingfunctions - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto/imaging - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto/base/source_models - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto/base/corrfunc - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/analysis/femto -) -set(NICAFEMTO_GEN - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/nicagenerators/readers - ${CBMROOT_SOURCE_DIR}/external/NicaFemto/nicagenerators - -) - -add_subdirectory(format) -add_subdirectory(cuts) -add_subdirectory(helpers) diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/CMakeLists.txt deleted file mode 100644 index 411d44efa5a9b70c5555d94a7d98bdd75906419b..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Create a library called "" which includes the source files given in -# the array . -# The extension is already found. Any number of sources could be listed here. -set(INCLUDE_DIRECTORIES - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/pair - ${CMAKE_CURRENT_SOURCE_DIR}/track - ) - -# List of source files -set(SRCS - pair/CbmBasicFemtoPairCut.cxx - pair/CbmDeltaPhiDeltaThetaCut.cxx - pair/CbmStsExitSepCut.cxx - - track/CbmBasicTrackCuts.cxx - track/CbmNHitsCut.cxx - track/CbmTofCut.cxx - track/CbmTofM2PolyCut.cxx - ) - - -set(LIBRARY_NAME NicaCbmCuts) -set(LINKDEF ${LIBRARY_NAME}LinkDef.h) -set(PUBLIC_DEPENDENCIES - ROOT::Physics - ) - -set(PRIVATE_DEPENDENCIES - NicaCbmFormat - NicaFeatures - NicaCbmHelper - NicaCut - ) - -generate_cbm_library() - -add_dependencies(G__NicaCbmCuts NICAFEMTO) diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/NicaCbmCutsLinkDef.h b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/NicaCbmCutsLinkDef.h deleted file mode 100644 index b9fca4feb7d22a078c87838701885ad2456cdcf3..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/NicaCbmCutsLinkDef.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; - - -#pragma link C++ class CbmTofM2PolyCut + ; -#pragma link C++ class CbmStsExitSepCut + ; -#pragma link C++ class CbmDeltaPhiDeltaThetaStarCut + ; -#pragma link C++ class CbmDeltaPhiDeltaThetaCut + ; - - -#pragma link C++ class CbmBasicTrackCuts + ; -#pragma link C++ class CbmNHitsCut + ; -#pragma link C++ class CbmTofCut + ; -#pragma link C++ class CbmBasicFemtoPairCut + ; diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmBasicFemtoPairCut.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmBasicFemtoPairCut.cxx deleted file mode 100644 index 80881c7e5d8f48c9f05b27f403c906bfa2966ac0..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmBasicFemtoPairCut.cxx +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmBasicFemtoPairCut.cxx - * - * Created on: 22 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmBasicFemtoPairCut.h" - -#include "CbmDeltaPhiDeltaThetaCut.h" -#include "CbmStsExitSepCut.h" - -#include "NicaCutMonitorX.h" -#include "NicaCutMonitorXY.h" - -CbmBasicFemtoPairCut::CbmBasicFemtoPairCut() -{ - AddCut(CbmStsExitSepCut()); - AddCut(CbmDeltaPhiDeltaThetaStarCut()); - SetSeparationMonitorAxis(100, 0, 10); - SetDeltaPhiStarAxis(100, -0.1, 0.1); - SetDeltaEtaStarAxis(100, -0.1, 0.1); -} - -void CbmBasicFemtoPairCut::SetDeltaPhiStarCut(Double_t min, Double_t max) -{ - GetDeltaPhiEtaStarCut()->SetMinMax(min, max, 0); -} - -void CbmBasicFemtoPairCut::SetDeltaEtaStarCut(Double_t min, Double_t max) -{ - GetDeltaPhiEtaStarCut()->SetMinMax(min, max, 1); -} - -void CbmBasicFemtoPairCut::SetR(Double_t R) { GetDeltaPhiEtaStarCut()->SetR(R); } - -void CbmBasicFemtoPairCut::SetSTSExitSeparationCut(Double_t min, Double_t max) { GetStsExitCut()->SetMinMax(min, max); } - -void CbmBasicFemtoPairCut::CreateBasicMonitors() -{ - TString opt = ""; - Int_t step = 0; - TString params = GetGlobalCutOption(); - if (NicaStd::FindParam(params, "re")) { opt = "re"; } - if (NicaStd::FindParam(params, "im")) { - opt = "im"; - step = 1; - } - NicaCutMonitorX exitM(GetStsExitCut()->CutName(opt), step); - exitM.SetXaxis(fExitSeparation.X(), fExitSeparation.Y(), fExitSeparation.Z()); - AddCutMonitor(exitM); - NicaCutMonitorXY phiM(GetDeltaPhiEtaStarCut()->CutName(opt), 0 + step, GetDeltaPhiEtaStarCut()->CutName(opt), - 1 + step); - phiM.SetXaxis(fMonitorPhiPair[0].X(), fMonitorPhiPair[0].Y(), fMonitorPhiPair[0].Z()); - phiM.SetYaxis(fMonitorPhiPair[1].X(), fMonitorPhiPair[1].Y(), fMonitorPhiPair[1].Z()); - AddCutMonitor(phiM); -} - -CbmBasicFemtoPairCut::~CbmBasicFemtoPairCut() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmBasicFemtoPairCut.h b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmBasicFemtoPairCut.h deleted file mode 100644 index b697e8a47a3679bcbd6b9dc3f1cbf2dd770317dd..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmBasicFemtoPairCut.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmBasicFemtoPairCut.h - * - * Created on: 22 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMBASICFEMTOPAIRCUT_H_ -#define CBMBASICFEMTOPAIRCUT_H_ - -#include <TVector3.h> - -#include "NicaCutsAndMonitors.h" - -class CbmStsExitSepCut; -class CbmDeltaPhiDeltaThetaStarCut; - -class CbmBasicFemtoPairCut : public NicaCutsAndMonitors { - TVector3 fMonitorPhiPair[2]; - TVector3 fExitSeparation; - CbmStsExitSepCut* GetStsExitCut() const { return (CbmStsExitSepCut*) CutAt(0); } - CbmDeltaPhiDeltaThetaStarCut* GetDeltaPhiEtaStarCut() const { return (CbmDeltaPhiDeltaThetaStarCut*) CutAt(1); } - -public: - CbmBasicFemtoPairCut(); - void SetSeparationMonitorAxis(Int_t nbins, Double_t min, Double_t max) { fExitSeparation.SetXYZ(nbins, min, max); } - void SetDeltaPhiStarAxis(Int_t bin, Double_t min, Double_t max) { fMonitorPhiPair[0].SetXYZ(bin, min, max); } - void SetDeltaEtaStarAxis(Int_t bin, Double_t min, Double_t max) { fMonitorPhiPair[1].SetXYZ(bin, min, max); } - void SetDeltaPhiStarCut(Double_t min, Double_t max); - void SetDeltaEtaStarCut(Double_t min, Double_t max); - void SetR(Double_t R); - void SetSTSExitSeparationCut(Double_t min, Double_t max); - void CreateBasicMonitors(); - virtual ~CbmBasicFemtoPairCut(); - ClassDef(CbmBasicFemtoPairCut, 1) -}; - -#endif /* CBMBASICFEMTOPAIRCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmDeltaPhiDeltaThetaCut.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmDeltaPhiDeltaThetaCut.cxx deleted file mode 100644 index b50f55bd4455bf8b9ed3a74bfc671b6c367c52c1..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmDeltaPhiDeltaThetaCut.cxx +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmDeltaPhiDeltaThetaCut.cxx - * - * Created on: 22 cze 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "CbmDeltaPhiDeltaThetaCut.h" - -#include "CbmHbtTrack.h" -#include "CbmHelix.h" - -#include <TLorentzVector.h> -#include <TVector3.h> - -#include "NicaCbmTrack.h" -#include "NicaCut.h" -#include "NicaEvent.h" -#include "NicaPackage.h" -#include "NicaParameter.h" -#include "NicaStd.h" -#include "NicaTrack.h" -#include "NicaTwoTrack.h" - -CbmDeltaPhiDeltaThetaStarCut::CbmDeltaPhiDeltaThetaStarCut() - : NicaTwoTrackCut(2) - , fR(0.0) - , fDataType(NicaCbmFormats::ECbmFormatType::kUnknown) -{ - SetUnitName("#Delta#phi^{*} [rad]", 0); - SetUnitName("#Delta#eta^{*} [rad]", 1); -} - -Bool_t CbmDeltaPhiDeltaThetaStarCut::Init(Int_t task_id) -{ - fDataType = NicaCbmFormats::GetFormatType(task_id, ENicaFormatDepth::kBuffered); - if (fDataType == NicaCbmFormats::ECbmFormatType::kUnknown) return kFALSE; - return kTRUE; -} - -Bool_t CbmDeltaPhiDeltaThetaStarCut::Pass(NicaTwoTrack* pair) -{ - TVector3 mom1, mom2; - switch (fDataType) { - case NicaCbmFormats::ECbmFormatType::kAnaTree: { - NicaCbmTrack* tr1 = static_cast<NicaCbmTrack*>(pair->GetTrack1()); - NicaCbmTrack* tr2 = static_cast<NicaCbmTrack*>(pair->GetTrack2()); - CbmHelix* h1 = tr1->GetHelix(); - CbmHelix* h2 = tr2->GetHelix(); - h1->Eval(fR + tr1->GetEvent()->GetVertex()->Z(), mom1); - h2->Eval(fR + tr2->GetEvent()->GetVertex()->Z(), mom2); - } break; - case NicaCbmFormats::ECbmFormatType::kHbt: { - CbmHbtTrack* tr1 = static_cast<CbmHbtTrack*>(pair->GetTrack1()); - CbmHbtTrack* tr2 = static_cast<CbmHbtTrack*>(pair->GetTrack2()); - tr1->CalculateMomAt(fR); - tr2->CalculateMomAt(fR); - mom1 = *tr1->GetMomAtR(); - mom2 = *tr2->GetMomAtR(); - } break; - case NicaCbmFormats::ECbmFormatType::kUnknown: { - - } break; - } - - SetValue(mom1.Phi() - mom2.Phi(), 0); //dleta phi - SetValue(mom1.Theta() - mom2.Theta(), 1); - if (GetValue(0) > GetMin(0) && GetValue(0) < GetMax(0) && GetValue(1) > GetMin(1) && GetValue(1) < GetMax(1)) { - return ForcedUpdate(kFALSE); - } - return ForcedUpdate(kTRUE); -} - -NicaPackage* CbmDeltaPhiDeltaThetaStarCut::Report() const -{ - NicaPackage* pack = NicaTwoTrackCut::Report(); - pack->AddObject(new NicaParameterDouble("R", fR)); - return pack; -} - -CbmDeltaPhiDeltaThetaStarCut& CbmDeltaPhiDeltaThetaStarCut::operator=(const CbmDeltaPhiDeltaThetaStarCut& other) -{ - if (this == &other) return *this; - fDataType = other.fDataType; - return *this; -} - -CbmDeltaPhiDeltaThetaStarCut::~CbmDeltaPhiDeltaThetaStarCut() {} - -CbmDeltaPhiDeltaThetaCut::CbmDeltaPhiDeltaThetaCut() : NicaTwoTrackCut(2) -{ - SetUnitName("#Delta#phi [rad]", 0); - SetUnitName("#Delta#eta [rad]", 1); -} - -Bool_t CbmDeltaPhiDeltaThetaCut::Init(Int_t /*task_id*/) { return kTRUE; } - -Bool_t CbmDeltaPhiDeltaThetaCut::Pass(NicaTwoTrack* pair) -{ - NicaTrack* tr1 = static_cast<NicaTrack*>(pair->GetTrack1()); - NicaTrack* tr2 = static_cast<NicaTrack*>(pair->GetTrack2()); - SetValue(tr1->GetMomentum()->Phi() - tr2->GetMomentum()->Phi(), 0); - SetValue(tr1->GetMomentum()->Theta() - tr2->GetMomentum()->Theta(), 1); - if (GetValue(0) > GetMin(0) && GetValue(0) < GetMax(0) && GetValue(1) > GetMin(1) && GetValue(1) < GetMax(1)) { - return ForcedUpdate(kFALSE); - } - return ForcedUpdate(kTRUE); -} - -CbmDeltaPhiDeltaThetaCut::~CbmDeltaPhiDeltaThetaCut() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmDeltaPhiDeltaThetaCut.h b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmDeltaPhiDeltaThetaCut.h deleted file mode 100644 index 5b6ee5ae96b7db34cf301f41b597254f225b4e4e..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmDeltaPhiDeltaThetaCut.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmDeltaPhiDeltaThetaCut.h - * - * Created on: 22 cze 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMDELTAPHIDELTATHETACUT_H_ -#define CBMDELTAPHIDELTATHETACUT_H_ -#include "NicaCbmFormatTypes.h" -#include "NicaTwoTrackCut.h" - -class CbmDeltaPhiDeltaThetaStarCut : public NicaTwoTrackCut { - Double_t fR; - NicaCbmFormats::ECbmFormatType fDataType; - -public: - CbmDeltaPhiDeltaThetaStarCut(); - CbmDeltaPhiDeltaThetaStarCut& operator=(const CbmDeltaPhiDeltaThetaStarCut& other); - void SetR(Double_t r) { fR = r; } - virtual Bool_t Init(Int_t task_id = 0); - Bool_t Pass(NicaTwoTrack* pair); - virtual NicaPackage* Report() const; - virtual ~CbmDeltaPhiDeltaThetaStarCut(); - ClassDef(CbmDeltaPhiDeltaThetaStarCut, 1) -}; - -class CbmDeltaPhiDeltaThetaCut : public NicaTwoTrackCut { -public: - CbmDeltaPhiDeltaThetaCut(); - virtual Bool_t Init(Int_t task_id = 0); - Bool_t Pass(NicaTwoTrack* pair); - virtual ~CbmDeltaPhiDeltaThetaCut(); - ClassDef(CbmDeltaPhiDeltaThetaCut, 1) -}; - -#endif /* CBMDELTAPHIDELTATHETACUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmStsExitSepCut.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmStsExitSepCut.cxx deleted file mode 100644 index 063e23e90628655ec210883f94f0c4bd729c6a63..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmStsExitSepCut.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmStsExitSepCut.cxx - * - * Created on: 23 mar 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmStsExitSepCut.h" - -#include "CbmHbtTrack.h" -#include "CbmHelix.h" - -#include <TLorentzVector.h> -#include <TVector3.h> - -#include "NicaCbmTrack.h" -#include "NicaExpEvent.h" -#include "NicaTwoTrack.h" - -CbmStsExitSepCut::CbmStsExitSepCut() : NicaTwoTrackCut(1), fDataType(NicaCbmFormats::ECbmFormatType::kUnknown) -{ - SetUnitName("StsExitSep [cm]"); - SetMinMax(0, 1E+5); -} - -Bool_t CbmStsExitSepCut::Pass(NicaTwoTrack* pair) -{ - CbmHelix *h1 = nullptr, *h2 = nullptr; - TLorentzVector *Pos1 = nullptr, *Pos2 = nullptr; - Double_t dist = 0; - switch (fDataType) { - case NicaCbmFormats::ECbmFormatType::kAnaTree: { - NicaCbmTrack* tr1 = static_cast<NicaCbmTrack*>(pair->GetTrack1()); - NicaCbmTrack* tr2 = static_cast<NicaCbmTrack*>(pair->GetTrack2()); - Pos1 = static_cast<NicaExpEvent*>(tr1->GetEvent())->GetVertex(); - Pos2 = static_cast<NicaExpEvent*>(tr2->GetEvent())->GetVertex(); - - h1 = tr1->GetHelix(); - h2 = tr2->GetHelix(); - TVector3 pos1 = h1->Eval(101.1 + Pos1->Z()); - TVector3 pos2 = h2->Eval(101.1 + Pos2->Z()); - pos1.SetX(pos1.X() - Pos1->X()); - pos1.SetY(pos1.Y() - Pos1->Y()); - pos2.SetX(pos2.X() - Pos2->X()); - pos2.SetY(pos2.Y() - Pos2->Y()); - dist = (pos1 - pos2).Mag(); - } break; - case NicaCbmFormats::ECbmFormatType::kHbt: { - CbmHbtTrack* tr1 = static_cast<CbmHbtTrack*>(pair->GetTrack1()); - CbmHbtTrack* tr2 = static_cast<CbmHbtTrack*>(pair->GetTrack2()); - tr1->CalculatePosAt(101.0); - tr2->CalculatePosAt(101.0); - dist = (*tr1->GetPosAtR() - *tr2->GetPosAtR()).Mag(); - } break; - case NicaCbmFormats::ECbmFormatType::kUnknown: { - - } break; - } - SetValue(dist); - return Validate(); -} - -Bool_t CbmStsExitSepCut::Init(Int_t task_id) -{ - fDataType = NicaCbmFormats::GetFormatType(task_id, ENicaFormatDepth::kBuffered); - if (fDataType == NicaCbmFormats::ECbmFormatType::kUnknown) return kFALSE; - return kTRUE; -} - -CbmStsExitSepCut::~CbmStsExitSepCut() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmStsExitSepCut.h b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmStsExitSepCut.h deleted file mode 100644 index 5e7ba9cc9c87d70a396befd35897c02519a8f02e..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/pair/CbmStsExitSepCut.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmStsExitSep.h - * - * Created on: 23 mar 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef PAIRCUTS_CBMSTSEXITSEPCUT_H_ -#define PAIRCUTS_CBMSTSEXITSEPCUT_H_ - -#include "NicaCbmFormatTypes.h" -#include "NicaTwoTrackCut.h" - - -class CbmStsExitSepCut : public NicaTwoTrackCut { - NicaCbmFormats::ECbmFormatType fDataType; - -public: - CbmStsExitSepCut(); - virtual Bool_t Init(Int_t task_id = 0); - Bool_t Pass(NicaTwoTrack* pair); - virtual ~CbmStsExitSepCut(); - ClassDef(CbmStsExitSepCut, 1) -}; - -#endif /* PAIRCUTS_CBMSTSEXITSEPCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmBasicTrackCuts.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmBasicTrackCuts.cxx deleted file mode 100644 index 976a7fc736eccf34ec2cd4e7e4c6f095c1c52269..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmBasicTrackCuts.cxx +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmBasicTrackCut.cxx - * - * Created on: 22 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "CbmBasicTrackCuts.h" - -#include "CbmNHitsCut.h" -#include "CbmTofCut.h" - -#include "NicaCutMonitorX.h" -#include "NicaCutMonitorXY.h" -#include "NicaStdString.h" -#include "NicaTrackChargeCut.h" -#include "NicaTrackChi2Cut.h" -#include "NicaTrackDCACut.h" -#include "NicaTrackEtaCut.h" -#include "NicaTrackPCut.h" -#include "NicaTrackPtCut.h" - -CbmBasicTrackCuts::CbmBasicTrackCuts() -{ - fMonitorSettingsChi2 = TVector3(20, 0, 10); - fMonitorsSettingsKin[0] = TVector3(100, -2, 6); - fMonitorsSettingsKin[1] = TVector3(100, 0, 3); - fMonitorSettingsTof[0] = TVector3(100, 0, 2); - fMonitorSettingsTof[1] = TVector3(140, -0.2, 1.2); - fMonitorSettingsNHits = TVector3(10, 0, 10); - fMonitorSettingsDCA[0] = TVector3(100, 0, 10); - fMonitorSettingsDCA[1] = TVector3(100, 0, 10); - AddCut(NicaTrackChargeCut()); //0 - AddCut(CbmNHitsCut()); //1 - AddCut(NicaTrackChi2Cut()); //2 - AddCut(NicaTrackPCut()); //3 - AddCut(NicaTrackPtCut()); //4 - AddCut(NicaTrackEtaCut()); //5 - AddCut(NicaTrackDCACut()); //6 - AddCut(CbmTofCut()); //7 -} - -NicaTrackChargeCut* CbmBasicTrackCuts::GetChargeCut() const { return (NicaTrackChargeCut*) this->CutAt(0); } - -CbmNHitsCut* CbmBasicTrackCuts::GetNHitsCut() const { return (CbmNHitsCut*) this->CutAt(1); } - -NicaTrackChi2Cut* CbmBasicTrackCuts::GetChi2Cut() const { return (NicaTrackChi2Cut*) this->CutAt(2); } - -NicaTrackPCut* CbmBasicTrackCuts::GetPCut() const { return (NicaTrackPCut*) this->CutAt(3); } - -NicaTrackPtCut* CbmBasicTrackCuts::GetPtCut() const { return (NicaTrackPtCut*) this->CutAt(4); } - -NicaTrackEtaCut* CbmBasicTrackCuts::GetEtaCut() const { return (NicaTrackEtaCut*) this->CutAt(5); } - -NicaTrackDCACut* CbmBasicTrackCuts::GetDCACut() const { return (NicaTrackDCACut*) this->CutAt(6); } - -void CbmBasicTrackCuts::CreateBasicMonitors() -{ - TString opt = ""; - Int_t step = 0; - TString params = GetGlobalCutOption(); - if (NicaStd::FindParam(params, "re")) { opt = "re"; } - if (NicaStd::FindParam(params, "im")) { - opt = "im"; - step = 1; - } - NicaCutMonitorX nHits(GetNHitsCut()->CutName(opt), step); - nHits.SetXaxis(fMonitorSettingsNHits.X(), fMonitorSettingsNHits.Y(), fMonitorSettingsNHits.Z()); - AddCutMonitor(nHits); - - NicaCutMonitorX nchi(GetChi2Cut()->CutName(opt), step); - nchi.SetXaxis(fMonitorSettingsChi2.X(), fMonitorSettingsChi2.Y(), fMonitorSettingsChi2.Z()); - AddCutMonitor(nchi); - - NicaCutMonitorXY kinM(GetEtaCut()->CutName(opt), step, GetPtCut()->CutName(opt), step); - kinM.SetXaxis(fMonitorsSettingsKin[0].X(), fMonitorsSettingsKin[0].Y(), fMonitorsSettingsKin[0].Z()); - kinM.SetYaxis(fMonitorsSettingsKin[1].X(), fMonitorsSettingsKin[1].Y(), fMonitorsSettingsKin[1].Z()); - AddCutMonitor(kinM); - - NicaCutMonitorXY tofM(GetPCut()->CutName(opt), step, GetTofCut()->CutName(opt), step + GetTofCut()->M2()); - tofM.SetXaxis(fMonitorSettingsTof[0].X(), fMonitorSettingsTof[0].Y(), fMonitorSettingsTof[0].Z()); - tofM.SetYaxis(fMonitorSettingsTof[1].X(), fMonitorSettingsTof[1].Y(), fMonitorSettingsTof[1].Z()); - AddCutMonitor(tofM); - - NicaCutMonitorXY dcaM(GetDCACut()->CutName(opt), step + GetDCACut()->DCAz(), GetDCACut()->CutName(opt), - step + GetDCACut()->DCAxy()); - dcaM.SetXaxis(fMonitorSettingsDCA[0].X(), fMonitorSettingsDCA[0].Y(), fMonitorSettingsDCA[0].Z()); - dcaM.SetYaxis(fMonitorSettingsDCA[1].X(), fMonitorSettingsDCA[1].Y(), fMonitorSettingsDCA[1].Z()); - AddCutMonitor(dcaM); -} - -void CbmBasicTrackCuts::SetCharge(Int_t charge) { GetChargeCut()->SetMinAndMax(charge); } - -void CbmBasicTrackCuts::SetNHits(Int_t min, Int_t max) { GetNHitsCut()->SetMinMax(min, max); } - -void CbmBasicTrackCuts::SetPt(Double_t min, Double_t max) { GetPtCut()->SetMinMax(min, max); } - -void CbmBasicTrackCuts::SetEta(Double_t min, Double_t max) { GetEtaCut()->SetMinMax(min, max); } - -void CbmBasicTrackCuts::SetM2(Double_t min, Double_t max) { GetTofCut()->SetMinMax(min, max); } - -void CbmBasicTrackCuts::SetDCAXY(Double_t min, Double_t max) { GetDCACut()->SetMinMax(min, max, GetDCACut()->DCAxy()); } - -void CbmBasicTrackCuts::SetDCAZ(Double_t min, Double_t max) { GetDCACut()->SetMinMax(min, max, GetDCACut()->DCAz()); } - -void CbmBasicTrackCuts::SetTofMonitorPAxis(Int_t nbins, Double_t min, Double_t max) -{ - fMonitorSettingsTof[0].SetXYZ(nbins, min, max); -} - -void CbmBasicTrackCuts::SetTofMonitorM2Axis(Int_t nbins, Double_t min, Double_t max) -{ - fMonitorSettingsTof[1].SetXYZ(nbins, min, max); -} - -void CbmBasicTrackCuts::SetPtEtaMonitorPtAxis(Int_t nbins, Double_t min, Double_t max) -{ - fMonitorsSettingsKin[1].SetXYZ(nbins, min, max); -} - -void CbmBasicTrackCuts::SetPtEtaMonitorEtaAxis(Int_t nbins, Double_t min, Double_t max) -{ - fMonitorsSettingsKin[0].SetXYZ(nbins, min, max); -} - -void CbmBasicTrackCuts::SetNHitsMonitorAxis(Int_t nbins, Double_t min, Double_t max) -{ - fMonitorSettingsNHits.SetXYZ(nbins, min, max); -} - -void CbmBasicTrackCuts::SetChi2MonitorAxis(Int_t nbins, Double_t min, Double_t max) -{ - fMonitorSettingsChi2.SetXYZ(nbins, min, max); -} - -void CbmBasicTrackCuts::SetDCAMonitorZAxis(Int_t nbins, Double_t min, Double_t max) -{ - fMonitorSettingsDCA[0].SetXYZ(nbins, min, max); -} - -void CbmBasicTrackCuts::SetDCAMonitorXYAxis(Int_t nbins, Double_t min, Double_t max) -{ - fMonitorSettingsDCA[1].SetXYZ(nbins, min, max); -} - -CbmTofCut* CbmBasicTrackCuts::GetTofCut() const { return (CbmTofCut*) this->CutAt(7); } - -void CbmBasicTrackCuts::AcceptOnlyWithTofHit(Bool_t val) -{ - if (val) GetTofCut()->AcceptTracksOnlyWithToF(); - else - GetTofCut()->SetMinMax(0, 1, 1); -} - -CbmBasicTrackCuts::~CbmBasicTrackCuts() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmBasicTrackCuts.h b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmBasicTrackCuts.h deleted file mode 100644 index 64c4fc71c0170f13e8a2bc99f70026fd86dcc2a2..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmBasicTrackCuts.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmBasicTrackCut.h - * - * Created on: 22 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMBASICTRACKCUT_H_ -#define CBMBASICTRACKCUT_H_ - -#include <Rtypes.h> -#include <RtypesCore.h> - -#include "NicaCutsAndMonitors.h" - -class NicaTrackPCut; - -class CbmTofCut; -class NicaTrackChargeCut; -class CbmNHitsCut; -class NicaTrackChi2Cut; -class NicaTrackPtCut; -class NicaTrackEtaCut; -class NicaTrackDCACut; -/**collection of basic cuts and cut monitors for track in AnaTree format **/ - -class CbmBasicTrackCuts : public NicaCutsAndMonitors { - - NicaTrackChargeCut* GetChargeCut() const; - CbmNHitsCut* GetNHitsCut() const; - NicaTrackChi2Cut* GetChi2Cut() const; - NicaTrackPCut* GetPCut() const; - NicaTrackPtCut* GetPtCut() const; - NicaTrackEtaCut* GetEtaCut() const; - NicaTrackDCACut* GetDCACut() const; - TVector3 fMonitorsSettingsKin[2]; - TVector3 fMonitorSettingsTof[2]; - TVector3 fMonitorSettingsNHits; - TVector3 fMonitorSettingsChi2; - TVector3 fMonitorSettingsDCA[2]; - -public: - CbmBasicTrackCuts(); - /** - * enable monitors must be called **after** setting axes of histograms - */ - void CreateBasicMonitors(); - void SetCharge(Int_t charge); - void SetNHits(Int_t min, Int_t max); - void SetPt(Double_t min, Double_t max); - void SetEta(Double_t min, Double_t max); - void AcceptOnlyWithTofHit(Bool_t val); - void SetM2(Double_t min, Double_t max); - void SetDCAXY(Double_t min, Double_t max); - void SetDCAZ(Double_t min, Double_t max); - void SetTofMonitorPAxis(Int_t nbins, Double_t min, Double_t max); - void SetTofMonitorM2Axis(Int_t nbins, Double_t min, Double_t max); - void SetPtEtaMonitorPtAxis(Int_t nbins, Double_t min, Double_t max); - void SetPtEtaMonitorEtaAxis(Int_t nbins, Double_t min, Double_t max); - void SetNHitsMonitorAxis(Int_t nbins, Double_t min, Double_t max); - void SetChi2MonitorAxis(Int_t nbins, Double_t min, Double_t max); - void SetDCAMonitorZAxis(Int_t nbins, Double_t min, Double_t max); - void SetDCAMonitorXYAxis(Int_t nbins, Double_t min, Double_t max); - CbmTofCut* GetTofCut() const; - virtual ~CbmBasicTrackCuts(); - ClassDef(CbmBasicTrackCuts, 1) -}; - -#endif /* CBMBASICTRACKCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmNHitsCut.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmNHitsCut.cxx deleted file mode 100644 index 5cf1f3661de4214f5aa824f386e1ee61c5f056b0..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmNHitsCut.cxx +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmNHitsCut.cxx - * - * Created on: 22 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmNHitsCut.h" - -#include "NicaCbmTrack.h" - -CbmNHitsCut::CbmNHitsCut() : NicaTrackExpCut(1) { SetUnitName("N_{hits}"); } - -Bool_t CbmNHitsCut::Init(Int_t task_id) { return FormatInhertis("NicaCbmEvent", task_id); } - -Bool_t CbmNHitsCut::Pass(NicaTrack* track) -{ - NicaCbmTrack* tr = (NicaCbmTrack*) track; - SetValue(tr->GetNHits()); - return Validate(); -} - -CbmNHitsCut::~CbmNHitsCut() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmNHitsCut.h b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmNHitsCut.h deleted file mode 100644 index c442cabf58af3ee17ad09c007b367fbc9463184f..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmNHitsCut.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmNHitsCut.h - * - * Created on: 22 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMNHITSCUT_H_ -#define CBMNHITSCUT_H_ - -#include "NicaTrackExpCut.h" - -class CbmNHitsCut : public NicaTrackExpCut { -public: - CbmNHitsCut(); - virtual Bool_t Init(Int_t task_id); - virtual Bool_t Pass(NicaTrack* track); - virtual ~CbmNHitsCut(); - ClassDef(CbmNHitsCut, 1) -}; - -#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_ANATREECUTS_TRACK_CBMNHITSCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofCut.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofCut.cxx deleted file mode 100644 index 5f5ed60a325ef220c2597a6721d4671717d23a30..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofCut.cxx +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmTofCut.cxx - * - * Created on: 21 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmTofCut.h" - -#include "NicaCbmTrack.h" - -CbmTofCut::CbmTofCut() : NicaTrackToFMass2Cut(2) { SetUnitName("Flag [AU]", 1); } - -Bool_t CbmTofCut::Init(Int_t task_id) -{ - if (FormatInhertis("NicaCbmEvent", task_id, ENicaFormatDepth::kNonBuffered)) return kTRUE; - return kFALSE; -} - -Bool_t CbmTofCut::Pass(NicaTrack* track) -{ - NicaCbmTrack* reco = (NicaCbmTrack*) track; - NicaToFTrack* tof = reco->GetTofTrack(); - SetValue(tof->GetFlag(), Flag()); - SetValue(tof->GetMass2(), M2()); - Double_t m2 = tof->GetMass2(); - Double_t p = reco->GetMomentum()->P(); - SetValue(m2, 0); - SetValue(tof->GetFlag(), 1); - Double_t min = fLowLine[0] + fLowLine[1] * p + fLowLine[2] * p * p; - Double_t max = fHighLine[0] + fHighLine[1] * p + fHighLine[2] * p * p; - if (m2 > max || m2 < min) { return ForcedUpdate(kFALSE); } - return Validate(); -} - -CbmTofCut::~CbmTofCut() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofCut.h b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofCut.h deleted file mode 100644 index 704afabc0117dd778a7de2da4801bb33c7a6e0bb..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofCut.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmTofCut.h - * - * Created on: 21 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMTOFCUT_H_ -#define CBMTOFCUT_H_ - -#include "NicaTrackToFMass2Cut.h" - -class CbmTofCut : public NicaTrackToFMass2Cut { -public: - CbmTofCut(); - void AcceptTracksWithoutTof() { SetMinMax(0, 1, 1); }; - void AcceptTracksOnlyWithToF() { SetMinMax(1, 1, 1); }; - static Int_t Flag() { return 1; }; - static Int_t M2() { return 0; }; - virtual Bool_t Init(Int_t task_id); - virtual Bool_t Pass(NicaTrack* track); - virtual ~CbmTofCut(); - ClassDef(CbmTofCut, 1) -}; - -#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_ANATREECUTS_TRACK_CBMTOFCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofM2PolyCut.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofM2PolyCut.cxx deleted file mode 100644 index c3a85d8558a5c7c34066abd7552e03a1f059adc0..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofM2PolyCut.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmTofM2PolyCut.cxx - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmTofM2PolyCut.h" - -#include "CbmDetectorID.h" - -#include "NicaExpTrack.h" - -CbmTofM2PolyCut::CbmTofM2PolyCut() {} - -Bool_t CbmTofM2PolyCut::Pass(NicaTrack* track) -{ - NicaToFTrack* tof = (NicaToFTrack*) static_cast<NicaExpTrack*>(track)->GetDetTrack(NicaCbmDetectorID::kTOF); - if (tof->GetFlag() == 0) { SetValue(NicaToFTrack::DummyVal()); } - SetValue(tof->GetMass2()); - return Validate(); -} - -CbmTofM2PolyCut::~CbmTofM2PolyCut() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofM2PolyCut.h b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofM2PolyCut.h deleted file mode 100644 index 6c63f4562f69bd74d0354060df0995ded3eb3fc3..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/track/CbmTofM2PolyCut.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmTofM2PolyCut.h - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef COMMONCUTS_TRACK_CBMTOFM2POLYCUT_H_ -#define COMMONCUTS_TRACK_CBMTOFM2POLYCUT_H_ - -#include "NicaTrackToFMass2Cut.h" - -class CbmTofM2PolyCut : public NicaTrackToFMass2Cut { -public: - CbmTofM2PolyCut(); - Bool_t Pass(NicaTrack* track); - virtual ~CbmTofM2PolyCut(); - ClassDef(CbmTofM2PolyCut, 1) -}; - -#endif /* CBMROOT_ANALYSIS_PWGC2F_FEMTOSCOPY_NICAFEMTO_CUTS_COMMONCUTS_TRACK_CBMTOFM2POLYCUT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/nicafemto/format/CMakeLists.txt deleted file mode 100644 index 7b5f9ce8142066e2c0ef0409ebf9ce19df9c04fa..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/CMakeLists.txt +++ /dev/null @@ -1,70 +0,0 @@ -# Create a library called "" which includes the source files given in -# the array . -# The extension is already found. Any number of sources could be listed here. -set(INCLUDE_DIRECTORIES - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/combined - ${CMAKE_CURRENT_SOURCE_DIR}/unigen - ${CMAKE_CURRENT_SOURCE_DIR}/anatree - ${CMAKE_CURRENT_SOURCE_DIR}/anatree/mc - ${CMAKE_CURRENT_SOURCE_DIR}/anatree/reco - ${CMAKE_CURRENT_SOURCE_DIR}/anatree/femto - ) - -# List of source files -set(SRCS - NicaCbmFormatTypes.cxx - - combined/NicaCbmFullEvent.cxx - combined/CbmHbtFullEvent.cxx - - unigen/NicaGeneratorReadUnigen.cxx - unigen/NicaGeneratorWriteUnigen.cxx - unigen/NicaUnigenSource.cxx - unigen/NicaUnigenEvent.cxx - unigen/NicaUnigenEventInterface.cxx - unigen/NicaUnigenTrack.cxx - unigen/NicaUnigenTrackInterface.cxx - - anatree/mc/NicaCbmMCEvent.cxx - anatree/mc/NicaCbmMCEventInterface.cxx - anatree/mc/NicaCbmMCTrack.cxx - anatree/mc/NicaCbmMCTrackInterface.cxx - anatree/reco/NicaCbmEvent.cxx - anatree/reco/NicaCbmEventInterface.cxx - anatree/reco/NicaCbmTrack.cxx - anatree/reco/NicaCbmTrackInterface.cxx - anatree/femto/CbmHbtTrack.cxx - anatree/femto/CbmHbtEvent.cxx - anatree/CbmAnaTreeContainer.cxx - anatree/CbmAnaTreeSource.cxx - ) - -set(LIBRARY_NAME NicaCbmFormat) -set(LINKDEF ${LIBRARY_NAME}LinkDef.h) -set(PUBLIC_DEPENDENCIES - CbmData - NicaCbmHelper - FairRoot::Base - ROOT::Core - ROOT::Physics - ROOT::Tree -) - - -set(PRIVATE_DEPENDENCIES - CbmSimGenerators - FairLogger::FairLogger - ROOT::EG - ROOT::RIO - NicaDataFormat - NicaFeatures - NicaGen - AnalysisTreeBase - AnalysisTreeInfra - ) - - -generate_cbm_library() - -add_dependencies(G__NicaCbmFormat NICAFEMTO ANALYSISTREE) diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/NicaCbmFormatLinkDef.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/NicaCbmFormatLinkDef.h deleted file mode 100644 index 2728a7bc2f759a52d880e13a5dc8f485fa64ae95..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/NicaCbmFormatLinkDef.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaBmnFormatLinkDef.h - * - * Created on: 19 wrz 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; - -#pragma link C++ namespace NicaCbmFormats; - -#pragma link C++ class CbmHbtFullEvent + ; -#pragma link C++ class NicaCbmFullEvent + ; -#pragma link C++ class CbmHbtEvent + ; -#pragma link C++ class CbmHbtTrack + ; - -#pragma link C++ class NicaGeneratorReadUnigen + ; -#pragma link C++ class NicaGeneratorWriteUnigen + ; -#pragma link C++ class NicaUnigenEvent + ; -#pragma link C++ class NicaUnigenEventInterface + ; -#pragma link C++ class NicaUnigenSource + ; -#pragma link C++ class NicaUnigenTrack + ; -#pragma link C++ class NicaUnigenTrackInterface + ; - -#pragma link C++ class NicaCbmMCEvent + ; -#pragma link C++ class NicaCbmMCEventInterface + ; -#pragma link C++ class NicaCbmMCTrack + ; -#pragma link C++ class NicaCbmMCTrackInterface + ; - -#pragma link C++ class NicaCbmEvent + ; -#pragma link C++ class NicaCbmEventInterface + ; -#pragma link C++ class NicaCbmTrack + ; -#pragma link C++ class NicaCbmTrackInterface + ; - -#pragma link C++ class CbmAnaTreeRecoSourceContainer + ; -#pragma link C++ class CbmAnaTreeMcSourceContainer + ; -#pragma link C++ class CbmAnaTreeSource + ; - diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/NicaCbmFormatTypes.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/NicaCbmFormatTypes.cxx deleted file mode 100644 index 8f73e08e3a2b4d0b762cb1256fadc8ace9c8b956..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/NicaCbmFormatTypes.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmFormatTypes.cxx - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "NicaCbmFormatTypes.h" - -#include "NicaDataFormatManager.h" -#include "NicaEvent.h" -#include "NicaStd.h" - - -namespace NicaCbmFormats -{ - - ECbmFormatType GetFormatType(Int_t task_id, ENicaFormatDepth depth) - { - const NicaEvent* ev = NicaDataFormatManager::Instance()->GetFormat(task_id, depth); - if (ev->InheritsFrom("NicaCbmEvent")) { return ECbmFormatType::kAnaTree; } - else if (ev->InheritsFrom("CbmHbtEvent")) { - return ECbmFormatType::kHbt; - } - return ECbmFormatType::kUnknown; - } -} // namespace NicaCbmFormats diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/NicaCbmFormatTypes.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/NicaCbmFormatTypes.h deleted file mode 100644 index 447329394108d721e567882b941849e21c691482..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/NicaCbmFormatTypes.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmFormatTypes.h - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMFORMATTYPES_H_ -#define NICACBMFORMATTYPES_H_ - -#include "NicaDataFormatManager.h" - -namespace NicaCbmFormats -{ - - enum class ECbmFormatType - { - kAnaTree, - kHbt, - kUnknown - }; - ECbmFormatType GetFormatType(Int_t task_id, ENicaFormatDepth depht = ENicaFormatDepth::kAll); - -} // namespace NicaCbmFormats - -#endif /* NICACBMFORMATTYPES_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeContainer.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeContainer.cxx deleted file mode 100644 index 7a19ab155b97be16001d86d3070d9218a9670690..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeContainer.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaDstAnaTreeContainer.cxx - * - * Created on: 17 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmAnaTreeContainer.h" - -#include <TChain.h> - -#include "AnalysisTree/Matching.hpp" - -Bool_t CbmAnaTreeRecoSourceContainer::ConnectToTree(TChain* tree) -{ - fEvent = new AnalysisTree::EventHeader(); - fVtxTracks = new AnalysisTree::TrackDetector(); - fTofHits = new AnalysisTree::HitDetector(); - fVtx2Tof = new AnalysisTree::Matching(); - fVtx2Mc = new AnalysisTree::Matching(); - if (tree->GetBranch("VtxTracks") == nullptr) return kFALSE; - if (tree->GetBranch("RecEventHeader") == nullptr) return kFALSE; - if (tree->GetBranch("TofHits") == nullptr) return kFALSE; - if (tree->GetBranch("VtxTracks2TofHits") == nullptr) return kFALSE; - tree->SetBranchAddress("VtxTracks", &fVtxTracks); - tree->SetBranchAddress("RecEventHeader", &fEvent); - tree->SetBranchAddress("TofHits", &fTofHits); - tree->SetBranchAddress("VtxTracks2TofHits", &fVtx2Tof); - tree->SetBranchStatus("VtxTracks", 1); - tree->SetBranchStatus("RecEventHeader", 1); - tree->SetBranchStatus("TofHits", 1); - tree->SetBranchStatus("VtxTracks2TofHits", 1); - if (tree->GetBranch("VtxTracks2SimParticles")) { - tree->SetBranchAddress("VtxTracks2SimParticles", &fVtx2Mc); - tree->SetBranchStatus("VtxTracks2SimParticles", 1); - } - return kTRUE; -} - -Bool_t CbmAnaTreeMcSourceContainer::ConnectToTree(TChain* tree) -{ - fEvent = new AnalysisTree::EventHeader(); - fParticles = new AnalysisTree::Particles(); - if (tree->GetBranch("SimEventHeader") == nullptr) return kFALSE; - if (tree->GetBranch("SimParticles") == nullptr) return kFALSE; - tree->SetBranchAddress("SimEventHeader", &fEvent); - tree->SetBranchAddress("SimParticles", &fParticles); - tree->SetBranchStatus("SimEventHeader", 1); - tree->SetBranchStatus("SimParticles", 1); - return kTRUE; -} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeObjectTrack.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeObjectTrack.cxx deleted file mode 100644 index fc780504c3d7826aecc84eae41dd3cd6f4f82b12..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeObjectTrack.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmAnaTreeObjectTrack.cxx - * - * Created on: 14 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmAnaTreeObjectTrack.h" - -CbmAnaTreeObjectTrack::CbmAnaTreeObjectTrack() : fTreeParticle(nullptr), fTreeTrack(nullptr), fTreeHit(nullptr) {} - -CbmAnaTreeObjectTrack::~CbmAnaTreeObjectTrack() {} - -CbmAnaTreeObjectTrack::CbmAnaTreeObjectTrack(const CbmAnaTreeObjectTrack& other) - : fTreeParticle(other.fTreeParticle) - , fTreeTrack(other.fTreeTrack) - , fTreeHit(other.fTreeTrack) -{ -} - -CbmAnaTreeObjectTrack& CbmAnaTreeObjectTrack::operator=(const CbmAnaTreeObjectTrack& other) -{ - if (this == &other) return *this; - fTreeParticle = other.fTreeParticle; - fTreeTrack = other.fTreeTrack; - fTreeHit = other.fTreeHit; - return *this; -} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeSource.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeSource.cxx deleted file mode 100644 index f1c029b8f1e1b55375c3430893473ec5c13b02c5..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/CbmAnaTreeSource.cxx +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright (C) 2017-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmDstSource.cxx - * - * Created on: 27 mar 2017 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmAnaTreeSource.h" - -#include "CbmAnaTreeContainer.h" - -#include <FairRootManager.h> -#include <Logger.h> - -#include <TBranch.h> -#include <TChain.h> -#include <TFile.h> - -#include <fstream> - -#include "AnalysisTree/Configuration.hpp" - - -CbmAnaTreeSource::CbmAnaTreeSource() : CbmAnaTreeSource("", "aTree") {} - -CbmAnaTreeSource::CbmAnaTreeSource(TString inFile, TString treeName) - : fNFiles(1) - , fTreeName(treeName) - , fChain(nullptr) - , fFileName(nullptr) - , fContainerReco(nullptr) - , fContainerSim(nullptr) -{ - fFileName = new TString[1]; - fFileName[0] = inFile; -} - -CbmAnaTreeSource::~CbmAnaTreeSource() -{ - if (fFileName) delete[] fFileName; -} - -Bool_t CbmAnaTreeSource::Init() -{ - LOG(debug) << "Init source "; - FairRootManager* mngr = FairRootManager::Instance(); - fChain = new TChain(fTreeName); //new name of tree? - TString first_file_name; - if (fFileName[0].EndsWith(".root")) { - for (int i = 0; i < fNFiles; i++) { - LOG(debug) << "CbmAnaTree: opening single file" << fFileName[i]; - fChain->Add(fFileName[i]); - } - first_file_name = fFileName[0]; - } - else { // this is long list - std::ifstream list; - list.open(fFileName[0]); - bool first = true; - do { - TString temp; - list >> temp; - if (temp.Length() > 1) { - fChain->Add(temp); - if (first) { - first_file_name = temp; - first = false; - } - } - else { - break; - } - LOG(debug) << "Adding file " << temp << " to chain"; - } while (!list.eof()); - list.close(); - } - LOG(debug) << "load container "; - fContainerReco = new CbmAnaTreeRecoSourceContainer(); - fContainerSim = new CbmAnaTreeMcSourceContainer(); - Bool_t recoAvail = fContainerReco->ConnectToTree(fChain); - Bool_t simAvail = fContainerSim->ConnectToTree(fChain); - if (recoAvail == kFALSE) { - delete fContainerReco; - fContainerReco = nullptr; - } - if (simAvail == kFALSE) { - delete fContainerSim; - fContainerSim = nullptr; - } - LOG(debug) << "load conf "; - LoadConf(first_file_name); - mngr->SetInChain(fChain, -1); - if (fContainerReco) { - mngr->Register("CbmAnaTreeSourceContainer.", "CbmAnaTreeSourceContainer", fContainerReco, kFALSE); - } - if (fContainerSim) { - mngr->Register("CbmAnaTreeMcSourceContainer.", "CbmAnaTreeMcSourceContainer", fContainerSim, kFALSE); - } - return kTRUE; -} - -Int_t CbmAnaTreeSource::ReadEvent(UInt_t unsignedInt) -{ - fChain->GetEntry(unsignedInt); - return 0; -} - -void CbmAnaTreeSource::Close() {} - -void CbmAnaTreeSource::LoadConf(TString name) -{ - /// Save old global file and folder pointer to avoid messing with FairRoot - TFile* oldFile = gFile; - TDirectory* oldDir = gDirectory; - - TFile* f = new TFile(name); - LOG_IF(fatal, !f) << "Could not open file " << name; - // TTree *tree = f->Get<TTree>("aTree"); - // AnalysisTree::Configuration* conf = (AnalysisTree::Configuration*) f->Get("Configuration"); - AnalysisTree::Configuration* conf = f->Get<AnalysisTree::Configuration>("Configuration"); - LOG_IF(fatal, !conf) << "Could not read AnalysisTree configuration from file " << name; - if (fContainerReco) { - fContainerReco->GetFieldIds().vtx_px = conf->GetBranchConfig("VtxTracks").GetFieldId("px"); - fContainerReco->GetFieldIds().vtx_py = conf->GetBranchConfig("VtxTracks").GetFieldId("py"); - fContainerReco->GetFieldIds().vtx_pz = conf->GetBranchConfig("VtxTracks").GetFieldId("pz"); - fContainerReco->GetFieldIds().vtx_dcax = conf->GetBranchConfig("VtxTracks").GetFieldId("dcax"); - fContainerReco->GetFieldIds().vtx_dcay = conf->GetBranchConfig("VtxTracks").GetFieldId("dcay"); - fContainerReco->GetFieldIds().vtx_dcaz = conf->GetBranchConfig("VtxTracks").GetFieldId("dcaz"); - - fContainerReco->GetFieldIds().vtx_chi2 = conf->GetBranchConfig("VtxTracks").GetFieldId("chi2"); - fContainerReco->GetFieldIds().vtx_vtxchi2 = conf->GetBranchConfig("VtxTracks").GetFieldId("vtx_chi2"); - fContainerReco->GetFieldIds().vtx_q = conf->GetBranchConfig("VtxTracks").GetFieldId("q"); - fContainerReco->GetFieldIds().vtx_nhits = conf->GetBranchConfig("VtxTracks").GetFieldId("nhits"); - fContainerReco->GetFieldIds().vtx_mvdhits = conf->GetBranchConfig("VtxTracks").GetFieldId("nhits_mvd"); - - fContainerReco->GetFieldIds().tof_mass2 = conf->GetBranchConfig("TofHits").GetFieldId("mass2"); - - fContainerReco->GetFieldIds().vtx_x = conf->GetBranchConfig("VtxTracks").GetFieldId("x"); - fContainerReco->GetFieldIds().vtx_cx0 = conf->GetBranchConfig("VtxTracks").GetFieldId("cx0"); - fContainerReco->GetFieldIds().vtx_cov1 = conf->GetBranchConfig("VtxTracks").GetFieldId("cov1"); - } - if (fContainerSim) { - fContainerSim->GetFieldIds().px = conf->GetBranchConfig("SimParticles").GetFieldId("px"); - fContainerSim->GetFieldIds().py = conf->GetBranchConfig("SimParticles").GetFieldId("py"); - fContainerSim->GetFieldIds().pz = conf->GetBranchConfig("SimParticles").GetFieldId("pz"); - fContainerSim->GetFieldIds().mass = conf->GetBranchConfig("SimParticles").GetFieldId("mass"); - fContainerSim->GetFieldIds().pdg = conf->GetBranchConfig("SimParticles").GetFieldId("pid"); - fContainerSim->GetFieldIds().motherId = conf->GetBranchConfig("SimParticles").GetFieldId("mother_id"); - fContainerSim->GetFieldIds().event_b = conf->GetBranchConfig("SimEventHeader").GetFieldId("b"); - fContainerSim->GetFieldIds().event_psi = conf->GetBranchConfig("SimEventHeader").GetFieldId("psi_RP"); - fContainerSim->GetFieldIds().freezX = conf->GetBranchConfig("SimParticles").GetFieldId("xfreez"); - fContainerSim->GetFieldIds().freezY = conf->GetBranchConfig("SimParticles").GetFieldId("yfreez"); - fContainerSim->GetFieldIds().freezZ = conf->GetBranchConfig("SimParticles").GetFieldId("zfreez"); - fContainerSim->GetFieldIds().freezT = conf->GetBranchConfig("SimParticles").GetFieldId("tfreez"); - } - - /// Restore old global file and folder pointer to avoid messing with FairRoot - gFile = oldFile; - gDirectory = oldDir; - - f->Close(); - delete f; -} - -void CbmAnaTreeSource::AddFile(TString file) -{ - TString* temp = fFileName; - fFileName = new TString[fNFiles + 1]; - for (int i = 0; i < fNFiles; i++) { - fFileName[i] = temp[i]; - } - delete[] temp; - fFileName[fNFiles] = file; - fNFiles = fNFiles + 1; -} - -Int_t CbmAnaTreeSource::CheckMaxEventNo(Int_t /*int1*/) { return fChain->GetEntries(); } diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtEvent.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtEvent.cxx deleted file mode 100644 index 494966f561d45a57e46367376bcda77617e96c6d..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtEvent.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmHbtEventReco.cxx - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmHbtEvent.h" - -#include "CbmHbtTrack.h" - -#include "NicaCbmEvent.h" - -CbmHbtEvent::CbmHbtEvent() : NicaExpEvent("CbmHbtTrack") {} - -Bool_t CbmHbtEvent::IsCompatible(const NicaEvent* non_buffered) const -{ - if (non_buffered->InheritsFrom("NicaCbmEvent")) return kTRUE; - return kFALSE; -} - -void CbmHbtEvent::ShallowCopyTracks(NicaEvent* event) -{ - fTracks->Clear(); - fTotalTracksNo = event->GetTotalTrackNo(); - fTracks->ExpandCreateFast(fTotalTracksNo); - for (int i = 0; i < fTotalTracksNo; i++) { - NicaCbmTrack* from = (NicaCbmTrack*) event->GetTrack(i); - CbmHbtTrack* to = (CbmHbtTrack*) fTracks->UncheckedAt(i); - to->ResetTrack(i, this); - to->CopyData(from); - } -} - -CbmHbtEvent::~CbmHbtEvent() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtEvent.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtEvent.h deleted file mode 100644 index 9d6386b4de214488656fd49a0a16a049252c42e4..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtEvent.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmHbtEventReco.h - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMHBTEVENT_H_ -#define CBMHBTEVENT_H_ - -#include "NicaExpEvent.h" -/** - * class for HBT analysis, note: CAN BE USED ONLY AS BUFFERED EVENT! - */ - -class CbmHbtEvent : public NicaExpEvent { -protected: - virtual void CreateSource() {}; - virtual void ShallowCopyTracks(NicaEvent* event); - -public: - CbmHbtEvent(); - virtual Bool_t IsCompatible(const NicaEvent* non_buffered) const; - virtual NicaEvent* GetNewEvent() const { return new CbmHbtEvent(); }; - virtual ~CbmHbtEvent(); - ClassDef(CbmHbtEvent, 1) -}; - -#endif /* CBMHBTEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtTrack.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtTrack.cxx deleted file mode 100644 index 198123b96066a43900b5a945d3d4be09876c32f0..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtTrack.cxx +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmHbtTrack.cxx - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmHbtTrack.h" - -#include "CbmHbtEvent.h" - -#include "NicaCbmTrack.h" - -CbmHbtTrack::CbmHbtTrack() - : NicaExpTrack() - , fPosAt(new TVector3()) - , fMomAt(new TVector3()) - , fHelix(new CbmHelix()) - , fRPos(0) - , fRMom(0) -{ -} - -CbmHbtTrack::~CbmHbtTrack() -{ - if (fPosAt) delete fPosAt; - if (fMomAt) delete fMomAt; - if (fHelix) delete fHelix; -} - -CbmHbtTrack::CbmHbtTrack(const CbmHbtTrack& other) : NicaExpTrack(other) -{ - fPosAt = new TVector3(*other.fPosAt); - fMomAt = new TVector3(*other.fMomAt); - fHelix = new CbmHelix(*other.fHelix); - fRPos = other.fRPos; - fRMom = other.fRMom; -} - -CbmHbtTrack& CbmHbtTrack::operator=(const CbmHbtTrack& other) -{ - if (this == &other) return *this; - NicaExpTrack::operator=(other); - *fPosAt = *other.fPosAt; - *fMomAt = *other.fMomAt; - *fHelix = *other.fHelix; - fRPos = other.fRPos; - fRMom = other.fRMom; - return *this; -} - -void CbmHbtTrack::CopyData(NicaTrack* other) -{ - NicaExpTrack::CopyData(other); - *fHelix = *((NicaCbmTrack*) other)->GetHelix(); - fRPos = fRMom = -1; -} - -void CbmHbtTrack::CalculatePosAt(Double_t R) -{ - if (fRPos == R) return; - TLorentzVector* vertex = GetEvent()->GetVertex(); - TVector3 pos = GetHelix()->Eval(vertex->Z() + R); - fPosAt->SetXYZ(pos.X() - vertex->X(), pos.Y() - vertex->Y(), pos.Z() - vertex->Z()); - fRPos = R; -} - -void CbmHbtTrack::CalculateMomAt(Double_t R) -{ - if (fRMom == R) return; - TLorentzVector* vertex = GetEvent()->GetVertex(); - GetHelix()->Eval(vertex->Z() + R, *fMomAt); - fRMom = R; -} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtTrack.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtTrack.h deleted file mode 100644 index d3ccee9ea4b7fac668f64c6990038d8cea2b70d1..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/femto/CbmHbtTrack.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmHbtTrack.h - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMHBTTRACK_H_ -#define CBMHBTTRACK_H_ - -#include "CbmHelix.h" - -#include <TVector3.h> - -#include "NicaExpTrack.h" - - -class CbmHbtTrack : public NicaExpTrack { - TVector3* fPosAt; - TVector3* fMomAt; - CbmHelix* fHelix; - /* true if hbt values are calculated */ - Double_t fRPos; - Double_t fRMom; - -public: - CbmHbtTrack(); - TVector3* GetPosAtR() const { return fPosAt; }; - TVector3* GetMomAtR() const { return fMomAt; }; - CbmHelix* GetHelix() const { return fHelix; }; - void CalculatePosAt(Double_t R); - void CalculateMomAt(Double_t R); - virtual void CopyData(NicaTrack* other); - CbmHbtTrack(const CbmHbtTrack& other); - CbmHbtTrack& operator=(const CbmHbtTrack& other); - virtual ~CbmHbtTrack(); - ClassDef(CbmHbtTrack, 1) -}; - -#endif /* CBMHBTTRACK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEvent.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEvent.cxx deleted file mode 100644 index 102a2863982558917f46af9c02f1553cad42259f..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEvent.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmDstMcEvent.cxx - * - * Created on: 17 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "NicaCbmMCEvent.h" - -#include "CbmAnaTreeSource.h" - -#include "AnalysisTree/EventHeader.hpp" -#include "AnalysisTree/Particle.hpp" -#include "NicaCbmMCEventInterface.h" -#include "NicaCbmMCTrack.h" - -NicaCbmMCEvent::NicaCbmMCEvent() : NicaMCEvent("NicaCbmMCTrack") {} - -void NicaCbmMCEvent::CreateSource() { fSource = new NicaCbmMCEventInterface(); } - -NicaCbmMCEvent::NicaCbmMCEvent(const NicaCbmMCEvent& other) : NicaMCEvent(other) {} - -void NicaCbmMCEvent::Update() -{ - NicaCbmMCEventInterface* s = static_cast<NicaCbmMCEventInterface*>(fSource); - CbmAnaTreeMcSourceContainer* data = (CbmAnaTreeMcSourceContainer*) s->GetRawEventPointer(); - AnaTreeMcIds conf = data->GetFieldIds(); - fTotalTracksNo = data->GetParticles()->GetNumberOfChannels(); - fB = data->GetEventHeader()->GetField<Float_t>(conf.event_b); - fPhi = data->GetEventHeader()->GetField<Float_t>(conf.event_psi); - fTracks->Clear(); - fTracks->ExpandCreateFast(fTotalTracksNo); - Bool_t UseFreez = kTRUE; - if (conf.freezX == AnalysisTree::UndefValueShort) UseFreez = kFALSE; - - - for (int i = 0; i < fTotalTracksNo; i++) { - NicaCbmMCTrack* track = (NicaCbmMCTrack*) fTracks->UncheckedAt(i); - track->ResetTrack(i, this); - AnalysisTree::Particle particle = data->GetParticles()->GetChannel(i); - Double_t px = particle.GetField<float>(conf.px); - Double_t py = particle.GetField<float>(conf.py); - Double_t pz = particle.GetField<float>(conf.pz); - Double_t mass = particle.GetField<float>(conf.mass); - - Int_t mother_id = particle.GetField<int>(conf.motherId); - Int_t pid = particle.GetField<int>(conf.pdg); - track->GetMomentum()->SetXYZM(px, py, pz, mass); - track->SetPdg(pid); - if (UseFreez) { - Double_t x = particle.GetField<float>(conf.freezX); - Double_t y = particle.GetField<float>(conf.freezY); - Double_t z = particle.GetField<float>(conf.freezZ); - Double_t t = particle.GetField<float>(conf.freezT); - track->GetFreezoutPosition()->SetXYZT(x, y, z, t); - } - - track->SetMotherIndex(mother_id); - if (mother_id < 0) { track->SetPrimary(); } - else { - track->SetMotherIndex(track->GetMotherIndex()); - } - track->SetCharge(CalculateCharge(pid)); - } -} - -Bool_t NicaCbmMCEvent::ExistInTree() const { return CheckBranches(1, "CbmAnaTreeMcSourceContainer."); } - -NicaCbmMCEvent::~NicaCbmMCEvent() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEvent.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEvent.h deleted file mode 100644 index 5d00b3311ee4729d28adfb4efd5d4dea214a1fce..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEvent.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmDstMcEvent.h - * - * Created on: 17 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMATMCEVENT_H_ -#define NICACBMATMCEVENT_H_ - -#include "NicaMCEvent.h" - -class NicaCbmMCEvent : public NicaMCEvent { -protected: - virtual void CreateSource(); - -public: - NicaCbmMCEvent(); - NicaCbmMCEvent(const NicaCbmMCEvent& other); - virtual void Update(); - virtual NicaEvent* GetNewEvent() const { return new NicaCbmMCEvent(); }; - virtual Bool_t ExistInTree() const; - virtual TString GetFormatName() const { return "CbmMCEvent"; }; - virtual ~NicaCbmMCEvent(); - ClassDef(NicaCbmMCEvent, 1) -}; - -#endif /* NICACBMATMCEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEventInterface.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEventInterface.cxx deleted file mode 100644 index 41c2ebb7655414caa2dc030ba20fd989b47ef58f..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEventInterface.cxx +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmDstMcEventInterface.cxx - * - * Created on: 17 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaCbmMCEventInterface.h" - -#include "CbmAnaTreeContainer.h" - -#include <FairRootManager.h> - -NicaCbmMCEventInterface::NicaCbmMCEventInterface() : fDataContainer(nullptr) {} - -void NicaCbmMCEventInterface::ConnectToTree() -{ - FairRootManager* manager = FairRootManager::Instance(); - if (CanDeleteEvent()) { delete fDataContainer; } - fDataContainer = (CbmAnaTreeMcSourceContainer*) manager->GetObject("CbmAnaTreeMcSourceContainer."); -} - -void NicaCbmMCEventInterface::Register(Bool_t write) -{ - FairRootManager* manager = FairRootManager::Instance(); - manager->Register("CbmAnaTreeMcSourceContainer.", "CbmAnaTreeMcSourceContainer.", fDataContainer, write); -} - -void NicaCbmMCEventInterface::CopyData(NicaEventInterface* s) -{ - NicaCbmMCEventInterface* ev = (NicaCbmMCEventInterface*) s; - *fDataContainer = *ev->fDataContainer; //TODO make assignment operator -} - -void NicaCbmMCEventInterface::Compress(Int_t* /*map*/, Int_t /*map_size*/) -{ - //TODO -} - -void NicaCbmMCEventInterface::CopyAndCompress(NicaEventInterface* s, Int_t* /*map*/, Int_t /*map_size*/) -{ - CopyData(s); -} - -void NicaCbmMCEventInterface::FillTrackInterface(NicaTrackInterface* /*track*/, Int_t /*index*/) {} - -Int_t NicaCbmMCEventInterface::GetTotalTrackNo() const { return fDataContainer->GetParticles()->GetNumberOfChannels(); } - -TObject* NicaCbmMCEventInterface::GetRawTrackPointer(Int_t /*index*/) const { return nullptr; } - -TLorentzVector NicaCbmMCEventInterface::GetVertexError() const { return TLorentzVector(0, 0, 0, 0); } - -TLorentzVector NicaCbmMCEventInterface::GetVertex() const -{ - AnalysisTree::EventHeader* header = fDataContainer->GetEventHeader(); - return TLorentzVector(header->GetVertexX(), header->GetVertexY(), header->GetVertexZ(), 0); -} - -NicaCbmMCEventInterface::~NicaCbmMCEventInterface() -{ - if (CanDeleteEvent()) delete fDataContainer; -} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEventInterface.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEventInterface.h deleted file mode 100644 index 5ac3125608f5fab4a191d5508bbee062f15ba11e..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCEventInterface.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmDstMcEventInterface.h - * - * Created on: 17 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMATMCEVENTINTERFACE_H_ -#define NICACBMATMCEVENTINTERFACE_H_ - -#include "CbmAnaTreeContainer.h" - -#include <TVector3.h> - -#include "NicaCbmMCTrackInterface.h" -#include "NicaMCEventInterface.h" - -class CbmAnaTreeMcSourceContainer; -class NicaCbmMCEventInterface : public NicaMCEventInterface { - friend class NicaCbmMCEvent; - -protected: - CbmAnaTreeMcSourceContainer* fDataContainer; - virtual void ConnectToTree(); - void Register(Bool_t write); - -public: - NicaCbmMCEventInterface(); - virtual void CopyData(NicaEventInterface* s); - virtual void Compress(Int_t* map, Int_t map_size); - virtual void CopyAndCompress(NicaEventInterface* s, Int_t* map, Int_t map_size); - virtual void FillTrackInterface(NicaTrackInterface* track, Int_t index); - virtual Int_t GetTotalTrackNo() const; - virtual TObject* GetRawEventPointer() const { return fDataContainer; }; - virtual NicaTrackInterface* GetTrackInterface() const { return new NicaCbmMCTrackInterface(); } - virtual TObject* GetRawTrackPointer(Int_t index) const; - /** GETTERS AND SETTERS **/ - virtual void SetRunInfoId(Int_t /*i*/) {}; - virtual Int_t GetRunInfoId() const { return 0; }; - virtual void SetMagneticField(TVector3 /*mag*/) const {}; - virtual TVector3 GetMagneticField() const { return TVector3(0, 0, 0); }; - virtual TLorentzVector GetVertexError() const; - virtual TLorentzVector GetVertex() const; - virtual ~NicaCbmMCEventInterface(); - ClassDef(NicaCbmMCEventInterface, 1) -}; - -#endif /* NICACBMATMCEVENTINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrack.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrack.cxx deleted file mode 100644 index f2cd1e56786c22b3b5612a421fcde319b13a0a52..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrack.cxx +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmATMCTrack.cxx - * - * Created on: 21 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaCbmMCTrack.h" - -NicaCbmMCTrack::NicaCbmMCTrack() {} - -NicaCbmMCTrack::~NicaCbmMCTrack() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrack.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrack.h deleted file mode 100644 index 040949d83f121f63ab5f8ae0cc146e8f53cc4dd4..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrack.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmATMCTrack.h - * - * Created on: 21 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMATMCTRACK_H_ -#define NICACBMATMCTRACK_H_ - -#include "NicaMCTrack.h" -class NicaCbmMCTrack : public NicaMCTrack { -public: - NicaCbmMCTrack(); - virtual ~NicaCbmMCTrack(); - ClassDef(NicaCbmMCTrack, 1) -}; - -#endif /* NICACBMATMCTRACK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrackInterface.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrackInterface.cxx deleted file mode 100644 index f13e906b51f7f80b8e1fd0bbbfd92cbf08b037e8..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrackInterface.cxx +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmATMMCTrackInterface.cxx - * - * Created on: 21 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaCbmMCTrackInterface.h" - -NicaCbmMCTrackInterface::NicaCbmMCTrackInterface() {} - -NicaCbmMCTrackInterface::~NicaCbmMCTrackInterface() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrackInterface.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrackInterface.h deleted file mode 100644 index 29daa8a92cbd1bb884ec920e4b69550f30c354f8..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/mc/NicaCbmMCTrackInterface.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmATMMCTrackInterface.h - * - * Created on: 21 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMATMMCTRACKINTERFACE_H_ -#define NICACBMATMMCTRACKINTERFACE_H_ - -#include "NicaMCTrackInterface.h" - -class NicaCbmMCTrackInterface : public NicaMCTrackInterface { -public: - NicaCbmMCTrackInterface(); - virtual ~NicaCbmMCTrackInterface(); - ClassDef(NicaCbmMCTrackInterface, 1) -}; - -#endif /* NICACBMATMMCTRACKINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEvent.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEvent.cxx deleted file mode 100644 index 9883a90a3ad879da6472dcfdf9af2b0aad130720..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEvent.cxx +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmEvent.cxx - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaCbmEvent.h" - -#include <TVector3.h> - -#include <iostream> - -#include "AnalysisTree/Constants.hpp" -#include "AnalysisTree/Matching.hpp" -#include "NicaCbmEventInterface.h" -#include "NicaCbmTrack.h" -#include "NicaDataFormat.h" -#include "NicaEvent.h" - -NicaCbmEvent::NicaCbmEvent() : NicaExpEvent("NicaCbmTrack") {} - -void NicaCbmEvent::CreateSource() { fSource = new NicaCbmEventInterface(); } - -NicaCbmEvent::NicaCbmEvent(const NicaCbmEvent& other) : NicaExpEvent(other) -{ - if (other.fSource) CreateSource(); -} - -void NicaCbmEvent::Update() -{ - fTracks->Clear(); - NicaCbmEventInterface* interface = (NicaCbmEventInterface*) fSource; - CbmAnaTreeRecoSourceContainer* container = (CbmAnaTreeRecoSourceContainer*) interface->GetRawEventPointer(); - fTotalTracksNo = interface->GetTotalTrackNo(); - if (fTotalTracksNo > 1000) { fTotalTracksNo = 0; } - TLorentzVector start = interface->GetVertex(); - fVertex->SetXYZT(start.X(), start.Y(), start.Z(), start.T()); - fTracks->ExpandCreateFast(fTotalTracksNo); - AnaTreeRecoIds ids = container->GetFieldIds(); - for (int i = 0; i < fTotalTracksNo; i++) { - AnalysisTree::Track p = container->GetVtxTracks()->GetChannel(i); - AnalysisTree::ShortInt_t match = container->GetVtx2ToFMatch()->GetMatchDirect(i); - NicaCbmTrack* track = (NicaCbmTrack*) fTracks->UncheckedAt(i); - track->ResetTrack(i, this); - track->SetChi2(p.GetField<float>(ids.vtx_chi2)); - track->SetVertexChi2(p.GetField<float>(ids.vtx_vtxchi2)); - track->GetMomentum()->SetPxPyPzE(p.GetPx(), p.GetPy(), p.GetPz(), 0); - track->GetDCA()->SetXYZ(p.GetField<float>(ids.vtx_dcax), p.GetField<float>(ids.vtx_dcay), - p.GetField<float>(ids.vtx_dcaz)); - track->SetNHits(p.GetField<int>(ids.vtx_nhits)); - track->SetCharge(p.GetField<int>(ids.vtx_q)); - track->SetNMvdHits(p.GetField<int>(ids.vtx_mvdhits)); - TVector3 mom(p.GetPx(), p.GetPy(), p.GetPz()); - TVector3 pos(track->GetDCA()->X(), track->GetDCA()->Y(), track->GetDCA()->Z()); - track->GetHelix()->Build(pos, mom, track->GetCharge()); - NicaToFTrack* tof = (NicaToFTrack*) track->GetDetTrack(NicaDetectorID::kTOF); - if (match == AnalysisTree::UndefValueShort) { - //no tof - tof->SetMass2(NicaToFTrack::DummyVal()); - tof->SetBeta(NicaToFTrack::DummyVal()); - tof->SetFlag(0); - } - else { - AnalysisTree::Hit tof_hit = container->GetTofHits()->GetChannel(match); - Double_t P = track->GetMomentum()->P(); - Double_t m2 = tof_hit.GetField<float>(ids.tof_mass2); - Double_t E = TMath::Sqrt(mom * mom + m2); - Double_t beta = P / E; - tof->SetMass2(m2); - tof->SetBeta(beta); - tof->SetFlag(1); - } - } -} - -NicaCbmEvent::NicaCbmEvent(TString classname) : NicaExpEvent(classname) {} - -NicaCbmEvent::~NicaCbmEvent() {} - -Bool_t NicaCbmEvent::ExistInTree() const { return CheckBranches(1, "CbmAnaTreeSourceContainer."); } diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEvent.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEvent.h deleted file mode 100644 index 9a3ccb29f974ba38113bf1b15430704a3a27bc8c..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEvent.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmEvent.h - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMDSTEVENT_H_ -#define NICACBMDSTEVENT_H_ - -#include "NicaCbmTrack.h" -#include "NicaExpEvent.h" - -class NicaCbmEvent : public NicaExpEvent { -protected: - virtual void CreateSource(); - NicaCbmEvent(TString classname); - -public: - NicaCbmEvent(); - NicaCbmEvent(const NicaCbmEvent& other); - virtual void Update(); - virtual Bool_t ExistInTree() const; - virtual NicaTrack* GetNewTrack() const { return new NicaCbmTrack(); }; - virtual NicaEvent* GetNewEvent() const { return new NicaCbmEvent(); }; - virtual TString GetFormatName() const { return "NicaCbmEvent"; }; - virtual ~NicaCbmEvent(); - ClassDef(NicaCbmEvent, 1) -}; - -#endif /* NICACBMDSTEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEventInterface.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEventInterface.cxx deleted file mode 100644 index adea76aa058e2b90b554e5282bc632ebe0f1deb5..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEventInterface.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmEventInterface.cxx - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "NicaCbmEventInterface.h" - -#include "CbmAnaTreeSource.h" -#include "CbmGlobalTrack.h" -#include "CbmStsTrack.h" -#include "CbmTofTrack.h" - -#include <FairRootManager.h> - -#include <RtypesCore.h> -#include <TObjArray.h> - -#include <stddef.h> - -NicaCbmEventInterface::NicaCbmEventInterface() : fDataContainer(nullptr) {} - -void NicaCbmEventInterface::ConnectToTree() -{ - FairRootManager* manager = FairRootManager::Instance(); - if (CanDeleteEvent()) { delete fDataContainer; } - - fDataContainer = (CbmAnaTreeRecoSourceContainer*) manager->GetObject("CbmAnaTreeSourceContainer."); -} - -void NicaCbmEventInterface::Register(Bool_t write) -{ - FairRootManager* manager = FairRootManager::Instance(); - manager->Register("CbmAnaTreeSourceContainer.", "CbmAnaTreeSourceContainer.", fDataContainer, write); -} - -void NicaCbmEventInterface::CopyData(NicaEventInterface* s) -{ - NicaCbmEventInterface* ev = (NicaCbmEventInterface*) s; - *fDataContainer = *ev->fDataContainer; //TODO make assignment operator -} - -void NicaCbmEventInterface::Compress(Int_t* /*map*/, Int_t /*map_size*/) -{ - //NOT AVAIABLE IN ANATREE -} - -void NicaCbmEventInterface::CopyAndCompress(NicaEventInterface* s, Int_t* /*map*/, Int_t /*map_size*/) -{ - NicaCbmEventInterface* ev = (NicaCbmEventInterface*) s; - *fDataContainer = *ev->fDataContainer; -} - -void NicaCbmEventInterface::FillTrackInterface(NicaTrackInterface* /*track*/, Int_t /*index*/) -{ - // OPS NO POINTER TO TOBJECT ! -} - -Int_t NicaCbmEventInterface::GetTotalTrackNo() const { return fDataContainer->GetVtxTracks()->GetNumberOfChannels(); } - -TObject* NicaCbmEventInterface::GetRawTrackPointer(Int_t /*index*/) const { return nullptr; } - -TLorentzVector NicaCbmEventInterface::GetVertexError() const { return TLorentzVector(0, 0, 0, 0); } - -TLorentzVector NicaCbmEventInterface::GetVertex() const -{ - AnalysisTree::EventHeader* header = fDataContainer->GetEventHeader(); - return TLorentzVector(header->GetVertexX(), header->GetVertexY(), header->GetVertexZ(), 0); -} - -NicaCbmEventInterface::~NicaCbmEventInterface() -{ - if (CanDeleteEvent()) { delete fDataContainer; } -} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEventInterface.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEventInterface.h deleted file mode 100644 index 75f9a2f77470396f44a31b0e4ac0ff3a8d52bf42..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmEventInterface.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmDstEventInterface.h - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMATRECOEVENTINTERFACE_H_ -#define NICACBMATRECOEVENTINTERFACE_H_ - -#include "CbmAnaTreeContainer.h" - -#include <Rtypes.h> -#include <RtypesCore.h> -#include <TVector3.h> - -#include "NicaCbmTrackInterface.h" -#include "NicaExpEventInterface.h" - -class NicaCbmEventInterface : public NicaExpEventInterface { -protected: - CbmAnaTreeRecoSourceContainer* fDataContainer; - virtual void ConnectToTree(); - void Register(Bool_t write); - -public: - NicaCbmEventInterface(); - virtual void CopyData(NicaEventInterface* s); - virtual void Compress(Int_t* map, Int_t map_size); - virtual void CopyAndCompress(NicaEventInterface* s, Int_t* map, Int_t map_size); - virtual void FillTrackInterface(NicaTrackInterface* track, Int_t index); - virtual Int_t GetTotalTrackNo() const; - virtual TObject* GetRawEventPointer() const { return fDataContainer; }; - virtual NicaTrackInterface* GetTrackInterface() const { return new NicaCbmTrackInterface(); } - virtual TObject* GetRawTrackPointer(Int_t index) const; - /** GETTERS AND SETTERS **/ - virtual void SetRunInfoId(Int_t /*i*/) {}; - virtual Int_t GetRunInfoId() const { return 0; }; - ; - virtual void SetMagneticField(TVector3 /*mag*/) const {}; - virtual TVector3 GetMagneticField() const { return TVector3(0, 0, 0); }; - virtual TLorentzVector GetVertexError() const; - virtual TLorentzVector GetVertex() const; - virtual ~NicaCbmEventInterface(); - ClassDef(NicaCbmEventInterface, 1) -}; - -#endif /* NICACBMATRECOEVENTINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrack.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrack.cxx deleted file mode 100644 index 9a8e2a8837d7732971931e98095d7b6f0230dfb8..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrack.cxx +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmTrack.cxx - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaCbmTrack.h" - -#include "CbmHelix.h" - -#include "NicaCbmEventInterface.h" -#include "NicaDataFormat.h" -#include "NicaExpEvent.h" - -NicaCbmTrack::NicaCbmTrack() : fTofTrack(new NicaToFTrack()), fHelix(new CbmHelix()), fChi2Vertex(0), fMvdHits(0) {} - -NicaCbmTrack::NicaCbmTrack(const NicaCbmTrack& other) - : NicaExpTrack(other) - , fTofTrack(new NicaToFTrack(*other.fTofTrack)) - , fHelix(new CbmHelix(*other.fHelix)) - , fChi2Vertex(other.fChi2Vertex) - , fMvdHits(other.fMvdHits) -{ -} - -NicaCbmTrack& NicaCbmTrack::operator=(const NicaCbmTrack& other) -{ - if (this == &other) return *this; - NicaExpTrack::operator=(other); - *fTofTrack = *other.fTofTrack; - *fHelix = *other.fHelix; - fChi2Vertex = other.fChi2Vertex; - fMvdHits = other.fMvdHits; - return *this; -} - -TObject* NicaCbmTrack::GetDetTrack(const UInt_t detID) const -{ - if (detID == NicaDetectorID::kTOF) { return fTofTrack; } - return nullptr; -} - -NicaCbmTrack::~NicaCbmTrack() -{ - delete fTofTrack; - delete fHelix; -} - -void NicaCbmTrack::CopyData(NicaTrack* other) -{ - NicaExpTrack::CopyData(other); - *fTofTrack = *(static_cast<NicaCbmTrack*>(other))->fTofTrack; - *fHelix = *(static_cast<NicaCbmTrack*>(other))->fHelix; - fChi2Vertex = (static_cast<NicaCbmTrack*>(other))->fChi2Vertex; - fMvdHits = (static_cast<NicaCbmTrack*>(other))->fMvdHits; -} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrack.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrack.h deleted file mode 100644 index 403b4ccb3ba25c9f74b95e2af01095406317e049..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrack.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmTrack.h - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMATRECOTRACK_H_ -#define NICACBMATRECOTRACK_H_ - -#include "CbmGlobalTrack.h" -#include "CbmHelix.h" - -#include "AnalysisTree/Detector.hpp" -#include "AnalysisTree/Particle.hpp" -#include "NicaCbmEventInterface.h" -#include "NicaExpTrack.h" -#include "NicaToFTrack.h" - -class CbmHelix; -class NicaCbmTrackInterface; -class NicaCbmTrack : public NicaExpTrack { - NicaToFTrack* fTofTrack; - CbmHelix* fHelix; - Float_t fChi2Vertex; - Int_t fMvdHits; - -public: - NicaCbmTrack(); - NicaCbmTrack(const NicaCbmTrack& other); - NicaCbmTrack& operator=(const NicaCbmTrack& other); - NicaToFTrack* GetTofTrack() { return fTofTrack; }; - CbmHelix* GetHelix() const { return fHelix; }; - Double_t GetVertexChi2() const { return fChi2Vertex; }; - Int_t GetNMvdHits() const { return fMvdHits; }; - void SetVertexChi2(Double_t v) { fChi2Vertex = v; }; - void SetNMvdHits(Int_t h) { fMvdHits = h; }; - virtual void CopyData(NicaTrack* other); - virtual TObject* GetDetTrack(const UInt_t detID) const; - virtual ~NicaCbmTrack(); - ClassDef(NicaCbmTrack, 1) -}; - -#endif /* NICACBMATRECOTRACK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrackInterface.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrackInterface.cxx deleted file mode 100644 index 6e5b0fc40d7a3ea5fd4f9d2f6647ba88f64b72d9..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrackInterface.cxx +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmTrackInterface.cxx - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaCbmTrackInterface.h" - -NicaCbmTrackInterface::NicaCbmTrackInterface() {} - -NicaCbmTrackInterface::~NicaCbmTrackInterface() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrackInterface.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrackInterface.h deleted file mode 100644 index 85a91eedc0ca84dd82a51f4f1f2a23c3b29209d9..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/anatree/reco/NicaCbmTrackInterface.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmTrackInterface.h - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMATRECOTRACKINTERFACE_H_ -#define NICACBMATRECOTRACKINTERFACE_H_ - -#include "CbmStsTrack.h" - -#include "NicaTrackInterface.h" -class NicaCbmTrackInterface : public NicaTrackInterface { -public: - NicaCbmTrackInterface(); - virtual ~NicaCbmTrackInterface(); - ClassDef(NicaCbmTrackInterface, 1) -}; - -#endif /* NICACBMATTRACKINTERFACE_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/CbmHbtFullEvent.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/CbmHbtFullEvent.cxx deleted file mode 100644 index 7237ba4bd3b905489d0d85da9e06a705eec8e971..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/CbmHbtFullEvent.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmHbtEvent.cxx - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmHbtFullEvent.h" - -#include "CbmHbtEvent.h" -#include "CbmHbtFullEvent.h" - -#include "NicaCbmMCEvent.h" - -CbmHbtFullEvent::CbmHbtFullEvent() : NicaComplexEvent(new CbmHbtEvent(), new NicaCbmMCEvent()) {} - -CbmHbtFullEvent::~CbmHbtFullEvent() {} - -/* -Bool_t CbmHbtFullEvent::IsCompatible(const NicaEvent *non_buffered) const { - if(non_buffered->InheritsFrom("NicaCbmATFullEvent")) return kTRUE; - return kFALSE; -} -*/ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/CbmHbtFullEvent.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/CbmHbtFullEvent.h deleted file mode 100644 index 52685a1c44436d3b2bc5472113670abec70401d5..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/CbmHbtFullEvent.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmHbtEvent.h - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMHBTFULLEVENT_H_ -#define CBMHBTFULLEVENT_H_ - -#include "NicaComplexEvent.h" - -/** - * class for ana tree data and HBT analysis - */ - -class CbmHbtFullEvent : public NicaComplexEvent { -public: - CbmHbtFullEvent(); - virtual void Update() {}; // we are never reading directly from tree - virtual TString GetFormatName() const { return "NicaCbmHbtEvent"; }; - virtual NicaEvent* GetNewEvent() const { return new CbmHbtFullEvent(); }; - // virtual Bool_t IsCompatible(const NicaEvent *non_buffered) const; - virtual ~CbmHbtFullEvent(); - ClassDef(CbmHbtFullEvent, 1) -}; - -#endif /* CBMHBTFULLEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/NicaCbmFullEvent.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/NicaCbmFullEvent.cxx deleted file mode 100644 index cb995fcca1e77c38c535d2c7cfba9f9deedcd551..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/NicaCbmFullEvent.cxx +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmATEvent.cxx - * - * Created on: 17 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "NicaCbmFullEvent.h" - -#include "AnalysisTree/Constants.hpp" -#include "NicaCbmEvent.h" -#include "NicaCbmEventInterface.h" -#include "NicaCbmMCEvent.h" -#include "NicaComplexTrack.h" - - -NicaCbmFullEvent::NicaCbmFullEvent() : NicaComplexEvent(new NicaCbmEvent(), new NicaCbmMCEvent()) {} - -void NicaCbmFullEvent::Update() -{ - fImgEvent->Update(); - fRealEvent->Update(); - NicaEvent::ShallowCopyEvent(fRealEvent); - fTracks->Clear(); - fTotalTracksNo = fRealEvent->GetTotalTrackNo(); - fTracks->ExpandCreateFast(fTotalTracksNo); - NicaCbmEventInterface* s = (NicaCbmEventInterface*) fSource; - CbmAnaTreeRecoSourceContainer* reco = (CbmAnaTreeRecoSourceContainer*) s->GetRawEventPointer(); - for (Int_t i = 0; i < fTotalTracksNo; i++) { - NicaComplexTrack* track = (NicaComplexTrack*) fTracks->UncheckedAt(i); - track->ResetTrack(i, this); - track->SetRealTrack(fRealEvent->GetTrack(i)); - track->NicaTrack::CopyData(fRealEvent->GetTrack(i)); - Int_t match = reco->GetVtx2Sim()->GetMatchDirect(i); - - if (match < 0 || match == AnalysisTree::UndefValueInt) { track->SetImgTrack(nullptr); } - else { - track->SetImgTrack(fImgEvent->GetTrack(match)); - track->SetMatchID(match); - } - } -} - -NicaEvent* NicaCbmFullEvent::GetNewEvent() const { return new NicaCbmFullEvent(); } - -NicaCbmFullEvent::~NicaCbmFullEvent() {} - -NicaCbmFullEvent::NicaCbmFullEvent(NicaEvent* re, NicaEvent* im) : NicaComplexEvent(re, im) {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/NicaCbmFullEvent.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/NicaCbmFullEvent.h deleted file mode 100644 index 7b3d68174f1905a4588097bbfac92a87c9f32eba..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/combined/NicaCbmFullEvent.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmATEvent.h - * - * Created on: 17 wrz 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMATEVENT_H_ -#define NICACBMATEVENT_H_ -#include "NicaComplexEvent.h" - -/** - * class for analyses that base on anatree events - */ - -class NicaCbmFullEvent : public NicaComplexEvent { -protected: - NicaCbmFullEvent(NicaEvent* re, NicaEvent* im); - -public: - NicaCbmFullEvent(); - virtual void Update(); - virtual TString GetFormatName() const { return "NicaCbmFullEvent"; }; - virtual NicaEvent* GetNewEvent() const; - virtual ~NicaCbmFullEvent(); - ClassDef(NicaCbmFullEvent, 1) -}; - -#endif /* NICACBMATEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorReadUnigen.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorReadUnigen.cxx deleted file mode 100644 index eb374dd90d2a6732f1c7db8b57ff0e64d1ef7cbb..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorReadUnigen.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 2015-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaGeneratorReadUnigen.cxx - * - * Created on: 13 sie 2015 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "NicaGeneratorReadUnigen.h" - -#include <TString.h> - -#include "NicaGeneratorParametersArray.h" -#include "NicaGeneratorRead.h" - - -Int_t NicaGeneratorReadUnigen::ReadEvent() -{ - Int_t status = NicaGeneratorReadTree::ReadEvent(); - if (status != EventOk()) return status; - fEventParameters->SetInt(fInEvent->GetEventNr(), fEventNr_Id); - fEventParameters->SetInt(fInEvent->GetNes(), fENes_Id); - fEventParameters->SetInt(fInEvent->GetStepNr(), fEStepNr_Id); - fEventParameters->SetDouble(fInEvent->GetPhi(), fPhi_Id); - fEventParameters->SetDouble(fInEvent->GetB(), fB_Id); - WriteEventHeader(); - for (int i = 0; i < fInEvent->GetNpa(); i++) { - UParticle* part = fInEvent->GetParticle(i); - fTrackParameters->SetInt(part->GetIndex(), fIndex_Id); - fTrackParameters->SetInt(part->GetStatus(), fStatus_Id); - fTrackParameters->SetInt(part->GetParent(), fParent_Id); - fTrackParameters->SetInt(part->GetParentDecay(), fParentDecay_Id); - fTrackParameters->SetInt(part->GetMate(), fMate_Id); - fTrackParameters->SetInt(part->GetDecay(), fDecay_Id); - fTrackParameters->SetInt(part->GetFirstChild(), fChild1_Id); - fTrackParameters->SetInt(part->GetLastChild(), fChild2_Id); - fTrackParameters->SetDouble(part->Px(), fPx_Id); - fTrackParameters->SetDouble(part->Py(), fPy_Id); - fTrackParameters->SetDouble(part->Pz(), fPz_Id); - fTrackParameters->SetDouble(part->E(), fE_Id); - fTrackParameters->SetDouble(part->X(), fX_Id); - fTrackParameters->SetDouble(part->Y(), fY_Id); - fTrackParameters->SetDouble(part->Z(), fZ_Id); - fTrackParameters->SetDouble(part->T(), fT_Id); - fTrackParameters->SetInt(part->GetPdg(), fPdg_Id); - WriteParticle(); - } - return EventOk(); -} - -Int_t NicaGeneratorReadUnigen::Reopen() -{ - Int_t stat = NicaGeneratorReadTree::Reopen(); - if (stat != FileOk()) { return stat; } - if (fInEvent == NULL) fInEvent = new UEvent(); - fBranch->SetAddress(&fInEvent); - fInTree->GetEntry(0); - return FileOk(); -} - -NicaGeneratorReadUnigen::NicaGeneratorReadUnigen(TString name, Bool_t multi_mode) - : NicaGeneratorReadTree(name, "events", "event", multi_mode) - , fInEvent(NULL) - , fStatus_Id(0) - , fParent_Id(0) - , fParentDecay_Id(0) - , fMate_Id(0) - , fDecay_Id(0) - , fChild1_Id(0) - , fChild2_Id(0) - , fX_Id(0) - , fY_Id(0) - , fZ_Id(0) - , fT_Id(0) - , fWeight_Id(0) - , fENes_Id(0) - , fEStepNr_Id(0) - , fEStepT_Id(0) -{ - fInEvent = new UEvent(); -} - -void NicaGeneratorReadUnigen::CheckParameters() -{ - NicaGeneratorRead::CheckParameters(); - fStatus_Id = CheckParameter("status"); - fParent_Id = CheckParameter("parent"); - fParentDecay_Id = CheckParameter("parent_decay"); - fMate_Id = CheckParameter("mate"); - fDecay_Id = CheckParameter("decay_id"); - fChild1_Id = CheckParameter("first_child"); - fChild2_Id = CheckParameter("last_child"); - fX_Id = CheckParameter("frx"); - fY_Id = CheckParameter("fry"); - fZ_Id = CheckParameter("frz"); - fT_Id = CheckParameter("frt"); - fWeight_Id = CheckParameter("weight"); - ; - fENes_Id = CheckParameter("Nes"); - fEStepNr_Id = CheckParameter("Step_nr"); - fEStepT_Id = CheckParameter("Step_t"); -} - -NicaGeneratorReadUnigen::~NicaGeneratorReadUnigen() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorReadUnigen.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorReadUnigen.h deleted file mode 100644 index deda5fc842d6e8f2ba59df5eb79e72393867fa7c..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorReadUnigen.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 2015-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaGeneratorReadUnigen.h - * - * Created on: 13 sie 2015 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef _NICAGENERATORREADUNIGEN_H_ -#define _NICAGENERATORREADUNIGEN_H_ - -#include <TBranch.h> -#include <TTree.h> - -#include "NicaGeneratorReadTree.h" -#include "UEvent.h" -#include "UParticle.h" - - -/** - * basic class for reading unigen files - */ -class NicaGeneratorReadUnigen : public NicaGeneratorReadTree { -private: - UEvent* fInEvent; - Int_t fStatus_Id, fParent_Id, fParentDecay_Id, fMate_Id, fDecay_Id, fChild1_Id, fChild2_Id; - Int_t fX_Id, fY_Id, fZ_Id, fT_Id, fWeight_Id; - Int_t fENes_Id, fEStepNr_Id, fEStepT_Id; - -protected: - virtual Int_t ReadEvent(); - virtual Int_t Reopen(); - virtual void CheckParameters(); - -public: - /** - * default constructor - * @param name - * @param multi_mode - */ - NicaGeneratorReadUnigen(TString name, Bool_t multi_mode = kFALSE); - virtual ~NicaGeneratorReadUnigen(); - ClassDef(NicaGeneratorReadUnigen, 1) -}; - -#endif /* _NICAGENERATORREADUNIGEN_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorWriteUnigen.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorWriteUnigen.cxx deleted file mode 100644 index b5c78c2edc244ac8285d8c22f64036148acdc7bf..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorWriteUnigen.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (C) 2015-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaGeneratorWriteUnigen.cxx - * - * Created on: 13 sie 2015 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "NicaGeneratorWriteUnigen.h" - -#include <FairTask.h> -#include <Logger.h> - -#include <TTree.h> - -#include "NicaGeneratorParametersArray.h" -#include "NicaRunSim.h" - -NicaGeneratorWriteUnigen::NicaGeneratorWriteUnigen() : NicaGeneratorWrite(4, 3, 1, 0, 9, 9, 0, 0) -{ - fEvent = new UEvent(); - // parameter 0 is reserverd for random stuff ! - //register event parameters int - Register(4, "Nes", "Step_nr", "Npa", "Nr"); - //register event parameters double - Register(3, "B", "Phi", "Step_t"); - //register track int parameters - Register(9, "index", "pdg", "status", "parent", "parent_decay", "mate", "decay", "first_child", "last_child"); - //register track double parameters - Register(9, "px", "py", "pz", "e", "frx", "fry", "frz", "frt", "weight"); -} - -InitStatus NicaGeneratorWriteUnigen::Init() -{ - InitStatus stat = NicaGeneratorWrite::Init(); - NicaRunSim* manager = NicaRunSim::Instance(); - manager->GetTree()->Branch("event", &fEvent); - LOG(info) << "Data will be set to Unigen format"; - return stat; -} - -void NicaGeneratorWriteUnigen::ClearEvent() { fEvent->Clear(); } - -void NicaGeneratorWriteUnigen::AddEvent() -{ - fEvent->SetNes(fEventParameters->GetInt(1)); - fEvent->SetStepNr(fEventParameters->GetInt(2)); - fEvent->SetEventNr(fEventParameters->GetInt(4)); - fEvent->SetB(fEventParameters->GetDouble(1)); - fEvent->SetPhi(fEventParameters->GetDouble(2)); - fEvent->SetStepT(fEventParameters->GetDouble(3)); -} - -void NicaGeneratorWriteUnigen::AddParticle() -{ - Int_t child[2] = {fTrackParameters->GetInt(8), fTrackParameters->GetInt(9)}; - fEvent->AddParticle(fTrackParameters->GetInt(1), //index - fTrackParameters->GetInt(2), //pdg - fTrackParameters->GetInt(3), ///status - fTrackParameters->GetInt(4), //parent - fTrackParameters->GetInt(5), //parent_decay - fTrackParameters->GetInt(6), //mate - fTrackParameters->GetInt(7), //decay - child, fTrackParameters->GetDouble(1), fTrackParameters->GetDouble(2), - fTrackParameters->GetDouble(3), fTrackParameters->GetDouble(4), fTrackParameters->GetDouble(5), - fTrackParameters->GetDouble(6), fTrackParameters->GetDouble(7), fTrackParameters->GetDouble(8), - fTrackParameters->GetDouble(9)); -} - -NicaGeneratorWriteUnigen::~NicaGeneratorWriteUnigen() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorWriteUnigen.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorWriteUnigen.h deleted file mode 100644 index 5cdb6522bbb2ac069e0ef9a0152936f52655613c..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaGeneratorWriteUnigen.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2015-2019 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaGeneratorWriteUnigen.h - * - * Created on: 13 sie 2015 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef _NICAGENERATORWRITEUNIGEN_H_ -#define _NICAGENERATORWRITEUNIGEN_H_ - -#include "NicaGeneratorWrite.h" -#include "UEvent.h" -#include "UParticle.h" -/** - * default class for saving data in unigen format - */ -class NicaGeneratorWriteUnigen : public NicaGeneratorWrite { - UEvent* fEvent; - -public: - NicaGeneratorWriteUnigen(); - virtual InitStatus Init(); - virtual void Exec(Option_t* /*opt*/) {}; - virtual void ClearEvent(); - void AddEvent(); - void AddParticle(); - virtual ~NicaGeneratorWriteUnigen(); - ClassDef(NicaGeneratorWriteUnigen, 1) -}; - -#endif /* _NICAGENERATORWRITEUNIGEN_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEvent.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEvent.cxx deleted file mode 100644 index d150d7c1747702c196d1c27fb1d7b2fd4938dba5..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEvent.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 2014-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaUnigen.cxx - * - * Created on: 23-06-2014 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "NicaUnigenEvent.h" - -#include <FairRootManager.h> - -#include <TClonesArray.h> -#include <TDatabasePDG.h> -#include <TLorentzVector.h> -#include <TParticlePDG.h> - -#include "NicaEventInterface.h" -#include "NicaLink.h" -#include "NicaMCTrack.h" -#include "NicaTrack.h" -#include "NicaUnigenEventInterface.h" - -NicaUnigenEvent::NicaUnigenEvent() : NicaMCEvent("NicaUnigenTrack") {} - -void NicaUnigenEvent::Update() -{ - UEvent* temp = ((NicaUnigenEventInterface*) fSource)->fEvent; - fB = temp->GetB(); - fPhi = temp->GetPhi(); - fTotalTracksNo = temp->GetNpa(); - fTracks->Clear(); - for (int i = 0; i < fTotalTracksNo; i++) { - UParticle* particle = temp->GetParticle(i); - TParticlePDG* pdg_part = fPDG->GetParticle(particle->GetPdg()); - Double_t charge = 0; - if (pdg_part) { charge = pdg_part->Charge() / 3.0; } - NicaMCTrack* target_track = (NicaMCTrack*) fTracks->ConstructedAt(i); - target_track->ResetTrack(i, this); - target_track->SetCharge(charge); - target_track->SetPdg(particle->GetPdg()); - if (particle->GetParent() < 0) { target_track->SetPrimary(); } - else { - target_track->SetMotherIndex(particle->GetParent()); - } - target_track->GetMomentum()->SetPxPyPzE(particle->Px(), particle->Py(), particle->Pz(), particle->E()); - target_track->GetFreezoutPosition()->SetXYZT(particle->X(), particle->Y(), particle->Z(), particle->T()); - target_track->SetStatus(particle->GetStatus()); - } -} - -void NicaUnigenEvent::Clear(Option_t* opt) -{ - NicaMCEvent::Clear(opt); - if (fSource) fSource->Clear(opt); -} - -NicaUnigenEvent::NicaUnigenEvent(const NicaUnigenEvent& other) : NicaMCEvent(other) {} - -void NicaUnigenEvent::CreateSource() { fSource = new NicaUnigenEventInterface(); } - -NicaUnigenEvent::~NicaUnigenEvent() {} - -TString NicaUnigenEvent::GetFormatName() const { return "UnigenFormat"; } - -Bool_t NicaUnigenEvent::ExistInTree() const -{ - FairRootManager* manager = FairRootManager::Instance(); - if (manager->CheckBranch("UEvent.")) { return kTRUE; } - return kFALSE; -} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEvent.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEvent.h deleted file mode 100644 index 88c16eb86b60d2007ba220c48f7b5d6eaa1aa753..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEvent.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 2014-2019 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaUnigen.h - * - * Created on: 23-06-2014 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#ifndef NICAUNIGENEVENT_H_ -#define NICAUNIGENEVENT_H_ - -#include "NicaMCEvent.h" -#include "NicaUnigenTrack.h" -#include "UEvent.h" -#include "UParticle.h" -/** - * class used for representation of unigen event in "fake" format - */ -class NicaUnigenEvent : public NicaMCEvent { -public: - /** - * default constructor - */ - NicaUnigenEvent(); - NicaUnigenEvent(const NicaUnigenEvent& other); - void CreateSource(); - virtual void Update(); - virtual void Clear(Option_t* opt = " "); - virtual Bool_t ExistInTree() const; - virtual TString GetFormatName() const; - virtual ~NicaUnigenEvent(); - ClassDef(NicaUnigenEvent, 1) -}; - -#endif /* NICAUNIGENEVENT_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEventInterface.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEventInterface.cxx deleted file mode 100644 index bf261f44f65357025725aeaa2778a52110eb3ab9..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenEventInterface.cxx +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (C) 2017-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaUnigenSource.cxx - * - * Created on: 2 sie 2017 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaUnigenEventInterface.h" - -#include "FairRootManager.h" - -#include "NicaUnigenTrackInterface.h" - -NicaUnigenEventInterface::NicaUnigenEventInterface() : fEvent(NULL) { fEvent = new UEvent(); } - -void NicaUnigenEventInterface::Compress(Int_t* map, Int_t map_size) -{ - Int_t track_pos = 0; - for (int i = 0; i < map_size; i++) { - Int_t good_track = map[i]; - for (int j = track_pos; j < good_track; j++) { - fEvent->RemoveAt(j); - } - track_pos = good_track + 1; - } -} - -void NicaUnigenEventInterface::CopyData(NicaEventInterface* s) -{ -#ifdef UNIGEN_OLD - CopyUnigen(((NicaUnigenEventInterface*) s)->fEvent, fEvent); -#else - *fEvent = *((NicaUnigenEventInterface*) s)->fEvent; -#endif -} - -void NicaUnigenEventInterface::CopyAndCompress(NicaEventInterface* s, Int_t* map, Int_t map_size) -{ - NicaUnigenEventInterface* ev = (NicaUnigenEventInterface*) s; - fEvent->SetB(ev->fEvent->GetB()); - fEvent->SetPhi(ev->fEvent->GetPhi()); - fEvent->SetNes(ev->fEvent->GetNes()); - fEvent->SetStepNr(ev->fEvent->GetStepNr()); - fEvent->SetStepT(ev->fEvent->GetStepT()); -#ifdef UNIGEN_OLD - fEvent->GetParticleList()->Clear(); -#else - TString comment; - ev->fEvent->GetComment(comment); - fEvent->SetComment(comment); - fEvent->Clear(); -#endif - for (int i = 0; i < map_size; i++) { - fEvent->AddParticle(*ev->fEvent->GetParticle(map[i])); - } -} - -void NicaUnigenEventInterface::ConnectToTree() -{ - FairRootManager* manager = FairRootManager::Instance(); - if (CanDeleteEvent()) { - if (fEvent) delete fEvent; - } - fEvent = (UEvent*) manager->GetObject("UEvent."); -} - -void NicaUnigenEventInterface::Boost(Double_t vx, Double_t vy, Double_t vz) -{ - for (int i = 0; i < fEvent->GetNpa(); i++) { - UParticle* p = fEvent->GetParticle(i); - TLorentzVector mom = p->GetMomentum(); - TLorentzVector pos = p->GetPosition(); - mom.Boost(vx, vy, vz); - pos.Boost(vx, vy, vz); - p->SetMomentum(mom); - p->SetPosition(pos); - } -} - -NicaUnigenEventInterface::~NicaUnigenEventInterface() -{ - if (CanDeleteEvent()) { - if (fEvent) delete fEvent; - } -} - -NicaTrackInterface* NicaUnigenEventInterface::GetTrackInterface() const { return new NicaUnigenTrackInterface(); } - -void NicaUnigenEventInterface::Register(Bool_t write) -{ - if (fEvent == NULL) fEvent = new UEvent(); - FairRootManager* manager = FairRootManager::Instance(); - manager->Register("Event", "", (TNamed*) fEvent, write); -} - -void NicaUnigenEventInterface::FillTrackInterface(NicaTrackInterface* track, Int_t index) -{ - track->SetRawTrack(fEvent->GetParticle(index)); -} -#ifdef UNIGEN_OLD -void NicaUnigenEventInterface::CopyUnigen(UEvent* from, UEvent* to) -{ - to->GetParticleList()->Clear(); - to->SetB(from->GetB()); - to->SetPhi(from->GetPhi()); - to->SetNes(from->GetNes()); - to->SetStepNr(from->GetStepNr()); - to->SetStepT(from->GetStepT()); - for (int i = 0; i < from->GetNpa(); i++) { - to->AddParticle(*from->GetParticle(i)); - } -} -#endif diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrack.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrack.cxx deleted file mode 100644 index d738388afa651bec83788a2e340e755e40e39996..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrack.cxx +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (C) 2014-2019 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaUnigenTrack.cxx - * - * Created on: 23-06-2014 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#include "NicaUnigenTrack.h" - -NicaUnigenTrack::NicaUnigenTrack() {} - -NicaUnigenTrack::~NicaUnigenTrack() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrack.h b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrack.h deleted file mode 100644 index 6d4ab430f903f5851f341bed402d8298b7d24fe2..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrack.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2014-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaUnigenTrack.h - * - * Created on: 23-06-2014 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ - -#ifndef NICAUNIGENTRACK_H_ -#define NICAUNIGENTRACK_H_ - -#include <iostream> - -#include "NicaMCTrack.h" -#include "UParticle.h" - -/** - * class for representation of track from unigen in "fake" format - */ -class NicaUnigenTrack : public NicaMCTrack { -public: - NicaUnigenTrack(); - virtual ~NicaUnigenTrack(); - ClassDef(NicaUnigenTrack, 1) -}; - -#endif /* NICAUNIGENTRACK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrackInterface.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrackInterface.cxx deleted file mode 100644 index 2d41869631866cb2a003915c25a08d81bf18e98b..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/format/unigen/NicaUnigenTrackInterface.cxx +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (C) 2017-2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaUnigenTrackInterface.cxx - * - * Created on: 2 sie 2017 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaUnigenTrackInterface.h" - -NicaUnigenTrackInterface::NicaUnigenTrackInterface() {} - -NicaUnigenTrackInterface::~NicaUnigenTrackInterface() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CMakeLists.txt deleted file mode 100644 index 26064f548fef7f4ffd45b12096c05cc0f6a108cc..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Create a library called "" which includes the source files given in -# the array . -# The extension is already found. Any number of sources could be listed here. -set(INCLUDE_DIRECTORIES - ${CMAKE_CURRENT_SOURCE_DIR} - ) - -# List of source files -set(SRCS - CbmDetectorID.cxx - NicaCbmFirstTask.cxx - CbmHelix.cxx - ) - - -set(LIBRARY_NAME NicaCbmHelper) -set(LINKDEF NicaCbmHelpersLinkDef.h) -set(PUBLIC_DEPENDENCIES - CbmData - FairRoot::Base - NicaFeatures - NicaDataFormat - ) - -set(PRIVATE_DEPENDENCIES - ROOT::MathCore - ) - -set(INTERFACE_DEPENDENCIES - ROOT::Core - ) - - -generate_cbm_library() - -add_dependencies(G__NicaCbmHelper NICAFEMTO) diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmDetectorID.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmDetectorID.cxx deleted file mode 100644 index e8955e483b56545a58250da635b3440a3a5db13f..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmDetectorID.cxx +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright (C) 2018-2019 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmDetectorID.cxx - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmDetectorID.h" diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmDetectorID.h b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmDetectorID.h deleted file mode 100644 index 8f784495429499188a4c4a6729ce08377fd54689..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmDetectorID.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2018-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer]*/ - -/* - * CbmDetectorID.h - * - * Created on: 3 gru 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMROOT_NICA_CBM_HELPERS_CBMDETECTORID_H_ -#define CBMROOT_NICA_CBM_HELPERS_CBMDETECTORID_H_ - -#include "NicaDataFormat.h" - -namespace NicaCbmDetectorID -{ - const UInt_t kTOF = NicaDetectorID::kTOF; - const UInt_t kSTS = NicaDetectorID::kSTS; - const UInt_t kMVD = 29641; - const UInt_t kRICH = 1283489; - const UInt_t kTRD = 38569; - const UInt_t kECAL = 669117; - const UInt_t kPSD = 33421; - const UInt_t kMUCH = 1065761; -}; // namespace NicaCbmDetectorID - -enum class NicaCbmSetup -{ - kSis100Hadron = 0, - kSis100Electron = 1, - kSis100Muon = 2, - kSis100Mini = 3 -}; - - -#endif /* CBMROOT_NICA_CBM_HELPERS_CBMDETECTORID_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmHelix.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmHelix.cxx deleted file mode 100644 index 09b745039d8c882cd3e7da19cb95c1c341df704a..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmHelix.cxx +++ /dev/null @@ -1,630 +0,0 @@ -/* Copyright (C) 2019-2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmHelix.cxx - * - * Created on: 27 sie 2019 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "CbmHelix.h" - -#include <TMath.h> - -#include <vector> -// matrix x, y, tx,ty, qp, z -FairField* CbmHelix::fgField = NULL; -CbmHelix::CbmHelix() {} - -void CbmHelix::Build(const CbmGlobalTrack* tr) -{ - const FairTrackParam* parameters = tr->GetParamVertex(); - SetParameters(parameters); -} - -void CbmHelix::Build(const CbmStsTrack* tr, Bool_t firstPoint) -{ - if (firstPoint) { SetParameters(tr->GetParamFirst()); } - else { - SetParameters(tr->GetParamLast()); - } -} - -TVector3 CbmHelix::Eval(Double_t z) -{ - Propagate(z); - return TVector3(GetTrack()[0], GetTrack()[1], GetTrack()[5]); -} - -TVector3 CbmHelix::Eval(Double_t z, TVector3& mom) -{ - Propagate(z); - Double_t p = (TMath::Abs(Qp()) > 1.e-4) ? 1. / TMath::Abs(Qp()) : 1.e4; - Double_t pz = TMath::Sqrt(p * p / (Tx() * Tx() + Ty() * Ty() + 1)); - Double_t px = Tx() * pz; - Double_t py = Ty() * pz; - mom.SetXYZ(px, py, pz); - return TVector3(GetTrack()[0], GetTrack()[1], GetTrack()[5]); -} - -void CbmHelix::SetParameters(const FairTrackParam* param) -{ - fTb[0] = param->GetX(); - fTb[1] = param->GetY(); - fTb[2] = param->GetTx(); - fTb[3] = param->GetTy(); - fTb[4] = param->GetQp(); - fTb[5] = param->GetZ(); - /* - for (Int_t i=0,iCov=0; i<5; i++) - for (Int_t j=0; j<=i; j++,iCov++) - fC[iCov] = param->GetCovariance(i,j); - */ -} - -void CbmHelix::Build(const TVector3& pos, const TVector3& mom, Double_t charge) -{ - fTb[0] = pos.X(); - fTb[1] = pos.Y(); - Double_t p = mom.Mag(); - fTb[2] = mom.Px() / mom.Pz(); - fTb[3] = mom.Py() / mom.Pz(); - fTb[4] = charge / p; - fTb[5] = pos.Z(); -} - -CbmHelix::~CbmHelix() {} - -CbmHelix::CbmHelix(const CbmHelix& other) : TObject() -{ - for (int i = 0; i < 6; i++) { - fT[i] = other.fT[i]; - fTb[i] = other.fTb[i]; - } - /* - for(int i=0;i<15;i++){ - fC[i] = other.fC[i]; - }*/ -} - -CbmHelix& CbmHelix::operator=(const CbmHelix& other) -{ - if (&other == this) return *this; - for (int i = 0; i < 6; i++) { - fT[i] = other.fT[i]; - fTb[i] = other.fTb[i]; - } - //for(int i=0;i<15;i++) - // fC[i] = other.fC[i]; - return *this; -} - -Int_t CbmHelix::Propagate(Double_t z) -{ - Int_t fMethod = 1; - Bool_t err = 0; - for (int i = 0; i < 6; i++) { - fT[i] = fTb[i]; - } - if (fabs(fT[5] - z) < 1.e-5) return 0; - - if (!fgField || (300 <= z && 300 <= fT[5])) { - // ExtrapolateLine(Z ); - // return 0; - } - Double_t zz = z; - if (z < 300. && 300 <= fT[5]) ExtrapolateLine(300.); - - if (fT[5] < 300. && 300. < z) { zz = 300.; } - Bool_t repeat = 1; - while (!err && repeat) { - const Double_t max_step = 5.; - Double_t zzz; - if (fabs(fT[5] - zz) > max_step) zzz = fT[5] + ((zz > fT[5]) ? max_step : -max_step); - else { - zzz = zz; - repeat = 0; - } - switch (fMethod) { - case 0: { - ExtrapolateLine(zzz); - break; - } - case 1: { - err = err || ExtrapolateALight(zzz); - break; - } - case 2: { - err = err || ExtrapolateRK4(zzz); - break; - } - } - } - if (fT[5] != z) ExtrapolateLine(z); - return err; -} - -void CbmHelix::ExtrapolateLine(Double_t z_out) -{ - Double_t dz = z_out - fT[5]; - - fT[0] += dz * fT[2]; - fT[1] += dz * fT[3]; - fT[5] = z_out; - /* - const Double_t dzC_in8 = dz * fC[8]; - - fC[4] = fC[4] + dzC_in8; - fC[1] = fC[1] + dz * (fC[4] + fC[6]); - - const Double_t C_in3 = fC[3]; - - fC[3] = C_in3 + dz * fC[5]; - fC[0] = fC[0] + dz * (fC[3] + C_in3); - - const Double_t C_in7 = fC[7]; - - fC[7] = C_in7 + dz * fC[9]; - fC[2] = fC[2] + dz * (fC[7] + C_in7); - fC[6] = fC[6] + dzC_in8; -*/ -} - -Int_t CbmHelix::ExtrapolateRK4(Double_t z_out) -{ - const Double_t c_light = 0.000299792458; - - static Double_t a[4] = {0.0, 0.5, 0.5, 1.0}; - static Double_t c[4] = {1.0 / 6.0, 1.0 / 3.0, 1.0 / 3.0, 1.0 / 6.0}; - static Double_t b[4] = {0.0, 0.5, 0.5, 1.0}; - - Int_t step4; - Double_t k[16], x0[4], x[4], k1[16]; - Double_t Ax[4], Ay[4], Ax_tx[4], Ay_tx[4], Ax_ty[4], Ay_ty[4]; - - //---------------------------------------------------------------- - - Double_t qp_in = fT[4]; - Double_t z_in = fT[5]; - Double_t h = z_out - z_in; - Double_t hC = h * c_light; - x0[0] = fT[0]; - x0[1] = fT[1]; - x0[2] = fT[2]; - x0[3] = fT[3]; - // - // Runge-Kutta step - // - - Int_t step; - Int_t i; - - for (step = 0; step < 4; ++step) { - for (i = 0; i < 4; ++i) { - if (step == 0) { x[i] = x0[i]; } - else { - x[i] = x0[i] + b[step] * k[step * 4 - 4 + i]; - } - } - - Double_t point[3] = {x[0], x[1], z_in + a[step] * h}; - Double_t B[3]; - if (fgField) fgField->GetFieldValue(point, B); - else { - B[0] = B[1] = B[2] = 0.; - } - - Double_t tx = x[2]; - Double_t ty = x[3]; - Double_t tx2 = tx * tx; - Double_t ty2 = ty * ty; - Double_t txty = tx * ty; - Double_t tx2ty21 = 1.0 + tx2 + ty2; - if (tx2ty21 > 1.e4) return 1; - Double_t I_tx2ty21 = 1.0 / tx2ty21 * Qp(); - Double_t tx2ty2 = sqrt(tx2ty21); - // Double_t I_tx2ty2 = qp0 * hC / tx2ty2 ; unsused ??? - tx2ty2 *= hC; - Double_t tx2ty2qp = tx2ty2 * Qp(); - Ax[step] = (txty * B[0] + ty * B[2] - (1.0 + tx2) * B[1]) * tx2ty2; - Ay[step] = (-txty * B[1] - tx * B[2] + (1.0 + ty2) * B[0]) * tx2ty2; - - Ax_tx[step] = Ax[step] * tx * I_tx2ty21 + (ty * B[0] - 2.0 * tx * B[1]) * tx2ty2qp; - Ax_ty[step] = Ax[step] * ty * I_tx2ty21 + (tx * B[0] + B[2]) * tx2ty2qp; - Ay_tx[step] = Ay[step] * tx * I_tx2ty21 + (-ty * B[1] - B[2]) * tx2ty2qp; - Ay_ty[step] = Ay[step] * ty * I_tx2ty21 + (-tx * B[1] + 2.0 * ty * B[0]) * tx2ty2qp; - - step4 = step * 4; - k[step4] = tx * h; - k[step4 + 1] = ty * h; - k[step4 + 2] = Ax[step] * Qp(); - k[step4 + 3] = Ay[step] * Qp(); - - } // end of Runge-Kutta steps - - for (i = 0; i < 4; ++i) { - fT[i] = x0[i] + c[0] * k[i] + c[1] * k[4 + i] + c[2] * k[8 + i] + c[3] * k[12 + i]; - } - fT[5] = z_out; - // - // Derivatives dx/dqp - // - - x0[0] = 0.0; - x0[1] = 0.0; - x0[2] = 0.0; - x0[3] = 0.0; - - // - // Runge-Kutta step for derivatives dx/dqp - - for (step = 0; step < 4; ++step) { - for (i = 0; i < 4; ++i) { - if (step == 0) { x[i] = x0[i]; } - else { - x[i] = x0[i] + b[step] * k1[step * 4 - 4 + i]; - } - } - step4 = step * 4; - k1[step4] = x[2] * h; - k1[step4 + 1] = x[3] * h; - k1[step4 + 2] = Ax[step] + Ax_tx[step] * x[2] + Ax_ty[step] * x[3]; - k1[step4 + 3] = Ay[step] + Ay_tx[step] * x[2] + Ay_ty[step] * x[3]; - - } // end of Runge-Kutta steps for derivatives dx/dqp - - Double_t J[25]; - - for (i = 0; i < 4; ++i) { - J[20 + i] = x0[i] + c[0] * k1[i] + c[1] * k1[4 + i] + c[2] * k1[8 + i] + c[3] * k1[12 + i]; - } - J[24] = 1.; - // - // end of derivatives dx/dqp - // - - // Derivatives dx/tx - // - - x0[0] = 0.0; - x0[1] = 0.0; - x0[2] = 1.0; - x0[3] = 0.0; - - // - // Runge-Kutta step for derivatives dx/dtx - // - - for (step = 0; step < 4; ++step) { - for (i = 0; i < 4; ++i) { - if (step == 0) { x[i] = x0[i]; } - else if (i != 2) { - x[i] = x0[i] + b[step] * k1[step * 4 - 4 + i]; - } - } - step4 = step * 4; - k1[step4] = x[2] * h; - k1[step4 + 1] = x[3] * h; - // k1[step4+2] = Ax_tx[step] * x[2] + Ax_ty[step] * x[3]; - k1[step4 + 3] = Ay_tx[step] * x[2] + Ay_ty[step] * x[3]; - - } // end of Runge-Kutta steps for derivatives dx/dtx - - for (i = 0; i < 4; ++i) { - if (i != 2) { J[10 + i] = x0[i] + c[0] * k1[i] + c[1] * k1[4 + i] + c[2] * k1[8 + i] + c[3] * k1[12 + i]; } - } - // end of derivatives dx/dtx - J[12] = 1.0; - J[14] = 0.0; - - // Derivatives dx/ty - // - - x0[0] = 0.0; - x0[1] = 0.0; - x0[2] = 0.0; - x0[3] = 1.0; - - // - // Runge-Kutta step for derivatives dx/dty - // - - for (step = 0; step < 4; ++step) { - for (i = 0; i < 4; ++i) { - if (step == 0) { - x[i] = x0[i]; // ty fixed - } - else if (i != 3) { - x[i] = x0[i] + b[step] * k1[step * 4 - 4 + i]; - } - } - step4 = step * 4; - k1[step4] = x[2] * h; - k1[step4 + 1] = x[3] * h; - k1[step4 + 2] = Ax_tx[step] * x[2] + Ax_ty[step] * x[3]; - // k1[step4+3] = Ay_tx[step] * x[2] + Ay_ty[step] * x[3]; - - } // end of Runge-Kutta steps for derivatives dx/dty - - for (i = 0; i < 3; ++i) { - J[15 + i] = x0[i] + c[0] * k1[i] + c[1] * k1[4 + i] + c[2] * k1[8 + i] + c[3] * k1[12 + i]; - } - // end of derivatives dx/dty - J[18] = 1.; - J[19] = 0.; - - // - // derivatives dx/dx and dx/dy - - for (i = 0; i < 10; ++i) { - J[i] = 0.; - } - J[0] = 1.; - J[6] = 1.; - - // extrapolate inverse momentum - - fT[4] = qp_in; - - Double_t dqp = qp_in - Qp(); - - { - for (Int_t ip = 0; ip < 4; ip++) { - fT[ip] += J[5 * 4 + ip] * dqp; - } - } - - // covariance matrix transport - - multQtSQ(5, J); - return 0; -} - -Int_t CbmHelix::ExtrapolateALight(Double_t z_out) -{ - // - // Part of the analytic extrapolation formula with error (c_light*B*dz)^4/4! - // - { - bool ok = 1; - for (int i = 0; i < 6; i++) - ok = ok && !TMath::IsNaN(fT[i]) && (fT[i] < 1.e5); - /* for (int i = 0; i < 15; i++) - ok = ok && !TMath::IsNaN(fC[i]); - if (!ok) { - for (int i = 0; i < 15; i++) - fC[i] = 0; - fC[0] = fC[2] = fC[5] = fC[9] = fC[14] = 100.; - return 1; - } - */ - } - const Double_t c_light = 0.000299792458; - - //Double_t qp_in = fT[4]; - Double_t z_in = fT[5]; - Double_t dz = z_out - z_in; - - // construct coefficients - - Double_t x = fT[2], // tx !! - y = fT[3], // ty !! - - xx = x * x, xy = x * y, yy = y * y, x2 = x * 2, x4 = x * 4, xx31 = xx * 3 + 1, xx159 = xx * 15 + 9, y2 = y * 2; - - Double_t Ax = xy, Ay = -xx - 1, Az = y, Ayy = x * (xx * 3 + 3), Ayz = -2 * xy, Ayyy = -(15 * xx * xx + 18 * xx + 3), - - Ax_x = y, Ay_x = -x2, Az_x = 0, Ayy_x = 3 * xx31, Ayz_x = -y2, Ayyy_x = -x4 * xx159, - - Ax_y = x, Ay_y = 0, Az_y = 1, Ayy_y = 0, Ayz_y = -x2, Ayyy_y = 0, - - Bx = yy + 1, By = -xy, Bz = -x, Byy = y * xx31, Byz = 2 * xx + 1, Byyy = -xy * xx159, - - Bx_x = 0, By_x = -y, Bz_x = -1, Byy_x = 6 * xy, Byz_x = x4, Byyy_x = -y * (45 * xx + 9), - - Bx_y = y2, By_y = -x, Bz_y = 0, Byy_y = xx31, Byz_y = 0, Byyy_y = -x * xx159; - - // end of coefficients calculation - - Double_t t2 = 1. + xx + yy; - if (t2 > 1.e4) return 1; - Double_t t = sqrt(t2), h = Qp() * c_light, ht = h * t; - - Double_t sx = 0, sy = 0, sz = 0, syy = 0, syz = 0, syyy = 0, Sx = 0, Sy = 0, Sz = 0, Syy = 0, Syz = 0, Syyy = 0; - - { // get field integrals - - Double_t B[3][3]; - Double_t r0[3], r1[3], r2[3]; - - // first order track approximation - - r0[0] = fT[0]; - r0[1] = fT[1]; - r0[2] = fT[5]; - - r2[0] = fT[0] + fT[2] * dz; - r2[1] = fT[1] + fT[3] * dz; - r2[2] = z_out; - - r1[0] = 0.5 * (r0[0] + r2[0]); - r1[1] = 0.5 * (r0[1] + r2[1]); - r1[2] = 0.5 * (r0[2] + r2[2]); - - fgField->GetFieldValue(r0, B[0]); - fgField->GetFieldValue(r1, B[1]); - fgField->GetFieldValue(r2, B[2]); - - Sy = (7 * B[0][1] + 6 * B[1][1] - B[2][1]) * dz * dz / 96.; - r1[0] = fT[0] + x * dz / 2 + ht * Sy * Ay; - r1[1] = fT[1] + y * dz / 2 + ht * Sy * By; - - Sy = (B[0][1] + 2 * B[1][1]) * dz * dz / 6.; - r2[0] = fT[0] + x * dz + ht * Sy * Ay; - r2[1] = fT[1] + y * dz + ht * Sy * By; - - Sy = 0; - - // integrals - - fgField->GetFieldValue(r0, B[0]); - fgField->GetFieldValue(r1, B[1]); - fgField->GetFieldValue(r2, B[2]); - - sx = (B[0][0] + 4 * B[1][0] + B[2][0]) * dz / 6.; - sy = (B[0][1] + 4 * B[1][1] + B[2][1]) * dz / 6.; - sz = (B[0][2] + 4 * B[1][2] + B[2][2]) * dz / 6.; - - Sx = (B[0][0] + 2 * B[1][0]) * dz * dz / 6.; - Sy = (B[0][1] + 2 * B[1][1]) * dz * dz / 6.; - Sz = (B[0][2] + 2 * B[1][2]) * dz * dz / 6.; - - Double_t c2[3][3] = {{5, -4, -1}, {44, 80, -4}, {11, 44, 5}}; // /=360. - Double_t C2[3][3] = {{38, 8, -4}, {148, 208, -20}, {3, 36, 3}}; // /=2520. - for (Int_t n = 0; n < 3; n++) - for (Int_t m = 0; m < 3; m++) { - syz += c2[n][m] * B[n][1] * B[m][2]; - Syz += C2[n][m] * B[n][1] * B[m][2]; - } - - syz *= dz * dz / 360.; - Syz *= dz * dz * dz / 2520.; - - syy = (B[0][1] + 4 * B[1][1] + B[2][1]) * dz; - syyy = syy * syy * syy / 1296; - syy = syy * syy / 72; - - Syy = (B[0][1] * (38 * B[0][1] + 156 * B[1][1] - B[2][1]) + B[1][1] * (208 * B[1][1] + 16 * B[2][1]) - + B[2][1] * (3 * B[2][1])) - * dz * dz * dz / 2520.; - Syyy = (B[0][1] - * (B[0][1] * (85 * B[0][1] + 526 * B[1][1] - 7 * B[2][1]) + B[1][1] * (1376 * B[1][1] + 84 * B[2][1]) - + B[2][1] * (19 * B[2][1])) - + B[1][1] * (B[1][1] * (1376 * B[1][1] + 256 * B[2][1]) + B[2][1] * (62 * B[2][1])) - + B[2][1] * B[2][1] * (3 * B[2][1])) - * dz * dz * dz * dz / 90720.; - } - - Double_t - - sA1 = sx * Ax + sy * Ay + sz * Az, - sA1_x = sx * Ax_x + sy * Ay_x + sz * Az_x, sA1_y = sx * Ax_y + sy * Ay_y + sz * Az_y, - - sB1 = sx * Bx + sy * By + sz * Bz, sB1_x = sx * Bx_x + sy * By_x + sz * Bz_x, - sB1_y = sx * Bx_y + sy * By_y + sz * Bz_y, - - SA1 = Sx * Ax + Sy * Ay + Sz * Az, SA1_x = Sx * Ax_x + Sy * Ay_x + Sz * Az_x, - SA1_y = Sx * Ax_y + Sy * Ay_y + Sz * Az_y, - - SB1 = Sx * Bx + Sy * By + Sz * Bz, SB1_x = Sx * Bx_x + Sy * By_x + Sz * Bz_x, - SB1_y = Sx * Bx_y + Sy * By_y + Sz * Bz_y, - - sA2 = syy * Ayy + syz * Ayz, sA2_x = syy * Ayy_x + syz * Ayz_x, sA2_y = syy * Ayy_y + syz * Ayz_y, - sB2 = syy * Byy + syz * Byz, sB2_x = syy * Byy_x + syz * Byz_x, sB2_y = syy * Byy_y + syz * Byz_y, - - SA2 = Syy * Ayy + Syz * Ayz, SA2_x = Syy * Ayy_x + Syz * Ayz_x, SA2_y = Syy * Ayy_y + Syz * Ayz_y, - SB2 = Syy * Byy + Syz * Byz, SB2_x = Syy * Byy_x + Syz * Byz_x, SB2_y = Syy * Byy_y + Syz * Byz_y, - - sA3 = syyy * Ayyy, sA3_x = syyy * Ayyy_x, sA3_y = syyy * Ayyy_y, sB3 = syyy * Byyy, sB3_x = syyy * Byyy_x, - sB3_y = syyy * Byyy_y, - - SA3 = Syyy * Ayyy, SA3_x = Syyy * Ayyy_x, SA3_y = Syyy * Ayyy_y, SB3 = Syyy * Byyy, SB3_x = Syyy * Byyy_x, - SB3_y = Syyy * Byyy_y; -#ifdef SKIP_LOSSES - fT[0] = fT[0] + x * dz + ht * (SA1 + ht * (SA2 + ht * SA3)); - fT[1] = fT[1] + y * dz + ht * (SB1 + ht * (SB2 + ht * SB3)); - fT[2] = fT[2] + ht * (sA1 + ht * (sA2 + ht * sA3)); - fT[3] = fT[3] + ht * (sB1 + ht * (sB2 + ht * sB3)); - fT[5] = z_out; -#else - T_out[0] = fT[0] + x * dz + ht * (SA1 + ht * (SA2 + ht * SA3)); - T_out[1] = fT[1] + y * dz + ht * (SB1 + ht * (SB2 + ht * SB3)); - T_out[2] = fT[2] + ht * (sA1 + ht * (sA2 + ht * sA3)); - T_out[3] = fT[3] + ht * (sB1 + ht * (sB2 + ht * sB3)); - T_out[4] = fT[4]; - T_out[5] = z_out; -#endif - Double_t J[25]; - - // derivatives '_x - - J[0] = 1; - J[1] = 0; - J[2] = 0; - J[3] = 0; - J[4] = 0; - - // derivatives '_y - - J[5] = 0; - J[6] = 1; - J[7] = 0; - J[8] = 0; - J[9] = 0; - - // derivatives '_tx - - J[10] = dz + h * x * (1. / t * SA1 + h * (2 * SA2 + 3 * ht * SA3)) + ht * (SA1_x + ht * (SA2_x + ht * SA3_x)); - J[11] = h * x * (1. / t * SB1 + h * (2 * SB2 + 3 * ht * SB3)) + ht * (SB1_x + ht * (SB2_x + ht * SB3_x)); - J[12] = 1 + h * x * (1. / t * sA1 + h * (2 * sA2 + 3 * ht * sA3)) + ht * (sA1_x + ht * (sA2_x + ht * sA3_x)); - J[13] = h * x * (1. / t * sB1 + h * (2 * sB2 + 3 * ht * sB3)) + ht * (sB1_x + ht * (sB2_x + ht * sB3_x)); - J[14] = 0; - - // derivatives '_ty - - J[15] = h * y * (1. / t * SA1 + h * (2 * SA2 + 3 * ht * SA3)) + ht * (SA1_y + ht * (SA2_y + ht * SA3_y)); - J[16] = dz + h * y * (1. / t * SB1 + h * (2 * SB2 + 3 * ht * SB3)) + ht * (SB1_y + ht * (SB2_y + ht * SB3_y)); - J[17] = h * y * (1. / t * sA1 + h * (2 * sA2 + 3 * ht * sA3)) + ht * (sA1_y + ht * (sA2_y + ht * sA3_y)); - J[18] = 1 + h * y * (1. / t * sB1 + h * (2 * sB2 + 3 * ht * sB3)) + ht * (sB1_y + ht * (sB2_y + ht * sB3_y)); - J[19] = 0; - - // derivatives '_qp - - J[20] = c_light * t * (SA1 + ht * (2 * SA2 + 3 * ht * SA3)); - J[21] = c_light * t * (SB1 + ht * (2 * SB2 + 3 * ht * SB3)); - J[22] = c_light * t * (sA1 + ht * (2 * sA2 + 3 * ht * sA3)); - J[23] = c_light * t * (sB1 + ht * (2 * sB2 + 3 * ht * sB3)); - J[24] = 1; - - // extrapolate inverse momentum -#ifdef SKIP_LOSSES -#else - T_out[4] = qp_in; - - Double_t dqp = qp_in - Qp(); - - - for (Int_t i = 0; i < 4; i++) { - fT[i] = T_out[i] + J[5 * 4 + i] * dqp; - } - fT[4] = T_out[4]; - fT[5] = T_out[5]; -#endif - // covariance matrix transport - - multQtSQ(5, J); - return 0; -} - -void CbmHelix::multQtSQ(const Int_t /*N*/, Double_t /*Q*/[]) -{ - /*Double_t A[N * N]; - - for( Int_t i=0, n=0; i<N; i++ ){ - for( Int_t j=0; j<N; j++, ++n ){ - A[n] = 0 ; - for( Int_t k=0; k<N; ++k ) A[n]+= fC[indexS(i,k)] * Q[ k*N+j]; - } - } - - for( Int_t i=0; i<N; i++ ){ - for( Int_t j=0; j<=i; j++ ){ - Int_t n = indexS(i,j); - fC[n] = 0 ; - for( Int_t k=0; k<N; k++ ) fC[n] += Q[ k*N+i ] * A[ k*N+j ]; - } - }*/ -} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmNicaCompression.h b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmNicaCompression.h deleted file mode 100644 index 0aa2f309affaa2636b1311854d3645f3de1458e8..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CbmNicaCompression.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * CbmNicaCompression.h - * - * Created on: 7 lut 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef CBMNICACOMPRESSION_H_ -#define CBMNICACOMPRESSION_H_ - -#include "FairTask.h" - -#include "TClonesArray.h" - -#include "NicaArray.h" -#include "NicaTrackClones.h" - -class CbmNicaCompression : public FairTask { - NicaTrackClones* fStsMatches; - NicaTrackClones* fTofMatches; - NicaTrackClones* fMCTracks; - TClonesArray* fStsLinks; - TClonesArray* fTofLinks; - NicaArray_1<Int_t> fMapUse; - NicaArray_1<Int_t> fMapIndex; - Bool_t fAllDep; - void NoDep(); - void WithDep(); - -public: - CbmNicaCompression(); - InitStatus Init(); - void AllDependencies() { fAllDep = kTRUE; }; - void Exec(Option_t* opt); - virtual ~CbmNicaCompression(); - ClassDef(CbmNicaCompression, 1) -}; - -#endif /* CBMNICACOMPRESSION_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/NicaCbmFirstTask.cxx b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/NicaCbmFirstTask.cxx deleted file mode 100644 index 6e6486a7ce9fa044604334cd93af4deb2d006e22..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/NicaCbmFirstTask.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2019-2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmFirstTask.cxx - * - * Created on: 3 wrz 2019 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#include "NicaCbmFirstTask.h" - -#include "FairRunAna.h" - -NicaCbmFirstTask::NicaCbmFirstTask() : fMagField(nullptr) {} - -InitStatus NicaCbmFirstTask::Init() -{ - if (fMagField != nullptr) { - CbmHelix::SetField(fMagField); - std::cout << "SET FIELD " << fMagField << std::endl; - } - else { - CbmHelix::SetField(FairRunAna::Instance()->GetField()); - } - return kSUCCESS; -} - -NicaCbmFirstTask::~NicaCbmFirstTask() {} diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/NicaCbmFirstTask.h b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/NicaCbmFirstTask.h deleted file mode 100644 index 550e50b87aeb10821e405d63145774ecaec03242..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/NicaCbmFirstTask.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2019-2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaCbmFirstTask.h - * - * Created on: 3 wrz 2019 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#ifndef NICACBMFIRSTTASK_H_ -#define NICACBMFIRSTTASK_H_ -#include "CbmHelix.h" - -#include "FairField.h" -#include "FairTask.h" - -class NicaCbmFirstTask : public FairTask { - FairField* fMagField; - -public: - NicaCbmFirstTask(); - void SetMagField(FairField* f) { fMagField = f; }; - InitStatus Init(); - void Exec(Option_t* /*opt*/) {}; - virtual ~NicaCbmFirstTask(); - ClassDef(NicaCbmFirstTask, 1) -}; - -#endif /* CBM_ANALYSIS_NICA_CBM_HELPERS_NICACBMFIRSTTASK_H_ */ diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/NicaCbmHelpersLinkDef.h b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/NicaCbmHelpersLinkDef.h deleted file mode 100644 index f541c829c12dd02ba62e5a6c5b32c9b5bc350262..0000000000000000000000000000000000000000 --- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/NicaCbmHelpersLinkDef.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (C) 2018-2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * NicaBmnFormatLinkDef.h - * - * Created on: 19 wrz 2018 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; - -#pragma link C++ namespace NicaCbmDetectorID; -#pragma link C++ class NicaCbmFirstTask + ; -#pragma link C++ class CbmHelix + ; -#pragma link C++ enum NicaCbmSetup; -//#pragma link C++ class CbmNicaCompression + ; diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 15a503423d647a1cd0aa109c27d39f9d3d69ec77..58ca0dcfbf411543f75c4ca186eddb105c51a6a7 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -72,7 +72,7 @@ if(DOWNLOAD_EXTERNALS) if (NOT CBM_ONLINE_STANDALONE) # Not required for online standalone Include(InstallKFParticle.cmake) - Include(InstallNicaFemto.cmake) + Include(InstallHal.cmake) Include(InstallAnalysisTree.cmake) Include(InstallAnalysisTreeQA.cmake) @@ -92,7 +92,7 @@ else() # whithout the external packages add_library(ANALYSISTREE SHARED IMPORTED GLOBAL) add_library(ANALYSISTREEQA SHARED IMPORTED GLOBAL) - add_library(NICAFEMTO SHARED IMPORTED GLOBAL) + add_library(HAL SHARED IMPORTED GLOBAL) add_library(KFPARTICLE SHARED IMPORTED GLOBAL) add_library(external::yaml-cpp STATIC IMPORTED GLOBAL) set_target_properties(external::yaml-cpp PROPERTIES diff --git a/external/InstallHal.cmake b/external/InstallHal.cmake new file mode 100644 index 0000000000000000000000000000000000000000..81aba3e597d2f2f4a9342c44b3817fa95ba822f7 --- /dev/null +++ b/external/InstallHal.cmake @@ -0,0 +1,109 @@ +set(HAL_VERSION 9da3fa0b6511765b83409a1804753e4b46ab81a7) + +set(HAL_SRC_URL "https://github.com/DanielWielanek/HAL.git") +set(HAL_DESTDIR "${CMAKE_BINARY_DIR}/external/HAL-prefix") + + +list(APPEND HAL_LIB_LIST "HalAna" "HalCut" "HalData" "HalFeatures" "HalFemto") +list(APPEND HAL_LIB_LIST "HalFlow" "HalFluct" "HalSpectra" "HalFair" "HalQA") + +download_project_if_needed(PROJECT Hal_source + GIT_REPOSITORY ${HAL_SRC_URL} + GIT_TAG ${HAL_VERSION} + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Hal + # PATCH_COMMAND "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/Hal.patch" + ) + +If(ProjectUpdated) + File(REMOVE_RECURSE ${HAL_DESTDIR}) + Message("Hal source directory was changed so build directory was deleted") +EndIf() + +If(USE_DIFFERENT_COMPILER) + Set(EXTRA_ARGS "-DUSE_DIFFERENT_COMPILER=TRUE") +Else() + Set(EXTRA_ARGS "") +EndIf() +execute_process(COMMAND gsl-config --prefix OUTPUT_VARIABLE GSLPATH OUTPUT_STRIP_TRAILING_WHITESPACE) +message(WARNING "GSL PATH ${GSLPATH}") + +ExternalProject_Add(HAL + BUILD_IN_SOURCE 0 + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Hal + BUILD_BYPRODUCTS ${HAL_LIBRARY} + LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 + CMAKE_ARGS -G ${CMAKE_GENERATOR} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} + -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + -DROOTSYS=${SIMPATH} + -DGSL_DIR=${GSLPATH} + -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON + -DCMAKE_BUILD_TYPE=RelWithDebInfo + "${EXTRA_ARGS}" + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install +) + + +foreach(HAL_LIB_LOCAL ${HAL_LIB_LIST}) + add_library(${HAL_LIB_LOCAL} SHARED IMPORTED GLOBAL) + set_target_properties(${HAL_LIB_LOCAL} PROPERTIES + IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${HAL_LIB_LOCAL}${CMAKE_SHARED_LIBRARY_SUFFIX} + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include) + add_dependencies(${HAL_LIB_LOCAL} HAL) +endforeach() + + + +#set(Hal_LIBRARIES HalFeatures PARENT_SCOPE) +#set(Hal_LIB_DIR ${CMAKE_BINARY_DIR}/lib PARENT_SCOPE) +set(Hal_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include" PARENT_SCOPE) +set(Hal_FOUND TRUE PARENT_SCOPE) + + +foreach(LIB_NAME ${HAL_LIB_LIST}) + if(APPLE) + Install( FILES + "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}.0${CMAKE_SHARED_LIBRARY_SUFFIX}" + "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}.1${CMAKE_SHARED_LIBRARY_SUFFIX}" + "${CMAKE_BINARY_DIR}/lib/G__${LIB_NAME}Dict_rdict.pcm" + "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}.rootmap" + DESTINATION lib) + else() + Install( FILES + "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.0" + "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.1" + "${CMAKE_BINARY_DIR}/lib/G__${LIB_NAME}Dict_rdict.pcm" + "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}.rootmap" + DESTINATION lib) + endif() +endforeach(LIB_NAME) + +## addditional stuff +Install(FILES ${CMAKE_BINARY_DIR}/bin/hal-report + ${CMAKE_BINARY_DIR}/bin/hal-merger + ${CMAKE_BINARY_DIR}/bin/hal-jobs + ${CMAKE_BINARY_DIR}/bin/hal-corrfit + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ + DESTINATION bin +) + +Install(DIRECTORY + ${CMAKE_CURRENT_SOURCE_DIR}/Hal/features/hal_plus + DESTINATION share +) +Install(DIRECTORY + ${CMAKE_BINARY_DIR}/include/Hal + DESTINATION include +) + + + + diff --git a/external/InstallNicaFemto.cmake b/external/InstallNicaFemto.cmake deleted file mode 100644 index decdc309f6a8d42b4bd47fc167f61376bf8034ab..0000000000000000000000000000000000000000 --- a/external/InstallNicaFemto.cmake +++ /dev/null @@ -1,128 +0,0 @@ -set(NICAFEMTO_VERSION 73178f31c1b8811fda19e77c89ca3b5944f3d4b8) - -set(NICAFEMTO_SRC_URL "https://git.cbm.gsi.de/f.uhlig/nicafemto.git") -set(NICAFEMTO_DESTDIR "${CMAKE_BINARY_DIR}/external/NICAFEMTO-prefix") -set(JSROOT_SRC_URL "https://github.com/root-project/jsroot.git") -set(JSROOT_VERSION "5.7.1") - - -list(APPEND NICA_LIB_LIST "NicaAna" "NicaCut" "NicaDataFormat" "NicaFeatures" "NicaFemto") -list(APPEND NICA_LIB_LIST "NicaFlow" "NicaFluct" "NicaGen" "NicaSpectra") - -download_project_if_needed(PROJECT NicaFemto_source - GIT_REPOSITORY ${NICAFEMTO_SRC_URL} - GIT_TAG ${NICAFEMTO_VERSION} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NicaFemto - ) - -If(ProjectUpdated) - File(REMOVE_RECURSE ${NICAFEMTO_DESTDIR}) - Message("NicaFemto source directory was changed so build directory was deleted") -EndIf() - -If(USE_DIFFERENT_COMPILER) - Set(EXTRA_ARGS "-DUSE_DIFFERENT_COMPILER=TRUE") -Else() - Set(EXTRA_ARGS "") -EndIf() - -ExternalProject_Add(NICAFEMTO - BUILD_IN_SOURCE 0 - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NicaFemto - BUILD_BYPRODUCTS ${NICAFEMTO_LIBRARY} - LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env SIMPATH=${SIMPATH} FAIRROOTPATH=${FAIRROOTPATH} - ${CMAKE_COMMAND} - -G ${CMAKE_GENERATOR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} - -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/cmake/modules - -DJSROOT=${CMAKE_CURRENT_SOURCE_DIR} - -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON - "${EXTRA_ARGS}" - ${CMAKE_CURRENT_SOURCE_DIR}/NicaFemto - INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install -) - -add_library(NicaFeatures SHARED IMPORTED GLOBAL) -set_target_properties(NicaFeatures PROPERTIES - IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}NicaFeatures${CMAKE_SHARED_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include - ) -add_dependencies(NicaFeatures NICAFEMTO) - - -add_library(NicaDataFormat SHARED IMPORTED GLOBAL) -set_target_properties(NicaDataFormat PROPERTIES - IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}NicaDataFormat${CMAKE_SHARED_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include - ) -add_dependencies(NicaDataFormat NICAFEMTO) - - -add_library(NicaGen SHARED IMPORTED GLOBAL) -set_target_properties(NicaGen PROPERTIES - IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}NicaGen${CMAKE_SHARED_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include - ) -add_dependencies(NicaGen NICAFEMTO) - - -add_library(NicaCut SHARED IMPORTED GLOBAL) -set_target_properties(NicaCut PROPERTIES - IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}NicaCut${CMAKE_SHARED_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include - ) -add_dependencies(NicaCut NICAFEMTO) - - -add_library(NicaAna SHARED IMPORTED GLOBAL) -set_target_properties(NicaAna PROPERTIES - IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}NicaAna${CMAKE_SHARED_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include - ) -add_dependencies(NicaAna NICAFEMTO) - - -foreach(LIB_NAME ${NICA_LIB_LIST}) - if(APPLE) - Install( FILES - "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}.0${CMAKE_SHARED_LIBRARY_SUFFIX}" - "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}.1${CMAKE_SHARED_LIBRARY_SUFFIX}" - "${CMAKE_BINARY_DIR}/lib/G__${LIB_NAME}Dict_rdict.pcm" - "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}.rootmap" - DESTINATION lib) - else() - Install( FILES - "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.0" - "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.1" - "${CMAKE_BINARY_DIR}/lib/G__${LIB_NAME}Dict_rdict.pcm" - "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}.rootmap" - DESTINATION lib) - endif() -endforeach(LIB_NAME) - -## addditional stuff -Install(FILES ${CMAKE_BINARY_DIR}/bin/nica-report - ${CMAKE_BINARY_DIR}/bin/nica-merger - DESTINATION bin -) - -Install(DIRECTORY - ${CMAKE_CURRENT_SOURCE_DIR}/jsroot - ${CMAKE_CURRENT_SOURCE_DIR}/NicaFemto/features/nicafemto_plus - DESTINATION share -) - - - - - diff --git a/external/NicaFemto.patch b/external/NicaFemto.patch deleted file mode 100644 index 939c2130c54ab9aced4ea8afefb6e607046e0e8a..0000000000000000000000000000000000000000 --- a/external/NicaFemto.patch +++ /dev/null @@ -1,148 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 60ab7e6..4df2021 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -27,11 +27,11 @@ if(NOT DEFINED NICAFEMTO_SUBDIR_BUILD) - set(CMAKE_MODULE_PATH "$ENV{FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH}) - set(CMAKE_MODULE_PATH "$ENV{FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH}) - set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH}) -- IF(FAIRROOTPATH) -- Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks") -- ELSE(FAIRROOTPATH) -- Set(CheckSrcDir "${CMAKE_SOURCE_DIR}/cmake/checks") -- ENDIF(FAIRROOTPATH) -+# IF(FAIRROOTPATH) -+# Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks") -+# ELSE(FAIRROOTPATH) -+# Set(CheckSrcDir "${CMAKE_SOURCE_DIR}/cmake/checks") -+# ENDIF(FAIRROOTPATH) - - if(FAIRROOTPATH) - find_package(FairRoot) -@@ -41,7 +41,7 @@ if(NOT DEFINED NICAFEMTO_SUBDIR_BUILD) - EndIf(CMAKE_INSTALL_PREFIX) - endif(FAIRROOTPATH) - -- include(CheckCXX11Features) -+# include(CheckCXX11Features) - - - include(FairMacros) -@@ -49,10 +49,14 @@ if(NOT DEFINED NICAFEMTO_SUBDIR_BUILD) - include(CheckCompiler) - include(WriteConfig) - -- If(NOT _HAS_CXX11_FLAG) -- Message(FATAL_ERROR "The used C++ compiler (${CMAKE_CXX_COMPILER}) does not support C++11. NicaFemto can only be compiled with compilers supporting C++11. Please install such an compiler.") -- EndIf() -- -+# If(NOT _HAS_CXX11_FLAG) -+# Message(FATAL_ERROR "The used C++ compiler (${CMAKE_CXX_COMPILER}) does not support C++11. NicaFemto can only be compiled with compilers supporting C++11. Please install such an compiler.") -+# EndIf() -+ -+ if(APPLE) -+ SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -single_module -undefined dynamic_lookup") -+ endif() -+ - Execute_process(COMMAND $ENV{SIMPATH}/bin/fairsoft-config --cxxflags OUTPUT_VARIABLE _res_fairsoft_config OUTPUT_STRIP_TRAILING_WHITESPACE) - String(FIND ${_res_fairsoft_config} "-std=c++11" POS_C++11) - If(${POS_C++11} EQUAL -1) -@@ -94,16 +98,24 @@ if(NOT DEFINED NICAFEMTO_SUBDIR_BUILD) - - find_package(ROOT 6.00.00 REQUIRED) - if("${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}" VERSION_GREATER 6.16) -- Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --has-vmc -- OUTPUT_VARIABLE ROOT_vmc_FOUND -- ) -- String(STRIP ${ROOT_vmc_FOUND} ROOT_vmc_FOUND) -- If(NOT ROOT_vmc_FOUND) -+ if("${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}" VERSION_LESS 6.26) -+ Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --has-vmc -+ OUTPUT_VARIABLE ROOT_vmc_FOUND -+ ) -+ -+ String(STRIP ${ROOT_vmc_FOUND} ROOT_vmc_FOUND) -+ If(NOT ROOT_vmc_FOUND) -+ set(CMAKE_PREFIX_PATH $ENV{SIMPATH} ${CMAKE_PREFIX_PATH}) -+ find_package2(PUBLIC VMC REQUIRED) -+ set(VMCLIB VMCLibrary) -+ endif() -+ else() - set(CMAKE_PREFIX_PATH $ENV{SIMPATH} ${CMAKE_PREFIX_PATH}) - find_package2(PUBLIC VMC REQUIRED) - set(VMCLIB VMCLibrary) - endif() - endif() -+ - Set(SIMPATH $ENV{SIMPATH}) - Set(Boost_NO_SYSTEM_PATHS TRUE) - Set(Boost_NO_BOOST_CMAKE TRUE) -@@ -129,9 +141,13 @@ if(NOT DEFINED NICAFEMTO_SUBDIR_BUILD) - find_package(GSL) - if(NOT GSL_FOUND) - if(APPLE) -- set(GSL_DIR /usr/local) -+ execute_process(COMMAND brew --prefix -+ OUTPUT_VARIABLE _brew_install_dir -+ OUTPUT_STRIP_TRAILING_WHITESPACE -+ ) -+ set(GSL_DIR "${_brew_install_dir}") - else() -- unset(GSL_DIR) -+ set(GSL_DIR /usr) - endif() - find_package(GSL REQUIRED) - endif() -diff --git a/cuts/CMakeLists.txt b/cuts/CMakeLists.txt -index 1d1c4f0..e5676ba 100755 ---- a/cuts/CMakeLists.txt -+++ b/cuts/CMakeLists.txt -@@ -114,7 +114,7 @@ cutmonitors/NicaPropertyMonitorXYZ.cxx - Set(HEADERS ) - Set(LINKDEF NicaCutLinkDef.h) - Set(LIBRARY_NAME NicaCut) --Set(DEPENDENCIES NicaFeatures) -+Set(DEPENDENCIES NicaFeatures NicaDataFormat Base) - - GENERATE_LIBRARY() - -diff --git a/dataformat/CMakeLists.txt b/dataformat/CMakeLists.txt -index b8576ab..b3fc335 100644 ---- a/dataformat/CMakeLists.txt -+++ b/dataformat/CMakeLists.txt -@@ -57,7 +57,7 @@ hiddeninfo/NicaV0Track.cxx - Set(HEADERS ) - Set(LINKDEF NicaDataFormatLinkDef.h) - Set(LIBRARY_NAME NicaDataFormat) --Set(DEPENDENCIES NicaFeatures ${NICAFORMATLIBS}) -+Set(DEPENDENCIES NicaFeatures ${NICAFORMATLIBS} Base EG) - - GENERATE_LIBRARY() - -diff --git a/dataformat/NicaDataFormatManager.h b/dataformat/NicaDataFormatManager.h -index 4ecb407..a739199 100644 ---- a/dataformat/NicaDataFormatManager.h -+++ b/dataformat/NicaDataFormatManager.h -@@ -13,9 +13,9 @@ - #include <TObject.h> - - #include "NicaStd.h" -+#include "NicaTrack.h" - - class NicaEvent; --class NicaTrack; - - /** - * manager of formats -diff --git a/features/NicaHelixBase.cxx b/features/NicaHelixBase.cxx -index e248f54..7317950 100644 ---- a/features/NicaHelixBase.cxx -+++ b/features/NicaHelixBase.cxx -@@ -8,6 +8,7 @@ - */ - #include "NicaHelixBase.h" - #include <TMath.h> -+#include <TString.h> - #include <iostream> - - Double_t NicaHelixBase::fgHelixBz = 0.5; diff --git a/macro/analysis/cbmfemto/hbt_anatree.C b/macro/analysis/cbmfemto/hbt_anatree.C index 5818798a4eb1e36228d71757ae47b4db9326282e..119125e0f44c1452bf12446c46c75c19ab12cb80 100644 --- a/macro/analysis/cbmfemto/hbt_anatree.C +++ b/macro/analysis/cbmfemto/hbt_anatree.C @@ -1,82 +1,40 @@ -/* Copyright (C) 2020-2021 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ - -/* - * hbt_anatree.C - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ /** * example macro for pi-pi analysis */ #ifndef __CLING__ #include "CbmAnaTreeSource.h" -#include "CbmBasicFemtoPairCut.h" -#include "CbmBasicTrackCuts.h" -#include "CbmDeltaPhiDeltaThetaCut.h" -#include "CbmDetectorID.h" #include "CbmFieldMap.h" -#include "CbmHasTofTrackCut.h" -#include "CbmHbtFullEvent.h" -#include "CbmStsExitSepCut.h" -#include "CbmStsTrackHitsCut.h" -#include "CbmTofTrackCuts.h" -#include "data/CbmDefs.h" - #include "FairFileSource.h" #include "FairParRootFileIo.h" +#include "FemtoBasicAna.h" +#include "HalCbmAnalysisManager.h" +#include "HalCbmTaskManager.h" +#include "TFile.h" +#include "data/CbmDefs.h" + #include <FairLogger.h> +#include <FairRun.h> #include <FairRunAna.h> -#include "TFile.h" #include <RtypesCore.h> #include <TStopwatch.h> #include <TString.h> #include <TTimer.h> +#include <cstdio> #include <iostream> -#include "NicaCbmFirstTask.h" -#include "NicaCbmFullEvent.h" -#include "NicaCbmGlobalMCEvent.h" -#include "NicaCbmMCEvent.h" -#include "NicaCut.h" -#include "NicaCutMonitorX.h" -#include "NicaCutMonitorXY.h" -#include "NicaCutMonitorXYZ.h" -#include "NicaEventComplexCut.h" -#include "NicaEventImpactParameterCut.h" -#include "NicaEventPhiCut.h" -#include "NicaEventVertexCut.h" -#include "NicaEventVirtualCut.h" -#include "NicaFemto1DCF.h" -#include "NicaFemtoBasicAna.h" -#include "NicaFemtoCorrFuncKt.h" -#include "NicaFemtoPairKinematics.h" -#include "NicaFemtoSourceModelGausMt.h" -#include "NicaFemtoWeightGenerator.h" -#include "NicaFemtoWeightGeneratorSupressed.h" -#include "NicaPdgBinPairCut.h" -#include "NicaStd.h" -#include "NicaTrackAna.h" -#include "NicaTrackBasicMCCut.h" -#include "NicaTrackBoostedMomentaCuts.h" -#include "NicaTrackChargeCut.h" -#include "NicaTrackDCACut.h" -#include "NicaTrackDeltaMomCut.h" -#include "NicaTrackEtaCut.h" -#include "NicaTrackOnlyPrimariesCut.h" -#include "NicaTrackPCut.h" -#include "NicaTrackPdgCut.h" -#include "NicaTrackPtCut.h" -#include "NicaTrackPzCut.h" -#include "NicaTwoTrackFemtoQinvCut.h" +#include <Hal/AnalysisManager.h> +#include <Hal/Source.h> +#include <Hal/TaskManager.h> + + using namespace std; #endif +#include "hbt_common.C" /** * macro for calcution of final CF @@ -84,53 +42,12 @@ using namespace std; #define KRONOS -void SetEventCut(NicaEventAna* task) -{ - NicaEventVertexCut vtx; - task->AddCut(vtx, "im"); - NicaCutMonitorXY vtxM(vtx.CutName("im"), vtx.Z(), vtx.CutName("im"), vtx.Rt()); - vtxM.SetXaxis(100, 0, 1); - vtxM.SetYaxis(200, 0, 2); - task->AddCutMonitor(vtxM); - NicaEventImpactParameterCut b; - NicaEventPhiCut phi; - NicaCutMonitorX phiM(phi.CutName("im"), 0); - phiM.SetXaxis(100, -TMath::TwoPi(), TMath::TwoPi()); - NicaCutMonitorX bM(b.CutName("im"), 0); - bM.SetXaxis(100, 0, 15); - task->AddCut(b, "im"); - task->AddCut(phi, "im"); - task->AddCutMonitor(phiM); - task->AddCutMonitor(bM); -} -void SetTrackCuts(NicaEventAna* task, Bool_t mc = kTRUE) -{ - CbmBasicTrackCuts basic; - basic.SetCharge(-1); - basic.SetM2(-0.1, 0.1); - basic.SetPt(0.1, 10); - basic.SetOptionForAllCuts("re"); - basic.CreateBasicMonitors(); // must be called after SetOptionForAllCuts - task->AddCutsAndMonitors(basic); - NicaTrackPdgCut pid; - pid.SetMinAndMax(-211); - if (mc) { task->AddCut(pid, "im"); } -} - -void SetPairCuts(NicaTwoTrackAna* task) -{ - CbmBasicFemtoPairCut combinedCut; - combinedCut.SetR(25); - combinedCut.SetDeltaPhiStarCut(-0.01, 0.01); - combinedCut.SetDeltaEtaStarCut(-0.01, 0.01); - combinedCut.SetDeltaEtaStarAxis(100, -0.1, 0.1); - combinedCut.SetDeltaPhiStarAxis(100, -0.1, 0.1); - combinedCut.SetOptionForAllCuts("re"); - combinedCut.CreateBasicMonitors(); - task->AddCutsAndMonitors(combinedCut); -} +/** + * analysis macro done via FairRoot + * @param task + */ -void hbt_anatree(TString inFile = "/media/daniel/WD/anatree/1.analysistree.root", TString outFile = "test2.root") +void hbt_anatree(TString inFile = "3000.analysistree.root", TString outFile = "test1.root") { FairRunAna* ana = new FairRunAna(); // inFile = "/home/daniel/temp/00001.mini.root"; @@ -143,31 +60,12 @@ void hbt_anatree(TString inFile = "/media/daniel/WD/anatree/1.analysistree.root" log->SetColoredLog(kTRUE); log->SetLogVerbosityLevel("high"); - NicaFemtoBasicAna* task = new NicaFemtoBasicAna(); - task->SetCorrFctn(NicaFemtoCorrFuncKt(NicaFemto1DCF("cf", 100, 0, 1, ENicaFemtoKinematics::kLCMS), {0, 10})); - task->SetOption(NicaTwoTrackAna::BackgroundOptionMixed()); - task->SetWeight(NicaFemtoWeightGenerator()); - task->SetPdg(211); - task->SetMixSize(5); -#ifdef SPEEDUP - /** - * speed up analysis by using compression and special HBT format - * the sts exit distance and phi* are calculated once per track - */ - task->SetFormat(new NicaCbmFullEvent(), ENicaFormatDepth::kNonBuffered); - task->SetFormat(new CbmHbtFullEvent(), ENicaFormatDepth::kBuffered); - task->SetFormatOption(NicaEventAna::EFormatOption::kCompress); -#else - task->SetFormat(new NicaCbmFullEvent()); -#endif - SetEventCut(task); - SetTrackCuts(task); - SetPairCuts(task); - NicaCbmFirstTask* first_task = new NicaCbmFirstTask(); - CbmFieldMap* field = new CbmFieldMap("field_v18a.root"); - first_task->SetMagField(field); - ana->AddTask(first_task); - ana->AddTask(task); + Hal::FemtoBasicAna* task = MakeAna(kTRUE); + + auto* fairtask = new HalCbmTaskManager(); + fairtask->AddTask(task); + + ana->AddTask(fairtask); TStopwatch timer; timer.Start(); diff --git a/macro/analysis/cbmfemto/hbt_anatree2.C b/macro/analysis/cbmfemto/hbt_anatree2.C new file mode 100644 index 0000000000000000000000000000000000000000..f81b528f393a888e9f9d07f6f90eeff025690471 --- /dev/null +++ b/macro/analysis/cbmfemto/hbt_anatree2.C @@ -0,0 +1,61 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ + +#ifndef __CLING__ +#include "CbmAnaTreeSource.h" +#include "CbmFieldMap.h" +#include "FairFileSource.h" +#include "FairParRootFileIo.h" +#include "FemtoBasicAna.h" +#include "HalCbmAnalysisManager.h" +#include "HalCbmSource.h" +#include "TFile.h" +#include "data/CbmDefs.h" + +#include <FairLogger.h> +#include <FairRun.h> +#include <FairRunAna.h> + +#include <RtypesCore.h> +#include <TStopwatch.h> +#include <TString.h> +#include <TTimer.h> + +#include <cstdio> +#include <iostream> + +#include <Hal/AnalysisManager.h> +#include <Hal/Source.h> +#include <Hal/TaskManager.h> + + +using namespace std; +#endif +#include "hbt_common.C" + +#define KRONOS + +/** + * analysis macro done via FairRoot + * @param task + */ + +void hbt_anatree2(TString inFile = "3000.analysistree.root", TString outFile = "test2.root") +{ + HalCbmAnalysisManager* manager = new HalCbmAnalysisManager(); + manager->SetSource(new HalCbmSource(inFile)); + manager->SetOutput(outFile); + + Hal::FemtoBasicAna* task = MakeAna(kTRUE); + + manager->AddTask(task); + + TStopwatch timer; + timer.Start(); + + manager->Init(); + manager->Run(0, 1000); + Double_t rtime = timer.RealTime(), ctime = timer.CpuTime(); + printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime); +} diff --git a/macro/analysis/cbmfemto/hbt_common.C b/macro/analysis/cbmfemto/hbt_common.C new file mode 100644 index 0000000000000000000000000000000000000000..8b1dfd39727790e8ffb5daa421ee7cf4d71f3950 --- /dev/null +++ b/macro/analysis/cbmfemto/hbt_common.C @@ -0,0 +1,109 @@ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ + +#ifndef __CLING__ +#include "EventAna.h" +#include "EventImpactParameterCut.h" +#include "EventPhiCut.h" +#include "EventVertexCut.h" +#include "Femto1DCF.h" +#include "FemtoBasicAna.h" +#include "FemtoConst.h" +#include "FemtoCorrFuncKt.h" +#include "FemtoWeightGenerator.h" +#include "HalCbmBasicFemtoPairCut.h" +#include "HalCbmBasicTrackCuts.h" +#include "HalCbmFullEvent.h" +#include "HalCbmHbtFullEvent.h" +#include "TrackPdgCut.h" +#include "TwoTrackAna.h" + +#include <RtypesCore.h> +#include <TMath.h> +#include <TString.h> + +#include <Hal/CutMonitorX.h> +#include <Hal/CutMonitorXY.h> +#include <Hal/CutsAndMonitors.h> +#include <Hal/Std.h> + +using namespace std; +#endif + + +void SetEventCut(Hal::EventAna* task) +{ + Hal::EventVertexCut vtx; + task->AddCut(vtx, "im"); + Hal::CutMonitorXY vtxM(vtx.CutName("im"), vtx.Z(), vtx.CutName("im"), vtx.Rt()); + vtxM.SetXaxis(100, 0, 1); + vtxM.SetYaxis(200, 0, 2); + task->AddCutMonitor(vtxM); + Hal::EventImpactParameterCut b; + Hal::EventPhiCut phi; + Hal::CutMonitorX phiM(phi.CutName("im"), 0); + phiM.SetXaxis(100, -TMath::TwoPi(), TMath::TwoPi()); + Hal::CutMonitorX bM(b.CutName("im"), 0); + bM.SetXaxis(100, 0, 15); + task->AddCut(b, "im"); + task->AddCut(phi, "im"); + task->AddCutMonitor(phiM); + task->AddCutMonitor(bM); +} + +void SetTrackCuts(Hal::EventAna* task, Bool_t mc = kTRUE) +{ + HalCbmBasicTrackCuts basic; + basic.SetCharge(-1); + basic.SetM2(-0.1, 0.1); + basic.SetPt(0.1, 10); + basic.SetOptionForAllCuts("re"); + basic.MakeCutMonitors(); // must be called after SetOptionForAllCuts + task->AddCutsAndMonitors(basic); + Hal::TrackPdgCut pid; + pid.SetMinAndMax(-211); + if (mc) { + task->AddCut(pid, "im"); + } +} + +void SetPairCuts(Hal::TwoTrackAna* task) +{ + HalCbmBasicFemtoPairCut combinedCut; + combinedCut.SetR(25); + combinedCut.SetDeltaPhiStarCut(-0.01, 0.01); + combinedCut.SetDeltaEtaStarCut(-0.01, 0.01); + combinedCut.SetDeltaEtaStarAxis(100, -0.1, 0.1); + combinedCut.SetDeltaPhiStarAxis(100, -0.1, 0.1); + combinedCut.SetOptionForAllCuts("re"); + combinedCut.MakeCutMonitors(); + task->AddCutsAndMonitors(combinedCut); +} + +Hal::FemtoBasicAna* MakeAna(Bool_t speedUp) +{ + Hal::FemtoBasicAna* task = new Hal::FemtoBasicAna(); + task->SetCorrFctn(Hal::FemtoCorrFuncKt(Hal::Femto1DCF("cf", 100, 0, 1, Hal::Femto::EKinematics::kLCMS), {0, 10})); + task->SetOption(Hal::TwoTrackAna::BackgroundOptionMixed()); + task->SetWeight(Hal::FemtoWeightGenerator()); + task->SetPdg(211); + task->SetMixSize(5); + if (speedUp) { + /** + * speed up analysis by using compression and special HBT format + * the sts exit distance and phi* are calculated once per track + */ + task->SetFormat(new HalCbmFullEvent(), Hal::EFormatDepth::kNonBuffered); + task->SetFormat(new HalCbmHbtFullEvent(), Hal::EFormatDepth::kBuffered); + task->SetFormatOption(Hal::EventAna::EFormatOption::kCompress); + } + else { + task->SetFormat(new HalCbmFullEvent()); + } + SetEventCut(task); + SetTrackCuts(task); + SetPairCuts(task); + + return task; +} diff --git a/macro/analysis/cbmfemto/show_hbt.C b/macro/analysis/cbmfemto/show_hbt.C index 0f83297b76b0a7764ad467952165b01406a97d6a..c34ffd172100d9f9324a22ba4f2126a2b4a33fad 100644 --- a/macro/analysis/cbmfemto/show_hbt.C +++ b/macro/analysis/cbmfemto/show_hbt.C @@ -1,34 +1,26 @@ -/* Copyright (C) 2020 Faculty of Physics, Warsaw University of Technology, Warsaw - SPDX-License-Identifier: GPL-3.0-only - Authors: Daniel Wielanek [committer] */ +/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw + SPDX-License-Identifier: GPL-3.0-only + Authors: Daniel Wielanek [committer] */ -/* - * show_hbt.C - * - * Created on: 21 paź 2020 - * Author: Daniel Wielanek - * E-mail: daniel.wielanek@gmail.com - * Warsaw University of Technology, Faculty of Physics - */ #ifndef __CLING__ +#include "AnaFile.h" +#include "Femto1DCF.h" +#include "FemtoCorrFuncKt.h" + #include <TCanvas.h> #include <TH1.h> - -#include "NicaAnaFile.h" -#include "NicaFemto1DCF.h" -#include "NicaFemtoCorrFuncKt.h" #endif void show_hbt() { - NicaAnaFile* f = new NicaAnaFile("test2.root"); - NicaFemtoCorrFuncKt* cf_kt = (NicaFemtoCorrFuncKt*) f->GetMainObject(2); - TH1* h = cf_kt->GetKtNum(); - NicaFemto1DCF* cf = (NicaFemto1DCF*) cf_kt->GetCF(0); + Hal::AnaFile* f = new Hal::AnaFile("test2.root"); + Hal::FemtoCorrFuncKt* cf_kt = (Hal::FemtoCorrFuncKt*) f->GetMainObject(2); + TH1* h = cf_kt->GetKtNum(); + Hal::Femto1DCF* cf = (Hal::Femto1DCF*) cf_kt->GetCF(0); - TH1* mon = f->GetHistogramPassed(ENicaCutUpdate::kTrackUpdate, 0, 3); + TH1* mon = f->GetHistogramPassed(Hal::ECutUpdate::kTrack, 0, 3); TCanvas* c = new TCanvas(); c->Divide(2, 2); diff --git a/macro/analysis/common/qa/run_qa_to_html.C b/macro/analysis/common/qa/run_qa_to_html.C index 6dfb753383cd186e6b180b173bd0f77c019c7faa..83062523f9341c464651dbffd95730b4564c3f80 100644 --- a/macro/analysis/common/qa/run_qa_to_html.C +++ b/macro/analysis/common/qa/run_qa_to_html.C @@ -2,6 +2,25 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Daniel Wielanek [committer] */ +#include <RtypesCore.h> +#include <TCollection.h> +#include <TDirectory.h> +#include <TDirectoryFile.h> +#include <TFile.h> +#include <TH1.h> +#include <TKey.h> +#include <TList.h> +#include <TNamed.h> +#include <TString.h> +#include <TSystem.h> +#ifndef __CLING__ + +#include "HtmlCore.h" +#include "HtmlFile.h" +#include "HtmlObject.h" +#include "HtmlTable.h" + +#endif /* * run_qa_to_html.C * simple macro for export of QA into html report @@ -18,10 +37,10 @@ void run_qa_to_html(TString rootFile = "cbm_qa.root", TString outDir = "html") TFile* f = new TFile(rootFile); TList* list = f->GetListOfKeys(); gSystem->mkdir(outDir); - NicaHtmlFile* html = new NicaHtmlFile(Form("%s/index.html", outDir.Data())); - NicaHtmlTable table("main_table", "nicatable", ""); - NicaHtmlRow row1("", "red_", ""); //id/class/style - NicaHtmlCellCol cell1("HtmlReport", 2); + Hal::HtmlFile* html = new Hal::HtmlFile(Form("%s/index.html", outDir.Data()), kTRUE); + Hal::HtmlTable table("main_table", "haltable", ""); + Hal::HtmlRow row1("", "red_", ""); //id/class/style + Hal::HtmlCellCol cell1("HtmlReport", 2); row1.AddContent(cell1); table.AddContent(row1); Int_t histo_count = 0; @@ -31,10 +50,10 @@ void run_qa_to_html(TString rootFile = "cbm_qa.root", TString outDir = "html") if (obj->InheritsFrom("TDirectory")) { TDirectory* dir = (TDirectory*) obj; TList* dirList = dir->GetListOfKeys(); - NicaHtmlRow dirRow("", "green_", ""); - dirRow.AddContent(NicaHtmlCell(dir->GetName())); - NicaHtmlCell cell2; - cell2.SetStringContent(NicaHtmlCore::GetHideButtonRow(Form("list_%i", i), "Show/Hide")); + Hal::HtmlRow dirRow("", "green_", ""); + dirRow.AddContent(Hal::HtmlCell(dir->GetName())); + Hal::HtmlCell cell2; + cell2.SetStringContent(Hal::HtmlCore::GetHideButtonRow(Form("list_%i", i), "Show/Hide")); dirRow.AddContent(cell2); table.AddContent(dirRow); for (int j = 0; j < dirList->GetEntries(); j++) { @@ -42,12 +61,12 @@ void run_qa_to_html(TString rootFile = "cbm_qa.root", TString outDir = "html") TObject* hobj = dir->Get(key2->GetName()); if (hobj->InheritsFrom("TH1")) { TH1* histo = (TH1*) hobj; - NicaHtmlRow rowHist("", Form("list_%i light_blue", i), "display:none"); - NicaHtmlCell cellName(key2->GetName()); + Hal::HtmlRow rowHist("", Form("list_%i light_blue", i), "display:none"); + Hal::HtmlCell cellName(key2->GetName()); cellName.SetClass("light_blue"); rowHist.AddContent(cellName); - NicaHtmlCell cellContent; - cellContent.SetStringContent(NicaHtmlCore::GetLinkToHistogram(histo, histo_count++, outDir)); + Hal::HtmlCell cellContent; + cellContent.SetStringContent(Hal::HtmlCore::GetLinkToHistogram(histo, histo_count++, outDir)); rowHist.AddContent(cellContent); table.AddContent(rowHist); }