CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
const double w
Definition: UKUtility.cc:23
void setTriggerMaskVeto(std::vector< int > value)
static PrescalesVetosFractHelper * readAndWriteFromEventSetup(const L1TGlobalPrescalesVetosFract *es)
const std::vector< int > & triggerMaskVeto() const
PrescalesVetosFractHelper(L1TGlobalPrescalesVetosFract *w)
static const PrescalesVetosFractHelper * readFromEventSetup(const L1TGlobalPrescalesVetosFract *es)
std::vector< std::vector< double > > prescale_table_
assert(be >=bs)
L1TGlobalPrescalesVetosFract * getWriteInstance()
L1TGlobalPrescalesVetosFract * write_
const std::vector< std::vector< double > > & prescaleTable() const
const std::map< int, std::vector< int > > & triggerAlgoBxMask() const
void setTriggerAlgoBxMask(std::map< int, std::vector< int > > value)
std::map< int, std::vector< int > > bxmask_map_
const L1TGlobalPrescalesVetosFract * getReadInstance() const
void setPrescaleFactorTable(std::vector< std::vector< double > > value)
const L1TGlobalPrescalesVetosFract * read_