CbmRoot
Loading...
Searching...
No Matches
CbmCutMap.h
Go to the documentation of this file.
1/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Dario Ramirez [committer] */
4
5#ifndef CBMCUTMAP_H
6#define CBMCUTMAP_H
7
8#include "CbmCut.h"
9#include "CbmEvent.h"
10#include "CbmStsHit.h"
11#include "CbmStsUtils.h"
12
13#include <TClonesArray.h>
14
19class CbmCutMap {
20 public:
21 CbmCutMap() = default;
22 ~CbmCutMap() = default;
23
28 std::unordered_map<CbmCutId, CbmCut<float>> GetMap() const { return fCbmCuts; }
29
36
43 bool Check(CbmCutId id, double value);
44
51 bool CheckStsHit(CbmStsHit*, TClonesArray*);
52
58 bool CheckEvent(CbmEvent* evt);
59
66 friend std::ostream& operator<<(std::ostream& out, const CbmCutMap& obj)
67 {
68 for (auto& [id, cut] : obj.GetMap()) {
69 out << ToString(id) << "\t" << cut << std::endl;
70 }
71 return out;
72 }
73
77 void Print()
78 {
79 for (auto& [id, cut] : fCbmCuts) {
80 std::cout << int(id) << ": " << cut << "\tFailed: " << fFailedCounter[id] << std::endl;
81 }
82 }
83
84 private:
85 std::unordered_map<CbmCutId, CbmCut<float>> fCbmCuts;
86 std::unordered_map<CbmCutId, unsigned long int> fFailedCounter;
87};
88
89#endif
std::string ToString(CbmCutId id)
Convert CbmCutId to a string representation.
Definition CbmCutId.cxx:7
CbmCutId
Enumeration of cut identifiers for various observables.
Definition CbmCutId.h:15
Data class for a reconstructed hit in the STS.
~CbmCutMap()=default
bool CheckEvent(CbmEvent *evt)
Check if a CbmEvent passes the cuts.
Definition CbmCutMap.cxx:36
std::unordered_map< CbmCutId, unsigned long int > fFailedCounter
Definition CbmCutMap.h:86
CbmCut< float > * AddCbmCut(CbmCutId id)
Add a new cut to the map.
Definition CbmCutMap.cxx:7
std::unordered_map< CbmCutId, CbmCut< float > > GetMap() const
Get the map of cuts.
Definition CbmCutMap.h:28
CbmCutMap()=default
std::unordered_map< CbmCutId, CbmCut< float > > fCbmCuts
Definition CbmCutMap.h:85
bool CheckStsHit(CbmStsHit *, TClonesArray *)
Check if a CbmStsHit passes the cuts.
Definition CbmCutMap.cxx:20
void Print()
Print the cuts and failed pass counters.
Definition CbmCutMap.h:77
friend std::ostream & operator<<(std::ostream &out, const CbmCutMap &obj)
Overloaded stream insertion operator for CbmCutMap.
Definition CbmCutMap.h:66
bool Check(CbmCutId id, double value)
Check if a value passes the cut with the given ID.
Definition CbmCutMap.cxx:9
Class characterising one event by a collection of links (indices) to data objects,...
Definition CbmEvent.h:34
data class for a reconstructed 3-d hit in the STS
Definition CbmStsHit.h:35