Skip to content
Snippets Groups Projects
Commit 875e3c64 authored by Omveer Singh's avatar Omveer Singh Committed by Omveer_Singh
Browse files

Add full CbmSetup and MC info

correct file license

clang-format correction

correct license header

clang-format applied

fix bug: if file doesn't have CbmEvent branch

filtertrack checking uncommented

MC information is extracted from CbmMCDataArray using MCDataManager due to issues with matching in the case of timeslices.

Update author list

fix the issue if MCDataManager not found in Tree

event time correction incase of timeslice
parent 94040dab
No related branches found
No related tags found
No related merge requests found
Pipeline #30985 passed
This diff is collapsed.
/* Copyright (C) 2024 Hulubei National Institute of Physics and Nuclear Engineering - Horia Hulubei, Bucharest
SPDX-License-Identifier: GPL-3.0-only
Authors: Alexandru Bercuci [committer] */
Authors: Alexandru Bercuci [committer], Omveer Singh */
#ifndef CBMRECOQATASK_H
#define CBMRECOQATASK_H 1
......@@ -11,15 +11,19 @@
#include <FairTask.h>
#include <TDirectoryFile.h>
#include <TGeoNode.h>
#include <bitset>
#include <map>
#include <vector>
#define kRecoQaNConfigs 8
class FairMCPoint;
class CbmEvent;
class CbmHit;
class CbmMCDataManager;
class CbmMCDataArray;
class CbmTimeSlice;
class TClonesArray;
class TH2;
......@@ -44,16 +48,26 @@ class CbmRecoQaTask : public FairTask {
};
enum class eViewProjection : int
{
kXYa = 0, /// X-Y hit coorelation in track filtered data
kXYp, /// X-Y track projections
kXdX, /// X to TRK residuals as function of local X in view
kYdY, /// Y to TRK residuals as function of local Y in view
kWdT, /// Time to TRK residuals as function of local high resolution coordinate in view
kXpX, /// X to TRK pulls as function of local X in view
kYpY, /// Y to TRK pulls as function of local Y in view
kChdT, /// Time to EV residuals as function of coordinate in view
kXYh, /// X-Y hit coorelation in local view
kXYs /// X-Y hit coorelation in time slice
kXYa = 0, /// X-Y hit coorelation in track filtered data
kXYp, /// X-Y track projections
kXdX, /// X to TRK residuals as function of local X in view
kXdXMC, /// X to TRK residuals w.r.t MC points
kYdY, /// Y to TRK residuals as function of local Y in view
kYdYMC, /// Y to TRK residuals w.r.t MC points
kWdT, /// Time to TRK residuals as function of local high resolution
/// coordinate in view
kXpX, /// X to TRK pulls as function of local X in view
kYpY, /// Y to TRK pulls as function of local Y in view
kChdT, /// Time to EV residuals as function of coordinate in view
kXYh, /// X-Y hit coorelation in local view
kXYhMC, /// X-Y MC point coorelation in local view (using HitMatch)
kPullX, /// Pull distribution X: (RC - MC) / dx_RC
kPullY, /// Pull distribution Y:
kResidualX, /// Residual distribution X: (x_RC - x_MC) in cm
kResidualY, /// Residual distribution Y:
kResidualTX, /// Residual distribution T:
kResidualTY, /// Residual distribution T:
kXYs /// X-Y hit coorelation in time slice
};
struct Detector {
struct Data {
......@@ -71,10 +85,10 @@ class CbmRecoQaTask : public FairTask {
virtual ~View() = default;
bool SetProjection(eViewProjection prj, float range, const char* unit);
template<class Hit>
bool HasAddress(const CbmHit* h, double& x, double& y) const;
bool HasAddress(const CbmHit* h, double& x, double& y, double& dx, double& dy) const;
template<class Hit>
bool Load(const CbmHit* h, const CbmEvent* ev = nullptr);
bool Load(const CbmKfTrackFitter::FitNode* n);
bool Load(const CbmHit* h, const FairMCPoint* point, const CbmEvent* ev);
bool Load(const CbmKfTrackFitter::FitNode* n, const FairMCPoint* point);
std::string ToString() const;
static std::string ToString(eViewProjection prj);
......@@ -84,14 +98,20 @@ class CbmRecoQaTask : public FairTask {
double pos[3] = {0.}; /// detection element center x0 y0 z0
std::vector<int> fSelector = {}; /// defining subset of the address set for this view
std::map<eViewProjection, std::tuple<int, float, TH2*>> fProjection =
{}; /// map of projections indexed by their type. Each projection contains also the relative scale [int] wrt to default units (ns, cm, keV) and the range [float].
{}; /// map of projections indexed by their type. Each projection
/// contains also the relative scale [int] wrt to default units
/// (ns, cm, keV) and the range [float].
void SetMode(CbmRecoQaTask::eSetup setup) { fSetup = setup; }
mutable eSetup fSetup = eSetup::kMcbm22;
protected:
bool AddProjection(eViewProjection prj, float range = -1, const char* unit = "cm");
/** \brief convert geo address into pointer to geometry.
* By the time of the call the geometry has to be available in memory.
/** \brief convert geo address into pointer to geometry.
* By the time of the call the geometry has to be available in memory.
* Failing to identify the named physical node will rezult in error */
bool Init(const char* dname);
/** \brief build directory structure for all projections of current view.*/
/** \brief build directory structure for all projections of current
* view.*/
uint Register(TDirectoryFile* f);
/** helper functions to estimate the representation (y) axis
* \param[in] scale read-only unit defining parameter
......@@ -101,25 +121,28 @@ class CbmRecoQaTask : public FairTask {
std::string makeTrange(const int scale, float& range);
std::string makeYrange(const int scale, float& range);
ClassDef(CbmRecoQaTask::Detector::View, 1); // A QA significant correlation
ClassDef(CbmRecoQaTask::Detector::View,
1); // A QA significant correlation
};
Detector(ECbmModuleId did = ECbmModuleId::kNotExist);
virtual ~Detector() = default;
View* AddView(const char* n, const char* p, std::vector<int> set);
View* GetView(const char* n);
View* FindView(double x, double y, double z);
/** \brief Check geometry and trigger Init() for all registered views. Build main directory outut for the current detector.
* Failing to identify the geometry will rezult in fatal error.
* \return true If ALL the subsequent calls to Init result in a true */
/** \brief Check geometry and trigger Init() for all registered views. Build
* main directory outut for the current detector. Failing to identify the
* geometry will rezult in fatal error. \return true If ALL the subsequent
* calls to Init result in a true */
bool Init(TDirectoryFile* f);
void Print() const;
ECbmModuleId id;
Data hit;
Data hit, point;
Data trk;
std::vector<View> fViews = {};
ClassDef(CbmRecoQaTask::Detector, 1); // QA representation of a detector unit
ClassDef(CbmRecoQaTask::Detector,
1); // QA representation of a detector unit
};
struct TrackFilter {
......@@ -188,7 +211,8 @@ class CbmRecoQaTask : public FairTask {
public:
CbmRecoQaTask();
virtual ~CbmRecoQaTask() { ; }
/** Copy the qa test defined for detector det from the steering macro to the current class */
/** Copy the qa test defined for detector det from the steering macro to the
* current class */
virtual Detector* AddDetector(ECbmModuleId did);
virtual EventFilter* AddEventFilter(EventFilter::eEventCut cut);
virtual TrackFilter* AddTrackFilter(TrackFilter::eTrackCut cut);
......@@ -206,9 +230,13 @@ class CbmRecoQaTask : public FairTask {
virtual void Finish();
/** \brief Define the set of extra z positions where the track should be projected in the x-y plane */
/** \brief Define the set of extra z positions where the track should be
* projected in the x-y plane */
void SetProjections(std::vector<double> vzpj);
void SetSetupClass(CbmRecoQaTask::eSetup setup) { fSetupClass = setup; }
TString GetGeoTagForDetector(const TString& detector);
std::vector<TString> GetPath(TGeoNode* node, TString, TString activeNodeName, int depth = 0,
const TString& path = "");
protected:
static std::bitset<kRecoQaNConfigs> fuRecoConfig;
......@@ -217,29 +245,33 @@ class CbmRecoQaTask : public FairTask {
CbmRecoQaTask(const CbmRecoQaTask&);
CbmRecoQaTask& operator=(const CbmRecoQaTask&);
/** \brief Filter events for QA use (e.g. event multiplicity)
/** \brief Filter events for QA use (e.g. event multiplicity)
* \param[in] ptr cbm event
* \return true if event accepted
*/
virtual bool FilterEvent(const CbmEvent* ptr);
/** \brief Filter tracks for further use (e.g. track projections)
/** \brief Filter tracks for further use (e.g. track projections)
* \param[in] ptr global track
* \return true if track accepted
*/
virtual bool FilterTrack(const CbmGlobalTrack* ptr);
void InitMcbm22();
void InitMcbm24();
void InitDefault();
CbmKfTrackFitter fFitter;
TClonesArray* fGTracks = nullptr; //! reconstructed global tracks / event
std::map<ECbmModuleId, TClonesArray*> fTracks = {}; //! reconstructed global tracks / event
TClonesArray* fTrackMatches = nullptr; //! MC info for the global tracks
TClonesArray* fEvents = nullptr; //! reconstructed events
CbmTimeSlice* fTimeSlice = nullptr; //! Time slice info
std::map<ECbmModuleId, TClonesArray*> fHits = {}; //! reconstructed hits
std::map<ECbmModuleId, Detector> fDetQa = {};
std::vector<EventFilter> fFilterEv = {};
std::vector<TrackFilter> fFilterTrk = {};
TClonesArray* fGTracks = nullptr; //! reconstructed global tracks / event
std::map<ECbmModuleId, TClonesArray*> fTracks = {}; //! reconstructed global tracks / event
TClonesArray* fTrackMatches = nullptr; //! MC info for the global tracks
TClonesArray* fEvents = nullptr; //! reconstructed events
CbmTimeSlice* fTimeSlice = nullptr; //! Time slice info
std::map<ECbmModuleId, TClonesArray*> fHits = {}; //! reconstructed hits
std::map<ECbmModuleId, CbmMCDataArray*> fPoints = {}; //! mc points
std::map<ECbmModuleId, TClonesArray*> fHitMatch = {}; //! reconstructed hits
std::map<ECbmModuleId, Detector> fDetQa = {};
std::vector<EventFilter> fFilterEv = {};
std::vector<TrackFilter> fFilterTrk = {};
CbmMCDataManager* cbm_mc_manager{nullptr};
TDirectoryFile fOutFolder = {"RecoQA", "CA track driven reco QA"}; //!
eSetup fSetupClass = eSetup::kMcbm24;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment