Commit 9b1c7425 authored by Administrator's avatar Administrator Committed by Florian Uhlig
Browse files

Remove a circular library dependency

There was a circular dependency between Littrack and CbmRichReco. The problem
only shows up when linking an executable.
The dependency could be resolved by moving some of the rich code into the
directory core/detectors/rich and splitting the littrack library into two parts.
The first library (Littrack) contains everything beside the littrack QA classes
and the second one (LittrackQA) contains only the QA code. Those files moved
from reco/detectors/rich had no dependencies to reco or sim.
parent d8163335
Set(INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}
${CBMROOT_SOURCE_DIR}/analysis/PWGDIL/dielectron/lmvm
${CBMROOT_SOURCE_DIR}/reco/base
#${CBMBASE_DIR}
${CBMBASE_DIR}/draw
${CBMBASE_DIR}/utils
......@@ -13,6 +9,11 @@ ${CBMDATA_DIR}/sts
${CBMDATA_DIR}/global
${CBMDATA_DIR}/rich
${CBMROOT_SOURCE_DIR}/core/detectors/rich/utils
${CBMROOT_SOURCE_DIR}/core/detectors/rich
${CBMROOT_SOURCE_DIR}/reco/base
${CBMROOT_SOURCE_DIR}/reco/KF
${CBMROOT_SOURCE_DIR}/reco/KF/Interface
......@@ -22,8 +23,7 @@ ${CBMROOT_SOURCE_DIR}/reco/L1/ParticleFinder
${CBMROOT_SOURCE_DIR}/reco/littrack/cbm/elid
${CBMROOT_SOURCE_DIR}/reco/detectors/rich
${CBMROOT_SOURCE_DIR}/reco/detectors/rich/utils
${CBMROOT_SOURCE_DIR}/analysis/PWGDIL/dielectron/lmvm
)
Include_Directories( ${INCLUDE_DIRECTORIES})
......
Set(INCLUDE_DIRECTORIES
#${CBMROOT_SOURCE_DIR}/analysis
${CMAKE_CURRENT_SOURCE_DIR}
${CBMROOT_SOURCE_DIR}/sim/transport/generators/unigen
${CBMBASE_DIR}
${CBMBASE_DIR}/draw
${CBMBASE_DIR}/report
......@@ -21,10 +17,9 @@ ${CBMDATA_DIR}/tof
${CBMDATA_DIR}/psd
${CBMROOT_SOURCE_DIR}/mvd
#${CBMROOT_SOURCE_DIR}/sts
${CBMROOT_SOURCE_DIR}/reco/detectors/rich
${CBMROOT_SOURCE_DIR}/core/detectors/rich
${CBMROOT_SOURCE_DIR}/run
${CBMROOT_SOURCE_DIR}/sim/transport/generators/unigen
${CBMROOT_SOURCE_DIR}/reco/KF
${CBMROOT_SOURCE_DIR}/reco/KF/Interface
......
Set(INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}
${CBMROOT_SOURCE_DIR}/analysis/PWGDIL/dielectron/lmvm
${CBMROOT_SOURCE_DIR}/reco/base
${CBMBASE_DIR}/draw
${CBMBASE_DIR}/utils
......@@ -14,6 +10,8 @@ ${CBMDATA_DIR}/sts
${CBMDATA_DIR}/global
${CBMDATA_DIR}/rich
${CBMROOT_SOURCE_DIR}/reco/base
${CBMROOT_SOURCE_DIR}/reco/KF
${CBMROOT_SOURCE_DIR}/reco/KF/Interface
......@@ -21,11 +19,14 @@ ${CBMROOT_SOURCE_DIR}/reco/L1
${CBMROOT_SOURCE_DIR}/reco/L1/L1Algo
${CBMROOT_SOURCE_DIR}/reco/L1/ParticleFinder
${CBMROOT_SOURCE_DIR}/littrack/cbm/elid
#${CBMROOT_SOURCE_DIR}/littrack/cbm/elid
${CBMROOT_SOURCE_DIR}/rich
#${CBMROOT_SOURCE_DIR}/rich
${CBMROOT_SOURCE_DIR}/reco/detectors/rich/fitter
${CBMROOT_SOURCE_DIR}/reco/detectors/rich/utils
${CBMROOT_SOURCE_DIR}/core/detectors/rich/utils
${CBMROOT_SOURCE_DIR}/analysis/PWGDIL/dielectron/lmvm
)
Include_Directories( ${INCLUDE_DIRECTORIES})
......
set(INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/utils
${CBMDATA_DIR}
${CBMDATA_DIR}/rich
${CBMDATA_DIR}/global
${CBMBASE_DIR}
${CBMBASE_DIR}/draw
......@@ -33,6 +35,7 @@ set(SRCS
)
set(NO_DICT_SRCS
CbmRichElectronIdAnn.cxx
CbmRichGeoManager.cxx
CbmRichDigiMapManager.cxx
CbmRichMCbmDigiMapManager.cxx
......
......@@ -6,16 +6,11 @@ ${CMAKE_CURRENT_SOURCE_DIR}/finder
${CMAKE_CURRENT_SOURCE_DIR}/fitter
${CMAKE_CURRENT_SOURCE_DIR}/tracks
${CMAKE_CURRENT_SOURCE_DIR}/selection
${CMAKE_CURRENT_SOURCE_DIR}/utils
${CMAKE_CURRENT_SOURCE_DIR}/qa
${CMAKE_CURRENT_SOURCE_DIR}/alignment
${CMAKE_CURRENT_SOURCE_DIR}/mcbm
${CMAKE_CURRENT_SOURCE_DIR}/unpack
${CBMROOT_SOURCE_DIR}/core/detectors/rich
${CBMROOT_SOURCE_DIR}/reco/base
${CBMBASE_DIR}
${CBMBASE_DIR}/report
${CBMBASE_DIR}/draw
......@@ -29,6 +24,11 @@ ${CBMDATA_DIR}/tof
${CBMDATA_DIR}/sts
${CBMDATA_DIR}/global
${CBMROOT_SOURCE_DIR}/core/detectors/rich
${CBMROOT_SOURCE_DIR}/core/detectors/rich/utils
${CBMROOT_SOURCE_DIR}/reco/base
${CBMROOT_SOURCE_DIR}/reco/littrack
${CBMROOT_SOURCE_DIR}/reco/littrack/std
${CBMROOT_SOURCE_DIR}/reco/littrack/std/base
......@@ -39,8 +39,6 @@ ${CBMROOT_SOURCE_DIR}/reco/KF
${CBMROOT_SOURCE_DIR}/reco/KF/Interface
${CBMROOT_SOURCE_DIR}/reco/L1/OffLineInterface
${CBMROOT_SOURCE_DIR}/run
)
Include_Directories( ${INCLUDE_DIRECTORIES})
......@@ -89,7 +87,6 @@ unpack/CbmRichUnpackConfig.cxx
)
set(NO_DICT_SRCS
CbmRichElectronIdAnn.cxx
CbmRichConverter.cxx
finder/CbmRichRingFinderIdeal.cxx
finder/CbmRichRingFinderHoughImpl.cxx
......
/* Copyright (C) 2019 Justus-Liebig-Universitaet Giessen, Giessen
SPDX-License-Identifier: GPL-3.0-only
Authors: Jordan Bendarouach [committer] */
#ifndef RICH_CbmRichUtil
#define RICH_CbmRichUtil
#include "CbmGlobalTrack.h"
#include "FairRootManager.h"
#include "FairTrackParam.h"
#include <Logger.h>
#include "TCanvas.h"
#include "TClonesArray.h"
#include "TH2.h"
#include "TObject.h"
#include <string>
using namespace std;
class CbmRichUtil {
public:
static Double_t GetRingTrackDistance(Int_t globalTrackId)
{
vector<Double_t> v = GetRingTrackDistanceImpl(globalTrackId);
return v[0];
}
static Double_t GetRingTrackDistanceX(Int_t globalTrackId)
{
vector<Double_t> v = GetRingTrackDistanceImpl(globalTrackId);
return v[1];
}
static Double_t GetRingTrackDistanceY(Int_t globalTrackId)
{
vector<Double_t> v = GetRingTrackDistanceImpl(globalTrackId);
return v[2];
}
private:
/**
* \brief Return a vector with total distance and x, y components. [0] - total distance, [1] - x component, [2] - y component
*/
static vector<Double_t> GetRingTrackDistanceImpl(Int_t globalTrackId)
{
vector<Double_t> errorVec = {999., 999., 999.};
FairRootManager* ioman = FairRootManager::Instance();
if (ioman == NULL) return errorVec;
// Do we really need static here, depends on ioman->GetObject() method
static TClonesArray* globalTracks = NULL;
static TClonesArray* richRings = NULL;
static TClonesArray* richProjections = NULL;
if (globalTracks == NULL || richRings == NULL || richProjections == NULL) {
//cout << "globalTracks == NULL || richRings == NULL || richProjections == NULL" << endl;
globalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
richRings = (TClonesArray*) ioman->GetObject("RichRing");
richProjections = (TClonesArray*) ioman->GetObject("RichProjection");
}
else {
//cout << "globalTracks, richRings, richProjections NOT NULL" << endl;
}
if (globalTracks == NULL || richRings == NULL || richProjections == NULL) {
LOG(error) << "CbmRichUtil::GetRingTrackDistance globalTracks, "
"richRings, richProjections NOT INITIALIZED"
<< endl;
return errorVec;
}
const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(globalTracks->At(globalTrackId));
if (globalTrack == NULL) return errorVec;
Int_t stsId = globalTrack->GetStsTrackIndex();
if (stsId < 0) return errorVec;
const FairTrackParam* pTrack = static_cast<const FairTrackParam*>(richProjections->At(stsId));
if (pTrack == NULL) return errorVec;
if (pTrack->GetX() == 0 && pTrack->GetY() == 0) return errorVec;
Int_t richId = globalTrack->GetRichRingIndex();
if (richId < 0) return errorVec;
const CbmRichRing* richRing = static_cast<const CbmRichRing*>(richRings->At(richId));
if (richRing == NULL) return errorVec;
Double_t xRing = richRing->GetCenterX();
Double_t yRing = richRing->GetCenterY();
Double_t dx = richRing->GetCenterX() - pTrack->GetX();
Double_t dy = richRing->GetCenterY() - pTrack->GetY();
Double_t dist = TMath::Sqrt(dx * dx + dy * dy);
vector<Double_t> v = {dist, dx, dy};
}
};
#endif
......@@ -23,9 +23,10 @@ ${CMAKE_CURRENT_SOURCE_DIR}/cbm/qa/radlength
${CMAKE_CURRENT_SOURCE_DIR}/cbm/qa/tof
${CBMROOT_SOURCE_DIR}/reco/base
# needed only for the LitrackQA library
${CBMROOT_SOURCE_DIR}/reco/detectors/rich
${CBMROOT_SOURCE_DIR}/reco/detectors/rich/fitter
${CBMROOT_SOURCE_DIR}/reco/detectors/rich/utils
${CBMBASE_DIR}
${CBMBASE_DIR}/report
......@@ -44,9 +45,8 @@ ${CBMDATA_DIR}/rich
${CBMDETECTORBASE_DIR}/much
${CBMDETECTORBASE_DIR}/sts
${CBMDETECTORBASE_DIR}/rich
${CBMDETECTORBASE_DIR}/rich/utils
${CBMROOT_SOURCE_DIR}/reco/KF
${CBMROOT_SOURCE_DIR}/reco/KF/Interface
......@@ -75,23 +75,17 @@ link_directories( ${LINK_DIRECTORIES})
set(SRCS
cbm/base/CbmLitDetectorSetup.cxx
cbm/elid/CbmLitGlobalElectronId.cxx
cbm/reco/CbmLitFindMvdTracks.cxx
cbm/reco/CbmLitFitTracksParallel.cxx
cbm/reco/CbmLitFitTracks.cxx
cbm/generators/CbmLitPolarizedGenerator.cxx
cbm/qa/base/CbmLitResultChecker.cxx
cbm/qa/material/CbmLitCheckEnergyLossMuons.cxx
cbm/qa/material/CbmLitCheckBrem.cxx
cbm/qa/mc/CbmLitMCTrack.cxx
cbm/qa/mc/CbmLitMCTrackCreator.cxx
cbm/qa/CbmLitCreateStandaloneData.cxx
cbm/qa/CbmLitTestMatrixMath.cxx
${LITTRACKSTD_SRCS}
cbm/base/CbmLitFieldGridCreator.cxx
cbm/base/CbmLitFieldFitter.cxx
cbm/base/CbmLitToolFactory.cxx
......@@ -100,8 +94,18 @@ set(SRCS
cbm/reco/CbmLitFindGlobalTracksIdeal.cxx
cbm/reco/CbmLitFindGlobalTracksParallel.cxx
cbm/utils/CbmLitConverterParallel.cxx
)
set(QA_SRCS
cbm/qa/base/CbmLitResultChecker.cxx
cbm/qa/material/CbmLitCheckEnergyLossMuons.cxx
cbm/qa/material/CbmLitCheckBrem.cxx
cbm/qa/mc/CbmLitMCTrack.cxx
cbm/qa/mc/CbmLitMCTrackCreator.cxx
cbm/qa/CbmLitCreateStandaloneData.cxx
cbm/qa/CbmLitTestMatrixMath.cxx
cbm/qa/tracking/CbmLitTrackingQa.cxx
cbm/qa/tracking/CbmLitTrackingQaStudyReport.cxx
cbm/qa/tracking/CbmLitTrackingQaStudyReport.cxx
cbm/qa/tracking/CbmLitTrackingQaReport.cxx
cbm/qa/clustering/CbmLitClusteringQa.cxx
cbm/qa/clustering/CbmLitClusteringQaReport.cxx
......@@ -129,8 +133,11 @@ set(HEADERS
cbm/reco/CbmLitFitTracks.h
cbm/reco/CbmLitFindGlobalTracksParallel.h
cbm/generators/CbmLitPolarizedGenerator.h
cbm/qa/material/CbmLitCheckEnergyLossMuons.h
cbm/qa/material/CbmLitCheckBrem.h
)
Set(QA_HEADERS
cbm/qa/material/CbmLitCheckEnergyLossMuons.h
cbm/qa/material/CbmLitCheckBrem.h
cbm/qa/CbmLitCreateStandaloneData.h
cbm/qa/CbmLitTestMatrixMath.h
cbm/qa/tracking/CbmLitTrackingQa.h
......@@ -139,7 +146,7 @@ set(HEADERS
cbm/qa/clustering/CbmLitClusteringQa.h
cbm/qa/clustering/CbmLitClusteringQaReport.h
cbm/qa/clustering/CbmLitClusteringQaStudyReport.h
cbm/qa/fit/CbmLitFitQa.h
cbm/qa/fit/CbmLitFitQa.h
cbm/qa/fit/CbmLitFitQaReport.h
cbm/qa/fit/CbmLitFitQaStudyReport.h
cbm/qa/field/CbmLitFieldQa.h
......@@ -174,7 +181,17 @@ EndIf (Boost_FOUND)
set(LINKDEF LittrackLinkDef.h)
Set(LIBRARY_NAME Littrack)
Set(DEPENDENCIES
Littrackparallel KF CbmMuchBase CbmStsBase CbmRichReco CbmRichBase CbmRecoBase CbmBase CbmData Base
Littrackparallel KF CbmMuchBase CbmStsBase CbmRichBase CbmRecoBase CbmBase CbmData Base
)
GENERATE_LIBRARY()
set(SRCS ${QA_SRCS})
set(HEADERS ${QA_HEADERS})
set(LINKDEF LittrackQALinkDef.h)
Set(LIBRARY_NAME LittrackQA)
Set(DEPENDENCIES
Littrack
)
GENERATE_LIBRARY()
......
......@@ -18,30 +18,6 @@
#pragma link C++ class CbmLitFindMvdTracks + ;
#pragma link C++ class CbmLitFindGlobalTracksIdeal + ;
#pragma link C++ class CbmLitTrackingQa + ;
#pragma link C++ class CbmLitClusteringQa + ;
#pragma link C++ class CbmLitFieldQa + ;
#pragma link C++ class CbmLitFieldApproximationQa + ;
#pragma link C++ class CbmLitFitQa + ;
#pragma link C++ class CbmLitRadLengthQa + ;
#pragma link C++ class CbmLitTofQa + ;
#pragma link C++ class CbmLitCheckEnergyLossMuons + ;
#pragma link C++ class CbmLitCheckBrem + ;
#pragma link C++ class CbmLitCreateStandaloneData + ;
#pragma link C++ class CbmLitTestMatrixMath + ;
#pragma link C++ class CbmLitFitTracksParallel + ;
#pragma link C++ class CbmLitTrackingQaReport + ;
#pragma link C++ class CbmLitTrackingQaStudyReport + ;
#pragma link C++ class CbmLitClusteringQaReport + ;
#pragma link C++ class CbmLitClusteringQaStudyReport + ;
#pragma link C++ class CbmLitFitQaReport + ;
#pragma link C++ class CbmLitFieldQaReport + ;
#pragma link C++ class CbmLitFitQaStudyReport + ;
#pragma link C++ class CbmLitFieldApproximationQaReport + ;
#pragma link C++ class CbmLitRadLengthQaReport + ;
#pragma link C++ class CbmLitTofQaReport + ;
#pragma link C++ class CbmLitRadLengthGenerator + ;
#endif
/* Copyright (C) 2006-2013 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Andrey Lebedev, Mohammad Al-Turany [committer] */
#ifdef __CINT__
#pragma link C++ class CbmLitTrackingQa + ;
#pragma link C++ class CbmLitClusteringQa + ;
#pragma link C++ class CbmLitFieldQa + ;
#pragma link C++ class CbmLitFieldApproximationQa + ;
#pragma link C++ class CbmLitFitQa + ;
#pragma link C++ class CbmLitRadLengthQa + ;
#pragma link C++ class CbmLitTofQa + ;
#pragma link C++ class CbmLitCheckEnergyLossMuons + ;
#pragma link C++ class CbmLitCheckBrem + ;
#pragma link C++ class CbmLitCreateStandaloneData + ;
#pragma link C++ class CbmLitTestMatrixMath + ;
#pragma link C++ class CbmLitTrackingQaReport + ;
#pragma link C++ class CbmLitTrackingQaStudyReport + ;
#pragma link C++ class CbmLitClusteringQaReport + ;
#pragma link C++ class CbmLitClusteringQaStudyReport + ;
#pragma link C++ class CbmLitFitQaReport + ;
#pragma link C++ class CbmLitFieldQaReport + ;
#pragma link C++ class CbmLitFitQaStudyReport + ;
#pragma link C++ class CbmLitFieldApproximationQaReport + ;
#pragma link C++ class CbmLitRadLengthQaReport + ;
#pragma link C++ class CbmLitTofQaReport + ;
#pragma link C++ class CbmLitRadLengthGenerator + ;
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment