Skip to content
Snippets Groups Projects
Commit d9d880d7 authored by Alexandru Bercuci's avatar Alexandru Bercuci
Browse files

update QA task according to MR 1949

parent d6f65099
No related branches found
No related tags found
1 merge request!1939Reco QA - primary vertex
This diff is collapsed.
...@@ -17,9 +17,7 @@ ...@@ -17,9 +17,7 @@
#include <map> #include <map>
#include <vector> #include <vector>
#define kRecoQaNConfigs 8
class FairMCPoint; class FairMCPoint;
class CbmEvent; class CbmEvent;
class CbmHit; class CbmHit;
class CbmMCDataManager; class CbmMCDataManager;
...@@ -28,6 +26,7 @@ class CbmTimeSlice; ...@@ -28,6 +26,7 @@ class CbmTimeSlice;
class TClonesArray; class TClonesArray;
class TH2; class TH2;
class TH2D; class TH2D;
class TVector3;
class CbmRecoQaTask : public FairTask { class CbmRecoQaTask : public FairTask {
public: public:
enum eRecoConfig enum eRecoConfig
...@@ -39,6 +38,8 @@ class CbmRecoQaTask : public FairTask { ...@@ -39,6 +38,8 @@ class CbmRecoQaTask : public FairTask {
kTofHits, /// has ToF hits (TofHit branch) kTofHits, /// has ToF hits (TofHit branch)
kRichHits, /// has Rich hits (RichHit branch) kRichHits, /// has Rich hits (RichHit branch)
kMuchHits, /// has Much hits (MuchHit branch) kMuchHits, /// has Much hits (MuchHit branch)
kUseMC, /// use MC even if available
kRecoQaNConfigs /// no of configuration flags
}; };
enum eSetup enum eSetup
{ {
...@@ -46,10 +47,18 @@ class CbmRecoQaTask : public FairTask { ...@@ -46,10 +47,18 @@ class CbmRecoQaTask : public FairTask {
kMcbm24, kMcbm24,
kDefault kDefault
}; };
enum class eViewProjection : int enum class eViewType : int
{
kDetUnit = 0, /// detector view
kTrkProj, /// set of track projection views
kPV /// primary vertex view
};
#define kNtrkProjections 6
enum class eProjectionType : int
{ {
kXYa = 0, /// X-Y hit coorelation in track filtered data kXYa = 0, /// X-Y hit coorelation in track filtered data
kXYp, /// X-Y track projections kXYp, /// X-Y track projections on detection unit
kXdX, /// X to TRK residuals as function of local X in view kXdX, /// X to TRK residuals as function of local X in view
kXdXMC, /// X to TRK residuals w.r.t MC points kXdXMC, /// X to TRK residuals w.r.t MC points
kYdY, /// Y to TRK residuals as function of local Y in view kYdY, /// Y to TRK residuals as function of local Y in view
...@@ -60,6 +69,8 @@ class CbmRecoQaTask : public FairTask { ...@@ -60,6 +69,8 @@ class CbmRecoQaTask : public FairTask {
kYpY, /// Y to TRK pulls as function of local Y 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 kChdT, /// Time to EV residuals as function of coordinate in view
kXYh, /// X-Y hit coorelation in local view kXYh, /// X-Y hit coorelation in local view
kDmult, /// local view hit multiplicity
kDmultMC, /// local view MC point multiplicity
kXYhMC, /// X-Y MC point coorelation in local view (using HitMatch) kXYhMC, /// X-Y MC point coorelation in local view (using HitMatch)
kPullX, /// Pull distribution X: (RC - MC) / dx_RC kPullX, /// Pull distribution X: (RC - MC) / dx_RC
kPullY, /// Pull distribution Y: kPullY, /// Pull distribution Y:
...@@ -67,63 +78,82 @@ class CbmRecoQaTask : public FairTask { ...@@ -67,63 +78,82 @@ class CbmRecoQaTask : public FairTask {
kResidualY, /// Residual distribution Y: kResidualY, /// Residual distribution Y:
kResidualTX, /// Residual distribution T: kResidualTX, /// Residual distribution T:
kResidualTY, /// Residual distribution T: kResidualTY, /// Residual distribution T:
kXYs /// X-Y hit coorelation in time slice kPVxy, /// x-y projection of the primary vertex:
kPVxz, /// x-z projection of the primary vertex:
kPVyz, /// y-z projection of the primary vertex:
kPVmult, /// y-z projection of the primary vertex:
kXYt0, /// X-Y track projections on a random plane (value 0)
kXYt1, /// X-Y track projections on a random plane (value 1)
kXYt2, /// X-Y track projections on a random plane (value 2)
kXYt3, /// X-Y track projections on a random plane (value 3)
kXYt4, /// X-Y track projections on a random plane (value 4)
kXYt5 /// X-Y track projections on a random plane (value 5)
}; };
// Generic view definition
struct Detector;
struct View {
friend struct Detector;
friend class CbmRecoQaTask;
View() = default;
View(const char* n, const char* p, std::vector<int> set) : name(n), path(p), fSelector(set) { ; }
virtual ~View() = default;
bool SetProjection(eProjectionType prj, float range, const char* unit);
template<class Hit>
bool HasAddress(const CbmHit* h, double& x, double& y, double& dx, double& dy) const;
template<class Hit>
bool Load(const CbmHit* h, const FairMCPoint* point, const CbmEvent* ev);
bool Load(const CbmKfTrackFitter::TrajectoryNode* n, const FairMCPoint* point);
bool Load(TVector3* p);
std::string ToString() const;
static std::string ToString(eProjectionType prj);
void SetSetup(CbmRecoQaTask::eSetup setup) { fSetup = setup; }
void SetType(CbmRecoQaTask::eViewType type) { fType = type; }
std::string name = ""; /// name describing the module
std::string path = ""; /// path to the geo volume describing the module
double size[3] = {0.}; /// detection element geometrical dx dy dz dimmensions
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<eProjectionType, 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].
int fMult = 0; /// multiplicity between 2 reset signals
mutable eSetup fSetup = eSetup::kMcbm22;
mutable eViewType fType = eViewType::kDetUnit;
protected:
bool AddProjection(eProjectionType prj, float range = -1, const char* unit = "cm");
/** \brief Define all type of QA histo known to the class.
* In case of detector view type, 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, bool mc = false);
/** \brief build directory structure for all projections of current
* view.*/
uint Register(TDirectoryFile* f);
/** \brief helper functions to estimate the representation (y) axis
* \param[in] scale read-only unit defining parameter
* \param[in] range read-write full range on the ordinate
* \return units for the ordinate and the range value
*/
std::string makeTrange(const int scale, float& range);
std::string makeYrange(const int scale, float& range);
ClassDef(CbmRecoQaTask::View,
1); // Stand-alone detection set to which QA is applied
}; // QA View definition
// Detector unit definition
struct Detector { struct Detector {
struct Data { struct Data {
Data() = default; Data() = default;
Data(ECbmDataType i, const char* n) : id(i), name(n) { ; } Data(ECbmDataType i, const char* n) : id(i), name(n) { ; }
ECbmDataType id = ECbmDataType::kUnknown; ECbmDataType id = ECbmDataType::kUnknown;
std::string name = "nn"; std::string name = "nn";
}; }; // Identifier of data to be monitored
struct View {
friend struct Detector;
friend class CbmRecoQaTask;
View() = default;
View(const char* n, const char* p, std::vector<int> set) : name(n), path(p), fSelector(set) { ; }
virtual ~View() = default;
bool SetProjection(eViewProjection prj, float range, const char* unit);
template<class Hit>
bool HasAddress(const CbmHit* h, double& x, double& y, double& dx, double& dy) const;
template<class Hit>
bool Load(const CbmHit* h, const FairMCPoint* point, const CbmEvent* ev);
bool Load(const CbmKfTrackFitter::TrajectoryNode* n, const FairMCPoint* point);
std::string ToString() const;
static std::string ToString(eViewProjection prj);
std::string name = ""; /// name describing the module
std::string path = ""; /// path to the geo volume describing the module
double size[3] = {0.}; /// detection element geometrical dx dy dz dimmensions
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].
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.
* 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.*/
uint Register(TDirectoryFile* f);
/** helper functions to estimate the representation (y) axis
* \param[in] scale read-only unit defining parameter
* \param[in] range read-write full range on the ordinate
* \return units for the ordinate and the range value
*/
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
};
Detector(ECbmModuleId did = ECbmModuleId::kNotExist); Detector(ECbmModuleId did = ECbmModuleId::kNotExist);
virtual ~Detector() = default; virtual ~Detector() = default;
View* AddView(const char* n, const char* p, std::vector<int> set); View* AddView(const char* n, const char* p, std::vector<int> set);
...@@ -133,7 +163,7 @@ class CbmRecoQaTask : public FairTask { ...@@ -133,7 +163,7 @@ class CbmRecoQaTask : public FairTask {
* main directory outut for the current detector. Failing to identify the * main directory outut for the current detector. Failing to identify the
* geometry will rezult in fatal error. \return true If ALL the subsequent * geometry will rezult in fatal error. \return true If ALL the subsequent
* calls to Init result in a true */ * calls to Init result in a true */
bool Init(TDirectoryFile* f); bool Init(TDirectoryFile* f, bool mc = false);
void Print() const; void Print() const;
ECbmModuleId id; ECbmModuleId id;
...@@ -143,7 +173,7 @@ class CbmRecoQaTask : public FairTask { ...@@ -143,7 +173,7 @@ class CbmRecoQaTask : public FairTask {
ClassDef(CbmRecoQaTask::Detector, ClassDef(CbmRecoQaTask::Detector,
1); // QA representation of a detector unit 1); // QA representation of a detector unit
}; }; // Detection system agregate
struct TrackFilter { struct TrackFilter {
enum class eTrackCut : int enum class eTrackCut : int
...@@ -172,7 +202,7 @@ class CbmRecoQaTask : public FairTask { ...@@ -172,7 +202,7 @@ class CbmRecoQaTask : public FairTask {
// ToF definition of track // ToF definition of track
int fNTof = -1; int fNTof = -1;
ClassDef(CbmRecoQaTask::TrackFilter, 1); // Track cut implementation ClassDef(CbmRecoQaTask::TrackFilter, 1); // Track cut implementation
}; }; // TrackFilter definition
struct EventFilter { struct EventFilter {
enum class eEventCut : int enum class eEventCut : int
...@@ -206,7 +236,7 @@ class CbmRecoQaTask : public FairTask { ...@@ -206,7 +236,7 @@ class CbmRecoQaTask : public FairTask {
void HelpMess() const; void HelpMess() const;
ClassDef(CbmRecoQaTask::EventFilter, 1); // Event cut implementation ClassDef(CbmRecoQaTask::EventFilter, 1); // Event cut implementation
}; }; // EventFilter definition
public: public:
CbmRecoQaTask(); CbmRecoQaTask();
...@@ -230,13 +260,17 @@ class CbmRecoQaTask : public FairTask { ...@@ -230,13 +260,17 @@ class CbmRecoQaTask : public FairTask {
virtual void Finish(); virtual void Finish();
/** \brief Define the set of extra z positions where the track should be // /** \brief Define the set of extra z positions where the track should be
* projected in the x-y plane */ // * projected in the x-y plane */
void SetProjections(std::vector<double> vzpj); // void SetProjections(std::vector<double> vzpj);
void SetSetupClass(CbmRecoQaTask::eSetup setup) { fSetupClass = setup; } void SetSetupClass(CbmRecoQaTask::eSetup setup) { fSetupClass = setup; }
TString GetGeoTagForDetector(const TString& detector); TString GetGeoTagForDetector(const TString& detector);
std::vector<TString> GetPath(TGeoNode* node, TString, TString activeNodeName, int depth = 0, std::vector<TString> GetPath(TGeoNode* node, TString, TString activeNodeName, int depth = 0,
const TString& path = ""); const TString& path = "");
void UseMC(bool set = true)
{
if (set) fuRecoConfig.set(kUseMC);
}
protected: protected:
static std::bitset<kRecoQaNConfigs> fuRecoConfig; static std::bitset<kRecoQaNConfigs> fuRecoConfig;
...@@ -255,6 +289,9 @@ class CbmRecoQaTask : public FairTask { ...@@ -255,6 +289,9 @@ class CbmRecoQaTask : public FairTask {
* \return true if track accepted * \return true if track accepted
*/ */
virtual bool FilterTrack(const CbmGlobalTrack* ptr); virtual bool FilterTrack(const CbmGlobalTrack* ptr);
/** \brief count views types registered with the task */
int GetNviews(eViewType type) const;
/** \brief build QA plots for particular setups */
void InitMcbm22(); void InitMcbm22();
void InitMcbm24(); void InitMcbm24();
void InitDefault(); void InitDefault();
...@@ -268,14 +305,14 @@ class CbmRecoQaTask : public FairTask { ...@@ -268,14 +305,14 @@ class CbmRecoQaTask : public FairTask {
std::map<ECbmModuleId, TClonesArray*> fHits = {}; //! reconstructed hits std::map<ECbmModuleId, TClonesArray*> fHits = {}; //! reconstructed hits
std::map<ECbmModuleId, CbmMCDataArray*> fPoints = {}; //! mc points std::map<ECbmModuleId, CbmMCDataArray*> fPoints = {}; //! mc points
std::map<ECbmModuleId, TClonesArray*> fHitMatch = {}; //! reconstructed hits std::map<ECbmModuleId, TClonesArray*> fHitMatch = {}; //! reconstructed hits
std::map<ECbmModuleId, Detector> fDetQa = {};
std::vector<EventFilter> fFilterEv = {}; std::vector<EventFilter> fFilterEv = {};
std::vector<TrackFilter> fFilterTrk = {}; std::vector<TrackFilter> fFilterTrk = {};
CbmMCDataManager* cbm_mc_manager{nullptr}; CbmMCDataManager* cbm_mc_manager = nullptr;
TDirectoryFile fOutFolder = {"RecoQA", "CA track driven reco QA"}; //! TDirectoryFile fOutFolder = {"RecoQA", "CA track driven reco QA"}; //!
eSetup fSetupClass = eSetup::kMcbm24; eSetup fSetupClass = eSetup::kMcbm24;
std::map<double, Detector::View> fProjs = {}; //! std::map<ECbmModuleId, Detector> fDetQa = {}; //! list of detector QA
std::map<const char*, View> fViews = {}; //! list of QA views
std::vector<TVector3> fPrjPlanes = {}; //! local storage for the z positions of track projection planes
ClassDef(CbmRecoQaTask, 1); // Reconstruction QA analyzed from CA perspective ClassDef(CbmRecoQaTask, 1); // Reconstruction QA analyzed from CA perspective
}; };
......
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