CMS 3D CMS Logo

PrescalesVetosHelper.h
Go to the documentation of this file.
1 #ifndef PRESCALESVETOSHELPERS_H__
2 #define PRESCALESVETOSHELPERS_H__
3 
4 #include <cassert>
6 
7 // If you want to create a new object that you can read and write, use this constructor:
8 //
9 // l1t::PrescalesVetosHelper x(new L1TPrescalesVetors());
10 //
11 // If you wish to read the table from the EventSetup, and will only read, use this:
12 //
13 // const PrescalesVetosHelper * x = PrescalesVetosHelper::readFromEventSetup(...)
14 // //...
15 // delete x;
16 //
17 // If you wish to read the table from the EventSetup, but then be able to edit the values locally, use this:
18 //
19 // PrescalesVetorsHelper * x = PrescalesVetosHelper::readAndWriteFromEventSetup(...)
20 // //...
22 //
23 // but there's a performance penalty as a copy is made.
24 
25 //
26 // This class does not take over responsibility for deleting the pointers it is
27 // initialized with. That is responsibility of the calling code.
28 //
29 
30 namespace l1t {
31 
33  public:
34  enum { VERSION_ = 1 };
35 
37 
38  //ctor if creating a new table (e.g. from XML or python file)
40  //create for reading only, from the EventSetup:
42  // create for reading and writing, starting from the EventSetup:
44 
45  int bxMaskDefault() const { return read_->bxmask_default_; };
46  void setBxMaskDefault(int value) {
47  check_write();
49  };
50 
51  inline const std::vector<std::vector<int> >& prescaleTable() const { return read_->prescale_table_; };
52  void setPrescaleFactorTable(std::vector<std::vector<int> > value) {
53  check_write();
55  };
56  inline const std::vector<int>& triggerMaskVeto() const { return read_->veto_; };
57  void setTriggerMaskVeto(std::vector<int> value) {
58  check_write();
59  write_->veto_ = value;
60  };
61 
62  inline const std::map<int, std::vector<int> >& triggerAlgoBxMask() const { return read_->bxmask_map_; };
63  void setTriggerAlgoBxMask(std::map<int, std::vector<int> > value) {
64  check_write();
66  };
67 
68  // access to underlying pointers, mainly for ESProducer:
69  const L1TGlobalPrescalesVetos* getReadInstance() const { return read_; }
71 
72  private:
74  void useCopy();
75  void check_write() { assert(write_); }
76  // separating read from write allows for a high-performance read-only mode (as no copy is made):
77  const L1TGlobalPrescalesVetos* read_; // when reading/getting, use this.
78  L1TGlobalPrescalesVetos* write_; // when writing/setting, use this.
80  };
81 
82 } // namespace l1t
83 #endif
const std::vector< std::vector< int > > & prescaleTable() const
void setPrescaleFactorTable(std::vector< std::vector< int > > value)
const double w
Definition: UKUtility.cc:23
PrescalesVetosHelper(L1TGlobalPrescalesVetos *w)
std::map< int, std::vector< int > > bxmask_map_
delete x;
Definition: CaloConfig.h:22
const std::map< int, std::vector< int > > & triggerAlgoBxMask() const
static const PrescalesVetosHelper * readFromEventSetup(const L1TGlobalPrescalesVetos *es)
const std::vector< int > & triggerMaskVeto() const
Definition: value.py:1
void setTriggerMaskVeto(std::vector< int > value)
L1TGlobalPrescalesVetos * write_
const L1TGlobalPrescalesVetos * getReadInstance() const
std::vector< std::vector< int > > prescale_table_
const L1TGlobalPrescalesVetos * read_
void setTriggerAlgoBxMask(std::map< int, std::vector< int > > value)
L1TGlobalPrescalesVetos * getWriteInstance()
static PrescalesVetosHelper * readAndWriteFromEventSetup(const L1TGlobalPrescalesVetos *es)