KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVFAZIATrigger.h
Go to the documentation of this file.
1 #ifndef __KVFAZIATRIGGER_H
2 #define __KVFAZIATRIGGER_H
3 
4 #include "KVBase.h"
5 #include "KVNameValueList.h"
6 #include <unordered_map>
7 
20 class KVFAZIATrigger : public KVBase {
21 public:
22  enum class TriggerPattern : uint8_t {
23  Mult1,
25  Mult2
26  };
27 private:
28  uint16_t fTriggerPattern;
29  mutable std::unordered_map<std::string, TriggerPattern> fTriggerPatterns = {
30  {"Mult1", TriggerPattern::Mult1},
31  {"Mult1/100", TriggerPattern::Mult1Downscale100},
32  {"Mult2", TriggerPattern::Mult2},
33  };
34  std::unordered_map<std::string, uint16_t> fTriggerNameToBitPattern;
35  mutable std::map<TriggerPattern, uint16_t> fTriggerEnumToBitPattern;
36 public:
37  void SetTriggerPattern(uint16_t tp)
38  {
40  fTriggerPattern = tp;
41  }
42  void AddTriggerPattern(const TString& name, uint16_t value)
43  {
45  fTriggerNameToBitPattern[name.Data()] = value;
47  }
48  std::vector<std::string> GetTriggerPatterns() const;
49  bool IsTrigger(TriggerPattern tp) const
50  {
53  }
54  bool IsTrigger(const std::string& tp) const
55  {
57  return IsTrigger(fTriggerPatterns[tp]);
58  }
59  void Print(Option_t* = "") const;
60 
61  ClassDef(KVFAZIATrigger, 1) //The trigger pattern for each FAZIA event
62 };
63 
64 #endif
uint8_t
const char Option_t
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:141
The trigger pattern for each FAZIA event.
bool IsTrigger(const std::string &tp) const
void AddTriggerPattern(const TString &name, uint16_t value)
bool IsTrigger(TriggerPattern tp) const
std::unordered_map< std::string, TriggerPattern > fTriggerPatterns
@ Mult2
M>=2 multiplicity trigger.
@ Mult1
Minimum bias M>=1 multiplicity trigger.
@ Mult1Downscale100
Downscaled (1/100) minimum bias M>=1 multiplicity trigger.
std::vector< std::string > GetTriggerPatterns() const
Returns the names of all trigger patterns which are known and set for the trigger.
std::map< TriggerPattern, uint16_t > fTriggerEnumToBitPattern
uint16_t fTriggerPattern
std::unordered_map< std::string, uint16_t > fTriggerNameToBitPattern
void Print(Option_t *="") const
Print defined trigger bit patterns with their meanings.
void SetTriggerPattern(uint16_t tp)
const char * Data() const