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
l1t::PrescalesVetosHelper::we_own_write_
bool we_own_write_
Definition: PrescalesVetosHelper.h:79
L1TGlobalPrescalesVetos::veto_
std::vector< int > veto_
Definition: L1TGlobalPrescalesVetos.h:24
l1t::PrescalesVetosHelper::~PrescalesVetosHelper
~PrescalesVetosHelper()
Definition: PrescalesVetosHelper.cc:34
l1t::PrescalesVetosHelper::read_
const L1TGlobalPrescalesVetos * read_
Definition: PrescalesVetosHelper.h:77
L1TGlobalPrescalesVetos::bxmask_map_
std::map< int, std::vector< int > > bxmask_map_
Definition: L1TGlobalPrescalesVetos.h:23
cms::cuda::assert
assert(be >=bs)
l1t::PrescalesVetosHelper::prescaleTable
const std::vector< std::vector< int > > & prescaleTable() const
Definition: PrescalesVetosHelper.h:51
l1t::PrescalesVetosHelper::getReadInstance
const L1TGlobalPrescalesVetos * getReadInstance() const
Definition: PrescalesVetosHelper.h:69
l1t::PrescalesVetosHelper::setPrescaleFactorTable
void setPrescaleFactorTable(std::vector< std::vector< int > > value)
Definition: PrescalesVetosHelper.h:52
l1t::PrescalesVetosHelper::triggerAlgoBxMask
const std::map< int, std::vector< int > > & triggerAlgoBxMask() const
Definition: PrescalesVetosHelper.h:62
l1t::PrescalesVetosHelper::readFromEventSetup
static const PrescalesVetosHelper * readFromEventSetup(const L1TGlobalPrescalesVetos *es)
Definition: PrescalesVetosHelper.cc:5
w
const double w
Definition: UKUtility.cc:23
L1TGlobalPrescalesVetos
Definition: L1TGlobalPrescalesVetos.h:13
l1t::PrescalesVetosHelper::setBxMaskDefault
void setBxMaskDefault(int value)
Definition: PrescalesVetosHelper.h:46
l1t::PrescalesVetosHelper::write_
L1TGlobalPrescalesVetos * write_
Definition: PrescalesVetosHelper.h:78
l1t::PrescalesVetosHelper
Definition: PrescalesVetosHelper.h:32
l1t::PrescalesVetosHelper::setTriggerAlgoBxMask
void setTriggerAlgoBxMask(std::map< int, std::vector< int > > value)
Definition: PrescalesVetosHelper.h:63
l1t
delete x;
Definition: CaloConfig.h:22
l1t::PrescalesVetosHelper::check_write
void check_write()
Definition: PrescalesVetosHelper.h:75
value
Definition: value.py:1
L1TGlobalPrescalesVetos.h
l1t::PrescalesVetosHelper::getWriteInstance
L1TGlobalPrescalesVetos * getWriteInstance()
Definition: PrescalesVetosHelper.h:70
relativeConstraints.value
value
Definition: relativeConstraints.py:53
L1TGlobalPrescalesVetos::bxmask_default_
int bxmask_default_
Definition: L1TGlobalPrescalesVetos.h:22
l1t::PrescalesVetosHelper::bxMaskDefault
int bxMaskDefault() const
Definition: PrescalesVetosHelper.h:45
l1t::PrescalesVetosHelper::setTriggerMaskVeto
void setTriggerMaskVeto(std::vector< int > value)
Definition: PrescalesVetosHelper.h:57
l1t::PrescalesVetosHelper::VERSION_
Definition: PrescalesVetosHelper.h:34
L1TGlobalPrescalesVetos::prescale_table_
std::vector< std::vector< int > > prescale_table_
Definition: L1TGlobalPrescalesVetos.h:21
genParticles_cff.map
map
Definition: genParticles_cff.py:11
l1t::PrescalesVetosHelper::readAndWriteFromEventSetup
static PrescalesVetosHelper * readAndWriteFromEventSetup(const L1TGlobalPrescalesVetos *es)
Definition: PrescalesVetosHelper.cc:9
l1t::PrescalesVetosHelper::useCopy
void useCopy()
Definition: PrescalesVetosHelper.cc:28
l1t::PrescalesVetosHelper::triggerMaskVeto
const std::vector< int > & triggerMaskVeto() const
Definition: PrescalesVetosHelper.h:56
l1t::PrescalesVetosHelper::PrescalesVetosHelper
PrescalesVetosHelper(L1TGlobalPrescalesVetos *w)
Definition: PrescalesVetosHelper.cc:15