CMS 3D CMS Logo

PrescalesVetosFractHelper.h
Go to the documentation of this file.
1 #ifndef PRESCALESVETOSFRACTHELPERS_H__
2 #define PRESCALESVETOSFRACTHELPERS_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::PrescalesVetosFractHelper x(new L1TPrescalesVetosFract());
10 //
11 // If you wish to read the table from the EventSetup, and will only read, use this:
12 //
13 // const PrescalesVetosFractHelper * x = PrescalesVetoFractsHelper::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 // PrescalesVetosFractHelper * x = PrescalesVetosFractHelper::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<double> >& prescaleTable() const { return read_->prescale_table_; };
52  void setPrescaleFactorTable(std::vector<std::vector<double> > 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:
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 L1TGlobalPrescalesVetosFract* read_; // when reading/getting, use this.
78  L1TGlobalPrescalesVetosFract* write_; // when writing/setting, use this.
80  };
81 
82 } // namespace l1t
83 #endif
l1t::PrescalesVetosFractHelper::setTriggerMaskVeto
void setTriggerMaskVeto(std::vector< int > value)
Definition: PrescalesVetosFractHelper.h:57
l1t::PrescalesVetosFractHelper::triggerMaskVeto
const std::vector< int > & triggerMaskVeto() const
Definition: PrescalesVetosFractHelper.h:56
L1TGlobalPrescalesVetosFract::veto_
std::vector< int > veto_
Definition: L1TGlobalPrescalesVetosFract.h:24
l1t::PrescalesVetosFractHelper::PrescalesVetosFractHelper
PrescalesVetosFractHelper(L1TGlobalPrescalesVetosFract *w)
Definition: PrescalesVetosFractHelper.cc:16
l1t::PrescalesVetosFractHelper::read_
const L1TGlobalPrescalesVetosFract * read_
Definition: PrescalesVetosFractHelper.h:77
cms::cuda::assert
assert(be >=bs)
l1t::PrescalesVetosFractHelper::readAndWriteFromEventSetup
static PrescalesVetosFractHelper * readAndWriteFromEventSetup(const L1TGlobalPrescalesVetosFract *es)
Definition: PrescalesVetosFractHelper.cc:9
l1t::PrescalesVetosFractHelper::setPrescaleFactorTable
void setPrescaleFactorTable(std::vector< std::vector< double > > value)
Definition: PrescalesVetosFractHelper.h:52
l1t::PrescalesVetosFractHelper::triggerAlgoBxMask
const std::map< int, std::vector< int > > & triggerAlgoBxMask() const
Definition: PrescalesVetosFractHelper.h:62
l1t::PrescalesVetosFractHelper::getReadInstance
const L1TGlobalPrescalesVetosFract * getReadInstance() const
Definition: PrescalesVetosFractHelper.h:69
l1t::PrescalesVetosFractHelper::check_write
void check_write()
Definition: PrescalesVetosFractHelper.h:75
w
const double w
Definition: UKUtility.cc:23
L1TGlobalPrescalesVetosFract.h
l1t::PrescalesVetosFractHelper
Definition: PrescalesVetosFractHelper.h:32
l1t::PrescalesVetosFractHelper::VERSION_
Definition: PrescalesVetosFractHelper.h:34
l1t
delete x;
Definition: CaloConfig.h:22
L1TGlobalPrescalesVetosFract
Definition: L1TGlobalPrescalesVetosFract.h:13
l1t::PrescalesVetosFractHelper::write_
L1TGlobalPrescalesVetosFract * write_
Definition: PrescalesVetosFractHelper.h:78
l1t::PrescalesVetosFractHelper::~PrescalesVetosFractHelper
~PrescalesVetosFractHelper()
Definition: PrescalesVetosFractHelper.cc:35
value
Definition: value.py:1
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
L1TGlobalPrescalesVetosFract::prescale_table_
std::vector< std::vector< double > > prescale_table_
Definition: L1TGlobalPrescalesVetosFract.h:21
l1t::PrescalesVetosFractHelper::setTriggerAlgoBxMask
void setTriggerAlgoBxMask(std::map< int, std::vector< int > > value)
Definition: PrescalesVetosFractHelper.h:63
L1TGlobalPrescalesVetosFract::bxmask_default_
int bxmask_default_
Definition: L1TGlobalPrescalesVetosFract.h:22
l1t::PrescalesVetosFractHelper::prescaleTable
const std::vector< std::vector< double > > & prescaleTable() const
Definition: PrescalesVetosFractHelper.h:51
l1t::PrescalesVetosFractHelper::getWriteInstance
L1TGlobalPrescalesVetosFract * getWriteInstance()
Definition: PrescalesVetosFractHelper.h:70
l1t::PrescalesVetosFractHelper::useCopy
void useCopy()
Definition: PrescalesVetosFractHelper.cc:29
l1t::PrescalesVetosFractHelper::bxMaskDefault
int bxMaskDefault() const
Definition: PrescalesVetosFractHelper.h:45
relativeConstraints.value
value
Definition: relativeConstraints.py:53
l1t::PrescalesVetosFractHelper::setBxMaskDefault
void setBxMaskDefault(int value)
Definition: PrescalesVetosFractHelper.h:46
l1t::PrescalesVetosFractHelper::readFromEventSetup
static const PrescalesVetosFractHelper * readFromEventSetup(const L1TGlobalPrescalesVetosFract *es)
Definition: PrescalesVetosFractHelper.cc:5
genParticles_cff.map
map
Definition: genParticles_cff.py:11
l1t::PrescalesVetosFractHelper::we_own_write_
bool we_own_write_
Definition: PrescalesVetosFractHelper.h:79
L1TGlobalPrescalesVetosFract::bxmask_map_
std::map< int, std::vector< int > > bxmask_map_
Definition: L1TGlobalPrescalesVetosFract.h:23